@availity/mui-autocomplete 1.0.3-alpha.0 → 1.0.3
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 +1 -6
- package/dist/index.js +2 -1
- package/dist/index.mjs +2 -1
- package/package.json +1 -1
- package/src/lib/AsyncAutocomplete.tsx +3 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,12 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
|
|
4
4
|
|
|
5
|
-
## [1.0.3
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
### Bug Fixes
|
|
9
|
-
|
|
10
|
-
* **mui-autocomplete:** refetch on blur when filter returns no results ([08cb7b6](https://github.com/Availity/element/commit/08cb7b63d055518fd02adb740da9aeb02d146f5f))
|
|
5
|
+
## [1.0.3](https://github.com/Availity/element/compare/@availity/mui-autocomplete@1.0.2...@availity/mui-autocomplete@1.0.3) (2025-03-06)
|
|
11
6
|
|
|
12
7
|
## [1.0.2](https://github.com/Availity/element/compare/@availity/mui-autocomplete@1.0.1...@availity/mui-autocomplete@1.0.2) (2025-03-03)
|
|
13
8
|
|
package/dist/index.js
CHANGED
|
@@ -158,6 +158,7 @@ var useDebounce = (value, delay) => {
|
|
|
158
158
|
|
|
159
159
|
// src/lib/AsyncAutocomplete.tsx
|
|
160
160
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
161
|
+
var shouldSetInputValue = (reason) => Boolean(reason === "clear");
|
|
161
162
|
var AsyncAutocomplete = (_a) => {
|
|
162
163
|
var _b = _a, {
|
|
163
164
|
loadOptions,
|
|
@@ -197,7 +198,7 @@ var AsyncAutocomplete = (_a) => {
|
|
|
197
198
|
}, queryOptions));
|
|
198
199
|
const options = (data == null ? void 0 : data.pages) ? data.pages.map((page) => page.options).flat() : [];
|
|
199
200
|
const handleOnInputChange = (event, value, reason) => {
|
|
200
|
-
if (reason
|
|
201
|
+
if (shouldSetInputValue(reason)) {
|
|
201
202
|
setInputValue(event.target.value);
|
|
202
203
|
}
|
|
203
204
|
if (onInputChange) onInputChange(event, value, reason);
|
package/dist/index.mjs
CHANGED
|
@@ -122,6 +122,7 @@ var useDebounce = (value, delay) => {
|
|
|
122
122
|
|
|
123
123
|
// src/lib/AsyncAutocomplete.tsx
|
|
124
124
|
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
125
|
+
var shouldSetInputValue = (reason) => Boolean(reason === "clear");
|
|
125
126
|
var AsyncAutocomplete = (_a) => {
|
|
126
127
|
var _b = _a, {
|
|
127
128
|
loadOptions,
|
|
@@ -161,7 +162,7 @@ var AsyncAutocomplete = (_a) => {
|
|
|
161
162
|
}, queryOptions));
|
|
162
163
|
const options = (data == null ? void 0 : data.pages) ? data.pages.map((page) => page.options).flat() : [];
|
|
163
164
|
const handleOnInputChange = (event, value, reason) => {
|
|
164
|
-
if (reason
|
|
165
|
+
if (shouldSetInputValue(reason)) {
|
|
165
166
|
setInputValue(event.target.value);
|
|
166
167
|
}
|
|
167
168
|
if (onInputChange) onInputChange(event, value, reason);
|
package/package.json
CHANGED
|
@@ -35,6 +35,8 @@ export interface AsyncAutocompleteProps<
|
|
|
35
35
|
debounceTimeout?: number;
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
+
const shouldSetInputValue = (reason: string) => Boolean(reason === 'clear');
|
|
39
|
+
|
|
38
40
|
export const AsyncAutocomplete = <
|
|
39
41
|
Option,
|
|
40
42
|
Multiple extends boolean | undefined = false,
|
|
@@ -78,7 +80,7 @@ export const AsyncAutocomplete = <
|
|
|
78
80
|
value: string,
|
|
79
81
|
reason: AutocompleteInputChangeReason
|
|
80
82
|
) => {
|
|
81
|
-
if (reason
|
|
83
|
+
if (shouldSetInputValue(reason)) {
|
|
82
84
|
setInputValue(event.target.value);
|
|
83
85
|
}
|
|
84
86
|
|