@aivex/ui 1.2.0-dev.6 → 1.2.0-dev.7

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.js CHANGED
@@ -8479,33 +8479,53 @@ function r_({ className: e, size: t = "sm", label: n, helperText: r, error: i, d
8479
8479
  }
8480
8480
  //#endregion
8481
8481
  //#region src/components/Textarea/Textarea.tsx
8482
- function i_({ className: e, label: t, helperText: n, error: r, disabled: i, size: a = "md", minHeight: o, fixedHeight: s, startContent: c, endContent: l, id: u, ref: d, onFocus: f, onBlur: p, ...m }) {
8483
- let [h, g] = K(!1), _ = {};
8484
- return o !== void 0 && (_.minHeight = typeof o == "number" ? `${o}px` : o), s && o !== void 0 && (_.height = _.minHeight, _.maxHeight = _.minHeight), /* @__PURE__ */ q($l, {
8482
+ function i_({ className: e, label: t, helperText: n, error: r, disabled: i, size: a = "md", minHeight: o, fixedHeight: s, startContent: c, endContent: l, id: u, ref: d, onFocus: f, onBlur: p, maxLength: m, value: h, defaultValue: g, onChange: _, ...v }) {
8483
+ let [y, b] = K(!1), x = m != null, S = (e) => e == null ? 0 : String(e).length, [C, w] = K(() => S(h ?? g)), T = h == null ? C : S(h), E = !!r || x && T > m, D = (e) => {
8484
+ w(e.target.value.length), _?.(e);
8485
+ }, O = {};
8486
+ o !== void 0 && (O.minHeight = typeof o == "number" ? `${o}px` : o), s && o !== void 0 && (O.height = O.minHeight, O.maxHeight = O.minHeight);
8487
+ let k = /* @__PURE__ */ q("textarea", {
8488
+ ref: d,
8489
+ id: u,
8490
+ disabled: i,
8491
+ style: O,
8492
+ value: h,
8493
+ defaultValue: g,
8494
+ maxLength: x ? void 0 : m,
8495
+ className: R("aivex:w-full aivex:min-w-0 aivex:bg-transparent aivex:text-text-primary aivex:placeholder:text-text-tertiary aivex:outline-none", a === "sm" ? "aivex:text-body-md-regular" : "aivex:text-body-lg-regular", "aivex:resize-none aivex:overflow-auto", e),
8496
+ onChange: x ? D : _,
8497
+ onFocus: (e) => {
8498
+ b(!0), f?.(e);
8499
+ },
8500
+ onBlur: (e) => {
8501
+ b(!1), p?.(e);
8502
+ },
8503
+ ...v
8504
+ });
8505
+ return /* @__PURE__ */ q($l, {
8485
8506
  id: u,
8486
8507
  label: t,
8487
8508
  helperText: n,
8488
- error: r,
8509
+ error: E,
8489
8510
  disabled: i,
8490
- focused: h,
8511
+ focused: y,
8491
8512
  size: a,
8492
8513
  layout: "block",
8493
8514
  startContent: c,
8494
8515
  endContent: l,
8495
- children: /* @__PURE__ */ q("textarea", {
8496
- ref: d,
8497
- id: u,
8498
- disabled: i,
8499
- style: _,
8500
- className: R("aivex:w-full aivex:min-w-0 aivex:bg-transparent aivex:text-text-primary aivex:placeholder:text-text-tertiary aivex:outline-none", a === "sm" ? "aivex:text-body-md-regular" : "aivex:text-body-lg-regular", s ? "aivex:resize-none aivex:overflow-auto" : "aivex:resize-vertical", e),
8501
- onFocus: (e) => {
8502
- g(!0), f?.(e);
8503
- },
8504
- onBlur: (e) => {
8505
- g(!1), p?.(e);
8506
- },
8507
- ...m
8508
- })
8516
+ children: x ? /* @__PURE__ */ J("div", {
8517
+ className: "aivex:flex aivex:w-full aivex:flex-col aivex:gap-xs",
8518
+ children: [k, /* @__PURE__ */ J("div", {
8519
+ className: "aivex:flex aivex:w-full aivex:items-center aivex:justify-end aivex:gap-2xs aivex:text-body-sm-regular aivex:whitespace-nowrap",
8520
+ children: [/* @__PURE__ */ q("span", {
8521
+ className: E ? "aivex:text-text-danger" : "aivex:text-text-tertiary",
8522
+ children: T
8523
+ }), /* @__PURE__ */ q("span", {
8524
+ className: "aivex:text-text-tertiary",
8525
+ children: `/ ${m}`
8526
+ })]
8527
+ })]
8528
+ }) : k
8509
8529
  });
8510
8530
  }
8511
8531
  //#endregion