@medplum/react
Version:
Medplum React Component Library
1,258 lines (1,029 loc) • 77.9 kB
TypeScript
import { AccessPolicyResource } from '@medplum/fhirtypes';
import { Address } from '@medplum/fhirtypes';
import { AnchorProps } from '@mantine/core';
import { Annotation } from '@medplum/fhirtypes';
import { Attachment } from '@medplum/fhirtypes';
import { AvatarProps } from '@mantine/core';
import { BadgeProps } from '@mantine/core';
import { BaseLoginRequest } from '@medplum/core';
import { Bundle } from '@medplum/fhirtypes';
import { ButtonProps } from '@mantine/core';
import { ClientApplication } from '@medplum/fhirtypes';
import { CodeableConcept } from '@medplum/fhirtypes';
import { Coding } from '@medplum/fhirtypes';
import { ComboboxItem } from '@mantine/core';
import { ComboboxProps } from '@mantine/core';
import { Communication } from '@medplum/fhirtypes';
import { Component } from 'react';
import { ContactDetail } from '@medplum/fhirtypes';
import { ContactPoint } from '@medplum/fhirtypes';
import { ContainerProps } from '@mantine/core';
import { Context } from 'react';
import { CSSProperties } from 'react';
import { DiagnosticReport } from '@medplum/fhirtypes';
import { ElementDefinitionBinding } from '@medplum/fhirtypes';
import { ElementDefinitionType } from '@medplum/fhirtypes';
import { Encounter } from '@medplum/fhirtypes';
import { ErrorInfo } from 'react';
import { ExtendedInternalSchemaElement } from '@medplum/core';
import { ExtractResource } from '@medplum/fhirtypes';
import { Filter } from '@medplum/core';
import { HumanName } from '@medplum/fhirtypes';
import { HumanNameFormatOptions } from '@medplum/core';
import { Identifier } from '@medplum/fhirtypes';
import { InternalSchemaElement } from '@medplum/core';
import { JSX } from 'react';
import { MeasureReport } from '@medplum/fhirtypes';
import { Media } from '@medplum/fhirtypes';
import { MedplumClient } from '@medplum/core';
import { MemoExoticComponent } from 'react';
import { Money } from '@medplum/fhirtypes';
import { MouseEvent as MouseEvent_2 } from 'react';
import { MouseEventHandler } from 'react';
import { Observation } from '@medplum/fhirtypes';
import { ObservationDefinition } from '@medplum/fhirtypes';
import { ObservationDefinitionQualifiedInterval } from '@medplum/fhirtypes';
import { OperationOutcome } from '@medplum/fhirtypes';
import { OperationOutcomeIssue } from '@medplum/fhirtypes';
import { Operator } from '@medplum/core';
import { PaperProps } from '@mantine/core';
import { Patient } from '@medplum/fhirtypes';
import { PlanDefinition } from '@medplum/fhirtypes';
import { ProfileResource } from '@medplum/core';
import { Quantity } from '@medplum/fhirtypes';
import { QueryTypes } from '@medplum/core';
import { Questionnaire } from '@medplum/fhirtypes';
import { QuestionnaireItem } from '@medplum/fhirtypes';
import { QuestionnaireItemAnswerOption } from '@medplum/fhirtypes';
import { QuestionnaireItemEnableWhen } from '@medplum/fhirtypes';
import { QuestionnaireItemInitial } from '@medplum/fhirtypes';
import { QuestionnaireResponse } from '@medplum/fhirtypes';
import { QuestionnaireResponseItem } from '@medplum/fhirtypes';
import { QuestionnaireResponseItemAnswer } from '@medplum/fhirtypes';
import { Range as Range_2 } from '@medplum/fhirtypes';
import { Ratio } from '@medplum/fhirtypes';
import { ReactNode } from 'react';
import { Reference } from '@medplum/fhirtypes';
import { RequestGroup } from '@medplum/fhirtypes';
import { Resource } from '@medplum/fhirtypes';
import { ResourceArray } from '@medplum/core';
import { ResourceType } from '@medplum/fhirtypes';
import { Schedule } from '@medplum/fhirtypes';
import { SearchParameter } from '@medplum/fhirtypes';
import { SearchRequest } from '@medplum/core';
import { ServiceRequest } from '@medplum/fhirtypes';
import { Signature } from '@medplum/fhirtypes';
import { Slot } from '@medplum/fhirtypes';
import { StructureDefinition } from '@medplum/fhirtypes';
import { Subscription } from '@medplum/fhirtypes';
import { SyntheticEvent } from 'react';
import { Task } from '@medplum/fhirtypes';
import { TextProps } from '@mantine/core';
import { Timing } from '@medplum/fhirtypes';
import { TypedValue } from '@medplum/core';
import { ValueSetExpandParams } from '@medplum/core';
import { ValueSetExpansionContains } from '@medplum/fhirtypes';
/**
* 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;
/**
* 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 declare function AddressDisplay(props: AddressDisplayProps): JSX.Element | null;
export declare interface AddressDisplayProps {
readonly value?: Address;
}
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 AnnotationInput(props: AnnotationInputProps): JSX.Element;
export declare interface AnnotationInputProps extends ComplexTypeInputProps<Annotation> {
}
export declare function AppShell(props: AppShellProps): JSX.Element;
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;
}
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) => void;
readonly onMessageReceived?: (message: Communication) => void;
readonly onMessageUpdated?: (message: Communication) => void;
readonly inputDisabled?: boolean;
readonly excludeHeader?: boolean;
readonly onError?: (err: Error) => 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;
}
/**
* 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;
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 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;
}
/**
* 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;
}
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 type Command<T = string> = {
command: string;
value?: T;
};
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;
/**
* 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;
}
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;
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;
/**
* 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;
}
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;
}
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>;
/**
* 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 navbarToggle: () => void;
readonly notifications?: ReactNode;
}
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;
export declare type IntervalGroup = {
id: string;
filters: Record<string, any>;
intervals: ObservationDefinitionQualifiedInterval[];
};
/**
* 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 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;
/**
* Kills a browser event.
* Prevents default behavior.
* Stops event propagation.
* @param e - The event.
*/
export declare function killEvent(e: Event | SyntheticEvent): void;
export declare function Loading(): JSX.Element;
export declare function Logo(props: LogoProps): JSX.Element;
export declare interface LogoProps {
readonly size: number;
readonly fill?: string;
}
export declare function MeasureReportDisplay(props: MeasureReportDisplayProps): JSX.Element | null;
export declare interface MeasureReportDisplayProps {
readonly measureReport: MeasureReport | Reference<MeasureReport>;
}
export declare interface MedplumContext {
medplum: MedplumClient;
navigate: MedplumNavigateFunction;
profile?: ProfileResource;
loading: boolean;
}
export declare function MedplumLink(props: MedplumLinkProps): JSX.Element;
export declare interface MedplumLinkProps extends TextProps {
readonly to?: Resource | Reference | string;
readonly suffix?: string;
readonly label?: string;
readonly onClick?: MouseEventHandler;
readonly children: ReactNode;
}
export declare type MedplumNavigateFunction = (path: string) => void;
/**
* The MedplumProvider component provides Medplum context state.
*
* Medplum context includes:
* 1) medplum - Medplum client library
* 2) profile - The current user profile (if signed in)
* @param props - The MedplumProvider React props.
* @returns The MedplumProvider React node.
*/
export declare function MedplumProvider(props: MedplumProviderProps): JSX.Element;
export declare interface MedplumProviderProps {
readonly medplum: MedplumClient;
readonly navigate?: MedplumNavigateFunction;
readonly children: ReactNode;
}
export declare const MemoizedFhirPathTable: MemoExoticComponent<typeof FhirPathTable>;
/**
* @deprecated
*
* The memoization `MemoizedSearchControl` provides has been merged into `SearchControl`. Previously the memoization was done via HOC but
* it was proven that this wasn't effective for a large number of use cases, especially when:
* 1. `search` was an inline static object, which would trigger the memo to recompute on every re-render of the parent component
* 2. Any of the callbacks, such as `onClick` were not memoized via `useCallback`, which would result in the recomputation as well
*
* Scenario 1 also retriggered the effect that runs `loadResults` on change of the `search`, which was less than desirable.
*
* The memoization is now accomplished via checking deep equality of the incoming `search` prop in the body of the component, and setting a memoized
* state whenever the incoming and current memoized value are not deeply equal. See: https://github.com/medplum/medplum/pull/5023
*/
export declare const MemoizedSearchControl: typeof SearchControl;
export declare function MfaForm(props: MfaFormProps): JSX.Element;
export declare type MfaFormFields = 'token';
export declare interface MfaFormProps {
readonly title: string;
readonly buttonText: string;
readonly qrCodeUrl?: string;
readonly onSubmit: (formData: Record<MfaFormFields, string>) => void | Promise<void>;
}
export declare function MoneyDisplay(props: MoneyDisplayProps): JSX.Element | null;
export declare interface MoneyDisplayProps {
readonly value?: Money;
}
export declare function MoneyInput(props: MoneyInputProps): JSX.Element;
export declare interface MoneyInputProps extends ComplexTypeInputProps<Money> {
readonly label?: string;
readonly placeholder?: string;
}
export declare function Navbar(props: NavbarProps): JSX.Element;
export declare interface NavbarLink {
readonly icon?: JSX.Element;
readonly label?: string;
readonly href: string;
}
export declare interface NavbarMenu {
readonly title?: string;
readonly links?: NavbarLink[];
}
export declare interface NavbarProps {
readonly pathname?: string;
readonly searchParams?: URLSearchParams;
readonly menus?: NavbarMenu[];
readonly closeNavbar: () => void;
readonly displayAddBookmark?: boolean;
readonly resourceTypeSearchDisabled?: boolean;
}
export declare function NoteDisplay({ value }: NoteDisplayProps): JSX.Element | null;
export declare interface NoteDisplayProps {
readonly value?: Annotation[];
}
export declare function NotificationIcon(props: NotificationIconProps): JSX.Element;
export declare interface NotificationIconProps {
readonly iconComponent: JSX.Element;
readonly label: string;
readonly resourceType: ResourceType;
readonly countCriteria: string;
readonly subscriptionCriteria: string;
readonly onClick: () => void;
}
export declare function ObservationTable(props: ObservationTableProps): JSX.Element;
export declare interface ObservationTableProps {
readonly value?: Observation[] | Reference<Observation>[];
readonly ancestorIds?: string[];
readonly hideObservationNotes?: boolean;
}
export declare function OperationOutcomeAlert(props: OperationOutcomeAlertProps): JSX.Element | null;
export declare interface OperationOutcomeAlertProps {
readonly outcome?: OperationOutcome;
readonly issues?: OperationOutcomeIssue[];
}
export declare function Panel(props: PanelProps): JSX.Element;
export declare interface PanelProps extends PaperProps {
readonly width?: number;
readonly fill?: boolean;
readonly children?: ReactNode;
}
/**
* Parses an HTML form and returns the result as a JavaScript object.
* @param form - The HTML form element.
* @returns Form values in key value pairs.
*/
export declare function parseForm(form: HTMLFormElement): Record<string, string>;
export declare function PatientExportForm(props: PatientExportFormProps): JSX.Element;
export declare interface PatientExportFormProps {
readonly patient: Patient | Reference<Patient>;
}
export declare function PatientHeader(props: PatientHeaderProps): JSX.Element | null;
export declare interface PatientHeaderProps {
readonly patient: Patient | Reference<Patient>;
}
export declare function PatientSummary(props: PatientSummaryProps): JSX.Element | null;
export declare interface PatientSummaryProps {
readonly patient: Patient | Reference<Patient>;
readonly onClickResource?: (resource: Resource) => void;
readonly onRequestLabs?: () => void;
}
export declare function PatientTimeline(props: PatientTimelineProps): JSX.Element;
export declare interface PatientTimelineProps extends Pick<ResourceTimelineProps<Patient>, 'getMenu'> {
readonly patient: Patient | Reference<Patient>;
}
export declare function PlanDefinitionBuilder(props: PlanDefinitionBuilderProps): JSX.Element | null;
export declare interface PlanDefinitionBuilderProps {
readonly value: Partial<PlanDefinition> | Reference<PlanDefinition>;
readonly onSubmit: (result: PlanDefinition) => void;
}
export declare interface PrimitiveTypeInputProps {
readonly id?: string;
readonly name: string;
readonly 'data-testid'?: string;
readonly defaultValue?: any;
readonly required?: boolean;
readonly error?: string;
readonly disabled?: boolean;
}
export declare function QuantityDisplay(props: QuantityDisplayProps): JSX.Element | null;
export declare interface QuantityDisplayProps {
readonly value?: Quantity;
}
export declare function QuantityInput(props: QuantityInputProps): JSX.Element;
export declare interface QuantityInputProps extends ComplexTypeInputProps<Quantity> {
readonly autoFocus?: boolean;
readonly required?: boolean;
readonly disableWheel?: boolean;
}
export declare const QUESTIONNAIRE_CALCULATED_EXPRESSION_URL = "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-calculatedExpression";
export declare const QUESTIONNAIRE_ENABLED_WHEN_EXPRESSION_URL = "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-enableWhenExpression";
export declare const QUESTIONNAIRE_ITEM_CONTROL_URL = "http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl";
export declare const QUESTIONNAIRE_REFERENCE_FILTER_URL = "http://hl7.org/fhir/StructureDefinition/questionnaire-referenceFilter";
export declare const QUESTIONNAIRE_REFERENCE_RESOURCE_URL = "http://hl7.org/fhir/StructureDefinition/questionnaire-referenceResource";
export declare const QUESTIONNAIRE_SIGNATURE_REQUIRED_URL = "http://hl7.org/fhir/StructureDefinition/questionnaire-signatureRequired";
export declare const QUESTIONNAIRE_SIGNATURE_RESPONSE_URL = "http://hl7.org/fhir/StructureDefinition/questionnaireresponse-signature";
export declare const QUESTIONNAIRE_VALIDATION_ERROR_URL = "http://hl7.org/fhir/StructureDefinition/questionnaire-validationError";
export declare function QuestionnaireBuilder(props: QuestionnaireBuilderProps): JSX.Element | null;
export declare interface QuestionnaireBuilderProps {
readonly questionnaire: Partial<Questionnaire> | Reference<Questionnaire>;
readonly onSubmit: (result: Questionnaire) => void;
readonly autoSave?: boolean;
}
export declare function QuestionnaireForm(props: QuestionnaireFormProps): JSX.Element | null;
export declare interface QuestionnaireFormLoadedState {
/** Not loading */
readonly loading: false;
/** The loaded questionnaire */
questionnaire: Questionnaire;
/** The current draft questionnaire response */
questionnaireResponse: QuestionnaireResponse;
/** Optional questionnaire subject */
subject?: Reference;
/** Optional questionnaire encounter */
encounter?: Reference<Encounter>;
/** The top level items for the current page */
items: QuestionnaireItem[];
/** The response items for the current page */
responseItems: QuestionnaireResponseItem[];
/**
* Adds a new group item to the current context.
* @param context - The current context of the questionnaire response items.
* @param item - The questionnaire item that is being added to the group.
*/
onAddGroup: (context: QuestionnaireResponseItem[], item: QuestionnaireItem) => void;
/**
* Adds an answer to a repeating item.
* @param context - The current context of the questionnaire response items.
* @param item - The questionnaire item that is being answered.
*/
onAddAnswer: (context: QuestionnaireResponseItem[], item: QuestionnaireItem) => void;
/**
* Changes an answer value.
* @param context - The current context of the questionnaire response items.
* @param item - The questionnaire item that is being answered.
* @param answer - The answer(s) provided by the user for the questionnaire item.
*/
onChangeAnswer: (context: QuestionnaireResponseItem[], item: QuestionnaireItem, answer: QuestionnaireResponseItemAnswer[]) => void;
/**
* Sets or updates the signature for the questionnaire response.
* @param signature - The signature to set, or undefined to clear the signature.
*/
onChangeSignature: (signature: Signature | undefined) => void;
}
export declare interface QuestionnaireFormLoadingState {
/** Currently loading data such as the Questionnaire or the QuestionnaireResponse default value */
readonly loading: true;
}
export declare interface QuestionnaireFormPage {
readonly linkId: string;
readonly title: string;
readonly group: QuestionnaireItem & {
type: 'group';
};
}
export declare interface QuestionnaireFormPaginationState extends QuestionnaireFormLoadedState {
readonly pagination: true;
pages: QuestionnaireFormPage[];
activePage: number;
onNextPage: () => void;
onPrevPage: () => void;
}
export declare interface QuestionnaireFormProps {
readonly questionnaire: Questionnaire | Reference<Questionnaire>;
readonly questionnaireResponse?: QuestionnaireResponse | Reference<QuestionnaireResponse>;
readonly subject?: Reference;
readonly encounter?: Reference<Encounter>;
readonly source?: QuestionnaireResponse['source'];
readonly disablePagination?: boolean;
readonly excludeButtons?: boolean;
readonly submitButtonText?: string;
readonly onChange?: (response: QuestionnaireResponse) => void;
readonly onSubmit?: (response: QuestionnaireResponse) => void;
}
export declare interface QuestionnaireFormSinglePageState extends QuestionnaireFormLoadedState {
readonly pagination: false;
}
export declare type QuestionnaireFormState = QuestionnaireFormLoadingState | QuestionnaireFormSinglePageState | QuestionnaireFormPaginationState;
export declare const QuestionnaireItemType: {
readonly group: "group";
readonly display: "display";
readonly question: "question";
readonly boolean: "boolean";
readonly decimal: "decimal";
readonly integer: "integer";
readonly date: "date";
readonly dateTime: "dateTime";
readonly time: "time";
readonly string: "string";
readonly text: "text";
readonly url: "url";
readonly choice: "choice";
readonly openChoice: "open-choice";
readonly attachment: "attachment";
readonly reference: "reference";
readonly quantity: "quantity";
};
export declare type QuestionnaireItemType = (typeof QuestionnaireItemType)[keyof typeof QuestionnaireItemType];
export declare function QuestionnaireResponseDisplay(props: QuestionnaireResponseDisplayProps): JSX.Element;
export declare interface QuestionnaireResponseDisplayProps {
readonly questionnaireResponse: QuestionnaireResponse | Reference<QuestionnaireResponse>;
}
export declare function RangeDisplay(props: RangeDisplayProps): JSX.Element | null;
export declare interface RangeDisplayProps {
readonly value?: Range_2;
}
/**
* Renders a Range input.
* See: https://www.hl7.org/fhir/datatypes.html#Range
* @param props - Range input properties.
* @returns Range input element.
*/
export declare function RangeInput(props: RangeInputProps): JSX.Element;
export declare interface RangeInputProps extends ComplexTypeInputProps<Range_2> {
}
/**
* Renders a Ratio input.
* See: https://www.hl7.org/fhir/datatypes.html#Ratio
* @param props - Ratio input properties.
* @returns Ratio input element.
*/
export declare function RatioInput(props: RatioInputProps): JSX.Element;
export declare interface RatioInputProps extends ComplexTypeInputProps<Ratio> {
}
export declare const reactContext: Context<MedplumContext | undefined>;
export declare function ReferenceDisplay(props: ReferenceDisplayProps): JSX.Element | null;
export declare interface R