@availity/mui-controlled-form 1.2.10 → 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/dist/index.js CHANGED
@@ -100,7 +100,8 @@ var ControlledAsyncAutocomplete = (_a) => {
100
100
  value,
101
101
  FieldProps,
102
102
  defaultToFirstOption,
103
- defaultToOnlyOption
103
+ defaultToOnlyOption,
104
+ transform
104
105
  } = _b, rest = __objRest(_b, [
105
106
  "name",
106
107
  "onBlur",
@@ -110,7 +111,8 @@ var ControlledAsyncAutocomplete = (_a) => {
110
111
  "value",
111
112
  "FieldProps",
112
113
  "defaultToFirstOption",
113
- "defaultToOnlyOption"
114
+ "defaultToOnlyOption",
115
+ "transform"
114
116
  ]);
115
117
  const { setValue } = (0, import_react_hook_form.useFormContext)();
116
118
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
@@ -120,40 +122,44 @@ var ControlledAsyncAutocomplete = (_a) => {
120
122
  defaultValue: rest.defaultValue,
121
123
  rules: __spreadValues({ onBlur, onChange, shouldUnregister, value }, rules),
122
124
  shouldUnregister,
123
- render: ({ field: { onChange: onChange2, value: value2, onBlur: onBlur2, ref }, fieldState: { error } }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
124
- import_mui_autocomplete.AsyncAutocomplete,
125
- __spreadProps(__spreadValues({}, rest), {
126
- FieldProps: __spreadProps(__spreadValues({
127
- required: typeof rules.required === "object" ? rules.required.value : !!rules.required
128
- }, FieldProps), {
129
- error: !!error,
130
- helperText: (error == null ? void 0 : error.message) ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
131
- error.message,
132
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("br", {}),
133
- FieldProps == null ? void 0 : FieldProps.helperText
134
- ] }) : FieldProps == null ? void 0 : FieldProps.helperText,
135
- inputRef: ref
136
- }),
137
- onChange: (event, value3, reason) => {
138
- if (reason === "clear") {
139
- onChange2(null);
140
- }
141
- onChange2(value3);
142
- },
143
- onBlur: onBlur2,
144
- value: value2 || null,
145
- loadOptions: (offset, limit, inputValue) => __async(void 0, null, function* () {
146
- const { options, hasMore, offset: returnedOffsetValue } = yield rest.loadOptions(offset, limit, inputValue);
147
- if (defaultToFirstOption && offset === 0) {
148
- setValue(name, rest.multiple ? [options[0]] : options[0]);
149
- }
150
- if (defaultToOnlyOption && offset === 0 && options.length === 1) {
151
- setValue(name, rest.multiple ? [options[0]] : options[0]);
152
- }
153
- return { options, hasMore, offset: returnedOffsetValue };
125
+ render: ({ field: { onChange: onChange2, value: value2, onBlur: onBlur2, ref }, fieldState: { error } }) => {
126
+ var _a2, _b2, _c;
127
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
128
+ import_mui_autocomplete.AsyncAutocomplete,
129
+ __spreadProps(__spreadValues({}, rest), {
130
+ FieldProps: __spreadProps(__spreadValues({
131
+ required: typeof rules.required === "object" ? rules.required.value : !!rules.required
132
+ }, FieldProps), {
133
+ error: !!error,
134
+ helperText: (error == null ? void 0 : error.message) ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
135
+ error.message,
136
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("br", {}),
137
+ FieldProps == null ? void 0 : FieldProps.helperText
138
+ ] }) : FieldProps == null ? void 0 : FieldProps.helperText,
139
+ inputRef: ref
140
+ }),
141
+ onChange: (event, value3, reason) => {
142
+ var _a3, _b3, _c2, _d;
143
+ if (reason === "clear") {
144
+ onChange2((_b3 = (_a3 = transform == null ? void 0 : transform.output) == null ? void 0 : _a3.call(transform, null)) != null ? _b3 : null);
145
+ }
146
+ onChange2((_d = (_c2 = transform == null ? void 0 : transform.output) == null ? void 0 : _c2.call(transform, value3)) != null ? _d : value3);
147
+ },
148
+ onBlur: onBlur2,
149
+ value: (_c = (_b2 = (_a2 = transform == null ? void 0 : transform.input) == null ? void 0 : _a2.call(transform, value2)) != null ? _b2 : value2) != null ? _c : null,
150
+ loadOptions: (offset, limit, inputValue) => __async(void 0, null, function* () {
151
+ const { options, hasMore, offset: returnedOffsetValue } = yield rest.loadOptions(offset, limit, inputValue);
152
+ if (defaultToFirstOption && offset === 0) {
153
+ setValue(name, rest.multiple ? [options[0]] : options[0]);
154
+ }
155
+ if (defaultToOnlyOption && offset === 0 && options.length === 1) {
156
+ setValue(name, rest.multiple ? [options[0]] : options[0]);
157
+ }
158
+ return { options, hasMore, offset: returnedOffsetValue };
159
+ })
154
160
  })
155
- })
156
- )
161
+ );
162
+ }
157
163
  }
158
164
  );
159
165
  };
@@ -171,7 +177,8 @@ var ControlledAutocomplete = (_a) => {
171
177
  onBlur,
172
178
  onChange,
173
179
  shouldUnregister,
174
- value
180
+ value,
181
+ transform
175
182
  } = _b, rest = __objRest(_b, [
176
183
  "name",
177
184
  "FieldProps",
@@ -180,7 +187,8 @@ var ControlledAutocomplete = (_a) => {
180
187
  "onBlur",
181
188
  "onChange",
182
189
  "shouldUnregister",
183
- "value"
190
+ "value",
191
+ "transform"
184
192
  ]);
185
193
  return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
186
194
  import_react_hook_form2.Controller,
@@ -194,30 +202,34 @@ var ControlledAutocomplete = (_a) => {
194
202
  value
195
203
  }, rules),
196
204
  shouldUnregister,
197
- render: ({ field: { onChange: onChange2, value: value2, onBlur: onBlur2, ref }, fieldState: { error } }) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
198
- import_mui_autocomplete2.Autocomplete,
199
- __spreadProps(__spreadValues({}, rest), {
200
- FieldProps: __spreadProps(__spreadValues({
201
- required: typeof rules.required === "object" ? rules.required.value : !!rules.required
202
- }, FieldProps), {
203
- error: !!error,
204
- helperText: (error == null ? void 0 : error.message) ? /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
205
- error.message,
206
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("br", {}),
207
- FieldProps == null ? void 0 : FieldProps.helperText
208
- ] }) : FieldProps == null ? void 0 : FieldProps.helperText,
209
- inputRef: ref
210
- }),
211
- onChange: (event, value3, reason) => {
212
- if (reason === "clear") {
213
- onChange2(null);
214
- }
215
- onChange2(value3);
216
- },
217
- onBlur: onBlur2,
218
- value: value2 || null
219
- })
220
- )
205
+ render: ({ field: { onChange: onChange2, value: value2, onBlur: onBlur2, ref }, fieldState: { error } }) => {
206
+ var _a2, _b2, _c;
207
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
208
+ import_mui_autocomplete2.Autocomplete,
209
+ __spreadProps(__spreadValues({}, rest), {
210
+ FieldProps: __spreadProps(__spreadValues({
211
+ required: typeof rules.required === "object" ? rules.required.value : !!rules.required
212
+ }, FieldProps), {
213
+ error: !!error,
214
+ helperText: (error == null ? void 0 : error.message) ? /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
215
+ error.message,
216
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("br", {}),
217
+ FieldProps == null ? void 0 : FieldProps.helperText
218
+ ] }) : FieldProps == null ? void 0 : FieldProps.helperText,
219
+ inputRef: ref
220
+ }),
221
+ onChange: (event, value3, reason) => {
222
+ var _a3, _b3, _c2, _d;
223
+ if (reason === "clear") {
224
+ onChange2((_b3 = (_a3 = transform == null ? void 0 : transform.output) == null ? void 0 : _a3.call(transform, null)) != null ? _b3 : null);
225
+ }
226
+ onChange2((_d = (_c2 = transform == null ? void 0 : transform.output) == null ? void 0 : _c2.call(transform, value3)) != null ? _d : value3);
227
+ },
228
+ onBlur: onBlur2,
229
+ value: (_c = (_b2 = (_a2 = transform == null ? void 0 : transform.input) == null ? void 0 : _a2.call(transform, value2)) != null ? _b2 : value2) != null ? _c : null
230
+ })
231
+ );
232
+ }
221
233
  }
222
234
  );
223
235
  };
@@ -235,7 +247,8 @@ var ControlledCheckbox = (_a) => {
235
247
  value,
236
248
  defaultValue = false,
237
249
  rules = {},
238
- shouldUnregister
250
+ shouldUnregister,
251
+ transform
239
252
  } = _b, rest = __objRest(_b, [
240
253
  "name",
241
254
  "disabled",
@@ -244,7 +257,8 @@ var ControlledCheckbox = (_a) => {
244
257
  "value",
245
258
  "defaultValue",
246
259
  "rules",
247
- "shouldUnregister"
260
+ "shouldUnregister",
261
+ "transform"
248
262
  ]);
249
263
  return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
250
264
  import_react_hook_form3.Controller,
@@ -259,15 +273,21 @@ var ControlledCheckbox = (_a) => {
259
273
  shouldUnregister
260
274
  }, rules),
261
275
  shouldUnregister,
262
- render: ({ field }) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
263
- import_mui_checkbox.Checkbox,
264
- __spreadProps(__spreadValues(__spreadValues({
265
- required: typeof rules.required === "object" ? rules.required.value : !!rules.required
266
- }, rest), field), {
267
- checked: field.value,
268
- onChange: (e) => field.onChange(e.target.checked)
269
- })
270
- )
276
+ render: ({ field }) => {
277
+ var _a2, _b2;
278
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
279
+ import_mui_checkbox.Checkbox,
280
+ __spreadProps(__spreadValues(__spreadValues({
281
+ required: typeof rules.required === "object" ? rules.required.value : !!rules.required
282
+ }, rest), field), {
283
+ checked: (_b2 = (_a2 = transform == null ? void 0 : transform.input) == null ? void 0 : _a2.call(transform, field.value)) != null ? _b2 : field.value,
284
+ onChange: (e) => {
285
+ var _a3, _b3;
286
+ 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);
287
+ }
288
+ })
289
+ );
290
+ }
271
291
  }
272
292
  );
273
293
  };
@@ -277,28 +297,12 @@ var import_mui_autocomplete3 = require("@availity/mui-autocomplete");
277
297
  var import_jsx_runtime4 = require("react/jsx-runtime");
278
298
  var ControlledCodesAutocomplete = (_a) => {
279
299
  var _b = _a, {
280
- name,
281
- defaultValue,
282
- onBlur,
283
- onChange,
284
- rules = {},
285
- shouldUnregister,
286
- value,
287
- FieldProps,
288
300
  apiConfig = {},
289
301
  queryOptions,
290
302
  queryKey = "codes-autocomplete",
291
303
  list,
292
304
  watchParams
293
305
  } = _b, rest = __objRest(_b, [
294
- "name",
295
- "defaultValue",
296
- "onBlur",
297
- "onChange",
298
- "rules",
299
- "shouldUnregister",
300
- "value",
301
- "FieldProps",
302
306
  "apiConfig",
303
307
  "queryOptions",
304
308
  "queryKey",
@@ -314,14 +318,6 @@ var ControlledCodesAutocomplete = (_a) => {
314
318
  return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
315
319
  ControlledAsyncAutocomplete,
316
320
  __spreadProps(__spreadValues({
317
- name,
318
- defaultValue,
319
- onBlur,
320
- onChange,
321
- rules,
322
- shouldUnregister,
323
- value,
324
- FieldProps,
325
321
  getOptionLabel: import_mui_autocomplete3.handleGetCodesOptionLabel,
326
322
  queryKey,
327
323
  queryOptions: __spreadValues({ enabled: !!list }, queryOptions),
@@ -345,7 +341,8 @@ var ControlledDatepicker = (_a) => {
345
341
  rules = {},
346
342
  shouldUnregister,
347
343
  value,
348
- FieldProps
344
+ FieldProps,
345
+ transform
349
346
  } = _b, rest = __objRest(_b, [
350
347
  "name",
351
348
  "defaultValue",
@@ -354,7 +351,8 @@ var ControlledDatepicker = (_a) => {
354
351
  "rules",
355
352
  "shouldUnregister",
356
353
  "value",
357
- "FieldProps"
354
+ "FieldProps",
355
+ "transform"
358
356
  ]);
359
357
  return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
360
358
  import_react_hook_form4.Controller,
@@ -368,27 +366,33 @@ var ControlledDatepicker = (_a) => {
368
366
  value
369
367
  }, rules),
370
368
  shouldUnregister,
371
- render: ({ field: { onChange: onChange2, value: value2, onBlur: onBlur2, ref }, fieldState: { error } }) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
372
- import_mui_datepicker.Datepicker,
373
- __spreadProps(__spreadValues({}, rest), {
374
- FieldProps: __spreadProps(__spreadValues({
375
- required: typeof rules.required === "object" ? rules.required.value : !!rules.required
376
- }, FieldProps), {
377
- error: !!error,
378
- helperText: error ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
379
- error.message,
380
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("br", {}),
381
- FieldProps == null ? void 0 : FieldProps.helperText
382
- ] }) : FieldProps == null ? void 0 : FieldProps.helperText,
383
- inputRef: ref,
384
- inputProps: {
385
- onBlur: onBlur2
386
- }
387
- }),
388
- onChange: onChange2,
389
- value: value2 || null
390
- })
391
- )
369
+ render: ({ field: { onChange: onChange2, value: value2, onBlur: onBlur2, ref }, fieldState: { error } }) => {
370
+ var _a2, _b2, _c;
371
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
372
+ import_mui_datepicker.Datepicker,
373
+ __spreadProps(__spreadValues({}, rest), {
374
+ FieldProps: __spreadProps(__spreadValues({
375
+ required: typeof rules.required === "object" ? rules.required.value : !!rules.required
376
+ }, FieldProps), {
377
+ error: !!error,
378
+ helperText: error ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
379
+ error.message,
380
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("br", {}),
381
+ FieldProps == null ? void 0 : FieldProps.helperText
382
+ ] }) : FieldProps == null ? void 0 : FieldProps.helperText,
383
+ inputRef: ref,
384
+ inputProps: {
385
+ onBlur: onBlur2
386
+ }
387
+ }),
388
+ onChange: (e) => {
389
+ var _a3, _b3;
390
+ return onChange2((_b3 = (_a3 = transform == null ? void 0 : transform.output) == null ? void 0 : _a3.call(transform, e)) != null ? _b3 : e);
391
+ },
392
+ value: (_c = (_b2 = (_a2 = transform == null ? void 0 : transform.input) == null ? void 0 : _a2.call(transform, value2)) != null ? _b2 : value2) != null ? _c : null
393
+ })
394
+ );
395
+ }
392
396
  }
393
397
  );
394
398
  };
@@ -406,7 +410,8 @@ var ControlledInput = (_a) => {
406
410
  onChange,
407
411
  rules = {},
408
412
  shouldUnregister,
409
- value
413
+ value,
414
+ transform
410
415
  } = _b, rest = __objRest(_b, [
411
416
  "name",
412
417
  "defaultValue",
@@ -415,7 +420,8 @@ var ControlledInput = (_a) => {
415
420
  "onChange",
416
421
  "rules",
417
422
  "shouldUnregister",
418
- "value"
423
+ "value",
424
+ "transform"
419
425
  ]);
420
426
  return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
421
427
  import_react_hook_form5.Controller,
@@ -430,14 +436,22 @@ var ControlledInput = (_a) => {
430
436
  shouldUnregister
431
437
  }, rules),
432
438
  shouldUnregister,
433
- render: ({ field, fieldState: { error } }) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
434
- import_mui_form_utils.Input,
435
- __spreadProps(__spreadValues(__spreadValues({
436
- required: typeof rules.required === "object" ? rules.required.value : !!rules.required
437
- }, rest), field), {
438
- error: !!error
439
- })
440
- )
439
+ render: ({ field, fieldState: { error } }) => {
440
+ var _a2, _b2, _c;
441
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
442
+ import_mui_form_utils.Input,
443
+ __spreadProps(__spreadValues(__spreadValues({
444
+ required: typeof rules.required === "object" ? rules.required.value : !!rules.required
445
+ }, rest), field), {
446
+ onChange: (e) => {
447
+ var _a3, _b3;
448
+ return field.onChange((_b3 = (_a3 = transform == null ? void 0 : transform.output) == null ? void 0 : _a3.call(transform, e.target.value)) != null ? _b3 : e);
449
+ },
450
+ value: (_c = (_b2 = (_a2 = transform == null ? void 0 : transform.input) == null ? void 0 : _a2.call(transform, field.value)) != null ? _b2 : field.value) != null ? _c : "",
451
+ error: !!error
452
+ })
453
+ );
454
+ }
441
455
  }
442
456
  );
443
457
  };
@@ -447,25 +461,9 @@ var import_mui_autocomplete4 = require("@availity/mui-autocomplete");
447
461
  var import_jsx_runtime7 = require("react/jsx-runtime");
448
462
  var ControlledOrganizationAutocomplete = (_a) => {
449
463
  var _b = _a, {
450
- name,
451
- defaultValue,
452
- onBlur,
453
- onChange,
454
- rules = {},
455
- shouldUnregister,
456
- value,
457
- FieldProps,
458
464
  queryKey = "org-autocomplete",
459
465
  apiConfig = {}
460
466
  } = _b, rest = __objRest(_b, [
461
- "name",
462
- "defaultValue",
463
- "onBlur",
464
- "onChange",
465
- "rules",
466
- "shouldUnregister",
467
- "value",
468
- "FieldProps",
469
467
  "queryKey",
470
468
  "apiConfig"
471
469
  ]);
@@ -476,14 +474,6 @@ var ControlledOrganizationAutocomplete = (_a) => {
476
474
  return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
477
475
  ControlledAsyncAutocomplete,
478
476
  __spreadProps(__spreadValues({
479
- name,
480
- defaultValue,
481
- onBlur,
482
- onChange,
483
- rules,
484
- shouldUnregister,
485
- value,
486
- FieldProps,
487
477
  getOptionLabel: import_mui_autocomplete4.handleGetOrgOptionLabel,
488
478
  queryKey
489
479
  }, rest), {
@@ -497,26 +487,10 @@ var import_mui_autocomplete5 = require("@availity/mui-autocomplete");
497
487
  var import_jsx_runtime8 = require("react/jsx-runtime");
498
488
  var ControlledProviderAutocomplete = (_a) => {
499
489
  var _b = _a, {
500
- name,
501
- defaultValue,
502
- onBlur,
503
- onChange,
504
- rules = {},
505
- shouldUnregister,
506
- value,
507
- FieldProps,
508
490
  apiConfig = {},
509
491
  customerId,
510
492
  queryKey = "prov-autocomplete"
511
493
  } = _b, rest = __objRest(_b, [
512
- "name",
513
- "defaultValue",
514
- "onBlur",
515
- "onChange",
516
- "rules",
517
- "shouldUnregister",
518
- "value",
519
- "FieldProps",
520
494
  "apiConfig",
521
495
  "customerId",
522
496
  "queryKey"
@@ -530,14 +504,6 @@ var ControlledProviderAutocomplete = (_a) => {
530
504
  return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
531
505
  ControlledAsyncAutocomplete,
532
506
  __spreadProps(__spreadValues({
533
- name,
534
- defaultValue,
535
- onBlur,
536
- onChange,
537
- rules,
538
- shouldUnregister,
539
- value,
540
- FieldProps,
541
507
  getOptionLabel: import_mui_autocomplete5.handleGetProviderOptionLabel,
542
508
  queryOptions: { enabled: !!customerId },
543
509
  queryKey,
@@ -564,7 +530,8 @@ var ControlledRadioGroup = (_a) => {
564
530
  required,
565
531
  rules = {},
566
532
  shouldUnregister,
567
- value
533
+ value,
534
+ transform
568
535
  } = _b, rest = __objRest(_b, [
569
536
  "name",
570
537
  "helperText",
@@ -575,7 +542,8 @@ var ControlledRadioGroup = (_a) => {
575
542
  "required",
576
543
  "rules",
577
544
  "shouldUnregister",
578
- "value"
545
+ "value",
546
+ "transform"
579
547
  ]);
580
548
  return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
581
549
  import_react_hook_form6.Controller,
@@ -586,6 +554,7 @@ var ControlledRadioGroup = (_a) => {
586
554
  shouldUnregister,
587
555
  render: (_a2) => {
588
556
  var _b2 = _a2, { field: _c } = _b2, _d = _c, { disabled } = _d, field = __objRest(_d, ["disabled"]), { fieldState: { error } } = _b2;
557
+ var _a3, _b3, _c2;
589
558
  return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
590
559
  import_mui_form_utils3.FormControl,
591
560
  {
@@ -594,7 +563,16 @@ var ControlledRadioGroup = (_a) => {
594
563
  required: !!required || (typeof rules.required === "object" ? rules.required.value : !!rules.required),
595
564
  children: [
596
565
  /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_mui_form_utils3.FormLabel, { children: label }),
597
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_mui_form_utils2.RadioGroup, __spreadValues(__spreadValues({}, field), rest)),
566
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
567
+ import_mui_form_utils2.RadioGroup,
568
+ __spreadValues(__spreadProps(__spreadValues({}, field), {
569
+ onChange: (e) => {
570
+ var _a4, _b4;
571
+ return field.onChange((_b4 = (_a4 = transform == null ? void 0 : transform.output) == null ? void 0 : _a4.call(transform, e.target.value)) != null ? _b4 : e);
572
+ },
573
+ value: (_c2 = (_b3 = (_a3 = transform == null ? void 0 : transform.input) == null ? void 0 : _a3.call(transform, field.value)) != null ? _b3 : field.value) != null ? _c2 : ""
574
+ }), rest)
575
+ ),
598
576
  /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_mui_form_utils3.FormHelperText, { children: (error == null ? void 0 : error.message) ? /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
599
577
  error.message,
600
578
  /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("br", {}),
@@ -621,7 +599,8 @@ var ControlledSelect = (_a) => {
621
599
  onChange,
622
600
  rules = {},
623
601
  shouldUnregister,
624
- value
602
+ value,
603
+ transform
625
604
  } = _b, rest = __objRest(_b, [
626
605
  "name",
627
606
  "defaultValue",
@@ -630,7 +609,8 @@ var ControlledSelect = (_a) => {
630
609
  "onChange",
631
610
  "rules",
632
611
  "shouldUnregister",
633
- "value"
612
+ "value",
613
+ "transform"
634
614
  ]);
635
615
  return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
636
616
  import_react_hook_form7.Controller,
@@ -645,14 +625,22 @@ var ControlledSelect = (_a) => {
645
625
  shouldUnregister
646
626
  }, rules),
647
627
  shouldUnregister,
648
- render: ({ field, fieldState: { error } }) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
649
- import_mui_form_utils4.Select,
650
- __spreadProps(__spreadValues(__spreadValues({
651
- required: typeof rules.required === "object" ? rules.required.value : !!rules.required
652
- }, rest), field), {
653
- error: !!error
654
- })
655
- )
628
+ render: ({ field, fieldState: { error } }) => {
629
+ var _a2, _b2, _c;
630
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
631
+ import_mui_form_utils4.Select,
632
+ __spreadProps(__spreadValues(__spreadValues({
633
+ required: typeof rules.required === "object" ? rules.required.value : !!rules.required
634
+ }, rest), field), {
635
+ onChange: (e) => {
636
+ var _a3, _b3;
637
+ return field.onChange((_b3 = (_a3 = transform == null ? void 0 : transform.output) == null ? void 0 : _a3.call(transform, e.target.value)) != null ? _b3 : e);
638
+ },
639
+ value: (_c = (_b2 = (_a2 = transform == null ? void 0 : transform.input) == null ? void 0 : _a2.call(transform, field.value)) != null ? _b2 : field.value) != null ? _c : "",
640
+ error: !!error
641
+ })
642
+ );
643
+ }
656
644
  }
657
645
  );
658
646
  };
@@ -671,7 +659,8 @@ var ControlledTextField = (_a) => {
671
659
  onChange,
672
660
  rules = {},
673
661
  shouldUnregister,
674
- value
662
+ value,
663
+ transform
675
664
  } = _b, rest = __objRest(_b, [
676
665
  "name",
677
666
  "defaultValue",
@@ -681,7 +670,8 @@ var ControlledTextField = (_a) => {
681
670
  "onChange",
682
671
  "rules",
683
672
  "shouldUnregister",
684
- "value"
673
+ "value",
674
+ "transform"
685
675
  ]);
686
676
  return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
687
677
  import_react_hook_form8.Controller,
@@ -698,16 +688,22 @@ var ControlledTextField = (_a) => {
698
688
  shouldUnregister,
699
689
  render: (_a2) => {
700
690
  var _b2 = _a2, { field: _c } = _b2, _d = _c, { ref } = _d, field = __objRest(_d, ["ref"]), { fieldState: { error } } = _b2;
701
- var _a3;
691
+ var _a3, _b3, _c2, _d2;
702
692
  return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
703
693
  import_mui_textfield.TextField,
704
- __spreadProps(__spreadValues(__spreadValues({
694
+ __spreadProps(__spreadValues(__spreadProps(__spreadValues({
705
695
  required: typeof rules.required === "object" ? rules.required.value : !!rules.required
706
- }, field), rest), {
696
+ }, field), {
697
+ onChange: (e) => {
698
+ var _a4, _b4;
699
+ return field.onChange((_b4 = (_a4 = transform == null ? void 0 : transform.output) == null ? void 0 : _a4.call(transform, e.target.value)) != null ? _b4 : e);
700
+ },
701
+ value: (_c2 = (_b3 = (_a3 = transform == null ? void 0 : transform.input) == null ? void 0 : _a3.call(transform, field.value)) != null ? _b3 : field.value) != null ? _c2 : ""
702
+ }), rest), {
707
703
  slotProps: __spreadProps(__spreadValues({}, rest.slotProps), {
708
704
  htmlInput: __spreadValues({
709
705
  maxLength: typeof rules.maxLength === "object" ? rules.maxLength.value : rules.maxLength
710
- }, (_a3 = rest.slotProps) == null ? void 0 : _a3.htmlInput)
706
+ }, (_d2 = rest.slotProps) == null ? void 0 : _d2.htmlInput)
711
707
  }),
712
708
  inputRef: ref,
713
709
  error: !!error,