kui-complex 0.0.48 → 0.0.50

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/index.d.ts CHANGED
@@ -155,7 +155,7 @@ declare const InputSelectDropdown: React.ForwardRefExoticComponent<InputSelectDr
155
155
 
156
156
  declare const InputTextAreaMobile: React.ForwardRefExoticComponent<Pick<any, string | number | symbol> & React.RefAttributes<unknown>>;
157
157
 
158
- declare const InputWithController: React.ForwardRefExoticComponent<InputWithControllerProps & React.RefAttributes<HTMLInputElement>>;
158
+ declare const InputWithController: React.ForwardRefExoticComponent<InputWithControllerProps & React.RefAttributes<HTMLInputElement | null>>;
159
159
 
160
160
  declare const InputWithDatePicker: React.ForwardRefExoticComponent<Pick<{
161
161
  title?: string | undefined;
package/index.js CHANGED
@@ -464,14 +464,6 @@ var InputWithController = forwardRef(function (_a, ref) {
464
464
  inputProps.onChange(e);
465
465
  }
466
466
  };
467
- var forwardedRef = function (elem, field) {
468
- if (ref) {
469
- // eslint-disable-next-line no-param-reassign
470
- // @ts-ignore
471
- ref.current = elem;
472
- }
473
- field.ref(elem);
474
- };
475
467
  var getError = function (fieldState) {
476
468
  var _a;
477
469
  return typeof error !== "undefined" && String(error).length > 0
@@ -482,7 +474,7 @@ var InputWithController = forwardRef(function (_a, ref) {
482
474
  var field = _a.field, fieldState = _a.fieldState;
483
475
  return (jsx(InputWithAdornments, __assign({ message: getError(fieldState) }, field, inputProps, { onChange: function (e) {
484
476
  return handleChange(e, field);
485
- }, value: typeof value !== "undefined" ? value : field.value || "", ref: function (e) { return forwardedRef(e, field); } })));
477
+ }, value: typeof value !== "undefined" ? value : field.value || "", inputRef: ref })));
486
478
  } }));
487
479
  });
488
480
 
@@ -865,9 +857,17 @@ var InputPhoneWithForm = forwardRef(function (props, ref) {
865
857
  }
866
858
  phoneRegister.field.ref(elem);
867
859
  };
860
+ useEffect(function () {
861
+ if (!codeRegister.field.value) {
862
+ codeRegister.field.onChange({
863
+ target: { value: "7", name: "".concat(name, ".phoneCode") },
864
+ type: "change",
865
+ });
866
+ }
867
+ }, []);
868
868
  return (jsx(InputWithCountryDropdown, __assign({ message: errorMessage,
869
869
  // @ts-ignore
870
- hiddenInputProps: __assign(__assign({}, codeRegister.field), hiddenInputProps), onSelectCountry: handleCountryChange }, phoneRegister.field, other, { onChange: handleChange, ref: forwardedRef, autoComplete: "false" })));
870
+ hiddenInputProps: __assign(__assign(__assign({}, codeRegister.field), hiddenInputProps), { value: codeRegister.field.value || "7" }), onSelectCountry: handleCountryChange }, phoneRegister.field, other, { onChange: handleChange, ref: forwardedRef, autoComplete: "false" })));
871
871
  });
872
872
  InputPhoneWithForm.defaultProps = {
873
873
  name: "phone",