@availity/mui-controlled-form 0.2.4 → 0.2.6

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,14 +100,10 @@ var ControlledAsyncAutocomplete = (_a) => {
100
100
  "value",
101
101
  "FieldProps"
102
102
  ]);
103
- var _a2;
104
- const { control, getFieldState } = (0, import_react_hook_form.useFormContext)();
105
- const errorMessage = (_a2 = getFieldState(name).error) == null ? void 0 : _a2.message;
106
103
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
107
104
  import_react_hook_form.Controller,
108
105
  {
109
106
  name,
110
- control,
111
107
  defaultValue: rest.defaultValue,
112
108
  rules: {
113
109
  deps,
@@ -124,13 +120,14 @@ var ControlledAsyncAutocomplete = (_a) => {
124
120
  value
125
121
  },
126
122
  shouldUnregister,
127
- render: ({ field: { onChange: onChange2, value: value2, onBlur: onBlur2 } }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
123
+ render: ({ field: { onChange: onChange2, value: value2, onBlur: onBlur2 }, fieldState: { error } }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
128
124
  import_mui_autocomplete.AsyncAutocomplete,
129
125
  __spreadProps(__spreadValues({}, rest), {
130
126
  FieldProps: __spreadProps(__spreadValues({}, FieldProps), {
131
- error: !!errorMessage,
132
- helperText: errorMessage && typeof errorMessage === "string" ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
133
- errorMessage,
127
+ required: typeof required === "object" ? required.value : !!required,
128
+ error: !!error,
129
+ helperText: (error == null ? void 0 : error.message) ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
130
+ error.message,
134
131
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("br", {}),
135
132
  FieldProps == null ? void 0 : FieldProps.helperText
136
133
  ] }) : FieldProps == null ? void 0 : FieldProps.helperText
@@ -187,13 +184,9 @@ var ControlledAutocomplete = (_a) => {
187
184
  "validate",
188
185
  "value"
189
186
  ]);
190
- var _a2;
191
- const { control, getFieldState } = (0, import_react_hook_form2.useFormContext)();
192
- const errorMessage = (_a2 = getFieldState(name).error) == null ? void 0 : _a2.message;
193
187
  return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
194
188
  import_react_hook_form2.Controller,
195
189
  {
196
- control,
197
190
  name,
198
191
  defaultValue,
199
192
  rules: {
@@ -211,13 +204,14 @@ var ControlledAutocomplete = (_a) => {
211
204
  value
212
205
  },
213
206
  shouldUnregister,
214
- render: ({ field: { onChange: onChange2, value: value2, onBlur: onBlur2 } }) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
207
+ render: ({ field: { onChange: onChange2, value: value2, onBlur: onBlur2 }, fieldState: { error } }) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
215
208
  import_mui_autocomplete2.Autocomplete,
216
209
  __spreadProps(__spreadValues({}, rest), {
217
210
  FieldProps: __spreadProps(__spreadValues({}, FieldProps), {
218
- error: !!errorMessage,
219
- helperText: errorMessage && typeof errorMessage === "string" ? /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
220
- errorMessage,
211
+ required: typeof required === "object" ? required.value : !!required,
212
+ error: !!error,
213
+ helperText: (error == null ? void 0 : error.message) ? /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
214
+ error.message,
221
215
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("br", {}),
222
216
  FieldProps == null ? void 0 : FieldProps.helperText
223
217
  ] }) : FieldProps == null ? void 0 : FieldProps.helperText
@@ -243,35 +237,39 @@ var import_jsx_runtime3 = require("react/jsx-runtime");
243
237
  var ControlledCheckbox = (_a) => {
244
238
  var _b = _a, {
245
239
  name,
246
- setValueAs,
247
240
  disabled,
248
241
  onChange,
249
242
  onBlur,
250
243
  value,
244
+ defaultValue = false,
251
245
  shouldUnregister,
252
246
  deps
253
247
  } = _b, rest = __objRest(_b, [
254
248
  "name",
255
- "setValueAs",
256
249
  "disabled",
257
250
  "onChange",
258
251
  "onBlur",
259
252
  "value",
253
+ "defaultValue",
260
254
  "shouldUnregister",
261
255
  "deps"
262
256
  ]);
263
- const { register } = (0, import_react_hook_form3.useFormContext)();
264
257
  return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
265
- import_mui_checkbox.Checkbox,
266
- __spreadValues(__spreadValues({}, rest), register(name, {
267
- setValueAs,
258
+ import_react_hook_form3.Controller,
259
+ {
260
+ name,
261
+ defaultValue,
268
262
  disabled,
269
- onChange,
270
- onBlur,
271
- value,
263
+ rules: {
264
+ onChange,
265
+ onBlur,
266
+ value,
267
+ shouldUnregister,
268
+ deps
269
+ },
272
270
  shouldUnregister,
273
- deps
274
- }))
271
+ render: ({ field }) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_mui_checkbox.Checkbox, __spreadProps(__spreadValues(__spreadValues({}, rest), field), { checked: field.value, onChange: (e) => field.onChange(e.target.checked) }))
272
+ }
275
273
  );
276
274
  };
277
275
 
@@ -309,14 +307,10 @@ var ControlledCodesAutocomplete = (_a) => {
309
307
  "value",
310
308
  "FieldProps"
311
309
  ]);
312
- var _a2;
313
- const { control, getFieldState } = (0, import_react_hook_form4.useFormContext)();
314
- const errorMessage = (_a2 = getFieldState(name).error) == null ? void 0 : _a2.message;
315
310
  return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
316
311
  import_react_hook_form4.Controller,
317
312
  {
318
313
  name,
319
- control,
320
314
  defaultValue,
321
315
  rules: {
322
316
  deps,
@@ -331,13 +325,14 @@ var ControlledCodesAutocomplete = (_a) => {
331
325
  value
332
326
  },
333
327
  shouldUnregister,
334
- render: ({ field: { onChange: onChange2, value: value2, onBlur: onBlur2 } }) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
328
+ render: ({ field: { onChange: onChange2, value: value2, onBlur: onBlur2 }, fieldState: { error } }) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
335
329
  import_mui_autocomplete3.CodesAutocomplete,
336
330
  __spreadProps(__spreadValues({}, rest), {
337
331
  FieldProps: __spreadProps(__spreadValues({}, FieldProps), {
338
- error: !!errorMessage,
339
- helperText: errorMessage && typeof errorMessage === "string" ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
340
- errorMessage,
332
+ required: typeof required === "object" ? required.value : !!required,
333
+ error: !!error,
334
+ helperText: (error == null ? void 0 : error.message) ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
335
+ error.message,
341
336
  /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("br", {}),
342
337
  FieldProps == null ? void 0 : FieldProps.helperText
343
338
  ] }) : FieldProps == null ? void 0 : FieldProps.helperText
@@ -366,7 +361,7 @@ var ControlledForm = (_a) => {
366
361
  useFormOptions.resolver = validationResolver(schema);
367
362
  }
368
363
  const methods = (0, import_react_hook_form5.useForm)(useFormOptions);
369
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react_hook_form5.FormProvider, __spreadProps(__spreadValues({}, methods), { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("form", __spreadValues({ onSubmit: methods.handleSubmit(onSubmit) }, rest)) }));
364
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react_hook_form5.FormProvider, __spreadProps(__spreadValues({}, methods), { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("form", __spreadValues({ onSubmit: methods.handleSubmit(onSubmit), noValidate: true }, rest)) }));
370
365
  };
371
366
 
372
367
  // src/lib/Datepicker.tsx
@@ -388,7 +383,8 @@ var ControlledDatepicker = (_a) => {
388
383
  required,
389
384
  shouldUnregister,
390
385
  validate,
391
- value
386
+ value,
387
+ FieldProps
392
388
  } = _b, rest = __objRest(_b, [
393
389
  "name",
394
390
  "defaultValue",
@@ -403,14 +399,13 @@ var ControlledDatepicker = (_a) => {
403
399
  "required",
404
400
  "shouldUnregister",
405
401
  "validate",
406
- "value"
402
+ "value",
403
+ "FieldProps"
407
404
  ]);
408
- const { control } = (0, import_react_hook_form6.useFormContext)();
409
405
  return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
410
406
  import_react_hook_form6.Controller,
411
407
  {
412
408
  name,
413
- control,
414
409
  defaultValue,
415
410
  rules: {
416
411
  deps,
@@ -427,7 +422,22 @@ var ControlledDatepicker = (_a) => {
427
422
  value
428
423
  },
429
424
  shouldUnregister,
430
- render: ({ field: { onChange: onChange2, value: value2 } }) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_mui_datepicker.Datepicker, __spreadProps(__spreadValues({}, rest), { onChange: onChange2, value: value2 || null }))
425
+ render: ({ field: { onChange: onChange2, value: value2 }, fieldState: { error } }) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
426
+ import_mui_datepicker.Datepicker,
427
+ __spreadProps(__spreadValues({}, rest), {
428
+ FieldProps: __spreadProps(__spreadValues({}, FieldProps), {
429
+ required: typeof required === "object" ? required.value : !!required,
430
+ error: !!error,
431
+ helperText: (error == null ? void 0 : error.message) ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
432
+ error == null ? void 0 : error.message,
433
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("br", {}),
434
+ FieldProps == null ? void 0 : FieldProps.helperText
435
+ ] }) : FieldProps == null ? void 0 : FieldProps.helperText
436
+ }),
437
+ onChange: onChange2,
438
+ value: value2 || null
439
+ })
440
+ )
431
441
  }
432
442
  );
433
443
  };
@@ -446,7 +456,7 @@ var ControlledInput = (_a) => {
446
456
  min,
447
457
  pattern,
448
458
  validate,
449
- setValueAs,
459
+ defaultValue,
450
460
  disabled,
451
461
  onChange,
452
462
  onBlur,
@@ -462,7 +472,7 @@ var ControlledInput = (_a) => {
462
472
  "min",
463
473
  "pattern",
464
474
  "validate",
465
- "setValueAs",
475
+ "defaultValue",
466
476
  "disabled",
467
477
  "onChange",
468
478
  "onBlur",
@@ -470,28 +480,35 @@ var ControlledInput = (_a) => {
470
480
  "shouldUnregister",
471
481
  "deps"
472
482
  ]);
473
- const { register, getFieldState } = (0, import_react_hook_form7.useFormContext)();
474
483
  return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
475
- import_mui_form_utils.Input,
476
- __spreadValues(__spreadProps(__spreadValues({}, rest), {
477
- error: !!getFieldState(name).error,
478
- required: !!required
479
- }), register(name, {
480
- required,
481
- maxLength,
482
- minLength,
483
- max,
484
- min,
485
- pattern,
486
- validate,
487
- setValueAs,
484
+ import_react_hook_form7.Controller,
485
+ {
486
+ name,
487
+ defaultValue,
488
488
  disabled,
489
- onChange,
490
- onBlur,
491
- value,
489
+ rules: {
490
+ required,
491
+ maxLength,
492
+ minLength,
493
+ max,
494
+ min,
495
+ pattern,
496
+ validate,
497
+ onChange,
498
+ onBlur,
499
+ value,
500
+ shouldUnregister,
501
+ deps
502
+ },
492
503
  shouldUnregister,
493
- deps
494
- }))
504
+ render: ({ field, fieldState: { error } }) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
505
+ import_mui_form_utils.Input,
506
+ __spreadProps(__spreadValues(__spreadValues({}, rest), field), {
507
+ error: !!error,
508
+ required: typeof required === "object" ? required.value : !!required
509
+ })
510
+ )
511
+ }
495
512
  );
496
513
  };
497
514
 
@@ -525,14 +542,10 @@ var ControlledOrganizationAutocomplete = (_a) => {
525
542
  "value",
526
543
  "FieldProps"
527
544
  ]);
528
- var _a2;
529
- const { control, getFieldState } = (0, import_react_hook_form8.useFormContext)();
530
- const errorMessage = (_a2 = getFieldState(name).error) == null ? void 0 : _a2.message;
531
545
  return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
532
546
  import_react_hook_form8.Controller,
533
547
  {
534
548
  name,
535
- control,
536
549
  defaultValue,
537
550
  rules: {
538
551
  deps,
@@ -545,13 +558,14 @@ var ControlledOrganizationAutocomplete = (_a) => {
545
558
  value
546
559
  },
547
560
  shouldUnregister,
548
- render: ({ field: { onChange: onChange2, value: value2, onBlur: onBlur2 } }) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
561
+ render: ({ field: { onChange: onChange2, value: value2, onBlur: onBlur2 }, fieldState: { error } }) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
549
562
  import_mui_autocomplete4.OrganizationAutocomplete,
550
563
  __spreadProps(__spreadValues({}, rest), {
551
564
  FieldProps: __spreadProps(__spreadValues({}, FieldProps), {
552
- error: !!errorMessage,
553
- helperText: errorMessage && typeof errorMessage === "string" ? /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
554
- errorMessage,
565
+ required: typeof required === "object" ? required.value : !!required,
566
+ error: !!error,
567
+ helperText: (error == null ? void 0 : error.message) ? /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
568
+ error.message,
555
569
  /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("br", {}),
556
570
  FieldProps == null ? void 0 : FieldProps.helperText
557
571
  ] }) : FieldProps == null ? void 0 : FieldProps.helperText
@@ -608,14 +622,10 @@ var ControlledProviderAutocomplete = (_a) => {
608
622
  "value",
609
623
  "FieldProps"
610
624
  ]);
611
- var _a2;
612
- const { control, getFieldState } = (0, import_react_hook_form9.useFormContext)();
613
- const errorMessage = (_a2 = getFieldState(name).error) == null ? void 0 : _a2.message;
614
625
  return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
615
626
  import_react_hook_form9.Controller,
616
627
  {
617
628
  name,
618
- control,
619
629
  defaultValue,
620
630
  rules: {
621
631
  deps,
@@ -632,13 +642,14 @@ var ControlledProviderAutocomplete = (_a) => {
632
642
  value
633
643
  },
634
644
  shouldUnregister,
635
- render: ({ field: { onChange: onChange2, value: value2, onBlur: onBlur2 } }) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
645
+ render: ({ field: { onChange: onChange2, value: value2, onBlur: onBlur2 }, fieldState: { error } }) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
636
646
  import_mui_autocomplete5.ProviderAutocomplete,
637
647
  __spreadProps(__spreadValues({}, rest), {
638
648
  FieldProps: __spreadProps(__spreadValues({}, FieldProps), {
639
- error: !!errorMessage,
640
- helperText: errorMessage && typeof errorMessage === "string" ? /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
641
- errorMessage,
649
+ required: typeof required === "object" ? required.value : !!required,
650
+ error: !!error,
651
+ helperText: (error == null ? void 0 : error.message) ? /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
652
+ error.message,
642
653
  /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("br", {}),
643
654
  FieldProps == null ? void 0 : FieldProps.helperText
644
655
  ] }) : FieldProps == null ? void 0 : FieldProps.helperText
@@ -686,22 +697,18 @@ var ControlledRadioGroup = (_a) => {
686
697
  "shouldUnregister",
687
698
  "value"
688
699
  ]);
689
- var _a2;
690
- const { control, getFieldState } = (0, import_react_hook_form10.useFormContext)();
691
- const errorMessage = (_a2 = getFieldState(name).error) == null ? void 0 : _a2.message;
692
700
  return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
693
701
  import_react_hook_form10.Controller,
694
702
  {
695
- control,
696
703
  name,
697
704
  defaultValue,
698
705
  rules: { deps, onBlur, onChange, required, shouldUnregister, value },
699
706
  shouldUnregister,
700
- render: ({ field }) => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_mui_form_utils3.FormControl, { error: !!errorMessage, children: [
701
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_mui_form_utils3.FormLabel, { children: label }),
707
+ render: ({ field, fieldState: { error } }) => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_mui_form_utils3.FormControl, { error: !!error, children: [
708
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_mui_form_utils3.FormLabel, { required: typeof required === "object" ? required.value : !!required, children: label }),
702
709
  /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_mui_form_utils2.RadioGroup, __spreadValues(__spreadValues({}, field), rest)),
703
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_mui_form_utils3.FormHelperText, { children: errorMessage && typeof errorMessage === "string" ? /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
704
- errorMessage,
710
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_mui_form_utils3.FormHelperText, { children: (error == null ? void 0 : error.message) ? /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
711
+ error.message,
705
712
  /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("br", {}),
706
713
  helperText
707
714
  ] }) : helperText })
@@ -724,11 +731,11 @@ var ControlledSelect = (_a) => {
724
731
  min,
725
732
  pattern,
726
733
  validate,
727
- setValueAs,
728
734
  disabled,
729
735
  onChange,
730
736
  onBlur,
731
737
  value,
738
+ defaultValue,
732
739
  shouldUnregister,
733
740
  deps
734
741
  } = _b, rest = __objRest(_b, [
@@ -740,36 +747,43 @@ var ControlledSelect = (_a) => {
740
747
  "min",
741
748
  "pattern",
742
749
  "validate",
743
- "setValueAs",
744
750
  "disabled",
745
751
  "onChange",
746
752
  "onBlur",
747
753
  "value",
754
+ "defaultValue",
748
755
  "shouldUnregister",
749
756
  "deps"
750
757
  ]);
751
- const { register, getFieldState } = (0, import_react_hook_form11.useFormContext)();
752
758
  return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
753
- import_mui_form_utils4.Select,
754
- __spreadValues(__spreadProps(__spreadValues({}, rest), {
755
- error: !!getFieldState(name).error,
756
- required: !!required
757
- }), register(name, {
758
- required,
759
- maxLength,
760
- minLength,
761
- max,
762
- min,
763
- pattern,
764
- validate,
765
- setValueAs,
759
+ import_react_hook_form11.Controller,
760
+ {
761
+ name,
762
+ defaultValue,
766
763
  disabled,
767
- onChange,
768
- onBlur,
769
- value,
764
+ rules: {
765
+ required,
766
+ maxLength,
767
+ minLength,
768
+ max,
769
+ min,
770
+ pattern,
771
+ validate,
772
+ onChange,
773
+ onBlur,
774
+ value,
775
+ shouldUnregister,
776
+ deps
777
+ },
770
778
  shouldUnregister,
771
- deps
772
- }))
779
+ render: ({ field, fieldState: { error } }) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
780
+ import_mui_form_utils4.Select,
781
+ __spreadProps(__spreadValues(__spreadValues({}, rest), field), {
782
+ error: !!error,
783
+ required: typeof required === "object" ? required.value : !!required
784
+ })
785
+ )
786
+ }
773
787
  );
774
788
  };
775
789
 
@@ -788,8 +802,8 @@ var ControlledTextField = (_a) => {
788
802
  min,
789
803
  pattern,
790
804
  validate,
791
- setValueAs,
792
805
  disabled,
806
+ defaultValue,
793
807
  onChange,
794
808
  onBlur,
795
809
  value,
@@ -805,44 +819,48 @@ var ControlledTextField = (_a) => {
805
819
  "min",
806
820
  "pattern",
807
821
  "validate",
808
- "setValueAs",
809
822
  "disabled",
823
+ "defaultValue",
810
824
  "onChange",
811
825
  "onBlur",
812
826
  "value",
813
827
  "shouldUnregister",
814
828
  "deps"
815
829
  ]);
816
- var _a2;
817
- const { register, getFieldState } = (0, import_react_hook_form12.useFormContext)();
818
- const errorMessage = (_a2 = getFieldState(name).error) == null ? void 0 : _a2.message;
819
830
  return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
820
- import_mui_textfield.TextField,
821
- __spreadProps(__spreadValues(__spreadProps(__spreadValues({}, rest), {
822
- required: !!required
823
- }), register(name, {
824
- required,
825
- maxLength,
826
- minLength,
827
- max,
828
- min,
829
- pattern,
830
- validate,
831
- setValueAs,
831
+ import_react_hook_form12.Controller,
832
+ {
833
+ name,
834
+ defaultValue,
832
835
  disabled,
833
- onChange,
834
- onBlur,
835
- value,
836
+ rules: {
837
+ required,
838
+ maxLength,
839
+ minLength,
840
+ max,
841
+ min,
842
+ pattern,
843
+ validate,
844
+ onChange,
845
+ onBlur,
846
+ value,
847
+ shouldUnregister,
848
+ deps
849
+ },
836
850
  shouldUnregister,
837
- deps
838
- })), {
839
- error: !!getFieldState(name).error,
840
- helperText: errorMessage && typeof errorMessage === "string" ? /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
841
- errorMessage,
842
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("br", {}),
843
- helperText
844
- ] }) : helperText
845
- })
851
+ render: ({ field, fieldState: { error } }) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
852
+ import_mui_textfield.TextField,
853
+ __spreadProps(__spreadValues(__spreadValues({}, rest), field), {
854
+ required: typeof required === "object" ? required.value : !!required,
855
+ error: !!error,
856
+ helperText: (error == null ? void 0 : error.message) ? /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
857
+ error.message,
858
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("br", {}),
859
+ helperText
860
+ ] }) : helperText
861
+ })
862
+ )
863
+ }
846
864
  );
847
865
  };
848
866
  // Annotate the CommonJS export names for ESM import in node: