@vkzstudio/muza-ui 1.0.21 → 1.0.22

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.
@@ -1,22 +1,20 @@
1
- import { jsxs as A, jsx as m } from "react/jsx-runtime";
2
- import { forwardRef as C, useId as G, useRef as H, useState as U } from "react";
3
- import { cva as B } from "class-variance-authority";
1
+ import { jsxs as G, jsx as l } from "react/jsx-runtime";
2
+ import { forwardRef as H, useId as U, useRef as W, useState as B } from "react";
3
+ import { cva as h } from "class-variance-authority";
4
4
  import { FormField as D } from "../FormField/FormField.js";
5
- import { cn as f } from "../../utils/cn.js";
6
- import { typographyVariants as h } from "../Typography/Typography.js";
7
- const E = B(
5
+ import { cn as x } from "../../utils/cn.js";
6
+ import { typographyVariants as b } from "../Typography/Typography.js";
7
+ const E = h(
8
8
  [
9
- h({
9
+ b({
10
10
  variant: "body",
11
11
  weight: "medium",
12
12
  size: "base"
13
13
  }),
14
- "w-full bg-comp-input-fill-def px-comp-input-p-hor py-xl font-text text-comp-input-text-primary transition-colors",
14
+ "w-full font-text text-comp-input-text-primary transition-colors outline-none",
15
15
  "placeholder:font-regular placeholder:text-comp-input-text-placeholder",
16
- "rounded-xl border border-comp-input-stroke-def",
17
- "hover:border-comp-input-stroke-hover",
18
- "disabled:cursor-not-allowed disabled:border-comp-input-stroke-disabled disabled:bg-comp-input-fill-disabled",
19
- "outline-none focus:border-comp-input-stroke-focused"
16
+ "mr-[calc(var(--spacing-xl)/2)] pt-xl pr-[calc(var(--spacing-comp-input-p-hor)-var(--spacing-xl)/2)] pb-[calc(var(--spacing-xl)/2)] pl-comp-input-p-hor",
17
+ "disabled:cursor-not-allowed"
20
18
  ],
21
19
  {
22
20
  variants: {
@@ -38,36 +36,57 @@ const E = B(
38
36
  resize: "none"
39
37
  }
40
38
  }
41
- ), J = C(
39
+ ), J = h(
40
+ [
41
+ "overflow-hidden rounded-xl border border-comp-input-stroke-def bg-comp-input-fill-def transition-colors",
42
+ "focus-within:border-comp-texteditor-stroke-focused",
43
+ "pb-[calc(var(--spacing-xl)/2)]",
44
+ // Offset scrollbar to make resize handle visible
45
+ "flex"
46
+ ],
47
+ {
48
+ variants: {
49
+ state: {
50
+ default: "border-comp-texteditor-stroke-def hover:border-comp-texteditor-stroke-hover",
51
+ disabled: "cursor-not-allowed border-comp-input-stroke-disabled bg-comp-input-fill-disabled",
52
+ error: "border-comp-texteditor-stroke-error"
53
+ }
54
+ },
55
+ defaultVariants: {
56
+ state: "default"
57
+ }
58
+ }
59
+ ), K = H(
42
60
  ({
43
- className: x,
44
- label: b,
45
- hint: g,
46
- id: y,
47
- error: o,
48
- resize: v,
49
- autoResize: l,
50
- errorMessage: s,
51
- required: r,
52
- disableRequiredAsterisk: z,
53
- labelExtra: w,
54
- infoTooltip: I,
55
- showCharacterCount: k,
56
- value: n,
61
+ className: g,
62
+ label: v,
63
+ hint: y,
64
+ id: w,
65
+ error: e,
66
+ resize: z,
67
+ autoResize: s,
68
+ errorMessage: c,
69
+ required: o,
70
+ disableRequiredAsterisk: k,
71
+ labelExtra: I,
72
+ infoTooltip: N,
73
+ showCharacterCount: R,
74
+ value: a,
57
75
  defaultValue: d,
58
- onChange: i,
59
- ...a
60
- }, c) => {
61
- const R = G(), e = y ?? R, N = `${e}-hint`, F = `${e}-label`, S = H(null), p = (typeof c == "function" ? null : c) ?? S, u = n !== void 0, [$, j] = U(
76
+ onChange: n,
77
+ disabled: p,
78
+ ...i
79
+ }, u) => {
80
+ const V = U(), r = w ?? V, F = `${r}-hint`, S = `${r}-label`, $ = W(null), m = (typeof u == "function" ? null : u) ?? $, f = a !== void 0, [j, A] = B(
62
81
  () => String(d ?? "").length
63
- ), L = u ? String(n).length : $, T = () => {
64
- const t = p.current;
65
- t && (t.style.height = "auto", t.style.height = `${t.scrollHeight + 2}px`);
66
- }, V = k && a.maxLength != null ? /* @__PURE__ */ A(
82
+ ), L = f ? String(a).length : j, T = () => {
83
+ const t = m.current;
84
+ t && (t.style.height = "auto", t.style.height = `${t.scrollHeight}px`);
85
+ }, C = R && i.maxLength != null ? /* @__PURE__ */ G(
67
86
  "span",
68
87
  {
69
- className: f(
70
- h({
88
+ className: x(
89
+ b({
71
90
  variant: "body",
72
91
  weight: "regular",
73
92
  size: "sm"
@@ -77,50 +96,51 @@ const E = B(
77
96
  children: [
78
97
  L,
79
98
  "/",
80
- a.maxLength
99
+ i.maxLength
81
100
  ]
82
101
  }
83
102
  ) : void 0;
84
- return /* @__PURE__ */ m(
103
+ return /* @__PURE__ */ l(
85
104
  D,
86
105
  {
87
- label: b,
88
- hint: o && s ? s : g,
89
- error: o,
90
- required: r,
91
- disableRequiredAsterisk: z,
92
- htmlFor: e,
93
- labelId: F,
94
- hintId: N,
95
- labelExtra: w,
96
- infoTooltip: I,
97
- labelRight: V,
98
- children: /* @__PURE__ */ m(
106
+ label: v,
107
+ hint: e && c ? c : y,
108
+ error: e,
109
+ required: o,
110
+ disableRequiredAsterisk: k,
111
+ htmlFor: r,
112
+ labelId: S,
113
+ hintId: F,
114
+ labelExtra: I,
115
+ infoTooltip: N,
116
+ labelRight: C,
117
+ children: /* @__PURE__ */ l("div", { className: J({ state: p ? "disabled" : e ? "error" : "default" }), children: /* @__PURE__ */ l(
99
118
  "textarea",
100
119
  {
101
120
  "data-slot": "textarea",
102
- ref: p,
103
- id: e,
104
- required: r,
105
- "aria-required": r,
106
- className: f(
107
- E({ error: o, resize: v, autoResize: l }),
108
- x
121
+ ref: m,
122
+ id: r,
123
+ required: o,
124
+ "aria-required": o,
125
+ className: x(
126
+ E({ error: e, resize: z, autoResize: s }),
127
+ g
109
128
  ),
110
- value: n,
129
+ value: a,
111
130
  defaultValue: d,
112
131
  onChange: (t) => {
113
- u || j(t.target.value.length), i == null || i(t);
132
+ f || A(t.target.value.length), n == null || n(t);
114
133
  },
115
- ...a,
116
- onInput: l ? T : void 0
134
+ disabled: p,
135
+ ...i,
136
+ onInput: s ? T : void 0
117
137
  }
118
- )
138
+ ) })
119
139
  }
120
140
  );
121
141
  }
122
142
  );
123
- J.displayName = "Textarea";
143
+ K.displayName = "Textarea";
124
144
  export {
125
- J as Textarea
145
+ K as Textarea
126
146
  };