@medplum/react 2.1.5 → 2.1.7

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.
@@ -5,11 +5,4 @@ export interface CalendarInputProps {
5
5
  onChangeMonth: (date: Date) => void;
6
6
  onClick: (date: Date) => void;
7
7
  }
8
- /**
9
- * Returns a month display string (e.g. "January 2020").
10
- * @param date Any date within the month.
11
- * @returns The month display string (e.g. "January 2020")
12
- */
13
- export declare function getMonthString(date: Date): string;
14
8
  export declare function CalendarInput(props: CalendarInputProps): JSX.Element;
15
- export declare function getStartMonth(): Date;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Returns a month display string (e.g. "January 2020").
3
+ * @param date Any date within the month.
4
+ * @returns The month display string (e.g. "January 2020")
5
+ */
6
+ export declare function getMonthString(date: Date): string;
7
+ export declare function getStartMonth(): Date;
@@ -18,15 +18,3 @@ export interface DateTimeInputProps {
18
18
  * @returns The JSX element to render.
19
19
  */
20
20
  export declare function DateTimeInput(props: DateTimeInputProps): JSX.Element;
21
- /**
22
- * Converts an ISO-8601 date/time string to a local date/time string.
23
- * @param isoString The ISO-8601 date/time string to convert.
24
- * @returns The local date/time string.
25
- */
26
- export declare function convertIsoToLocal(isoString: string | undefined): string;
27
- /**
28
- * Converts a local date/time string to an ISO-8601 date/time string.
29
- * @param localString The local date/time string to convert.
30
- * @returns The ISO-8601 date/time string.
31
- */
32
- export declare function convertLocalToIso(localString: string | undefined): string;
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Converts an ISO-8601 date/time string to a local date/time string.
3
+ * @param isoString The ISO-8601 date/time string to convert.
4
+ * @returns The local date/time string.
5
+ */
6
+ export declare function convertIsoToLocal(isoString: string | undefined): string;
7
+ /**
8
+ * Converts a local date/time string to an ISO-8601 date/time string.
9
+ * @param localString The local date/time string to convert.
10
+ * @returns The ISO-8601 date/time string.
11
+ */
12
+ export declare function convertLocalToIso(localString: string | undefined): string;
@@ -11,6 +11,7 @@ export declare namespace DiagnosticReportDisplay {
11
11
  }
12
12
  export interface ObservationTableProps {
13
13
  value?: Observation[] | Reference<Observation>[];
14
+ ancestorIds?: string[];
14
15
  hideObservationNotes?: boolean;
15
16
  }
16
17
  export declare function ObservationTable(props: ObservationTableProps): JSX.Element;
@@ -5,4 +5,3 @@ export interface GoogleButtonProps {
5
5
  readonly handleGoogleCredential: (response: GoogleCredentialResponse) => void;
6
6
  }
7
7
  export declare function GoogleButton(props: GoogleButtonProps): JSX.Element | null;
8
- export declare function getGoogleClientId(clientId: string | undefined): string | undefined;
@@ -0,0 +1 @@
1
+ export declare function getGoogleClientId(clientId: string | undefined): string | undefined;
@@ -0,0 +1,32 @@
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,17 +1,11 @@
1
- import { MedplumClient, ProfileResource } from '@medplum/core';
1
+ import { MedplumClient } from '@medplum/core';
2
2
  import React from 'react';
3
- export type MepdlumNavigateFunction = (path: string) => void;
3
+ import { MepdlumNavigateFunction } from './MedplumProvider.context';
4
4
  export interface MedplumProviderProps {
5
5
  medplum: MedplumClient;
6
6
  navigate?: MepdlumNavigateFunction;
7
7
  children: React.ReactNode;
8
8
  }
9
- export interface MedplumContext {
10
- medplum: MedplumClient;
11
- navigate: MepdlumNavigateFunction;
12
- profile?: ProfileResource;
13
- loading: boolean;
14
- }
15
9
  /**
16
10
  * The MedplumProvider component provides Medplum context state.
17
11
  *
@@ -22,25 +16,3 @@ export interface MedplumContext {
22
16
  * @returns The MedplumProvider React node.
23
17
  */
24
18
  export declare function MedplumProvider(props: MedplumProviderProps): JSX.Element;
25
- /**
26
- * Returns the MedplumContext instance.
27
- * @returns The MedplumContext instance.
28
- */
29
- export declare function useMedplumContext(): MedplumContext;
30
- /**
31
- * Returns the MedplumClient instance.
32
- * This is a shortcut for useMedplumContext().medplum.
33
- * @returns The MedplumClient instance.
34
- */
35
- export declare function useMedplum(): MedplumClient;
36
- /**
37
- * Returns the Medplum navigate function.
38
- * @returns The Medplum navigate function.
39
- */
40
- export declare function useMedplumNavigate(): MepdlumNavigateFunction;
41
- /**
42
- * Returns the current Medplum user profile (if signed in).
43
- * This is a shortcut for useMedplumContext().profile.
44
- * @returns The current user profile.
45
- */
46
- export declare function useMedplumProfile(): ProfileResource | undefined;
@@ -6,4 +6,3 @@ export interface ResourceBlameProps {
6
6
  id?: string;
7
7
  }
8
8
  export declare function ResourceBlame(props: ResourceBlameProps): JSX.Element | null;
9
- export declare function getTimeString(lastUpdated: string): string;
@@ -0,0 +1,3 @@
1
+ import { Resource } from '@medplum/fhirtypes';
2
+ export declare function getVersionUrl(resource: Resource, versionId: string): string;
3
+ export declare function getTimeString(lastUpdated: string): string;
@@ -1,5 +1,4 @@
1
1
  /// <reference types="react" />
2
- import { InternalSchemaElement } from '@medplum/core';
3
2
  import { OperationOutcome, Reference, Resource } from '@medplum/fhirtypes';
4
3
  export interface ResourceFormProps {
5
4
  defaultValue: Resource | Reference;
@@ -8,4 +7,3 @@ export interface ResourceFormProps {
8
7
  onDelete?: (resource: Resource) => void;
9
8
  }
10
9
  export declare function ResourceForm(props: ResourceFormProps): JSX.Element;
11
- export declare function setPropertyValue(obj: any, key: string, propName: string, elementDefinition: InternalSchemaElement, value: any): any;
@@ -0,0 +1,2 @@
1
+ import { InternalSchemaElement } from '@medplum/core';
2
+ export declare function setPropertyValue(obj: any, key: string, propName: string, elementDefinition: InternalSchemaElement, value: any): any;
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- import { InternalSchemaElement, TypedValue } from '@medplum/core';
2
+ import { InternalSchemaElement } from '@medplum/core';
3
3
  export interface ResourcePropertyDisplayProps {
4
4
  property?: InternalSchemaElement;
5
5
  propertyType: string;
@@ -15,14 +15,3 @@ export interface ResourcePropertyDisplayProps {
15
15
  * @returns The ResourcePropertyDisplay React node.
16
16
  */
17
17
  export declare function ResourcePropertyDisplay(props: ResourcePropertyDisplayProps): JSX.Element;
18
- /**
19
- * Returns the value of the property and the property type.
20
- * Some property definitions support multiple types.
21
- * For example, "Observation.value[x]" can be "valueString", "valueInteger", "valueQuantity", etc.
22
- * According to the spec, there can only be one property for a given element definition.
23
- * This function returns the value and the type.
24
- * @param context The base context (usually a FHIR resource).
25
- * @param path The property path.
26
- * @returns The value of the property and the property type.
27
- */
28
- export declare function getValueAndType(context: TypedValue, path: string): [any, string];
@@ -0,0 +1,12 @@
1
+ import { TypedValue } from '@medplum/core';
2
+ /**
3
+ * Returns the value of the property and the property type.
4
+ * Some property definitions support multiple types.
5
+ * For example, "Observation.value[x]" can be "valueString", "valueInteger", "valueQuantity", etc.
6
+ * According to the spec, there can only be one property for a given element definition.
7
+ * This function returns the value and the type.
8
+ * @param context The base context (usually a FHIR resource).
9
+ * @param path The property path.
10
+ * @returns The value of the property and the property type.
11
+ */
12
+ export declare function getValueAndType(context: TypedValue, path: string): [any, string];
@@ -10,13 +10,15 @@ export * from './AttachmentArrayInput/AttachmentArrayInput';
10
10
  export * from './AttachmentButton/AttachmentButton';
11
11
  export * from './AttachmentDisplay/AttachmentDisplay';
12
12
  export * from './AttachmentInput/AttachmentInput';
13
+ export * from './auth/RegisterForm';
14
+ export * from './auth/SignInForm';
13
15
  export * from './BackboneElementDisplay/BackboneElementDisplay';
14
16
  export * from './BackboneElementInput/BackboneElementInput';
15
17
  export * from './CalendarInput/CalendarInput';
16
18
  export * from './CheckboxFormSection/CheckboxFormSection';
17
- export * from './CodeInput/CodeInput';
18
19
  export * from './CodeableConceptDisplay/CodeableConceptDisplay';
19
20
  export * from './CodeableConceptInput/CodeableConceptInput';
21
+ export * from './CodeInput/CodeInput';
20
22
  export * from './CodingDisplay/CodingDisplay';
21
23
  export * from './CodingInput/CodingInput';
22
24
  export * from './ContactDetailDisplay/ContactDetailDisplay';
@@ -25,6 +27,7 @@ export * from './ContactPointDisplay/ContactPointDisplay';
25
27
  export * from './ContactPointInput/ContactPointInput';
26
28
  export * from './Container/Container';
27
29
  export * from './DateTimeInput/DateTimeInput';
30
+ export * from './DateTimeInput/DateTimeInput.utils';
28
31
  export * from './DefaultResourceTimeline/DefaultResourceTimeline';
29
32
  export * from './DescriptionList/DescriptionList';
30
33
  export * from './DiagnosticReportDisplay/DiagnosticReportDisplay';
@@ -43,6 +46,7 @@ export * from './Loading/Loading';
43
46
  export * from './Logo/Logo';
44
47
  export * from './MedplumLink/MedplumLink';
45
48
  export * from './MedplumProvider/MedplumProvider';
49
+ export * from './MedplumProvider/MedplumProvider.context';
46
50
  export * from './MoneyDisplay/MoneyDisplay';
47
51
  export * from './MoneyInput/MoneyInput';
48
52
  export * from './OperationOutcomeAlert/OperationOutcomeAlert';
@@ -82,9 +86,8 @@ export * from './ServiceRequestTimeline/ServiceRequestTimeline';
82
86
  export * from './StatusBadge/StatusBadge';
83
87
  export * from './Timeline/Timeline';
84
88
  export * from './TimingInput/TimingInput';
85
- export * from './auth/RegisterForm';
86
- export * from './auth/SignInForm';
87
89
  export * from './useResource/useResource';
90
+ export * from './useSearch/useSearch';
88
91
  export * from './utils/date';
89
92
  export * from './utils/outcomes';
90
93
  export * from './utils/questionnaire';
@@ -0,0 +1,32 @@
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];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@medplum/react",
3
- "version": "2.1.5",
3
+ "version": "2.1.7",
4
4
  "description": "Medplum React Component Library",
5
5
  "author": "Medplum <hello@medplum.com>",
6
6
  "license": "Apache-2.0",
@@ -22,34 +22,34 @@
22
22
  },
23
23
  "devDependencies": {
24
24
  "@emotion/react": "11.11.1",
25
- "@mantine/core": "6.0.20",
26
- "@mantine/hooks": "6.0.20",
27
- "@mantine/notifications": "6.0.20",
25
+ "@mantine/core": "6.0.21",
26
+ "@mantine/hooks": "6.0.21",
27
+ "@mantine/notifications": "6.0.21",
28
28
  "@medplum/core": "*",
29
29
  "@medplum/definitions": "*",
30
30
  "@medplum/fhirtypes": "*",
31
31
  "@medplum/mock": "*",
32
- "@storybook/addon-actions": "7.4.2",
33
- "@storybook/addon-essentials": "7.4.2",
34
- "@storybook/addon-links": "7.4.2",
35
- "@storybook/addon-storysource": "7.4.2",
36
- "@storybook/builder-vite": "7.4.2",
37
- "@storybook/react": "7.4.2",
38
- "@storybook/react-vite": "7.4.2",
39
- "@tabler/icons-react": "2.34.0",
40
- "@testing-library/dom": "9.3.1",
41
- "@testing-library/jest-dom": "6.1.3",
32
+ "@storybook/addon-actions": "7.4.6",
33
+ "@storybook/addon-essentials": "7.4.6",
34
+ "@storybook/addon-links": "7.4.6",
35
+ "@storybook/addon-storysource": "7.4.6",
36
+ "@storybook/builder-vite": "7.4.6",
37
+ "@storybook/react": "7.4.6",
38
+ "@storybook/react-vite": "7.4.6",
39
+ "@tabler/icons-react": "2.39.0",
40
+ "@testing-library/dom": "9.3.3",
41
+ "@testing-library/jest-dom": "6.1.4",
42
42
  "@testing-library/react": "14.0.0",
43
43
  "@types/jest": "29.5.5",
44
- "@types/node": "20.6.2",
45
- "@types/react": "18.2.21",
46
- "@types/react-dom": "18.2.7",
44
+ "@types/node": "20.8.6",
45
+ "@types/react": "18.2.28",
46
+ "@types/react-dom": "18.2.13",
47
47
  "jest": "29.7.0",
48
48
  "jest-each": "29.7.0",
49
49
  "react": "18.2.0",
50
50
  "react-dom": "18.2.0",
51
- "rimraf": "5.0.1",
52
- "storybook": "7.4.2",
51
+ "rimraf": "5.0.5",
52
+ "storybook": "7.4.6",
53
53
  "typescript": "5.2.2"
54
54
  },
55
55
  "peerDependencies": {