@nation-a/ui 0.15.2 → 0.16.0

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 CHANGED
@@ -19322,8 +19322,7 @@ const navigationRecipe = sva({
19322
19322
  flexDirection: "row",
19323
19323
  justifyContent: "space-around",
19324
19324
  bg: "surface.layer_1",
19325
- pt: 2,
19326
- pb: 8
19325
+ py: 2
19327
19326
  },
19328
19327
  trigger: {
19329
19328
  display: "flex",
@@ -19903,6 +19902,7 @@ const Textarea = React.forwardRef(
19903
19902
  ...rest
19904
19903
  }, ref) => {
19905
19904
  const [count, setCount] = React.useState((value == null ? void 0 : value.toString().length) || 0);
19905
+ const [text, setText] = React.useState(value);
19906
19906
  const recipe = inputRecipe({
19907
19907
  variant,
19908
19908
  color: color2,
@@ -19918,8 +19918,8 @@ const Textarea = React.forwardRef(
19918
19918
  if (disabled) return;
19919
19919
  const { value: value2 } = e2.target;
19920
19920
  e2.target.value = value2.slice(0, textLimit);
19921
+ setText(e2.target.value);
19921
19922
  onChange == null ? void 0 : onChange(e2);
19922
- if (showTextCount) setCount(value2.length);
19923
19923
  },
19924
19924
  [disabled, onChange, textLimit, showTextCount]
19925
19925
  );
@@ -19946,17 +19946,19 @@ const Textarea = React.forwardRef(
19946
19946
  },
19947
19947
  [recipe.label, required, RequiredStar]
19948
19948
  );
19949
- const TextLengthIndicator = React.useCallback(
19950
- ({ count: count2, limit }) => {
19951
- return /* @__PURE__ */ jsxRuntime.jsx("span", { className: recipe.textLengthIndicator, children: `${count2}${limit ? ` / ${limit}` : ""}` });
19952
- },
19953
- [recipe.textLengthIndicator]
19954
- );
19949
+ const TextLengthIndicator = ({ count: count2, limit }) => {
19950
+ return /* @__PURE__ */ jsxRuntime.jsx("span", { className: recipe.textLengthIndicator, children: `${count2}${limit ? ` / ${limit}` : ""}` });
19951
+ };
19952
+ React.useEffect(() => {
19953
+ const textUpdated = value == null ? void 0 : value.toString().slice(0, textLimit);
19954
+ setText(textUpdated);
19955
+ setCount((textUpdated == null ? void 0 : textUpdated.length) || 0);
19956
+ }, [value]);
19955
19957
  return /* @__PURE__ */ jsxRuntime.jsxs(VStack2, { gap: 1, className: "group", "data-disabled": disabled || void 0, css: { width: "100%" }, children: [
19956
19958
  /* @__PURE__ */ jsxRuntime.jsx(Label2, { visible: !!(label && labelPosition === "outside"), children: label }),
19957
19959
  /* @__PURE__ */ jsxRuntime.jsxs(Stack2, { gap: 1, className: cx(recipe.inputContainer, className), onClick: handleContainerClick, css: css2, children: [
19958
19960
  /* @__PURE__ */ jsxRuntime.jsx(Label2, { visible: !!(label && labelPosition === "inside"), children: label }),
19959
- /* @__PURE__ */ jsxRuntime.jsx("textarea", { ref: inputRef, value, disabled, onChange: handleTextareaChange, ...rest }),
19961
+ /* @__PURE__ */ jsxRuntime.jsx("textarea", { ref: inputRef, value: text, disabled, onChange: handleTextareaChange, ...rest }),
19960
19962
  showTextCount && /* @__PURE__ */ jsxRuntime.jsx(TextLengthIndicator, { count, limit: textLimit })
19961
19963
  ] }),
19962
19964
  description && /* @__PURE__ */ jsxRuntime.jsx(Description2, { children: description })