@vkzstudio/muza-ui 1.0.21 → 1.0.23

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.
Files changed (29) hide show
  1. package/dist/components/Calendar/Calendar.d.ts +28 -3
  2. package/dist/components/Calendar/Calendar.d.ts.map +1 -1
  3. package/dist/components/Calendar/Calendar.js +209 -134
  4. package/dist/components/Calendar/CalendarBase.stories.d.ts +2 -0
  5. package/dist/components/Calendar/CalendarBase.stories.d.ts.map +1 -1
  6. package/dist/components/DatePicker/DatePicker.d.ts +5 -0
  7. package/dist/components/DatePicker/DatePicker.d.ts.map +1 -1
  8. package/dist/components/DatePicker/DatePicker.js +96 -77
  9. package/dist/components/DatePicker/DatePicker.stories.d.ts +3 -0
  10. package/dist/components/DatePicker/DatePicker.stories.d.ts.map +1 -1
  11. package/dist/components/Dialog/Dialog.js +8 -8
  12. package/dist/components/FileUpload/FileItem.js +1 -1
  13. package/dist/components/FileUpload/FileUpload.d.ts +5 -1
  14. package/dist/components/FileUpload/FileUpload.d.ts.map +1 -1
  15. package/dist/components/FileUpload/FileUpload.js +152 -121
  16. package/dist/components/FileUpload/FileUpload.stories.d.ts +2 -0
  17. package/dist/components/FileUpload/FileUpload.stories.d.ts.map +1 -1
  18. package/dist/components/Textarea/Textarea.d.ts.map +1 -1
  19. package/dist/components/Textarea/Textarea.js +85 -65
  20. package/dist/muza-ui.css +1 -1
  21. package/dist/translations/locales/cs.d.ts.map +1 -1
  22. package/dist/translations/locales/cs.js +1 -0
  23. package/dist/translations/locales/en.d.ts.map +1 -1
  24. package/dist/translations/locales/en.js +1 -0
  25. package/dist/translations/locales/sk.d.ts.map +1 -1
  26. package/dist/translations/locales/sk.js +1 -0
  27. package/dist/translations/types.d.ts +2 -0
  28. package/dist/translations/types.d.ts.map +1 -1
  29. package/package.json +1 -1
@@ -1,15 +1,15 @@
1
- import { jsxs as f, jsx as a, Fragment as re } from "react/jsx-runtime";
2
- import * as y from "react";
3
- import { cva as G } from "class-variance-authority";
4
- import { useDropzone as le } from "react-dropzone";
5
- import { FileItem as K } from "./FileItem.js";
6
- import { useMuzaTranslations as se } from "../../translations/TranslationContext.js";
7
- import { Flex as _ } from "../Flex/Flex.js";
8
- import { FormField as ie } from "../FormField/FormField.js";
9
- import { cn as B } from "../../utils/cn.js";
10
- import { CloudUploadOutline as ae } from "@solar-icons/react-perf";
11
- import { Typography as k } from "../Typography/Typography.js";
12
- const de = G(
1
+ import { jsxs as n, jsx as a, Fragment as pe } from "react/jsx-runtime";
2
+ import * as v from "react";
3
+ import { cva as Y } from "class-variance-authority";
4
+ import { useDropzone as ue } from "react-dropzone";
5
+ import { FileItem as Q } from "./FileItem.js";
6
+ import { useMuzaTranslations as fe } from "../../translations/TranslationContext.js";
7
+ import { Flex as W } from "../Flex/Flex.js";
8
+ import { FormField as ne } from "../FormField/FormField.js";
9
+ import { cn as X } from "../../utils/cn.js";
10
+ import { CloudUploadOutline as me } from "@solar-icons/react-perf";
11
+ import { Typography as M } from "../Typography/Typography.js";
12
+ const ge = Y(
13
13
  [
14
14
  "group relative cursor-pointer rounded-xl border-1 border-dashed transition-colors",
15
15
  "p-4xl pt-3xl pr-4xl pb-3xl",
@@ -45,7 +45,7 @@ const de = G(
45
45
  }
46
46
  }
47
47
  }
48
- ), pe = G(
48
+ ), xe = Y(
49
49
  [
50
50
  "text-center transition-colors",
51
51
  "text-comp-file-upload-text-dark-secondary"
@@ -57,119 +57,139 @@ const de = G(
57
57
  }
58
58
  }
59
59
  }
60
- ), ce = y.forwardRef(
60
+ ), he = v.forwardRef(
61
61
  ({
62
- className: $,
63
- onDrop: x,
64
- accept: u,
65
- multiple: w = !0,
66
- maxSize: g,
67
- maxSizeErrorMessage: J,
68
- size: N = "base",
62
+ className: U,
63
+ onDrop: z,
64
+ accept: m,
65
+ multiple: A = !0,
66
+ maxSize: y,
67
+ maxSizeErrorMessage: Z,
68
+ maxFiles: i,
69
+ maxFilesErrorMessage: q,
70
+ size: P = "base",
69
71
  disabled: p = !1,
70
- readOnly: m = !1,
71
- dropzoneOptions: L,
72
- label: I,
73
- title: Q,
74
- subtitle: R,
75
- preselectedFiles: W = [],
76
- fileStatus: X = [],
77
- itemErrors: b,
78
- itemHints: h,
79
- error: Y,
80
- required: v,
81
- disableRequiredAsterisk: Z,
72
+ readOnly: g = !1,
73
+ dropzoneOptions: O,
74
+ label: V,
75
+ title: H,
76
+ subtitle: K,
77
+ preselectedFiles: D = [],
78
+ fileStatus: C = [],
79
+ itemErrors: S,
80
+ itemHints: F,
81
+ error: E,
82
+ required: k,
83
+ disableRequiredAsterisk: ee,
82
84
  onError: t,
83
- onDelete: z,
84
- onChange: c,
85
- preselectedUrls: M = [],
86
- onDeleteUrl: F,
87
- labelExtra: q,
88
- infoTooltip: O,
89
- ...H
90
- }, D) => {
91
- const n = se(), [S, U] = y.useState(W), [j, A] = y.useState(!1), E = Q ?? n.fileUpload.title, P = g ? n.fileUpload.maxSizeError.replace(
85
+ onDelete: w,
86
+ onChange: u,
87
+ preselectedUrls: x = [],
88
+ onDeleteUrl: $,
89
+ labelExtra: te,
90
+ infoTooltip: oe,
91
+ ...le
92
+ }, se) => {
93
+ const f = fe(), [h, _] = v.useState(D), [j, N] = v.useState(!1), [B, b] = v.useState(!1), T = h.length + x.length, re = H ?? f.fileUpload.title, I = i != null ? f.fileUpload.maxFilesError.replace("{count}", String(i)) : "", R = q ?? I, G = y ? f.fileUpload.maxSizeError.replace(
92
94
  "{size}",
93
- (g / (1024 * 1024)).toFixed(0)
94
- ) : "", T = J ?? P, { getRootProps: C, getInputProps: ee, isDragActive: oe } = le({
95
- onDrop: (e, l) => {
95
+ (y / (1024 * 1024)).toFixed(0)
96
+ ) : "", J = Z ?? G, { getRootProps: ae, getInputProps: ie, isDragActive: de } = ue({
97
+ onDrop: (e, s) => {
96
98
  try {
97
- if (A(!1), l.length > 0 && l.some(
98
- (r) => r.errors.some((s) => s.code === "file-too-large")
99
- )) {
100
- A(!0);
101
- const r = T || P;
102
- t == null || t(r, l[0].file);
99
+ if (N(!1), b(!1), s.length > 0) {
100
+ const o = s.some(
101
+ (l) => l.errors.some((r) => r.code === "file-too-large")
102
+ );
103
+ if (s.some(
104
+ (l) => l.errors.some((r) => r.code === "too-many-files")
105
+ )) {
106
+ b(!0);
107
+ const l = R || I;
108
+ t == null || t(l, s[0].file);
109
+ return;
110
+ }
111
+ if (o) {
112
+ N(!0);
113
+ const l = J || G;
114
+ t == null || t(l, s[0].file);
115
+ return;
116
+ }
117
+ }
118
+ if (i != null && T + e.length > i) {
119
+ b(!0);
120
+ const o = R || I;
121
+ t == null || t(o);
103
122
  return;
104
123
  }
105
- U((o) => {
106
- const r = new Set(
107
- o.map((i) => `${i.name}-${i.size}-${i.lastModified}`)
108
- ), s = e.filter(
109
- (i) => !r.has(`${i.name}-${i.size}-${i.lastModified}`)
110
- ), d = [...o, ...s];
111
- return c == null || c(d), d;
112
- }), x == null || x(e);
124
+ _((o) => {
125
+ const c = new Set(
126
+ o.map((d) => `${d.name}-${d.size}-${d.lastModified}`)
127
+ ), l = e.filter(
128
+ (d) => !c.has(`${d.name}-${d.size}-${d.lastModified}`)
129
+ ), r = [...o, ...l];
130
+ return u == null || u(r), r;
131
+ }), z == null || z(e);
113
132
  } catch (o) {
114
- const r = o instanceof Error ? o.message : n.fileUpload.processingError;
115
- t == null || t(r);
133
+ const c = o instanceof Error ? o.message : f.fileUpload.processingError;
134
+ t == null || t(c);
116
135
  }
117
136
  },
118
- accept: typeof u == "string" ? { [u]: [] } : u ? Object.fromEntries(u.map((e) => [e, []])) : void 0,
119
- multiple: w,
120
- maxSize: g,
137
+ accept: typeof m == "string" ? { [m]: [] } : m ? Object.fromEntries(m.map((e) => [e, []])) : void 0,
138
+ multiple: A,
139
+ maxSize: y,
140
+ maxFiles: i != null ? i - T : void 0,
121
141
  disabled: p,
122
- ...L
123
- }), V = m || !w && (S.length > 0 || M.length > 0);
124
- return /* @__PURE__ */ f(_, { direction: "column", gap: "lg", children: [
125
- (!V || I) && /* @__PURE__ */ a(
126
- ie,
142
+ ...O
143
+ }), L = g || !A && (h.length > 0 || x.length > 0) || i != null && T >= i;
144
+ return /* @__PURE__ */ n(W, { direction: "column", gap: "lg", children: [
145
+ (!L || V) && /* @__PURE__ */ a(
146
+ ne,
127
147
  {
128
- label: I,
129
- required: v,
130
- disableRequiredAsterisk: Z,
131
- labelExtra: q,
132
- infoTooltip: O,
133
- children: !V && /* @__PURE__ */ f(re, { children: [
134
- /* @__PURE__ */ f(
148
+ label: V,
149
+ required: k,
150
+ disableRequiredAsterisk: ee,
151
+ labelExtra: te,
152
+ infoTooltip: oe,
153
+ children: !L && /* @__PURE__ */ n(pe, { children: [
154
+ /* @__PURE__ */ n(
135
155
  "div",
136
156
  {
137
- ref: D,
157
+ ref: se,
138
158
  tabIndex: p ? void 0 : 0,
139
- className: B(
140
- de({
141
- error: Y || j,
159
+ className: X(
160
+ ge({
161
+ error: E || j || B,
142
162
  disabled: p,
143
- className: $,
144
- isDragActive: oe
163
+ className: U,
164
+ isDragActive: de
145
165
  })
146
166
  ),
147
- ...C(),
148
- ...H,
167
+ ...ae(),
168
+ ...le,
149
169
  children: [
150
170
  /* @__PURE__ */ a(
151
171
  "input",
152
172
  {
153
- ...ee({ required: v }),
154
- "aria-required": v
173
+ ...ie({ required: k }),
174
+ "aria-required": k
155
175
  }
156
176
  ),
157
- /* @__PURE__ */ a(ae, { className: "inline size-comp-file-upload-ico-size" }),
158
- /* @__PURE__ */ f("div", { children: [
159
- /* @__PURE__ */ a(k, { size: "base", component: "p", weight: "medium", children: E }),
160
- R && /* @__PURE__ */ a(
161
- k,
177
+ /* @__PURE__ */ a(me, { className: "inline size-comp-file-upload-ico-size" }),
178
+ /* @__PURE__ */ n("div", { children: [
179
+ /* @__PURE__ */ a(M, { size: "base", component: "p", weight: "medium", children: re }),
180
+ K && /* @__PURE__ */ a(
181
+ M,
162
182
  {
163
183
  size: "sm",
164
184
  component: "p",
165
185
  weight: "regular",
166
- className: B(
167
- pe({
186
+ className: X(
187
+ xe({
168
188
  disabled: p,
169
- className: $
189
+ className: U
170
190
  })
171
191
  ),
172
- children: R
192
+ children: K
173
193
  }
174
194
  )
175
195
  ] })
@@ -177,22 +197,33 @@ const de = G(
177
197
  }
178
198
  ),
179
199
  j && /* @__PURE__ */ a(
180
- k,
200
+ M,
201
+ {
202
+ size: "sm",
203
+ variant: "body",
204
+ component: "p",
205
+ weight: "regular",
206
+ className: "text-comp-file-upload-text-error-def",
207
+ children: J
208
+ }
209
+ ),
210
+ B && /* @__PURE__ */ a(
211
+ M,
181
212
  {
182
213
  size: "sm",
183
214
  variant: "body",
184
215
  component: "p",
185
216
  weight: "regular",
186
217
  className: "text-comp-file-upload-text-error-def",
187
- children: T
218
+ children: R
188
219
  }
189
220
  )
190
221
  ] })
191
222
  }
192
223
  ),
193
- (M.length > 0 || S.length > 0) && /* @__PURE__ */ f(_, { component: "ul", direction: "column", gap: "md", children: [
194
- M.map((e, l) => /* @__PURE__ */ a(
195
- K,
224
+ (x.length > 0 || h.length > 0) && /* @__PURE__ */ n(W, { component: "ul", direction: "column", gap: "md", children: [
225
+ x.map((e, s) => /* @__PURE__ */ a(
226
+ Q,
196
227
  {
197
228
  source: "url",
198
229
  url: e.url,
@@ -200,36 +231,36 @@ const de = G(
200
231
  type: e.type,
201
232
  uploaded: !0,
202
233
  disabled: p,
203
- readOnly: m,
204
- size: N,
205
- onDelete: () => F == null ? void 0 : F(e, l)
234
+ readOnly: g,
235
+ size: P,
236
+ onDelete: () => $ == null ? void 0 : $(e, s)
206
237
  },
207
238
  `url-${e.url}`
208
239
  )),
209
- S.map((e, l) => {
210
- const o = X[l], r = o == null ? void 0 : o.uploaded;
211
- return m && !r ? null : /* @__PURE__ */ a(
212
- K,
240
+ h.map((e, s) => {
241
+ const o = C[s], c = o == null ? void 0 : o.uploaded;
242
+ return g && !c ? null : /* @__PURE__ */ a(
243
+ Q,
213
244
  {
214
245
  source: "file",
215
246
  file: e,
216
- uploaded: r,
247
+ uploaded: c,
217
248
  progress: o == null ? void 0 : o.progress,
218
249
  disabled: p,
219
- readOnly: m,
220
- error: b == null ? void 0 : b.get(e),
221
- note: h == null ? void 0 : h.get(e),
250
+ readOnly: g,
251
+ error: S == null ? void 0 : S.get(e),
252
+ note: F == null ? void 0 : F.get(e),
222
253
  onError: t,
223
- size: N,
254
+ size: P,
224
255
  onDelete: () => {
225
256
  try {
226
- U((s) => {
227
- const d = s.filter((i, te) => te !== l);
228
- return c == null || c(d), d;
229
- }), z == null || z(e, l);
230
- } catch (s) {
231
- const d = s instanceof Error ? s.message : n.fileUpload.deleteError;
232
- t == null || t(d, e);
257
+ b(!1), N(!1), _((l) => {
258
+ const r = l.filter((d, ce) => ce !== s);
259
+ return u == null || u(r), r;
260
+ }), w == null || w(e, s);
261
+ } catch (l) {
262
+ const r = l instanceof Error ? l.message : f.fileUpload.deleteError;
263
+ t == null || t(r, e);
233
264
  }
234
265
  }
235
266
  },
@@ -240,7 +271,7 @@ const de = G(
240
271
  ] });
241
272
  }
242
273
  );
243
- ce.displayName = "FileUpload";
274
+ he.displayName = "FileUpload";
244
275
  export {
245
- ce as FileUpload
276
+ he as FileUpload
246
277
  };
@@ -17,6 +17,8 @@ export declare const Disabled: Story;
17
17
  export declare const WithErrorsAndHints: Story;
18
18
  export declare const ReadOnly: Story;
19
19
  export declare const UploadSimulation: Story;
20
+ export declare const WithMaxFiles: Story;
21
+ export declare const WithMaxFilesAndPreselected: Story;
20
22
  export declare const PreselectedUrls: Story;
21
23
  export declare const MixedFilesAndUrls: Story;
22
24
  export declare const SingleFileWithUrl: Story;
@@ -1 +1 @@
1
- {"version":3,"file":"FileUpload.stories.d.ts","sourceRoot":"","sources":["../../../src/components/FileUpload/FileUpload.stories.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAE3D,OAAO,EAAE,UAAU,EAAuB,MAAM,cAAc,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CAAA;IACjC,0CAA0C;IAC1C,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,yEAAyE;IACzE,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,6EAA6E;IAC7E,UAAU,CAAC,EAAE,SAAS,CAAA;IACtB,gHAAgH;IAChH,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,6HAA6H;IAC7H,kBAAkB,CAAC,EAAE,OAAO,CAAA;CAC7B;AAED,eAAO,MAAM,QAAQ,4HA0GpB,CAAA"}
@@ -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
  };