@kaio-xyz/design-system 1.1.123 → 1.1.125
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 +8 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +8 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -494,6 +494,13 @@ var Select = function (_a) {
|
|
|
494
494
|
var v = defaultValue;
|
|
495
495
|
return v != null && (!Array.isArray(v) || v.length > 0);
|
|
496
496
|
}), uncontrolledHasValue = _c[0], setUncontrolledHasValue = _c[1];
|
|
497
|
+
var prevValueRef = React.useRef(value);
|
|
498
|
+
React.useEffect(function () {
|
|
499
|
+
if (prevValueRef.current !== undefined && value === undefined) {
|
|
500
|
+
setUncontrolledHasValue(false);
|
|
501
|
+
}
|
|
502
|
+
prevValueRef.current = value;
|
|
503
|
+
}, [value]);
|
|
497
504
|
var controlledHasValue = value !== undefined
|
|
498
505
|
? (value != null && (!Array.isArray(value) || value.length > 0))
|
|
499
506
|
: uncontrolledHasValue;
|
|
@@ -511,7 +518,7 @@ var FormSelect = function (_a) {
|
|
|
511
518
|
var name = _a.name, control = _a.control, rules = _a.rules, defaultValue = _a.defaultValue, rest = __rest(_a, ["name", "control", "rules", "defaultValue"]);
|
|
512
519
|
return (jsxRuntime.jsx(reactHookForm.Controller, { name: name, control: control, rules: rules, defaultValue: defaultValue, render: function (_a) {
|
|
513
520
|
var _b = _a.field, value = _b.value, onChange = _b.onChange, onBlur = _b.onBlur;
|
|
514
|
-
return (jsxRuntime.jsx(Select, __assign({}, rest, { value: value
|
|
521
|
+
return (jsxRuntime.jsx(Select, __assign({}, rest, { value: value !== null && value !== void 0 ? value : null, onChange: onChange, onBlur: onBlur })));
|
|
515
522
|
} }));
|
|
516
523
|
};
|
|
517
524
|
FormSelect.displayName = "FormSelect";
|