@availity/mui-autocomplete 2.2.6 → 3.0.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@availity/mui-autocomplete",
3
- "version": "2.2.6",
3
+ "version": "3.0.0",
4
4
  "description": "Availity MUI Autocomplete Component - part of the @availity/element design system",
5
5
  "keywords": [
6
6
  "react",
@@ -8,7 +8,7 @@
8
8
  "availity",
9
9
  "mui"
10
10
  ],
11
- "homepage": "https://availity.github.io/element/?path=/docs/form-components-autocomplete-introduction--docs",
11
+ "homepage": "https://availity.github.io/element/?path=/docs/form-components-uncontrolled-fields-autocomplete-readme--docs",
12
12
  "bugs": {
13
13
  "url": "https://github.com/Availity/element/issues"
14
14
  },
@@ -21,19 +21,17 @@
21
21
  "author": "Availity Developers <AVOSS@availity.com>",
22
22
  "browser": "./dist/index.js",
23
23
  "main": "./dist/index.js",
24
- "module": "./dist/index.mjs",
25
24
  "types": "./dist/index.d.ts",
26
25
  "exports": {
27
- "./package.json": "./package.json",
28
26
  ".": {
29
27
  "types": "./dist/index.d.ts",
30
- "import": "./dist/index.mjs",
31
- "require": "./dist/index.js"
32
- }
28
+ "import": "./dist/index.js"
29
+ },
30
+ "./package.json": "./package.json"
33
31
  },
34
32
  "scripts": {
35
- "build": "tsup src/index.ts --format esm,cjs --dts",
36
- "dev": "tsup src/index.ts --format esm,cjs --watch --dts",
33
+ "build": "tsup src/index.ts --format esm --dts",
34
+ "dev": "tsup src/index.ts --format esm --watch --dts",
37
35
  "clean": "rm -rf dist",
38
36
  "clean:nm": "rm -rf node_modules",
39
37
  "bundlesize": "bundlesize",
@@ -41,31 +39,32 @@
41
39
  "publish:canary": "yarn npm publish --access public --tag canary"
42
40
  },
43
41
  "dependencies": {
44
- "@mui/types": "^7.4.7",
45
- "qs": "^6.15.0"
42
+ "@mui/types": "^7.4.12",
43
+ "qs": "^6.15.2"
46
44
  },
47
45
  "devDependencies": {
48
- "@availity/api-axios": "^12.0.4",
49
- "@availity/mui-form-utils": "^2.0.5",
50
- "@availity/mui-icon": "^2.1.0",
51
- "@availity/mui-textfield": "^2.0.5",
52
- "@mui/material": "^7.3.4",
53
- "@tanstack/react-query": "^4.36.1",
54
- "react": "19.2.0",
55
- "react-dom": "19.2.0",
56
- "tsup": "^8.4.0",
57
- "typescript": "^5.4.5"
46
+ "@availity/api-axios": "^13.2.0",
47
+ "@availity/mui-form-utils": "^3.0.0",
48
+ "@availity/mui-icon": "^3.0.0",
49
+ "@availity/mui-textfield": "^3.0.0",
50
+ "@mui/material": "^7.3.11",
51
+ "@tanstack/react-query": "^5.101.0",
52
+ "react": "19.2.7",
53
+ "react-dom": "19.2.7",
54
+ "tsup": "^8.5.1",
55
+ "typescript": "^5.9.3"
58
56
  },
59
57
  "peerDependencies": {
60
58
  "@availity/api-axios": "^12.0.0",
61
- "@availity/mui-form-utils": "^2.0.5",
62
- "@availity/mui-textfield": "^2.0.5",
59
+ "@availity/mui-form-utils": "^3.0.0",
60
+ "@availity/mui-textfield": "^3.0.0",
63
61
  "@mui/material": "^7.0.0",
64
- "@tanstack/react-query": "^4.36.1",
62
+ "@tanstack/react-query": "^5.101.0",
65
63
  "react": ">=17.0.0"
66
64
  },
67
65
  "publishConfig": {
68
66
  "access": "public"
69
67
  },
70
- "sideEffects": false
68
+ "sideEffects": false,
69
+ "type": "module"
71
70
  }
package/project.json CHANGED
@@ -8,23 +8,20 @@
8
8
  "lint": {
9
9
  "executor": "@nx/eslint:lint",
10
10
  "options": {
11
- "eslintConfig": ".eslintrc.json",
12
11
  "silent": false,
13
12
  "fix": false,
14
13
  "cache": true,
15
14
  "cacheLocation": "./node_modules/.cache/autocomplete/.eslintcache",
16
15
  "maxWarnings": -1,
17
16
  "quiet": false,
18
- "noEslintrc": false,
19
17
  "hasTypeAwareRules": true,
20
18
  "cacheStrategy": "metadata"
21
19
  }
22
20
  },
23
21
  "test": {
24
- "executor": "@nx/jest:jest",
25
- "outputs": ["{workspaceRoot}/coverage/autocomplete"],
22
+ "executor": "nx:run-commands",
26
23
  "options": {
27
- "jestConfig": "packages/autocomplete/jest.config.js"
24
+ "command": "vitest run packages/autocomplete"
28
25
  }
29
26
  },
30
27
  "version": {
@@ -34,7 +31,9 @@
34
31
  "commitMessageFormat": "chore({projectName}): release version ${version} [skip ci]",
35
32
  "tagPrefix": "@availity/{projectName}@",
36
33
  "trackDeps": true,
37
- "skipCommitTypes": ["docs"]
34
+ "skipCommitTypes": [
35
+ "docs"
36
+ ]
38
37
  }
39
38
  }
40
39
  }
@@ -6,7 +6,7 @@ import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
6
6
  import { AsyncAutocomplete } from './AsyncAutocomplete';
7
7
 
8
8
  const meta: Meta<typeof AsyncAutocomplete> = {
9
- title: 'Form Components/Autocomplete/AsyncAutocomplete',
9
+ title: 'Form Components/Uncontrolled Fields/AsyncAutocomplete',
10
10
  component: AsyncAutocomplete,
11
11
  tags: ['autodocs'],
12
12
  args: {
@@ -1,11 +1,9 @@
1
- import { act, fireEvent, render, screen, waitFor } from '@testing-library/react';
1
+ import { fireEvent, render, screen, waitFor } from '@testing-library/react';
2
2
  import AvApi, { ApiConfig } from '@availity/api-axios';
3
- /* eslint-disable @nx/enforce-module-boundaries */
4
3
  import { server } from '@availity/mock/src/lib/server';
5
4
  import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
6
5
 
7
6
  import { AsyncAutocomplete } from './AsyncAutocomplete';
8
- import { mock } from 'node:test';
9
7
 
10
8
  const api = new AvApi({ name: 'example' } as ApiConfig);
11
9
 
@@ -62,7 +60,7 @@ describe('AsyncAutocomplete', () => {
62
60
  // Remove any handlers you may have added
63
61
  // in individual tests (runtime handlers).
64
62
  server.resetHandlers();
65
- jest.restoreAllMocks();
63
+ vi.restoreAllMocks();
66
64
  });
67
65
 
68
66
  // terminate the server
@@ -184,7 +182,7 @@ describe('AsyncAutocomplete', () => {
184
182
  });
185
183
 
186
184
  test('should call loadOptions when scroll to the bottom', async () => {
187
- const mockLoadOptions = jest.fn(loadOptions);
185
+ const mockLoadOptions = vi.fn(loadOptions);
188
186
  const client = new QueryClient();
189
187
 
190
188
  render(
@@ -221,7 +219,7 @@ describe('AsyncAutocomplete', () => {
221
219
  });
222
220
 
223
221
  test('should call loadOptions if more options available and not enough options for scroll', async () => {
224
- const mockLoadOptions = jest.fn(loadOptions);
222
+ const mockLoadOptions = vi.fn(loadOptions);
225
223
  const client = new QueryClient();
226
224
 
227
225
  render(
@@ -264,7 +262,7 @@ describe('AsyncAutocomplete', () => {
264
262
 
265
263
 
266
264
  test('should search with input value', async () => {
267
- const mockLoadOptions = jest.fn(async () => ({ options: [{ label: 'Option 1' }], hasMore: false, offset: 50 }));
265
+ const mockLoadOptions = vi.fn(async () => ({ options: [{ label: 'Option 1' }], hasMore: false, offset: 50 }));
268
266
  const client = new QueryClient();
269
267
 
270
268
  render(
@@ -288,7 +286,7 @@ describe('AsyncAutocomplete', () => {
288
286
  });
289
287
 
290
288
  test('should make call when watchParams changes', async () => {
291
- const mockLoadOptions = jest.fn(async () => ({ options: [{ label: 'Option 1' }], hasMore: false, offset: 50 }));
289
+ const mockLoadOptions = vi.fn(async () => ({ options: [{ label: 'Option 1' }], hasMore: false, offset: 50 }));
292
290
  const client = new QueryClient();
293
291
 
294
292
  const watchParams = { foo: 'bar' };
@@ -1,6 +1,6 @@
1
1
  import { useState, useRef, useEffect, useCallback } from 'react';
2
2
  import type { ChipTypeMap } from '@mui/material/Chip';
3
- import { useInfiniteQuery, UseInfiniteQueryOptions } from '@tanstack/react-query';
3
+ import { useInfiniteQuery, type InfiniteData, type UseInfiniteQueryOptions } from '@tanstack/react-query';
4
4
  import { AutocompleteInputChangeReason } from '@mui/material/Autocomplete';
5
5
 
6
6
  import { Autocomplete, AutocompleteProps } from './Autocomplete';
@@ -28,7 +28,12 @@ export interface AsyncAutocompleteProps<
28
28
  * @default 50 */
29
29
  limit?: number;
30
30
  /** Config options for the useInfiniteQuery hook */
31
- queryOptions?: UseInfiniteQueryOptions<{ options: Option[]; hasMore: boolean; offset: number }>;
31
+ queryOptions?: Partial<
32
+ Omit<
33
+ UseInfiniteQueryOptions<{ options: Option[]; hasMore: boolean; offset: number }, Error, InfiniteData<{ options: Option[]; hasMore: boolean; offset: number }>, readonly unknown[], number>,
34
+ 'queryKey' | 'queryFn' | 'initialPageParam' | 'getNextPageParam'
35
+ >
36
+ >;
32
37
  /** Object of parameters used for the cacheKey. Options are re-refetched when a value in the object changes */
33
38
  watchParams?: Record<string, unknown>;
34
39
  /** Time to wait before searching with the input value typed into the component */
@@ -72,13 +77,14 @@ export const AsyncAutocomplete = <
72
77
 
73
78
  const { isLoading, isFetching, data, hasNextPage, fetchNextPage } = useInfiniteQuery({
74
79
  queryKey: [queryKey, limit, debouncedInput, watchParams],
75
- queryFn: async ({ pageParam = 0 }) => loadOptions(pageParam, limit, debouncedInput),
80
+ queryFn: ({ pageParam }) => loadOptions(pageParam, limit, debouncedInput),
81
+ initialPageParam: 0,
76
82
  staleTime: 10000,
77
83
  getNextPageParam: (lastPage) => (lastPage.hasMore ? lastPage.offset + limit : undefined),
78
84
  ...queryOptions,
79
85
  });
80
86
 
81
- const options = data?.pages ? data.pages.map((page) => page.options).flat() : [];
87
+ const options = data?.pages ? data.pages.flatMap((page) => page.options) : [];
82
88
 
83
89
  const finalOptions =
84
90
  prependOptions.length > 0
@@ -99,7 +105,7 @@ export const AsyncAutocomplete = <
99
105
  reason: AutocompleteInputChangeReason
100
106
  ) => {
101
107
  if (reason === 'clear') {
102
- setInputValue(event.target.value);
108
+ setInputValue(value);
103
109
  } else if (reason === 'blur') {
104
110
  setInputValue(value);
105
111
  }
@@ -31,7 +31,7 @@ const languages = [
31
31
  ];
32
32
 
33
33
  const meta: Meta<typeof Autocomplete> = {
34
- title: 'Form Components/Autocomplete/Autocomplete',
34
+ title: 'Form Components/Uncontrolled Fields/Autocomplete',
35
35
  component: Autocomplete,
36
36
  tags: ['autodocs'],
37
37
  args: {
@@ -72,7 +72,7 @@ export const _Multi: StoryObj<typeof Autocomplete> = {
72
72
  };
73
73
 
74
74
  /** Notice the new `read-only` styling. We're moving away from `disabled` in favor of `read-only`.
75
- * _See the [Disabled Fields Explainer](./?path=/docs/bs4-migration-form-migration--disabled-fields) for more information on when to use each._
75
+ * _See the [Disabled Fields Explainer](./?path=/docs/upgrading/bs4-migration-form-migration--disabled-fields) for more information on when to use each._
76
76
  */
77
77
  export const _States: StoryObj<typeof Autocomplete> = {
78
78
  render: (args) => (
@@ -151,7 +151,7 @@ export const _FreeSolo: StoryObj<typeof Autocomplete> = {
151
151
  return filtered;
152
152
  };
153
153
 
154
- const renderOption = (props: React.HTMLAttributes<HTMLLIElement>, option: Option) => {
154
+ const renderOption = (props: React.HTMLAttributes<HTMLLIElement> & { key?: string }, option: Option) => {
155
155
  const { key, ...optionProps } = props;
156
156
  return (
157
157
  <li key={key} {...optionProps}>
@@ -196,7 +196,7 @@ export const _Grouped: StoryObj<typeof Autocomplete> = {
196
196
  },
197
197
  };
198
198
 
199
- /** Wrap the fields in a `SearchByFormGroup` from the [@availity/mui-form-utils](./?path=/docs/form-components-formutils-introduction--docs) package for our combined search by styles.
199
+ /** Wrap the fields in a `SearchByFormGroup` from the [@availity/mui-form-utils](./?path=/docs/form-components-uncontrolled-formutils-readme--docs) package for our combined search by styles.
200
200
  *
201
201
  * The "Search By" field id must be passed as the FormGroup supplies the label.
202
202
  */
@@ -96,9 +96,7 @@ export const Autocomplete = <
96
96
 
97
97
  return (
98
98
  <MuiAutocomplete
99
- renderInput={(params: AutocompleteRenderInputParams) => {
100
- return <TextField {...params} {...FieldProps} {...resolvedProps(params)} />;
101
- }}
99
+ renderInput={(params: AutocompleteRenderInputParams) => <TextField {...params} {...FieldProps} {...resolvedProps(params)} />}
102
100
  popupIcon={<SelectExpandIcon className="MuiSelect-avExpandIcon" />}
103
101
  slotProps={{ popupIndicator: { component: PopupIndicatorWrapper } }}
104
102
  {...props}
@@ -5,7 +5,7 @@ import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
5
5
  import { CodesAutocomplete } from './CodesAutocomplete';
6
6
 
7
7
  const meta: Meta<typeof CodesAutocomplete> = {
8
- title: 'Form Components/Autocomplete/CodesAutocomplete',
8
+ title: 'Form Components/Uncontrolled Fields/CodesAutocomplete',
9
9
  component: CodesAutocomplete,
10
10
  tags: ['autodocs'],
11
11
  args: {
@@ -1,5 +1,4 @@
1
1
  import { render, screen, fireEvent, waitFor } from '@testing-library/react';
2
- /* eslint-disable @nx/enforce-module-boundaries */
3
2
  import { server } from '@availity/mock/src/lib/server';
4
3
  import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
5
4
 
@@ -17,7 +16,7 @@ describe('CodesAutocomplete', () => {
17
16
  // Remove any handlers you may have added
18
17
  // in individual tests (runtime handlers).
19
18
  server.resetHandlers();
20
- jest.restoreAllMocks();
19
+ vi.restoreAllMocks();
21
20
  client.clear();
22
21
  });
23
22
 
@@ -1,4 +1,4 @@
1
- import { avCodesApi, ApiConfig } from '@availity/api-axios';
1
+ import { avCodesApi, ApiConfig, type CodesResponse } from '@availity/api-axios';
2
2
  import type { ChipTypeMap } from '@mui/material/Chip';
3
3
 
4
4
  import { AsyncAutocomplete, AsyncAutocompleteProps } from './AsyncAutocomplete';
@@ -10,12 +10,12 @@ export type Code = {
10
10
  };
11
11
 
12
12
  export const fetchCodes = async (config: ApiConfig) => {
13
- const resp = await avCodesApi.query(config);
13
+ const resp = await avCodesApi.query<CodesResponse>(config);
14
14
 
15
15
  return {
16
- options: resp.data.codes as Code[],
17
- hasMore: config.params.offset + config.params.limit < resp.data.totalCount,
18
- offset: config.params.offset,
16
+ options: resp.data.codes as unknown as Code[],
17
+ hasMore: (config.params!.offset as number) + (config.params!.limit as number) < resp.data.totalCount,
18
+ offset: config.params!.offset as number,
19
19
  };
20
20
  };
21
21
 
@@ -5,7 +5,7 @@ import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
5
5
  import { OrganizationAutocomplete } from './OrganizationAutocomplete';
6
6
 
7
7
  const meta: Meta<typeof OrganizationAutocomplete> = {
8
- title: 'Form Components/Autocomplete/OrganizationAutocomplete',
8
+ title: 'Form Components/Uncontrolled Fields/OrganizationAutocomplete',
9
9
  component: OrganizationAutocomplete,
10
10
  tags: ['autodocs'],
11
11
  args: {
@@ -1,5 +1,4 @@
1
1
  import { render, screen, fireEvent, waitFor } from '@testing-library/react';
2
- /* eslint-disable @nx/enforce-module-boundaries */
3
2
  import { server } from '@availity/mock/src/lib/server';
4
3
  import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
5
4
 
@@ -17,7 +16,7 @@ describe('OrganizationAutocomplete', () => {
17
16
  // Remove any handlers you may have added
18
17
  // in individual tests (runtime handlers).
19
18
  server.resetHandlers();
20
- jest.restoreAllMocks();
19
+ vi.restoreAllMocks();
21
20
  client.clear();
22
21
  });
23
22
 
@@ -1,17 +1,11 @@
1
- import { avOrganizationsApi, ApiConfig } from '@availity/api-axios';
1
+ import { avOrganizationsApi, ApiConfig, type OrganizationsResponse, type Organization } from '@availity/api-axios';
2
2
  import type { ChipTypeMap } from '@mui/material/Chip';
3
3
  import qs from 'qs';
4
4
 
5
5
  import { AsyncAutocomplete, AsyncAutocompleteProps } from './AsyncAutocomplete';
6
6
  import type { Optional } from './util';
7
7
 
8
- export type Organization = {
9
- customerId: string;
10
- name: string;
11
- id: string;
12
- createDate: string;
13
- links: Record<string, Record<string, string>>;
14
- };
8
+ export type { Organization } from '@availity/api-axios';
15
9
 
16
10
  export const fetchOrgs = async (
17
11
  config: ApiConfig
@@ -24,12 +18,12 @@ export const fetchOrgs = async (
24
18
  },
25
19
  };
26
20
 
27
- const resp = await avOrganizationsApi.getOrganizations(configWithParamsSerializer);
21
+ const resp = await avOrganizationsApi.getOrganizations<OrganizationsResponse>(configWithParamsSerializer);
28
22
 
29
23
  return {
30
- options: resp.data.organizations as Organization[],
31
- hasMore: config.params.offset + config.params.limit < resp.data.totalCount,
32
- offset: config.params.offset,
24
+ options: resp.data.organizations,
25
+ hasMore: (config.params!.offset as number) + (config.params!.limit as number) < resp.data.totalCount,
26
+ offset: config.params!.offset as number,
33
27
  };
34
28
  };
35
29
 
@@ -5,7 +5,7 @@ import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
5
5
  import { ProviderAutocomplete } from './ProviderAutocomplete';
6
6
 
7
7
  const meta: Meta<typeof ProviderAutocomplete> = {
8
- title: 'Form Components/Autocomplete/ProviderAutocomplete',
8
+ title: 'Form Components/Uncontrolled Fields/ProviderAutocomplete',
9
9
  component: ProviderAutocomplete,
10
10
  tags: ['autodocs'],
11
11
  args: {
@@ -1,5 +1,4 @@
1
1
  import { render, screen, fireEvent, waitFor } from '@testing-library/react';
2
- /* eslint-disable @nx/enforce-module-boundaries */
3
2
  import { server } from '@availity/mock/src/lib/server';
4
3
  import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
5
4
 
@@ -17,7 +16,7 @@ describe('ProviderAutocomplete', () => {
17
16
  // Remove any handlers you may have added
18
17
  // in individual tests (runtime handlers).
19
18
  server.resetHandlers();
20
- jest.restoreAllMocks();
19
+ vi.restoreAllMocks();
21
20
  client.clear();
22
21
  });
23
22
 
@@ -89,5 +88,5 @@ describe('ProviderAutocomplete', () => {
89
88
  await waitFor(() => {
90
89
  expect(screen.getByText('Provider 0')).toBeDefined();
91
90
  });
92
- }, 10000000000);
91
+ }, 10000);
93
92
  });
@@ -1,15 +1,12 @@
1
- import { avProvidersApi, ApiConfig } from '@availity/api-axios';
1
+ import { avProvidersApi, ApiConfig, type ProvidersResponse, type Provider as BaseProvider } from '@availity/api-axios';
2
2
  import type { ChipTypeMap } from '@mui/material/Chip';
3
3
 
4
4
  import { AsyncAutocomplete, AsyncAutocompleteProps } from './AsyncAutocomplete';
5
5
  import type { Optional } from './util';
6
6
 
7
- export type Provider = {
8
- id: string;
7
+ export interface Provider extends BaseProvider {
9
8
  businessName: string;
10
9
  uiDisplayName: string;
11
- lastName?: string;
12
- firstName?: string;
13
10
  payerAssignedIdentifiers?: { payerId: string; identifier: string }[];
14
11
  atypical: boolean;
15
12
  npi: string;
@@ -31,18 +28,18 @@ export type Provider = {
31
28
  code: string;
32
29
  value: string;
33
30
  };
34
- };
31
+ }
35
32
 
36
33
  export const fetchProviders = async (
37
34
  customerId: string,
38
35
  config: ApiConfig
39
36
  ): Promise<{ options: Provider[]; hasMore: boolean; offset: number }> => {
40
- const resp = await avProvidersApi.getProviders(customerId, config);
37
+ const resp = await avProvidersApi.getProviders<ProvidersResponse>(customerId, config);
41
38
 
42
39
  return {
43
40
  options: resp.data.providers as Provider[],
44
- hasMore: config.params.offset + config.params.limit < resp.data.totalCount,
45
- offset: config.params.offset,
41
+ hasMore: (config.params!.offset as number) + (config.params!.limit as number) < resp.data.totalCount,
42
+ offset: config.params!.offset as number,
46
43
  };
47
44
  };
48
45
 
package/dist/index.d.mts DELETED
@@ -1,141 +0,0 @@
1
- import { AutocompleteProps as AutocompleteProps$1 } from '@mui/material/Autocomplete';
2
- export { createFilterOptions } from '@mui/material/Autocomplete';
3
- import { ChipTypeMap } from '@mui/material/Chip';
4
- import { TextFieldProps } from '@availity/mui-textfield';
5
- import * as react_jsx_runtime from 'react/jsx-runtime';
6
- import { UseInfiniteQueryOptions } from '@tanstack/react-query';
7
- import { ApiConfig } from '@availity/api-axios';
8
-
9
- interface AutocompleteProps<T, Multiple extends boolean | undefined, DisableClearable extends boolean | undefined, FreeSolo extends boolean | undefined, ChipComponent extends React.ElementType = ChipTypeMap['defaultComponent']> extends Omit<AutocompleteProps$1<T, Multiple, DisableClearable, FreeSolo, ChipComponent>, 'clearIcon' | 'clearText' | 'closeText' | 'componentsProps' | 'disabledItemsFocusable' | 'forcePopupIcon' | 'fullWidth' | 'handleHomeEndKeys' | 'includeInputInList' | 'openOnFocus' | 'openText' | 'PaperComponent' | 'PopperComponent' | 'popupIcon' | 'selectOnFocus' | 'size' | 'renderInput' | 'slotProps'> {
10
- /** Props applied to the `TextField` component */
11
- FieldProps?: TextFieldProps;
12
- name?: string;
13
- }
14
- declare const Autocomplete: <T, Multiple extends boolean | undefined = false, DisableClearable extends boolean | undefined = false, FreeSolo extends boolean | undefined = false, ChipComponent extends React.ElementType = ChipTypeMap["defaultComponent"]>({ FieldProps, ...props }: AutocompleteProps<T, Multiple, DisableClearable, FreeSolo, ChipComponent>) => React.JSX.Element;
15
-
16
- interface AsyncAutocompleteProps<Option, Multiple extends boolean | undefined, DisableClearable extends boolean | undefined, FreeSolo extends boolean | undefined, ChipComponent extends React.ElementType = ChipTypeMap['defaultComponent']> extends Omit<AutocompleteProps<Option, Multiple, DisableClearable, FreeSolo, ChipComponent>, 'options' | 'disableListWrap' | 'loading'> {
17
- /** Function that is called to fetch the options for the list. Returns a promise with options, hasMore, and offset */
18
- loadOptions: (offset: number, limit: number, inputValue?: string) => Promise<{
19
- options: Option[];
20
- hasMore: boolean;
21
- offset: number;
22
- }>;
23
- /** The key used by @tanstack/react-query to cache the response */
24
- queryKey: string;
25
- /** The number of options to request from the api
26
- * @default 50 */
27
- limit?: number;
28
- /** Config options for the useInfiniteQuery hook */
29
- queryOptions?: UseInfiniteQueryOptions<{
30
- options: Option[];
31
- hasMore: boolean;
32
- offset: number;
33
- }>;
34
- /** Object of parameters used for the cacheKey. Options are re-refetched when a value in the object changes */
35
- watchParams?: Record<string, unknown>;
36
- /** Time to wait before searching with the input value typed into the component */
37
- debounceTimeout?: number;
38
- /** Options to prepend to the list (e.g., frequently used items). These will be filtered from loadOptions results to avoid duplicates. */
39
- prependOptions?: Option[];
40
- }
41
- declare const AsyncAutocomplete: <Option, Multiple extends boolean | undefined = false, DisableClearable extends boolean | undefined = false, FreeSolo extends boolean | undefined = false, ChipComponent extends React.ElementType = ChipTypeMap["defaultComponent"]>({ loadOptions, limit, queryKey, ListboxProps, queryOptions, watchParams, debounceTimeout, FieldProps, onInputChange, prependOptions, ...rest }: AsyncAutocompleteProps<Option, Multiple, DisableClearable, FreeSolo, ChipComponent>) => react_jsx_runtime.JSX.Element;
42
-
43
- type Optional<T, K extends keyof T> = Pick<Partial<T>, K> & Omit<T, K>;
44
-
45
- type Code = {
46
- code: string;
47
- value: string;
48
- };
49
- declare const fetchCodes: (config: ApiConfig) => Promise<{
50
- options: Code[];
51
- hasMore: boolean;
52
- offset: any;
53
- }>;
54
- interface CodesAutocompleteProps<Option = Code, Multiple extends boolean | undefined = false, DisableClearable extends boolean | undefined = false, FreeSolo extends boolean | undefined = false, ChipComponent extends React.ElementType = ChipTypeMap['defaultComponent']> extends Omit<Optional<AsyncAutocompleteProps<Option, Multiple, DisableClearable, FreeSolo, ChipComponent>, 'queryKey'>, 'loadOptions'> {
55
- /** The code list id. */
56
- list: string;
57
- /** Config passed to the AvCodesApi.query function */
58
- apiConfig?: ApiConfig;
59
- }
60
- declare const handleGetCodesOptionLabel: (option: Code) => string;
61
- declare const CodesAutocomplete: <Option = Code, Multiple extends boolean | undefined = false, DisableClearable extends boolean | undefined = false, FreeSolo extends boolean | undefined = false, ChipComponent extends React.ElementType = ChipTypeMap["defaultComponent"]>({ apiConfig, queryOptions, queryKey, list, watchParams, ...rest }: CodesAutocompleteProps<Option, Multiple, DisableClearable, FreeSolo, ChipComponent>) => react_jsx_runtime.JSX.Element;
62
-
63
- type Organization = {
64
- customerId: string;
65
- name: string;
66
- id: string;
67
- createDate: string;
68
- links: Record<string, Record<string, string>>;
69
- };
70
- declare const fetchOrgs: (config: ApiConfig) => Promise<{
71
- options: Organization[];
72
- hasMore: boolean;
73
- offset: number;
74
- }>;
75
- interface OrgAutocompleteProps<Option = Organization, Multiple extends boolean | undefined = false, DisableClearable extends boolean | undefined = false, FreeSolo extends boolean | undefined = false, ChipComponent extends React.ElementType = ChipTypeMap['defaultComponent']> extends Omit<Optional<AsyncAutocompleteProps<Option, Multiple, DisableClearable, FreeSolo, ChipComponent>, 'queryKey'>, 'loadOptions'> {
76
- /** Axios ApiConfig */
77
- apiConfig?: ApiConfig;
78
- }
79
- declare const handleGetOrgOptionLabel: (org: Organization) => string;
80
- declare const OrganizationAutocomplete: <Option = Organization, Multiple extends boolean | undefined = false, DisableClearable extends boolean | undefined = false, FreeSolo extends boolean | undefined = false, ChipComponent extends React.ElementType = ChipTypeMap["defaultComponent"]>({ apiConfig, queryKey, ...rest }: OrgAutocompleteProps<Option, Multiple, DisableClearable, FreeSolo, ChipComponent>) => react_jsx_runtime.JSX.Element;
81
-
82
- type Provider = {
83
- id: string;
84
- businessName: string;
85
- uiDisplayName: string;
86
- lastName?: string;
87
- firstName?: string;
88
- payerAssignedIdentifiers?: {
89
- payerId: string;
90
- identifier: string;
91
- }[];
92
- atypical: boolean;
93
- npi: string;
94
- customerIds: string[];
95
- roles: {
96
- code: string;
97
- value: string;
98
- }[];
99
- primaryPhone: {
100
- internationalCellularCode: string;
101
- areaCode: string;
102
- phoneNumber: string;
103
- };
104
- primaryFax: {
105
- internationalCellularCode: string;
106
- areaCode: string;
107
- phoneNumber: string;
108
- };
109
- taxId?: string;
110
- ssn?: string;
111
- primaryAddress: {
112
- line1: string;
113
- line2: string;
114
- city: string;
115
- state: string;
116
- stateCode: string;
117
- zip: {
118
- code: string;
119
- addon: string;
120
- };
121
- };
122
- primarySpecialty?: {
123
- code: string;
124
- value: string;
125
- };
126
- };
127
- declare const fetchProviders: (customerId: string, config: ApiConfig) => Promise<{
128
- options: Provider[];
129
- hasMore: boolean;
130
- offset: number;
131
- }>;
132
- interface ProviderAutocompleteProps<Option = Provider, Multiple extends boolean | undefined = false, DisableClearable extends boolean | undefined = false, FreeSolo extends boolean | undefined = false, ChipComponent extends React.ElementType = ChipTypeMap['defaultComponent']> extends Omit<Optional<AsyncAutocompleteProps<Option, Multiple, DisableClearable, FreeSolo, ChipComponent>, 'queryKey'>, 'loadOptions'> {
133
- /** Customer ID of the Organization you are requesting the providers for */
134
- customerId: string;
135
- /** Config passed to the AvProvidersApi.getProviders function */
136
- apiConfig?: ApiConfig;
137
- }
138
- declare const handleGetProviderOptionLabel: (option: Provider) => string;
139
- declare const ProviderAutocomplete: <Option = Provider, Multiple extends boolean | undefined = false, DisableClearable extends boolean | undefined = false, FreeSolo extends boolean | undefined = false, ChipComponent extends React.ElementType = ChipTypeMap["defaultComponent"]>({ apiConfig, customerId, queryKey, ...rest }: ProviderAutocompleteProps<Option, Multiple, DisableClearable, FreeSolo, ChipComponent>) => react_jsx_runtime.JSX.Element;
140
-
141
- export { AsyncAutocomplete, type AsyncAutocompleteProps, Autocomplete, type AutocompleteProps, type Code, CodesAutocomplete, type CodesAutocompleteProps, type OrgAutocompleteProps, type Organization, OrganizationAutocomplete, type Provider, ProviderAutocomplete, type ProviderAutocompleteProps, fetchCodes, fetchOrgs, fetchProviders, handleGetCodesOptionLabel, handleGetOrgOptionLabel, handleGetProviderOptionLabel };