@medplum/react 2.1.7 → 2.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -9
- package/dist/cjs/index.cjs +4 -4
- package/dist/cjs/index.cjs.map +4 -4
- package/dist/esm/index.mjs +4 -4
- package/dist/esm/index.mjs.map +4 -4
- package/dist/types/AttachmentButton/AttachmentButton.d.ts +2 -1
- package/dist/types/QuantityInput/QuantityInput.d.ts +1 -0
- package/dist/types/ReferenceInput/ReferenceInput.d.ts +1 -0
- package/dist/types/ResourceInput/ResourceInput.d.ts +1 -0
- package/dist/types/index.d.ts +1 -4
- package/package.json +2 -1
- package/dist/types/MedplumProvider/MedplumProvider.context.d.ts +0 -32
- package/dist/types/MedplumProvider/MedplumProvider.d.ts +0 -18
- package/dist/types/useResource/useResource.d.ts +0 -9
- package/dist/types/useSearch/useSearch.d.ts +0 -32
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { Attachment } from '@medplum/fhirtypes';
|
|
1
|
+
import { Attachment, OperationOutcome } from '@medplum/fhirtypes';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
export interface AttachmentButtonProps {
|
|
4
4
|
onUpload: (attachment: Attachment) => void;
|
|
5
5
|
onUploadStart?: () => void;
|
|
6
6
|
onUploadProgress?: (e: ProgressEvent) => void;
|
|
7
|
+
onUploadError?: (outcome: OperationOutcome) => void;
|
|
7
8
|
children(props: {
|
|
8
9
|
onClick(e: React.MouseEvent): void;
|
|
9
10
|
}): React.ReactNode;
|
|
@@ -6,6 +6,7 @@ export interface ReferenceInputProps {
|
|
|
6
6
|
defaultValue?: Reference;
|
|
7
7
|
targetTypes?: string[];
|
|
8
8
|
autoFocus?: boolean;
|
|
9
|
+
required?: boolean;
|
|
9
10
|
onChange?: (value: Reference | undefined) => void;
|
|
10
11
|
}
|
|
11
12
|
export declare function ReferenceInput(props: ReferenceInputProps): JSX.Element;
|
|
@@ -6,6 +6,7 @@ export interface ResourceInputProps<T extends Resource = Resource> {
|
|
|
6
6
|
readonly defaultValue?: T | Reference<T>;
|
|
7
7
|
readonly placeholder?: string;
|
|
8
8
|
readonly loadOnFocus?: boolean;
|
|
9
|
+
readonly required?: boolean;
|
|
9
10
|
readonly onChange?: (value: T | undefined) => void;
|
|
10
11
|
}
|
|
11
12
|
export declare function ResourceInput<T extends Resource = Resource>(props: ResourceInputProps<T>): JSX.Element | null;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export * from '@medplum/react-hooks';
|
|
1
2
|
export * from './AddressDisplay/AddressDisplay';
|
|
2
3
|
export * from './AddressInput/AddressInput';
|
|
3
4
|
export * from './AnnotationInput/AnnotationInput';
|
|
@@ -45,8 +46,6 @@ export * from './IdentifierInput/IdentifierInput';
|
|
|
45
46
|
export * from './Loading/Loading';
|
|
46
47
|
export * from './Logo/Logo';
|
|
47
48
|
export * from './MedplumLink/MedplumLink';
|
|
48
|
-
export * from './MedplumProvider/MedplumProvider';
|
|
49
|
-
export * from './MedplumProvider/MedplumProvider.context';
|
|
50
49
|
export * from './MoneyDisplay/MoneyDisplay';
|
|
51
50
|
export * from './MoneyInput/MoneyInput';
|
|
52
51
|
export * from './OperationOutcomeAlert/OperationOutcomeAlert';
|
|
@@ -86,8 +85,6 @@ export * from './ServiceRequestTimeline/ServiceRequestTimeline';
|
|
|
86
85
|
export * from './StatusBadge/StatusBadge';
|
|
87
86
|
export * from './Timeline/Timeline';
|
|
88
87
|
export * from './TimingInput/TimingInput';
|
|
89
|
-
export * from './useResource/useResource';
|
|
90
|
-
export * from './useSearch/useSearch';
|
|
91
88
|
export * from './utils/date';
|
|
92
89
|
export * from './utils/outcomes';
|
|
93
90
|
export * from './utils/questionnaire';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@medplum/react",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.9",
|
|
4
4
|
"description": "Medplum React Component Library",
|
|
5
5
|
"author": "Medplum <hello@medplum.com>",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -29,6 +29,7 @@
|
|
|
29
29
|
"@medplum/definitions": "*",
|
|
30
30
|
"@medplum/fhirtypes": "*",
|
|
31
31
|
"@medplum/mock": "*",
|
|
32
|
+
"@medplum/react-hooks": "*",
|
|
32
33
|
"@storybook/addon-actions": "7.4.6",
|
|
33
34
|
"@storybook/addon-essentials": "7.4.6",
|
|
34
35
|
"@storybook/addon-links": "7.4.6",
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import { MedplumClient, ProfileResource } from '@medplum/core';
|
|
3
|
-
export declare const reactContext: import("react").Context<MedplumContext | undefined>;
|
|
4
|
-
export type MepdlumNavigateFunction = (path: string) => void;
|
|
5
|
-
export interface MedplumContext {
|
|
6
|
-
medplum: MedplumClient;
|
|
7
|
-
navigate: MepdlumNavigateFunction;
|
|
8
|
-
profile?: ProfileResource;
|
|
9
|
-
loading: boolean;
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* Returns the MedplumContext instance.
|
|
13
|
-
* @returns The MedplumContext instance.
|
|
14
|
-
*/
|
|
15
|
-
export declare function useMedplumContext(): MedplumContext;
|
|
16
|
-
/**
|
|
17
|
-
* Returns the MedplumClient instance.
|
|
18
|
-
* This is a shortcut for useMedplumContext().medplum.
|
|
19
|
-
* @returns The MedplumClient instance.
|
|
20
|
-
*/
|
|
21
|
-
export declare function useMedplum(): MedplumClient;
|
|
22
|
-
/**
|
|
23
|
-
* Returns the Medplum navigate function.
|
|
24
|
-
* @returns The Medplum navigate function.
|
|
25
|
-
*/
|
|
26
|
-
export declare function useMedplumNavigate(): MepdlumNavigateFunction;
|
|
27
|
-
/**
|
|
28
|
-
* Returns the current Medplum user profile (if signed in).
|
|
29
|
-
* This is a shortcut for useMedplumContext().profile.
|
|
30
|
-
* @returns The current user profile.
|
|
31
|
-
*/
|
|
32
|
-
export declare function useMedplumProfile(): ProfileResource | undefined;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { MedplumClient } from '@medplum/core';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import { MepdlumNavigateFunction } from './MedplumProvider.context';
|
|
4
|
-
export interface MedplumProviderProps {
|
|
5
|
-
medplum: MedplumClient;
|
|
6
|
-
navigate?: MepdlumNavigateFunction;
|
|
7
|
-
children: React.ReactNode;
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* The MedplumProvider component provides Medplum context state.
|
|
11
|
-
*
|
|
12
|
-
* Medplum context includes:
|
|
13
|
-
* 1) medplum - Medplum client library
|
|
14
|
-
* 2) profile - The current user profile (if signed in)
|
|
15
|
-
* @param props The MedplumProvider React props.
|
|
16
|
-
* @returns The MedplumProvider React node.
|
|
17
|
-
*/
|
|
18
|
-
export declare function MedplumProvider(props: MedplumProviderProps): JSX.Element;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { OperationOutcome, Reference, Resource } from '@medplum/fhirtypes';
|
|
2
|
-
/**
|
|
3
|
-
* React Hook to use a FHIR reference.
|
|
4
|
-
* Handles the complexity of resolving references and caching resources.
|
|
5
|
-
* @param value The resource or reference to resource.
|
|
6
|
-
* @param setOutcome Optional callback to set the OperationOutcome.
|
|
7
|
-
* @returns The resolved resource.
|
|
8
|
-
*/
|
|
9
|
-
export declare function useResource<T extends Resource>(value: Reference<T> | T | undefined, setOutcome?: (outcome: OperationOutcome) => void): T | undefined;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { QueryTypes, ResourceArray } from '@medplum/core';
|
|
2
|
-
import { Bundle, ExtractResource, OperationOutcome, ResourceType } from '@medplum/fhirtypes';
|
|
3
|
-
/**
|
|
4
|
-
* React hook for searching FHIR resources.
|
|
5
|
-
*
|
|
6
|
-
* This is a convenience hook for calling the MedplumClient.search() method.
|
|
7
|
-
*
|
|
8
|
-
* @param resourceType The FHIR resource type to search.
|
|
9
|
-
* @param query Optional search parameters.
|
|
10
|
-
* @returns A 3-element tuple containing the search result, loading flag, and operation outcome.
|
|
11
|
-
*/
|
|
12
|
-
export declare function useSearch<K extends ResourceType>(resourceType: K, query?: QueryTypes): [Bundle<ExtractResource<K>> | undefined, boolean, OperationOutcome | undefined];
|
|
13
|
-
/**
|
|
14
|
-
* React hook for searching for a single FHIR resource.
|
|
15
|
-
*
|
|
16
|
-
* This is a convenience hook for calling the MedplumClient.searchOne() method.
|
|
17
|
-
*
|
|
18
|
-
* @param resourceType The FHIR resource type to search.
|
|
19
|
-
* @param query Optional search parameters.
|
|
20
|
-
* @returns A 3-element tuple containing the search result, loading flag, and operation outcome.
|
|
21
|
-
*/
|
|
22
|
-
export declare function useSearchOne<K extends ResourceType>(resourceType: K, query?: QueryTypes): [ExtractResource<K> | undefined, boolean, OperationOutcome | undefined];
|
|
23
|
-
/**
|
|
24
|
-
* React hook for searching for an array of FHIR resources.
|
|
25
|
-
*
|
|
26
|
-
* This is a convenience hook for calling the MedplumClient.searchResources() method.
|
|
27
|
-
*
|
|
28
|
-
* @param resourceType The FHIR resource type to search.
|
|
29
|
-
* @param query Optional search parameters.
|
|
30
|
-
* @returns A 3-element tuple containing the search result, loading flag, and operation outcome.
|
|
31
|
-
*/
|
|
32
|
-
export declare function useSearchResources<K extends ResourceType>(resourceType: K, query?: QueryTypes): [ResourceArray<ExtractResource<K>> | undefined, boolean, OperationOutcome | undefined];
|