@medplum/react
Version:
Medplum React Component Library
1,191 lines (997 loc) • 136 kB
TypeScript
import type { AccessPolicyResource } from '@medplum/fhirtypes';
import { AddFavoriteParams } from '@medplum/core';
import { AddPharmacyResponse } from '@medplum/core';
import { addPreferredPharmacyToPatient } from '@medplum/core';
import type { Address } from '@medplum/fhirtypes';
import type { AddressFormatOptions } from '@medplum/core';
import type { AlertProps } from '@mantine/core';
import type { AnchorProps } from '@mantine/core';
import type { Annotation } from '@medplum/fhirtypes';
import type { AriaRole } from 'react';
import type { Attachment } from '@medplum/fhirtypes';
import type { AvatarProps } from '@mantine/core';
import type { BadgeProps } from '@mantine/core';
import type { BaseLoginRequest } from '@medplum/core';
import type { Bundle } from '@medplum/fhirtypes';
import type { ButtonProps } from '@mantine/core';
import type { ClientApplication } from '@medplum/fhirtypes';
import type { CodeableConcept } from '@medplum/fhirtypes';
import type { Coding } from '@medplum/fhirtypes';
import type { ComboboxItem } from '@mantine/core';
import type { ComboboxProps } from '@mantine/core';
import type { Communication } from '@medplum/fhirtypes';
import { Component } from 'react';
import type { ComponentType } from 'react';
import type { ContactDetail } from '@medplum/fhirtypes';
import type { ContactPoint } from '@medplum/fhirtypes';
import type { ContainerProps } from '@mantine/core';
import { Context } from 'react';
import { createPreferredPharmacyExtension } from '@medplum/core';
import type { CSSProperties } from 'react';
import type { DiagnosticReport } from '@medplum/fhirtypes';
import type { DocumentReference } from '@medplum/fhirtypes';
import type { ElementDefinitionBinding } from '@medplum/fhirtypes';
import type { ElementDefinitionType } from '@medplum/fhirtypes';
import type { ElementProps } from '@mantine/core';
import type { Encounter } from '@medplum/fhirtypes';
import type { ErrorInfo } from 'react';
import type { ExtendedInternalSchemaElement } from '@medplum/core';
import type { ExtractResource } from '@medplum/fhirtypes';
import type { Filter } from '@medplum/core';
import { ForwardRefExoticComponent } from 'react';
import { getPreferredPharmaciesFromPatient } from '@medplum/core';
import type { HumanName } from '@medplum/fhirtypes';
import type { HumanNameFormatOptions } from '@medplum/core';
import type { Identifier } from '@medplum/fhirtypes';
import type { InternalSchemaElement } from '@medplum/core';
import { isAddPharmacyResponse } from '@medplum/core';
import { isOrganizationArray } from '@medplum/core';
import type { JSX } from 'react';
import type { LoginAuthenticationResponse } from '@medplum/core';
import type { MantineColor } from '@mantine/core';
import type { MeasureReport } from '@medplum/fhirtypes';
import type { Media } from '@medplum/fhirtypes';
import type { Medication } from '@medplum/fhirtypes';
import type { MedicationCartClearRequest } from '@medplum/core';
import type { MedicationCartManageResponse } from '@medplum/core';
import type { MedicationCartRemoveRequest } from '@medplum/core';
import type { MedicationCheckoutRequest } from '@medplum/core';
import type { MedicationCheckoutResponse } from '@medplum/core';
import type { MedicationOrderRequest } from '@medplum/core';
import type { MedicationOrderResponse } from '@medplum/core';
import type { MedicationRequest } from '@medplum/fhirtypes';
import type { MedicationSearchParams } from '@medplum/core';
import type { MedplumClient } from '@medplum/core';
import { MemoExoticComponent } from 'react';
import type { Money } from '@medplum/fhirtypes';
import type { MouseEvent as MouseEvent_2 } from 'react';
import type { MouseEventHandler } from 'react';
import type { Observation } from '@medplum/fhirtypes';
import type { ObservationDefinition } from '@medplum/fhirtypes';
import type { ObservationDefinitionQualifiedInterval } from '@medplum/fhirtypes';
import type { OperationOutcome } from '@medplum/fhirtypes';
import type { OperationOutcomeIssue } from '@medplum/fhirtypes';
import { Operator } from '@medplum/core';
import type { OrderSetSyncResponse } from '@medplum/core';
import type { Organization } from '@medplum/fhirtypes';
import type { PaperProps } from '@mantine/core';
import type { PasswordInputProps } from '@mantine/core';
import type { Patient } from '@medplum/fhirtypes';
import { PATIENT_PREFERRED_PHARMACY_URL } from '@medplum/core';
import type { Period } from '@medplum/fhirtypes';
import { PHARMACY_PREFERENCE_TYPE_SYSTEM } from '@medplum/core';
import { PHARMACY_TYPE_PREFERRED } from '@medplum/core';
import { PHARMACY_TYPE_PRIMARY } from '@medplum/core';
import { PharmacySearchParams } from '@medplum/core';
import type { PlanDefinition } from '@medplum/fhirtypes';
import type { Practitioner } from '@medplum/fhirtypes';
import { PreferredPharmacy } from '@medplum/core';
import type { ProfileResource } from '@medplum/core';
import type { Quantity } from '@medplum/fhirtypes';
import type { QueryTypes } from '@medplum/core';
import type { Questionnaire } from '@medplum/fhirtypes';
import type { QuestionnaireItem } from '@medplum/fhirtypes';
import type { QuestionnaireItemAnswerOption } from '@medplum/fhirtypes';
import type { QuestionnaireItemEnableWhen } from '@medplum/fhirtypes';
import type { QuestionnaireItemInitial } from '@medplum/fhirtypes';
import type { QuestionnaireResponse } from '@medplum/fhirtypes';
import type { QuestionnaireResponseItem } from '@medplum/fhirtypes';
import type { QuestionnaireResponseItemAnswer } from '@medplum/fhirtypes';
import type { Range as Range_2 } from '@medplum/fhirtypes';
import type { Ratio } from '@medplum/fhirtypes';
import type { ReactNode } from 'react';
import { RefAttributes } from 'react';
import type { Reference } from '@medplum/fhirtypes';
import { removePreferredPharmacyFromPatient } from '@medplum/core';
import type { RequestGroup } from '@medplum/fhirtypes';
import type { Resource } from '@medplum/fhirtypes';
import type { ResourceArray } from '@medplum/core';
import type { ResourceModifiedEvent } from '@medplum/core';
import type { ResourceType } from '@medplum/fhirtypes';
import type { Schedule } from '@medplum/fhirtypes';
import type { SearchParameter } from '@medplum/fhirtypes';
import type { SearchRequest } from '@medplum/core';
import type { ServiceRequest } from '@medplum/fhirtypes';
import type { Signature } from '@medplum/fhirtypes';
import type { Slot } from '@medplum/fhirtypes';
import type { StructureDefinition } from '@medplum/fhirtypes';
import type { Subscription } from '@medplum/fhirtypes';
import type { SyntheticEvent } from 'react';
import type { TabsProps } from '@mantine/core';
import type { Task } from '@medplum/fhirtypes';
import type { TextProps } from '@mantine/core';
import type { Timing } from '@medplum/fhirtypes';
import type { TypedValue } from '@medplum/core';
import type { ValueSetExpandParams } from '@medplum/core';
import type { ValueSetExpansionContains } from '@medplum/fhirtypes';
import type { WithId } from '@medplum/core';
/**
* Adds a filter for a date between two dates (inclusive of both dates).
* @param definition - The original search request.
* @param field - The field key name.
* @param d1 - The start date.
* @param d2 - The end date.
* @returns The updated search request.
*/
export declare function addDateFilterBetween(definition: SearchRequest, field: string, d1: Date, d2: Date): SearchRequest;
export { AddFavoriteParams }
/**
* Adds a field.
* @param definition - The original search request.
* @param field - The field key name.
* @returns The updated search request.
*/
export declare function addField(definition: SearchRequest, field: string): SearchRequest;
/**
* Adds a filter.
* @param definition - The original search request.
* @param field - The field key name.
* @param op - The operation key name.
* @param value - The filter value.
* @param opt_clear - Optional flag to clear filters on the field.
* @returns The updated search request.
*/
export declare function addFilter(definition: SearchRequest, field: string, op: Operator, value?: string, opt_clear?: boolean): SearchRequest;
/**
* Adds a filter that constrains the specified field to "last month".
* @param definition - The original search request.
* @param field - The field key name.
* @returns The updated search request.
*/
export declare function addLastMonthFilter(definition: SearchRequest, field: string): SearchRequest;
/**
* Adds a filter that constrains the specified field to "missing".
* @param definition - The original search request.
* @param field - The field key name.
* @param value - Optional boolean value. Default is true.
* @returns The updated search request.
*/
export declare function addMissingFilter(definition: SearchRequest, field: string, value?: boolean): SearchRequest;
/**
* Adds a filter that constrains the specified field to "next 24 hours".
* @param definition - The original search request.
* @param field - The field key name.
* @returns The updated search request.
*/
export declare function addNext24HoursFilter(definition: SearchRequest, field: string): SearchRequest;
/**
* Adds a filter that constrains the specified field to "next month".
* @param definition - The original search request.
* @param field - The field key name.
* @returns The updated search request.
*/
export declare function addNextMonthFilter(definition: SearchRequest, field: string): SearchRequest;
export { AddPharmacyResponse }
export { addPreferredPharmacyToPatient }
export declare function AddressDisplay(props: AddressDisplayProps): JSX.Element | null;
export declare interface AddressDisplayProps {
readonly value?: Address;
readonly options?: AddressFormatOptions;
}
export declare function AddressInput(props: AddressInputProps): JSX.Element;
export declare type AddressInputProps = ComplexTypeInputProps<Address>;
/**
* Adds a filter that constrains the specified field to "this month".
* @param definition - The original search request.
* @param field - The field key name.
* @returns The updated search request.
*/
export declare function addThisMonthFilter(definition: SearchRequest, field: string): SearchRequest;
/**
* Adds a filter that constrains the specified field to "today".
* @param definition - The original search request.
* @param field - The field key name.
* @returns The updated search request.
*/
export declare function addTodayFilter(definition: SearchRequest, field: string): SearchRequest;
/**
* Adds a filter that constrains the specified field to "tomorrow".
* @param definition - The original search request.
* @param field - The field key name.
* @returns The updated search request.
*/
export declare function addTomorrowFilter(definition: SearchRequest, field: string): SearchRequest;
/**
* Adds a filter that constrains the specified field to the year to date.
* @param definition - The original search request.
* @param field - The field key name.
* @returns The updated search request.
*/
export declare function addYearToDateFilter(definition: SearchRequest, field: string): SearchRequest;
/**
* Adds a filter that constrains the specified field to "yesterday".
* @param definition - The original search request.
* @param field - The field key name.
* @returns The updated search request.
*/
export declare function addYesterdayFilter(definition: SearchRequest, field: string): SearchRequest;
export declare function AIRealTimeQuestionnaireForm(props: AIRealTimeQuestionnaireFormProps): JSX.Element;
export declare interface AIRealTimeQuestionnaireFormProps extends QuestionnaireFormProps {
readonly aiModel?: string;
readonly onTranscript?: (fullTranscript: string, chunk: string) => void;
readonly voiceInstructions?: ReactNode;
}
/** Allergies section — searches for AllergyIntolerance resources. */
export declare const AllergiesSection: PatientSummarySectionConfig;
export declare function AnnotationInput(props: AnnotationInputProps): JSX.Element;
export declare interface AnnotationInputProps extends ComplexTypeInputProps<Annotation> {
}
export declare function AppShell(props: AppShellProps): JSX.Element;
export declare interface AppShellAnnouncement {
readonly id?: string;
readonly message: ReactNode;
readonly color?: MantineColor;
readonly icon?: ReactNode;
readonly dismissible?: boolean;
readonly onDismiss?: (announcement: AppShellAnnouncement) => void;
readonly role?: AriaRole;
}
export declare interface AppShellProps {
readonly logo: ReactNode;
readonly pathname?: string;
readonly searchParams?: URLSearchParams;
readonly headerSearchDisabled?: boolean;
readonly version?: string;
readonly menus?: NavbarMenu[];
readonly children: ReactNode;
readonly displayAddBookmark?: boolean;
readonly resourceTypeSearchDisabled?: boolean;
readonly notifications?: ReactNode;
readonly announcements?: AppShellAnnouncement[];
readonly layoutVersion?: 'v1' | 'v2';
readonly showLayoutVersionToggle?: boolean;
readonly spotlightPatientsOnly?: boolean;
}
export declare function AsyncAutocomplete<T>(props: AsyncAutocompleteProps<T>): JSX.Element;
export declare interface AsyncAutocompleteOption<T> extends ComboboxItem {
readonly active?: boolean;
readonly resource: T;
}
export declare interface AsyncAutocompleteProps<T> extends Omit<ComboboxProps, 'data' | 'defaultValue' | 'loadOptions' | 'onChange' | 'onCreate' | 'searchable'> {
readonly name?: string;
readonly label?: ReactNode;
readonly description?: ReactNode;
readonly error?: ReactNode;
readonly defaultValue?: T | T[];
readonly toOption: (item: T) => AsyncAutocompleteOption<T>;
readonly loadOptions: (input: string, signal: AbortSignal) => Promise<T[]>;
readonly itemComponent?: (props: AsyncAutocompleteOption<T>) => JSX.Element | ReactNode;
readonly pillComponent?: (props: {
item: AsyncAutocompleteOption<T>;
disabled?: boolean;
onRemove: () => void;
}) => JSX.Element;
readonly emptyComponent?: (props: {
search: string;
}) => JSX.Element | ReactNode;
readonly onChange: (item: T[]) => void;
readonly onCreate?: (input: string) => T;
readonly creatable?: boolean;
readonly clearable?: boolean;
readonly required?: boolean;
readonly className?: string;
readonly placeholder?: string;
readonly leftSection?: ReactNode;
readonly maxValues?: number;
readonly optionsDropdownMaxHeight?: number;
readonly minInputLength?: number;
}
export declare function AttachmentArrayDisplay(props: AttachmentArrayDisplayProps): JSX.Element;
export declare interface AttachmentArrayDisplayProps {
readonly path?: string;
readonly values?: Attachment[];
readonly maxWidth?: number;
readonly includeDescriptionListEntry?: boolean;
readonly property?: InternalSchemaElement;
}
export declare function AttachmentArrayInput(props: AttachmentArrayInputProps): JSX.Element;
export declare interface AttachmentArrayInputProps {
readonly name: string;
readonly defaultValue?: Attachment[];
readonly arrayElement?: boolean;
readonly onChange?: (value: Attachment[]) => void;
readonly disabled?: boolean;
}
export declare function AttachmentButton(props: AttachmentButtonProps): JSX.Element;
export declare interface AttachmentButtonProps {
readonly securityContext?: Reference;
readonly onUpload: (attachment: Attachment) => void;
readonly onUploadStart?: () => void;
readonly onUploadProgress?: (e: ProgressEvent) => void;
readonly onUploadError?: (outcome: OperationOutcome) => void;
children(props: {
disabled?: boolean;
onClick(e: MouseEvent_2): void;
}): ReactNode;
readonly disabled?: boolean;
}
export declare function AttachmentDisplay(props: AttachmentDisplayProps): JSX.Element | null;
export declare interface AttachmentDisplayProps {
readonly value?: Attachment;
readonly maxWidth?: number;
}
export declare function AttachmentInput(props: AttachmentInputProps): JSX.Element;
export declare interface AttachmentInputProps extends ComplexTypeInputProps<Attachment> {
readonly arrayElement?: boolean;
readonly securityContext?: Reference;
readonly onChange?: (value: Attachment | undefined) => void;
}
export declare function BackboneElementDisplay(props: BackboneElementDisplayProps): JSX.Element | null;
export declare interface BackboneElementDisplayProps {
readonly value: TypedValue;
/** The path identifies the element and is expressed as a "."-separated list of ancestor elements, beginning with the name of the resource or extension. */
readonly path: string;
readonly compact?: boolean;
readonly ignoreMissingValues?: boolean;
readonly link?: boolean;
/** (optional) Profile URL of the structure definition represented by the backbone element */
readonly profileUrl?: string;
/**
* (optional) If provided, inputs specified in `accessPolicyResource.hiddenFields` are not shown.
*/
readonly accessPolicyResource?: AccessPolicyResource;
}
export declare function BackboneElementInput(props: BackboneElementInputProps): JSX.Element;
export declare interface BackboneElementInputProps extends BaseInputProps {
/** Type name the backbone element represents */
readonly typeName: string;
/** (optional) The contents of the resource represented by the backbone element */
readonly defaultValue?: any;
/** (optional) callback function that is called when the value of the backbone element changes */
readonly onChange?: (value: any) => void;
/** (optional) Profile URL of the structure definition represented by the backbone element */
readonly profileUrl?: string;
/**
* (optional) If provided, inputs specified in `accessPolicyResource.readonlyFields` are not editable
* and inputs specified in `accessPolicyResource.hiddenFields` are not shown.
*/
readonly accessPolicyResource?: AccessPolicyResource;
}
/**
* BaseChat component for displaying and managing communications.
*
* **NOTE: The component automatically filters `Communication` resources where the `sent` property is `undefined`.**
*
* @param props - The BaseChat React props.
* @returns The BaseChat React node.
*/
export declare function BaseChat(props: BaseChatProps): JSX.Element | null;
export declare interface BaseChatProps extends PaperProps {
readonly title: string;
readonly communications: Communication[];
readonly setCommunications: (communications: Communication[]) => void;
readonly query: string;
readonly sendMessage: (content: string, file?: File, existingDocRef?: DocumentReference) => void;
readonly onMessageReceived?: (message: Communication) => void;
readonly onMessageUpdated?: (message: Communication) => void;
readonly inputDisabled?: boolean;
readonly excludeHeader?: boolean;
readonly onError?: (err: Error) => void;
readonly uploadEnabled?: boolean;
readonly attachmentSubjectRef?: Reference;
readonly onViewInDocuments?: (reference: Reference<DocumentReference>) => void;
}
export declare interface BaseInputProps {
/** The path identifying the related element definition and is expressed as a "."-separated list of ancestor elements, beginning with the name of the resource or extension. */
readonly path: string;
/** (optional) A FHIRPath expression that identifies the input more precisely than `path`, e.g. `Patient.identifier[0].system` versus `Patient.identifier.system` */
readonly valuePath?: string;
/** (optional) OperationOutcome from the last attempted system action*/
readonly outcome?: OperationOutcome;
}
/**
* A generic widget to choose an option by date/time. Renders a monthly
* calendar UI and lets the viewer drill down into options on a given day.
*
* @param props - The React props
* @returns the JSX Element
*/
export declare function BaseScheduler<T>(props: BaseSchedulerProps<T>): JSX.Element | null;
export declare interface BaseSchedulerProps<T> {
/** A Reference or Resource to the actor being scheduled against (typically a Practitioner) */
readonly actor?: Reference | Resource;
/** A function that fetches SchedulingOption pairs. If this is not a stable function it can cause duplicate queries. */
readonly fetchOptions: FetchOptionsFunction<T>;
/** React nodes to render inside the scheduler container */
readonly children?: React.ReactNode;
/** A callback invoked when a specific option is selected */
readonly onSelectOption?: (el: T, date: Date) => void;
}
/**
* Returns a field display name.
* @param key - The field key.
* @returns The field display name.
*/
export declare function buildFieldNameString(key: string): string;
export declare function buildInitialResponse(questionnaire: Questionnaire, questionnaireResponse?: QuestionnaireResponse): QuestionnaireResponse;
export declare function buildInitialResponseItem(item: QuestionnaireItem): QuestionnaireResponseItem;
/**
* Returns a display label for a search parameter code.
*
* Meta fields keep their underscore-prefixed code so they don't collide with same-named
* elements (e.g. `ProjectMembership.project` vs `_project`).
* @param code - The search parameter code.
* @returns The display label for the search parameter.
*/
export declare function buildSearchParamFieldLabel(code: string): string;
export declare function CalendarDateInput(props: CalendarDateInputProps): JSX.Element;
export declare interface CalendarDateInputProps {
readonly availableDates: Date[];
readonly onChangeMonth: (date: Date) => void;
readonly onClick: (date: Date) => void;
}
export declare function CalendarInput(props: CalendarInputProps): JSX.Element;
export declare interface CalendarInputProps {
readonly slots: Slot[];
readonly onChangeMonth: (date: Date) => void;
readonly onClick: (date: Date) => void;
}
export declare function ChangePasswordForm(props: ChangePasswordFormProps): JSX.Element;
export declare interface ChangePasswordFormProps {
readonly onSuccess?: () => void;
}
export declare interface ChatBubbleSkeletonProps {
readonly alignment: 'left' | 'right';
readonly parentWidth: number;
}
export declare function ChatModal(props: ChatModalProps): JSX.Element | null;
export declare interface ChatModalProps {
readonly open?: boolean;
readonly children: ReactNode;
}
export declare function CheckboxFormSection(props: CheckboxFormSectionProps): JSX.Element;
export declare interface CheckboxFormSectionProps {
readonly htmlFor?: string;
readonly title?: string;
readonly description?: string;
readonly withAsterisk?: boolean;
readonly children?: ReactNode;
readonly testId?: string;
readonly fhirPath?: string;
readonly readonly?: boolean;
}
export declare function ChooseScopeForm(props: ChooseScopeFormProps): JSX.Element;
export declare interface ChooseScopeFormProps {
readonly login: string;
readonly scope: string | undefined;
readonly handleAuthResponse: (response: LoginAuthenticationResponse) => void;
readonly title?: string;
readonly submitLabel?: string;
readonly logo?: ReactNode;
readonly children?: ReactNode;
}
/**
* Clears all of the filters.
* @param definition - The original search request.
* @returns The updated search request.
*/
export declare function clearFilters(definition: SearchRequest): SearchRequest;
/**
* Clears all of the filters on a certain field.
* @param definition - The original search request.
* @param code - The field key name to clear filters.
* @returns The updated search request.
*/
export declare function clearFiltersOnField(definition: SearchRequest, code: string): SearchRequest;
export declare function CodeableConceptDisplay(props: CodeableConceptDisplayProps): JSX.Element;
export declare interface CodeableConceptDisplayProps {
readonly value?: CodeableConcept;
}
export declare function CodeableConceptInput(props: CodeableConceptInputProps): JSX.Element;
export declare interface CodeableConceptInputProps extends Omit<ValueSetAutocompleteProps, 'name' | 'defaultValue' | 'onChange' | 'disabled'>, ComplexTypeInputProps<CodeableConcept> {
readonly onChange?: (value: CodeableConcept | undefined) => void;
}
export declare function CodeInput(props: CodeInputProps): JSX.Element;
export declare interface CodeInputProps extends Omit<ValueSetAutocompleteProps, 'defaultValue' | 'onChange'> {
readonly defaultValue?: string;
readonly onChange: ((value: string | undefined) => void) | undefined;
}
export declare function CodingDisplay(props: CodingDisplayProps): JSX.Element;
export declare interface CodingDisplayProps {
readonly value?: Coding;
readonly includeCode?: boolean;
}
export declare function CodingInput(props: CodingInputProps): JSX.Element;
export declare interface CodingInputProps extends Omit<ValueSetAutocompleteProps, 'defaultValue' | 'onChange' | 'disabled' | 'name'>, ComplexTypeInputProps<Coding> {
readonly response?: QuestionnaireResponseItem;
}
export declare function codingToValueSetElement(coding: Coding): ValueSetExpansionContains;
export declare type Command<T = string> = {
command: string;
value?: T;
};
/**
* Compares two resources by meta.lastUpdated descending.
* Resources without meta.lastUpdated sort after resources with meta.lastUpdated.
* @param a - First resource.
* @param b - Second resource.
* @returns Comparator result for Array.sort().
*/
export declare function compareByLastUpdatedDescending(a: Resource, b: Resource): number;
export declare interface ComplexTypeInputProps<ValueType> extends BaseInputProps {
readonly name: string;
readonly defaultValue?: ValueType;
readonly onChange?: (value: ValueType, propName?: string) => void;
readonly disabled?: boolean;
}
export declare function ContactDetailDisplay(props: ContactDetailDisplayProps): JSX.Element | null;
export declare interface ContactDetailDisplayProps {
readonly value?: ContactDetail;
}
export declare function ContactDetailInput(props: ContactDetailInputProps): JSX.Element;
export declare type ContactDetailInputProps = ComplexTypeInputProps<ContactDetail>;
export declare function ContactPointDisplay(props: ContactPointDisplayProps): JSX.Element | null;
export declare interface ContactPointDisplayProps {
readonly value?: ContactPoint;
}
export declare function ContactPointInput(props: ContactPointInputProps): JSX.Element;
export declare type ContactPointInputProps = ComplexTypeInputProps<ContactPoint> & {
readonly onChange?: (value: ContactPoint | undefined) => void;
};
export declare function Container(props: ContainerProps): JSX.Element;
/**
* Converts an ISO-8601 date/time string to a local date/time string.
* @param isoString - The ISO-8601 date/time string to convert.
* @returns The local date/time string.
*/
export declare function convertIsoToLocal(isoString: string | undefined): string;
/**
* Converts a local date/time string to an ISO-8601 date/time string.
* @param localString - The local date/time string to convert.
* @returns The ISO-8601 date/time string.
*/
export declare function convertLocalToIso(localString: string | undefined): string;
export declare function convertToPCM16(float32Array: Float32Array): Uint8Array;
/**
* Labs section — searches for both ServiceRequest and DiagnosticReport resources.
* Accepts an optional `onRequestLabs` callback via closure.
* @param onRequestLabs - Optional callback invoked when the user requests labs.
* @returns A section config for labs.
*/
export declare function createLabsSection(onRequestLabs?: () => void): PatientSummarySectionConfig;
/**
* Pharmacies section — no FHIR searches; the Pharmacies component resolves its own data
* from patient extensions.
* Accepts an optional `pharmacyDialogComponent` via closure.
* @param pharmacyDialogComponent - Optional component for the pharmacy search dialog.
* @returns A section config for pharmacies.
*/
export declare function createPharmaciesSection(pharmacyDialogComponent?: ComponentType<PharmacyDialogBaseProps>): PatientSummarySectionConfig;
export { createPreferredPharmacyExtension }
/**
* Dynamically creates a script tag for the specified JavaScript file.
* @param src - The JavaScript file URL.
* @param onload - Optional callback for the onload event.
*/
export declare function createScriptTag(src: string, onload?: () => void): void;
/**
* The DateTimeInput component is a wrapper around the HTML5 input type="datetime-local".
* The main purpose is to reconcile time zones.
* Most of our date/time values are in ISO-8601, which includes a time zone offset.
* The datetime-local input does not support the time zone offset.
* @param props - The Input props.
* @returns The JSX element to render.
*/
export declare function DateTimeInput(props: DateTimeInputProps): JSX.Element;
export declare interface DateTimeInputProps extends PrimitiveTypeInputProps {
readonly label?: string;
readonly placeholder?: string;
readonly defaultValue?: string;
readonly autoFocus?: boolean;
readonly outcome?: OperationOutcome;
readonly onChange?: (value: string) => void;
}
/**
* Default item component for resource autocomplete inputs.
* Displays the resource avatar, display name, and birth date or ID.
*/
export declare const DefaultResourceItemComponent: ForwardRefExoticComponent<AsyncAutocompleteOption<Resource> & RefAttributes<HTMLDivElement>>;
export declare function DefaultResourceTimeline(props: DefaultResourceTimelineProps): JSX.Element;
export declare interface DefaultResourceTimelineProps extends Pick<ResourceTimelineProps<Resource>, 'getMenu'> {
readonly resource: Resource | Reference;
}
/**
* Deletes a filter at the specified index.
* @param definition - The original search request.
* @param index - The filter index.
* @returns The updated search request.
*/
export declare function deleteFilter(definition: SearchRequest, index: number): SearchRequest;
/** Demographics section — no FHIR searches, renders patient info items directly. */
export declare const DemographicsSection: PatientSummarySectionConfig;
export declare function DescriptionList(props: DescriptionListProps): JSX.Element;
export declare function DescriptionListEntry(props: DescriptionListEntryProps): JSX.Element;
export declare interface DescriptionListEntryProps {
readonly term: string;
readonly children: ReactNode;
}
export declare interface DescriptionListProps {
readonly children: ReactNode;
readonly compact?: boolean;
}
export declare function DiagnosticReportDisplay(props: DiagnosticReportDisplayProps): JSX.Element | null;
export declare namespace DiagnosticReportDisplay {
var defaultProps: DiagnosticReportDisplayProps;
}
export declare interface DiagnosticReportDisplayProps {
readonly value?: DiagnosticReport | Reference<DiagnosticReport>;
readonly hideObservationNotes?: boolean;
readonly hideSpecimenInfo?: boolean;
readonly hideSubject?: boolean;
}
declare function Document_2(props: PanelProps): JSX.Element;
export { Document_2 as Document }
export declare function ElementDefinitionInputSelector(props: ElementDefinitionSelectorProps): JSX.Element;
export declare interface ElementDefinitionSelectorProps extends ResourcePropertyInputProps {
readonly elementDefinitionTypes: ElementDefinitionType[];
}
export declare function ElementDefinitionTypeInput(props: ElementDefinitionTypeInputProps): JSX.Element;
export declare interface ElementDefinitionTypeInputProps extends Pick<ResourcePropertyInputProps, 'name' | 'path' | 'valuePath' | 'defaultValue' | 'onChange' | 'outcome'> {
readonly elementDefinitionType: ElementDefinitionType;
readonly min: number;
readonly max: number;
readonly binding: ElementDefinitionBinding | undefined;
readonly readOnly?: boolean;
}
export declare function EncounterTimeline(props: EncounterTimelineProps): JSX.Element;
export declare interface EncounterTimelineProps extends Pick<ResourceTimelineProps<Encounter>, 'getMenu'> {
readonly encounter: Encounter | Reference<Encounter>;
}
/**
* ErrorBoundary is a React component that handles errors in its child components.
* See: https://reactjs.org/docs/error-boundaries.html
*/
export declare class ErrorBoundary extends Component<ErrorBoundaryProps, ErrorBoundaryState> {
readonly state: ErrorBoundaryState;
constructor(props: ErrorBoundaryProps);
static getDerivedStateFromError(error: Error): ErrorBoundaryState;
componentDidUpdate(_prevProps: ErrorBoundaryProps, _prevState: ErrorBoundaryState): void;
shouldComponentUpdate(nextProps: ErrorBoundaryProps, nextState: ErrorBoundaryState): boolean;
componentDidCatch(error: Error, errorInfo: ErrorInfo): void;
render(): ReactNode;
}
export declare interface ErrorBoundaryProps {
readonly children: ReactNode;
}
export declare interface ErrorBoundaryState {
readonly error?: Error;
readonly lastLocation: string;
}
/**
* Evaluates the calculated expressions in a questionnaire.
* Updates response item answers in place with the calculated values.
*
* See: https://build.fhir.org/ig/HL7/sdc/StructureDefinition-sdc-questionnaire-calculatedExpression.html
*
* @param items - The questionnaire items to evaluate.
* @param response - The questionnaire response to evaluate against.
* @param responseItems - The response items to update.
*/
export declare function evaluateCalculatedExpressionsInQuestionnaire(items: QuestionnaireItem[], response: QuestionnaireResponse, responseItems?: QuestionnaireResponseItem[] | undefined): void;
/**
* Creates a Blob object from the JSON object given and downloads the object.
* @param jsonString - The JSON string.
* @param fileName - Optional file name. Default is based on current timestamp.
*/
export declare function exportJsonFile(jsonString: string, fileName?: string): void;
export declare type FetchOptionsFunction<T> = (period: Period) => Promise<SchedulingOption<T>[]>;
/**
* The FhirPathTable component represents the embeddable search table control.
* @param props - FhirPathTable React props.
* @returns FhirPathTable React node.
*/
export declare function FhirPathTable(props: FhirPathTableProps): JSX.Element;
export declare interface FhirPathTableField {
readonly propertyType: string;
readonly name: string;
readonly fhirPath: string;
}
export declare interface FhirPathTableProps {
readonly resourceType: string;
readonly query: string;
readonly fields: FhirPathTableField[];
readonly checkboxesEnabled?: boolean;
readonly onClick?: (e: SearchClickEvent) => void;
readonly onAuxClick?: (e: SearchClickEvent) => void;
readonly onBulk?: (ids: string[]) => void;
}
/** Descriptor for a single FHIR search that a section needs. */
export declare interface FhirSearchDescriptor {
/** Unique key used to access this search's results via `SectionResults[key]`. */
readonly key: string;
readonly resourceType: ResourceType;
/** Which search param references the patient. Defaults to 'subject'. Examples: 'patient', 'beneficiary'. */
readonly patientParam?: string;
/**
* Additional search params — same format as the 2nd arg to medplum.searchResources().
* When using a string, do not include _count or _sort; they are appended automatically.
*/
readonly query?: QueryTypes;
}
export declare function Form(props: FormProps): JSX.Element;
export declare interface FormProps {
readonly onSubmit?: (formData: Record<string, string>) => Promise<void> | void;
readonly style?: CSSProperties;
readonly children?: ReactNode;
readonly testid?: string;
}
export declare function FormSection(props: FormSectionProps): JSX.Element;
export declare interface FormSectionProps {
readonly title?: string;
readonly htmlFor?: string;
readonly description?: string;
readonly withAsterisk?: boolean;
readonly outcome?: OperationOutcome;
readonly children?: ReactNode;
readonly testId?: string;
readonly fhirPath?: string;
readonly errorExpression?: string;
readonly readonly?: boolean;
}
/**
* Returns the application name from environment variables or a default value.
* @returns The application name.
*/
export declare function getAppName(): string;
/**
* Returns the default set of sections, matching the original hardcoded PatientSummary layout.
* The `onRequestLabs` callback is threaded through to the Labs section.
* @param onRequestLabs - Optional callback invoked when the user requests labs.
* @returns The default array of section configs.
*/
export declare function getDefaultSections(onRequestLabs?: () => void): PatientSummarySectionConfig[];
export declare function getErrorsForInput(outcome: OperationOutcome | undefined, expression: string | undefined): string | undefined;
/**
* Returns the collection of field definitions for the search request.
* @param search - The search request definition.
* @returns An array of field definitions.
*/
export declare function getFieldDefinitions(search: SearchRequest): SearchControlField[];
export declare function getIssuesForExpression(outcome: OperationOutcome | undefined, expression: string | undefined): OperationOutcomeIssue[] | undefined;
export declare function getItemAnswerOptionValue(option: QuestionnaireItemAnswerOption): TypedValue;
export declare function getItemEnableWhenValueAnswer(enableWhen: QuestionnaireItemEnableWhen): TypedValue;
export declare function getItemInitialValue(initial: QuestionnaireItemInitial | undefined): TypedValue;
export declare function getNewMultiSelectValues(selected: string[], propertyName: string, item: QuestionnaireItem): QuestionnaireResponseItemAnswer[];
/**
* Returns a string representing the operation.
* @param op - The operation code.
* @returns A display string for the operation.
*/
export declare function getOpString(op: Operator): string;
/**
* Returns control properties for pagination controls.
* This is specifically for the Mantine Pagination component.
* See: https://v7.mantine.dev/core/pagination/?t=props
* @param controlName - The name of the pagination control (e.g., 'previous', 'next').
* @returns The properties for the pagination control.
*/
export declare function getPaginationControlProps(controlName: string): Record<string, string>;
export { getPreferredPharmaciesFromPatient }
/**
* Returns the reference filter for the given questionnaire item.
* @see https://build.fhir.org/ig/HL7/fhir-extensions/StructureDefinition-questionnaire-referenceFilter-definitions.html
* @param item - The questionnaire item to get the reference filter for.
* @param subject - Optional subject reference.
* @param encounter - Optional encounter reference.
* @returns The reference filter as a map of key/value pairs.
*/
export declare function getQuestionnaireItemReferenceFilter(item: QuestionnaireItem, subject: Reference | undefined, encounter: Reference<Encounter> | undefined): Record<string, string> | undefined;
export declare function getQuestionnaireItemReferenceTargetTypes(item: QuestionnaireItem): ResourceType[] | undefined;
/**
* Starts a request to generate a recapcha token.
* @param siteKey - The reCAPTCHA site key, available from the reCAPTCHA admin page.
* @returns Promise to a recaptcha token for the current user.
*/
export declare function getRecaptcha(siteKey: string): Promise<string>;
export declare function getResponseItemAnswerValue(answer: QuestionnaireResponseItemAnswer): TypedValue | undefined;
/**
* Returns a list of operators for a search parameter.
* @param searchParam - The search parameter.
* @returns The list of operators that can be used for the search parameter.
*/
export declare function getSearchOperators(searchParam: SearchParameter): Operator[] | undefined;
export declare function getSortField(definition: SearchRequest): string | undefined;
export declare function getValuePath(elementPath: string, valuePath: string | undefined, arrayIndex?: number): string;
export declare function Header(props: HeaderProps): JSX.Element;
export declare interface HeaderProps {
readonly pathname?: string;
readonly searchParams?: URLSearchParams;
readonly headerSearchDisabled?: boolean;
readonly logo: ReactNode;
readonly version?: string;
readonly navbarOpen?: boolean;
readonly navbarToggle: () => void;
readonly notifications?: ReactNode;
readonly announcements?: AppShellAnnouncement[];
readonly onDismissAnnouncement?: (announcement: AppShellAnnouncement) => void;
}
export declare type HeaderSearchTypes = Patient | ServiceRequest;
export declare function HumanNameDisplay(props: HumanNameDisplayProps): JSX.Element | null;
export declare interface HumanNameDisplayProps {
readonly value?: HumanName;
readonly options?: HumanNameFormatOptions;
}
export declare function HumanNameInput(props: HumanNameInputProps): JSX.Element;
export declare type HumanNameInputProps = ComplexTypeInputProps<HumanName>;
export declare function IdentifierDisplay(props: IdentifierDisplayProps): JSX.Element;
export declare interface IdentifierDisplayProps {
readonly value?: Identifier;
}
export declare function IdentifierInput(props: IdentifierInputProps): JSX.Element;
export declare type IdentifierInputProps = ComplexTypeInputProps<Identifier>;
export declare function InfoBar(props: InfoBarProps): JSX.Element;
export declare namespace InfoBar {
var Entry: (props: InfoBarEntryProps) => JSX.Element;
var Key: (props: InfoBarKeyProps) => JSX.Element;
var Value: (props: InfoBarValueProps) => JSX.Element;
}
export declare interface InfoBarEntryProps {
readonly children: ReactNode;
}
export declare interface InfoBarKeyProps {
readonly children: ReactNode;
}
export declare interface InfoBarProps {
readonly children: ReactNode;
}
export declare interface InfoBarValueProps {
readonly children: ReactNode;
}
/**
* Dynamically loads the recaptcha script.
* We do not want to load the script on page load unless the user needs it.
* @param siteKey - The reCAPTCHA site key, available from the reCAPTCHA admin page.
*/
export declare function initRecaptcha(siteKey: string): void;
/** Insurance section — searches for Coverage resources. */
export declare const InsuranceSection: PatientSummarySectionConfig;
export declare type IntervalGroup = {
id: string;
filters: Record<string, any>;
intervals: ObservationDefinitionQualifiedInterval[];
};
export { isAddPharmacyResponse }
/**
* Returns true if the event is an auxiliary click.
* @param e - The event.
* @returns True if the event is an auxiliary click.
*/
export declare function isAuxClick(e: MouseEvent_2): boolean;
/**
* Returns true if the element is a checkbox or a table cell containing a checkbox.
* Table cells containing checkboxes are commonly accidentally clicked.
* @param el - The HTML DOM element.
* @returns True if the element is a checkbox or a table cell containing a checkbox.
*/
export declare function isCheckboxCell(el: Element): boolean;
/**
* Returns true if the item is a choice question.
* @param item - The questionnaire item to check.
* @returns True if the item is a choice question, false otherwise.
*/
export declare function isChoiceQuestion(item: QuestionnaireItem): boolean;
/**
* Returns true if the given search parameter code refers to a resource metadata field.
* @param code - The search parameter code.
* @returns True if the code is a meta search parameter.
*/
export declare function isMetaSearchParam(code: string): boolean;
export { isOrganizationArray }
/**
* Returns true if the questionnaire item is enabled based on the enableWhen conditions or expression.
* @param item - The questionnaire item to check.
* @param questionnaireResponse - The questionnaire response to check against.
* @returns True if the question is enabled, false otherwise.
*/
export declare function isQuestionEnabled(item: QuestionnaireItem, questionnaireResponse: QuestionnaireResponse | undefined): boolean;
export declare function isSortDescending(definition: SearchRequest): boolean;
export declare function isSupportedProfileStructureDefinition(profile?: StructureDefinition): profile is SupportedProfileStructureDefinition;
/**
* Returns true if an error thrown while expanding a ValueSet means the value set itself is
* unavailable — a permanent 400/404 (e.g. "ValueSet not found"). Transient failures (429 rate
* limit, 401, 5xx, network) return false so a blip never disables a field.
* @param err - The error thrown by `valueSetExpand`.
* @returns True for a permanent 400/404, false for a transient failure.
*/
export declare function isValueSetUnavailableError(err: unknown): boolean;
/**
* Kills a browser event.
* Prevents default behavior.
* Stops event propagation.
* @param e - The event.
*/
export declare function killEvent(e: Event | SyntheticEvent): void;
/** Default Labs section constant (no onRequestLabs callback). */
export declare const LabsSection: PatientSummarySectionConfig;
export declare function LinkTabs(props: LinkTabsProps): JSX.Element;
export declare interface LinkTabsProps extends Omit<TabsProps, 'value' | 'onChange'> {
readonly baseUrl: string;
readonly tabs: string[] | TabDefinition[];
readonly children?: React.ReactNode;
}
/**
* ListWithDetailPane is a generic, presentational master-detail shell: a left sidebar
* with optional pill tabs, header actions, a scrollable list, and pagination, plus a
* detail area for the selected item. It does no data fetching or routing — it renders
* what it is given and emits `onTabChange` / `onPageChange` callbacks.
* @param props - The ListWithDetailPane React props.
* @returns The ListWithDetailPane React node.
*/
export declare function ListWithDetailPane<T extends {
id?: string;
} = Resource>(props: ListWithDetailPaneProps<T>): JSX.Element;
export declare interface ListWithDetailPaneDetailContext {
readonly refresh: () => Promise<void>;
}
/** The sidebar header is plain text or pill tabs, never both. */
export declare type ListWithDetailPaneHeaderProps = ListWithDetailPaneTextHeaderProps | ListWithDetailPaneTabsHeaderProps;
export declare interface ListWithDetailPaneItemContext<T extends {
id?: string;
} = Resource> {
readonly selected: boolean;
readonly index: number;
readonly items: T[];
}
export declare type ListWithDetailPaneProps<T extends {
id?: string;
} = Resource> = ListWithDetailPanePropsBase<T> & ListWithDetailPaneHeaderProps;
/** Props shared by every ListWithDetailPane, independent of the header style. */
export declare interface ListWithDetailPanePropsBase<T extends {
id?: string;
} = Resource> {
/** The current page of items to render in the list. */
readonly items: T[];
/** When true, the list area shows the skeleton instead of items. */
readonly loading: boolean;
/** Id of the highlighted row. */
readonly selectedKey?: string;
readonly renderItem: (item: T, ctx: ListWithDetailPaneItemContext<T>) => ReactNode;
/** Shown when the list is empty. Default: dimmed "No items found". */
readonly emptyList?: ReactNode;
/** Shown while loading. Default: built-in skeleton rows. */
readonly skeleton?: ReactNode;
/** Sidebar width in pixels. Default 350. */
readonly listWidth?: number;
/** Right-aligned slot in the sidebar header row: action buttons, filter popovers. */
readonly headerActions?: ReactNode;
/** The resolved selected item, or undefined when nothing is selected. */
readonly selected: T | undefined;
readonly renderDetail: (selected: T, ctx: ListWithDetailPaneDetailContext) => ReactNode;
/** Shown when nothing is selected. Default: dimmed prompt. */
readonly emptyDetail?: ReactNode;
/** Passed through to the detail render context. */
readonly refresh: () => Promise<void>;
/** Current 1-based page. Pagination is hidden unless this, `pageCount`, and `onPageChange` are set. */
readonly page?: number;
/** Total number of pages. Pagination is hidden when this is less than or equal to 1. */
readonly pageCount?: number;
/** Fired by the built-in pagination with the new 1-based page. */
readonly onPageChange?: (page: number) => void;
}
export declare interface ListWithDetailPaneTab {
readonly value: string;
readonly label: ReactNode;
readonly uri: string;
}
/**
* Pill-tab header. Declares `headerText` as `never` so tabs can't be mixed wi