@availity/mui-autocomplete 1.2.3 → 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 CHANGED
@@ -2,6 +2,20 @@
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
+
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)
13
+
14
+
15
+ ### Bug Fixes
16
+
17
+ * **mui-autocomplete:** serialize organization params ([23d9dce](https://github.com/Availity/element/commit/23d9dce0bd63e9417a8a79a95ab2c7e5c8946301))
18
+
5
19
  ## [1.2.3](https://github.com/Availity/element/compare/@availity/mui-autocomplete@1.2.2...@availity/mui-autocomplete@1.2.3) (2025-05-30)
6
20
 
7
21
 
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,
@@ -281,9 +283,15 @@ var CodesAutocomplete = (_a) => {
281
283
 
282
284
  // src/lib/OrganizationAutocomplete.tsx
283
285
  var import_api_axios2 = require("@availity/api-axios");
286
+ var import_qs = __toESM(require("qs"));
284
287
  var import_jsx_runtime4 = require("react/jsx-runtime");
285
288
  var fetchOrgs = (config) => __async(void 0, null, function* () {
286
- const resp = yield import_api_axios2.avOrganizationsApi.getOrganizations(config);
289
+ const configWithParamsSerializer = __spreadProps(__spreadValues({}, config), {
290
+ paramsSerializer: {
291
+ serialize: (params) => import_qs.default.stringify(params, { arrayFormat: "repeat" })
292
+ }
293
+ });
294
+ const resp = yield import_api_axios2.avOrganizationsApi.getOrganizations(configWithParamsSerializer);
287
295
  return {
288
296
  options: resp.data.organizations,
289
297
  hasMore: config.params.offset + config.params.limit < resp.data.totalCount,
@@ -301,7 +309,9 @@ var OrganizationAutocomplete = (_a) => {
301
309
  ]);
302
310
  const handleLoadOptions = (offset, limit) => __async(void 0, null, function* () {
303
311
  const resp = yield fetchOrgs(__spreadProps(__spreadValues({}, apiConfig), { params: __spreadProps(__spreadValues({ dropdown: true }, apiConfig.params), { offset, limit }) }));
304
- return resp;
312
+ return __spreadProps(__spreadValues({}, resp), {
313
+ options: resp.options
314
+ });
305
315
  });
306
316
  return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
307
317
  AsyncAutocomplete,
@@ -340,7 +350,9 @@ var ProviderAutocomplete = (_a) => {
340
350
  const resp = yield fetchProviders(customerId, __spreadProps(__spreadValues({}, apiConfig), {
341
351
  params: __spreadProps(__spreadValues({}, apiConfig.params), { offset, limit, q: inputValue })
342
352
  }));
343
- return resp;
353
+ return __spreadProps(__spreadValues({}, resp), {
354
+ options: resp.options
355
+ });
344
356
  });
345
357
  return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
346
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,
@@ -239,9 +241,15 @@ var CodesAutocomplete = (_a) => {
239
241
 
240
242
  // src/lib/OrganizationAutocomplete.tsx
241
243
  import { avOrganizationsApi } from "@availity/api-axios";
244
+ import qs from "qs";
242
245
  import { jsx as jsx4 } from "react/jsx-runtime";
243
246
  var fetchOrgs = (config) => __async(void 0, null, function* () {
244
- const resp = yield avOrganizationsApi.getOrganizations(config);
247
+ const configWithParamsSerializer = __spreadProps(__spreadValues({}, config), {
248
+ paramsSerializer: {
249
+ serialize: (params) => qs.stringify(params, { arrayFormat: "repeat" })
250
+ }
251
+ });
252
+ const resp = yield avOrganizationsApi.getOrganizations(configWithParamsSerializer);
245
253
  return {
246
254
  options: resp.data.organizations,
247
255
  hasMore: config.params.offset + config.params.limit < resp.data.totalCount,
@@ -259,7 +267,9 @@ var OrganizationAutocomplete = (_a) => {
259
267
  ]);
260
268
  const handleLoadOptions = (offset, limit) => __async(void 0, null, function* () {
261
269
  const resp = yield fetchOrgs(__spreadProps(__spreadValues({}, apiConfig), { params: __spreadProps(__spreadValues({ dropdown: true }, apiConfig.params), { offset, limit }) }));
262
- return resp;
270
+ return __spreadProps(__spreadValues({}, resp), {
271
+ options: resp.options
272
+ });
263
273
  });
264
274
  return /* @__PURE__ */ jsx4(
265
275
  AsyncAutocomplete,
@@ -298,7 +308,9 @@ var ProviderAutocomplete = (_a) => {
298
308
  const resp = yield fetchProviders(customerId, __spreadProps(__spreadValues({}, apiConfig), {
299
309
  params: __spreadProps(__spreadValues({}, apiConfig.params), { offset, limit, q: inputValue })
300
310
  }));
301
- return resp;
311
+ return __spreadProps(__spreadValues({}, resp), {
312
+ options: resp.options
313
+ });
302
314
  });
303
315
  return /* @__PURE__ */ jsx5(
304
316
  AsyncAutocomplete,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@availity/mui-autocomplete",
3
- "version": "1.2.3",
3
+ "version": "1.2.5",
4
4
  "description": "Availity MUI Autocomplete Component - part of the @availity/element design system",
5
5
  "keywords": [
6
6
  "react",
@@ -41,7 +41,8 @@
41
41
  "publish:canary": "yarn npm publish --access public --tag canary"
42
42
  },
43
43
  "dependencies": {
44
- "@mui/types": "^7.2.21"
44
+ "@mui/types": "^7.2.21",
45
+ "qs": "^6.14.0"
45
46
  },
46
47
  "devDependencies": {
47
48
  "@availity/api-axios": "^11.0.0",
@@ -12,13 +12,6 @@ const meta: Meta<typeof AsyncAutocomplete> = {
12
12
  args: {
13
13
  id: 'example',
14
14
  },
15
- argTypes: {
16
- multiple: {
17
- table: {
18
- disable: true,
19
- },
20
- },
21
- },
22
15
  };
23
16
 
24
17
  export default meta;
@@ -11,13 +11,6 @@ const meta: Meta<typeof CodesAutocomplete> = {
11
11
  args: {
12
12
  id: 'example',
13
13
  },
14
- argTypes: {
15
- multiple: {
16
- table: {
17
- disable: true,
18
- },
19
- },
20
- },
21
14
  };
22
15
 
23
16
  export default meta;
@@ -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 resp;
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 }}
@@ -11,13 +11,6 @@ const meta: Meta<typeof OrganizationAutocomplete> = {
11
11
  args: {
12
12
  id: 'example',
13
13
  },
14
- argTypes: {
15
- multiple: {
16
- table: {
17
- disable: true,
18
- },
19
- },
20
- },
21
14
  };
22
15
 
23
16
  export default meta;
@@ -1,5 +1,6 @@
1
1
  import { avOrganizationsApi, ApiConfig } from '@availity/api-axios';
2
2
  import type { ChipTypeMap } from '@mui/material/Chip';
3
+ import qs from 'qs';
3
4
 
4
5
  import { AsyncAutocomplete, AsyncAutocompleteProps } from './AsyncAutocomplete';
5
6
  import type { Optional } from './util';
@@ -15,7 +16,15 @@ export type Organization = {
15
16
  export const fetchOrgs = async (
16
17
  config: ApiConfig
17
18
  ): Promise<{ options: Organization[]; hasMore: boolean; offset: number }> => {
18
- const resp = await avOrganizationsApi.getOrganizations(config);
19
+ // Configure axios to use 'repeat' format for arrays (no brackets)
20
+ const configWithParamsSerializer = {
21
+ ...config,
22
+ paramsSerializer: {
23
+ serialize: (params: Record<string, any>) => qs.stringify(params, { arrayFormat: 'repeat' }),
24
+ },
25
+ };
26
+
27
+ const resp = await avOrganizationsApi.getOrganizations(configWithParamsSerializer);
19
28
 
20
29
  return {
21
30
  options: resp.data.organizations as Organization[],
@@ -40,20 +49,29 @@ export interface OrgAutocompleteProps<
40
49
 
41
50
  export const handleGetOrgOptionLabel = (org: Organization) => org.name;
42
51
 
43
- 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
+ >({
44
59
  apiConfig = {},
45
60
  queryKey = 'org-autocomplete',
46
61
  ...rest
47
- }: OrgAutocompleteProps) => {
62
+ }: OrgAutocompleteProps<Option, Multiple, DisableClearable, FreeSolo, ChipComponent>) => {
48
63
  const handleLoadOptions = async (offset: number, limit: number) => {
49
64
  const resp = await fetchOrgs({ ...apiConfig, params: { dropdown: true, ...apiConfig.params, offset, limit } });
50
65
 
51
- return resp;
66
+ return {
67
+ ...resp,
68
+ options: resp.options as Option[],
69
+ };
52
70
  };
53
71
 
54
72
  return (
55
73
  <AsyncAutocomplete
56
- getOptionLabel={handleGetOrgOptionLabel}
74
+ getOptionLabel={handleGetOrgOptionLabel as (option: Option) => string}
57
75
  queryKey={queryKey}
58
76
  {...rest}
59
77
  loadOptions={handleLoadOptions}
@@ -11,13 +11,6 @@ const meta: Meta<typeof ProviderAutocomplete> = {
11
11
  args: {
12
12
  id: 'example',
13
13
  },
14
- argTypes: {
15
- multiple: {
16
- table: {
17
- disable: true,
18
- },
19
- },
20
- },
21
14
  };
22
15
 
23
16
  export default meta;
@@ -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 resp;
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 }}