@availity/mui-controlled-form 1.2.9 → 1.3.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 +21 -0
- package/dist/index.d.mts +39 -24
- package/dist/index.d.ts +39 -24
- package/dist/index.js +192 -196
- package/dist/index.mjs +192 -196
- package/package.json +5 -5
- package/src/lib/AsyncAutocomplete.tsx +13 -6
- package/src/lib/Autocomplete.tsx +10 -6
- package/src/lib/Checkbox.tsx +8 -7
- package/src/lib/CodesAutocomplete.tsx +15 -20
- package/src/lib/Datepicker.stories.tsx +61 -5
- package/src/lib/Datepicker.tsx +13 -7
- package/src/lib/Input.tsx +9 -5
- package/src/lib/OrganizationAutocomplete.tsx +15 -20
- package/src/lib/ProviderAutocomplete.tsx +12 -20
- package/src/lib/RadioGroup.tsx +12 -5
- package/src/lib/Select.tsx +12 -5
- package/src/lib/TextField.tsx +9 -5
- package/src/lib/Types.tsx +15 -1
package/dist/index.mjs
CHANGED
|
@@ -64,7 +64,8 @@ var ControlledAsyncAutocomplete = (_a) => {
|
|
|
64
64
|
value,
|
|
65
65
|
FieldProps,
|
|
66
66
|
defaultToFirstOption,
|
|
67
|
-
defaultToOnlyOption
|
|
67
|
+
defaultToOnlyOption,
|
|
68
|
+
transform
|
|
68
69
|
} = _b, rest = __objRest(_b, [
|
|
69
70
|
"name",
|
|
70
71
|
"onBlur",
|
|
@@ -74,7 +75,8 @@ var ControlledAsyncAutocomplete = (_a) => {
|
|
|
74
75
|
"value",
|
|
75
76
|
"FieldProps",
|
|
76
77
|
"defaultToFirstOption",
|
|
77
|
-
"defaultToOnlyOption"
|
|
78
|
+
"defaultToOnlyOption",
|
|
79
|
+
"transform"
|
|
78
80
|
]);
|
|
79
81
|
const { setValue } = useFormContext();
|
|
80
82
|
return /* @__PURE__ */ jsx(
|
|
@@ -84,40 +86,44 @@ var ControlledAsyncAutocomplete = (_a) => {
|
|
|
84
86
|
defaultValue: rest.defaultValue,
|
|
85
87
|
rules: __spreadValues({ onBlur, onChange, shouldUnregister, value }, rules),
|
|
86
88
|
shouldUnregister,
|
|
87
|
-
render: ({ field: { onChange: onChange2, value: value2, onBlur: onBlur2, ref }, fieldState: { error } }) =>
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
error
|
|
96
|
-
/* @__PURE__ */
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
89
|
+
render: ({ field: { onChange: onChange2, value: value2, onBlur: onBlur2, ref }, fieldState: { error } }) => {
|
|
90
|
+
var _a2, _b2, _c;
|
|
91
|
+
return /* @__PURE__ */ jsx(
|
|
92
|
+
AsyncAutocomplete,
|
|
93
|
+
__spreadProps(__spreadValues({}, rest), {
|
|
94
|
+
FieldProps: __spreadProps(__spreadValues({
|
|
95
|
+
required: typeof rules.required === "object" ? rules.required.value : !!rules.required
|
|
96
|
+
}, FieldProps), {
|
|
97
|
+
error: !!error,
|
|
98
|
+
helperText: (error == null ? void 0 : error.message) ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
99
|
+
error.message,
|
|
100
|
+
/* @__PURE__ */ jsx("br", {}),
|
|
101
|
+
FieldProps == null ? void 0 : FieldProps.helperText
|
|
102
|
+
] }) : FieldProps == null ? void 0 : FieldProps.helperText,
|
|
103
|
+
inputRef: ref
|
|
104
|
+
}),
|
|
105
|
+
onChange: (event, value3, reason) => {
|
|
106
|
+
var _a3, _b3, _c2, _d;
|
|
107
|
+
if (reason === "clear") {
|
|
108
|
+
onChange2((_b3 = (_a3 = transform == null ? void 0 : transform.output) == null ? void 0 : _a3.call(transform, null)) != null ? _b3 : null);
|
|
109
|
+
}
|
|
110
|
+
onChange2((_d = (_c2 = transform == null ? void 0 : transform.output) == null ? void 0 : _c2.call(transform, value3)) != null ? _d : value3);
|
|
111
|
+
},
|
|
112
|
+
onBlur: onBlur2,
|
|
113
|
+
value: (_c = (_b2 = (_a2 = transform == null ? void 0 : transform.input) == null ? void 0 : _a2.call(transform, value2)) != null ? _b2 : value2) != null ? _c : null,
|
|
114
|
+
loadOptions: (offset, limit, inputValue) => __async(void 0, null, function* () {
|
|
115
|
+
const { options, hasMore, offset: returnedOffsetValue } = yield rest.loadOptions(offset, limit, inputValue);
|
|
116
|
+
if (defaultToFirstOption && offset === 0) {
|
|
117
|
+
setValue(name, rest.multiple ? [options[0]] : options[0]);
|
|
118
|
+
}
|
|
119
|
+
if (defaultToOnlyOption && offset === 0 && options.length === 1) {
|
|
120
|
+
setValue(name, rest.multiple ? [options[0]] : options[0]);
|
|
121
|
+
}
|
|
122
|
+
return { options, hasMore, offset: returnedOffsetValue };
|
|
123
|
+
})
|
|
118
124
|
})
|
|
119
|
-
|
|
120
|
-
|
|
125
|
+
);
|
|
126
|
+
}
|
|
121
127
|
}
|
|
122
128
|
);
|
|
123
129
|
};
|
|
@@ -135,7 +141,8 @@ var ControlledAutocomplete = (_a) => {
|
|
|
135
141
|
onBlur,
|
|
136
142
|
onChange,
|
|
137
143
|
shouldUnregister,
|
|
138
|
-
value
|
|
144
|
+
value,
|
|
145
|
+
transform
|
|
139
146
|
} = _b, rest = __objRest(_b, [
|
|
140
147
|
"name",
|
|
141
148
|
"FieldProps",
|
|
@@ -144,7 +151,8 @@ var ControlledAutocomplete = (_a) => {
|
|
|
144
151
|
"onBlur",
|
|
145
152
|
"onChange",
|
|
146
153
|
"shouldUnregister",
|
|
147
|
-
"value"
|
|
154
|
+
"value",
|
|
155
|
+
"transform"
|
|
148
156
|
]);
|
|
149
157
|
return /* @__PURE__ */ jsx2(
|
|
150
158
|
Controller2,
|
|
@@ -158,30 +166,34 @@ var ControlledAutocomplete = (_a) => {
|
|
|
158
166
|
value
|
|
159
167
|
}, rules),
|
|
160
168
|
shouldUnregister,
|
|
161
|
-
render: ({ field: { onChange: onChange2, value: value2, onBlur: onBlur2, ref }, fieldState: { error } }) =>
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
error
|
|
170
|
-
/* @__PURE__ */
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
169
|
+
render: ({ field: { onChange: onChange2, value: value2, onBlur: onBlur2, ref }, fieldState: { error } }) => {
|
|
170
|
+
var _a2, _b2, _c;
|
|
171
|
+
return /* @__PURE__ */ jsx2(
|
|
172
|
+
Autocomplete,
|
|
173
|
+
__spreadProps(__spreadValues({}, rest), {
|
|
174
|
+
FieldProps: __spreadProps(__spreadValues({
|
|
175
|
+
required: typeof rules.required === "object" ? rules.required.value : !!rules.required
|
|
176
|
+
}, FieldProps), {
|
|
177
|
+
error: !!error,
|
|
178
|
+
helperText: (error == null ? void 0 : error.message) ? /* @__PURE__ */ jsxs2(Fragment2, { children: [
|
|
179
|
+
error.message,
|
|
180
|
+
/* @__PURE__ */ jsx2("br", {}),
|
|
181
|
+
FieldProps == null ? void 0 : FieldProps.helperText
|
|
182
|
+
] }) : FieldProps == null ? void 0 : FieldProps.helperText,
|
|
183
|
+
inputRef: ref
|
|
184
|
+
}),
|
|
185
|
+
onChange: (event, value3, reason) => {
|
|
186
|
+
var _a3, _b3, _c2, _d;
|
|
187
|
+
if (reason === "clear") {
|
|
188
|
+
onChange2((_b3 = (_a3 = transform == null ? void 0 : transform.output) == null ? void 0 : _a3.call(transform, null)) != null ? _b3 : null);
|
|
189
|
+
}
|
|
190
|
+
onChange2((_d = (_c2 = transform == null ? void 0 : transform.output) == null ? void 0 : _c2.call(transform, value3)) != null ? _d : value3);
|
|
191
|
+
},
|
|
192
|
+
onBlur: onBlur2,
|
|
193
|
+
value: (_c = (_b2 = (_a2 = transform == null ? void 0 : transform.input) == null ? void 0 : _a2.call(transform, value2)) != null ? _b2 : value2) != null ? _c : null
|
|
194
|
+
})
|
|
195
|
+
);
|
|
196
|
+
}
|
|
185
197
|
}
|
|
186
198
|
);
|
|
187
199
|
};
|
|
@@ -199,7 +211,8 @@ var ControlledCheckbox = (_a) => {
|
|
|
199
211
|
value,
|
|
200
212
|
defaultValue = false,
|
|
201
213
|
rules = {},
|
|
202
|
-
shouldUnregister
|
|
214
|
+
shouldUnregister,
|
|
215
|
+
transform
|
|
203
216
|
} = _b, rest = __objRest(_b, [
|
|
204
217
|
"name",
|
|
205
218
|
"disabled",
|
|
@@ -208,7 +221,8 @@ var ControlledCheckbox = (_a) => {
|
|
|
208
221
|
"value",
|
|
209
222
|
"defaultValue",
|
|
210
223
|
"rules",
|
|
211
|
-
"shouldUnregister"
|
|
224
|
+
"shouldUnregister",
|
|
225
|
+
"transform"
|
|
212
226
|
]);
|
|
213
227
|
return /* @__PURE__ */ jsx3(
|
|
214
228
|
Controller3,
|
|
@@ -223,15 +237,21 @@ var ControlledCheckbox = (_a) => {
|
|
|
223
237
|
shouldUnregister
|
|
224
238
|
}, rules),
|
|
225
239
|
shouldUnregister,
|
|
226
|
-
render: ({ field }) =>
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
240
|
+
render: ({ field }) => {
|
|
241
|
+
var _a2, _b2;
|
|
242
|
+
return /* @__PURE__ */ jsx3(
|
|
243
|
+
Checkbox,
|
|
244
|
+
__spreadProps(__spreadValues(__spreadValues({
|
|
245
|
+
required: typeof rules.required === "object" ? rules.required.value : !!rules.required
|
|
246
|
+
}, rest), field), {
|
|
247
|
+
checked: (_b2 = (_a2 = transform == null ? void 0 : transform.input) == null ? void 0 : _a2.call(transform, field.value)) != null ? _b2 : field.value,
|
|
248
|
+
onChange: (e) => {
|
|
249
|
+
var _a3, _b3;
|
|
250
|
+
return field.onChange((_b3 = (_a3 = transform == null ? void 0 : transform.output) == null ? void 0 : _a3.call(transform, e.target.checked)) != null ? _b3 : e.target.checked);
|
|
251
|
+
}
|
|
252
|
+
})
|
|
253
|
+
);
|
|
254
|
+
}
|
|
235
255
|
}
|
|
236
256
|
);
|
|
237
257
|
};
|
|
@@ -241,28 +261,12 @@ import { fetchCodes, handleGetCodesOptionLabel } from "@availity/mui-autocomplet
|
|
|
241
261
|
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
242
262
|
var ControlledCodesAutocomplete = (_a) => {
|
|
243
263
|
var _b = _a, {
|
|
244
|
-
name,
|
|
245
|
-
defaultValue,
|
|
246
|
-
onBlur,
|
|
247
|
-
onChange,
|
|
248
|
-
rules = {},
|
|
249
|
-
shouldUnregister,
|
|
250
|
-
value,
|
|
251
|
-
FieldProps,
|
|
252
264
|
apiConfig = {},
|
|
253
265
|
queryOptions,
|
|
254
266
|
queryKey = "codes-autocomplete",
|
|
255
267
|
list,
|
|
256
268
|
watchParams
|
|
257
269
|
} = _b, rest = __objRest(_b, [
|
|
258
|
-
"name",
|
|
259
|
-
"defaultValue",
|
|
260
|
-
"onBlur",
|
|
261
|
-
"onChange",
|
|
262
|
-
"rules",
|
|
263
|
-
"shouldUnregister",
|
|
264
|
-
"value",
|
|
265
|
-
"FieldProps",
|
|
266
270
|
"apiConfig",
|
|
267
271
|
"queryOptions",
|
|
268
272
|
"queryKey",
|
|
@@ -278,14 +282,6 @@ var ControlledCodesAutocomplete = (_a) => {
|
|
|
278
282
|
return /* @__PURE__ */ jsx4(
|
|
279
283
|
ControlledAsyncAutocomplete,
|
|
280
284
|
__spreadProps(__spreadValues({
|
|
281
|
-
name,
|
|
282
|
-
defaultValue,
|
|
283
|
-
onBlur,
|
|
284
|
-
onChange,
|
|
285
|
-
rules,
|
|
286
|
-
shouldUnregister,
|
|
287
|
-
value,
|
|
288
|
-
FieldProps,
|
|
289
285
|
getOptionLabel: handleGetCodesOptionLabel,
|
|
290
286
|
queryKey,
|
|
291
287
|
queryOptions: __spreadValues({ enabled: !!list }, queryOptions),
|
|
@@ -309,7 +305,8 @@ var ControlledDatepicker = (_a) => {
|
|
|
309
305
|
rules = {},
|
|
310
306
|
shouldUnregister,
|
|
311
307
|
value,
|
|
312
|
-
FieldProps
|
|
308
|
+
FieldProps,
|
|
309
|
+
transform
|
|
313
310
|
} = _b, rest = __objRest(_b, [
|
|
314
311
|
"name",
|
|
315
312
|
"defaultValue",
|
|
@@ -318,7 +315,8 @@ var ControlledDatepicker = (_a) => {
|
|
|
318
315
|
"rules",
|
|
319
316
|
"shouldUnregister",
|
|
320
317
|
"value",
|
|
321
|
-
"FieldProps"
|
|
318
|
+
"FieldProps",
|
|
319
|
+
"transform"
|
|
322
320
|
]);
|
|
323
321
|
return /* @__PURE__ */ jsx5(
|
|
324
322
|
Controller4,
|
|
@@ -332,27 +330,33 @@ var ControlledDatepicker = (_a) => {
|
|
|
332
330
|
value
|
|
333
331
|
}, rules),
|
|
334
332
|
shouldUnregister,
|
|
335
|
-
render: ({ field: { onChange: onChange2, value: value2, onBlur: onBlur2, ref }, fieldState: { error } }) =>
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
error
|
|
344
|
-
/* @__PURE__ */
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
333
|
+
render: ({ field: { onChange: onChange2, value: value2, onBlur: onBlur2, ref }, fieldState: { error } }) => {
|
|
334
|
+
var _a2, _b2, _c;
|
|
335
|
+
return /* @__PURE__ */ jsx5(
|
|
336
|
+
Datepicker,
|
|
337
|
+
__spreadProps(__spreadValues({}, rest), {
|
|
338
|
+
FieldProps: __spreadProps(__spreadValues({
|
|
339
|
+
required: typeof rules.required === "object" ? rules.required.value : !!rules.required
|
|
340
|
+
}, FieldProps), {
|
|
341
|
+
error: !!error,
|
|
342
|
+
helperText: error ? /* @__PURE__ */ jsxs3(Fragment3, { children: [
|
|
343
|
+
error.message,
|
|
344
|
+
/* @__PURE__ */ jsx5("br", {}),
|
|
345
|
+
FieldProps == null ? void 0 : FieldProps.helperText
|
|
346
|
+
] }) : FieldProps == null ? void 0 : FieldProps.helperText,
|
|
347
|
+
inputRef: ref,
|
|
348
|
+
inputProps: {
|
|
349
|
+
onBlur: onBlur2
|
|
350
|
+
}
|
|
351
|
+
}),
|
|
352
|
+
onChange: (e) => {
|
|
353
|
+
var _a3, _b3;
|
|
354
|
+
return onChange2((_b3 = (_a3 = transform == null ? void 0 : transform.output) == null ? void 0 : _a3.call(transform, e)) != null ? _b3 : e);
|
|
355
|
+
},
|
|
356
|
+
value: (_c = (_b2 = (_a2 = transform == null ? void 0 : transform.input) == null ? void 0 : _a2.call(transform, value2)) != null ? _b2 : value2) != null ? _c : null
|
|
357
|
+
})
|
|
358
|
+
);
|
|
359
|
+
}
|
|
356
360
|
}
|
|
357
361
|
);
|
|
358
362
|
};
|
|
@@ -370,7 +374,8 @@ var ControlledInput = (_a) => {
|
|
|
370
374
|
onChange,
|
|
371
375
|
rules = {},
|
|
372
376
|
shouldUnregister,
|
|
373
|
-
value
|
|
377
|
+
value,
|
|
378
|
+
transform
|
|
374
379
|
} = _b, rest = __objRest(_b, [
|
|
375
380
|
"name",
|
|
376
381
|
"defaultValue",
|
|
@@ -379,7 +384,8 @@ var ControlledInput = (_a) => {
|
|
|
379
384
|
"onChange",
|
|
380
385
|
"rules",
|
|
381
386
|
"shouldUnregister",
|
|
382
|
-
"value"
|
|
387
|
+
"value",
|
|
388
|
+
"transform"
|
|
383
389
|
]);
|
|
384
390
|
return /* @__PURE__ */ jsx6(
|
|
385
391
|
Controller5,
|
|
@@ -394,14 +400,22 @@ var ControlledInput = (_a) => {
|
|
|
394
400
|
shouldUnregister
|
|
395
401
|
}, rules),
|
|
396
402
|
shouldUnregister,
|
|
397
|
-
render: ({ field, fieldState: { error } }) =>
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
403
|
+
render: ({ field, fieldState: { error } }) => {
|
|
404
|
+
var _a2, _b2, _c;
|
|
405
|
+
return /* @__PURE__ */ jsx6(
|
|
406
|
+
Input,
|
|
407
|
+
__spreadProps(__spreadValues(__spreadValues({
|
|
408
|
+
required: typeof rules.required === "object" ? rules.required.value : !!rules.required
|
|
409
|
+
}, rest), field), {
|
|
410
|
+
onChange: (e) => {
|
|
411
|
+
var _a3, _b3;
|
|
412
|
+
return field.onChange((_b3 = (_a3 = transform == null ? void 0 : transform.output) == null ? void 0 : _a3.call(transform, e.target.value)) != null ? _b3 : e);
|
|
413
|
+
},
|
|
414
|
+
value: (_c = (_b2 = (_a2 = transform == null ? void 0 : transform.input) == null ? void 0 : _a2.call(transform, field.value)) != null ? _b2 : field.value) != null ? _c : "",
|
|
415
|
+
error: !!error
|
|
416
|
+
})
|
|
417
|
+
);
|
|
418
|
+
}
|
|
405
419
|
}
|
|
406
420
|
);
|
|
407
421
|
};
|
|
@@ -411,25 +425,9 @@ import { handleGetOrgOptionLabel, fetchOrgs } from "@availity/mui-autocomplete";
|
|
|
411
425
|
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
412
426
|
var ControlledOrganizationAutocomplete = (_a) => {
|
|
413
427
|
var _b = _a, {
|
|
414
|
-
name,
|
|
415
|
-
defaultValue,
|
|
416
|
-
onBlur,
|
|
417
|
-
onChange,
|
|
418
|
-
rules = {},
|
|
419
|
-
shouldUnregister,
|
|
420
|
-
value,
|
|
421
|
-
FieldProps,
|
|
422
428
|
queryKey = "org-autocomplete",
|
|
423
429
|
apiConfig = {}
|
|
424
430
|
} = _b, rest = __objRest(_b, [
|
|
425
|
-
"name",
|
|
426
|
-
"defaultValue",
|
|
427
|
-
"onBlur",
|
|
428
|
-
"onChange",
|
|
429
|
-
"rules",
|
|
430
|
-
"shouldUnregister",
|
|
431
|
-
"value",
|
|
432
|
-
"FieldProps",
|
|
433
431
|
"queryKey",
|
|
434
432
|
"apiConfig"
|
|
435
433
|
]);
|
|
@@ -440,14 +438,6 @@ var ControlledOrganizationAutocomplete = (_a) => {
|
|
|
440
438
|
return /* @__PURE__ */ jsx7(
|
|
441
439
|
ControlledAsyncAutocomplete,
|
|
442
440
|
__spreadProps(__spreadValues({
|
|
443
|
-
name,
|
|
444
|
-
defaultValue,
|
|
445
|
-
onBlur,
|
|
446
|
-
onChange,
|
|
447
|
-
rules,
|
|
448
|
-
shouldUnregister,
|
|
449
|
-
value,
|
|
450
|
-
FieldProps,
|
|
451
441
|
getOptionLabel: handleGetOrgOptionLabel,
|
|
452
442
|
queryKey
|
|
453
443
|
}, rest), {
|
|
@@ -461,26 +451,10 @@ import { handleGetProviderOptionLabel, fetchProviders } from "@availity/mui-auto
|
|
|
461
451
|
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
462
452
|
var ControlledProviderAutocomplete = (_a) => {
|
|
463
453
|
var _b = _a, {
|
|
464
|
-
name,
|
|
465
|
-
defaultValue,
|
|
466
|
-
onBlur,
|
|
467
|
-
onChange,
|
|
468
|
-
rules = {},
|
|
469
|
-
shouldUnregister,
|
|
470
|
-
value,
|
|
471
|
-
FieldProps,
|
|
472
454
|
apiConfig = {},
|
|
473
455
|
customerId,
|
|
474
456
|
queryKey = "prov-autocomplete"
|
|
475
457
|
} = _b, rest = __objRest(_b, [
|
|
476
|
-
"name",
|
|
477
|
-
"defaultValue",
|
|
478
|
-
"onBlur",
|
|
479
|
-
"onChange",
|
|
480
|
-
"rules",
|
|
481
|
-
"shouldUnregister",
|
|
482
|
-
"value",
|
|
483
|
-
"FieldProps",
|
|
484
458
|
"apiConfig",
|
|
485
459
|
"customerId",
|
|
486
460
|
"queryKey"
|
|
@@ -494,14 +468,6 @@ var ControlledProviderAutocomplete = (_a) => {
|
|
|
494
468
|
return /* @__PURE__ */ jsx8(
|
|
495
469
|
ControlledAsyncAutocomplete,
|
|
496
470
|
__spreadProps(__spreadValues({
|
|
497
|
-
name,
|
|
498
|
-
defaultValue,
|
|
499
|
-
onBlur,
|
|
500
|
-
onChange,
|
|
501
|
-
rules,
|
|
502
|
-
shouldUnregister,
|
|
503
|
-
value,
|
|
504
|
-
FieldProps,
|
|
505
471
|
getOptionLabel: handleGetProviderOptionLabel,
|
|
506
472
|
queryOptions: { enabled: !!customerId },
|
|
507
473
|
queryKey,
|
|
@@ -528,7 +494,8 @@ var ControlledRadioGroup = (_a) => {
|
|
|
528
494
|
required,
|
|
529
495
|
rules = {},
|
|
530
496
|
shouldUnregister,
|
|
531
|
-
value
|
|
497
|
+
value,
|
|
498
|
+
transform
|
|
532
499
|
} = _b, rest = __objRest(_b, [
|
|
533
500
|
"name",
|
|
534
501
|
"helperText",
|
|
@@ -539,7 +506,8 @@ var ControlledRadioGroup = (_a) => {
|
|
|
539
506
|
"required",
|
|
540
507
|
"rules",
|
|
541
508
|
"shouldUnregister",
|
|
542
|
-
"value"
|
|
509
|
+
"value",
|
|
510
|
+
"transform"
|
|
543
511
|
]);
|
|
544
512
|
return /* @__PURE__ */ jsx9(
|
|
545
513
|
Controller6,
|
|
@@ -550,6 +518,7 @@ var ControlledRadioGroup = (_a) => {
|
|
|
550
518
|
shouldUnregister,
|
|
551
519
|
render: (_a2) => {
|
|
552
520
|
var _b2 = _a2, { field: _c } = _b2, _d = _c, { disabled } = _d, field = __objRest(_d, ["disabled"]), { fieldState: { error } } = _b2;
|
|
521
|
+
var _a3, _b3, _c2;
|
|
553
522
|
return /* @__PURE__ */ jsxs4(
|
|
554
523
|
FormControl,
|
|
555
524
|
{
|
|
@@ -558,7 +527,16 @@ var ControlledRadioGroup = (_a) => {
|
|
|
558
527
|
required: !!required || (typeof rules.required === "object" ? rules.required.value : !!rules.required),
|
|
559
528
|
children: [
|
|
560
529
|
/* @__PURE__ */ jsx9(FormLabel, { children: label }),
|
|
561
|
-
/* @__PURE__ */ jsx9(
|
|
530
|
+
/* @__PURE__ */ jsx9(
|
|
531
|
+
RadioGroup,
|
|
532
|
+
__spreadValues(__spreadProps(__spreadValues({}, field), {
|
|
533
|
+
onChange: (e) => {
|
|
534
|
+
var _a4, _b4;
|
|
535
|
+
return field.onChange((_b4 = (_a4 = transform == null ? void 0 : transform.output) == null ? void 0 : _a4.call(transform, e.target.value)) != null ? _b4 : e);
|
|
536
|
+
},
|
|
537
|
+
value: (_c2 = (_b3 = (_a3 = transform == null ? void 0 : transform.input) == null ? void 0 : _a3.call(transform, field.value)) != null ? _b3 : field.value) != null ? _c2 : ""
|
|
538
|
+
}), rest)
|
|
539
|
+
),
|
|
562
540
|
/* @__PURE__ */ jsx9(FormHelperText, { children: (error == null ? void 0 : error.message) ? /* @__PURE__ */ jsxs4(Fragment4, { children: [
|
|
563
541
|
error.message,
|
|
564
542
|
/* @__PURE__ */ jsx9("br", {}),
|
|
@@ -585,7 +563,8 @@ var ControlledSelect = (_a) => {
|
|
|
585
563
|
onChange,
|
|
586
564
|
rules = {},
|
|
587
565
|
shouldUnregister,
|
|
588
|
-
value
|
|
566
|
+
value,
|
|
567
|
+
transform
|
|
589
568
|
} = _b, rest = __objRest(_b, [
|
|
590
569
|
"name",
|
|
591
570
|
"defaultValue",
|
|
@@ -594,7 +573,8 @@ var ControlledSelect = (_a) => {
|
|
|
594
573
|
"onChange",
|
|
595
574
|
"rules",
|
|
596
575
|
"shouldUnregister",
|
|
597
|
-
"value"
|
|
576
|
+
"value",
|
|
577
|
+
"transform"
|
|
598
578
|
]);
|
|
599
579
|
return /* @__PURE__ */ jsx10(
|
|
600
580
|
Controller7,
|
|
@@ -609,14 +589,22 @@ var ControlledSelect = (_a) => {
|
|
|
609
589
|
shouldUnregister
|
|
610
590
|
}, rules),
|
|
611
591
|
shouldUnregister,
|
|
612
|
-
render: ({ field, fieldState: { error } }) =>
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
592
|
+
render: ({ field, fieldState: { error } }) => {
|
|
593
|
+
var _a2, _b2, _c;
|
|
594
|
+
return /* @__PURE__ */ jsx10(
|
|
595
|
+
Select,
|
|
596
|
+
__spreadProps(__spreadValues(__spreadValues({
|
|
597
|
+
required: typeof rules.required === "object" ? rules.required.value : !!rules.required
|
|
598
|
+
}, rest), field), {
|
|
599
|
+
onChange: (e) => {
|
|
600
|
+
var _a3, _b3;
|
|
601
|
+
return field.onChange((_b3 = (_a3 = transform == null ? void 0 : transform.output) == null ? void 0 : _a3.call(transform, e.target.value)) != null ? _b3 : e);
|
|
602
|
+
},
|
|
603
|
+
value: (_c = (_b2 = (_a2 = transform == null ? void 0 : transform.input) == null ? void 0 : _a2.call(transform, field.value)) != null ? _b2 : field.value) != null ? _c : "",
|
|
604
|
+
error: !!error
|
|
605
|
+
})
|
|
606
|
+
);
|
|
607
|
+
}
|
|
620
608
|
}
|
|
621
609
|
);
|
|
622
610
|
};
|
|
@@ -635,7 +623,8 @@ var ControlledTextField = (_a) => {
|
|
|
635
623
|
onChange,
|
|
636
624
|
rules = {},
|
|
637
625
|
shouldUnregister,
|
|
638
|
-
value
|
|
626
|
+
value,
|
|
627
|
+
transform
|
|
639
628
|
} = _b, rest = __objRest(_b, [
|
|
640
629
|
"name",
|
|
641
630
|
"defaultValue",
|
|
@@ -645,7 +634,8 @@ var ControlledTextField = (_a) => {
|
|
|
645
634
|
"onChange",
|
|
646
635
|
"rules",
|
|
647
636
|
"shouldUnregister",
|
|
648
|
-
"value"
|
|
637
|
+
"value",
|
|
638
|
+
"transform"
|
|
649
639
|
]);
|
|
650
640
|
return /* @__PURE__ */ jsx11(
|
|
651
641
|
Controller8,
|
|
@@ -662,16 +652,22 @@ var ControlledTextField = (_a) => {
|
|
|
662
652
|
shouldUnregister,
|
|
663
653
|
render: (_a2) => {
|
|
664
654
|
var _b2 = _a2, { field: _c } = _b2, _d = _c, { ref } = _d, field = __objRest(_d, ["ref"]), { fieldState: { error } } = _b2;
|
|
665
|
-
var _a3;
|
|
655
|
+
var _a3, _b3, _c2, _d2;
|
|
666
656
|
return /* @__PURE__ */ jsx11(
|
|
667
657
|
TextField,
|
|
668
|
-
__spreadProps(__spreadValues(__spreadValues({
|
|
658
|
+
__spreadProps(__spreadValues(__spreadProps(__spreadValues({
|
|
669
659
|
required: typeof rules.required === "object" ? rules.required.value : !!rules.required
|
|
670
|
-
}, field),
|
|
660
|
+
}, field), {
|
|
661
|
+
onChange: (e) => {
|
|
662
|
+
var _a4, _b4;
|
|
663
|
+
return field.onChange((_b4 = (_a4 = transform == null ? void 0 : transform.output) == null ? void 0 : _a4.call(transform, e.target.value)) != null ? _b4 : e);
|
|
664
|
+
},
|
|
665
|
+
value: (_c2 = (_b3 = (_a3 = transform == null ? void 0 : transform.input) == null ? void 0 : _a3.call(transform, field.value)) != null ? _b3 : field.value) != null ? _c2 : ""
|
|
666
|
+
}), rest), {
|
|
671
667
|
slotProps: __spreadProps(__spreadValues({}, rest.slotProps), {
|
|
672
668
|
htmlInput: __spreadValues({
|
|
673
669
|
maxLength: typeof rules.maxLength === "object" ? rules.maxLength.value : rules.maxLength
|
|
674
|
-
}, (
|
|
670
|
+
}, (_d2 = rest.slotProps) == null ? void 0 : _d2.htmlInput)
|
|
675
671
|
}),
|
|
676
672
|
inputRef: ref,
|
|
677
673
|
error: !!error,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@availity/mui-controlled-form",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
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.1.
|
|
43
|
+
"@availity/mui-autocomplete": "^1.1.3",
|
|
44
44
|
"@availity/mui-checkbox": "^1.0.2",
|
|
45
|
-
"@availity/mui-datepicker": "^1.0.
|
|
46
|
-
"@availity/mui-form-utils": "^1.
|
|
47
|
-
"@availity/mui-textfield": "^1.2.
|
|
45
|
+
"@availity/mui-datepicker": "^1.0.17",
|
|
46
|
+
"@availity/mui-form-utils": "^1.3.0",
|
|
47
|
+
"@availity/mui-textfield": "^1.2.3",
|
|
48
48
|
"react-hook-form": "^7.55.0"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|