@kaio-xyz/design-system 1.1.60 → 1.1.61

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.cjs.js CHANGED
@@ -394,15 +394,17 @@ var TextField = React.forwardRef(function (_a, ref) {
394
394
  var className = _a.className, disabled = _a.disabled, hint = _a.hint, id = _a.id, label = _a.label, onChange = _a.onChange, readOnly = _a.readOnly, invalid = _a.invalid, button = _a.button, _b = _a.fullWidth, fullWidth = _b === void 0 ? false : _b, _c = _a.size, size = _c === void 0 ? "default" : _c, _d = _a.noPadding, noPadding = _d === void 0 ? false : _d, _e = _a.floatingLabel, floatingLabel = _e === void 0 ? true : _e, value = _a.value, defaultValue = _a.defaultValue, onFocus = _a.onFocus, onBlur = _a.onBlur, attributes = __rest(_a, ["className", "disabled", "hint", "id", "label", "onChange", "readOnly", "invalid", "button", "fullWidth", "size", "noPadding", "floatingLabel", "value", "defaultValue", "onFocus", "onBlur"]);
395
395
  var _f = React.useState(false), isFocused = _f[0], setIsFocused = _f[1];
396
396
  var _g = React.useState(false), isAutofilled = _g[0], setIsAutofilled = _g[1];
397
- var _h = React.useState(false), hasValue = _h[0], setHasValue = _h[1];
397
+ var _h = React.useState(function () { return Boolean(value || defaultValue); }), hasValue = _h[0], setHasValue = _h[1];
398
398
  var internalRef = React.useRef(null);
399
399
  var inputRef = ref || internalRef;
400
+ React.useEffect(function () {
401
+ if (value !== undefined)
402
+ setHasValue(value !== '');
403
+ }, [value]);
400
404
  React.useEffect(function () {
401
405
  var input = inputRef.current;
402
406
  if (!input)
403
407
  return;
404
- if (input.value)
405
- setHasValue(true);
406
408
  var handleAnimationStart = function (e) {
407
409
  if (e.animationName === 'onAutoFillStart')
408
410
  return setIsAutofilled(true);