@availity/mui-autocomplete 1.0.3 → 1.0.4

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,44 @@
2
2
 
3
3
  This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
4
4
 
5
+ ## [1.0.4](https://github.com/Availity/element/compare/@availity/mui-autocomplete@1.0.3...@availity/mui-autocomplete@1.0.4) (2025-03-06)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * **mui-autocomplete:** reset value on blur to account for search ([a4af887](https://github.com/Availity/element/commit/a4af88733fd336282e002d3f2aa343fe105fc388))
11
+ * **mui-autocomplete:** reset value on blur to account for search ([3ba4edd](https://github.com/Availity/element/commit/3ba4eddde9cb36ef5cd29c28c1030ab8fa6f0bac))
12
+ * **mui-autocomplete:** reset value on blur to account for search ([1998342](https://github.com/Availity/element/commit/199834225ab2f93f9ab0c81e1c66fa0f70d248b7))
13
+ * **mui-autocomplete:** reset value on blur when filter returns no results ([29e3d8f](https://github.com/Availity/element/commit/29e3d8f9605d7d1b8886187dfe27557e5e830427))
14
+
15
+ ## [1.0.3-beta.2](https://github.com/Availity/element/compare/@availity/mui-autocomplete@1.0.3-beta.1...@availity/mui-autocomplete@1.0.3-beta.2) (2025-03-06)
16
+
17
+
18
+ ### Bug Fixes
19
+
20
+ * **mui-autocomplete:** reset value on blur to account for search ([3ba4edd](https://github.com/Availity/element/commit/3ba4eddde9cb36ef5cd29c28c1030ab8fa6f0bac))
21
+
22
+ ## [1.0.3-beta.1](https://github.com/Availity/element/compare/@availity/mui-autocomplete@1.0.3-beta.0...@availity/mui-autocomplete@1.0.3-beta.1) (2025-03-06)
23
+
24
+
25
+ ### Bug Fixes
26
+
27
+ * **mui-autocomplete:** reset value on blur to account for search ([1998342](https://github.com/Availity/element/commit/199834225ab2f93f9ab0c81e1c66fa0f70d248b7))
28
+
29
+ ## [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)
30
+
31
+
32
+ ### Bug Fixes
33
+
34
+ * **mui-autocomplete:** reset value on blur when filter returns no results ([29e3d8f](https://github.com/Availity/element/commit/29e3d8f9605d7d1b8886187dfe27557e5e830427))
35
+
36
+ ## [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)
37
+
38
+
39
+ ### Bug Fixes
40
+
41
+ * **mui-autocomplete:** reset value on blur when filter returns no results ([29e3d8f](https://github.com/Availity/element/commit/29e3d8f9605d7d1b8886187dfe27557e5e830427))
42
+
5
43
  ## [1.0.3](https://github.com/Availity/element/compare/@availity/mui-autocomplete@1.0.2...@availity/mui-autocomplete@1.0.3) (2025-03-06)
6
44
 
7
45
  ## [1.0.2](https://github.com/Availity/element/compare/@availity/mui-autocomplete@1.0.1...@availity/mui-autocomplete@1.0.2) (2025-03-03)
package/dist/index.js CHANGED
@@ -158,7 +158,6 @@ 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");
162
161
  var AsyncAutocomplete = (_a) => {
163
162
  var _b = _a, {
164
163
  loadOptions,
@@ -198,8 +197,10 @@ var AsyncAutocomplete = (_a) => {
198
197
  }, queryOptions));
199
198
  const options = (data == null ? void 0 : data.pages) ? data.pages.map((page) => page.options).flat() : [];
200
199
  const handleOnInputChange = (event, value, reason) => {
201
- if (shouldSetInputValue(reason)) {
200
+ if (reason === "clear") {
202
201
  setInputValue(event.target.value);
202
+ } else if (reason === "blur") {
203
+ setInputValue(value);
203
204
  }
204
205
  if (onInputChange) onInputChange(event, value, reason);
205
206
  };
package/dist/index.mjs CHANGED
@@ -122,7 +122,6 @@ 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");
126
125
  var AsyncAutocomplete = (_a) => {
127
126
  var _b = _a, {
128
127
  loadOptions,
@@ -162,8 +161,10 @@ var AsyncAutocomplete = (_a) => {
162
161
  }, queryOptions));
163
162
  const options = (data == null ? void 0 : data.pages) ? data.pages.map((page) => page.options).flat() : [];
164
163
  const handleOnInputChange = (event, value, reason) => {
165
- if (shouldSetInputValue(reason)) {
164
+ if (reason === "clear") {
166
165
  setInputValue(event.target.value);
166
+ } else if (reason === "blur") {
167
+ setInputValue(value);
167
168
  }
168
169
  if (onInputChange) onInputChange(event, value, reason);
169
170
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@availity/mui-autocomplete",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "description": "Availity MUI Autocomplete Component - part of the @availity/element design system",
5
5
  "keywords": [
6
6
  "react",
@@ -35,8 +35,6 @@ export interface AsyncAutocompleteProps<
35
35
  debounceTimeout?: number;
36
36
  }
37
37
 
38
- const shouldSetInputValue = (reason: string) => Boolean(reason === 'clear');
39
-
40
38
  export const AsyncAutocomplete = <
41
39
  Option,
42
40
  Multiple extends boolean | undefined = false,
@@ -80,8 +78,10 @@ export const AsyncAutocomplete = <
80
78
  value: string,
81
79
  reason: AutocompleteInputChangeReason
82
80
  ) => {
83
- if (shouldSetInputValue(reason)) {
81
+ if (reason === 'clear') {
84
82
  setInputValue(event.target.value);
83
+ } else if (reason === 'blur') {
84
+ setInputValue(value);
85
85
  }
86
86
 
87
87
  if (onInputChange) onInputChange(event, value, reason);