kui-complex 0.0.59 → 0.0.60

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/cjs/index.js CHANGED
@@ -502,7 +502,7 @@ var InputWithMask = React.forwardRef(function (_a, ref) {
502
502
  });
503
503
 
504
504
  var InputWithController = React.forwardRef(function (_a, ref) {
505
- var form = _a.form, name = _a.name, error = _a.error, value = _a.value, inputProps = __rest(_a, ["form", "name", "error", "value"]);
505
+ var form = _a.form, name = _a.name, error = _a.error, value = _a.value, type = _a.type, inputProps = __rest(_a, ["form", "name", "error", "value", "type"]);
506
506
  var handleChange = function (e, field) {
507
507
  field.onChange(e);
508
508
  if (inputProps.onChange) {
@@ -515,12 +515,19 @@ var InputWithController = React.forwardRef(function (_a, ref) {
515
515
  ? error
516
516
  : (_a = fieldState.error) === null || _a === void 0 ? void 0 : _a.message;
517
517
  };
518
+ var getValue = function (field) {
519
+ if (typeof value === "undefined") {
520
+ if (typeof field.value !== "undefined")
521
+ return field.value;
522
+ return type === "number" ? null : "";
523
+ }
524
+ return value;
525
+ };
518
526
  return (jsxRuntime.jsx(reactHookForm.Controller, { control: form === null || form === void 0 ? void 0 : form.control, name: name, render: function (_a) {
519
- var _b;
520
527
  var field = _a.field, fieldState = _a.fieldState;
521
528
  return (jsxRuntime.jsx(kuiBasic.InputWithAdornments, __assign({ message: getError(fieldState) }, field, inputProps, { onChange: function (e) {
522
529
  return handleChange(e, field);
523
- }, value: typeof value !== "undefined" ? value : (_b = field.value) !== null && _b !== void 0 ? _b : "", inputRef: ref })));
530
+ }, type: type, value: getValue(field), inputRef: ref })));
524
531
  } }));
525
532
  });
526
533