@availity/mui-autocomplete 1.2.4 → 1.2.5
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 +7 -0
- package/dist/index.d.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +9 -3
- package/dist/index.mjs +9 -3
- package/package.json +1 -1
- package/src/lib/AsyncAutocomplete.stories.tsx +0 -7
- package/src/lib/CodesAutocomplete.stories.tsx +0 -7
- package/src/lib/CodesAutocomplete.tsx +13 -4
- package/src/lib/OrganizationAutocomplete.stories.tsx +0 -7
- package/src/lib/OrganizationAutocomplete.tsx +13 -4
- package/src/lib/ProviderAutocomplete.stories.tsx +0 -7
- package/src/lib/ProviderAutocomplete.tsx +13 -4
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
|
|
4
4
|
|
|
5
|
+
## [1.2.5](https://github.com/Availity/element/compare/@availity/mui-autocomplete@1.2.4...@availity/mui-autocomplete@1.2.5) (2025-07-17)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* **mui-autocomplete:** fix the multiple prop type for async autocompletes ([3b904a4](https://github.com/Availity/element/commit/3b904a4f88b250433d75ff4a439aab10adc238e9))
|
|
11
|
+
|
|
5
12
|
## [1.2.4](https://github.com/Availity/element/compare/@availity/mui-autocomplete@1.2.3...@availity/mui-autocomplete@1.2.4) (2025-06-18)
|
|
6
13
|
|
|
7
14
|
|
package/dist/index.d.mts
CHANGED
|
@@ -56,7 +56,7 @@ interface CodesAutocompleteProps<Option = Code, Multiple extends boolean | undef
|
|
|
56
56
|
apiConfig?: ApiConfig;
|
|
57
57
|
}
|
|
58
58
|
declare const handleGetCodesOptionLabel: (option: Code) => string;
|
|
59
|
-
declare const CodesAutocomplete: ({ apiConfig, queryOptions, queryKey, list, watchParams, ...rest }: CodesAutocompleteProps) => react_jsx_runtime.JSX.Element;
|
|
59
|
+
declare const CodesAutocomplete: <Option = Code, Multiple extends boolean | undefined = false, DisableClearable extends boolean | undefined = false, FreeSolo extends boolean | undefined = false, ChipComponent extends React.ElementType = "div">({ apiConfig, queryOptions, queryKey, list, watchParams, ...rest }: CodesAutocompleteProps<Option, Multiple, DisableClearable, FreeSolo, ChipComponent>) => react_jsx_runtime.JSX.Element;
|
|
60
60
|
|
|
61
61
|
type Organization = {
|
|
62
62
|
customerId: string;
|
|
@@ -75,7 +75,7 @@ interface OrgAutocompleteProps<Option = Organization, Multiple extends boolean |
|
|
|
75
75
|
apiConfig?: ApiConfig;
|
|
76
76
|
}
|
|
77
77
|
declare const handleGetOrgOptionLabel: (org: Organization) => string;
|
|
78
|
-
declare const OrganizationAutocomplete: ({ apiConfig, queryKey, ...rest }: OrgAutocompleteProps) => react_jsx_runtime.JSX.Element;
|
|
78
|
+
declare const OrganizationAutocomplete: <Option = Organization, Multiple extends boolean | undefined = false, DisableClearable extends boolean | undefined = false, FreeSolo extends boolean | undefined = false, ChipComponent extends React.ElementType = "div">({ apiConfig, queryKey, ...rest }: OrgAutocompleteProps<Option, Multiple, DisableClearable, FreeSolo, ChipComponent>) => react_jsx_runtime.JSX.Element;
|
|
79
79
|
|
|
80
80
|
type Provider = {
|
|
81
81
|
id: string;
|
|
@@ -134,6 +134,6 @@ interface ProviderAutocompleteProps<Option = Provider, Multiple extends boolean
|
|
|
134
134
|
apiConfig?: ApiConfig;
|
|
135
135
|
}
|
|
136
136
|
declare const handleGetProviderOptionLabel: (option: Provider) => string;
|
|
137
|
-
declare const ProviderAutocomplete: ({ apiConfig, customerId, queryKey, ...rest }: ProviderAutocompleteProps) => react_jsx_runtime.JSX.Element;
|
|
137
|
+
declare const ProviderAutocomplete: <Option = Provider, Multiple extends boolean | undefined = false, DisableClearable extends boolean | undefined = false, FreeSolo extends boolean | undefined = false, ChipComponent extends React.ElementType = "div">({ apiConfig, customerId, queryKey, ...rest }: ProviderAutocompleteProps<Option, Multiple, DisableClearable, FreeSolo, ChipComponent>) => react_jsx_runtime.JSX.Element;
|
|
138
138
|
|
|
139
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
|
@@ -56,7 +56,7 @@ interface CodesAutocompleteProps<Option = Code, Multiple extends boolean | undef
|
|
|
56
56
|
apiConfig?: ApiConfig;
|
|
57
57
|
}
|
|
58
58
|
declare const handleGetCodesOptionLabel: (option: Code) => string;
|
|
59
|
-
declare const CodesAutocomplete: ({ apiConfig, queryOptions, queryKey, list, watchParams, ...rest }: CodesAutocompleteProps) => react_jsx_runtime.JSX.Element;
|
|
59
|
+
declare const CodesAutocomplete: <Option = Code, Multiple extends boolean | undefined = false, DisableClearable extends boolean | undefined = false, FreeSolo extends boolean | undefined = false, ChipComponent extends React.ElementType = "div">({ apiConfig, queryOptions, queryKey, list, watchParams, ...rest }: CodesAutocompleteProps<Option, Multiple, DisableClearable, FreeSolo, ChipComponent>) => react_jsx_runtime.JSX.Element;
|
|
60
60
|
|
|
61
61
|
type Organization = {
|
|
62
62
|
customerId: string;
|
|
@@ -75,7 +75,7 @@ interface OrgAutocompleteProps<Option = Organization, Multiple extends boolean |
|
|
|
75
75
|
apiConfig?: ApiConfig;
|
|
76
76
|
}
|
|
77
77
|
declare const handleGetOrgOptionLabel: (org: Organization) => string;
|
|
78
|
-
declare const OrganizationAutocomplete: ({ apiConfig, queryKey, ...rest }: OrgAutocompleteProps) => react_jsx_runtime.JSX.Element;
|
|
78
|
+
declare const OrganizationAutocomplete: <Option = Organization, Multiple extends boolean | undefined = false, DisableClearable extends boolean | undefined = false, FreeSolo extends boolean | undefined = false, ChipComponent extends React.ElementType = "div">({ apiConfig, queryKey, ...rest }: OrgAutocompleteProps<Option, Multiple, DisableClearable, FreeSolo, ChipComponent>) => react_jsx_runtime.JSX.Element;
|
|
79
79
|
|
|
80
80
|
type Provider = {
|
|
81
81
|
id: string;
|
|
@@ -134,6 +134,6 @@ interface ProviderAutocompleteProps<Option = Provider, Multiple extends boolean
|
|
|
134
134
|
apiConfig?: ApiConfig;
|
|
135
135
|
}
|
|
136
136
|
declare const handleGetProviderOptionLabel: (option: Provider) => string;
|
|
137
|
-
declare const ProviderAutocomplete: ({ apiConfig, customerId, queryKey, ...rest }: ProviderAutocompleteProps) => react_jsx_runtime.JSX.Element;
|
|
137
|
+
declare const ProviderAutocomplete: <Option = Provider, Multiple extends boolean | undefined = false, DisableClearable extends boolean | undefined = false, FreeSolo extends boolean | undefined = false, ChipComponent extends React.ElementType = "div">({ apiConfig, customerId, queryKey, ...rest }: ProviderAutocompleteProps<Option, Multiple, DisableClearable, FreeSolo, ChipComponent>) => react_jsx_runtime.JSX.Element;
|
|
138
138
|
|
|
139
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
|
@@ -264,7 +264,9 @@ var CodesAutocomplete = (_a) => {
|
|
|
264
264
|
const resp = yield fetchCodes(__spreadProps(__spreadValues({}, apiConfig), {
|
|
265
265
|
params: __spreadProps(__spreadValues({}, apiConfig.params), { list, offset, limit, q: inputValue })
|
|
266
266
|
}));
|
|
267
|
-
return resp
|
|
267
|
+
return __spreadProps(__spreadValues({}, resp), {
|
|
268
|
+
options: resp.options
|
|
269
|
+
});
|
|
268
270
|
});
|
|
269
271
|
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
270
272
|
AsyncAutocomplete,
|
|
@@ -307,7 +309,9 @@ var OrganizationAutocomplete = (_a) => {
|
|
|
307
309
|
]);
|
|
308
310
|
const handleLoadOptions = (offset, limit) => __async(void 0, null, function* () {
|
|
309
311
|
const resp = yield fetchOrgs(__spreadProps(__spreadValues({}, apiConfig), { params: __spreadProps(__spreadValues({ dropdown: true }, apiConfig.params), { offset, limit }) }));
|
|
310
|
-
return resp
|
|
312
|
+
return __spreadProps(__spreadValues({}, resp), {
|
|
313
|
+
options: resp.options
|
|
314
|
+
});
|
|
311
315
|
});
|
|
312
316
|
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
313
317
|
AsyncAutocomplete,
|
|
@@ -346,7 +350,9 @@ var ProviderAutocomplete = (_a) => {
|
|
|
346
350
|
const resp = yield fetchProviders(customerId, __spreadProps(__spreadValues({}, apiConfig), {
|
|
347
351
|
params: __spreadProps(__spreadValues({}, apiConfig.params), { offset, limit, q: inputValue })
|
|
348
352
|
}));
|
|
349
|
-
return resp
|
|
353
|
+
return __spreadProps(__spreadValues({}, resp), {
|
|
354
|
+
options: resp.options
|
|
355
|
+
});
|
|
350
356
|
});
|
|
351
357
|
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
352
358
|
AsyncAutocomplete,
|
package/dist/index.mjs
CHANGED
|
@@ -222,7 +222,9 @@ var CodesAutocomplete = (_a) => {
|
|
|
222
222
|
const resp = yield fetchCodes(__spreadProps(__spreadValues({}, apiConfig), {
|
|
223
223
|
params: __spreadProps(__spreadValues({}, apiConfig.params), { list, offset, limit, q: inputValue })
|
|
224
224
|
}));
|
|
225
|
-
return resp
|
|
225
|
+
return __spreadProps(__spreadValues({}, resp), {
|
|
226
|
+
options: resp.options
|
|
227
|
+
});
|
|
226
228
|
});
|
|
227
229
|
return /* @__PURE__ */ jsx3(
|
|
228
230
|
AsyncAutocomplete,
|
|
@@ -265,7 +267,9 @@ var OrganizationAutocomplete = (_a) => {
|
|
|
265
267
|
]);
|
|
266
268
|
const handleLoadOptions = (offset, limit) => __async(void 0, null, function* () {
|
|
267
269
|
const resp = yield fetchOrgs(__spreadProps(__spreadValues({}, apiConfig), { params: __spreadProps(__spreadValues({ dropdown: true }, apiConfig.params), { offset, limit }) }));
|
|
268
|
-
return resp
|
|
270
|
+
return __spreadProps(__spreadValues({}, resp), {
|
|
271
|
+
options: resp.options
|
|
272
|
+
});
|
|
269
273
|
});
|
|
270
274
|
return /* @__PURE__ */ jsx4(
|
|
271
275
|
AsyncAutocomplete,
|
|
@@ -304,7 +308,9 @@ var ProviderAutocomplete = (_a) => {
|
|
|
304
308
|
const resp = yield fetchProviders(customerId, __spreadProps(__spreadValues({}, apiConfig), {
|
|
305
309
|
params: __spreadProps(__spreadValues({}, apiConfig.params), { offset, limit, q: inputValue })
|
|
306
310
|
}));
|
|
307
|
-
return resp
|
|
311
|
+
return __spreadProps(__spreadValues({}, resp), {
|
|
312
|
+
options: resp.options
|
|
313
|
+
});
|
|
308
314
|
});
|
|
309
315
|
return /* @__PURE__ */ jsx5(
|
|
310
316
|
AsyncAutocomplete,
|
package/package.json
CHANGED
|
@@ -37,26 +37,35 @@ export interface CodesAutocompleteProps<
|
|
|
37
37
|
|
|
38
38
|
export const handleGetCodesOptionLabel = (option: Code) => [option.code, option.value].filter(Boolean).join(' - ');
|
|
39
39
|
|
|
40
|
-
export const CodesAutocomplete =
|
|
40
|
+
export const CodesAutocomplete = <
|
|
41
|
+
Option = Code,
|
|
42
|
+
Multiple extends boolean | undefined = false,
|
|
43
|
+
DisableClearable extends boolean | undefined = false,
|
|
44
|
+
FreeSolo extends boolean | undefined = false,
|
|
45
|
+
ChipComponent extends React.ElementType = ChipTypeMap['defaultComponent'],
|
|
46
|
+
>({
|
|
41
47
|
apiConfig = {},
|
|
42
48
|
queryOptions,
|
|
43
49
|
queryKey = 'codes-autocomplete',
|
|
44
50
|
list,
|
|
45
51
|
watchParams,
|
|
46
52
|
...rest
|
|
47
|
-
}: CodesAutocompleteProps) => {
|
|
53
|
+
}: CodesAutocompleteProps<Option, Multiple, DisableClearable, FreeSolo, ChipComponent>) => {
|
|
48
54
|
const handleLoadOptions = async (offset: number, limit: number, inputValue: string) => {
|
|
49
55
|
const resp = await fetchCodes({
|
|
50
56
|
...apiConfig,
|
|
51
57
|
params: { ...apiConfig.params, list, offset, limit, q: inputValue },
|
|
52
58
|
});
|
|
53
59
|
|
|
54
|
-
return
|
|
60
|
+
return {
|
|
61
|
+
...resp,
|
|
62
|
+
options: resp.options as Option[],
|
|
63
|
+
};
|
|
55
64
|
};
|
|
56
65
|
|
|
57
66
|
return (
|
|
58
67
|
<AsyncAutocomplete
|
|
59
|
-
getOptionLabel={handleGetCodesOptionLabel}
|
|
68
|
+
getOptionLabel={handleGetCodesOptionLabel as (option: Option) => string}
|
|
60
69
|
queryKey={queryKey}
|
|
61
70
|
queryOptions={{ enabled: !!list, ...queryOptions }}
|
|
62
71
|
watchParams={{ list, ...watchParams }}
|
|
@@ -49,20 +49,29 @@ export interface OrgAutocompleteProps<
|
|
|
49
49
|
|
|
50
50
|
export const handleGetOrgOptionLabel = (org: Organization) => org.name;
|
|
51
51
|
|
|
52
|
-
export const OrganizationAutocomplete =
|
|
52
|
+
export const OrganizationAutocomplete = <
|
|
53
|
+
Option = Organization,
|
|
54
|
+
Multiple extends boolean | undefined = false,
|
|
55
|
+
DisableClearable extends boolean | undefined = false,
|
|
56
|
+
FreeSolo extends boolean | undefined = false,
|
|
57
|
+
ChipComponent extends React.ElementType = ChipTypeMap['defaultComponent'],
|
|
58
|
+
>({
|
|
53
59
|
apiConfig = {},
|
|
54
60
|
queryKey = 'org-autocomplete',
|
|
55
61
|
...rest
|
|
56
|
-
}: OrgAutocompleteProps) => {
|
|
62
|
+
}: OrgAutocompleteProps<Option, Multiple, DisableClearable, FreeSolo, ChipComponent>) => {
|
|
57
63
|
const handleLoadOptions = async (offset: number, limit: number) => {
|
|
58
64
|
const resp = await fetchOrgs({ ...apiConfig, params: { dropdown: true, ...apiConfig.params, offset, limit } });
|
|
59
65
|
|
|
60
|
-
return
|
|
66
|
+
return {
|
|
67
|
+
...resp,
|
|
68
|
+
options: resp.options as Option[],
|
|
69
|
+
};
|
|
61
70
|
};
|
|
62
71
|
|
|
63
72
|
return (
|
|
64
73
|
<AsyncAutocomplete
|
|
65
|
-
getOptionLabel={handleGetOrgOptionLabel}
|
|
74
|
+
getOptionLabel={handleGetOrgOptionLabel as (option: Option) => string}
|
|
66
75
|
queryKey={queryKey}
|
|
67
76
|
{...rest}
|
|
68
77
|
loadOptions={handleLoadOptions}
|
|
@@ -64,24 +64,33 @@ export interface ProviderAutocompleteProps<
|
|
|
64
64
|
|
|
65
65
|
export const handleGetProviderOptionLabel = (option: Provider) => option.uiDisplayName;
|
|
66
66
|
|
|
67
|
-
export const ProviderAutocomplete =
|
|
67
|
+
export const ProviderAutocomplete = <
|
|
68
|
+
Option = Provider,
|
|
69
|
+
Multiple extends boolean | undefined = false,
|
|
70
|
+
DisableClearable extends boolean | undefined = false,
|
|
71
|
+
FreeSolo extends boolean | undefined = false,
|
|
72
|
+
ChipComponent extends React.ElementType = ChipTypeMap['defaultComponent'],
|
|
73
|
+
>({
|
|
68
74
|
apiConfig = {},
|
|
69
75
|
customerId,
|
|
70
76
|
queryKey = 'prov-autocomplete',
|
|
71
77
|
...rest
|
|
72
|
-
}: ProviderAutocompleteProps) => {
|
|
78
|
+
}: ProviderAutocompleteProps<Option, Multiple, DisableClearable, FreeSolo, ChipComponent>) => {
|
|
73
79
|
const handleLoadOptions = async (offset: number, limit: number, inputValue: string) => {
|
|
74
80
|
const resp = await fetchProviders(customerId, {
|
|
75
81
|
...apiConfig,
|
|
76
82
|
params: { ...apiConfig.params, offset, limit, q: inputValue },
|
|
77
83
|
});
|
|
78
84
|
|
|
79
|
-
return
|
|
85
|
+
return {
|
|
86
|
+
...resp,
|
|
87
|
+
options: resp.options as Option[],
|
|
88
|
+
};
|
|
80
89
|
};
|
|
81
90
|
|
|
82
91
|
return (
|
|
83
92
|
<AsyncAutocomplete
|
|
84
|
-
getOptionLabel={handleGetProviderOptionLabel}
|
|
93
|
+
getOptionLabel={handleGetProviderOptionLabel as (option: Option) => string}
|
|
85
94
|
queryOptions={{ enabled: !!customerId }}
|
|
86
95
|
queryKey={queryKey}
|
|
87
96
|
watchParams={{ customerId }}
|