@kaio-xyz/design-system 1.1.64 → 1.1.66
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 -2
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +8 -2
- 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
|
@@ -391,12 +391,18 @@ var Hint = function (_a) {
|
|
|
391
391
|
var style$q = {"field":"text-field-module__field__iZ0TF","label":"text-field-module__label__ClJkz","container":"text-field-module__container__IKtNZ","fieldWrapper":"text-field-module__fieldWrapper__nQ7l8","textField":"text-field-module__textField__756eR","hint":"text-field-module__hint__Ad6VA"};
|
|
392
392
|
|
|
393
393
|
var TextField = React.forwardRef(function (_a, ref) {
|
|
394
|
-
var className = _a.className, disabled = _a.disabled, hint = _a.hint, id = _a.id, label = _a.label, onChange = _a.onChange, readOnly = _a.readOnly,
|
|
394
|
+
var className = _a.className, disabled = _a.disabled, hint = _a.hint, id = _a.id, label = _a.label, onChange = _a.onChange, readOnly = _a.readOnly, 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", "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
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
|
+
var input = inputRef.current;
|
|
402
|
+
if (input && input.value) {
|
|
403
|
+
setHasValue(true);
|
|
404
|
+
}
|
|
405
|
+
}, []);
|
|
400
406
|
React.useEffect(function () {
|
|
401
407
|
if (value !== undefined)
|
|
402
408
|
setHasValue(value !== '');
|
|
@@ -427,7 +433,7 @@ var TextField = React.forwardRef(function (_a, ref) {
|
|
|
427
433
|
setHasValue(e.target.value.length > 0);
|
|
428
434
|
onChange === null || onChange === void 0 ? void 0 : onChange(e);
|
|
429
435
|
};
|
|
430
|
-
return (jsxRuntime.jsx("fieldset", { "aria-disabled": disabled, disabled: disabled, className: clsx(style$q.textField, className), "data-no-padding": noPadding, "data-full-width": fullWidth, children: jsxRuntime.jsxs("div", { className: style$q.container, "data-has-label": !!label, "data-has-hint": !!hint, "data-has-button": !!button, "data-floating-label": floatingLabel, children: [label && (jsxRuntime.jsx("label", { className: style$q.label, htmlFor: id, "data-floating": floatingLabel, "data-active": isLabelFloating, children: label })), jsxRuntime.jsxs("div", { className: style$q.fieldWrapper, children: [jsxRuntime.jsx("input", __assign({ "aria-readonly": readOnly, className: style$q.field, readOnly: readOnly, "data-type": "single", "data-size": size, "data-floating-label": floatingLabel, id: id, onChange: handleChange, onFocus: handleFocus, onBlur: handleBlur,
|
|
436
|
+
return (jsxRuntime.jsx("fieldset", { "aria-disabled": disabled, disabled: disabled, className: clsx(style$q.textField, className), "data-no-padding": noPadding, "data-full-width": fullWidth, children: jsxRuntime.jsxs("div", { className: style$q.container, "data-has-label": !!label, "data-has-hint": !!hint, "data-has-button": !!button, "data-floating-label": floatingLabel, children: [label && (jsxRuntime.jsx("label", { className: style$q.label, htmlFor: id, "data-floating": floatingLabel, "data-active": isLabelFloating, children: label })), jsxRuntime.jsxs("div", { className: style$q.fieldWrapper, children: [jsxRuntime.jsx("input", __assign({ "aria-readonly": readOnly, className: style$q.field, readOnly: readOnly, "data-type": "single", "data-size": size, "data-floating-label": floatingLabel, id: id, onChange: handleChange, onFocus: handleFocus, onBlur: handleBlur, ref: inputRef, type: "text", value: value, defaultValue: defaultValue }, attributes)), button ? button : null, hint && jsxRuntime.jsx(Hint, { kind: "error", className: style$q.hint, children: hint })] })] }) }));
|
|
431
437
|
});
|
|
432
438
|
TextField.displayName = "TextField";
|
|
433
439
|
|