@availity/mui-autocomplete 0.9.8 → 0.9.10

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,19 @@
2
2
 
3
3
  This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
4
4
 
5
+ ## [0.9.10](https://github.com/Availity/element/compare/@availity/mui-autocomplete@0.9.9...@availity/mui-autocomplete@0.9.10) (2025-01-27)
6
+
7
+ ### Dependency Updates
8
+
9
+ * `mui-form-utils` updated to version `0.9.9`
10
+ * `mui-textfield` updated to version `0.9.9`
11
+ ## [0.9.9](https://github.com/Availity/element/compare/@availity/mui-autocomplete@0.9.8...@availity/mui-autocomplete@0.9.9) (2025-01-23)
12
+
13
+
14
+ ### Bug Fixes
15
+
16
+ * **mui-autocomplete:** export the CodesAutocomplete component ([b9eba2c](https://github.com/Availity/element/commit/b9eba2ce16de7a5bd277d724dab6b1003cc09f9f))
17
+
5
18
  ## [0.9.8](https://github.com/Availity/element/compare/@availity/mui-autocomplete@0.9.7...@availity/mui-autocomplete@0.9.8) (2025-01-22)
6
19
 
7
20
  ### Dependency Updates
package/dist/index.d.mts CHANGED
@@ -41,6 +41,18 @@ declare const AsyncAutocomplete: <Option, Multiple extends boolean | undefined =
41
41
 
42
42
  type Optional<T, K extends keyof T> = Pick<Partial<T>, K> & Omit<T, K>;
43
43
 
44
+ type Code = {
45
+ code: string;
46
+ value: string;
47
+ };
48
+ 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'> {
49
+ /** The code list id. */
50
+ list: string;
51
+ /** Config passed to the AvCodesApi.query function */
52
+ apiConfig?: ApiConfig;
53
+ }
54
+ declare const CodesAutocomplete: ({ apiConfig, queryOptions, queryKey, list, watchParams, ...rest }: CodesAutocompleteProps) => react_jsx_runtime.JSX.Element;
55
+
44
56
  type Organization = {
45
57
  customerId: string;
46
58
  name: string;
@@ -49,6 +61,7 @@ type Organization = {
49
61
  links: Record<string, Record<string, string>>;
50
62
  };
51
63
  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'> {
64
+ /** Axios ApiConfig */
52
65
  apiConfig?: ApiConfig;
53
66
  }
54
67
  declare const OrganizationAutocomplete: ({ apiConfig, queryKey, ...rest }: OrgAutocompleteProps) => react_jsx_runtime.JSX.Element;
@@ -106,4 +119,4 @@ interface ProviderAutocompleteProps<Option = Provider, Multiple extends boolean
106
119
  }
107
120
  declare const ProviderAutocomplete: ({ apiConfig, customerId, queryKey, ...rest }: ProviderAutocompleteProps) => react_jsx_runtime.JSX.Element;
108
121
 
109
- export { AsyncAutocomplete, type AsyncAutocompleteProps, Autocomplete, type AutocompleteProps, type OrgAutocompleteProps, type Organization, OrganizationAutocomplete, type Provider, ProviderAutocomplete, type ProviderAutocompleteProps };
122
+ export { AsyncAutocomplete, type AsyncAutocompleteProps, Autocomplete, type AutocompleteProps, CodesAutocomplete, type CodesAutocompleteProps, type OrgAutocompleteProps, type Organization, OrganizationAutocomplete, type Provider, ProviderAutocomplete, type ProviderAutocompleteProps };
package/dist/index.d.ts CHANGED
@@ -41,6 +41,18 @@ declare const AsyncAutocomplete: <Option, Multiple extends boolean | undefined =
41
41
 
42
42
  type Optional<T, K extends keyof T> = Pick<Partial<T>, K> & Omit<T, K>;
43
43
 
44
+ type Code = {
45
+ code: string;
46
+ value: string;
47
+ };
48
+ 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'> {
49
+ /** The code list id. */
50
+ list: string;
51
+ /** Config passed to the AvCodesApi.query function */
52
+ apiConfig?: ApiConfig;
53
+ }
54
+ declare const CodesAutocomplete: ({ apiConfig, queryOptions, queryKey, list, watchParams, ...rest }: CodesAutocompleteProps) => react_jsx_runtime.JSX.Element;
55
+
44
56
  type Organization = {
45
57
  customerId: string;
46
58
  name: string;
@@ -49,6 +61,7 @@ type Organization = {
49
61
  links: Record<string, Record<string, string>>;
50
62
  };
51
63
  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'> {
64
+ /** Axios ApiConfig */
52
65
  apiConfig?: ApiConfig;
53
66
  }
54
67
  declare const OrganizationAutocomplete: ({ apiConfig, queryKey, ...rest }: OrgAutocompleteProps) => react_jsx_runtime.JSX.Element;
@@ -106,4 +119,4 @@ interface ProviderAutocompleteProps<Option = Provider, Multiple extends boolean
106
119
  }
107
120
  declare const ProviderAutocomplete: ({ apiConfig, customerId, queryKey, ...rest }: ProviderAutocompleteProps) => react_jsx_runtime.JSX.Element;
108
121
 
109
- export { AsyncAutocomplete, type AsyncAutocompleteProps, Autocomplete, type AutocompleteProps, type OrgAutocompleteProps, type Organization, OrganizationAutocomplete, type Provider, ProviderAutocomplete, type ProviderAutocompleteProps };
122
+ export { AsyncAutocomplete, type AsyncAutocompleteProps, Autocomplete, type AutocompleteProps, CodesAutocomplete, type CodesAutocompleteProps, type OrgAutocompleteProps, type Organization, OrganizationAutocomplete, type Provider, ProviderAutocomplete, type ProviderAutocompleteProps };
package/dist/index.js CHANGED
@@ -81,6 +81,7 @@ var src_exports = {};
81
81
  __export(src_exports, {
82
82
  AsyncAutocomplete: () => AsyncAutocomplete,
83
83
  Autocomplete: () => Autocomplete,
84
+ CodesAutocomplete: () => CodesAutocomplete,
84
85
  OrganizationAutocomplete: () => OrganizationAutocomplete,
85
86
  ProviderAutocomplete: () => ProviderAutocomplete,
86
87
  createFilterOptions: () => import_Autocomplete2.createFilterOptions
@@ -217,11 +218,56 @@ var AsyncAutocomplete = (_a) => {
217
218
  );
218
219
  };
219
220
 
220
- // src/lib/OrganizationAutocomplete.tsx
221
+ // src/lib/CodesAutocomplete.tsx
221
222
  var import_api_axios = require("@availity/api-axios");
222
223
  var import_jsx_runtime3 = require("react/jsx-runtime");
224
+ var fetchCodes = (config) => __async(void 0, null, function* () {
225
+ const resp = yield import_api_axios.avCodesApi.query(config);
226
+ return {
227
+ options: resp.data.codes,
228
+ hasMore: config.params.offset + config.params.limit < resp.data.totalCount,
229
+ offset: config.params.offset
230
+ };
231
+ });
232
+ var CodesAutocomplete = (_a) => {
233
+ var _b = _a, {
234
+ apiConfig = {},
235
+ queryOptions,
236
+ queryKey = "codes-autocomplete",
237
+ list,
238
+ watchParams
239
+ } = _b, rest = __objRest(_b, [
240
+ "apiConfig",
241
+ "queryOptions",
242
+ "queryKey",
243
+ "list",
244
+ "watchParams"
245
+ ]);
246
+ const handleLoadOptions = (offset, limit, inputValue) => __async(void 0, null, function* () {
247
+ const resp = yield fetchCodes(__spreadProps(__spreadValues({}, apiConfig), {
248
+ params: __spreadProps(__spreadValues({}, apiConfig.params), { list, offset, limit, q: inputValue })
249
+ }));
250
+ return resp;
251
+ });
252
+ const handleGetOptionLabel = (option) => [option.code, option.value].filter(Boolean).join(" - ");
253
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
254
+ AsyncAutocomplete,
255
+ __spreadProps(__spreadValues({
256
+ getOptionLabel: handleGetOptionLabel,
257
+ queryKey,
258
+ queryOptions: __spreadValues({ enabled: !!list }, queryOptions),
259
+ watchParams: __spreadValues({ list }, watchParams)
260
+ }, rest), {
261
+ loadOptions: handleLoadOptions
262
+ })
263
+ );
264
+ };
265
+
266
+ // src/lib/OrganizationAutocomplete.tsx
267
+ var import_api_axios2 = require("@availity/api-axios");
268
+ var import_jsx_runtime4 = require("react/jsx-runtime");
223
269
  var fetchOrgs = (config) => __async(void 0, null, function* () {
224
- const resp = yield import_api_axios.avOrganizationsApi.getOrganizations(config);
270
+ const resp = yield import_api_axios2.avOrganizationsApi.getOrganizations(config);
225
271
  return {
226
272
  options: resp.data.organizations,
227
273
  hasMore: config.params.offset + config.params.limit < resp.data.totalCount,
@@ -241,7 +287,7 @@ var OrganizationAutocomplete = (_a) => {
241
287
  return resp;
242
288
  });
243
289
  const handleGetOptionLabel = (org) => org.name;
244
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
290
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
245
291
  AsyncAutocomplete,
246
292
  __spreadProps(__spreadValues({
247
293
  getOptionLabel: handleGetOptionLabel,
@@ -253,10 +299,10 @@ var OrganizationAutocomplete = (_a) => {
253
299
  };
254
300
 
255
301
  // src/lib/ProviderAutocomplete.tsx
256
- var import_api_axios2 = require("@availity/api-axios");
257
- var import_jsx_runtime4 = require("react/jsx-runtime");
302
+ var import_api_axios3 = require("@availity/api-axios");
303
+ var import_jsx_runtime5 = require("react/jsx-runtime");
258
304
  var fetchProviders = (customerId, config) => __async(void 0, null, function* () {
259
- const resp = yield import_api_axios2.avProvidersApi.getProviders(customerId, config);
305
+ const resp = yield import_api_axios3.avProvidersApi.getProviders(customerId, config);
260
306
  return {
261
307
  options: resp.data.providers,
262
308
  hasMore: config.params.offset + config.params.limit < resp.data.totalCount,
@@ -280,7 +326,7 @@ var ProviderAutocomplete = (_a) => {
280
326
  return resp;
281
327
  });
282
328
  const handleGetOptionLabel = (option) => option.uiDisplayName;
283
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
329
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
284
330
  AsyncAutocomplete,
285
331
  __spreadProps(__spreadValues({
286
332
  getOptionLabel: handleGetOptionLabel,
@@ -296,6 +342,7 @@ var ProviderAutocomplete = (_a) => {
296
342
  0 && (module.exports = {
297
343
  AsyncAutocomplete,
298
344
  Autocomplete,
345
+ CodesAutocomplete,
299
346
  OrganizationAutocomplete,
300
347
  ProviderAutocomplete,
301
348
  createFilterOptions
package/dist/index.mjs CHANGED
@@ -182,9 +182,54 @@ var AsyncAutocomplete = (_a) => {
182
182
  );
183
183
  };
184
184
 
185
+ // src/lib/CodesAutocomplete.tsx
186
+ import { avCodesApi } from "@availity/api-axios";
187
+ import { jsx as jsx3 } from "react/jsx-runtime";
188
+ var fetchCodes = (config) => __async(void 0, null, function* () {
189
+ const resp = yield avCodesApi.query(config);
190
+ return {
191
+ options: resp.data.codes,
192
+ hasMore: config.params.offset + config.params.limit < resp.data.totalCount,
193
+ offset: config.params.offset
194
+ };
195
+ });
196
+ var CodesAutocomplete = (_a) => {
197
+ var _b = _a, {
198
+ apiConfig = {},
199
+ queryOptions,
200
+ queryKey = "codes-autocomplete",
201
+ list,
202
+ watchParams
203
+ } = _b, rest = __objRest(_b, [
204
+ "apiConfig",
205
+ "queryOptions",
206
+ "queryKey",
207
+ "list",
208
+ "watchParams"
209
+ ]);
210
+ const handleLoadOptions = (offset, limit, inputValue) => __async(void 0, null, function* () {
211
+ const resp = yield fetchCodes(__spreadProps(__spreadValues({}, apiConfig), {
212
+ params: __spreadProps(__spreadValues({}, apiConfig.params), { list, offset, limit, q: inputValue })
213
+ }));
214
+ return resp;
215
+ });
216
+ const handleGetOptionLabel = (option) => [option.code, option.value].filter(Boolean).join(" - ");
217
+ return /* @__PURE__ */ jsx3(
218
+ AsyncAutocomplete,
219
+ __spreadProps(__spreadValues({
220
+ getOptionLabel: handleGetOptionLabel,
221
+ queryKey,
222
+ queryOptions: __spreadValues({ enabled: !!list }, queryOptions),
223
+ watchParams: __spreadValues({ list }, watchParams)
224
+ }, rest), {
225
+ loadOptions: handleLoadOptions
226
+ })
227
+ );
228
+ };
229
+
185
230
  // src/lib/OrganizationAutocomplete.tsx
186
231
  import { avOrganizationsApi } from "@availity/api-axios";
187
- import { jsx as jsx3 } from "react/jsx-runtime";
232
+ import { jsx as jsx4 } from "react/jsx-runtime";
188
233
  var fetchOrgs = (config) => __async(void 0, null, function* () {
189
234
  const resp = yield avOrganizationsApi.getOrganizations(config);
190
235
  return {
@@ -206,7 +251,7 @@ var OrganizationAutocomplete = (_a) => {
206
251
  return resp;
207
252
  });
208
253
  const handleGetOptionLabel = (org) => org.name;
209
- return /* @__PURE__ */ jsx3(
254
+ return /* @__PURE__ */ jsx4(
210
255
  AsyncAutocomplete,
211
256
  __spreadProps(__spreadValues({
212
257
  getOptionLabel: handleGetOptionLabel,
@@ -219,7 +264,7 @@ var OrganizationAutocomplete = (_a) => {
219
264
 
220
265
  // src/lib/ProviderAutocomplete.tsx
221
266
  import { avProvidersApi } from "@availity/api-axios";
222
- import { jsx as jsx4 } from "react/jsx-runtime";
267
+ import { jsx as jsx5 } from "react/jsx-runtime";
223
268
  var fetchProviders = (customerId, config) => __async(void 0, null, function* () {
224
269
  const resp = yield avProvidersApi.getProviders(customerId, config);
225
270
  return {
@@ -245,7 +290,7 @@ var ProviderAutocomplete = (_a) => {
245
290
  return resp;
246
291
  });
247
292
  const handleGetOptionLabel = (option) => option.uiDisplayName;
248
- return /* @__PURE__ */ jsx4(
293
+ return /* @__PURE__ */ jsx5(
249
294
  AsyncAutocomplete,
250
295
  __spreadProps(__spreadValues({
251
296
  getOptionLabel: handleGetOptionLabel,
@@ -260,6 +305,7 @@ var ProviderAutocomplete = (_a) => {
260
305
  export {
261
306
  AsyncAutocomplete,
262
307
  Autocomplete,
308
+ CodesAutocomplete,
263
309
  OrganizationAutocomplete,
264
310
  ProviderAutocomplete,
265
311
  createFilterOptions
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@availity/mui-autocomplete",
3
- "version": "0.9.8",
3
+ "version": "0.9.10",
4
4
  "description": "Availity MUI Autocomplete Component - part of the @availity/element design system",
5
5
  "keywords": [
6
6
  "react",
@@ -36,9 +36,9 @@
36
36
  "@mui/types": "^7.2.14"
37
37
  },
38
38
  "devDependencies": {
39
- "@availity/api-axios": "^9.0.4",
40
- "@availity/mui-form-utils": "^0.16.4",
41
- "@availity/mui-textfield": "^0.6.18",
39
+ "@availity/api-axios": "^9.0.6",
40
+ "@availity/mui-form-utils": "^0.16.5",
41
+ "@availity/mui-textfield": "^0.6.19",
42
42
  "@mui/material": "^5.15.15",
43
43
  "@tanstack/react-query": "^4.36.1",
44
44
  "react": "18.2.0",
@@ -48,8 +48,8 @@
48
48
  },
49
49
  "peerDependencies": {
50
50
  "@availity/api-axios": "^8.0.7",
51
- "@availity/mui-form-utils": "^0.16.4",
52
- "@availity/mui-textfield": "^0.6.18",
51
+ "@availity/mui-form-utils": "^0.16.5",
52
+ "@availity/mui-textfield": "^0.6.19",
53
53
  "@mui/material": "^5.11.9",
54
54
  "@tanstack/react-query": "^4.36.1",
55
55
  "react": ">=16.3.0"
package/src/index.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  export * from './lib/Autocomplete';
2
2
  export * from './lib/AsyncAutocomplete';
3
+ export * from './lib/CodesAutocomplete';
3
4
  export * from './lib/OrganizationAutocomplete';
4
5
  export * from './lib/ProviderAutocomplete';
@@ -29,6 +29,7 @@ export interface CodesAutocompleteProps<
29
29
  Optional<AsyncAutocompleteProps<Option, Multiple, DisableClearable, FreeSolo, ChipComponent>, 'queryKey'>,
30
30
  'loadOptions'
31
31
  > {
32
+ /** The code list id. */
32
33
  list: string;
33
34
  /** Config passed to the AvCodesApi.query function */
34
35
  apiConfig?: ApiConfig;
@@ -32,6 +32,7 @@ export interface OrgAutocompleteProps<
32
32
  Optional<AsyncAutocompleteProps<Option, Multiple, DisableClearable, FreeSolo, ChipComponent>, 'queryKey'>,
33
33
  'loadOptions'
34
34
  > {
35
+ /** Axios ApiConfig */
35
36
  apiConfig?: ApiConfig;
36
37
  }
37
38