@availity/mui-controlled-form 1.2.0 → 1.2.1

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,18 @@
2
2
 
3
3
  This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
4
4
 
5
+ ## [1.2.1](https://github.com/Availity/element/compare/@availity/mui-controlled-form@1.2.0...@availity/mui-controlled-form@1.2.1) (2025-04-04)
6
+
7
+ ### Dependency Updates
8
+
9
+ * `mui-autocomplete` updated to version `1.2.0`
10
+ * `mui-datepicker` updated to version `1.2.0`
11
+ * `mui-textfield` updated to version `1.2.0`
12
+
13
+ ### Bug Fixes
14
+
15
+ * **mui-controlled-form:** allow defaultOptions on multiple AsyncAutocomplete ([4dcb5bc](https://github.com/Availity/element/commit/4dcb5bc4d1a02a54b5a2d0540e15d77a07aa7c02))
16
+
5
17
  ## [1.2.0](https://github.com/Availity/element/compare/@availity/mui-controlled-form@1.1.3...@availity/mui-controlled-form@1.2.0) (2025-03-31)
6
18
 
7
19
  ### Dependency Updates
package/dist/index.js CHANGED
@@ -145,10 +145,10 @@ var ControlledAsyncAutocomplete = (_a) => {
145
145
  loadOptions: (offset, limit, inputValue) => __async(void 0, null, function* () {
146
146
  const { options, hasMore, offset: returnedOffsetValue } = yield rest.loadOptions(offset, limit, inputValue);
147
147
  if (defaultToFirstOption && offset === 0) {
148
- setValue(name, options[0]);
148
+ setValue(name, rest.multiple ? [options[0]] : options[0]);
149
149
  }
150
150
  if (defaultToOnlyOption && offset === 0 && options.length === 1) {
151
- setValue(name, options[0]);
151
+ setValue(name, rest.multiple ? [options[0]] : options[0]);
152
152
  }
153
153
  return { options, hasMore, offset: returnedOffsetValue };
154
154
  })
package/dist/index.mjs CHANGED
@@ -109,10 +109,10 @@ var ControlledAsyncAutocomplete = (_a) => {
109
109
  loadOptions: (offset, limit, inputValue) => __async(void 0, null, function* () {
110
110
  const { options, hasMore, offset: returnedOffsetValue } = yield rest.loadOptions(offset, limit, inputValue);
111
111
  if (defaultToFirstOption && offset === 0) {
112
- setValue(name, options[0]);
112
+ setValue(name, rest.multiple ? [options[0]] : options[0]);
113
113
  }
114
114
  if (defaultToOnlyOption && offset === 0 && options.length === 1) {
115
- setValue(name, options[0]);
115
+ setValue(name, rest.multiple ? [options[0]] : options[0]);
116
116
  }
117
117
  return { options, hasMore, offset: returnedOffsetValue };
118
118
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@availity/mui-controlled-form",
3
- "version": "1.2.0",
3
+ "version": "1.2.1",
4
4
  "description": "Availity MUI/react-hook-form controlled form components - part of the @availity/element design system",
5
5
  "keywords": [
6
6
  "react",
@@ -40,11 +40,11 @@
40
40
  "publish:canary": "yarn npm publish --access public --tag canary"
41
41
  },
42
42
  "dependencies": {
43
- "@availity/mui-autocomplete": "^1.0.9",
43
+ "@availity/mui-autocomplete": "^1.0.10",
44
44
  "@availity/mui-checkbox": "^1.0.1",
45
- "@availity/mui-datepicker": "^1.0.6",
45
+ "@availity/mui-datepicker": "^1.0.7",
46
46
  "@availity/mui-form-utils": "^1.1.0",
47
- "@availity/mui-textfield": "^1.1.1",
47
+ "@availity/mui-textfield": "^1.1.2",
48
48
  "react-hook-form": "^7.54.2"
49
49
  },
50
50
  "devDependencies": {
@@ -76,10 +76,12 @@ export const _ControlledAsyncAutoComplete: StoryObj<typeof ControlledAsyncAutoco
76
76
  limit: 10,
77
77
  queryKey: 'example',
78
78
  rules: { required: 'This is required.' },
79
+ defaultToFirstOption: true,
80
+ disableClearable: true,
79
81
  },
80
82
  };
81
83
 
82
- export const _ControlledAsyncAutoCompleteDefaultOption: StoryObj<typeof ControlledAsyncAutocomplete> = {
84
+ export const _ControlledAsyncAutoCompleteDefaultToOnlyOption: StoryObj<typeof ControlledAsyncAutocomplete> = {
83
85
  render: (args) => {
84
86
  const methods = useForm();
85
87
 
@@ -113,10 +115,10 @@ export const _ControlledAsyncAutoCompleteDefaultOption: StoryObj<typeof Controll
113
115
  FieldProps: { label: 'Async Select', helperText: 'Helper Text', fullWidth: false, required: true },
114
116
  getOptionLabel: (val: Option) => val.label,
115
117
  loadOptions,
116
- limit: 10,
117
- queryKey: 'example',
118
+ limit: 1,
119
+ queryKey: 'example2',
118
120
  rules: { required: 'This is required.' },
119
- defaultToFirstOption: true,
121
+ defaultToOnlyOption: true,
120
122
  disableClearable: true,
121
123
  },
122
124
  };
@@ -71,11 +71,11 @@ export const ControlledAsyncAutocomplete = <
71
71
  const { options, hasMore, offset: returnedOffsetValue } = await rest.loadOptions(offset, limit, inputValue);
72
72
 
73
73
  if (defaultToFirstOption && offset === 0) {
74
- setValue(name, options[0]);
74
+ setValue(name, rest.multiple ? [options[0]] : options[0]);
75
75
  }
76
76
 
77
77
  if (defaultToOnlyOption && offset === 0 && options.length === 1) {
78
- setValue(name, options[0]);
78
+ setValue(name, rest.multiple ? [options[0]] : options[0]);
79
79
  }
80
80
 
81
81
  return { options, hasMore, offset: returnedOffsetValue };