@medplum/react 1.0.5 → 2.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.
- package/README.md +2 -1
- package/dist/cjs/MoneyDisplay/MoneyDisplay.d.ts +6 -0
- package/dist/cjs/MoneyInput/MoneyInput.d.ts +10 -0
- package/dist/cjs/MoneyInput/MoneyInput.stories.d.ts +6 -0
- package/dist/cjs/OperationOutcomeAlert/OperationOutcomeAlert.d.ts +6 -0
- package/dist/cjs/auth/AuthenticationForm.d.ts +15 -1
- package/dist/cjs/auth/SignInForm.d.ts +1 -0
- package/dist/cjs/{index.js → index.cjs} +675 -549
- package/dist/cjs/index.cjs.map +1 -0
- package/dist/cjs/index.d.ts +2 -0
- package/dist/cjs/index.min.cjs +1 -0
- package/dist/esm/AddressDisplay/{AddressDisplay.js → AddressDisplay.mjs} +1 -1
- package/dist/esm/AddressDisplay/AddressDisplay.mjs.map +1 -0
- package/dist/esm/AddressInput/{AddressInput.js → AddressInput.mjs} +9 -9
- package/dist/esm/AddressInput/AddressInput.mjs.map +1 -0
- package/dist/esm/AnnotationInput/{AnnotationInput.js → AnnotationInput.mjs} +2 -2
- package/dist/esm/AnnotationInput/AnnotationInput.mjs.map +1 -0
- package/dist/esm/AsyncAutocomplete/{AsyncAutocomplete.js → AsyncAutocomplete.mjs} +7 -10
- package/dist/esm/AsyncAutocomplete/AsyncAutocomplete.mjs.map +1 -0
- package/dist/esm/AttachmentArrayDisplay/{AttachmentArrayDisplay.js → AttachmentArrayDisplay.mjs} +2 -2
- package/dist/esm/AttachmentArrayDisplay/AttachmentArrayDisplay.mjs.map +1 -0
- package/dist/esm/AttachmentArrayInput/{AttachmentArrayInput.js → AttachmentArrayInput.mjs} +6 -7
- package/dist/esm/AttachmentArrayInput/AttachmentArrayInput.mjs.map +1 -0
- package/dist/esm/AttachmentButton/{AttachmentButton.js → AttachmentButton.mjs} +5 -7
- package/dist/esm/AttachmentButton/AttachmentButton.mjs.map +1 -0
- package/dist/esm/AttachmentDisplay/AttachmentDisplay.mjs +21 -0
- package/dist/esm/AttachmentDisplay/AttachmentDisplay.mjs.map +1 -0
- package/dist/esm/AttachmentInput/{AttachmentInput.js → AttachmentInput.mjs} +5 -5
- package/dist/esm/AttachmentInput/AttachmentInput.mjs.map +1 -0
- package/dist/esm/BackboneElementDisplay/{BackboneElementDisplay.js → BackboneElementDisplay.mjs} +4 -4
- package/dist/esm/BackboneElementDisplay/BackboneElementDisplay.mjs.map +1 -0
- package/dist/esm/BackboneElementInput/{BackboneElementInput.js → BackboneElementInput.mjs} +10 -11
- package/dist/esm/BackboneElementInput/BackboneElementInput.mjs.map +1 -0
- package/dist/esm/CalendarInput/{CalendarInput.js → CalendarInput.mjs} +1 -1
- package/dist/esm/CalendarInput/CalendarInput.mjs.map +1 -0
- package/dist/esm/CheckboxFormSection/{CheckboxFormSection.js → CheckboxFormSection.mjs} +1 -1
- package/dist/esm/CheckboxFormSection/CheckboxFormSection.mjs.map +1 -0
- package/dist/esm/CodeInput/{CodeInput.js → CodeInput.mjs} +3 -3
- package/dist/esm/CodeInput/CodeInput.mjs.map +1 -0
- package/dist/esm/CodeableConceptDisplay/{CodeableConceptDisplay.js → CodeableConceptDisplay.mjs} +1 -1
- package/dist/esm/CodeableConceptDisplay/CodeableConceptDisplay.mjs.map +1 -0
- package/dist/esm/CodeableConceptInput/{CodeableConceptInput.js → CodeableConceptInput.mjs} +3 -4
- package/dist/esm/CodeableConceptInput/CodeableConceptInput.mjs.map +1 -0
- package/dist/esm/CodingDisplay/{CodingDisplay.js → CodingDisplay.mjs} +1 -1
- package/dist/esm/CodingDisplay/CodingDisplay.mjs.map +1 -0
- package/dist/esm/CodingInput/{CodingInput.js → CodingInput.mjs} +2 -2
- package/dist/esm/CodingInput/CodingInput.mjs.map +1 -0
- package/dist/esm/ContactDetailDisplay/{ContactDetailDisplay.js → ContactDetailDisplay.mjs} +4 -5
- package/dist/esm/ContactDetailDisplay/ContactDetailDisplay.mjs.map +1 -0
- package/dist/esm/ContactDetailInput/{ContactDetailInput.js → ContactDetailInput.mjs} +6 -7
- package/dist/esm/ContactDetailInput/ContactDetailInput.mjs.map +1 -0
- package/dist/esm/ContactPointDisplay/{ContactPointDisplay.js → ContactPointDisplay.mjs} +1 -1
- package/dist/esm/ContactPointDisplay/ContactPointDisplay.mjs.map +1 -0
- package/dist/esm/ContactPointInput/{ContactPointInput.js → ContactPointInput.mjs} +7 -7
- package/dist/esm/ContactPointInput/ContactPointInput.mjs.map +1 -0
- package/dist/esm/Container/{Container.js → Container.mjs} +3 -4
- package/dist/esm/Container/Container.mjs.map +1 -0
- package/dist/esm/DateTimeInput/{DateTimeInput.js → DateTimeInput.mjs} +2 -2
- package/dist/esm/DateTimeInput/DateTimeInput.mjs.map +1 -0
- package/dist/esm/DefaultResourceTimeline/{DefaultResourceTimeline.js → DefaultResourceTimeline.mjs} +2 -2
- package/dist/esm/DefaultResourceTimeline/DefaultResourceTimeline.mjs.map +1 -0
- package/dist/esm/DescriptionList/{DescriptionList.js → DescriptionList.mjs} +1 -1
- package/dist/esm/DescriptionList/DescriptionList.mjs.map +1 -0
- package/dist/esm/DiagnosticReportDisplay/{DiagnosticReportDisplay.js → DiagnosticReportDisplay.mjs} +13 -16
- package/dist/esm/DiagnosticReportDisplay/DiagnosticReportDisplay.mjs.map +1 -0
- package/dist/esm/Document/Document.mjs +12 -0
- package/dist/esm/Document/Document.mjs.map +1 -0
- package/dist/esm/EncounterTimeline/{EncounterTimeline.js → EncounterTimeline.mjs} +2 -2
- package/dist/esm/EncounterTimeline/EncounterTimeline.mjs.map +1 -0
- package/dist/esm/ErrorBoundary/{ErrorBoundary.js → ErrorBoundary.mjs} +1 -1
- package/dist/esm/ErrorBoundary/ErrorBoundary.mjs.map +1 -0
- package/dist/esm/ExtensionInput/{ExtensionInput.js → ExtensionInput.mjs} +1 -1
- package/dist/esm/ExtensionInput/ExtensionInput.mjs.map +1 -0
- package/dist/esm/FhirPathDisplay/{FhirPathDisplay.js → FhirPathDisplay.mjs} +2 -2
- package/dist/esm/FhirPathDisplay/FhirPathDisplay.mjs.map +1 -0
- package/dist/esm/FhirPathTable/{FhirPathTable.js → FhirPathTable.mjs} +14 -17
- package/dist/esm/FhirPathTable/FhirPathTable.mjs.map +1 -0
- package/dist/esm/Form/{Form.js → Form.mjs} +2 -2
- package/dist/esm/Form/Form.mjs.map +1 -0
- package/dist/esm/Form/{FormUtils.js → FormUtils.mjs} +1 -1
- package/dist/esm/Form/FormUtils.mjs.map +1 -0
- package/dist/esm/FormSection/{FormSection.js → FormSection.mjs} +2 -2
- package/dist/esm/FormSection/FormSection.mjs.map +1 -0
- package/dist/esm/GoogleButton/{GoogleButton.js → GoogleButton.mjs} +4 -5
- package/dist/esm/GoogleButton/GoogleButton.mjs.map +1 -0
- package/dist/esm/HumanNameDisplay/{HumanNameDisplay.js → HumanNameDisplay.mjs} +1 -1
- package/dist/esm/HumanNameDisplay/HumanNameDisplay.mjs.map +1 -0
- package/dist/esm/HumanNameInput/HumanNameInput.mjs +50 -0
- package/dist/esm/HumanNameInput/HumanNameInput.mjs.map +1 -0
- package/dist/esm/IdentifierDisplay/IdentifierDisplay.mjs +11 -0
- package/dist/esm/IdentifierDisplay/IdentifierDisplay.mjs.map +1 -0
- package/dist/esm/IdentifierInput/{IdentifierInput.js → IdentifierInput.mjs} +3 -3
- package/dist/esm/IdentifierInput/IdentifierInput.mjs.map +1 -0
- package/dist/esm/Logo/{Logo.js → Logo.mjs} +1 -1
- package/dist/esm/Logo/Logo.mjs.map +1 -0
- package/dist/esm/MedplumLink/{MedplumLink.js → MedplumLink.mjs} +5 -6
- package/dist/esm/MedplumLink/MedplumLink.mjs.map +1 -0
- package/dist/esm/MedplumProvider/{MedplumProvider.js → MedplumProvider.mjs} +9 -3
- package/dist/esm/MedplumProvider/MedplumProvider.mjs.map +1 -0
- package/dist/esm/MoneyDisplay/MoneyDisplay.d.ts +6 -0
- package/dist/esm/MoneyDisplay/MoneyDisplay.mjs +9 -0
- package/dist/esm/MoneyDisplay/MoneyDisplay.mjs.map +1 -0
- package/dist/esm/MoneyInput/MoneyInput.d.ts +10 -0
- package/dist/esm/MoneyInput/MoneyInput.mjs +53 -0
- package/dist/esm/MoneyInput/MoneyInput.mjs.map +1 -0
- package/dist/esm/MoneyInput/MoneyInput.stories.d.ts +6 -0
- package/dist/esm/OperationOutcomeAlert/OperationOutcomeAlert.d.ts +6 -0
- package/dist/esm/OperationOutcomeAlert/OperationOutcomeAlert.mjs +13 -0
- package/dist/esm/OperationOutcomeAlert/OperationOutcomeAlert.mjs.map +1 -0
- package/dist/esm/Panel/{Panel.js → Panel.mjs} +3 -4
- package/dist/esm/Panel/Panel.mjs.map +1 -0
- package/dist/esm/PatientTimeline/{PatientTimeline.js → PatientTimeline.mjs} +2 -2
- package/dist/esm/PatientTimeline/PatientTimeline.mjs.map +1 -0
- package/dist/esm/PeriodInput/{PeriodInput.js → PeriodInput.mjs} +4 -4
- package/dist/esm/PeriodInput/PeriodInput.mjs.map +1 -0
- package/dist/esm/PlanDefinitionBuilder/{PlanDefinitionBuilder.js → PlanDefinitionBuilder.mjs} +36 -24
- package/dist/esm/PlanDefinitionBuilder/PlanDefinitionBuilder.mjs.map +1 -0
- package/dist/esm/QuantityDisplay/{QuantityDisplay.js → QuantityDisplay.mjs} +1 -1
- package/dist/esm/QuantityDisplay/QuantityDisplay.mjs.map +1 -0
- package/dist/esm/QuantityInput/{QuantityInput.js → QuantityInput.mjs} +13 -5
- package/dist/esm/QuantityInput/QuantityInput.mjs.map +1 -0
- package/dist/esm/QuestionnaireBuilder/{QuestionnaireBuilder.js → QuestionnaireBuilder.mjs} +45 -27
- package/dist/esm/QuestionnaireBuilder/QuestionnaireBuilder.mjs.map +1 -0
- package/dist/esm/QuestionnaireForm/{QuestionnaireForm.js → QuestionnaireForm.mjs} +36 -36
- package/dist/esm/QuestionnaireForm/QuestionnaireForm.mjs.map +1 -0
- package/dist/esm/RangeDisplay/{RangeDisplay.js → RangeDisplay.mjs} +1 -1
- package/dist/esm/RangeDisplay/RangeDisplay.mjs.map +1 -0
- package/dist/esm/RangeInput/{RangeInput.js → RangeInput.mjs} +10 -4
- package/dist/esm/RangeInput/RangeInput.mjs.map +1 -0
- package/dist/esm/RatioDisplay/{RatioDisplay.js → RatioDisplay.mjs} +2 -2
- package/dist/esm/RatioDisplay/RatioDisplay.mjs.map +1 -0
- package/dist/esm/RatioInput/{RatioInput.js → RatioInput.mjs} +10 -4
- package/dist/esm/RatioInput/RatioInput.mjs.map +1 -0
- package/dist/esm/ReferenceDisplay/{ReferenceDisplay.js → ReferenceDisplay.mjs} +2 -2
- package/dist/esm/ReferenceDisplay/ReferenceDisplay.mjs.map +1 -0
- package/dist/esm/ReferenceInput/{ReferenceInput.js → ReferenceInput.mjs} +10 -5
- package/dist/esm/ReferenceInput/ReferenceInput.mjs.map +1 -0
- package/dist/esm/ReferenceRangeEditor/{ReferenceRangeEditor.js → ReferenceRangeEditor.mjs} +44 -38
- package/dist/esm/ReferenceRangeEditor/ReferenceRangeEditor.mjs.map +1 -0
- package/dist/esm/RequestGroupDisplay/{RequestGroupDisplay.js → RequestGroupDisplay.mjs} +14 -17
- package/dist/esm/RequestGroupDisplay/RequestGroupDisplay.mjs.map +1 -0
- package/dist/esm/ResourceArrayDisplay/{ResourceArrayDisplay.js → ResourceArrayDisplay.mjs} +4 -5
- package/dist/esm/ResourceArrayDisplay/ResourceArrayDisplay.mjs.map +1 -0
- package/dist/esm/ResourceArrayInput/{ResourceArrayInput.js → ResourceArrayInput.mjs} +3 -3
- package/dist/esm/ResourceArrayInput/ResourceArrayInput.mjs.map +1 -0
- package/dist/esm/ResourceAvatar/ResourceAvatar.mjs +23 -0
- package/dist/esm/ResourceAvatar/ResourceAvatar.mjs.map +1 -0
- package/dist/esm/ResourceBadge/{ResourceBadge.js → ResourceBadge.mjs} +3 -3
- package/dist/esm/ResourceBadge/ResourceBadge.mjs.map +1 -0
- package/dist/esm/ResourceBlame/{ResourceBlame.js → ResourceBlame.mjs} +6 -7
- package/dist/esm/ResourceBlame/ResourceBlame.mjs.map +1 -0
- package/dist/esm/ResourceDiff/{ResourceDiff.js → ResourceDiff.mjs} +4 -4
- package/dist/esm/ResourceDiff/ResourceDiff.mjs.map +1 -0
- package/dist/esm/ResourceDiffTable/{ResourceDiffTable.js → ResourceDiffTable.mjs} +3 -3
- package/dist/esm/ResourceDiffTable/ResourceDiffTable.mjs.map +1 -0
- package/dist/esm/ResourceForm/{ResourceForm.js → ResourceForm.mjs} +5 -5
- package/dist/esm/ResourceForm/ResourceForm.mjs.map +1 -0
- package/dist/esm/ResourceHistoryTable/{ResourceHistoryTable.js → ResourceHistoryTable.mjs} +10 -13
- package/dist/esm/ResourceHistoryTable/ResourceHistoryTable.mjs.map +1 -0
- package/dist/esm/ResourceInput/{ResourceInput.js → ResourceInput.mjs} +18 -24
- package/dist/esm/ResourceInput/ResourceInput.mjs.map +1 -0
- package/dist/esm/ResourceName/ResourceName.mjs +18 -0
- package/dist/esm/ResourceName/ResourceName.mjs.map +1 -0
- package/dist/esm/ResourcePropertyDisplay/{ResourcePropertyDisplay.js → ResourcePropertyDisplay.mjs} +23 -21
- package/dist/esm/ResourcePropertyDisplay/ResourcePropertyDisplay.mjs.map +1 -0
- package/dist/esm/ResourcePropertyInput/{ResourcePropertyInput.js → ResourcePropertyInput.mjs} +34 -34
- package/dist/esm/ResourcePropertyInput/ResourcePropertyInput.mjs.map +1 -0
- package/dist/esm/ResourceTable/{ResourceTable.js → ResourceTable.mjs} +4 -4
- package/dist/esm/ResourceTable/ResourceTable.mjs.map +1 -0
- package/dist/esm/ResourceTimeline/{ResourceTimeline.js → ResourceTimeline.mjs} +26 -30
- package/dist/esm/ResourceTimeline/ResourceTimeline.mjs.map +1 -0
- package/dist/esm/Scheduler/{Scheduler.js → Scheduler.mjs} +8 -9
- package/dist/esm/Scheduler/Scheduler.mjs.map +1 -0
- package/dist/esm/SearchControl/{SearchControl.js → SearchControl.mjs} +66 -50
- package/dist/esm/SearchControl/SearchControl.mjs.map +1 -0
- package/dist/esm/SearchControl/{SearchControlField.js → SearchControlField.mjs} +3 -4
- package/dist/esm/SearchControl/SearchControlField.mjs.map +1 -0
- package/dist/esm/SearchControl/{SearchUtils.js → SearchUtils.mjs} +34 -17
- package/dist/esm/SearchControl/SearchUtils.mjs.map +1 -0
- package/dist/esm/SearchFieldEditor/{SearchFieldEditor.js → SearchFieldEditor.mjs} +28 -21
- package/dist/esm/SearchFieldEditor/SearchFieldEditor.mjs.map +1 -0
- package/dist/esm/SearchFilterEditor/{SearchFilterEditor.js → SearchFilterEditor.mjs} +8 -9
- package/dist/esm/SearchFilterEditor/SearchFilterEditor.mjs.map +1 -0
- package/dist/esm/SearchFilterValueDialog/{SearchFilterValueDialog.js → SearchFilterValueDialog.mjs} +5 -6
- package/dist/esm/SearchFilterValueDialog/SearchFilterValueDialog.mjs.map +1 -0
- package/dist/esm/SearchFilterValueDisplay/{SearchFilterValueDisplay.js → SearchFilterValueDisplay.mjs} +3 -4
- package/dist/esm/SearchFilterValueDisplay/SearchFilterValueDisplay.mjs.map +1 -0
- package/dist/esm/SearchFilterValueInput/{SearchFilterValueInput.js → SearchFilterValueInput.mjs} +5 -6
- package/dist/esm/SearchFilterValueInput/SearchFilterValueInput.mjs.map +1 -0
- package/dist/esm/SearchPopupMenu/{SearchPopupMenu.js → SearchPopupMenu.mjs} +10 -10
- package/dist/esm/SearchPopupMenu/SearchPopupMenu.mjs.map +1 -0
- package/dist/esm/ServiceRequestTimeline/{ServiceRequestTimeline.js → ServiceRequestTimeline.mjs} +2 -2
- package/dist/esm/ServiceRequestTimeline/ServiceRequestTimeline.mjs.map +1 -0
- package/dist/esm/StatusBadge/{StatusBadge.js → StatusBadge.mjs} +1 -1
- package/dist/esm/StatusBadge/StatusBadge.mjs.map +1 -0
- package/dist/esm/Timeline/{Timeline.js → Timeline.mjs} +11 -13
- package/dist/esm/Timeline/Timeline.mjs.map +1 -0
- package/dist/esm/TimingInput/{TimingInput.js → TimingInput.mjs} +13 -18
- package/dist/esm/TimingInput/TimingInput.mjs.map +1 -0
- package/dist/esm/ValueSetAutocomplete/ValueSetAutocomplete.mjs +43 -0
- package/dist/esm/ValueSetAutocomplete/ValueSetAutocomplete.mjs.map +1 -0
- package/dist/esm/auth/AuthenticationForm.d.ts +15 -1
- package/dist/esm/auth/AuthenticationForm.mjs +88 -0
- package/dist/esm/auth/AuthenticationForm.mjs.map +1 -0
- package/dist/esm/auth/ChooseProfileForm.mjs +29 -0
- package/dist/esm/auth/ChooseProfileForm.mjs.map +1 -0
- package/dist/esm/auth/{ChooseScopeForm.js → ChooseScopeForm.mjs} +4 -4
- package/dist/esm/auth/ChooseScopeForm.mjs.map +1 -0
- package/dist/esm/auth/{MfaForm.js → MfaForm.mjs} +4 -4
- package/dist/esm/auth/MfaForm.mjs.map +1 -0
- package/dist/esm/auth/{NewProjectForm.js → NewProjectForm.mjs} +8 -9
- package/dist/esm/auth/NewProjectForm.mjs.map +1 -0
- package/dist/esm/auth/{NewUserForm.js → NewUserForm.mjs} +16 -21
- package/dist/esm/auth/NewUserForm.mjs.map +1 -0
- package/dist/esm/auth/{RegisterForm.js → RegisterForm.mjs} +5 -5
- package/dist/esm/auth/RegisterForm.mjs.map +1 -0
- package/dist/esm/auth/SignInForm.d.ts +1 -0
- package/dist/esm/auth/{SignInForm.js → SignInForm.mjs} +36 -29
- package/dist/esm/auth/SignInForm.mjs.map +1 -0
- package/dist/esm/{constants.js → constants.mjs} +1 -1
- package/dist/esm/constants.mjs.map +1 -0
- package/dist/esm/index.d.ts +2 -0
- package/dist/esm/index.min.mjs +1 -0
- package/dist/esm/{index.js → index.mjs} +88 -86
- package/dist/esm/index.mjs.map +1 -0
- package/dist/esm/useResource/{useResource.js → useResource.mjs} +2 -2
- package/dist/esm/useResource/useResource.mjs.map +1 -0
- package/dist/esm/utils/{blame.js → blame.mjs} +6 -9
- package/dist/esm/utils/blame.mjs.map +1 -0
- package/dist/esm/utils/{date.js → date.mjs} +2 -3
- package/dist/esm/utils/date.mjs.map +1 -0
- package/dist/esm/utils/{diff.js → diff.mjs} +1 -1
- package/dist/esm/utils/diff.mjs.map +1 -0
- package/dist/esm/utils/{dom.js → dom.mjs} +1 -1
- package/dist/esm/utils/dom.mjs.map +1 -0
- package/dist/esm/utils/outcomes.mjs +30 -0
- package/dist/esm/utils/outcomes.mjs.map +1 -0
- package/dist/esm/utils/{questionnaire.js → questionnaire.mjs} +1 -1
- package/dist/esm/utils/questionnaire.mjs.map +1 -0
- package/dist/esm/utils/{recaptcha.js → recaptcha.mjs} +5 -6
- package/dist/esm/utils/recaptcha.mjs.map +1 -0
- package/dist/esm/utils/{script.js → script.mjs} +1 -1
- package/dist/esm/utils/script.mjs.map +1 -0
- package/package.json +22 -22
- package/rollup.config.mjs +6 -7
- package/dist/cjs/auth/OktaButton.d.ts +0 -5
- package/dist/cjs/index.js.map +0 -1
- package/dist/cjs/index.min.js +0 -2
- package/dist/cjs/index.min.js.map +0 -1
- package/dist/esm/AddressDisplay/AddressDisplay.js.map +0 -1
- package/dist/esm/AddressInput/AddressInput.js.map +0 -1
- package/dist/esm/AnnotationInput/AnnotationInput.js.map +0 -1
- package/dist/esm/AsyncAutocomplete/AsyncAutocomplete.js.map +0 -1
- package/dist/esm/AttachmentArrayDisplay/AttachmentArrayDisplay.js.map +0 -1
- package/dist/esm/AttachmentArrayInput/AttachmentArrayInput.js.map +0 -1
- package/dist/esm/AttachmentButton/AttachmentButton.js.map +0 -1
- package/dist/esm/AttachmentDisplay/AttachmentDisplay.js +0 -21
- package/dist/esm/AttachmentDisplay/AttachmentDisplay.js.map +0 -1
- package/dist/esm/AttachmentInput/AttachmentInput.js.map +0 -1
- package/dist/esm/BackboneElementDisplay/BackboneElementDisplay.js.map +0 -1
- package/dist/esm/BackboneElementInput/BackboneElementInput.js.map +0 -1
- package/dist/esm/CalendarInput/CalendarInput.js.map +0 -1
- package/dist/esm/CheckboxFormSection/CheckboxFormSection.js.map +0 -1
- package/dist/esm/CodeInput/CodeInput.js.map +0 -1
- package/dist/esm/CodeableConceptDisplay/CodeableConceptDisplay.js.map +0 -1
- package/dist/esm/CodeableConceptInput/CodeableConceptInput.js.map +0 -1
- package/dist/esm/CodingDisplay/CodingDisplay.js.map +0 -1
- package/dist/esm/CodingInput/CodingInput.js.map +0 -1
- package/dist/esm/ContactDetailDisplay/ContactDetailDisplay.js.map +0 -1
- package/dist/esm/ContactDetailInput/ContactDetailInput.js.map +0 -1
- package/dist/esm/ContactPointDisplay/ContactPointDisplay.js.map +0 -1
- package/dist/esm/ContactPointInput/ContactPointInput.js.map +0 -1
- package/dist/esm/Container/Container.js.map +0 -1
- package/dist/esm/DateTimeInput/DateTimeInput.js.map +0 -1
- package/dist/esm/DefaultResourceTimeline/DefaultResourceTimeline.js.map +0 -1
- package/dist/esm/DescriptionList/DescriptionList.js.map +0 -1
- package/dist/esm/DiagnosticReportDisplay/DiagnosticReportDisplay.js.map +0 -1
- package/dist/esm/Document/Document.js +0 -13
- package/dist/esm/Document/Document.js.map +0 -1
- package/dist/esm/EncounterTimeline/EncounterTimeline.js.map +0 -1
- package/dist/esm/ErrorBoundary/ErrorBoundary.js.map +0 -1
- package/dist/esm/ExtensionInput/ExtensionInput.js.map +0 -1
- package/dist/esm/FhirPathDisplay/FhirPathDisplay.js.map +0 -1
- package/dist/esm/FhirPathTable/FhirPathTable.js.map +0 -1
- package/dist/esm/Form/Form.js.map +0 -1
- package/dist/esm/Form/FormUtils.js.map +0 -1
- package/dist/esm/FormSection/FormSection.js.map +0 -1
- package/dist/esm/GoogleButton/GoogleButton.js.map +0 -1
- package/dist/esm/HumanNameDisplay/HumanNameDisplay.js.map +0 -1
- package/dist/esm/HumanNameInput/HumanNameInput.js +0 -39
- package/dist/esm/HumanNameInput/HumanNameInput.js.map +0 -1
- package/dist/esm/IdentifierDisplay/IdentifierDisplay.js +0 -12
- package/dist/esm/IdentifierDisplay/IdentifierDisplay.js.map +0 -1
- package/dist/esm/IdentifierInput/IdentifierInput.js.map +0 -1
- package/dist/esm/Logo/Logo.js.map +0 -1
- package/dist/esm/MedplumLink/MedplumLink.js.map +0 -1
- package/dist/esm/MedplumProvider/MedplumProvider.js.map +0 -1
- package/dist/esm/Panel/Panel.js.map +0 -1
- package/dist/esm/PatientTimeline/PatientTimeline.js.map +0 -1
- package/dist/esm/PeriodInput/PeriodInput.js.map +0 -1
- package/dist/esm/PlanDefinitionBuilder/PlanDefinitionBuilder.js.map +0 -1
- package/dist/esm/QuantityDisplay/QuantityDisplay.js.map +0 -1
- package/dist/esm/QuantityInput/QuantityInput.js.map +0 -1
- package/dist/esm/QuestionnaireBuilder/QuestionnaireBuilder.js.map +0 -1
- package/dist/esm/QuestionnaireForm/QuestionnaireForm.js.map +0 -1
- package/dist/esm/RangeDisplay/RangeDisplay.js.map +0 -1
- package/dist/esm/RangeInput/RangeInput.js.map +0 -1
- package/dist/esm/RatioDisplay/RatioDisplay.js.map +0 -1
- package/dist/esm/RatioInput/RatioInput.js.map +0 -1
- package/dist/esm/ReferenceDisplay/ReferenceDisplay.js.map +0 -1
- package/dist/esm/ReferenceInput/ReferenceInput.js.map +0 -1
- package/dist/esm/ReferenceRangeEditor/ReferenceRangeEditor.js.map +0 -1
- package/dist/esm/RequestGroupDisplay/RequestGroupDisplay.js.map +0 -1
- package/dist/esm/ResourceArrayDisplay/ResourceArrayDisplay.js.map +0 -1
- package/dist/esm/ResourceArrayInput/ResourceArrayInput.js.map +0 -1
- package/dist/esm/ResourceAvatar/ResourceAvatar.js +0 -24
- package/dist/esm/ResourceAvatar/ResourceAvatar.js.map +0 -1
- package/dist/esm/ResourceBadge/ResourceBadge.js.map +0 -1
- package/dist/esm/ResourceBlame/ResourceBlame.js.map +0 -1
- package/dist/esm/ResourceDiff/ResourceDiff.js.map +0 -1
- package/dist/esm/ResourceDiffTable/ResourceDiffTable.js.map +0 -1
- package/dist/esm/ResourceForm/ResourceForm.js.map +0 -1
- package/dist/esm/ResourceHistoryTable/ResourceHistoryTable.js.map +0 -1
- package/dist/esm/ResourceInput/ResourceInput.js.map +0 -1
- package/dist/esm/ResourceName/ResourceName.js +0 -19
- package/dist/esm/ResourceName/ResourceName.js.map +0 -1
- package/dist/esm/ResourcePropertyDisplay/ResourcePropertyDisplay.js.map +0 -1
- package/dist/esm/ResourcePropertyInput/ResourcePropertyInput.js.map +0 -1
- package/dist/esm/ResourceTable/ResourceTable.js.map +0 -1
- package/dist/esm/ResourceTimeline/ResourceTimeline.js.map +0 -1
- package/dist/esm/Scheduler/Scheduler.js.map +0 -1
- package/dist/esm/SearchControl/SearchControl.js.map +0 -1
- package/dist/esm/SearchControl/SearchControlField.js.map +0 -1
- package/dist/esm/SearchControl/SearchUtils.js.map +0 -1
- package/dist/esm/SearchFieldEditor/SearchFieldEditor.js.map +0 -1
- package/dist/esm/SearchFilterEditor/SearchFilterEditor.js.map +0 -1
- package/dist/esm/SearchFilterValueDialog/SearchFilterValueDialog.js.map +0 -1
- package/dist/esm/SearchFilterValueDisplay/SearchFilterValueDisplay.js.map +0 -1
- package/dist/esm/SearchFilterValueInput/SearchFilterValueInput.js.map +0 -1
- package/dist/esm/SearchPopupMenu/SearchPopupMenu.js.map +0 -1
- package/dist/esm/ServiceRequestTimeline/ServiceRequestTimeline.js.map +0 -1
- package/dist/esm/StatusBadge/StatusBadge.js.map +0 -1
- package/dist/esm/Timeline/Timeline.js.map +0 -1
- package/dist/esm/TimingInput/TimingInput.js.map +0 -1
- package/dist/esm/ValueSetAutocomplete/ValueSetAutocomplete.js +0 -45
- package/dist/esm/ValueSetAutocomplete/ValueSetAutocomplete.js.map +0 -1
- package/dist/esm/auth/AuthenticationForm.js +0 -54
- package/dist/esm/auth/AuthenticationForm.js.map +0 -1
- package/dist/esm/auth/ChooseProfileForm.js +0 -32
- package/dist/esm/auth/ChooseProfileForm.js.map +0 -1
- package/dist/esm/auth/ChooseScopeForm.js.map +0 -1
- package/dist/esm/auth/MfaForm.js.map +0 -1
- package/dist/esm/auth/NewProjectForm.js.map +0 -1
- package/dist/esm/auth/NewUserForm.js.map +0 -1
- package/dist/esm/auth/OktaButton.d.ts +0 -5
- package/dist/esm/auth/RegisterForm.js.map +0 -1
- package/dist/esm/auth/SignInForm.js.map +0 -1
- package/dist/esm/constants.js.map +0 -1
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/index.min.js +0 -2
- package/dist/esm/index.min.js.map +0 -1
- package/dist/esm/node_modules/tslib/tslib.es6.js +0 -39
- package/dist/esm/node_modules/tslib/tslib.es6.js.map +0 -1
- package/dist/esm/useResource/useResource.js.map +0 -1
- package/dist/esm/utils/blame.js.map +0 -1
- package/dist/esm/utils/date.js.map +0 -1
- package/dist/esm/utils/diff.js.map +0 -1
- package/dist/esm/utils/dom.js.map +0 -1
- package/dist/esm/utils/outcomes.js +0 -29
- package/dist/esm/utils/outcomes.js.map +0 -1
- package/dist/esm/utils/questionnaire.js.map +0 -1
- package/dist/esm/utils/recaptcha.js.map +0 -1
- package/dist/esm/utils/script.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IdentifierInput.mjs","sources":["../../../src/IdentifierInput/IdentifierInput.tsx"],"sourcesContent":["import { Group, TextInput } from '@mantine/core';\nimport { Identifier } from '@medplum/fhirtypes';\nimport React, { useState } from 'react';\n\nexport interface IdentifierInputProps {\n name: string;\n defaultValue?: Identifier;\n onChange?: (value: Identifier) => void;\n}\n\nexport function IdentifierInput(props: IdentifierInputProps): JSX.Element {\n const [value, setValue] = useState(props.defaultValue);\n\n function setValueWrapper(newValue: Identifier): void {\n setValue(newValue);\n if (props.onChange) {\n props.onChange(newValue);\n }\n }\n\n return (\n <Group spacing=\"xs\" grow noWrap>\n <TextInput\n placeholder=\"System\"\n defaultValue={value?.system}\n onChange={(e) => setValueWrapper({ ...value, system: e.currentTarget.value })}\n />\n <TextInput\n placeholder=\"Value\"\n defaultValue={value?.value}\n onChange={(e) => setValueWrapper({ ...value, value: e.currentTarget.value })}\n />\n </Group>\n );\n}\n"],"names":[],"mappings":";;;AAUM,SAAU,eAAe,CAAC,KAA2B,EAAA;AACzD,IAAA,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;IAEvD,SAAS,eAAe,CAAC,QAAoB,EAAA;QAC3C,QAAQ,CAAC,QAAQ,CAAC,CAAC;QACnB,IAAI,KAAK,CAAC,QAAQ,EAAE;AAClB,YAAA,KAAK,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;AAC1B,SAAA;KACF;IAED,QACE,KAAC,CAAA,aAAA,CAAA,KAAK,EAAC,EAAA,OAAO,EAAC,IAAI,EAAC,IAAI,EAAA,IAAA,EAAC,MAAM,EAAA,IAAA,EAAA;AAC7B,QAAA,KAAA,CAAA,aAAA,CAAC,SAAS,EAAA,EACR,WAAW,EAAC,QAAQ,EACpB,YAAY,EAAE,KAAK,EAAE,MAAM,EAC3B,QAAQ,EAAE,CAAC,CAAC,KAAK,eAAe,CAAC,EAAE,GAAG,KAAK,EAAE,MAAM,EAAE,CAAC,CAAC,aAAa,CAAC,KAAK,EAAE,CAAC,EAC7E,CAAA;AACF,QAAA,KAAA,CAAA,aAAA,CAAC,SAAS,EACR,EAAA,WAAW,EAAC,OAAO,EACnB,YAAY,EAAE,KAAK,EAAE,KAAK,EAC1B,QAAQ,EAAE,CAAC,CAAC,KAAK,eAAe,CAAC,EAAE,GAAG,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC,aAAa,CAAC,KAAK,EAAE,CAAC,EAC5E,CAAA,CACI,EACR;AACJ;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Logo.mjs","sources":["../../../src/Logo/Logo.tsx"],"sourcesContent":["import React from 'react';\n\nexport interface LogoProps {\n size: number;\n fill?: string;\n}\n\nexport function Logo(props: LogoProps): JSX.Element {\n return (\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 491 491\" style={{ width: props.size, height: props.size }}>\n <title>Medplum Logo</title>\n <path fill={props.fill || '#ad7136'} d=\"M282 67c6-16 16-29 29-40L289 0c-22 17-37 41-43 68l17 23 19-24z\" />\n <path\n fill={props.fill || '#946af9'}\n d=\"M311 63c-17 0-33 4-48 11-16-7-32-11-49-11-87 0-158 96-158 214s71 214 158 214c17 0 33-4 49-11 15 7 31 11 48 11 87 0 158-96 158-214S398 63 311 63z\"\n />\n <path\n fill={props.fill || '#7857c5'}\n d=\"M231 489l-17 2c-87 0-158-96-158-214S127 63 214 63l17 1c-39 12-70 102-70 213s31 201 70 212z\"\n />\n <path\n fill={props.fill || '#40bc26'}\n d=\"M207 220a176 176 0 01-177 43A176 176 0 01251 43l1 5c17 59 2 125-45 172z\"\n />\n <path fill={props.fill || '#33961e'} d=\"M252 48A421 421 0 0057 270l-27-7A176 176 0 01251 43l1 5z\" />\n </svg>\n );\n}\n"],"names":[],"mappings":";;AAOM,SAAU,IAAI,CAAC,KAAgB,EAAA;IACnC,QACE,KAAK,CAAA,aAAA,CAAA,KAAA,EAAA,EAAA,KAAK,EAAC,4BAA4B,EAAC,OAAO,EAAC,aAAa,EAAC,KAAK,EAAE,EAAE,KAAK,EAAE,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,IAAI,EAAE,EAAA;QAC5G,KAA2B,CAAA,aAAA,CAAA,OAAA,EAAA,IAAA,EAAA,cAAA,CAAA;QAC3B,KAAM,CAAA,aAAA,CAAA,MAAA,EAAA,EAAA,IAAI,EAAE,KAAK,CAAC,IAAI,IAAI,SAAS,EAAE,CAAC,EAAC,gEAAgE,EAAG,CAAA;QAC1G,KACE,CAAA,aAAA,CAAA,MAAA,EAAA,EAAA,IAAI,EAAE,KAAK,CAAC,IAAI,IAAI,SAAS,EAC7B,CAAC,EAAC,kJAAkJ,EACpJ,CAAA;QACF,KACE,CAAA,aAAA,CAAA,MAAA,EAAA,EAAA,IAAI,EAAE,KAAK,CAAC,IAAI,IAAI,SAAS,EAC7B,CAAC,EAAC,4FAA4F,EAC9F,CAAA;QACF,KACE,CAAA,aAAA,CAAA,MAAA,EAAA,EAAA,IAAI,EAAE,KAAK,CAAC,IAAI,IAAI,SAAS,EAC7B,CAAC,EAAC,yEAAyE,EAC3E,CAAA;AACF,QAAA,KAAA,CAAA,aAAA,CAAA,MAAA,EAAA,EAAM,IAAI,EAAE,KAAK,CAAC,IAAI,IAAI,SAAS,EAAE,CAAC,EAAC,0DAA0D,EAAG,CAAA,CAChG,EACN;AACJ;;;;"}
|
|
@@ -1,17 +1,16 @@
|
|
|
1
|
-
import { __rest } from '../node_modules/tslib/tslib.es6.js';
|
|
2
1
|
import { Anchor } from '@mantine/core';
|
|
3
2
|
import React from 'react';
|
|
4
3
|
import { useNavigate } from 'react-router-dom';
|
|
5
|
-
import { killEvent } from '../utils/dom.
|
|
4
|
+
import { killEvent } from '../utils/dom.mjs';
|
|
6
5
|
|
|
7
6
|
function MedplumLink(props) {
|
|
8
7
|
const navigate = useNavigate();
|
|
9
|
-
const { to, suffix, label, onClick, children
|
|
8
|
+
const { to, suffix, label, onClick, children, ...rest } = props;
|
|
10
9
|
let href = getHref(to);
|
|
11
10
|
if (suffix) {
|
|
12
11
|
href += '/' + suffix;
|
|
13
12
|
}
|
|
14
|
-
return (React.createElement(Anchor,
|
|
13
|
+
return (React.createElement(Anchor, { href: href, "aria-label": label, onClick: (e) => {
|
|
15
14
|
killEvent(e);
|
|
16
15
|
if (onClick) {
|
|
17
16
|
onClick();
|
|
@@ -19,7 +18,7 @@ function MedplumLink(props) {
|
|
|
19
18
|
else if (to) {
|
|
20
19
|
navigate(href);
|
|
21
20
|
}
|
|
22
|
-
}
|
|
21
|
+
}, ...rest }, children));
|
|
23
22
|
}
|
|
24
23
|
function getHref(to) {
|
|
25
24
|
if (to) {
|
|
@@ -49,4 +48,4 @@ function getReferenceHref(to) {
|
|
|
49
48
|
}
|
|
50
49
|
|
|
51
50
|
export { MedplumLink };
|
|
52
|
-
//# sourceMappingURL=MedplumLink.
|
|
51
|
+
//# sourceMappingURL=MedplumLink.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MedplumLink.mjs","sources":["../../../src/MedplumLink/MedplumLink.tsx"],"sourcesContent":["import { Anchor, TextProps } from '@mantine/core';\nimport { Reference, Resource } from '@medplum/fhirtypes';\nimport React from 'react';\nimport { useNavigate } from 'react-router-dom';\nimport { killEvent } from '../utils/dom';\n\nexport interface MedplumLinkProps extends TextProps {\n to?: Resource | Reference | string;\n suffix?: string;\n label?: string;\n onClick?: () => void;\n children: React.ReactNode;\n}\n\nexport function MedplumLink(props: MedplumLinkProps): JSX.Element {\n const navigate = useNavigate();\n const { to, suffix, label, onClick, children, ...rest } = props;\n\n let href = getHref(to);\n if (suffix) {\n href += '/' + suffix;\n }\n\n return (\n <Anchor\n href={href}\n aria-label={label}\n onClick={(e: React.SyntheticEvent) => {\n killEvent(e);\n if (onClick) {\n onClick();\n } else if (to) {\n navigate(href);\n }\n }}\n {...rest}\n >\n {children}\n </Anchor>\n );\n}\n\nfunction getHref(to: Resource | Reference | string | undefined): string {\n if (to) {\n if (typeof to === 'string') {\n return getStringHref(to);\n } else if ('resourceType' in to) {\n return getResourceHref(to);\n } else if ('reference' in to) {\n return getReferenceHref(to);\n }\n }\n return '#';\n}\n\nfunction getStringHref(to: string): string {\n if (to.startsWith('http://') || to.startsWith('https://') || to.startsWith('/')) {\n return to;\n }\n return '/' + to;\n}\n\nfunction getResourceHref(to: Resource): string {\n return `/${to.resourceType}/${to.id}`;\n}\n\nfunction getReferenceHref(to: Reference): string {\n return `/${to.reference}`;\n}\n"],"names":[],"mappings":";;;;;AAcM,SAAU,WAAW,CAAC,KAAuB,EAAA;AACjD,IAAA,MAAM,QAAQ,GAAG,WAAW,EAAE,CAAC;AAC/B,IAAA,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,G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AAG,EAAE,CAAC;AAClB,CAAC;AAED,SAAS,eAAe,CAAC,EAAY,EAAA;IACnC,OAAO,CAAA,CAAA,EAAI,EAAE,CAAC,YAAY,IAAI,EAAE,CAAC,EAAE,CAAA,CAAE,CAAC;AACxC,CAAC;AAED,SAAS,gBAAgB,CAAC,EAAa,EAAA;AACrC,IAAA,OAAO,CAAI,CAAA,EAAA,EAAE,CAAC,SAAS,EAAE,CAAC;AAC5B;;;;"}
|
|
@@ -16,12 +16,18 @@ function MedplumProvider(props) {
|
|
|
16
16
|
});
|
|
17
17
|
useEffect(() => {
|
|
18
18
|
function eventListener() {
|
|
19
|
-
setState(
|
|
19
|
+
setState({
|
|
20
|
+
...state,
|
|
21
|
+
profile: medplum.getProfile(),
|
|
22
|
+
});
|
|
20
23
|
}
|
|
21
24
|
medplum.addEventListener('change', eventListener);
|
|
22
25
|
return () => medplum.removeEventListeneer('change', eventListener);
|
|
23
26
|
}, [medplum, state]);
|
|
24
|
-
const medplumContext =
|
|
27
|
+
const medplumContext = {
|
|
28
|
+
...state,
|
|
29
|
+
medplum,
|
|
30
|
+
};
|
|
25
31
|
return React.createElement(reactContext.Provider, { value: medplumContext }, props.children);
|
|
26
32
|
}
|
|
27
33
|
/**
|
|
@@ -47,4 +53,4 @@ function useMedplumProfile() {
|
|
|
47
53
|
}
|
|
48
54
|
|
|
49
55
|
export { MedplumProvider, useMedplum, useMedplumContext, useMedplumProfile };
|
|
50
|
-
//# sourceMappingURL=MedplumProvider.
|
|
56
|
+
//# sourceMappingURL=MedplumProvider.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MedplumProvider.mjs","sources":["../../../src/MedplumProvider/MedplumProvider.tsx"],"sourcesContent":["import { MedplumClient, ProfileResource } from '@medplum/core';\nimport React, { createContext, useContext, useEffect, useState } from 'react';\n\nconst reactContext = createContext(undefined as MedplumContext | undefined);\n\nexport interface MedplumProviderProps {\n medplum: MedplumClient;\n children: React.ReactNode;\n}\n\nexport interface MedplumContext {\n medplum: MedplumClient;\n profile?: ProfileResource;\n loading: boolean;\n}\n\n/**\n * The MedplumProvider component provides Medplum context state.\n *\n * Medplum context includes:\n * 1) medplum - Medplum client library\n * 2) profile - The current user profile (if signed in)\n */\nexport function MedplumProvider(props: MedplumProviderProps): JSX.Element {\n const medplum = props.medplum;\n\n const [state, setState] = useState({\n profile: medplum.getProfile(),\n loading: false,\n });\n\n useEffect(() => {\n function eventListener(): void {\n setState({\n ...state,\n profile: medplum.getProfile(),\n });\n }\n\n medplum.addEventListener('change', eventListener);\n return () => medplum.removeEventListeneer('change', eventListener);\n }, [medplum, state]);\n\n const medplumContext = {\n ...state,\n medplum,\n };\n\n return <reactContext.Provider value={medplumContext}>{props.children}</reactContext.Provider>;\n}\n\n/**\n * Returns the MedplumContext instance.\n */\nexport function useMedplumContext(): MedplumContext {\n return useContext(reactContext) as MedplumContext;\n}\n\n/**\n * Returns the MedplumClient instance.\n * This is a shortcut for useMedplumContext().medplum.\n */\nexport function useMedplum(): MedplumClient {\n return useMedplumContext().medplum;\n}\n\n/**\n * Returns the current Medplum user profile (if signed in).\n * This is a shortcut for useMedplumContext().profile.\n * @returns The current user profile.\n */\nexport function useMedplumProfile(): ProfileResource | undefined {\n return useMedplumContext().profile;\n}\n"],"names":[],"mappings":";;AAGA,MAAM,YAAY,GAAG,aAAa,CAAC,SAAuC,CAAC,CAAC;AAa5E;;;;;;AAMG;AACG,SAAU,eAAe,CAAC,KAA2B,EAAA;AACzD,IAAA,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC;AAE9B,IAAA,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAC;AACjC,QAAA,OAAO,EAAE,OAAO,CAAC,UAAU,EAAE;AAC7B,QAAA,OAAO,EAAE,KAAK;AACf,KAAA,CAAC,CAAC;IAEH,SAAS,CAAC,MAAK;AACb,QAAA,SAAS,aAAa,GAAA;AACpB,YAAA,QAAQ,CAAC;AACP,gBAAA,GAAG,KAAK;AACR,gBAAA,OAAO,EAAE,OAAO,CAAC,UAAU,EAAE;AAC9B,aAAA,CAAC,CAAC;SACJ;AAED,QAAA,OAAO,CAAC,gBAAgB,CAAC,QAAQ,EAAE,aAAa,CAAC,CAAC;QAClD,OAAO,MAAM,OAAO,CAAC,oBAAoB,CAAC,QAAQ,EAAE,aAAa,CAAC,CAAC;AACrE,KAAC,EAAE,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC;AAErB,IAAA,MAAM,cAAc,GAAG;AACrB,QAAA,GAAG,KAAK;QACR,OAAO;KACR,CAAC;AAEF,IAAA,OAAO,KAAC,CAAA,aAAA,CAAA,YAAY,CAAC,QAAQ,EAAC,EAAA,KAAK,EAAE,cAAc,EAAG,EAAA,KAAK,CAAC,QAAQ,CAAyB,CAAC;AAChG,CAAC;AAED;;AAEG;SACa,iBAAiB,GAAA;AAC/B,IAAA,OAAO,UAAU,CAAC,YAAY,CAAmB,CAAC;AACpD,CAAC;AAED;;;AAGG;SACa,UAAU,GAAA;AACxB,IAAA,OAAO,iBAAiB,EAAE,CAAC,OAAO,CAAC;AACrC,CAAC;AAED;;;;AAIG;SACa,iBAAiB,GAAA;AAC/B,IAAA,OAAO,iBAAiB,EAAE,CAAC,OAAO,CAAC;AACrC;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MoneyDisplay.mjs","sources":["../../../src/MoneyDisplay/MoneyDisplay.tsx"],"sourcesContent":["import { formatMoney } from '@medplum/core';\nimport { Money } from '@medplum/fhirtypes';\nimport React from 'react';\n\nexport interface MoneyDisplayProps {\n value?: Money;\n}\n\nexport function MoneyDisplay(props: MoneyDisplayProps): JSX.Element | null {\n return <>{formatMoney(props.value)}</>;\n}\n"],"names":[],"mappings":";;;AAQM,SAAU,YAAY,CAAC,KAAwB,EAAA;IACnD,OAAO,KAAA,CAAA,aAAA,CAAA,KAAA,CAAA,QAAA,EAAA,IAAA,EAAG,WAAW,CAAC,KAAK,CAAC,KAAK,CAAC,CAAI,CAAC;AACzC;;;;"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { Money } from '@medplum/fhirtypes';
|
|
3
|
+
export interface MoneyInputProps {
|
|
4
|
+
name: string;
|
|
5
|
+
label?: string;
|
|
6
|
+
placeholder?: string;
|
|
7
|
+
defaultValue?: Money;
|
|
8
|
+
onChange?: (value: Money) => void;
|
|
9
|
+
}
|
|
10
|
+
export declare function MoneyInput(props: MoneyInputProps): JSX.Element;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { NativeSelect, TextInput } from '@mantine/core';
|
|
2
|
+
import { IconCurrencyDollar } from '@tabler/icons';
|
|
3
|
+
import React, { useState, useCallback } from 'react';
|
|
4
|
+
|
|
5
|
+
/*
|
|
6
|
+
* Based on: https://github.com/mantinedev/ui.mantine.dev/blob/master/components/CurrencyInput/CurrencyInput.tsx
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* List of currencies.
|
|
10
|
+
*
|
|
11
|
+
* Full list of currencies:
|
|
12
|
+
* https://www.hl7.org/fhir/valueset-currencies.html
|
|
13
|
+
*
|
|
14
|
+
* Latest browsers can report list of supported currencies, but it's not widely supported:
|
|
15
|
+
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/supportedValuesOf
|
|
16
|
+
*
|
|
17
|
+
* Using a short list for simplicity for now.
|
|
18
|
+
*/
|
|
19
|
+
const data = ['USD', 'EUR', 'CAD', 'GBP', 'AUD'];
|
|
20
|
+
function MoneyInput(props) {
|
|
21
|
+
const { onChange } = props;
|
|
22
|
+
const [value, setValue] = useState(props.defaultValue);
|
|
23
|
+
const setValueWrapper = useCallback((newValue) => {
|
|
24
|
+
setValue(newValue);
|
|
25
|
+
if (onChange) {
|
|
26
|
+
onChange(newValue);
|
|
27
|
+
}
|
|
28
|
+
}, [onChange]);
|
|
29
|
+
const handleCurrencyChange = useCallback((e) => {
|
|
30
|
+
setValueWrapper({
|
|
31
|
+
...value,
|
|
32
|
+
currency: e.currentTarget.value,
|
|
33
|
+
});
|
|
34
|
+
}, [value, setValueWrapper]);
|
|
35
|
+
const handleValueChange = useCallback((e) => {
|
|
36
|
+
setValueWrapper({
|
|
37
|
+
...value,
|
|
38
|
+
value: e.currentTarget.valueAsNumber,
|
|
39
|
+
});
|
|
40
|
+
}, [value, setValueWrapper]);
|
|
41
|
+
const select = (React.createElement(NativeSelect, { defaultValue: value?.currency, data: data, styles: {
|
|
42
|
+
input: {
|
|
43
|
+
fontWeight: 500,
|
|
44
|
+
borderTopLeftRadius: 0,
|
|
45
|
+
borderBottomLeftRadius: 0,
|
|
46
|
+
width: 92,
|
|
47
|
+
},
|
|
48
|
+
}, onChange: handleCurrencyChange }));
|
|
49
|
+
return (React.createElement(TextInput, { type: "number", label: props.label, placeholder: props.placeholder || 'Value', defaultValue: value?.value?.toString() || 'USD', icon: React.createElement(IconCurrencyDollar, { size: 14 }), rightSection: select, rightSectionWidth: 92, onChange: handleValueChange }));
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export { MoneyInput };
|
|
53
|
+
//# sourceMappingURL=MoneyInput.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MoneyInput.mjs","sources":["../../../src/MoneyInput/MoneyInput.tsx"],"sourcesContent":["import { NativeSelect, TextInput } from '@mantine/core';\nimport { Money } from '@medplum/fhirtypes';\nimport { IconCurrencyDollar } from '@tabler/icons';\nimport React, { useCallback, useState } from 'react';\n\n/*\n * Based on: https://github.com/mantinedev/ui.mantine.dev/blob/master/components/CurrencyInput/CurrencyInput.tsx\n */\n\n/**\n * List of currencies.\n *\n * Full list of currencies:\n * https://www.hl7.org/fhir/valueset-currencies.html\n *\n * Latest browsers can report list of supported currencies, but it's not widely supported:\n * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/supportedValuesOf\n *\n * Using a short list for simplicity for now.\n */\nconst data = ['USD', 'EUR', 'CAD', 'GBP', 'AUD'];\n\nexport interface MoneyInputProps {\n name: string;\n label?: string;\n placeholder?: string;\n defaultValue?: Money;\n onChange?: (value: Money) => void;\n}\n\nexport function MoneyInput(props: MoneyInputProps): JSX.Element {\n const { onChange } = props;\n const [value, setValue] = useState(props.defaultValue);\n\n const setValueWrapper = useCallback(\n (newValue: Money): void => {\n setValue(newValue);\n if (onChange) {\n onChange(newValue);\n }\n },\n [onChange]\n );\n\n const handleCurrencyChange = useCallback(\n (e: React.ChangeEvent<HTMLSelectElement>) => {\n setValueWrapper({\n ...value,\n currency: e.currentTarget.value,\n });\n },\n [value, setValueWrapper]\n );\n\n const handleValueChange = useCallback(\n (e: React.ChangeEvent<HTMLInputElement>) => {\n setValueWrapper({\n ...value,\n value: e.currentTarget.valueAsNumber,\n });\n },\n [value, setValueWrapper]\n );\n\n const select = (\n <NativeSelect\n defaultValue={value?.currency}\n data={data}\n styles={{\n input: {\n fontWeight: 500,\n borderTopLeftRadius: 0,\n borderBottomLeftRadius: 0,\n width: 92,\n },\n }}\n onChange={handleCurrencyChange}\n />\n );\n\n return (\n <TextInput\n type=\"number\"\n label={props.label}\n placeholder={props.placeholder || 'Value'}\n defaultValue={value?.value?.toString() || 'USD'}\n icon={<IconCurrencyDollar size={14} />}\n rightSection={select}\n rightSectionWidth={92}\n onChange={handleValueChange}\n />\n );\n}\n"],"names":[],"mappings":";;;;AAKA;;AAEG;AAEH;;;;;;;;;;AAUG;AACH,MAAM,IAAI,GAAG,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;AAU3C,SAAU,UAAU,CAAC,KAAsB,EAAA;AAC/C,IAAA,MAAM,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC;AAC3B,IAAA,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;AAEvD,I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YAAY,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,KAAK,EAC/C,IAAI,EAAE,KAAC,CAAA,aAAA,CAAA,kBAAkB,EAAC,EAAA,IAAI,EAAE,EAAE,EAAI,CAAA,EACtC,YAAY,EAAE,MAAM,EACpB,iBAAiB,EAAE,EAAE,EACrB,QAAQ,EAAE,iBAAiB,EAC3B,CAAA,EACF;AACJ;;;;"}
|
|
@@ -0,0 +1,6 @@
|
|
|
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;
|
|
6
|
+
export declare const DefaultValue: () => JSX.Element;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { OperationOutcomeIssue } from '@medplum/fhirtypes';
|
|
3
|
+
export interface OperationOutcomeAlertProps {
|
|
4
|
+
issues?: OperationOutcomeIssue[];
|
|
5
|
+
}
|
|
6
|
+
export declare function OperationOutcomeAlert(props: OperationOutcomeAlertProps): JSX.Element | null;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Alert } from '@mantine/core';
|
|
2
|
+
import { IconAlertCircle } from '@tabler/icons';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
|
|
5
|
+
function OperationOutcomeAlert(props) {
|
|
6
|
+
if (!props.issues) {
|
|
7
|
+
return null;
|
|
8
|
+
}
|
|
9
|
+
return (React.createElement(Alert, { icon: React.createElement(IconAlertCircle, { size: 16 }), color: "red" }, props.issues.map((issue) => (React.createElement("div", { "data-testid": "text-field-error", key: issue.details?.text }, issue.details?.text)))));
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export { OperationOutcomeAlert };
|
|
13
|
+
//# sourceMappingURL=OperationOutcomeAlert.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OperationOutcomeAlert.mjs","sources":["../../../src/OperationOutcomeAlert/OperationOutcomeAlert.tsx"],"sourcesContent":["import { Alert } from '@mantine/core';\nimport { OperationOutcomeIssue } from '@medplum/fhirtypes';\nimport { IconAlertCircle } from '@tabler/icons';\nimport React from 'react';\n\nexport interface OperationOutcomeAlertProps {\n issues?: OperationOutcomeIssue[];\n}\n\nexport function OperationOutcomeAlert(props: OperationOutcomeAlertProps): JSX.Element | null {\n if (!props.issues) {\n return null;\n }\n return (\n <Alert icon={<IconAlertCircle size={16} />} color=\"red\">\n {props.issues.map((issue) => (\n <div data-testid=\"text-field-error\" key={issue.details?.text}>\n {issue.details?.text}\n </div>\n ))}\n </Alert>\n );\n}\n"],"names":[],"mappings":";;;;AASM,SAAU,qBAAqB,CAAC,KAAiC,EAAA;AACrE,IAAA,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE;AACjB,QAAA,OAAO,IAAI,CAAC;AACb,KAAA;IACD,QACE,oBAAC,KAAK,EAAA,EAAC,IAAI,EAAE,KAAA,CAAA,aAAA,CAAC,eAAe,EAAA,EAAC,IAAI,EAAE,EAAE,EAAI,CAAA,EAAE,KAAK,EAAC,KAAK,EAAA,EACpD,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,MACtB,KAAiB,CAAA,aAAA,CAAA,KAAA,EAAA,EAAA,aAAA,EAAA,kBAAkB,EAAC,GAAG,EAAE,KAAK,CAAC,OAAO,EAAE,IAAI,EACzD,EAAA,KAAK,CAAC,OAAO,EAAE,IAAI,CAChB,CACP,CAAC,CACI,EACR;AACJ;;;;"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { __rest } from '../node_modules/tslib/tslib.es6.js';
|
|
2
1
|
import { createStyles, useComponentDefaultProps, Paper } from '@mantine/core';
|
|
3
2
|
import React from 'react';
|
|
4
3
|
|
|
@@ -26,10 +25,10 @@ const defaultProps = {
|
|
|
26
25
|
withBorder: true,
|
|
27
26
|
};
|
|
28
27
|
function Panel(props) {
|
|
29
|
-
const
|
|
28
|
+
const { className, children, width, fill, unstyled, ...others } = useComponentDefaultProps('Panel', defaultProps, props);
|
|
30
29
|
const { classes, cx } = useStyles({ width, fill }, { name: 'Panel', unstyled });
|
|
31
|
-
return (React.createElement(Paper,
|
|
30
|
+
return (React.createElement(Paper, { className: cx(classes.paper, className), ...others }, children));
|
|
32
31
|
}
|
|
33
32
|
|
|
34
33
|
export { Panel };
|
|
35
|
-
//# sourceMappingURL=Panel.
|
|
34
|
+
//# sourceMappingURL=Panel.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Panel.mjs","sources":["../../../src/Panel/Panel.tsx"],"sourcesContent":["import { createStyles, Paper, PaperProps, useComponentDefaultProps } from '@mantine/core';\nimport React from 'react';\n\nexport interface PanelStylesParams {\n width?: number;\n fill?: boolean;\n}\n\nconst useStyles = createStyles((theme, { width, fill }: PanelStylesParams) => ({\n paper: {\n maxWidth: width,\n margin: `${theme.spacing.xl}px auto`,\n padding: fill ? 0 : theme.spacing.md,\n '@media (max-width: 800px)': {\n padding: fill ? 0 : 8,\n },\n '& img': {\n width: '100%',\n maxWidth: '100%',\n },\n '& video': {\n width: '100%',\n maxWidth: '100%',\n },\n },\n}));\n\nexport interface PanelProps extends PaperProps {\n width?: number;\n fill?: boolean;\n}\n\nconst defaultProps: Partial<PanelProps> = {\n shadow: 'xs',\n radius: 'md',\n withBorder: true,\n};\n\nexport function Panel(props: PanelProps): JSX.Element {\n const { className, children, width, fill, unstyled, ...others } = useComponentDefaultProps(\n 'Panel',\n defaultProps,\n props\n );\n const { classes, cx } = useStyles({ width, fill }, { name: 'Panel', unstyled });\n\n return (\n <Paper className={cx(classes.paper, className)} {...others}>\n {children}\n </Paper>\n );\n}\n"],"names":[],"mappings":";;;AAQA,MAAM,SAAS,GAAG,YAAY,CAAC,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE,IAAI,EAAqB,MAAM;AAC7E,IAAA,KAAK,EAAE;AACL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ResourceTimeline } from '../ResourceTimeline/ResourceTimeline.
|
|
3
|
+
import { ResourceTimeline } from '../ResourceTimeline/ResourceTimeline.mjs';
|
|
4
4
|
|
|
5
5
|
const searches = [
|
|
6
6
|
'$/_history',
|
|
@@ -39,4 +39,4 @@ function PatientTimeline(props) {
|
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
export { PatientTimeline };
|
|
42
|
-
//# sourceMappingURL=PatientTimeline.
|
|
42
|
+
//# sourceMappingURL=PatientTimeline.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PatientTimeline.mjs","sources":["../../../src/PatientTimeline/PatientTimeline.tsx"],"sourcesContent":["import { createReference, getReferenceString, ProfileResource } from '@medplum/core';\nimport { Attachment, Patient, Reference, Resource } from '@medplum/fhirtypes';\nimport React from 'react';\nimport { ResourceTimeline } from '../ResourceTimeline/ResourceTimeline';\n\nexport interface PatientTimelineProps {\n patient: Patient | Reference<Patient>;\n}\n\nconst searches = [\n '$/_history',\n 'Communication?subject=$',\n 'Device?patient=$',\n 'DeviceRequest?patient=$',\n 'DiagnosticReport?subject=$',\n 'Media?subject=$',\n 'ServiceRequest?subject=$',\n];\n\nexport function PatientTimeline(props: PatientTimelineProps): JSX.Element {\n return (\n <ResourceTimeline\n value={props.patient}\n buildSearchRequests={(resource: Resource) => ({\n resourceType: 'Bundle',\n type: 'batch',\n entry: searches.map((search) => ({\n request: {\n method: 'GET',\n url: search.replaceAll('$', getReferenceString(resource)),\n },\n })),\n })}\n createCommunication={(resource: Patient, sender: ProfileResource, text: string) => ({\n resourceType: 'Communication',\n status: 'completed',\n subject: createReference(resource),\n sender: createReference(sender),\n sent: new Date().toISOString(),\n payload: [{ contentString: text }],\n })}\n createMedia={(resource: Patient, operator: ProfileResource, content: Attachment) => ({\n resourceType: 'Media',\n status: 'completed',\n subject: createReference(resource),\n operator: createReference(operator),\n issued: new Date().toISOString(),\n content,\n })}\n />\n );\n}\n"],"names":[],"mappings":";;;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AAM,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;YAChC,OAAO;SACR,CAAC,EAAA,CACF,EACF;AACJ;;;;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Group } from '@mantine/core';
|
|
2
2
|
import React, { useState } from 'react';
|
|
3
|
-
import { DateTimeInput } from '../DateTimeInput/DateTimeInput.
|
|
3
|
+
import { DateTimeInput } from '../DateTimeInput/DateTimeInput.mjs';
|
|
4
4
|
|
|
5
5
|
function PeriodInput(props) {
|
|
6
6
|
const [value, setValue] = useState(props.defaultValue);
|
|
@@ -11,9 +11,9 @@ function PeriodInput(props) {
|
|
|
11
11
|
}
|
|
12
12
|
}
|
|
13
13
|
return (React.createElement(Group, { spacing: "xs", grow: true, noWrap: true },
|
|
14
|
-
React.createElement(DateTimeInput, { name: props.name + '.start', placeholder: "Start", defaultValue: value
|
|
15
|
-
React.createElement(DateTimeInput, { name: props.name + '.end', placeholder: "End", defaultValue: value
|
|
14
|
+
React.createElement(DateTimeInput, { name: props.name + '.start', placeholder: "Start", defaultValue: value?.start, onChange: (newValue) => setValueWrapper({ ...value, start: newValue }) }),
|
|
15
|
+
React.createElement(DateTimeInput, { name: props.name + '.end', placeholder: "End", defaultValue: value?.end, onChange: (newValue) => setValueWrapper({ ...value, end: newValue }) })));
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
export { PeriodInput };
|
|
19
|
-
//# sourceMappingURL=PeriodInput.
|
|
19
|
+
//# sourceMappingURL=PeriodInput.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PeriodInput.mjs","sources":["../../../src/PeriodInput/PeriodInput.tsx"],"sourcesContent":["import { Group } from '@mantine/core';\nimport { Period } from '@medplum/fhirtypes';\nimport React, { useState } from 'react';\nimport { DateTimeInput } from '../DateTimeInput/DateTimeInput';\n\nexport interface PeriodInputProps {\n name: string;\n defaultValue?: Period;\n onChange?: (value: Period) => void;\n}\n\nexport function PeriodInput(props: PeriodInputProps): JSX.Element {\n const [value, setValue] = useState(props.defaultValue);\n\n function setValueWrapper(newValue: Period): void {\n setValue(newValue);\n if (props.onChange) {\n props.onChange(newValue);\n }\n }\n\n return (\n <Group spacing=\"xs\" grow noWrap>\n <DateTimeInput\n name={props.name + '.start'}\n placeholder=\"Start\"\n defaultValue={value?.start}\n onChange={(newValue) => setValueWrapper({ ...value, start: newValue })}\n />\n <DateTimeInput\n name={props.name + '.end'}\n placeholder=\"End\"\n defaultValue={value?.end}\n onChange={(newValue) => setValueWrapper({ ...value, end: newValue })}\n />\n </Group>\n );\n}\n"],"names":[],"mappings":";;;;AAWM,SAAU,WAAW,CAAC,KAAuB,EAAA;AACjD,IAAA,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;IAEvD,SAAS,eAAe,CAAC,QAAgB,EAAA;QACvC,QAAQ,CAAC,QAAQ,CAAC,CAAC;QACnB,IAAI,KAAK,CAAC,QAAQ,EAAE;AAClB,YAAA,KAAK,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;AAC1B,SAAA;KACF;IAED,QACE,KAAC,CAAA,aAAA,CAAA,KAAK,EAAC,EAAA,OAAO,EAAC,IAAI,EAAC,IAAI,EAAA,IAAA,EAAC,MAAM,EAAA,IAAA,EAAA;AAC7B,QAAA,KAAA,CAAA,aAAA,CAAC,aAAa,EACZ,EAAA,IAAI,EAAE,KAAK,CAAC,IAAI,GAAG,QAAQ,EAC3B,WAAW,EAAC,OAAO,EACnB,YAAY,EAAE,KAAK,EAAE,KAAK,EAC1B,QAAQ,EAAE,CAAC,QAAQ,KAAK,eAAe,CAAC,EAAE,GAAG,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC,EACtE,CAAA;AACF,QAAA,KAAA,CAAA,aAAA,CAAC,aAAa,EACZ,EAAA,IAAI,EAAE,KAAK,CAAC,IAAI,GAAG,MAAM,EACzB,WAAW,EAAC,KAAK,EACjB,YAAY,EAAE,KAAK,EAAE,GAAG,EACxB,QAAQ,EAAE,CAAC,QAAQ,KAAK,eAAe,CAAC,EAAE,GAAG,KAAK,EAAE,GAAG,EAAE,QAAQ,EAAE,CAAC,EACpE,CAAA,CACI,EACR;AACJ;;;;"}
|
package/dist/esm/PlanDefinitionBuilder/{PlanDefinitionBuilder.js → PlanDefinitionBuilder.mjs}
RENAMED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { createStyles, TextInput, Button, Anchor, Stack, NativeSelect } from '@mantine/core';
|
|
2
2
|
import { getReferenceString } from '@medplum/core';
|
|
3
3
|
import React, { useState, useRef, useEffect } from 'react';
|
|
4
|
-
import { Form } from '../Form/Form.
|
|
5
|
-
import { FormSection } from '../FormSection/FormSection.
|
|
6
|
-
import { useMedplum } from '../MedplumProvider/MedplumProvider.
|
|
7
|
-
import { ReferenceDisplay } from '../ReferenceDisplay/ReferenceDisplay.
|
|
8
|
-
import { setPropertyValue } from '../ResourceForm/ResourceForm.
|
|
9
|
-
import { ResourceInput } from '../ResourceInput/ResourceInput.
|
|
10
|
-
import { ResourcePropertyDisplay, getValueAndType } from '../ResourcePropertyDisplay/ResourcePropertyDisplay.
|
|
11
|
-
import { ResourcePropertyInput } from '../ResourcePropertyInput/ResourcePropertyInput.
|
|
12
|
-
import { useResource } from '../useResource/useResource.
|
|
13
|
-
import { killEvent } from '../utils/dom.
|
|
4
|
+
import { Form } from '../Form/Form.mjs';
|
|
5
|
+
import { FormSection } from '../FormSection/FormSection.mjs';
|
|
6
|
+
import { useMedplum } from '../MedplumProvider/MedplumProvider.mjs';
|
|
7
|
+
import { ReferenceDisplay } from '../ReferenceDisplay/ReferenceDisplay.mjs';
|
|
8
|
+
import { setPropertyValue } from '../ResourceForm/ResourceForm.mjs';
|
|
9
|
+
import { ResourceInput } from '../ResourceInput/ResourceInput.mjs';
|
|
10
|
+
import { ResourcePropertyDisplay, getValueAndType } from '../ResourcePropertyDisplay/ResourcePropertyDisplay.mjs';
|
|
11
|
+
import { ResourcePropertyInput } from '../ResourcePropertyInput/ResourcePropertyInput.mjs';
|
|
12
|
+
import { useResource } from '../useResource/useResource.mjs';
|
|
13
|
+
import { killEvent } from '../utils/dom.mjs';
|
|
14
14
|
|
|
15
15
|
const useStyles = createStyles((theme) => ({
|
|
16
16
|
section: {
|
|
@@ -57,7 +57,7 @@ function PlanDefinitionBuilder(props) {
|
|
|
57
57
|
medplum.requestSchema('PlanDefinition').then(setSchema).catch(console.log);
|
|
58
58
|
}, [medplum]);
|
|
59
59
|
useEffect(() => {
|
|
60
|
-
setValue(ensurePlanDefinitionKeys(defaultValue
|
|
60
|
+
setValue(ensurePlanDefinitionKeys(defaultValue ?? { resourceType: 'PlanDefinition' }));
|
|
61
61
|
document.addEventListener('mouseover', handleDocumentMouseOver);
|
|
62
62
|
document.addEventListener('click', handleDocumentClick);
|
|
63
63
|
return () => {
|
|
@@ -69,7 +69,10 @@ function PlanDefinitionBuilder(props) {
|
|
|
69
69
|
return null;
|
|
70
70
|
}
|
|
71
71
|
function changeProperty(property, newValue) {
|
|
72
|
-
setValue(
|
|
72
|
+
setValue({
|
|
73
|
+
...valueRef.current,
|
|
74
|
+
[property]: newValue,
|
|
75
|
+
});
|
|
73
76
|
}
|
|
74
77
|
return (React.createElement("div", null,
|
|
75
78
|
React.createElement(Form, { testid: "questionnaire-form", onSubmit: () => props.onSubmit(value) },
|
|
@@ -149,7 +152,10 @@ function ActionEditor(props) {
|
|
|
149
152
|
const { action } = props;
|
|
150
153
|
const [actionType, setActionType] = useState(props.actionType);
|
|
151
154
|
function changeProperty(property, value) {
|
|
152
|
-
props.onChange(
|
|
155
|
+
props.onChange({
|
|
156
|
+
...action,
|
|
157
|
+
[property]: value,
|
|
158
|
+
});
|
|
153
159
|
}
|
|
154
160
|
return (React.createElement(Stack, { spacing: "xl" },
|
|
155
161
|
React.createElement(TextInput, { name: `actionTitle-${action.id}`, label: "Title", defaultValue: action.title, onChange: (e) => changeProperty('title', e.currentTarget.value) }),
|
|
@@ -175,15 +181,15 @@ function ActionEditor(props) {
|
|
|
175
181
|
}
|
|
176
182
|
function ActionResourceTypeBuilder(props) {
|
|
177
183
|
const { id, definitionCanonical } = props.action;
|
|
178
|
-
const reference =
|
|
184
|
+
const reference = definitionCanonical?.startsWith(props.resourceType + '/')
|
|
179
185
|
? { reference: definitionCanonical }
|
|
180
186
|
: undefined;
|
|
181
187
|
return (React.createElement(ResourceInput, { name: id, resourceType: props.resourceType, defaultValue: reference, loadOnFocus: true, onChange: (newValue) => {
|
|
182
188
|
if (newValue) {
|
|
183
|
-
props.onChange(
|
|
189
|
+
props.onChange({ ...props.action, definitionCanonical: getReferenceString(newValue) });
|
|
184
190
|
}
|
|
185
191
|
else {
|
|
186
|
-
props.onChange(
|
|
192
|
+
props.onChange({ ...props.action, definitionCanonical: undefined });
|
|
187
193
|
}
|
|
188
194
|
} }));
|
|
189
195
|
}
|
|
@@ -192,18 +198,17 @@ function ActionTimingInput(props) {
|
|
|
192
198
|
const key = 'timing';
|
|
193
199
|
const [propertyValue, propertyType] = getActionTiming(value);
|
|
194
200
|
return (React.createElement(ResourcePropertyInput, { property: timingProperty, name: "timing[x]", defaultValue: propertyValue, defaultPropertyType: propertyType, onChange: (newValue, propName) => {
|
|
195
|
-
props.onChange(setPropertyValue(value, key, propName
|
|
201
|
+
props.onChange(setPropertyValue(value, key, propName ?? key, timingProperty, newValue));
|
|
196
202
|
} }));
|
|
197
203
|
}
|
|
198
204
|
function getInitialActionType(action) {
|
|
199
|
-
|
|
200
|
-
if ((_a = action.definitionCanonical) === null || _a === void 0 ? void 0 : _a.startsWith('Schedule')) {
|
|
205
|
+
if (action.definitionCanonical?.startsWith('Schedule')) {
|
|
201
206
|
return 'appointment';
|
|
202
207
|
}
|
|
203
|
-
if (
|
|
208
|
+
if (action.definitionCanonical?.startsWith('Questionnaire/')) {
|
|
204
209
|
return 'questionnaire';
|
|
205
210
|
}
|
|
206
|
-
if (
|
|
211
|
+
if (action.definitionCanonical?.startsWith('ActivityDefinition/')) {
|
|
207
212
|
return 'task';
|
|
208
213
|
}
|
|
209
214
|
return undefined;
|
|
@@ -232,14 +237,21 @@ function generateId(existing) {
|
|
|
232
237
|
return 'id-' + nextId++;
|
|
233
238
|
}
|
|
234
239
|
function ensurePlanDefinitionKeys(planDefinition) {
|
|
235
|
-
return
|
|
240
|
+
return {
|
|
241
|
+
...planDefinition,
|
|
242
|
+
action: ensurePlanDefinitionActionKeys(planDefinition.action),
|
|
243
|
+
};
|
|
236
244
|
}
|
|
237
245
|
function ensurePlanDefinitionActionKeys(actions) {
|
|
238
246
|
if (!actions) {
|
|
239
247
|
return undefined;
|
|
240
248
|
}
|
|
241
|
-
return actions.map((action) => (
|
|
249
|
+
return actions.map((action) => ({
|
|
250
|
+
...action,
|
|
251
|
+
id: generateId(action.id),
|
|
252
|
+
action: ensurePlanDefinitionActionKeys(action.action),
|
|
253
|
+
}));
|
|
242
254
|
}
|
|
243
255
|
|
|
244
256
|
export { PlanDefinitionBuilder };
|
|
245
|
-
//# sourceMappingURL=PlanDefinitionBuilder.
|
|
257
|
+
//# sourceMappingURL=PlanDefinitionBuilder.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PlanDefinitionBuilder.mjs","sources":["../../../src/PlanDefinitionBuilder/PlanDefinitionBuilder.tsx"],"sourcesContent":["import { Anchor, Button, createStyles, NativeSelect, Stack, TextInput } from '@mantine/core';\nimport { getReferenceString, IndexedStructureDefinition, PropertyType } from '@medplum/core';\nimport { ElementDefinition, PlanDefinition, PlanDefinitionAction, Reference, ResourceType } from '@medplum/fhirtypes';\nimport React, { useEffect, useRef, useState } from 'react';\nimport { Form } from '../Form/Form';\nimport { FormSection } from '../FormSection/FormSection';\nimport { useMedplum } from '../MedplumProvider/MedplumProvider';\nimport { ReferenceDisplay } from '../ReferenceDisplay/ReferenceDisplay';\nimport { setPropertyValue } from '../ResourceForm/ResourceForm';\nimport { ResourceInput } from '../ResourceInput/ResourceInput';\nimport { getValueAndType, ResourcePropertyDisplay } from '../ResourcePropertyDisplay/ResourcePropertyDisplay';\nimport { ResourcePropertyInput } from '../ResourcePropertyInput/ResourcePropertyInput';\nimport { useResource } from '../useResource/useResource';\nimport { killEvent } from '../utils/dom';\n\nconst useStyles = createStyles((theme) => ({\n section: {\n position: 'relative',\n margin: '4px 4px 8px 0',\n padding: '6px 12px 16px 6px',\n border: `1.5px solid ${theme.colors.gray[1]}`,\n borderRadius: theme.radius.sm,\n transition: 'all 0.1s',\n },\n\n hovering: {\n border: `1.5px solid ${theme.colors.blue[5]}`,\n },\n\n editing: {\n border: `1.5px solid ${theme.colors.gray[1]}`,\n borderLeft: `4px solid ${theme.colors.blue[5]}`,\n },\n\n bottomActions: {\n position: 'absolute',\n right: 4,\n bottom: 0,\n fontSize: theme.fontSizes.xs,\n\n '& a': {\n marginLeft: 8,\n },\n },\n}));\n\nexport interface PlanDefinitionBuilderProps {\n value: PlanDefinition | Reference<PlanDefinition>;\n onSubmit: (result: PlanDefinition) => void;\n}\n\nexport function PlanDefinitionBuilder(props: PlanDefinitionBuilderProps): JSX.Element | null {\n const medplum = useMedplum();\n const defaultValue = useResource(props.value);\n const [schema, setSchema] = useState<IndexedStructureDefinition | undefined>(undefined);\n const [selectedKey, setSelectedKey] = useState<string>();\n const [hoverKey, setHoverKey] = useState<string>();\n const [value, setValue] = useState<PlanDefinition>();\n\n function handleDocumentMouseOver(): void {\n setHoverKey(undefined);\n }\n\n function handleDocumentClick(): void {\n setSelectedKey(undefined);\n }\n\n const valueRef = useRef<PlanDefinition>();\n valueRef.current = value;\n\n useEffect(() => {\n medplum.requestSchema('PlanDefinition').then(setSchema).catch(console.log);\n }, [medplum]);\n\n useEffect(() => {\n setValue(ensurePlanDefinitionKeys(defaultValue ?? { resourceType: 'PlanDefinition' }));\n document.addEventListener('mouseover', handleDocumentMouseOver);\n document.addEventListener('click', handleDocumentClick);\n return () => {\n document.removeEventListener('mouseover', handleDocumentMouseOver);\n document.removeEventListener('click', handleDocumentClick);\n };\n }, [defaultValue]);\n\n if (!schema || !value) {\n return null;\n }\n\n function changeProperty(property: string, newValue: any): void {\n setValue({\n ...valueRef.current,\n [property]: newValue,\n } as PlanDefinition);\n }\n\n return (\n <div>\n <Form testid=\"questionnaire-form\" onSubmit={() => props.onSubmit(value)}>\n <TextInput\n label=\"Plan Title\"\n defaultValue={value.title}\n onChange={(e) => changeProperty('title', e.currentTarget.value)}\n />\n <ActionArrayBuilder\n actions={value.action || []}\n selectedKey={selectedKey}\n setSelectedKey={setSelectedKey}\n hoverKey={hoverKey}\n setHoverKey={setHoverKey}\n onChange={(x) => changeProperty('action', x)}\n />\n <Button type=\"submit\">Save</Button>\n </Form>\n </div>\n );\n}\n\ninterface ActionArrayBuilderProps {\n actions: PlanDefinitionAction[];\n selectedKey: string | undefined;\n setSelectedKey: (key: string | undefined) => void;\n hoverKey: string | undefined;\n setHoverKey: (key: string | undefined) => void;\n onChange: (actions: PlanDefinitionAction[]) => void;\n}\n\nfunction ActionArrayBuilder(props: ActionArrayBuilderProps): JSX.Element {\n const { classes } = useStyles();\n const actionsRef = useRef<PlanDefinitionAction[]>();\n actionsRef.current = props.actions;\n\n function changeAction(changedAction: PlanDefinitionAction): void {\n props.onChange(\n (actionsRef.current as PlanDefinition[]).map((i) => (i.id === changedAction.id ? changedAction : i))\n );\n }\n\n function addAction(addedAction: PlanDefinitionAction): void {\n props.onChange([...(actionsRef.current as PlanDefinition[]), addedAction]);\n props.setSelectedKey(addedAction.id);\n }\n\n function removeAction(removedAction: PlanDefinitionAction): void {\n props.onChange((actionsRef.current as PlanDefinition[]).filter((i) => i !== removedAction));\n }\n\n return (\n <div className={classes.section}>\n {props.actions.map((action) => (\n <div key={action.id}>\n <ActionBuilder\n action={action}\n selectedKey={props.selectedKey}\n setSelectedKey={props.setSelectedKey}\n hoverKey={props.hoverKey}\n setHoverKey={props.setHoverKey}\n onChange={changeAction}\n onRemove={() => removeAction(action)}\n />\n </div>\n ))}\n <div className={classes.bottomActions}>\n <Anchor\n href=\"#\"\n onClick={(e: React.MouseEvent) => {\n killEvent(e);\n addAction({ id: generateId() });\n }}\n >\n Add action\n </Anchor>\n </div>\n </div>\n );\n}\n\ninterface ActionBuilderProps {\n action: PlanDefinitionAction;\n selectedKey: string | undefined;\n setSelectedKey: (key: string | undefined) => void;\n hoverKey: string | undefined;\n setHoverKey: (key: string | undefined) => void;\n onChange: (action: PlanDefinitionAction) => void;\n onRemove: () => void;\n}\n\nfunction ActionBuilder(props: ActionBuilderProps): JSX.Element {\n const { classes, cx } = useStyles();\n const { action } = props;\n const actionType = getInitialActionType(action);\n const editing = props.selectedKey === props.action.id;\n const hovering = props.hoverKey === props.action.id;\n\n function onClick(e: React.SyntheticEvent): void {\n e.stopPropagation();\n props.setSelectedKey(props.action.id);\n }\n\n function onHover(e: React.SyntheticEvent): void {\n killEvent(e);\n props.setHoverKey(props.action.id);\n }\n\n const className = cx(classes.section, {\n [classes.editing]: editing,\n [classes.hovering]: hovering && !editing,\n });\n\n return (\n <div data-testid={action.id} className={className} onClick={onClick} onMouseOver={onHover}>\n {editing ? (\n <ActionEditor\n action={action}\n actionType={actionType}\n onChange={props.onChange}\n selectedKey={props.selectedKey}\n setSelectedKey={props.setSelectedKey}\n hoverKey={props.hoverKey}\n setHoverKey={props.setHoverKey}\n onRemove={props.onRemove}\n />\n ) : (\n <ActionDisplay action={action} actionType={actionType} />\n )}\n <div className={classes.bottomActions}>\n <Anchor\n href=\"#\"\n onClick={(e: React.MouseEvent) => {\n e.preventDefault();\n props.onRemove();\n }}\n >\n Remove\n </Anchor>\n </div>\n </div>\n );\n}\n\nconst timingProperty: ElementDefinition = {\n path: 'PlanDefinition.action.timing[x]',\n min: 0,\n max: '1',\n type: [{ code: 'dateTime' }, { code: 'Period' }, { code: 'Range' }, { code: 'Timing' }],\n};\n\ninterface ActionDisplayProps {\n action: PlanDefinitionAction;\n actionType: string | undefined;\n}\n\nfunction ActionDisplay(props: ActionDisplayProps): JSX.Element {\n const { action, actionType } = props;\n const [propertyValue, propertyType] = getActionTiming(action);\n return (\n <div>\n <div>\n {action.title || 'Untitled'} {actionType && `(${actionType})`}\n </div>\n {action.definitionCanonical && (\n <div>\n <ReferenceDisplay value={{ reference: action.definitionCanonical }} />\n </div>\n )}\n {propertyValue && (\n <div>\n <ResourcePropertyDisplay property={timingProperty} propertyType={propertyType} value={propertyValue} />\n </div>\n )}\n </div>\n );\n}\n\ninterface ActionEditorProps {\n action: PlanDefinitionAction;\n actionType: string | undefined;\n selectedKey: string | undefined;\n setSelectedKey: (key: string | undefined) => void;\n hoverKey: string | undefined;\n setHoverKey: (key: string | undefined) => void;\n onChange: (action: PlanDefinitionAction) => void;\n onRemove: () => void;\n}\n\nfunction ActionEditor(props: ActionEditorProps): JSX.Element {\n const { action } = props;\n const [actionType, setActionType] = useState<string | undefined>(props.actionType);\n\n function changeProperty(property: string, value: any): void {\n props.onChange({\n ...action,\n [property]: value,\n } as PlanDefinitionAction);\n }\n\n return (\n <Stack spacing=\"xl\">\n <TextInput\n name={`actionTitle-${action.id}`}\n label=\"Title\"\n defaultValue={action.title}\n onChange={(e) => changeProperty('title', e.currentTarget.value)}\n />\n <TextInput\n name={`actionDescription-${action.id}`}\n label=\"Description\"\n defaultValue={action.description}\n onChange={(e) => changeProperty('description', e.currentTarget.value)}\n />\n <NativeSelect\n label=\"Type of Action\"\n description=\"The type of the action to be performed.\"\n name={`actionType-${action.id}`}\n defaultValue={actionType}\n onChange={(e) => setActionType(e.currentTarget.value)}\n data={['', 'appointment', 'lab', 'questionnaire', 'task']}\n />\n {action.action && action.action.length > 0 && (\n <ActionArrayBuilder\n actions={action.action}\n selectedKey={props.selectedKey}\n setSelectedKey={props.setSelectedKey}\n hoverKey={props.hoverKey}\n setHoverKey={props.setHoverKey}\n onChange={(x) => changeProperty('action', x)}\n />\n )}\n {(() => {\n switch (actionType) {\n case 'appointment':\n return (\n <ActionResourceTypeBuilder\n title=\"Appointment\"\n description=\"The subject must schedule an appointment from the schedule.\"\n resourceType=\"Schedule\"\n action={action}\n onChange={props.onChange}\n />\n );\n case 'lab':\n return (\n <ActionResourceTypeBuilder\n title=\"Lab\"\n description=\"The subject must complete the following lab panel.\"\n resourceType=\"ActivityDefinition\"\n action={action}\n onChange={props.onChange}\n />\n );\n case 'questionnaire':\n return (\n <ActionResourceTypeBuilder\n title=\"Questionnaire\"\n description=\"The subject must complete the selected questionnaire.\"\n resourceType=\"Questionnaire\"\n action={action}\n onChange={props.onChange}\n />\n );\n case 'task':\n return (\n <ActionResourceTypeBuilder\n title=\"Task\"\n description=\"The subject must complete the following task.\"\n resourceType=\"ActivityDefinition\"\n action={action}\n onChange={props.onChange}\n />\n );\n default:\n return null;\n }\n })()}\n <FormSection title=\"Timing\" description=\"When the action should take place.\">\n <ActionTimingInput name={'timing-' + action.id} action={action} onChange={props.onChange} />\n </FormSection>\n </Stack>\n );\n}\n\ninterface ActionResourceTypeBuilderProps {\n action: PlanDefinitionAction;\n title: string;\n description: string;\n resourceType: ResourceType;\n onChange: (action: PlanDefinitionAction) => void;\n}\n\nfunction ActionResourceTypeBuilder(props: ActionResourceTypeBuilderProps): JSX.Element {\n const { id, definitionCanonical } = props.action;\n const reference = definitionCanonical?.startsWith(props.resourceType + '/')\n ? { reference: definitionCanonical }\n : undefined;\n return (\n <ResourceInput\n name={id as string}\n resourceType={props.resourceType}\n defaultValue={reference}\n loadOnFocus={true}\n onChange={(newValue) => {\n if (newValue) {\n props.onChange({ ...props.action, definitionCanonical: getReferenceString(newValue) });\n } else {\n props.onChange({ ...props.action, definitionCanonical: undefined });\n }\n }}\n />\n );\n}\n\ninterface ActionTimingInputProps {\n name: string;\n action: PlanDefinitionAction;\n onChange: (action: PlanDefinitionAction) => void;\n}\n\nfunction ActionTimingInput(props: ActionTimingInputProps): JSX.Element {\n const value = props.action;\n const key = 'timing';\n const [propertyValue, propertyType] = getActionTiming(value);\n return (\n <ResourcePropertyInput\n property={timingProperty}\n name=\"timing[x]\"\n defaultValue={propertyValue}\n defaultPropertyType={propertyType}\n onChange={(newValue: any, propName?: string) => {\n props.onChange(setPropertyValue(value, key, propName ?? key, timingProperty, newValue));\n }}\n />\n );\n}\n\nfunction getInitialActionType(action: PlanDefinitionAction): string | undefined {\n if (action.definitionCanonical?.startsWith('Schedule')) {\n return 'appointment';\n }\n\n if (action.definitionCanonical?.startsWith('Questionnaire/')) {\n return 'questionnaire';\n }\n\n if (action.definitionCanonical?.startsWith('ActivityDefinition/')) {\n return 'task';\n }\n\n return undefined;\n}\n\nfunction getActionTiming(action: PlanDefinitionAction): [any, PropertyType] {\n return getValueAndType({ type: 'PlanDefinitionAction', value: action }, 'timing');\n}\n\nlet nextId = 1;\n\n/**\n * Generates a unique ID.\n * React needs unique IDs for components for rendering performance.\n * All of the important components in the questionnaire builder have id properties for this:\n * Questionnaire, QuestionnaireItem, and QuestionnaireItemAnswerOption.\n * @return A unique key.\n */\nfunction generateId(existing?: string): string {\n if (existing) {\n if (existing.startsWith('id-')) {\n const existingNum = parseInt(existing.substring(3));\n if (!isNaN(existingNum)) {\n nextId = Math.max(nextId, existingNum + 1);\n }\n }\n return existing;\n }\n return 'id-' + nextId++;\n}\n\nfunction ensurePlanDefinitionKeys(planDefinition: PlanDefinition): PlanDefinition {\n return {\n ...planDefinition,\n action: ensurePlanDefinitionActionKeys(planDefinition.action),\n } as PlanDefinition;\n}\n\nfunction ensurePlanDefinitionActionKeys(\n actions: PlanDefinitionAction[] | undefined\n): PlanDefinitionAction[] | undefined {\n if (!actions) {\n return undefined;\n }\n return actions.map((action) => ({\n ...action,\n id: generateId(action.id),\n action: ensurePlanDefinitionActionKeys(action.action),\n }));\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;AAeA,MAAM,SAAS,GAAG,YAAY,CAAC,CAAC,KAAK,MAAM;AACzC,IAAA,OAAO,EAAE;AACP,QAAA,QAAQ,EAAE,UAAU;AACpB,QAAA,MAAM,EAAE,eAAe;AACv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AAC;AACjB,KAAA;AACD,IAAA,OAAO,KAAK,GAAG,MAAM,EAAE,CAAC;AAC1B,CAAC;AAED,SAAS,wBAAwB,CAAC,cAA8B,EAAA;IAC9D,OAAO;AACL,QAAA,GAAG,cAAc;AACjB,QAAA,MAAM,EAAE,8BAA8B,CAAC,cAAc,CAAC,MAAM,CAAC;KAC5C,CAAC;AACtB,CAAC;AAED,SAAS,8BAA8B,CACrC,OAA2C,EAAA;IAE3C,IAAI,CAAC,OAAO,EAAE;AACZ,QAAA,OAAO,SAAS,CAAC;AAClB,KAAA;IACD,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,MAAM;AAC9B,QAAA,GAAG,MAAM;AACT,QAAA,EAAE,EAAE,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC;AACzB,QAAA,MAAM,EAAE,8BAA8B,CAAC,MAAM,CAAC,MAAM,CAAC;AACtD,KAAA,CAAC,CAAC,CAAC;AACN;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QuantityDisplay.mjs","sources":["../../../src/QuantityDisplay/QuantityDisplay.tsx"],"sourcesContent":["import { formatQuantity } from '@medplum/core';\nimport { Quantity } from '@medplum/fhirtypes';\nimport React from 'react';\n\nexport interface QuantityDisplayProps {\n value?: Quantity;\n}\n\nexport function QuantityDisplay(props: QuantityDisplayProps): JSX.Element | null {\n return <>{formatQuantity(props.value)}</>;\n}\n"],"names":[],"mappings":";;;AAQM,SAAU,eAAe,CAAC,KAA2B,EAAA;IACzD,OAAO,KAAA,CAAA,aAAA,CAAA,KAAA,CAAA,QAAA,EAAA,IAAA,EAAG,cAAc,CAAC,KAAK,CAAC,KAAK,CAAC,CAAI,CAAC;AAC5C;;;;"}
|
|
@@ -2,7 +2,6 @@ import { Group, NativeSelect, TextInput } from '@mantine/core';
|
|
|
2
2
|
import React, { useState } from 'react';
|
|
3
3
|
|
|
4
4
|
function QuantityInput(props) {
|
|
5
|
-
var _a;
|
|
6
5
|
const [value, setValue] = useState(props.defaultValue);
|
|
7
6
|
function setValueWrapper(newValue) {
|
|
8
7
|
setValue(newValue);
|
|
@@ -11,9 +10,18 @@ function QuantityInput(props) {
|
|
|
11
10
|
}
|
|
12
11
|
}
|
|
13
12
|
return (React.createElement(Group, { spacing: "xs", grow: true, noWrap: true },
|
|
14
|
-
React.createElement(NativeSelect, { style: { width: 80 }, "data-testid": props.name + '-comparator', defaultValue: value
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
React.createElement(NativeSelect, { style: { width: 80 }, "data-testid": props.name + '-comparator', defaultValue: value?.comparator, data: ['', '<', '<=', '>=', '>'], onChange: (e) => setValueWrapper({
|
|
14
|
+
...value,
|
|
15
|
+
comparator: e.currentTarget.value,
|
|
16
|
+
}) }),
|
|
17
|
+
React.createElement(TextInput, { id: props.name, name: props.name, "data-testid": props.name + '-value', type: "number", step: "any", placeholder: "Value", defaultValue: value?.value?.toString(), onChange: (e) => setValueWrapper({
|
|
18
|
+
...value,
|
|
19
|
+
value: tryParseNumber(e.currentTarget.value),
|
|
20
|
+
}) }),
|
|
21
|
+
React.createElement(TextInput, { placeholder: "Unit", "data-testid": props.name + '-unit', defaultValue: value?.unit, onChange: (e) => setValueWrapper({
|
|
22
|
+
...value,
|
|
23
|
+
unit: e.currentTarget.value,
|
|
24
|
+
}) })));
|
|
17
25
|
}
|
|
18
26
|
function tryParseNumber(str) {
|
|
19
27
|
if (!str) {
|
|
@@ -23,4 +31,4 @@ function tryParseNumber(str) {
|
|
|
23
31
|
}
|
|
24
32
|
|
|
25
33
|
export { QuantityInput };
|
|
26
|
-
//# sourceMappingURL=QuantityInput.
|
|
34
|
+
//# sourceMappingURL=QuantityInput.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QuantityInput.mjs","sources":["../../../src/QuantityInput/QuantityInput.tsx"],"sourcesContent":["import { Group, NativeSelect, TextInput } from '@mantine/core';\nimport { Quantity } from '@medplum/fhirtypes';\nimport React, { useState } from 'react';\n\nexport interface QuantityInputProps {\n name: string;\n defaultValue?: Quantity;\n onChange?: (value: Quantity) => void;\n}\n\nexport function QuantityInput(props: QuantityInputProps): JSX.Element {\n const [value, setValue] = useState(props.defaultValue);\n\n function setValueWrapper(newValue: Quantity): void {\n setValue(newValue);\n if (props.onChange) {\n props.onChange(newValue);\n }\n }\n\n return (\n <Group spacing=\"xs\" grow noWrap>\n <NativeSelect\n style={{ width: 80 }}\n data-testid={props.name + '-comparator'}\n defaultValue={value?.comparator}\n data={['', '<', '<=', '>=', '>']}\n onChange={(e) =>\n setValueWrapper({\n ...value,\n comparator: e.currentTarget.value as '<' | '<=' | '>=' | '>',\n })\n }\n />\n <TextInput\n id={props.name}\n name={props.name}\n data-testid={props.name + '-value'}\n type=\"number\"\n step=\"any\"\n placeholder=\"Value\"\n defaultValue={value?.value?.toString()}\n onChange={(e) =>\n setValueWrapper({\n ...value,\n value: tryParseNumber(e.currentTarget.value),\n })\n }\n />\n <TextInput\n placeholder=\"Unit\"\n data-testid={props.name + '-unit'}\n defaultValue={value?.unit}\n onChange={(e) =>\n setValueWrapper({\n ...value,\n unit: e.currentTarget.value,\n })\n }\n />\n </Group>\n );\n}\n\nfunction tryParseNumber(str: string): number | undefined {\n if (!str) {\n return undefined;\n }\n return parseFloat(str);\n}\n"],"names":[],"mappings":";;;AAUM,SAAU,aAAa,CAAC,KAAyB,EAAA;AACrD,IAAA,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;IAEvD,SAAS,eAAe,CAAC,QAAkB,EAAA;QACzC,QAAQ,CAAC,QAAQ,CAAC,CAAC;QACnB,IAAI,KAAK,CAAC,QAAQ,EAAE;AAClB,YAAA,KAAK,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;AAC1B,SAAA;KACF;IAED,QACE,KAAC,CAAA,aAAA,CAAA,KAAK,EAAC,EAAA,OAAO,EAAC,IAAI,EAAC,IA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