@nation-a/ui 0.15.2 → 0.15.3
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 +11 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +11 -8
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -19885,6 +19885,7 @@ const Textarea = forwardRef(
|
|
|
19885
19885
|
...rest
|
|
19886
19886
|
}, ref) => {
|
|
19887
19887
|
const [count, setCount] = useState((value == null ? void 0 : value.toString().length) || 0);
|
|
19888
|
+
const [text, setText] = useState(value);
|
|
19888
19889
|
const recipe = inputRecipe({
|
|
19889
19890
|
variant,
|
|
19890
19891
|
color: color2,
|
|
@@ -19900,8 +19901,8 @@ const Textarea = forwardRef(
|
|
|
19900
19901
|
if (disabled) return;
|
|
19901
19902
|
const { value: value2 } = e2.target;
|
|
19902
19903
|
e2.target.value = value2.slice(0, textLimit);
|
|
19904
|
+
setText(e2.target.value);
|
|
19903
19905
|
onChange == null ? void 0 : onChange(e2);
|
|
19904
|
-
if (showTextCount) setCount(value2.length);
|
|
19905
19906
|
},
|
|
19906
19907
|
[disabled, onChange, textLimit, showTextCount]
|
|
19907
19908
|
);
|
|
@@ -19928,17 +19929,19 @@ const Textarea = forwardRef(
|
|
|
19928
19929
|
},
|
|
19929
19930
|
[recipe.label, required, RequiredStar]
|
|
19930
19931
|
);
|
|
19931
|
-
const TextLengthIndicator =
|
|
19932
|
-
({
|
|
19933
|
-
|
|
19934
|
-
|
|
19935
|
-
|
|
19936
|
-
|
|
19932
|
+
const TextLengthIndicator = ({ count: count2, limit }) => {
|
|
19933
|
+
return /* @__PURE__ */ jsx("span", { className: recipe.textLengthIndicator, children: `${count2}${limit ? ` / ${limit}` : ""}` });
|
|
19934
|
+
};
|
|
19935
|
+
useEffect(() => {
|
|
19936
|
+
const textUpdated = value == null ? void 0 : value.toString().slice(0, textLimit);
|
|
19937
|
+
setText(textUpdated);
|
|
19938
|
+
setCount((textUpdated == null ? void 0 : textUpdated.length) || 0);
|
|
19939
|
+
}, [value]);
|
|
19937
19940
|
return /* @__PURE__ */ jsxs(VStack2, { gap: 1, className: "group", "data-disabled": disabled || void 0, css: { width: "100%" }, children: [
|
|
19938
19941
|
/* @__PURE__ */ jsx(Label2, { visible: !!(label && labelPosition === "outside"), children: label }),
|
|
19939
19942
|
/* @__PURE__ */ jsxs(Stack2, { gap: 1, className: cx(recipe.inputContainer, className), onClick: handleContainerClick, css: css2, children: [
|
|
19940
19943
|
/* @__PURE__ */ jsx(Label2, { visible: !!(label && labelPosition === "inside"), children: label }),
|
|
19941
|
-
/* @__PURE__ */ jsx("textarea", { ref: inputRef, value, disabled, onChange: handleTextareaChange, ...rest }),
|
|
19944
|
+
/* @__PURE__ */ jsx("textarea", { ref: inputRef, value: text, disabled, onChange: handleTextareaChange, ...rest }),
|
|
19942
19945
|
showTextCount && /* @__PURE__ */ jsx(TextLengthIndicator, { count, limit: textLimit })
|
|
19943
19946
|
] }),
|
|
19944
19947
|
description && /* @__PURE__ */ jsx(Description2, { children: description })
|