@availity/mui-autocomplete 1.0.2 → 1.0.3-beta.0

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,22 @@
2
2
 
3
3
  This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
4
4
 
5
+ ## [1.0.3-beta.0](https://github.com/Availity/element/compare/@availity/mui-autocomplete@1.0.2...@availity/mui-autocomplete@1.0.3-beta.0) (2025-03-06)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * **mui-autocomplete:** reset value on blur when filter returns no results ([29e3d8f](https://github.com/Availity/element/commit/29e3d8f9605d7d1b8886187dfe27557e5e830427))
11
+
12
+ ## [1.0.3-alpha.0](https://github.com/Availity/element/compare/@availity/mui-autocomplete@1.0.2...@availity/mui-autocomplete@1.0.3-alpha.0) (2025-03-06)
13
+
14
+
15
+ ### Bug Fixes
16
+
17
+ * **mui-autocomplete:** reset value on blur when filter returns no results ([29e3d8f](https://github.com/Availity/element/commit/29e3d8f9605d7d1b8886187dfe27557e5e830427))
18
+
19
+ ## [1.0.3](https://github.com/Availity/element/compare/@availity/mui-autocomplete@1.0.2...@availity/mui-autocomplete@1.0.3) (2025-03-06)
20
+
5
21
  ## [1.0.2](https://github.com/Availity/element/compare/@availity/mui-autocomplete@1.0.1...@availity/mui-autocomplete@1.0.2) (2025-03-03)
6
22
 
7
23
 
package/dist/index.js CHANGED
@@ -197,7 +197,7 @@ var AsyncAutocomplete = (_a) => {
197
197
  }, queryOptions));
198
198
  const options = (data == null ? void 0 : data.pages) ? data.pages.map((page) => page.options).flat() : [];
199
199
  const handleOnInputChange = (event, value, reason) => {
200
- if (reason === "clear") {
200
+ if (reason === "clear" || reason === "blur") {
201
201
  setInputValue(event.target.value);
202
202
  }
203
203
  if (onInputChange) onInputChange(event, value, reason);
package/dist/index.mjs CHANGED
@@ -161,7 +161,7 @@ var AsyncAutocomplete = (_a) => {
161
161
  }, queryOptions));
162
162
  const options = (data == null ? void 0 : data.pages) ? data.pages.map((page) => page.options).flat() : [];
163
163
  const handleOnInputChange = (event, value, reason) => {
164
- if (reason === "clear") {
164
+ if (reason === "clear" || reason === "blur") {
165
165
  setInputValue(event.target.value);
166
166
  }
167
167
  if (onInputChange) onInputChange(event, value, reason);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@availity/mui-autocomplete",
3
- "version": "1.0.2",
3
+ "version": "1.0.3-beta.0",
4
4
  "description": "Availity MUI Autocomplete Component - part of the @availity/element design system",
5
5
  "keywords": [
6
6
  "react",
@@ -35,6 +35,8 @@ export interface AsyncAutocompleteProps<
35
35
  debounceTimeout?: number;
36
36
  }
37
37
 
38
+ const shouldSetInputValue = (reason: string) => ['blur', 'clear'].includes(reason);
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 === 'clear') {
83
+ if (shouldSetInputValue(reason)) {
82
84
  setInputValue(event.target.value);
83
85
  }
84
86