@medplum/react 1.0.4 → 1.0.6
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/AsyncAutocomplete/AsyncAutocomplete.d.ts +14 -0
- package/dist/cjs/DiagnosticReportDisplay/DiagnosticReportDisplay.stories.d.ts +1 -0
- package/dist/cjs/FhirPathTable/FhirPathTable.d.ts +2 -2
- 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/ValueSetAutocomplete/ValueSetAutocomplete.d.ts +3 -6
- package/dist/cjs/auth/ChooseProfileForm.d.ts +2 -1
- package/dist/cjs/auth/ChooseScopeForm.d.ts +2 -1
- package/dist/cjs/auth/MfaForm.d.ts +7 -0
- package/dist/cjs/auth/SignInForm.d.ts +10 -0
- package/dist/cjs/{index.js → index.cjs} +860 -642
- package/dist/cjs/index.cjs.map +1 -0
- package/dist/cjs/index.d.ts +3 -0
- package/dist/cjs/index.min.cjs +1 -0
- package/dist/cjs/stories/referenceLab.d.ts +3 -1
- 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.d.ts +14 -0
- package/dist/esm/AsyncAutocomplete/AsyncAutocomplete.mjs +113 -0
- 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} +6 -5
- 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.mjs +36 -0
- 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} +5 -4
- 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} +19 -16
- package/dist/esm/DiagnosticReportDisplay/DiagnosticReportDisplay.mjs.map +1 -0
- package/dist/esm/DiagnosticReportDisplay/DiagnosticReportDisplay.stories.d.ts +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.d.ts +2 -2
- 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/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} +37 -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} +19 -25
- 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} +3 -2
- 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.d.ts +3 -6
- package/dist/esm/ValueSetAutocomplete/ValueSetAutocomplete.mjs +43 -0
- package/dist/esm/ValueSetAutocomplete/ValueSetAutocomplete.mjs.map +1 -0
- package/dist/esm/auth/{AuthenticationForm.js → AuthenticationForm.mjs} +21 -19
- package/dist/esm/auth/AuthenticationForm.mjs.map +1 -0
- package/dist/esm/auth/ChooseProfileForm.d.ts +2 -1
- package/dist/esm/auth/ChooseProfileForm.mjs +29 -0
- package/dist/esm/auth/ChooseProfileForm.mjs.map +1 -0
- package/dist/esm/auth/ChooseScopeForm.d.ts +2 -1
- package/dist/esm/auth/{ChooseScopeForm.js → ChooseScopeForm.mjs} +4 -4
- package/dist/esm/auth/ChooseScopeForm.mjs.map +1 -0
- package/dist/esm/auth/MfaForm.d.ts +7 -0
- package/dist/esm/auth/MfaForm.mjs +34 -0
- 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} +15 -19
- 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 +10 -0
- package/dist/esm/auth/{SignInForm.js → SignInForm.mjs} +25 -10
- 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 +3 -0
- package/dist/esm/index.min.mjs +1 -0
- package/dist/esm/{index.js → index.mjs} +88 -85
- package/dist/esm/index.mjs.map +1 -0
- package/dist/esm/stories/referenceLab.d.ts +3 -1
- 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/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/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 +0 -37
- 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 -65
- package/dist/esm/ValueSetAutocomplete/ValueSetAutocomplete.js.map +0 -1
- 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/NewProjectForm.js.map +0 -1
- package/dist/esm/auth/NewUserForm.js.map +0 -1
- 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
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Group, Button, Modal, TextInput, NativeSelect, Checkbox } from '@mantine/core';
|
|
2
2
|
import { formatTiming } from '@medplum/core';
|
|
3
3
|
import React, { useState, useRef } from 'react';
|
|
4
|
-
import { DateTimeInput } from '../DateTimeInput/DateTimeInput.
|
|
5
|
-
import { FormSection } from '../FormSection/FormSection.
|
|
4
|
+
import { DateTimeInput } from '../DateTimeInput/DateTimeInput.mjs';
|
|
5
|
+
import { FormSection } from '../FormSection/FormSection.mjs';
|
|
6
6
|
|
|
7
7
|
const daysOfWeek = ['sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat'];
|
|
8
8
|
function TimingInput(props) {
|
|
@@ -23,23 +23,20 @@ function TimingInput(props) {
|
|
|
23
23
|
}, onCancel: () => setOpen(false) })));
|
|
24
24
|
}
|
|
25
25
|
function TimingEditorDialog(props) {
|
|
26
|
-
var _a, _b;
|
|
27
26
|
const [value, setValue] = useState(props.defaultValue || {});
|
|
28
27
|
const valueRef = useRef();
|
|
29
28
|
valueRef.current = value;
|
|
30
29
|
function setStart(newStart) {
|
|
31
|
-
setValue(
|
|
30
|
+
setValue({ ...valueRef.current, event: [newStart] });
|
|
32
31
|
}
|
|
33
32
|
function setRepeat(repeat) {
|
|
34
|
-
setValue(
|
|
33
|
+
setValue({ ...valueRef.current, repeat });
|
|
35
34
|
}
|
|
36
35
|
function setPeriod(newPeriod) {
|
|
37
|
-
|
|
38
|
-
setRepeat(Object.assign(Object.assign({}, (_a = valueRef.current) === null || _a === void 0 ? void 0 : _a.repeat), { period: newPeriod }));
|
|
36
|
+
setRepeat({ ...valueRef.current?.repeat, period: newPeriod });
|
|
39
37
|
}
|
|
40
38
|
function setPeriodUnit(newPeriodUnit) {
|
|
41
|
-
|
|
42
|
-
setRepeat(Object.assign(Object.assign({}, (_a = valueRef.current) === null || _a === void 0 ? void 0 : _a.repeat), { periodUnit: newPeriodUnit }));
|
|
39
|
+
setRepeat({ ...valueRef.current?.repeat, periodUnit: newPeriodUnit });
|
|
43
40
|
}
|
|
44
41
|
function setDayOfWeek(day, enabled) {
|
|
45
42
|
if (enabled) {
|
|
@@ -50,17 +47,15 @@ function TimingEditorDialog(props) {
|
|
|
50
47
|
}
|
|
51
48
|
}
|
|
52
49
|
function addDayOfWeek(day) {
|
|
53
|
-
|
|
54
|
-
const existing = ((_b = (_a = valueRef.current) === null || _a === void 0 ? void 0 : _a.repeat) === null || _b === void 0 ? void 0 : _b.dayOfWeek) || [];
|
|
50
|
+
const existing = valueRef.current?.repeat?.dayOfWeek || [];
|
|
55
51
|
if (!existing.includes(day)) {
|
|
56
|
-
setRepeat(
|
|
52
|
+
setRepeat({ ...valueRef.current?.repeat, dayOfWeek: [...existing, day] });
|
|
57
53
|
}
|
|
58
54
|
}
|
|
59
55
|
function removeDayOfWeek(day) {
|
|
60
|
-
|
|
61
|
-
const existing = ((_b = (_a = valueRef.current) === null || _a === void 0 ? void 0 : _a.repeat) === null || _b === void 0 ? void 0 : _b.dayOfWeek) || [];
|
|
56
|
+
const existing = valueRef.current?.repeat?.dayOfWeek || [];
|
|
62
57
|
if (existing.includes(day)) {
|
|
63
|
-
setRepeat(
|
|
58
|
+
setRepeat({ ...valueRef.current?.repeat, dayOfWeek: existing.filter((d) => d !== day) });
|
|
64
59
|
}
|
|
65
60
|
}
|
|
66
61
|
return (React.createElement(Modal, { title: "Timing", closeButtonLabel: "Close", opened: props.visible, onClose: () => props.onCancel() },
|
|
@@ -69,8 +64,8 @@ function TimingEditorDialog(props) {
|
|
|
69
64
|
React.createElement(DateTimeInput, { name: 'timing-dialog-start', onChange: (newValue) => setStart(newValue) })),
|
|
70
65
|
React.createElement(FormSection, { title: "Repeat every", htmlFor: 'timing-dialog-period' },
|
|
71
66
|
React.createElement(Group, { spacing: "xs", grow: true, noWrap: true },
|
|
72
|
-
React.createElement(TextInput, { type: "number", step: 1, id: "timing-dialog-period", name: "timing-dialog-period", defaultValue:
|
|
73
|
-
React.createElement(NativeSelect, { id: "timing-dialog-periodUnit", name: "timing-dialog-periodUnit", defaultValue:
|
|
67
|
+
React.createElement(TextInput, { type: "number", step: 1, id: "timing-dialog-period", name: "timing-dialog-period", defaultValue: value?.repeat?.period, onChange: (e) => setPeriod(parseInt(e.currentTarget.value)) }),
|
|
68
|
+
React.createElement(NativeSelect, { id: "timing-dialog-periodUnit", name: "timing-dialog-periodUnit", defaultValue: value?.repeat?.periodUnit, onChange: (e) => setPeriodUnit(e.currentTarget.value), data: [
|
|
74
69
|
{ label: 'day', value: 'd' },
|
|
75
70
|
{ label: 'week', value: 'wk' },
|
|
76
71
|
{ label: 'month', value: 'mo' },
|
|
@@ -84,4 +79,4 @@ function TimingEditorDialog(props) {
|
|
|
84
79
|
}
|
|
85
80
|
|
|
86
81
|
export { TimingInput };
|
|
87
|
-
//# sourceMappingURL=TimingInput.
|
|
82
|
+
//# sourceMappingURL=TimingInput.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TimingInput.mjs","sources":["../../../src/TimingInput/TimingInput.tsx"],"sourcesContent":["import { Button, Checkbox, Group, Modal, NativeSelect, TextInput } from '@mantine/core';\nimport { formatTiming } from '@medplum/core';\nimport { Timing, TimingRepeat } from '@medplum/fhirtypes';\nimport React, { useRef, useState } from 'react';\nimport { DateTimeInput } from '../DateTimeInput/DateTimeInput';\nimport { FormSection } from '../FormSection/FormSection';\n\nconst daysOfWeek = ['sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat'];\n\ntype DayOfWeek = 'sun' | 'mon' | 'tue' | 'wed' | 'thu' | 'fri' | 'sat';\n\nexport interface TimingInputProps {\n name: string;\n defaultValue?: Timing;\n onChange?: (newValue: Timing) => void;\n}\n\nexport function TimingInput(props: TimingInputProps): JSX.Element {\n const [value, setValue] = useState<Timing>(props.defaultValue || {});\n const [open, setOpen] = useState(false);\n\n const valueRef = useRef<Timing>();\n valueRef.current = value;\n\n return (\n <>\n <Group spacing=\"xs\" grow noWrap>\n <span>{formatTiming(valueRef.current) || 'No repeat'}</span>\n <Button onClick={() => setOpen(true)}>Edit</Button>\n </Group>\n <TimingEditorDialog\n visible={open}\n defaultValue={valueRef.current}\n onOk={(newValue) => {\n if (props.onChange) {\n props.onChange(newValue);\n }\n setValue(newValue);\n setOpen(false);\n }}\n onCancel={() => setOpen(false)}\n />\n </>\n );\n}\n\ninterface TimingEditorDialogProps {\n visible: boolean;\n defaultValue?: Timing;\n onOk: (newValue: Timing) => void;\n onCancel: () => void;\n}\n\nfunction TimingEditorDialog(props: TimingEditorDialogProps): JSX.Element {\n const [value, setValue] = useState<Timing>(props.defaultValue || {});\n\n const valueRef = useRef<Timing>();\n valueRef.current = value;\n\n function setStart(newStart: string): void {\n setValue({ ...valueRef.current, event: [newStart] });\n }\n\n function setRepeat(repeat: TimingRepeat): void {\n setValue({ ...valueRef.current, repeat });\n }\n\n function setPeriod(newPeriod: number | undefined): void {\n setRepeat({ ...valueRef.current?.repeat, period: newPeriod });\n }\n\n function setPeriodUnit(newPeriodUnit: 'a' | 's' | 'min' | 'h' | 'd' | 'wk' | 'mo' | undefined): void {\n setRepeat({ ...valueRef.current?.repeat, periodUnit: newPeriodUnit });\n }\n\n function setDayOfWeek(day: DayOfWeek, enabled: boolean): void {\n if (enabled) {\n addDayOfWeek(day);\n } else {\n removeDayOfWeek(day);\n }\n }\n\n function addDayOfWeek(day: DayOfWeek): void {\n const existing = valueRef.current?.repeat?.dayOfWeek || [];\n if (!existing.includes(day)) {\n setRepeat({ ...valueRef.current?.repeat, dayOfWeek: [...existing, day] });\n }\n }\n\n function removeDayOfWeek(day: DayOfWeek): void {\n const existing = valueRef.current?.repeat?.dayOfWeek || [];\n if (existing.includes(day)) {\n setRepeat({ ...valueRef.current?.repeat, dayOfWeek: existing.filter((d) => d !== day) });\n }\n }\n\n return (\n <Modal title=\"Timing\" closeButtonLabel=\"Close\" opened={props.visible} onClose={() => props.onCancel()}>\n <div style={{ padding: '5px 20px', textAlign: 'left' }}>\n <FormSection title=\"Starts on\" htmlFor={'timing-dialog-start'}>\n <DateTimeInput name={'timing-dialog-start'} onChange={(newValue) => setStart(newValue)} />\n </FormSection>\n <FormSection title=\"Repeat every\" htmlFor={'timing-dialog-period'}>\n <Group spacing=\"xs\" grow noWrap>\n <TextInput\n type=\"number\"\n step={1}\n id=\"timing-dialog-period\"\n name=\"timing-dialog-period\"\n defaultValue={value?.repeat?.period}\n onChange={(e) => setPeriod(parseInt(e.currentTarget.value))}\n />\n <NativeSelect\n id=\"timing-dialog-periodUnit\"\n name=\"timing-dialog-periodUnit\"\n defaultValue={value?.repeat?.periodUnit}\n onChange={(e) => setPeriodUnit(e.currentTarget.value as 'a' | 'd' | 'wk' | 'mo' | undefined)}\n data={[\n { label: 'day', value: 'd' },\n { label: 'week', value: 'wk' },\n { label: 'month', value: 'mo' },\n { label: 'year', value: 'a' },\n ]}\n />\n </Group>\n </FormSection>\n <FormSection title=\"Repeat on\">\n <Group spacing=\"xs\" grow noWrap>\n {daysOfWeek.map((day) => (\n <React.Fragment key={day}>\n <label htmlFor={'timing-dialog-repeat-' + day}>{day.charAt(0).toUpperCase()}</label>\n <Checkbox\n id={'timing-dialog-repeat-' + day}\n name={'timing-dialog-repeat-' + day}\n onChange={(e) => setDayOfWeek(day as DayOfWeek, e.currentTarget.checked)}\n />\n </React.Fragment>\n ))}\n </Group>\n </FormSection>\n </div>\n <Button onClick={() => props.onOk(value)}>OK</Button>\n </Modal>\n );\n}\n"],"names":[],"mappings":";;;;;;AAOA,MAAM,UAAU,GAAG,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;AAU/D,SAAU,WAAW,CAAC,KAAuB,EAAA;AACjD,IAAA,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAS,KAAK,CAAC,YAAY,IAAI,EAAE,CAAC,CAAC;IACrE,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;AAExC,IAAA,MAAM,QAAQ,GAAG,MAAM,EAAU,CAAC;AAClC,IAAA,QAAQ,CAAC,OAAO,GAAG,KAAK,CAAC;AAEzB,IAAA,QACE,KAAA,CAAA,aAAA,CAAA,KAAA,CAAA,QAAA,EAAA,IAAA;QACE,KAAC,CAAA,aAAA,CAAA,KAAK,IAAC,OAAO,EAAC,IAAI,EAAC,IAAI,QAAC,MAAM,EAAA,IAAA,EAAA;YAC7B,KAAO,CAA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ACJ;;;;"}
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { ElementDefinition, ValueSetExpansionContains } from '@medplum/fhirtypes';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
placeholder?: string;
|
|
7
|
-
defaultValue?: ValueSetExpansionContains;
|
|
8
|
-
onChange?: (value: ValueSetExpansionContains | undefined) => void;
|
|
3
|
+
import { AsyncAutocompleteProps } from '../AsyncAutocomplete/AsyncAutocomplete';
|
|
4
|
+
export interface ValueSetAutocompleteProps extends Omit<AsyncAutocompleteProps<ValueSetExpansionContains>, 'loadOptions' | 'toKey' | 'toOption'> {
|
|
5
|
+
elementDefinition: ElementDefinition;
|
|
9
6
|
}
|
|
10
7
|
export declare function ValueSetAutocomplete(props: ValueSetAutocompleteProps): JSX.Element;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import React, { useCallback } from 'react';
|
|
2
|
+
import { AsyncAutocomplete } from '../AsyncAutocomplete/AsyncAutocomplete.mjs';
|
|
3
|
+
import { useMedplum } from '../MedplumProvider/MedplumProvider.mjs';
|
|
4
|
+
|
|
5
|
+
function toKey(element) {
|
|
6
|
+
return element.code;
|
|
7
|
+
}
|
|
8
|
+
function toOption(element) {
|
|
9
|
+
return {
|
|
10
|
+
value: element.code,
|
|
11
|
+
label: getDisplay(element),
|
|
12
|
+
resource: element,
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
function createValue(input) {
|
|
16
|
+
return {
|
|
17
|
+
code: input,
|
|
18
|
+
display: input,
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
function ValueSetAutocomplete(props) {
|
|
22
|
+
const medplum = useMedplum();
|
|
23
|
+
const { elementDefinition, ...rest } = props;
|
|
24
|
+
const loadValues = useCallback(async (input, signal) => {
|
|
25
|
+
const system = elementDefinition.binding?.valueSet;
|
|
26
|
+
const valueSet = await medplum.searchValueSet(system, input, { signal });
|
|
27
|
+
const valueSetElements = valueSet.expansion?.contains;
|
|
28
|
+
const newData = [];
|
|
29
|
+
for (const valueSetElement of valueSetElements) {
|
|
30
|
+
if (valueSetElement.code && !newData.some((item) => item.code === valueSetElement.code)) {
|
|
31
|
+
newData.push(valueSetElement);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return newData;
|
|
35
|
+
}, [medplum, elementDefinition]);
|
|
36
|
+
return (React.createElement(AsyncAutocomplete, { ...rest, creatable: true, clearable: true, toKey: toKey, toOption: toOption, loadOptions: loadValues, getCreateLabel: (query) => `+ Create ${query}`, onCreate: createValue }));
|
|
37
|
+
}
|
|
38
|
+
function getDisplay(item) {
|
|
39
|
+
return item.display || item.code || '';
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export { ValueSetAutocomplete };
|
|
43
|
+
//# sourceMappingURL=ValueSetAutocomplete.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ValueSetAutocomplete.mjs","sources":["../../../src/ValueSetAutocomplete/ValueSetAutocomplete.tsx"],"sourcesContent":["import { ElementDefinition, ValueSetExpansionContains } from '@medplum/fhirtypes';\nimport React, { useCallback } from 'react';\nimport {\n AsyncAutocomplete,\n AsyncAutocompleteOption,\n AsyncAutocompleteProps,\n} from '../AsyncAutocomplete/AsyncAutocomplete';\nimport { useMedplum } from '../MedplumProvider/MedplumProvider';\n\nexport interface ValueSetAutocompleteProps\n extends Omit<AsyncAutocompleteProps<ValueSetExpansionContains>, 'loadOptions' | 'toKey' | 'toOption'> {\n elementDefinition: ElementDefinition;\n}\n\nfunction toKey(element: ValueSetExpansionContains): string {\n return element.code as string;\n}\n\nfunction toOption(element: ValueSetExpansionContains): AsyncAutocompleteOption<ValueSetExpansionContains> {\n return {\n value: element.code as string,\n label: getDisplay(element),\n resource: element,\n };\n}\n\nfunction createValue(input: string): ValueSetExpansionContains {\n return {\n code: input,\n display: input,\n };\n}\n\nexport function ValueSetAutocomplete(props: ValueSetAutocompleteProps): JSX.Element {\n const medplum = useMedplum();\n const { elementDefinition, ...rest } = props;\n\n const loadValues = useCallback(\n async (input: string, signal: AbortSignal): Promise<ValueSetExpansionContains[]> => {\n const system = elementDefinition.binding?.valueSet as string;\n const valueSet = await medplum.searchValueSet(system, input, { signal });\n const valueSetElements = valueSet.expansion?.contains as ValueSetExpansionContains[];\n const newData: ValueSetExpansionContains[] = [];\n\n for (const valueSetElement of valueSetElements) {\n if (valueSetElement.code && !newData.some((item) => item.code === valueSetElement.code)) {\n newData.push(valueSetElement);\n }\n }\n\n return newData;\n },\n [medplum, elementDefinition]\n );\n\n return (\n <AsyncAutocomplete\n {...rest}\n creatable\n clearable\n toKey={toKey}\n toOption={toOption}\n loadOptions={loadValues}\n getCreateLabel={(query) => `+ Create ${query}`}\n onCreate={createValue}\n />\n );\n}\n\nfunction getDisplay(item: ValueSetExpansionContains): string {\n return item.display || item.code || '';\n}\n"],"names":[],"mappings":";;;;AAcA,SAAS,KAAK,CAAC,OAAkC,EAAA;IAC/C,OAAO,OAAO,CAAC,IAAc,CAAC;AAChC,CAAC;AAED,SAAS,QAAQ,CAAC,OAAkC,EAAA;IAClD,OAAO;QACL,KAAK,EAAE,OAAO,CAAC,IAAc;AAC7B,QAAA,KAAK,EAAE,UAAU,CAAC,OAAO,CAAC;AAC1B,QAAA,QAAQ,EAAE,OAAO;KAClB,CAAC;AACJ,CAAC;AAED,SAAS,WAAW,CAAC,KAAa,EAAA;IAChC,OAAO;AACL,QAAA,IAAI,EAAE,KAAK;AACX,QAAA,OAAO,EAAE,KAAK;KACf,CAAC;AACJ,CAAC;AAEK,SAAU,oBAAoB,CAAC,KAAgC,EAAA;AACnE,IAAA,MAAM,OAAO,GAAG,UAAU,EAAE,CAAC;IAC7B,MAAM,EAAE,iBAAiB,EAAE,GAAG,IAAI,EAAE,GAAG,KAAK,CAAC;IAE7C,MAAM,UAAU,GAAG,WAAW,CAC5B,OAAO,KAAa,EAAE,MAAmB,KAA0C;AACjF,QAAA,MAAM,MAAM,GAAG,iBAAiB,CAAC,OAAO,EAAE,QAAkB,CAAC;AAC7D,QAAA,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,cAAc,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC;AACzE,QAAA,MAAM,gBAAgB,GAAG,QAAQ,CAAC,SAAS,EAAE,QAAuC,CAAC;QACrF,MAAM,OAAO,GAAgC,EAAE,CAAC;AAEhD,QAAA,KAAK,MAAM,eAAe,IAAI,gBAAgB,EAAE;YAC9C,IAAI,eAAe,CAAC,IAAI,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,IAAI,KAAK,IAAI,CAAC,IAAI,KAAK,eAAe,CAAC,IAAI,CAAC,EAAE;AACvF,gBAAA,OAAO,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;AAC/B,aAAA;AACF,SAAA;AAED,QAAA,OAAO,OAAO,CAAC;AACjB,KAAC,EACD,CAAC,OAAO,EAAE,iBAAiB,CAAC,CAC7B,CAAC;AAEF,IAAA,QACE,KAAC,CAAA,aAAA,CAAA,iBAAiB,EACZ,EAAA,GAAA,IAAI,EACR,SAAS,EAAA,IAAA,EACT,SAAS,EAAA,IAAA,EACT,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,QAAQ,EAClB,WAAW,EAAE,UAAU,EACvB,cAAc,EAAE,CAAC,KAAK,KAAK,CAAY,SAAA,EAAA,KAAK,EAAE,EAC9C,QAAQ,EAAE,WAAW,EAAA,CACrB,EACF;AACJ,CAAC;AAED,SAAS,UAAU,CAAC,IAA+B,EAAA;IACjD,OAAO,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,IAAI,IAAI,EAAE,CAAC;AACzC;;;;"}
|
|
@@ -1,41 +1,43 @@
|
|
|
1
|
-
import { __rest, __awaiter } from '../node_modules/tslib/tslib.es6.js';
|
|
2
1
|
import { Center, Alert, Group, Divider, Stack, TextInput, PasswordInput, Anchor, Checkbox, Button } from '@mantine/core';
|
|
3
2
|
import { IconAlertCircle } from '@tabler/icons';
|
|
4
3
|
import React, { useState } from 'react';
|
|
5
|
-
import { Form } from '../Form/Form.
|
|
6
|
-
import { getGoogleClientId, GoogleButton } from '../GoogleButton/GoogleButton.
|
|
7
|
-
import { useMedplum } from '../MedplumProvider/MedplumProvider.
|
|
8
|
-
import { getIssuesForExpression, getErrorsForInput } from '../utils/outcomes.
|
|
4
|
+
import { Form } from '../Form/Form.mjs';
|
|
5
|
+
import { getGoogleClientId, GoogleButton } from '../GoogleButton/GoogleButton.mjs';
|
|
6
|
+
import { useMedplum } from '../MedplumProvider/MedplumProvider.mjs';
|
|
7
|
+
import { getIssuesForExpression, getErrorsForInput } from '../utils/outcomes.mjs';
|
|
9
8
|
|
|
10
9
|
function AuthenticationForm(props) {
|
|
11
|
-
const { generatePkce, onForgotPassword, onRegister, handleAuthResponse, children
|
|
10
|
+
const { generatePkce, onForgotPassword, onRegister, handleAuthResponse, children, ...baseLoginRequest } = props;
|
|
12
11
|
const medplum = useMedplum();
|
|
13
12
|
const googleClientId = getGoogleClientId(props.googleClientId);
|
|
14
13
|
const [outcome, setOutcome] = useState();
|
|
15
14
|
const issues = getIssuesForExpression(outcome, undefined);
|
|
16
|
-
function startPkce() {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}
|
|
21
|
-
});
|
|
15
|
+
async function startPkce() {
|
|
16
|
+
if (generatePkce) {
|
|
17
|
+
await medplum.startPkce();
|
|
18
|
+
}
|
|
22
19
|
}
|
|
23
20
|
return (React.createElement(Form, { style: { maxWidth: 400 }, onSubmit: (formData) => {
|
|
24
21
|
startPkce()
|
|
25
|
-
.then(() => medplum.startLogin(
|
|
22
|
+
.then(() => medplum.startLogin({
|
|
23
|
+
...baseLoginRequest,
|
|
24
|
+
email: formData.email,
|
|
25
|
+
password: formData.password,
|
|
26
|
+
remember: formData.remember === 'on',
|
|
27
|
+
}))
|
|
26
28
|
.then(handleAuthResponse)
|
|
27
29
|
.catch(setOutcome);
|
|
28
30
|
} },
|
|
29
31
|
React.createElement(Center, { sx: { flexDirection: 'column' } }, children),
|
|
30
|
-
issues && (React.createElement(Alert, { icon: React.createElement(IconAlertCircle, { size: 16 }), color: "red" }, issues.map((issue) => {
|
|
31
|
-
var _a, _b;
|
|
32
|
-
return (React.createElement("div", { "data-testid": "text-field-error", key: (_a = issue.details) === null || _a === void 0 ? void 0 : _a.text }, (_b = issue.details) === null || _b === void 0 ? void 0 : _b.text));
|
|
33
|
-
}))),
|
|
32
|
+
issues && (React.createElement(Alert, { icon: React.createElement(IconAlertCircle, { size: 16 }), color: "red" }, issues.map((issue) => (React.createElement("div", { "data-testid": "text-field-error", key: issue.details?.text }, issue.details?.text))))),
|
|
34
33
|
googleClientId && (React.createElement(React.Fragment, null,
|
|
35
34
|
React.createElement(Group, { position: "center", p: "xl", style: { height: 70 } },
|
|
36
35
|
React.createElement(GoogleButton, { googleClientId: googleClientId, handleGoogleCredential: (response) => {
|
|
37
36
|
startPkce()
|
|
38
|
-
.then(() => medplum.startGoogleLogin(
|
|
37
|
+
.then(() => medplum.startGoogleLogin({
|
|
38
|
+
...baseLoginRequest,
|
|
39
|
+
googleCredential: response.credential,
|
|
40
|
+
}))
|
|
39
41
|
.then(props.handleAuthResponse)
|
|
40
42
|
.catch(setOutcome);
|
|
41
43
|
} })),
|
|
@@ -51,4 +53,4 @@ function AuthenticationForm(props) {
|
|
|
51
53
|
}
|
|
52
54
|
|
|
53
55
|
export { AuthenticationForm };
|
|
54
|
-
//# sourceMappingURL=AuthenticationForm.
|
|
56
|
+
//# sourceMappingURL=AuthenticationForm.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AuthenticationForm.mjs","sources":["../../../src/auth/AuthenticationForm.tsx"],"sourcesContent":["import {\n Alert,\n Anchor,\n Button,\n Center,\n Checkbox,\n Divider,\n Group,\n PasswordInput,\n Stack,\n TextInput,\n} from '@mantine/core';\nimport {\n BaseLoginRequest,\n GoogleCredentialResponse,\n GoogleLoginRequest,\n LoginAuthenticationResponse,\n} from '@medplum/core';\nimport { OperationOutcome } from '@medplum/fhirtypes';\nimport { IconAlertCircle } from '@tabler/icons';\nimport React, { useState } from 'react';\nimport { Form } from '../Form/Form';\nimport { getGoogleClientId, GoogleButton } from '../GoogleButton/GoogleButton';\nimport { useMedplum } from '../MedplumProvider/MedplumProvider';\nimport { getErrorsForInput, getIssuesForExpression } from '../utils/outcomes';\n\nexport interface AuthenticationFormProps extends BaseLoginRequest {\n readonly generatePkce?: boolean;\n readonly onForgotPassword?: () => void;\n readonly onRegister?: () => void;\n readonly handleAuthResponse: (response: LoginAuthenticationResponse) => void;\n readonly children?: React.ReactNode;\n}\n\nexport function AuthenticationForm(props: AuthenticationFormProps): JSX.Element {\n const { generatePkce, onForgotPassword, onRegister, handleAuthResponse, children, ...baseLoginRequest } = props;\n const medplum = useMedplum();\n const googleClientId = getGoogleClientId(props.googleClientId);\n const [outcome, setOutcome] = useState<OperationOutcome>();\n const issues = getIssuesForExpression(outcome, undefined);\n\n async function startPkce(): Promise<void> {\n if (generatePkce) {\n await medplum.startPkce();\n }\n }\n\n return (\n <Form\n style={{ maxWidth: 400 }}\n onSubmit={(formData: Record<string, string>) => {\n startPkce()\n .then(() =>\n medplum.startLogin({\n ...baseLoginRequest,\n email: formData.email,\n password: formData.password,\n remember: formData.remember === 'on',\n })\n )\n .then(handleAuthResponse)\n .catch(setOutcome);\n }}\n >\n <Center sx={{ flexDirection: 'column' }}>{children}</Center>\n {issues && (\n <Alert icon={<IconAlertCircle size={16} />} color=\"red\">\n {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 {googleClientId && (\n <>\n <Group position=\"center\" p=\"xl\" style={{ height: 70 }}>\n <GoogleButton\n googleClientId={googleClientId}\n handleGoogleCredential={(response: GoogleCredentialResponse) => {\n startPkce()\n .then(() =>\n medplum.startGoogleLogin({\n ...baseLoginRequest,\n googleCredential: response.credential,\n } as GoogleLoginRequest)\n )\n .then(props.handleAuthResponse)\n .catch(setOutcome);\n }}\n />\n </Group>\n <Divider label=\"or\" labelPosition=\"center\" my=\"lg\" />\n </>\n )}\n <Stack spacing=\"xl\">\n <TextInput\n name=\"email\"\n type=\"email\"\n label=\"Email\"\n placeholder=\"name@domain.com\"\n required={true}\n autoFocus={true}\n error={getErrorsForInput(outcome, 'email')}\n />\n <PasswordInput\n name=\"password\"\n type=\"password\"\n label=\"Password\"\n autoComplete=\"off\"\n required={true}\n error={getErrorsForInput(outcome, 'password')}\n />\n </Stack>\n <Group position=\"apart\" mt=\"xl\" spacing={0} noWrap>\n {onForgotPassword && (\n <Anchor component=\"button\" type=\"button\" color=\"dimmed\" onClick={onForgotPassword} size=\"xs\">\n Forgot password\n </Anchor>\n )}\n {onRegister && (\n <Anchor component=\"button\" type=\"button\" color=\"dimmed\" onClick={onRegister} size=\"xs\">\n Register\n </Anchor>\n )}\n <Checkbox id=\"remember\" name=\"remember\" label=\"Remember me\" size=\"xs\" sx={{ lineHeight: 1 }} />\n <Button type=\"submit\">Sign in</Button>\n </Group>\n </Form>\n );\n}\n"],"names":[],"mappings":";;;;;;;;AAkCM,SAAU,kBAAkB,CAAC,KAA8B,EAAA;AAC/D,IAAA,MAAM,EAAE,YAAY,EAAE,gBAAgB,EAAE,UAAU,EAAE,kBAAkB,EAAE,QAAQ,EAAE,GAAG,gBAAgB,EAAE,GAAG,KAAK,CAAC;AAChH,IAAA,MAAM,OAAO,GAAG,UAAU,EAAE,CAAC;IAC7B,MAAM,cAAc,GAAG,iBAAiB,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;IAC/D,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,EAAoB,CAAC;IAC3D,MAAM,MAAM,GAAG,sBAAsB,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;AAE1D,IAAA,eAAe,SAAS,GAAA;AACtB,QAAA,IAA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EAAA,EAAC,QAAQ,EAAC,OAAO,EAAC,EAAE,EAAC,IAAI,EAAC,OAAO,EAAE,CAAC,EAAE,MAAM,EAAA,IAAA,EAAA;YAC/C,gBAAgB,KACf,KAAA,CAAA,aAAA,CAAC,MAAM,EAAA,EAAC,SAAS,EAAC,QAAQ,EAAC,IAAI,EAAC,QAAQ,EAAC,KAAK,EAAC,QAAQ,EAAC,OAAO,EAAE,gBAAgB,EAAE,IAAI,EAAC,IAAI,EAAA,EAAA,iBAAA,CAEnF,CACV;YACA,UAAU,KACT,KAAA,CAAA,aAAA,CAAC,MAAM,EAAA,EAAC,SAAS,EAAC,QAAQ,EAAC,IAAI,EAAC,QAAQ,EAAC,KAAK,EAAC,QAAQ,EAAC,OAAO,EAAE,UAAU,EAAE,IAAI,EAAC,IAAI,EAAA,EAAA,UAAA,CAE7E,CACV;YACD,KAAC,CAAA,aAAA,CAAA,QAAQ,EAAC,EAAA,EAAE,EAAC,UAAU,EAAC,IAAI,EAAC,UAAU,EAAC,KAAK,EAAC,aAAa,EAAC,IAAI,EAAC,IAAI,EAAC,EAAE,EAAE,EAAE,UAAU,EAAE,CAAC,EAAE,EAAI,CAAA;YAC/F,KAAC,CAAA,aAAA,CAAA,MAAM,IAAC,IAAI,EAAC,QAAQ,EAAiB,EAAA,SAAA,CAAA,CAChC,CACH,EACP;AACJ;;;;"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
import { LoginAuthenticationResponse } from '@medplum/core';
|
|
2
3
|
import { ProjectMembership } from '@medplum/fhirtypes';
|
|
3
4
|
export interface ChooseProfileFormProps {
|
|
4
5
|
login: string;
|
|
5
6
|
memberships: ProjectMembership[];
|
|
6
|
-
handleAuthResponse: (response:
|
|
7
|
+
handleAuthResponse: (response: LoginAuthenticationResponse) => void;
|
|
7
8
|
}
|
|
8
9
|
export declare function ChooseProfileForm(props: ChooseProfileFormProps): JSX.Element;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Stack, Center, Title, UnstyledButton, Group, Avatar, Text } from '@mantine/core';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { Logo } from '../Logo/Logo.mjs';
|
|
4
|
+
import { useMedplum } from '../MedplumProvider/MedplumProvider.mjs';
|
|
5
|
+
|
|
6
|
+
function ChooseProfileForm(props) {
|
|
7
|
+
const medplum = useMedplum();
|
|
8
|
+
return (React.createElement(Stack, null,
|
|
9
|
+
React.createElement(Center, { sx: { flexDirection: 'column' } },
|
|
10
|
+
React.createElement(Logo, { size: 32 }),
|
|
11
|
+
React.createElement(Title, null, "Choose profile")),
|
|
12
|
+
props.memberships.map((membership) => (React.createElement(UnstyledButton, { key: membership.id, onClick: () => {
|
|
13
|
+
medplum
|
|
14
|
+
.post('auth/profile', {
|
|
15
|
+
login: props.login,
|
|
16
|
+
profile: membership.id,
|
|
17
|
+
})
|
|
18
|
+
.then(props.handleAuthResponse)
|
|
19
|
+
.catch(console.log);
|
|
20
|
+
} },
|
|
21
|
+
React.createElement(Group, null,
|
|
22
|
+
React.createElement(Avatar, { radius: "xl" }),
|
|
23
|
+
React.createElement("div", { style: { flex: 1 } },
|
|
24
|
+
React.createElement(Text, { size: "sm", weight: 500 }, membership.profile?.display),
|
|
25
|
+
React.createElement(Text, { color: "dimmed", size: "xs" }, membership.project?.display))))))));
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export { ChooseProfileForm };
|
|
29
|
+
//# sourceMappingURL=ChooseProfileForm.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChooseProfileForm.mjs","sources":["../../../src/auth/ChooseProfileForm.tsx"],"sourcesContent":["import { Avatar, Center, Group, Stack, Text, Title, UnstyledButton } from '@mantine/core';\nimport { LoginAuthenticationResponse } from '@medplum/core';\nimport { ProjectMembership } from '@medplum/fhirtypes';\nimport React from 'react';\nimport { Logo } from '../Logo/Logo';\nimport { useMedplum } from '../MedplumProvider/MedplumProvider';\n\nexport interface ChooseProfileFormProps {\n login: string;\n memberships: ProjectMembership[];\n handleAuthResponse: (response: LoginAuthenticationResponse) => void;\n}\n\nexport function ChooseProfileForm(props: ChooseProfileFormProps): JSX.Element {\n const medplum = useMedplum();\n return (\n <Stack>\n <Center sx={{ flexDirection: 'column' }}>\n <Logo size={32} />\n <Title>Choose profile</Title>\n </Center>\n {props.memberships.map((membership: ProjectMembership) => (\n <UnstyledButton\n key={membership.id}\n onClick={() => {\n medplum\n .post('auth/profile', {\n login: props.login,\n profile: membership.id,\n })\n .then(props.handleAuthResponse)\n .catch(console.log);\n }}\n >\n <Group>\n <Avatar radius=\"xl\" />\n <div style={{ flex: 1 }}>\n <Text size=\"sm\" weight={500}>\n {membership.profile?.display}\n </Text>\n <Text color=\"dimmed\" size=\"xs\">\n {membership.project?.display}\n </Text>\n </div>\n </Group>\n </UnstyledButton>\n ))}\n </Stack>\n );\n}\n"],"names":[],"mappings":";;;;;AAaM,SAAU,iBAAiB,CAAC,KAA6B,EAAA;AAC7D,IAAA,MAAM,OAAO,GAAG,UAAU,EAAE,CAAC;IAC7B,QACE,oBAAC,KAAK,EAAA,IAAA;QACJ,KAAC,CAAA,aAAA,CAAA,MAAM,IAAC,EAAE,EAAE,EAAE,aAAa,EAAE,QAAQ,EAAE,EAAA;AACrC,YAAA,KAAA,CAAA,aAAA,CAAC,IAAI,EAAA,EAAC,IAAI,EAAE,EAAE,EAAI,CAAA;YAClB,KAAC,CAAA,aAAA,CAAA,KAAK,yBAAuB,CACtB;QACR,KAAK,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,UAA6B,MACnD,oBAAC,cAAc,EAAA,EACb,GAAG,EAAE,UAAU,CAAC,EAAE,EAClB,OAAO,EAAE,MAAK;gBACZ,OAAO;qBACJ,IAAI,CAAC,cAAc,EAAE;oBACpB,KAAK,EAAE,KAAK,CAAC,KAAK;oBAClB,OAAO,EAAE,UAAU,CAAC,EAAE;iBACvB,CAAC;AACD,qBAAA,IAAI,CAAC,KAAK,CAAC,kBAAkB,CAAC;AAC9B,qBAAA,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;aACvB,EAAA;AAED,YAAA,KAAA,CAAA,aAAA,CAAC,KAAK,EAAA,IAAA;AACJ,gBAAA,KAAA,CAAA,aAAA,CAAC,MAAM,EAAA,EAAC,MAAM,EAAC,IAAI,EAAG,CAAA;AACtB,gBAAA,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA,EAAK,KAAK,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,EAAA;AACrB,oBAAA,KAAA,CAAA,aAAA,CAAC,IAAI,EAAA,EAAC,IAAI,EAAC,IAAI,EAAC,MAAM,EAAE,GAAG,IACxB,UAAU,CAAC,OAAO,EAAE,OAAO,CACvB;oBACP,KAAC,CAAA,aAAA,CAAA,IAAI,IAAC,KAAK,EAAC,QAAQ,EAAC,IAAI,EAAC,IAAI,EAC3B,EAAA,UAAU,CAAC,OAAO,EAAE,OAAO,CACvB,CACH,CACA,CACO,CAClB,CAAC,CACI,EACR;AACJ;;;;"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
import { LoginAuthenticationResponse } from '@medplum/core';
|
|
2
3
|
export interface ChooseScopeFormProps {
|
|
3
4
|
login: string;
|
|
4
5
|
scope: string | undefined;
|
|
5
|
-
handleAuthResponse: (response:
|
|
6
|
+
handleAuthResponse: (response: LoginAuthenticationResponse) => void;
|
|
6
7
|
}
|
|
7
8
|
export declare function ChooseScopeForm(props: ChooseScopeFormProps): JSX.Element;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Stack, Center, Title, Checkbox, Group, Button } from '@mantine/core';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import { Form } from '../Form/Form.
|
|
4
|
-
import { Logo } from '../Logo/Logo.
|
|
5
|
-
import { useMedplum } from '../MedplumProvider/MedplumProvider.
|
|
3
|
+
import { Form } from '../Form/Form.mjs';
|
|
4
|
+
import { Logo } from '../Logo/Logo.mjs';
|
|
5
|
+
import { useMedplum } from '../MedplumProvider/MedplumProvider.mjs';
|
|
6
6
|
|
|
7
7
|
function ChooseScopeForm(props) {
|
|
8
8
|
const medplum = useMedplum();
|
|
@@ -25,4 +25,4 @@ function ChooseScopeForm(props) {
|
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
export { ChooseScopeForm };
|
|
28
|
-
//# sourceMappingURL=ChooseScopeForm.
|
|
28
|
+
//# sourceMappingURL=ChooseScopeForm.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChooseScopeForm.mjs","sources":["../../../src/auth/ChooseScopeForm.tsx"],"sourcesContent":["import { Button, Center, Checkbox, Group, Stack, Title } from '@mantine/core';\nimport { LoginAuthenticationResponse } from '@medplum/core';\nimport React from 'react';\nimport { Form } from '../Form/Form';\nimport { Logo } from '../Logo/Logo';\nimport { useMedplum } from '../MedplumProvider/MedplumProvider';\n\nexport interface ChooseScopeFormProps {\n login: string;\n scope: string | undefined;\n handleAuthResponse: (response: LoginAuthenticationResponse) => void;\n}\n\nexport function ChooseScopeForm(props: ChooseScopeFormProps): JSX.Element {\n const medplum = useMedplum();\n return (\n <Form\n style={{ maxWidth: 400 }}\n onSubmit={(formData: Record<string, string>) => {\n medplum\n .post('auth/scope', {\n login: props.login,\n scope: Object.keys(formData).join(' '),\n })\n .then(props.handleAuthResponse)\n .catch(console.log);\n }}\n >\n <Stack>\n <Center sx={{ flexDirection: 'column' }}>\n <Logo size={32} />\n <Title>Choose scope</Title>\n </Center>\n <Stack>\n {(props.scope || 'openid').split(' ').map((scopeName: string) => (\n <Checkbox key={scopeName} id={scopeName} name={scopeName} label={scopeName} defaultChecked />\n ))}\n </Stack>\n <Group position=\"right\" mt=\"xl\">\n <Button type=\"submit\">Set scope</Button>\n </Group>\n </Stack>\n </Form>\n );\n}\n"],"names":[],"mappings":";;;;;;AAaM,SAAU,eAAe,CAAC,KAA2B,EAAA;AACzD,IAAA,M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,gBAAmB,CAClC,CACF,CACH,EACP;AACJ;;;;"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { LoginAuthenticationResponse } from '@medplum/core';
|
|
3
|
+
export interface MfaFormProps {
|
|
4
|
+
login: string;
|
|
5
|
+
handleAuthResponse: (response: LoginAuthenticationResponse) => void;
|
|
6
|
+
}
|
|
7
|
+
export declare function MfaForm(props: MfaFormProps): JSX.Element;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { Stack, Center, Title, Alert, TextInput, Group, Button } from '@mantine/core';
|
|
2
|
+
import { normalizeErrorString } from '@medplum/core';
|
|
3
|
+
import { IconAlertCircle } from '@tabler/icons';
|
|
4
|
+
import React, { useState } from 'react';
|
|
5
|
+
import { Form } from '../Form/Form.mjs';
|
|
6
|
+
import { Logo } from '../Logo/Logo.mjs';
|
|
7
|
+
import { useMedplum } from '../MedplumProvider/MedplumProvider.mjs';
|
|
8
|
+
|
|
9
|
+
function MfaForm(props) {
|
|
10
|
+
const medplum = useMedplum();
|
|
11
|
+
const [errorMessage, setErrorMessage] = useState(undefined);
|
|
12
|
+
return (React.createElement(Form, { style: { maxWidth: 400 }, onSubmit: (formData) => {
|
|
13
|
+
setErrorMessage(undefined);
|
|
14
|
+
medplum
|
|
15
|
+
.post('auth/mfa/verify', {
|
|
16
|
+
login: props.login,
|
|
17
|
+
token: formData.token,
|
|
18
|
+
})
|
|
19
|
+
.then(props.handleAuthResponse)
|
|
20
|
+
.catch((err) => setErrorMessage(normalizeErrorString(err)));
|
|
21
|
+
} },
|
|
22
|
+
React.createElement(Stack, null,
|
|
23
|
+
React.createElement(Center, { sx: { flexDirection: 'column' } },
|
|
24
|
+
React.createElement(Logo, { size: 32 }),
|
|
25
|
+
React.createElement(Title, null, "Enter MFA code")),
|
|
26
|
+
errorMessage && (React.createElement(Alert, { icon: React.createElement(IconAlertCircle, { size: 16 }), title: "Error", color: "red" }, errorMessage)),
|
|
27
|
+
React.createElement(Stack, null,
|
|
28
|
+
React.createElement(TextInput, { name: "token", label: "MFA code", required: true })),
|
|
29
|
+
React.createElement(Group, { position: "right", mt: "xl" },
|
|
30
|
+
React.createElement(Button, { type: "submit" }, "Submit code")))));
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export { MfaForm };
|
|
34
|
+
//# sourceMappingURL=MfaForm.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MfaForm.mjs","sources":["../../../src/auth/MfaForm.tsx"],"sourcesContent":["import { Alert, Button, Center, Group, Stack, TextInput, Title } from '@mantine/core';\nimport { LoginAuthenticationResponse, normalizeErrorString } from '@medplum/core';\nimport { IconAlertCircle } from '@tabler/icons';\nimport React, { useState } from 'react';\nimport { Form } from '../Form/Form';\nimport { Logo } from '../Logo/Logo';\nimport { useMedplum } from '../MedplumProvider/MedplumProvider';\n\nexport interface MfaFormProps {\n login: string;\n handleAuthResponse: (response: LoginAuthenticationResponse) => void;\n}\n\nexport function MfaForm(props: MfaFormProps): JSX.Element {\n const medplum = useMedplum();\n const [errorMessage, setErrorMessage] = useState<string | undefined>(undefined);\n return (\n <Form\n style={{ maxWidth: 400 }}\n onSubmit={(formData: Record<string, string>) => {\n setErrorMessage(undefined);\n medplum\n .post('auth/mfa/verify', {\n login: props.login,\n token: formData.token,\n })\n .then(props.handleAuthResponse)\n .catch((err) => setErrorMessage(normalizeErrorString(err)));\n }}\n >\n <Stack>\n <Center sx={{ flexDirection: 'column' }}>\n <Logo size={32} />\n <Title>Enter MFA code</Title>\n </Center>\n {errorMessage && (\n <Alert icon={<IconAlertCircle size={16} />} title=\"Error\" color=\"red\">\n {errorMessage}\n </Alert>\n )}\n <Stack>\n <TextInput name=\"token\" label=\"MFA code\" required />\n </Stack>\n <Group position=\"right\" mt=\"xl\">\n <Button type=\"submit\">Submit code</Button>\n </Group>\n </Stack>\n </Form>\n );\n}\n"],"names":[],"mappings":";;;;;;;;AAaM,SAAU,OAAO,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,IAAI,EAAC,OAAO,EAAC,KAAK,EAAC,UAAU,EAAC,QAAQ,EAAA,IAAA,EAAA,CAAG,CAC9C;YACR,KAAC,CAAA,aAAA,CAAA,KAAK,IAAC,QAAQ,EAAC,OAAO,EAAC,EAAE,EAAC,IAAI,EAAA;gBAC7B,KAAC,CAAA,aAAA,CAAA,MAAM,EAAC,EAAA,IAAI,EAAC,QAAQ,kBAAqB,CACpC,CACF,CACH,EACP;AACJ;;;;"}
|
|
@@ -1,17 +1,16 @@
|
|
|
1
|
-
import { __awaiter } from '../node_modules/tslib/tslib.es6.js';
|
|
2
1
|
import { Center, Title, Stack, TextInput, Text, Anchor, Group, Button } from '@mantine/core';
|
|
3
2
|
import React, { useState } from 'react';
|
|
4
|
-
import { Form } from '../Form/Form.
|
|
5
|
-
import { Logo } from '../Logo/Logo.
|
|
6
|
-
import { useMedplum } from '../MedplumProvider/MedplumProvider.
|
|
7
|
-
import { getErrorsForInput } from '../utils/outcomes.
|
|
3
|
+
import { Form } from '../Form/Form.mjs';
|
|
4
|
+
import { Logo } from '../Logo/Logo.mjs';
|
|
5
|
+
import { useMedplum } from '../MedplumProvider/MedplumProvider.mjs';
|
|
6
|
+
import { getErrorsForInput } from '../utils/outcomes.mjs';
|
|
8
7
|
|
|
9
8
|
function NewProjectForm(props) {
|
|
10
9
|
const medplum = useMedplum();
|
|
11
10
|
const [outcome, setOutcome] = useState();
|
|
12
|
-
return (React.createElement(Form, { style: { maxWidth: 400 }, onSubmit: (formData) =>
|
|
11
|
+
return (React.createElement(Form, { style: { maxWidth: 400 }, onSubmit: async (formData) => {
|
|
13
12
|
try {
|
|
14
|
-
props.handleAuthResponse(
|
|
13
|
+
props.handleAuthResponse(await medplum.startNewProject({
|
|
15
14
|
login: props.login,
|
|
16
15
|
projectName: formData.projectName,
|
|
17
16
|
}));
|
|
@@ -19,7 +18,7 @@ function NewProjectForm(props) {
|
|
|
19
18
|
catch (err) {
|
|
20
19
|
setOutcome(err);
|
|
21
20
|
}
|
|
22
|
-
}
|
|
21
|
+
} },
|
|
23
22
|
React.createElement(Center, { sx: { flexDirection: 'column' } },
|
|
24
23
|
React.createElement(Logo, { size: 32 }),
|
|
25
24
|
React.createElement(Title, null, "Create project")),
|
|
@@ -37,4 +36,4 @@ function NewProjectForm(props) {
|
|
|
37
36
|
}
|
|
38
37
|
|
|
39
38
|
export { NewProjectForm };
|
|
40
|
-
//# sourceMappingURL=NewProjectForm.
|
|
39
|
+
//# sourceMappingURL=NewProjectForm.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NewProjectForm.mjs","sources":["../../../src/auth/NewProjectForm.tsx"],"sourcesContent":["import { Anchor, Button, Center, Group, Stack, Text, TextInput, Title } from '@mantine/core';\nimport { LoginAuthenticationResponse } from '@medplum/core';\nimport { OperationOutcome } from '@medplum/fhirtypes';\nimport React, { useState } from 'react';\nimport { Form } from '../Form/Form';\nimport { Logo } from '../Logo/Logo';\nimport { useMedplum } from '../MedplumProvider/MedplumProvider';\nimport { getErrorsForInput } from '../utils/outcomes';\n\nexport interface NewProjectFormProps {\n login: string;\n handleAuthResponse: (response: LoginAuthenticationResponse) => void;\n}\n\nexport function NewProjectForm(props: NewProjectFormProps): JSX.Element {\n const medplum = useMedplum();\n const [outcome, setOutcome] = useState<OperationOutcome | undefined>();\n return (\n <Form\n style={{ maxWidth: 400 }}\n onSubmit={async (formData: Record<string, string>) => {\n try {\n props.handleAuthResponse(\n await medplum.startNewProject({\n login: props.login,\n projectName: formData.projectName,\n })\n );\n } catch (err) {\n setOutcome(err as OperationOutcome);\n }\n }}\n >\n <Center sx={{ flexDirection: 'column' }}>\n <Logo size={32} />\n <Title>Create project</Title>\n </Center>\n <Stack spacing=\"xl\">\n <TextInput\n name=\"projectName\"\n label=\"Project Name\"\n placeholder=\"My Project\"\n required={true}\n autoFocus={true}\n error={getErrorsForInput(outcome, 'firstName')}\n />\n <Text color=\"dimmed\" size=\"xs\">\n By clicking submit you agree to the Medplum{' '}\n <Anchor href=\"https://www.medplum.com/privacy\">Privacy Policy</Anchor>\n {' and '}\n <Anchor href=\"https://www.medplum.com/terms\">Terms of Service</Anchor>.\n </Text>\n </Stack>\n <Group position=\"right\" mt=\"xl\" noWrap>\n <Button type=\"submit\">Create project</Button>\n </Group>\n </Form>\n );\n}\n"],"names":[],"mappings":";;;;;;;AAcM,SAAU,cAAc,CAAC,KAA0B,EAAA;AACvD,IAAA,MAAM,OAAO,GAAG,UAAU,EAAE,CAAC;IAC7B,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,EAAgC,CAAC;AACvE,IAAA,QACE,KAAC,CAAA,aAAA,CAAA,IAAI,IACH,KAAK,EAAE,EAAE,QAAQ,EAAE,GAAG,EAAE,EACxB,QAAQ,EAAE,OAAO,QAAgC,KAAI;YACnD,IAAI;AACF,gBAAA,KAAK,CAAC,kBAAkB,CACtB,MAAM,OAAO,CAAC,eAAe,CAAC;oBAC5B,KAAK,EAAE,KAAK,CAAC,KAAK;oBAClB,WAAW,EAAE,QAAQ,CAAC,WAAW;AAClC,iBAAA,CAAC,CACH,CAAC;AACH,aAAA;AAAC,YAAA,OAAO,GAAG,EAAE;gBACZ,UAAU,CAAC,GAAuB,CAAC,CAAC;AACrC,aAAA;SACF,EAAA;QAED,KAAC,CAAA,aAAA,CAAA,MAAM,IAAC,EAAE,EAAE,EAAE,aAAa,EAAE,QAAQ,EAAE,EAAA;AACrC,YAAA,KAAA,CAAA,aAAA,CAAC,IAAI,EAAA,EAAC,IAAI,EAAE,EAAE,EAAI,CAAA;YAClB,KAAC,CAAA,aAAA,CAAA,KAAK,yBAAuB,CACtB;AACT,QAAA,KAAA,CAAA,aAAA,CAAC,KAAK,EAAA,EAAC,OAAO,EAAC,IAAI,EAAA;AACjB,YAAA,KAAA,CAAA,aAAA,CAAC,SAAS,EAAA,EACR,IAAI,EAAC,aAAa,EAClB,KAAK,EAAC,cAAc,EACpB,WAAW,EAAC,YAAY,EACxB,QAAQ,EAAE,IAAI,EACd,SAAS,EAAE,IAAI,EACf,KAAK,EAAE,iBAAiB,CAAC,OAAO,EAAE,WAAW,CAAC,EAC9C,CAAA;YACF,KAAC,CAAA,aAAA,CAAA,IAAI,IAAC,KAAK,EAAC,QAAQ,EAAC,IAAI,EAAC,IAAI,EAAA;;gBACgB,GAAG;AAC/C,gBAAA,KAAA,CAAA,aAAA,CAAC,MAAM,EAAA,EAAC,IAAI,EAAC,iCAAiC,EAA6B,EAAA,qBAAA,CAAA;gBAC1E,OAAO;AACR,gBAAA,KAAA,CAAA,aAAA,CAAC,MAAM,EAAA,EAAC,IAAI,EAAC,+BAA+B,EAAoC,EAAA,4BAAA,CAAA;oBAC3E,CACD;QACR,KAAC,CAAA,aAAA,CAAA,KAAK,EAAC,EAAA,QAAQ,EAAC,OAAO,EAAC,EAAE,EAAC,IAAI,EAAC,MAAM,EAAA,IAAA,EAAA;YACpC,KAAC,CAAA,aAAA,CAAA,MAAM,IAAC,IAAI,EAAC,QAAQ,EAAwB,EAAA,gBAAA,CAAA,CACvC,CACH,EACP;AACJ;;;;"}
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import { __awaiter } from '../node_modules/tslib/tslib.es6.js';
|
|
2
1
|
import { Center, Alert, Group, Divider, Stack, TextInput, PasswordInput, Text, Anchor, Checkbox, Button } from '@mantine/core';
|
|
3
2
|
import { IconAlertCircle } from '@tabler/icons';
|
|
4
3
|
import React, { useState, useEffect } from 'react';
|
|
5
|
-
import { Form } from '../Form/Form.
|
|
6
|
-
import { getGoogleClientId, GoogleButton } from '../GoogleButton/GoogleButton.
|
|
7
|
-
import { useMedplum } from '../MedplumProvider/MedplumProvider.
|
|
8
|
-
import { getIssuesForExpression, getErrorsForInput } from '../utils/outcomes.
|
|
9
|
-
import { initRecaptcha, getRecaptcha } from '../utils/recaptcha.
|
|
4
|
+
import { Form } from '../Form/Form.mjs';
|
|
5
|
+
import { getGoogleClientId, GoogleButton } from '../GoogleButton/GoogleButton.mjs';
|
|
6
|
+
import { useMedplum } from '../MedplumProvider/MedplumProvider.mjs';
|
|
7
|
+
import { getIssuesForExpression, getErrorsForInput } from '../utils/outcomes.mjs';
|
|
8
|
+
import { initRecaptcha, getRecaptcha } from '../utils/recaptcha.mjs';
|
|
10
9
|
|
|
11
10
|
function NewUserForm(props) {
|
|
12
11
|
const googleClientId = getGoogleClientId(props.googleClientId);
|
|
@@ -15,10 +14,10 @@ function NewUserForm(props) {
|
|
|
15
14
|
const [outcome, setOutcome] = useState();
|
|
16
15
|
const issues = getIssuesForExpression(outcome, undefined);
|
|
17
16
|
useEffect(() => initRecaptcha(recaptchaSiteKey), [recaptchaSiteKey]);
|
|
18
|
-
return (React.createElement(Form, { style: { maxWidth: 400 }, onSubmit: (formData) =>
|
|
17
|
+
return (React.createElement(Form, { style: { maxWidth: 400 }, onSubmit: async (formData) => {
|
|
19
18
|
try {
|
|
20
|
-
const recaptchaToken =
|
|
21
|
-
props.handleAuthResponse(
|
|
19
|
+
const recaptchaToken = await getRecaptcha(recaptchaSiteKey);
|
|
20
|
+
props.handleAuthResponse(await medplum.startNewUser({
|
|
22
21
|
projectId: props.projectId,
|
|
23
22
|
firstName: formData.firstName,
|
|
24
23
|
lastName: formData.lastName,
|
|
@@ -32,18 +31,15 @@ function NewUserForm(props) {
|
|
|
32
31
|
catch (err) {
|
|
33
32
|
setOutcome(err);
|
|
34
33
|
}
|
|
35
|
-
}
|
|
34
|
+
} },
|
|
36
35
|
React.createElement(Center, { sx: { flexDirection: 'column' } }, props.children),
|
|
37
|
-
issues && (React.createElement(Alert, { icon: React.createElement(IconAlertCircle, { size: 16 }), color: "red" }, issues.map((issue) => {
|
|
38
|
-
var _a, _b;
|
|
39
|
-
return (React.createElement("div", { "data-testid": "text-field-error", key: (_a = issue.details) === null || _a === void 0 ? void 0 : _a.text }, (_b = issue.details) === null || _b === void 0 ? void 0 : _b.text));
|
|
40
|
-
}))),
|
|
36
|
+
issues && (React.createElement(Alert, { icon: React.createElement(IconAlertCircle, { size: 16 }), color: "red" }, issues.map((issue) => (React.createElement("div", { "data-testid": "text-field-error", key: issue.details?.text }, issue.details?.text))))),
|
|
41
37
|
googleClientId && (React.createElement(React.Fragment, null,
|
|
42
38
|
React.createElement(Group, { position: "center", p: "xl", style: { height: 70 } },
|
|
43
|
-
React.createElement(GoogleButton, { googleClientId: googleClientId, handleGoogleCredential: (response) =>
|
|
39
|
+
React.createElement(GoogleButton, { googleClientId: googleClientId, handleGoogleCredential: async (response) => {
|
|
44
40
|
try {
|
|
45
|
-
|
|
46
|
-
props.handleAuthResponse(
|
|
41
|
+
await medplum.startPkce();
|
|
42
|
+
props.handleAuthResponse(await medplum.startGoogleLogin({
|
|
47
43
|
googleClientId: response.clientId,
|
|
48
44
|
googleCredential: response.credential,
|
|
49
45
|
createUser: true,
|
|
@@ -52,7 +48,7 @@ function NewUserForm(props) {
|
|
|
52
48
|
catch (err) {
|
|
53
49
|
setOutcome(err);
|
|
54
50
|
}
|
|
55
|
-
}
|
|
51
|
+
} })),
|
|
56
52
|
React.createElement(Divider, { label: "or", labelPosition: "center", my: "lg" }))),
|
|
57
53
|
React.createElement(Stack, { spacing: "xl" },
|
|
58
54
|
React.createElement(TextInput, { name: "firstName", type: "text", label: "First name", placeholder: "First name", required: true, autoFocus: true, error: getErrorsForInput(outcome, 'firstName') }),
|
|
@@ -79,4 +75,4 @@ function NewUserForm(props) {
|
|
|
79
75
|
}
|
|
80
76
|
|
|
81
77
|
export { NewUserForm };
|
|
82
|
-
//# sourceMappingURL=NewUserForm.
|
|
78
|
+
//# sourceMappingURL=NewUserForm.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NewUserForm.mjs","sources":["../../../src/auth/NewUserForm.tsx"],"sourcesContent":["import {\n Alert,\n Anchor,\n Button,\n Center,\n Checkbox,\n Divider,\n Group,\n PasswordInput,\n Stack,\n Text,\n TextInput,\n} from '@mantine/core';\nimport { GoogleCredentialResponse, LoginAuthenticationResponse } from '@medplum/core';\nimport { OperationOutcome } from '@medplum/fhirtypes';\nimport { IconAlertCircle } from '@tabler/icons';\nimport React, { useEffect, useState } from 'react';\nimport { Form } from '../Form/Form';\nimport { getGoogleClientId, GoogleButton } from '../GoogleButton/GoogleButton';\nimport { useMedplum } from '../MedplumProvider/MedplumProvider';\nimport { getErrorsForInput, getIssuesForExpression } from '../utils/outcomes';\nimport { getRecaptcha, initRecaptcha } from '../utils/recaptcha';\n\nexport interface NewUserFormProps {\n readonly projectId: string;\n readonly googleClientId?: string;\n readonly recaptchaSiteKey: string;\n readonly children?: React.ReactNode;\n readonly handleAuthResponse: (response: LoginAuthenticationResponse) => void;\n}\n\nexport function NewUserForm(props: NewUserFormProps): JSX.Element {\n const googleClientId = getGoogleClientId(props.googleClientId);\n const recaptchaSiteKey = props.recaptchaSiteKey;\n const medplum = useMedplum();\n const [outcome, setOutcome] = useState<OperationOutcome>();\n const issues = getIssuesForExpression(outcome, undefined);\n\n useEffect(() => initRecaptcha(recaptchaSiteKey), [recaptchaSiteKey]);\n\n return (\n <Form\n style={{ maxWidth: 400 }}\n onSubmit={async (formData: Record<string, string>) => {\n try {\n const recaptchaToken = await getRecaptcha(recaptchaSiteKey);\n props.handleAuthResponse(\n await medplum.startNewUser({\n projectId: props.projectId,\n firstName: formData.firstName,\n lastName: formData.lastName,\n email: formData.email,\n password: formData.password,\n remember: formData.remember === 'true',\n recaptchaSiteKey,\n recaptchaToken,\n })\n );\n } catch (err) {\n setOutcome(err as OperationOutcome);\n }\n }}\n >\n <Center sx={{ flexDirection: 'column' }}>{props.children}</Center>\n {issues && (\n <Alert icon={<IconAlertCircle size={16} />} color=\"red\">\n {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 {googleClientId && (\n <>\n <Group position=\"center\" p=\"xl\" style={{ height: 70 }}>\n <GoogleButton\n googleClientId={googleClientId}\n handleGoogleCredential={async (response: GoogleCredentialResponse) => {\n try {\n await medplum.startPkce();\n props.handleAuthResponse(\n await medplum.startGoogleLogin({\n googleClientId: response.clientId,\n googleCredential: response.credential,\n createUser: true,\n })\n );\n } catch (err) {\n setOutcome(err as OperationOutcome);\n }\n }}\n />\n </Group>\n <Divider label=\"or\" labelPosition=\"center\" my=\"lg\" />\n </>\n )}\n <Stack spacing=\"xl\">\n <TextInput\n name=\"firstName\"\n type=\"text\"\n label=\"First name\"\n placeholder=\"First name\"\n required={true}\n autoFocus={true}\n error={getErrorsForInput(outcome, 'firstName')}\n />\n <TextInput\n name=\"lastName\"\n type=\"text\"\n label=\"Last name\"\n placeholder=\"Last name\"\n required={true}\n error={getErrorsForInput(outcome, 'lastName')}\n />\n <TextInput\n name=\"email\"\n type=\"email\"\n label=\"Email\"\n placeholder=\"name@domain.com\"\n required={true}\n error={getErrorsForInput(outcome, 'email')}\n />\n <PasswordInput\n name=\"password\"\n label=\"Password\"\n autoComplete=\"off\"\n required={true}\n error={getErrorsForInput(outcome, 'password')}\n />\n <Text color=\"dimmed\" size=\"xs\">\n By clicking submit you agree to the Medplum{' '}\n <Anchor href=\"https://www.medplum.com/privacy\">Privacy Policy</Anchor>\n {' and '}\n <Anchor href=\"https://www.medplum.com/terms\">Terms of Service</Anchor>.\n </Text>\n <Text color=\"dimmed\" size=\"xs\">\n This site is protected by reCAPTCHA and the Google{' '}\n <Anchor href=\"https://policies.google.com/privacy\">Privacy Policy</Anchor>\n {' and '}\n <Anchor href=\"https://policies.google.com/terms\">Terms of Service</Anchor> apply.\n </Text>\n </Stack>\n <Group position=\"apart\" mt=\"xl\" noWrap>\n <Checkbox name=\"remember\" label=\"Remember me\" size=\"xs\" />\n <Button type=\"submit\">Create account</Button>\n </Group>\n </Form>\n );\n}\n"],"names":[],"mappings":";;;;;;;;;AA+BM,SAAU,WAAW,CAAC,KAAuB,EAAA;IACjD,MAAM,cAAc,GAAG,iBAAiB,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;AAC/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AAA,KAAA,CAAA,aAAA,CAAC,MAAM,EAAA,EAAC,IAAI,EAAC,+BAA+B,EAAoC,EAAA,4BAAA,CAAA;AAC3E,gBAAA,GAAA,CAAA;YACP,KAAC,CAAA,aAAA,CAAA,IAAI,IAAC,KAAK,EAAC,QAAQ,EAAC,IAAI,EAAC,IAAI,EAAA;;gBACuB,GAAG;AACtD,gBAAA,KAAA,CAAA,aAAA,CAAC,MAAM,EAAA,EAAC,IAAI,EAAC,qCAAqC,EAA6B,EAAA,qBAAA,CAAA;gBAC9E,OAAO;AACR,gBAAA,KAAA,CAAA,aAAA,CAAC,MAAM,EAAA,EAAC,IAAI,EAAC,mCAAmC,EAAoC,EAAA,4BAAA,CAAA;0BAC/E,CACD;QACR,KAAC,CAAA,aAAA,CAAA,KAAK,EAAC,EAAA,QAAQ,EAAC,OAAO,EAAC,EAAE,EAAC,IAAI,EAAC,MAAM,EAAA,IAAA,EAAA;AACpC,YAAA,KAAA,CAAA,aAAA,CAAC,QAAQ,EAAA,EAAC,IAAI,EAAC,UAAU,EAAC,KAAK,EAAC,aAAa,EAAC,IAAI,EAAC,IAAI,EAAG,CAAA;YAC1D,KAAC,CAAA,aAAA,CAAA,MAAM,IAAC,IAAI,EAAC,QAAQ,EAAwB,EAAA,gBAAA,CAAA,CACvC,CACH,EACP;AACJ;;;;"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React, { useState, useEffect } from 'react';
|
|
2
|
-
import { Document } from '../Document/Document.
|
|
3
|
-
import { useMedplum } from '../MedplumProvider/MedplumProvider.
|
|
4
|
-
import { NewProjectForm } from './NewProjectForm.
|
|
5
|
-
import { NewUserForm } from './NewUserForm.
|
|
2
|
+
import { Document } from '../Document/Document.mjs';
|
|
3
|
+
import { useMedplum } from '../MedplumProvider/MedplumProvider.mjs';
|
|
4
|
+
import { NewProjectForm } from './NewProjectForm.mjs';
|
|
5
|
+
import { NewUserForm } from './NewUserForm.mjs';
|
|
6
6
|
|
|
7
7
|
function RegisterForm(props) {
|
|
8
8
|
const { type, projectId, googleClientId, recaptchaSiteKey, onSuccess } = props;
|
|
@@ -36,4 +36,4 @@ function RegisterForm(props) {
|
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
export { RegisterForm };
|
|
39
|
-
//# sourceMappingURL=RegisterForm.
|
|
39
|
+
//# sourceMappingURL=RegisterForm.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RegisterForm.mjs","sources":["../../../src/auth/RegisterForm.tsx"],"sourcesContent":["import { LoginAuthenticationResponse } from '@medplum/core';\nimport { OperationOutcome } from '@medplum/fhirtypes';\nimport React, { useEffect, useState } from 'react';\nimport { Document } from '../Document/Document';\nimport { useMedplum } from '../MedplumProvider/MedplumProvider';\nimport { NewProjectForm } from './NewProjectForm';\nimport { NewUserForm } from './NewUserForm';\n\nexport interface RegisterFormProps {\n readonly type: 'patient' | 'project';\n readonly projectId?: string;\n readonly googleClientId?: string;\n readonly recaptchaSiteKey: string;\n readonly children?: React.ReactNode;\n readonly onSuccess: () => void;\n}\n\nexport function RegisterForm(props: RegisterFormProps): JSX.Element {\n const { type, projectId, googleClientId, recaptchaSiteKey, onSuccess } = props;\n const medplum = useMedplum();\n const [login, setLogin] = useState<string | undefined>(undefined);\n const [outcome, setOutcome] = useState<OperationOutcome>();\n\n useEffect(() => {\n if (type === 'patient' && login) {\n medplum\n .startNewPatient({ login, projectId: projectId as string })\n .then((response) => medplum.processCode(response.code as string))\n .then(() => onSuccess())\n .catch((err) => setOutcome(err as OperationOutcome));\n }\n }, [medplum, type, projectId, login, onSuccess]);\n\n function handleAuthResponse(response: LoginAuthenticationResponse): void {\n if (response.code) {\n medplum\n .processCode(response.code)\n .then(() => onSuccess())\n .catch(console.log);\n } else if (response.login) {\n setLogin(response.login);\n }\n }\n\n return (\n <Document width={450}>\n {outcome && <pre>{JSON.stringify(outcome, null, 2)}</pre>}\n {!login && (\n <NewUserForm\n projectId={projectId as string}\n googleClientId={googleClientId}\n recaptchaSiteKey={recaptchaSiteKey}\n handleAuthResponse={handleAuthResponse}\n >\n {props.children}\n </NewUserForm>\n )}\n {login && type === 'project' && <NewProjectForm login={login} handleAuthResponse={handleAuthResponse} />}\n </Document>\n );\n}\n"],"names":[],"mappings":";;;;;;AAiBM,SAAU,YAAY,CAAC,KAAwB,EAAA;AACnD,IAAA,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,cAAc,EAAE,gBAAgB,EAAE,SAAS,EAAE,GAAG,KAAK,CAAC;AAC/E,IAAA,MAAM,OAAO,GAAG,UAAU,EAAE,CAAC;IAC7B,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAqB,SAAS,CAAC,CAAC;IAClE,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,EAAoB,CAAC;IAE3D,SAAS,CAAC,MAAK;AACb,QAAA,IAAI,IAAI,KAAK,SAAS,IAAI,KAAK,EAAE;YAC/B,OAAO;iBACJ,eAAe,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,SAAmB,EAAE,CAAC;AAC1D,iBAAA,IAAI,CAAC,CAAC,QAAQ,KAAK,OAAO,CAAC,WAAW,CAAC,QAAQ,CAAC,IAAc,CAAC,CAAC;AAChE,iBAAA,IAAI,CAAC,MAAM,SAAS,EAAE,CAAC;iBACvB,KAAK,CAAC,CAAC,GAAG,KAAK,UAAU,CAAC,GAAuB,CAAC,CAAC,CAAC;AACxD,SAAA;AACH,KAAC,EAAE,CAAC,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC,CAAC;IAEjD,SAAS,kBAAkB,CAAC,QAAqC,EAAA;QAC/D,IAAI,QAAQ,CAAC,IAAI,EAAE;YACjB,OAAO;AACJ,iBAAA,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAC;AAC1B,iBAAA,IAAI,CAAC,MAAM,SAAS,EAAE,CAAC;AACvB,iBAAA,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;AACvB,SAAA;aAAM,IAAI,QAAQ,CAAC,KAAK,EAAE;AACzB,YAAA,QAAQ,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AAC1B,SAAA;KACF;AAED,IAAA,QACE,KAAC,CAAA,aAAA,CAAA,QAAQ,EAAC,EAAA,KAAK,EAAE,GAAG,EAAA;AACjB,QAAA,OAAO,IAAI,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA,IAAA,EAAM,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,CAAO;QACxD,CAAC,KAAK,KACL,KAAC,CAAA,aAAA,CAAA,WAAW,EACV,EAAA,SAAS,EAAE,SAAmB,EAC9B,cAAc,EAAE,cAAc,EAC9B,gBAAgB,EAAE,gBAAgB,EAClC,kBAAkB,EAAE,kBAAkB,EAAA,EAErC,KAAK,CAAC,QAAQ,CACH,CACf;AACA,QAAA,KAAK,IAAI,IAAI,KAAK,SAAS,IAAI,KAAA,CAAA,aAAA,CAAC,cAAc,EAAC,EAAA,KAAK,EAAE,KAAK,EAAE,kBAAkB,EAAE,kBAAkB,EAAI,CAAA,CAC/F,EACX;AACJ;;;;"}
|
|
@@ -8,4 +8,14 @@ export interface SignInFormProps extends BaseLoginRequest {
|
|
|
8
8
|
readonly onCode?: (code: string) => void;
|
|
9
9
|
readonly children?: React.ReactNode;
|
|
10
10
|
}
|
|
11
|
+
/**
|
|
12
|
+
* The SignInForm component allows users to sign in to Medplum.
|
|
13
|
+
*
|
|
14
|
+
* "Signing in" is a multi-step process:
|
|
15
|
+
* 1) Authentication - identify the user
|
|
16
|
+
* 2) MFA - If MFA is enabled, prompt for MFA code
|
|
17
|
+
* 3) Choose profile - If the user has multiple profiles, prompt to choose one
|
|
18
|
+
* 4) Choose scope - If the user has multiple scopes, prompt to choose one
|
|
19
|
+
* 5) Success - Return to the caller with either a code or a redirect
|
|
20
|
+
*/
|
|
11
21
|
export declare function SignInForm(props: SignInFormProps): JSX.Element;
|