@versini/ui-textarea 4.0.12 → 5.0.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/components/TextArea/TextArea.js +401 -209
- package/dist/index.js +3 -3
- package/package.json +7 -7
|
@@ -1,331 +1,523 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const
|
|
1
|
+
import { jsx as A, jsxs as ue } from "react/jsx-runtime";
|
|
2
|
+
import de, { useRef as f, useCallback as fe, useEffect as S, useMemo as B, useState as v, useId as pe, useReducer as ye, useLayoutEffect as E } from "react";
|
|
3
|
+
import c from "clsx";
|
|
4
|
+
const W = "av-text-area", xe = "av-text-area-wrapper", w = "av-text-area-helper-text", me = "av-text-area__control--right", he = "av-text-area__control--left";
|
|
5
|
+
function Ae() {
|
|
6
|
+
const e = f(!1);
|
|
7
|
+
return S(() => (e.current = !0, () => {
|
|
8
|
+
e.current = !1;
|
|
9
|
+
}), []), fe(() => e.current, []);
|
|
10
|
+
}
|
|
11
|
+
function ge(e) {
|
|
12
|
+
return B(() => e.every((r) => r == null) ? () => {
|
|
13
|
+
} : (r) => {
|
|
14
|
+
e.forEach((t) => {
|
|
15
|
+
typeof t == "function" ? t(r) : t != null && (t.current = r);
|
|
16
|
+
});
|
|
17
|
+
}, [...e]);
|
|
18
|
+
}
|
|
19
|
+
const Te = {
|
|
20
|
+
x: 0,
|
|
21
|
+
y: 0,
|
|
22
|
+
width: 0,
|
|
23
|
+
height: 0,
|
|
24
|
+
top: 0,
|
|
25
|
+
left: 0,
|
|
26
|
+
bottom: 0,
|
|
27
|
+
right: 0
|
|
28
|
+
};
|
|
29
|
+
function G(e) {
|
|
30
|
+
const r = Ae(), t = f(0), n = f(null), [a, o] = v(Te), s = B(() => typeof ResizeObserver > "u" ? null : new ResizeObserver((l) => {
|
|
31
|
+
const i = l[0];
|
|
32
|
+
i && (cancelAnimationFrame(t.current), t.current = requestAnimationFrame(() => {
|
|
33
|
+
n.current && r() && o(i.contentRect);
|
|
34
|
+
}));
|
|
35
|
+
}), [r]);
|
|
36
|
+
return S(() => (n.current && s?.observe(n.current, e), () => {
|
|
37
|
+
s?.disconnect(), t.current && cancelAnimationFrame(t.current);
|
|
38
|
+
}), [s, e]), [n, a];
|
|
39
|
+
}
|
|
40
|
+
function be({
|
|
41
|
+
value: e,
|
|
42
|
+
defaultValue: r,
|
|
43
|
+
finalValue: t,
|
|
44
|
+
onChange: n = () => {
|
|
45
|
+
},
|
|
46
|
+
initialControlledDelay: a = 0
|
|
47
|
+
}) {
|
|
48
|
+
const [o, s] = v(!1), [l, i] = v(
|
|
49
|
+
r !== void 0 ? r : t
|
|
50
|
+
), p = (y) => {
|
|
51
|
+
i(y), n?.(y);
|
|
52
|
+
};
|
|
53
|
+
return S(() => {
|
|
54
|
+
(async () => e !== void 0 && !o && a > 0 && (await new Promise(
|
|
55
|
+
(y) => setTimeout(y, a)
|
|
56
|
+
), s(!0)))();
|
|
57
|
+
}, [e, a, o]), e !== void 0 ? !o && a > 0 ? ["", n, !0] : [e, n, !0] : [l, p, !1];
|
|
58
|
+
}
|
|
59
|
+
function Re(e) {
|
|
60
|
+
const r = pe();
|
|
61
|
+
if (!e)
|
|
62
|
+
return r;
|
|
63
|
+
if (typeof e == "number" || typeof e == "string")
|
|
64
|
+
return `${e}${r}`;
|
|
65
|
+
if (typeof e == "object") {
|
|
66
|
+
const { id: t, prefix: n = "" } = e;
|
|
67
|
+
return typeof t == "number" || typeof t == "string" ? `${n}${t}` : `${n}${r}`;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
const q = "SET_ANNOUNCEMENT", J = "CLEAR_ANNOUNCEMENT", ke = {
|
|
71
|
+
alert: null,
|
|
72
|
+
alertdialog: null,
|
|
73
|
+
log: "polite",
|
|
74
|
+
marquee: null,
|
|
75
|
+
progressbar: null,
|
|
76
|
+
status: "polite",
|
|
77
|
+
timer: "assertive"
|
|
78
|
+
}, ve = (e, r) => {
|
|
79
|
+
switch (r?.type) {
|
|
80
|
+
case q:
|
|
81
|
+
return {
|
|
82
|
+
...e,
|
|
83
|
+
announcement: r.payload
|
|
84
|
+
};
|
|
85
|
+
case J:
|
|
86
|
+
return {
|
|
87
|
+
...e,
|
|
88
|
+
announcement: null
|
|
89
|
+
};
|
|
90
|
+
default:
|
|
91
|
+
return e;
|
|
92
|
+
}
|
|
93
|
+
}, _e = ({
|
|
94
|
+
onAnnouncementClear: e,
|
|
95
|
+
dispatch: r
|
|
96
|
+
}) => {
|
|
97
|
+
r({
|
|
98
|
+
type: J
|
|
99
|
+
}), typeof e == "function" && e();
|
|
100
|
+
}, z = ({
|
|
101
|
+
children: e,
|
|
102
|
+
clearAnnouncementDelay: r,
|
|
103
|
+
clearAnnouncementTimeoutRef: t,
|
|
104
|
+
onAnnouncementClear: n,
|
|
105
|
+
dispatch: a
|
|
106
|
+
}) => {
|
|
107
|
+
clearTimeout(t.current), e !== null && a({
|
|
108
|
+
type: q,
|
|
109
|
+
payload: e
|
|
110
|
+
}), r && (t.current = setTimeout(
|
|
111
|
+
() => _e({
|
|
112
|
+
onAnnouncementClear: n,
|
|
113
|
+
dispatch: a
|
|
114
|
+
}),
|
|
115
|
+
r
|
|
116
|
+
));
|
|
117
|
+
}, Ne = ({
|
|
118
|
+
children: e,
|
|
119
|
+
announcementTimeoutRef: r,
|
|
120
|
+
announcementDelay: t,
|
|
121
|
+
clearAnnouncementDelay: n,
|
|
122
|
+
clearAnnouncementTimeoutRef: a,
|
|
123
|
+
onAnnouncementClear: o,
|
|
124
|
+
dispatch: s
|
|
125
|
+
}) => {
|
|
126
|
+
clearTimeout(r.current), t ? r.current = setTimeout(z, t, {
|
|
127
|
+
children: e,
|
|
128
|
+
clearAnnouncementDelay: n,
|
|
129
|
+
clearAnnouncementTimeoutRef: a,
|
|
130
|
+
onAnnouncementClear: o,
|
|
131
|
+
dispatch: s
|
|
132
|
+
}) : z({
|
|
133
|
+
children: e,
|
|
134
|
+
clearAnnouncementDelay: n,
|
|
135
|
+
clearAnnouncementTimeoutRef: a,
|
|
136
|
+
onAnnouncementClear: o,
|
|
137
|
+
dispatch: s
|
|
138
|
+
});
|
|
139
|
+
};
|
|
140
|
+
function Ce({
|
|
141
|
+
children: e,
|
|
142
|
+
className: r,
|
|
143
|
+
politeness: t,
|
|
144
|
+
role: n = null,
|
|
145
|
+
announcementDelay: a,
|
|
146
|
+
clearAnnouncementDelay: o,
|
|
147
|
+
onAnnouncementClear: s,
|
|
148
|
+
visible: l,
|
|
149
|
+
...i
|
|
150
|
+
}) {
|
|
151
|
+
const p = f(null), y = f(null), [b, _] = ye(ve, {
|
|
152
|
+
announcement: null
|
|
153
|
+
});
|
|
154
|
+
let g = t;
|
|
155
|
+
typeof g > "u" && (g = n ? ke[n] : "assertive"), S(() => {
|
|
156
|
+
Ne({
|
|
157
|
+
announcementTimeoutRef: p,
|
|
158
|
+
announcementDelay: a,
|
|
159
|
+
children: e,
|
|
160
|
+
clearAnnouncementDelay: o,
|
|
161
|
+
clearAnnouncementTimeoutRef: y,
|
|
162
|
+
onAnnouncementClear: s,
|
|
163
|
+
dispatch: _
|
|
164
|
+
});
|
|
165
|
+
}, [
|
|
166
|
+
e,
|
|
167
|
+
a,
|
|
168
|
+
o,
|
|
169
|
+
s
|
|
170
|
+
]);
|
|
171
|
+
const u = c(r, {
|
|
172
|
+
"sr-only": !l
|
|
173
|
+
});
|
|
174
|
+
return /* @__PURE__ */ A(
|
|
175
|
+
"div",
|
|
176
|
+
{
|
|
177
|
+
"aria-live": g,
|
|
178
|
+
...n && { role: n },
|
|
179
|
+
className: u,
|
|
180
|
+
...i,
|
|
181
|
+
children: b.announcement
|
|
182
|
+
}
|
|
183
|
+
);
|
|
184
|
+
}
|
|
185
|
+
/*!
|
|
186
|
+
@versini/ui-liveregion v3.0.0
|
|
187
|
+
© 2025 gizmette.com
|
|
188
|
+
*/
|
|
189
|
+
try {
|
|
190
|
+
window.__VERSINI_UI_LIVEREGION__ || (window.__VERSINI_UI_LIVEREGION__ = {
|
|
191
|
+
version: "3.0.0",
|
|
192
|
+
buildTime: "09/01/2025 03:17 PM EDT",
|
|
193
|
+
homepage: "https://github.com/aversini/ui-components",
|
|
194
|
+
license: "MIT"
|
|
195
|
+
});
|
|
196
|
+
} catch {
|
|
197
|
+
}
|
|
198
|
+
const Ee = () => "rounded-md text-base h-20 min-h-[80px] resize-none overflow-hidden px-4 py-7", Le = ({ mode: e }) => c({
|
|
7
199
|
"bg-surface-darker text-copy-lighter caret-copy-light": e === "dark",
|
|
8
200
|
"bg-surface-lighter text-copy-dark caret-copy-dark": e === "light",
|
|
9
201
|
"bg-surface-lighter text-copy-dark caret-copy-dark dark:bg-surface-darker dark:text-copy-lighter dark:caret-copy-light": e === "system",
|
|
10
202
|
"bg-surface-darker text-copy-lighter caret-copy-light dark:bg-surface-lighter dark:text-copy-dark dark:caret-copy-dark": e === "alt-system"
|
|
11
|
-
}),
|
|
203
|
+
}), Oe = ({
|
|
12
204
|
focusMode: e
|
|
13
|
-
}) =>
|
|
205
|
+
}) => c("focus:outline focus:outline-2 focus:outline-offset-2", {
|
|
14
206
|
"focus:outline-focus-dark": e === "dark",
|
|
15
207
|
"focus:outline-focus-light": e === "light",
|
|
16
208
|
"focus:outline-focus-light dark:focus:outline-focus-dark": e === "alt-system",
|
|
17
209
|
"focus:outline-focus-dark dark:focus:outline-focus-light": e === "system"
|
|
18
|
-
}),
|
|
210
|
+
}), Ie = ({
|
|
19
211
|
noBorder: e,
|
|
20
|
-
error:
|
|
21
|
-
}) =>
|
|
22
|
-
"border-border-dark": !e && !
|
|
23
|
-
"focus:border-border-dark": !e &&
|
|
24
|
-
"border-border-error-dark": !e &&
|
|
212
|
+
error: r
|
|
213
|
+
}) => c("border-2", {
|
|
214
|
+
"border-border-dark": !e && !r,
|
|
215
|
+
"focus:border-border-dark": !e && r,
|
|
216
|
+
"border-border-error-dark": !e && r,
|
|
25
217
|
"border-transparent": e
|
|
26
|
-
}),
|
|
218
|
+
}), Se = ({
|
|
27
219
|
disabled: e,
|
|
28
|
-
raw:
|
|
220
|
+
raw: r,
|
|
29
221
|
error: t,
|
|
30
|
-
mode:
|
|
31
|
-
leftElement:
|
|
32
|
-
rightElement:
|
|
222
|
+
mode: n,
|
|
223
|
+
leftElement: a,
|
|
224
|
+
rightElement: o
|
|
33
225
|
}) => {
|
|
34
|
-
if (
|
|
226
|
+
if (r)
|
|
35
227
|
return "";
|
|
36
228
|
if (e)
|
|
37
|
-
return
|
|
229
|
+
return c(
|
|
38
230
|
"transform translate-y-0 scale-100 absolute px-2 cursor-not-allowed opacity-50 font-medium",
|
|
39
231
|
{
|
|
40
|
-
"translate-x-[12px]":
|
|
232
|
+
"translate-x-[12px]": o === !0 && !a || !o && !a
|
|
41
233
|
}
|
|
42
234
|
);
|
|
43
235
|
if (!t)
|
|
44
|
-
return
|
|
236
|
+
return c(
|
|
45
237
|
"absolute px-2 cursor-text font-medium transform translate-y-0 scale-100",
|
|
46
238
|
{
|
|
47
|
-
"translate-x-[12px]":
|
|
48
|
-
"text-copy-medium":
|
|
49
|
-
"text-copy-dark":
|
|
50
|
-
"text-copy-dark dark:text-copy-medium":
|
|
51
|
-
"text-copy-medium dark:text-copy-dark":
|
|
239
|
+
"translate-x-[12px]": o === !0 && !a || !o && !a,
|
|
240
|
+
"text-copy-medium": n === "dark",
|
|
241
|
+
"text-copy-dark": n === "light",
|
|
242
|
+
"text-copy-dark dark:text-copy-medium": n === "system",
|
|
243
|
+
"text-copy-medium dark:text-copy-dark": n === "alt-system"
|
|
52
244
|
}
|
|
53
245
|
);
|
|
54
246
|
if (t)
|
|
55
|
-
return
|
|
247
|
+
return c(
|
|
56
248
|
"absolute px-2 cursor-text font-medium transform translate-y-0 scale-100",
|
|
57
249
|
{
|
|
58
|
-
"translate-x-[12px]":
|
|
59
|
-
"text-copy-medium":
|
|
60
|
-
"text-copy-error-dark":
|
|
61
|
-
"text-copy-error-dark dark:text-copy-error-light":
|
|
62
|
-
"text-copy-medium dark:text-copy-error-dark":
|
|
250
|
+
"translate-x-[12px]": o === !0 && !a || !o && !a,
|
|
251
|
+
"text-copy-medium": n === "dark",
|
|
252
|
+
"text-copy-error-dark": n === "light",
|
|
253
|
+
"text-copy-error-dark dark:text-copy-error-light": n === "system",
|
|
254
|
+
"text-copy-medium dark:text-copy-error-dark": n === "alt-system"
|
|
63
255
|
}
|
|
64
256
|
);
|
|
65
|
-
},
|
|
257
|
+
}, $e = ({
|
|
66
258
|
error: e,
|
|
67
|
-
raw:
|
|
259
|
+
raw: r,
|
|
68
260
|
mode: t,
|
|
69
|
-
disabled:
|
|
261
|
+
disabled: n
|
|
70
262
|
}) => {
|
|
71
|
-
if (
|
|
263
|
+
if (r)
|
|
72
264
|
return "";
|
|
73
|
-
if (
|
|
74
|
-
return
|
|
75
|
-
|
|
265
|
+
if (n)
|
|
266
|
+
return c(
|
|
267
|
+
w,
|
|
76
268
|
"absolute px-2 cursor-not-allowed opacity-50 font-medium"
|
|
77
269
|
);
|
|
78
270
|
if (!e)
|
|
79
|
-
return
|
|
271
|
+
return c(w, "absolute px-2 font-medium", {
|
|
80
272
|
"text-copy-medium": t === "dark",
|
|
81
273
|
"text-copy-dark": t === "light",
|
|
82
274
|
"text-copy-dark dark:text-copy-medium": t === "system",
|
|
83
275
|
"text-copy-medium dark:text-copy-dark": t === "alt-system"
|
|
84
276
|
});
|
|
85
277
|
if (e)
|
|
86
|
-
return
|
|
278
|
+
return c(w, "absolute px-2 font-medium", {
|
|
87
279
|
"text-copy-error-light": t === "dark",
|
|
88
280
|
"text-copy-error-dark": t === "light",
|
|
89
281
|
"text-copy-error-dark dark:text-copy-error-light": t === "system",
|
|
90
282
|
"dark:text-copy-error-dark text-copy-error-light": t === "alt-system"
|
|
91
283
|
});
|
|
92
|
-
},
|
|
284
|
+
}, we = ({
|
|
93
285
|
className: e,
|
|
94
|
-
textAreaClassName:
|
|
286
|
+
textAreaClassName: r,
|
|
95
287
|
raw: t,
|
|
96
|
-
focusMode:
|
|
97
|
-
disabled:
|
|
98
|
-
noBorder:
|
|
99
|
-
error:
|
|
100
|
-
mode:
|
|
101
|
-
leftElement:
|
|
102
|
-
rightElement:
|
|
288
|
+
focusMode: n,
|
|
289
|
+
disabled: a,
|
|
290
|
+
noBorder: o,
|
|
291
|
+
error: s,
|
|
292
|
+
mode: l,
|
|
293
|
+
leftElement: i,
|
|
294
|
+
rightElement: p
|
|
103
295
|
}) => {
|
|
104
|
-
const
|
|
296
|
+
const y = t ? e : c(
|
|
105
297
|
"relative flex w-full flex-col justify-center",
|
|
106
|
-
|
|
298
|
+
xe,
|
|
107
299
|
e
|
|
108
|
-
),
|
|
300
|
+
), b = t ? c(r) : c(
|
|
109
301
|
W,
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
noBorder:
|
|
116
|
-
error:
|
|
302
|
+
r,
|
|
303
|
+
Ee(),
|
|
304
|
+
Le({ mode: l }),
|
|
305
|
+
Oe({ focusMode: n }),
|
|
306
|
+
Ie({
|
|
307
|
+
noBorder: o,
|
|
308
|
+
error: s
|
|
117
309
|
}),
|
|
118
310
|
{
|
|
119
|
-
"disabled:cursor-not-allowed disabled:opacity-50":
|
|
311
|
+
"disabled:cursor-not-allowed disabled:opacity-50": a
|
|
120
312
|
}
|
|
121
|
-
),
|
|
122
|
-
disabled:
|
|
313
|
+
), _ = t ? void 0 : "sr-only", g = Se({
|
|
314
|
+
disabled: a,
|
|
123
315
|
raw: t,
|
|
124
|
-
error:
|
|
125
|
-
mode:
|
|
126
|
-
rightElement:
|
|
127
|
-
leftElement:
|
|
128
|
-
}),
|
|
129
|
-
error:
|
|
316
|
+
error: s,
|
|
317
|
+
mode: l,
|
|
318
|
+
rightElement: p,
|
|
319
|
+
leftElement: i
|
|
320
|
+
}), u = $e({
|
|
321
|
+
error: s,
|
|
130
322
|
raw: t,
|
|
131
|
-
mode:
|
|
132
|
-
disabled:
|
|
133
|
-
}),
|
|
323
|
+
mode: l,
|
|
324
|
+
disabled: a
|
|
325
|
+
}), N = t ? void 0 : c(me, "absolute"), m = t ? void 0 : c(he, "absolute");
|
|
134
326
|
return {
|
|
135
|
-
wrapper:
|
|
136
|
-
textArea:
|
|
137
|
-
accessibleLabel:
|
|
138
|
-
visibleLabel:
|
|
139
|
-
helperText:
|
|
140
|
-
rightElement:
|
|
141
|
-
leftElement:
|
|
327
|
+
wrapper: y,
|
|
328
|
+
textArea: b,
|
|
329
|
+
accessibleLabel: _,
|
|
330
|
+
visibleLabel: g,
|
|
331
|
+
helperText: u,
|
|
332
|
+
rightElement: N,
|
|
333
|
+
leftElement: m
|
|
142
334
|
};
|
|
143
|
-
},
|
|
335
|
+
}, De = ({
|
|
144
336
|
scrollHeight: e,
|
|
145
|
-
currentHeight:
|
|
337
|
+
currentHeight: r,
|
|
146
338
|
currentLabelOffset: t = 0,
|
|
147
|
-
currentHelperTextOffset:
|
|
339
|
+
currentHelperTextOffset: n = 0
|
|
148
340
|
}) => {
|
|
149
|
-
let
|
|
150
|
-
if (e > 0 && e !==
|
|
151
|
-
const
|
|
152
|
-
|
|
341
|
+
let s, l;
|
|
342
|
+
if (e > 0 && e !== r) {
|
|
343
|
+
const i = e - r, p = Math.abs(i / 24);
|
|
344
|
+
s = t + -1 * Math.sign(i) * (12 * p), l = n + Math.sign(i) * (12 * p);
|
|
153
345
|
}
|
|
154
346
|
return {
|
|
155
|
-
labelOffset:
|
|
156
|
-
helperTextOffset:
|
|
347
|
+
labelOffset: s,
|
|
348
|
+
helperTextOffset: l,
|
|
157
349
|
scrollHeight: e
|
|
158
350
|
};
|
|
159
|
-
},
|
|
351
|
+
}, He = de.forwardRef(
|
|
160
352
|
({
|
|
161
353
|
id: e,
|
|
162
|
-
name:
|
|
354
|
+
name: r,
|
|
163
355
|
label: t,
|
|
164
|
-
error:
|
|
165
|
-
raw:
|
|
166
|
-
className:
|
|
167
|
-
textAreaClassName:
|
|
168
|
-
mode:
|
|
169
|
-
focusMode:
|
|
170
|
-
value:
|
|
171
|
-
defaultValue:
|
|
172
|
-
disabled:
|
|
173
|
-
noBorder:
|
|
174
|
-
labelId:
|
|
175
|
-
helperText:
|
|
176
|
-
helperTextOnFocus:
|
|
177
|
-
rightElement:
|
|
178
|
-
leftElement:
|
|
179
|
-
onChange:
|
|
180
|
-
onFocus:
|
|
181
|
-
onBlur:
|
|
182
|
-
...
|
|
183
|
-
},
|
|
184
|
-
const
|
|
185
|
-
!!(!
|
|
186
|
-
),
|
|
187
|
-
className:
|
|
188
|
-
textAreaClassName:
|
|
189
|
-
error:
|
|
190
|
-
raw:
|
|
191
|
-
focusMode:
|
|
192
|
-
disabled:
|
|
193
|
-
noBorder:
|
|
194
|
-
mode:
|
|
195
|
-
rightElement: !!
|
|
196
|
-
leftElement: !!
|
|
197
|
-
}), [
|
|
198
|
-
value:
|
|
356
|
+
error: n = !1,
|
|
357
|
+
raw: a = !1,
|
|
358
|
+
className: o,
|
|
359
|
+
textAreaClassName: s,
|
|
360
|
+
mode: l = "system",
|
|
361
|
+
focusMode: i = "system",
|
|
362
|
+
value: p,
|
|
363
|
+
defaultValue: y,
|
|
364
|
+
disabled: b = !1,
|
|
365
|
+
noBorder: _ = !1,
|
|
366
|
+
labelId: g,
|
|
367
|
+
helperText: u = "",
|
|
368
|
+
helperTextOnFocus: N = !1,
|
|
369
|
+
rightElement: m,
|
|
370
|
+
leftElement: R,
|
|
371
|
+
onChange: D,
|
|
372
|
+
onFocus: H,
|
|
373
|
+
onBlur: P,
|
|
374
|
+
...K
|
|
375
|
+
}, Q) => {
|
|
376
|
+
const x = f(null), Y = ge([Q, x]), [Z, L] = G(), [ee, k] = G(), $ = f(80), F = f(-25), O = f(null), M = f(30), U = f(null), C = Re({ id: e, prefix: `${W}-` }), [V, te] = v(0), [X, re] = v(0), [ne, j] = v(
|
|
377
|
+
!!(!N && u)
|
|
378
|
+
), ae = `${r} error, ${u}`, T = we({
|
|
379
|
+
className: o,
|
|
380
|
+
textAreaClassName: s,
|
|
381
|
+
error: n,
|
|
382
|
+
raw: a,
|
|
383
|
+
focusMode: i,
|
|
384
|
+
disabled: b,
|
|
385
|
+
noBorder: _,
|
|
386
|
+
mode: l,
|
|
387
|
+
rightElement: !!m,
|
|
388
|
+
leftElement: !!R
|
|
389
|
+
}), [h, oe] = be({
|
|
390
|
+
value: p,
|
|
199
391
|
initialControlledDelay: 20,
|
|
200
|
-
defaultValue:
|
|
201
|
-
onChange: (
|
|
202
|
-
|
|
392
|
+
defaultValue: y,
|
|
393
|
+
onChange: (d) => {
|
|
394
|
+
D && D({
|
|
203
395
|
target: {
|
|
204
|
-
value:
|
|
396
|
+
value: d
|
|
205
397
|
}
|
|
206
398
|
});
|
|
207
399
|
}
|
|
208
|
-
}),
|
|
209
|
-
|
|
210
|
-
},
|
|
211
|
-
|
|
212
|
-
},
|
|
213
|
-
|
|
400
|
+
}), se = (d) => {
|
|
401
|
+
oe(d.target.value);
|
|
402
|
+
}, ce = (d) => {
|
|
403
|
+
N && u && j(!0), H && H(d);
|
|
404
|
+
}, le = (d) => {
|
|
405
|
+
N && u && !h && j(!1), P && P(d);
|
|
214
406
|
};
|
|
215
|
-
return
|
|
216
|
-
|
|
217
|
-
}, [
|
|
218
|
-
|
|
219
|
-
}, [
|
|
220
|
-
|
|
221
|
-
}, [
|
|
222
|
-
|
|
223
|
-
|
|
407
|
+
return E(() => {
|
|
408
|
+
L && L.width && te(L.width + 18 + 10);
|
|
409
|
+
}, [L]), E(() => {
|
|
410
|
+
k && k.width && re(k.width + 18 + 10);
|
|
411
|
+
}, [k]), E(() => {
|
|
412
|
+
a || x && x.current && h !== void 0 && (x.current.style.height = "inherit", x.current.style.height = x.current.scrollHeight + "px");
|
|
413
|
+
}, [h, a]), E(() => {
|
|
414
|
+
a || setTimeout(() => {
|
|
415
|
+
O?.current?.style.setProperty(
|
|
224
416
|
"--av-text-area-wrapper-transition",
|
|
225
|
-
|
|
417
|
+
h ? "none" : "all 0.2s ease-out"
|
|
226
418
|
);
|
|
227
419
|
}, 0);
|
|
228
|
-
}, [
|
|
229
|
-
if (!
|
|
230
|
-
const { labelOffset:
|
|
231
|
-
scrollHeight:
|
|
232
|
-
currentHeight:
|
|
233
|
-
currentLabelOffset:
|
|
234
|
-
currentHelperTextOffset:
|
|
420
|
+
}, [h, a]), E(() => {
|
|
421
|
+
if (!a && x && x.current && h !== void 0) {
|
|
422
|
+
const { labelOffset: d, helperTextOffset: I, scrollHeight: ie } = De({
|
|
423
|
+
scrollHeight: x.current.scrollHeight,
|
|
424
|
+
currentHeight: $.current,
|
|
425
|
+
currentLabelOffset: F.current,
|
|
426
|
+
currentHelperTextOffset: M.current
|
|
235
427
|
});
|
|
236
|
-
|
|
428
|
+
d && (F.current = d, O?.current?.style.setProperty(
|
|
237
429
|
"--av-text-area-label",
|
|
238
|
-
`${
|
|
239
|
-
)),
|
|
430
|
+
`${d}px`
|
|
431
|
+
)), I && (M.current = I, U?.current?.style.setProperty(
|
|
240
432
|
"--av-text-area-helper-text",
|
|
241
|
-
`${
|
|
242
|
-
)),
|
|
433
|
+
`${I}px`
|
|
434
|
+
)), $.current = ie || $.current;
|
|
243
435
|
}
|
|
244
|
-
}, [
|
|
436
|
+
}, [h, a]), k.width > 0 && O?.current?.style.setProperty(
|
|
245
437
|
"--tw-translate-x",
|
|
246
|
-
`${12 +
|
|
247
|
-
), /* @__PURE__ */
|
|
248
|
-
/* @__PURE__ */
|
|
438
|
+
`${12 + k.width + 5}px`
|
|
439
|
+
), /* @__PURE__ */ ue("div", { className: T.wrapper, children: [
|
|
440
|
+
/* @__PURE__ */ A(
|
|
249
441
|
"label",
|
|
250
442
|
{
|
|
251
|
-
htmlFor:
|
|
252
|
-
id:
|
|
253
|
-
className:
|
|
443
|
+
htmlFor: C,
|
|
444
|
+
id: g,
|
|
445
|
+
className: T.accessibleLabel,
|
|
254
446
|
children: t
|
|
255
447
|
}
|
|
256
448
|
),
|
|
257
|
-
|
|
449
|
+
R && /* @__PURE__ */ A(
|
|
258
450
|
"div",
|
|
259
451
|
{
|
|
260
|
-
ref:
|
|
261
|
-
className:
|
|
262
|
-
children:
|
|
452
|
+
ref: ee,
|
|
453
|
+
className: T.leftElement,
|
|
454
|
+
children: R
|
|
263
455
|
}
|
|
264
456
|
),
|
|
265
|
-
/* @__PURE__ */
|
|
457
|
+
/* @__PURE__ */ A(
|
|
266
458
|
"textarea",
|
|
267
459
|
{
|
|
268
|
-
ref:
|
|
269
|
-
id:
|
|
270
|
-
name:
|
|
271
|
-
disabled:
|
|
272
|
-
placeholder:
|
|
273
|
-
className:
|
|
460
|
+
ref: Y,
|
|
461
|
+
id: C,
|
|
462
|
+
name: r,
|
|
463
|
+
disabled: b,
|
|
464
|
+
placeholder: a ? void 0 : " ",
|
|
465
|
+
className: T.textArea,
|
|
274
466
|
rows: 1,
|
|
275
|
-
...
|
|
276
|
-
...
|
|
277
|
-
...
|
|
278
|
-
...
|
|
279
|
-
...
|
|
467
|
+
...u && { "aria-describedby": `${C}-helper` },
|
|
468
|
+
...n && { "aria-invalid": "true" },
|
|
469
|
+
...m && !R && !a && { style: { paddingRight: V } },
|
|
470
|
+
...R && !m && !a && { style: { paddingLeft: X } },
|
|
471
|
+
...m && R && !a && {
|
|
280
472
|
style: {
|
|
281
|
-
paddingRight:
|
|
282
|
-
paddingLeft:
|
|
473
|
+
paddingRight: V,
|
|
474
|
+
paddingLeft: X
|
|
283
475
|
}
|
|
284
476
|
},
|
|
285
|
-
value:
|
|
286
|
-
onChange:
|
|
287
|
-
onFocus:
|
|
288
|
-
onBlur:
|
|
289
|
-
...
|
|
477
|
+
value: h,
|
|
478
|
+
onChange: se,
|
|
479
|
+
onFocus: ce,
|
|
480
|
+
onBlur: le,
|
|
481
|
+
...K
|
|
290
482
|
}
|
|
291
483
|
),
|
|
292
|
-
!
|
|
484
|
+
!a && /* @__PURE__ */ A(
|
|
293
485
|
"label",
|
|
294
486
|
{
|
|
295
|
-
ref:
|
|
487
|
+
ref: O,
|
|
296
488
|
"aria-hidden": !0,
|
|
297
|
-
htmlFor:
|
|
298
|
-
className: `${
|
|
489
|
+
htmlFor: C,
|
|
490
|
+
className: `${T.visibleLabel}`,
|
|
299
491
|
children: t
|
|
300
492
|
}
|
|
301
493
|
),
|
|
302
|
-
|
|
494
|
+
ne && /* @__PURE__ */ A(
|
|
303
495
|
"div",
|
|
304
496
|
{
|
|
305
|
-
ref:
|
|
306
|
-
id: `${
|
|
307
|
-
className:
|
|
308
|
-
children:
|
|
497
|
+
ref: U,
|
|
498
|
+
id: `${C}-helper`,
|
|
499
|
+
className: T.helperText,
|
|
500
|
+
children: u
|
|
309
501
|
}
|
|
310
502
|
),
|
|
311
|
-
|
|
503
|
+
m && /* @__PURE__ */ A(
|
|
312
504
|
"div",
|
|
313
505
|
{
|
|
314
|
-
ref:
|
|
315
|
-
className:
|
|
316
|
-
children:
|
|
506
|
+
ref: Z,
|
|
507
|
+
className: T.rightElement,
|
|
508
|
+
children: m
|
|
317
509
|
}
|
|
318
510
|
),
|
|
319
|
-
|
|
511
|
+
n && u && /* @__PURE__ */ A(Ce, { politeness: "polite", clearAnnouncementDelay: 500, children: ae })
|
|
320
512
|
] });
|
|
321
513
|
}
|
|
322
514
|
);
|
|
323
|
-
|
|
515
|
+
He.displayName = "TextArea";
|
|
324
516
|
export {
|
|
325
517
|
W as TEXT_AREA_CLASSNAME,
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
518
|
+
he as TEXT_AREA_CONTROL_LEFT_CLASSNAME,
|
|
519
|
+
me as TEXT_AREA_CONTROL_RIGHT_CLASSNAME,
|
|
520
|
+
w as TEXT_AREA_HELPER_TEXT_CLASSNAME,
|
|
521
|
+
xe as TEXT_AREA_WRAPPER_CLASSNAME,
|
|
522
|
+
He as TextArea
|
|
331
523
|
};
|
package/dist/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { TEXT_AREA_CLASSNAME as T, TEXT_AREA_CONTROL_LEFT_CLASSNAME as R, TEXT_AREA_CONTROL_RIGHT_CLASSNAME as e, TEXT_AREA_HELPER_TEXT_CLASSNAME as S, TEXT_AREA_WRAPPER_CLASSNAME as i, TextArea as o } from "./components/TextArea/TextArea.js";
|
|
2
2
|
/*!
|
|
3
|
-
@versini/ui-textarea
|
|
3
|
+
@versini/ui-textarea v5.0.0
|
|
4
4
|
© 2025 gizmette.com
|
|
5
5
|
*/
|
|
6
6
|
try {
|
|
7
7
|
window.__VERSINI_UI_TEXTAREA__ || (window.__VERSINI_UI_TEXTAREA__ = {
|
|
8
|
-
version: "
|
|
9
|
-
buildTime: "09/01/2025
|
|
8
|
+
version: "5.0.0",
|
|
9
|
+
buildTime: "09/01/2025 03:17 PM EDT",
|
|
10
10
|
homepage: "https://github.com/aversini/ui-components",
|
|
11
11
|
license: "MIT"
|
|
12
12
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@versini/ui-textarea",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.0.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "Arno Versini",
|
|
6
6
|
"publishConfig": {
|
|
@@ -37,22 +37,22 @@
|
|
|
37
37
|
"test": "vitest run"
|
|
38
38
|
},
|
|
39
39
|
"peerDependencies": {
|
|
40
|
-
"react": "^
|
|
41
|
-
"react-dom": "^
|
|
40
|
+
"react": "^19.0.0",
|
|
41
|
+
"react-dom": "^19.0.0"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"@testing-library/jest-dom": "6.8.0",
|
|
45
|
-
"@versini/ui-types": "
|
|
45
|
+
"@versini/ui-types": "6.0.0"
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
48
|
"@tailwindcss/typography": "0.5.16",
|
|
49
|
-
"@versini/ui-hooks": "
|
|
50
|
-
"@versini/ui-liveregion": "
|
|
49
|
+
"@versini/ui-hooks": "5.0.0",
|
|
50
|
+
"@versini/ui-liveregion": "3.0.0",
|
|
51
51
|
"clsx": "2.1.1",
|
|
52
52
|
"tailwindcss": "4.1.12"
|
|
53
53
|
},
|
|
54
54
|
"sideEffects": [
|
|
55
55
|
"**/*.css"
|
|
56
56
|
],
|
|
57
|
-
"gitHead": "
|
|
57
|
+
"gitHead": "70a47e9e30172dbb7b36306773fe9511e437fba6"
|
|
58
58
|
}
|