@availity/mui-autocomplete 1.0.8 → 1.0.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/CHANGELOG.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
4
4
 
5
+ ## [1.0.9](https://github.com/Availity/element/compare/@availity/mui-autocomplete@1.0.8...@availity/mui-autocomplete@1.0.9) (2025-03-31)
6
+
5
7
  ## [1.0.8](https://github.com/Availity/element/compare/@availity/mui-autocomplete@1.0.7...@availity/mui-autocomplete@1.0.8) (2025-03-27)
6
8
 
7
9
  ### Dependency Updates
package/dist/index.d.mts CHANGED
@@ -44,12 +44,18 @@ type Code = {
44
44
  code: string;
45
45
  value: string;
46
46
  };
47
+ declare const fetchCodes: (config: ApiConfig) => Promise<{
48
+ options: Code[];
49
+ hasMore: boolean;
50
+ offset: any;
51
+ }>;
47
52
  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'> {
48
53
  /** The code list id. */
49
54
  list: string;
50
55
  /** Config passed to the AvCodesApi.query function */
51
56
  apiConfig?: ApiConfig;
52
57
  }
58
+ declare const handleGetCodesOptionLabel: (option: Code) => string;
53
59
  declare const CodesAutocomplete: ({ apiConfig, queryOptions, queryKey, list, watchParams, ...rest }: CodesAutocompleteProps) => react_jsx_runtime.JSX.Element;
54
60
 
55
61
  type Organization = {
@@ -59,10 +65,16 @@ type Organization = {
59
65
  createDate: string;
60
66
  links: Record<string, Record<string, string>>;
61
67
  };
68
+ declare const fetchOrgs: (config: ApiConfig) => Promise<{
69
+ options: Organization[];
70
+ hasMore: boolean;
71
+ offset: number;
72
+ }>;
62
73
  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'> {
63
74
  /** Axios ApiConfig */
64
75
  apiConfig?: ApiConfig;
65
76
  }
77
+ declare const handleGetOrgOptionLabel: (org: Organization) => string;
66
78
  declare const OrganizationAutocomplete: ({ apiConfig, queryKey, ...rest }: OrgAutocompleteProps) => react_jsx_runtime.JSX.Element;
67
79
 
68
80
  type Provider = {
@@ -110,12 +122,18 @@ type Provider = {
110
122
  value: string;
111
123
  };
112
124
  };
125
+ declare const fetchProviders: (customerId: string, config: ApiConfig) => Promise<{
126
+ options: Provider[];
127
+ hasMore: boolean;
128
+ offset: number;
129
+ }>;
113
130
  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'> {
114
131
  /** Customer ID of the Organization you are requesting the providers for */
115
132
  customerId: string;
116
133
  /** Config passed to the AvProvidersApi.getProviders function */
117
134
  apiConfig?: ApiConfig;
118
135
  }
136
+ declare const handleGetProviderOptionLabel: (option: Provider) => string;
119
137
  declare const ProviderAutocomplete: ({ apiConfig, customerId, queryKey, ...rest }: ProviderAutocompleteProps) => react_jsx_runtime.JSX.Element;
120
138
 
121
- export { AsyncAutocomplete, type AsyncAutocompleteProps, Autocomplete, type AutocompleteProps, CodesAutocomplete, type CodesAutocompleteProps, type OrgAutocompleteProps, type Organization, OrganizationAutocomplete, type Provider, ProviderAutocomplete, type ProviderAutocompleteProps };
139
+ 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 };
package/dist/index.d.ts CHANGED
@@ -44,12 +44,18 @@ type Code = {
44
44
  code: string;
45
45
  value: string;
46
46
  };
47
+ declare const fetchCodes: (config: ApiConfig) => Promise<{
48
+ options: Code[];
49
+ hasMore: boolean;
50
+ offset: any;
51
+ }>;
47
52
  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'> {
48
53
  /** The code list id. */
49
54
  list: string;
50
55
  /** Config passed to the AvCodesApi.query function */
51
56
  apiConfig?: ApiConfig;
52
57
  }
58
+ declare const handleGetCodesOptionLabel: (option: Code) => string;
53
59
  declare const CodesAutocomplete: ({ apiConfig, queryOptions, queryKey, list, watchParams, ...rest }: CodesAutocompleteProps) => react_jsx_runtime.JSX.Element;
54
60
 
55
61
  type Organization = {
@@ -59,10 +65,16 @@ type Organization = {
59
65
  createDate: string;
60
66
  links: Record<string, Record<string, string>>;
61
67
  };
68
+ declare const fetchOrgs: (config: ApiConfig) => Promise<{
69
+ options: Organization[];
70
+ hasMore: boolean;
71
+ offset: number;
72
+ }>;
62
73
  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'> {
63
74
  /** Axios ApiConfig */
64
75
  apiConfig?: ApiConfig;
65
76
  }
77
+ declare const handleGetOrgOptionLabel: (org: Organization) => string;
66
78
  declare const OrganizationAutocomplete: ({ apiConfig, queryKey, ...rest }: OrgAutocompleteProps) => react_jsx_runtime.JSX.Element;
67
79
 
68
80
  type Provider = {
@@ -110,12 +122,18 @@ type Provider = {
110
122
  value: string;
111
123
  };
112
124
  };
125
+ declare const fetchProviders: (customerId: string, config: ApiConfig) => Promise<{
126
+ options: Provider[];
127
+ hasMore: boolean;
128
+ offset: number;
129
+ }>;
113
130
  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'> {
114
131
  /** Customer ID of the Organization you are requesting the providers for */
115
132
  customerId: string;
116
133
  /** Config passed to the AvProvidersApi.getProviders function */
117
134
  apiConfig?: ApiConfig;
118
135
  }
136
+ declare const handleGetProviderOptionLabel: (option: Provider) => string;
119
137
  declare const ProviderAutocomplete: ({ apiConfig, customerId, queryKey, ...rest }: ProviderAutocompleteProps) => react_jsx_runtime.JSX.Element;
120
138
 
121
- export { AsyncAutocomplete, type AsyncAutocompleteProps, Autocomplete, type AutocompleteProps, CodesAutocomplete, type CodesAutocompleteProps, type OrgAutocompleteProps, type Organization, OrganizationAutocomplete, type Provider, ProviderAutocomplete, type ProviderAutocompleteProps };
139
+ 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 };
package/dist/index.js CHANGED
@@ -84,7 +84,13 @@ __export(index_exports, {
84
84
  CodesAutocomplete: () => CodesAutocomplete,
85
85
  OrganizationAutocomplete: () => OrganizationAutocomplete,
86
86
  ProviderAutocomplete: () => ProviderAutocomplete,
87
- createFilterOptions: () => import_Autocomplete2.createFilterOptions
87
+ createFilterOptions: () => import_Autocomplete2.createFilterOptions,
88
+ fetchCodes: () => fetchCodes,
89
+ fetchOrgs: () => fetchOrgs,
90
+ fetchProviders: () => fetchProviders,
91
+ handleGetCodesOptionLabel: () => handleGetCodesOptionLabel,
92
+ handleGetOrgOptionLabel: () => handleGetOrgOptionLabel,
93
+ handleGetProviderOptionLabel: () => handleGetProviderOptionLabel
88
94
  });
89
95
  module.exports = __toCommonJS(index_exports);
90
96
 
@@ -239,6 +245,7 @@ var fetchCodes = (config) => __async(void 0, null, function* () {
239
245
  offset: config.params.offset
240
246
  };
241
247
  });
248
+ var handleGetCodesOptionLabel = (option) => [option.code, option.value].filter(Boolean).join(" - ");
242
249
  var CodesAutocomplete = (_a) => {
243
250
  var _b = _a, {
244
251
  apiConfig = {},
@@ -259,11 +266,10 @@ var CodesAutocomplete = (_a) => {
259
266
  }));
260
267
  return resp;
261
268
  });
262
- const handleGetOptionLabel = (option) => [option.code, option.value].filter(Boolean).join(" - ");
263
269
  return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
264
270
  AsyncAutocomplete,
265
271
  __spreadProps(__spreadValues({
266
- getOptionLabel: handleGetOptionLabel,
272
+ getOptionLabel: handleGetCodesOptionLabel,
267
273
  queryKey,
268
274
  queryOptions: __spreadValues({ enabled: !!list }, queryOptions),
269
275
  watchParams: __spreadValues({ list }, watchParams)
@@ -284,6 +290,7 @@ var fetchOrgs = (config) => __async(void 0, null, function* () {
284
290
  offset: config.params.offset
285
291
  };
286
292
  });
293
+ var handleGetOrgOptionLabel = (org) => org.name;
287
294
  var OrganizationAutocomplete = (_a) => {
288
295
  var _b = _a, {
289
296
  apiConfig = {},
@@ -296,11 +303,10 @@ var OrganizationAutocomplete = (_a) => {
296
303
  const resp = yield fetchOrgs(__spreadProps(__spreadValues({}, apiConfig), { params: __spreadProps(__spreadValues({ dropdown: true }, apiConfig.params), { offset, limit }) }));
297
304
  return resp;
298
305
  });
299
- const handleGetOptionLabel = (org) => org.name;
300
306
  return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
301
307
  AsyncAutocomplete,
302
308
  __spreadProps(__spreadValues({
303
- getOptionLabel: handleGetOptionLabel,
309
+ getOptionLabel: handleGetOrgOptionLabel,
304
310
  queryKey
305
311
  }, rest), {
306
312
  loadOptions: handleLoadOptions
@@ -319,6 +325,7 @@ var fetchProviders = (customerId, config) => __async(void 0, null, function* ()
319
325
  offset: config.params.offset
320
326
  };
321
327
  });
328
+ var handleGetProviderOptionLabel = (option) => option.uiDisplayName;
322
329
  var ProviderAutocomplete = (_a) => {
323
330
  var _b = _a, {
324
331
  apiConfig = {},
@@ -335,11 +342,10 @@ var ProviderAutocomplete = (_a) => {
335
342
  }));
336
343
  return resp;
337
344
  });
338
- const handleGetOptionLabel = (option) => option.uiDisplayName;
339
345
  return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
340
346
  AsyncAutocomplete,
341
347
  __spreadProps(__spreadValues({
342
- getOptionLabel: handleGetOptionLabel,
348
+ getOptionLabel: handleGetProviderOptionLabel,
343
349
  queryOptions: { enabled: !!customerId },
344
350
  queryKey,
345
351
  watchParams: { customerId }
@@ -355,5 +361,11 @@ var ProviderAutocomplete = (_a) => {
355
361
  CodesAutocomplete,
356
362
  OrganizationAutocomplete,
357
363
  ProviderAutocomplete,
358
- createFilterOptions
364
+ createFilterOptions,
365
+ fetchCodes,
366
+ fetchOrgs,
367
+ fetchProviders,
368
+ handleGetCodesOptionLabel,
369
+ handleGetOrgOptionLabel,
370
+ handleGetProviderOptionLabel
359
371
  });
package/dist/index.mjs CHANGED
@@ -203,6 +203,7 @@ var fetchCodes = (config) => __async(void 0, null, function* () {
203
203
  offset: config.params.offset
204
204
  };
205
205
  });
206
+ var handleGetCodesOptionLabel = (option) => [option.code, option.value].filter(Boolean).join(" - ");
206
207
  var CodesAutocomplete = (_a) => {
207
208
  var _b = _a, {
208
209
  apiConfig = {},
@@ -223,11 +224,10 @@ var CodesAutocomplete = (_a) => {
223
224
  }));
224
225
  return resp;
225
226
  });
226
- const handleGetOptionLabel = (option) => [option.code, option.value].filter(Boolean).join(" - ");
227
227
  return /* @__PURE__ */ jsx3(
228
228
  AsyncAutocomplete,
229
229
  __spreadProps(__spreadValues({
230
- getOptionLabel: handleGetOptionLabel,
230
+ getOptionLabel: handleGetCodesOptionLabel,
231
231
  queryKey,
232
232
  queryOptions: __spreadValues({ enabled: !!list }, queryOptions),
233
233
  watchParams: __spreadValues({ list }, watchParams)
@@ -248,6 +248,7 @@ var fetchOrgs = (config) => __async(void 0, null, function* () {
248
248
  offset: config.params.offset
249
249
  };
250
250
  });
251
+ var handleGetOrgOptionLabel = (org) => org.name;
251
252
  var OrganizationAutocomplete = (_a) => {
252
253
  var _b = _a, {
253
254
  apiConfig = {},
@@ -260,11 +261,10 @@ var OrganizationAutocomplete = (_a) => {
260
261
  const resp = yield fetchOrgs(__spreadProps(__spreadValues({}, apiConfig), { params: __spreadProps(__spreadValues({ dropdown: true }, apiConfig.params), { offset, limit }) }));
261
262
  return resp;
262
263
  });
263
- const handleGetOptionLabel = (org) => org.name;
264
264
  return /* @__PURE__ */ jsx4(
265
265
  AsyncAutocomplete,
266
266
  __spreadProps(__spreadValues({
267
- getOptionLabel: handleGetOptionLabel,
267
+ getOptionLabel: handleGetOrgOptionLabel,
268
268
  queryKey
269
269
  }, rest), {
270
270
  loadOptions: handleLoadOptions
@@ -283,6 +283,7 @@ var fetchProviders = (customerId, config) => __async(void 0, null, function* ()
283
283
  offset: config.params.offset
284
284
  };
285
285
  });
286
+ var handleGetProviderOptionLabel = (option) => option.uiDisplayName;
286
287
  var ProviderAutocomplete = (_a) => {
287
288
  var _b = _a, {
288
289
  apiConfig = {},
@@ -299,11 +300,10 @@ var ProviderAutocomplete = (_a) => {
299
300
  }));
300
301
  return resp;
301
302
  });
302
- const handleGetOptionLabel = (option) => option.uiDisplayName;
303
303
  return /* @__PURE__ */ jsx5(
304
304
  AsyncAutocomplete,
305
305
  __spreadProps(__spreadValues({
306
- getOptionLabel: handleGetOptionLabel,
306
+ getOptionLabel: handleGetProviderOptionLabel,
307
307
  queryOptions: { enabled: !!customerId },
308
308
  queryKey,
309
309
  watchParams: { customerId }
@@ -318,5 +318,11 @@ export {
318
318
  CodesAutocomplete,
319
319
  OrganizationAutocomplete,
320
320
  ProviderAutocomplete,
321
- createFilterOptions
321
+ createFilterOptions,
322
+ fetchCodes,
323
+ fetchOrgs,
324
+ fetchProviders,
325
+ handleGetCodesOptionLabel,
326
+ handleGetOrgOptionLabel,
327
+ handleGetProviderOptionLabel
322
328
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@availity/mui-autocomplete",
3
- "version": "1.0.8",
3
+ "version": "1.0.9",
4
4
  "description": "Availity MUI Autocomplete Component - part of the @availity/element design system",
5
5
  "keywords": [
6
6
  "react",
@@ -4,12 +4,12 @@ import type { ChipTypeMap } from '@mui/material/Chip';
4
4
  import { AsyncAutocomplete, AsyncAutocompleteProps } from './AsyncAutocomplete';
5
5
  import type { Optional } from './util';
6
6
 
7
- type Code = {
7
+ export type Code = {
8
8
  code: string;
9
9
  value: string;
10
10
  };
11
11
 
12
- const fetchCodes = async (config: ApiConfig) => {
12
+ export const fetchCodes = async (config: ApiConfig) => {
13
13
  const resp = await avCodesApi.query(config);
14
14
 
15
15
  return {
@@ -35,6 +35,8 @@ export interface CodesAutocompleteProps<
35
35
  apiConfig?: ApiConfig;
36
36
  }
37
37
 
38
+ export const handleGetCodesOptionLabel = (option: Code) => [option.code, option.value].filter(Boolean).join(' - ');
39
+
38
40
  export const CodesAutocomplete = ({
39
41
  apiConfig = {},
40
42
  queryOptions,
@@ -52,11 +54,9 @@ export const CodesAutocomplete = ({
52
54
  return resp;
53
55
  };
54
56
 
55
- const handleGetOptionLabel = (option: Code) => [option.code, option.value].filter(Boolean).join(' - ');
56
-
57
57
  return (
58
58
  <AsyncAutocomplete
59
- getOptionLabel={handleGetOptionLabel}
59
+ getOptionLabel={handleGetCodesOptionLabel}
60
60
  queryKey={queryKey}
61
61
  queryOptions={{ enabled: !!list, ...queryOptions }}
62
62
  watchParams={{ list, ...watchParams }}
@@ -12,7 +12,9 @@ export type Organization = {
12
12
  links: Record<string, Record<string, string>>;
13
13
  };
14
14
 
15
- const fetchOrgs = async (config: ApiConfig): Promise<{ options: Organization[]; hasMore: boolean; offset: number }> => {
15
+ export const fetchOrgs = async (
16
+ config: ApiConfig
17
+ ): Promise<{ options: Organization[]; hasMore: boolean; offset: number }> => {
16
18
  const resp = await avOrganizationsApi.getOrganizations(config);
17
19
 
18
20
  return {
@@ -36,6 +38,8 @@ export interface OrgAutocompleteProps<
36
38
  apiConfig?: ApiConfig;
37
39
  }
38
40
 
41
+ export const handleGetOrgOptionLabel = (org: Organization) => org.name;
42
+
39
43
  export const OrganizationAutocomplete = ({
40
44
  apiConfig = {},
41
45
  queryKey = 'org-autocomplete',
@@ -47,11 +51,9 @@ export const OrganizationAutocomplete = ({
47
51
  return resp;
48
52
  };
49
53
 
50
- const handleGetOptionLabel = (org: Organization) => org.name;
51
-
52
54
  return (
53
55
  <AsyncAutocomplete
54
- getOptionLabel={handleGetOptionLabel}
56
+ getOptionLabel={handleGetOrgOptionLabel}
55
57
  queryKey={queryKey}
56
58
  {...rest}
57
59
  loadOptions={handleLoadOptions}
@@ -33,7 +33,7 @@ export type Provider = {
33
33
  };
34
34
  };
35
35
 
36
- const fetchProviders = async (
36
+ export const fetchProviders = async (
37
37
  customerId: string,
38
38
  config: ApiConfig
39
39
  ): Promise<{ options: Provider[]; hasMore: boolean; offset: number }> => {
@@ -62,6 +62,8 @@ export interface ProviderAutocompleteProps<
62
62
  apiConfig?: ApiConfig;
63
63
  }
64
64
 
65
+ export const handleGetProviderOptionLabel = (option: Provider) => option.uiDisplayName;
66
+
65
67
  export const ProviderAutocomplete = ({
66
68
  apiConfig = {},
67
69
  customerId,
@@ -77,11 +79,9 @@ export const ProviderAutocomplete = ({
77
79
  return resp;
78
80
  };
79
81
 
80
- const handleGetOptionLabel = (option: Provider) => option.uiDisplayName;
81
-
82
82
  return (
83
83
  <AsyncAutocomplete
84
- getOptionLabel={handleGetOptionLabel}
84
+ getOptionLabel={handleGetProviderOptionLabel}
85
85
  queryOptions={{ enabled: !!customerId }}
86
86
  queryKey={queryKey}
87
87
  watchParams={{ customerId }}