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