@versini/ui-textarea 2.1.0 → 2.1.2
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 +49 -49
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -2,19 +2,19 @@ import { jsx as T, jsxs as pe } from "react/jsx-runtime";
|
|
|
2
2
|
import ye, { useRef as f, useEffect as O, useCallback as me, useMemo as J, useState as v, useId as xe, useReducer as he, useLayoutEffect as I } from "react";
|
|
3
3
|
import c from "clsx";
|
|
4
4
|
/*!
|
|
5
|
-
@versini/ui-textarea v2.1.
|
|
6
|
-
©
|
|
5
|
+
@versini/ui-textarea v2.1.2
|
|
6
|
+
© 2025 gizmette.com
|
|
7
7
|
*/
|
|
8
8
|
try {
|
|
9
9
|
window.__VERSINI_UI_TEXTAREA__ || (window.__VERSINI_UI_TEXTAREA__ = {
|
|
10
|
-
version: "2.1.
|
|
11
|
-
buildTime: "
|
|
10
|
+
version: "2.1.2",
|
|
11
|
+
buildTime: "01/02/2025 05:13 PM EST",
|
|
12
12
|
homepage: "https://github.com/aversini/ui-components",
|
|
13
13
|
license: "MIT"
|
|
14
14
|
});
|
|
15
15
|
} catch {
|
|
16
16
|
}
|
|
17
|
-
const K = "av-text-area", Ae = "av-text-area-wrapper",
|
|
17
|
+
const K = "av-text-area", Ae = "av-text-area-wrapper", M = "av-text-area-helper-text", Te = "av-text-area__control--right", ge = "av-text-area__control--left";
|
|
18
18
|
function _e() {
|
|
19
19
|
const e = f(!1);
|
|
20
20
|
return O(() => (e.current = !0, () => {
|
|
@@ -161,7 +161,7 @@ function Le({
|
|
|
161
161
|
visible: l,
|
|
162
162
|
...i
|
|
163
163
|
}) {
|
|
164
|
-
const p = f(null), y = f(null), [
|
|
164
|
+
const p = f(null), y = f(null), [b, E] = he(Ne, {
|
|
165
165
|
announcement: null
|
|
166
166
|
});
|
|
167
167
|
let g = t;
|
|
@@ -191,18 +191,18 @@ function Le({
|
|
|
191
191
|
...n && { role: n },
|
|
192
192
|
className: d,
|
|
193
193
|
...i,
|
|
194
|
-
children:
|
|
194
|
+
children: b.announcement
|
|
195
195
|
}
|
|
196
196
|
);
|
|
197
197
|
}
|
|
198
198
|
/*!
|
|
199
|
-
@versini/ui-liveregion v1.2.
|
|
200
|
-
©
|
|
199
|
+
@versini/ui-liveregion v1.2.8
|
|
200
|
+
© 2025 gizmette.com
|
|
201
201
|
*/
|
|
202
202
|
try {
|
|
203
203
|
window.__VERSINI_UI_LIVEREGION__ || (window.__VERSINI_UI_LIVEREGION__ = {
|
|
204
|
-
version: "1.2.
|
|
205
|
-
buildTime: "
|
|
204
|
+
version: "1.2.8",
|
|
205
|
+
buildTime: "01/02/2025 05:13 PM EST",
|
|
206
206
|
homepage: "https://github.com/aversini/ui-components",
|
|
207
207
|
license: "MIT"
|
|
208
208
|
});
|
|
@@ -267,7 +267,7 @@ const Se = () => "rounded-md text-base h-20 min-h-[80px] resize-none overflow-hi
|
|
|
267
267
|
"text-copy-medium dark:text-copy-error-dark": n === "alt-system"
|
|
268
268
|
}
|
|
269
269
|
);
|
|
270
|
-
},
|
|
270
|
+
}, He = ({
|
|
271
271
|
error: e,
|
|
272
272
|
raw: r,
|
|
273
273
|
mode: t,
|
|
@@ -277,24 +277,24 @@ const Se = () => "rounded-md text-base h-20 min-h-[80px] resize-none overflow-hi
|
|
|
277
277
|
return "";
|
|
278
278
|
if (n)
|
|
279
279
|
return c(
|
|
280
|
-
|
|
280
|
+
M,
|
|
281
281
|
"absolute px-2 cursor-not-allowed opacity-50 font-medium"
|
|
282
282
|
);
|
|
283
283
|
if (!e)
|
|
284
|
-
return c(
|
|
284
|
+
return c(M, "absolute px-2 font-medium", {
|
|
285
285
|
"text-copy-medium": t === "dark",
|
|
286
286
|
"text-copy-dark": t === "light",
|
|
287
287
|
"text-copy-dark dark:text-copy-medium": t === "system",
|
|
288
288
|
"text-copy-medium dark:text-copy-dark": t === "alt-system"
|
|
289
289
|
});
|
|
290
290
|
if (e)
|
|
291
|
-
return c(
|
|
291
|
+
return c(M, "absolute px-2 font-medium", {
|
|
292
292
|
"text-copy-error-light": t === "dark",
|
|
293
293
|
"text-copy-error-dark": t === "light",
|
|
294
294
|
"text-copy-error-dark dark:text-copy-error-light": t === "system",
|
|
295
295
|
"dark:text-copy-error-dark text-copy-error-light": t === "alt-system"
|
|
296
296
|
});
|
|
297
|
-
},
|
|
297
|
+
}, Me = ({
|
|
298
298
|
className: e,
|
|
299
299
|
textAreaClassName: r,
|
|
300
300
|
raw: t,
|
|
@@ -310,7 +310,7 @@ const Se = () => "rounded-md text-base h-20 min-h-[80px] resize-none overflow-hi
|
|
|
310
310
|
"relative flex w-full flex-col justify-center",
|
|
311
311
|
Ae,
|
|
312
312
|
e
|
|
313
|
-
),
|
|
313
|
+
), b = t ? c(r) : c(
|
|
314
314
|
K,
|
|
315
315
|
r,
|
|
316
316
|
Se(),
|
|
@@ -330,7 +330,7 @@ const Se = () => "rounded-md text-base h-20 min-h-[80px] resize-none overflow-hi
|
|
|
330
330
|
mode: l,
|
|
331
331
|
rightElement: p,
|
|
332
332
|
leftElement: i
|
|
333
|
-
}), d =
|
|
333
|
+
}), d = He({
|
|
334
334
|
error: s,
|
|
335
335
|
raw: t,
|
|
336
336
|
mode: l,
|
|
@@ -338,14 +338,14 @@ const Se = () => "rounded-md text-base h-20 min-h-[80px] resize-none overflow-hi
|
|
|
338
338
|
}), N = t ? void 0 : c(Te, "absolute"), h = t ? void 0 : c(ge, "absolute");
|
|
339
339
|
return {
|
|
340
340
|
wrapper: y,
|
|
341
|
-
textArea:
|
|
341
|
+
textArea: b,
|
|
342
342
|
accessibleLabel: E,
|
|
343
343
|
visibleLabel: g,
|
|
344
344
|
helperText: d,
|
|
345
345
|
rightElement: N,
|
|
346
346
|
leftElement: h
|
|
347
347
|
};
|
|
348
|
-
},
|
|
348
|
+
}, De = ({
|
|
349
349
|
scrollHeight: e,
|
|
350
350
|
currentHeight: r,
|
|
351
351
|
currentLabelOffset: t = 0,
|
|
@@ -374,38 +374,38 @@ const Se = () => "rounded-md text-base h-20 min-h-[80px] resize-none overflow-hi
|
|
|
374
374
|
focusMode: i = "system",
|
|
375
375
|
value: p,
|
|
376
376
|
defaultValue: y,
|
|
377
|
-
disabled:
|
|
377
|
+
disabled: b = !1,
|
|
378
378
|
noBorder: E = !1,
|
|
379
379
|
labelId: g,
|
|
380
380
|
helperText: d = "",
|
|
381
381
|
helperTextOnFocus: N = !1,
|
|
382
382
|
rightElement: h,
|
|
383
|
-
leftElement:
|
|
384
|
-
onChange:
|
|
383
|
+
leftElement: k,
|
|
384
|
+
onChange: D,
|
|
385
385
|
onFocus: F,
|
|
386
386
|
onBlur: U,
|
|
387
387
|
...Z
|
|
388
388
|
}, ee) => {
|
|
389
389
|
var B;
|
|
390
|
-
const x = f(null), te = be([ee, x]), [re, L] = W(), [ne,
|
|
390
|
+
const x = f(null), te = be([ee, x]), [re, L] = W(), [ne, R] = W(), w = f(80), V = f(-25), m = f(null), X = f(30), S = f(null), C = ve({ id: e, prefix: `${K}-` }), [j, ae] = v(0), [G, oe] = v(0), [se, z] = v(
|
|
391
391
|
!!(!N && d)
|
|
392
|
-
), ce = `${r} error, ${d}`,
|
|
392
|
+
), ce = `${r} error, ${d}`, _ = Me({
|
|
393
393
|
className: o,
|
|
394
394
|
textAreaClassName: s,
|
|
395
395
|
error: n,
|
|
396
396
|
raw: a,
|
|
397
397
|
focusMode: i,
|
|
398
|
-
disabled:
|
|
398
|
+
disabled: b,
|
|
399
399
|
noBorder: E,
|
|
400
400
|
mode: l,
|
|
401
401
|
rightElement: !!h,
|
|
402
|
-
leftElement: !!
|
|
402
|
+
leftElement: !!k
|
|
403
403
|
}), [A, le] = Re({
|
|
404
404
|
value: p,
|
|
405
405
|
initialControlledDelay: 20,
|
|
406
406
|
defaultValue: y,
|
|
407
407
|
onChange: (u) => {
|
|
408
|
-
|
|
408
|
+
D && D({
|
|
409
409
|
target: {
|
|
410
410
|
value: u
|
|
411
411
|
}
|
|
@@ -421,8 +421,8 @@ const Se = () => "rounded-md text-base h-20 min-h-[80px] resize-none overflow-hi
|
|
|
421
421
|
return I(() => {
|
|
422
422
|
L && L.width && ae(L.width + 18 + 10);
|
|
423
423
|
}, [L]), I(() => {
|
|
424
|
-
|
|
425
|
-
}, [
|
|
424
|
+
R && R.width && oe(R.width + 18 + 10);
|
|
425
|
+
}, [R]), I(() => {
|
|
426
426
|
a || x && x.current && A !== void 0 && (x.current.style.height = "inherit", x.current.style.height = x.current.scrollHeight + "px");
|
|
427
427
|
}, [A, a]), I(() => {
|
|
428
428
|
a || setTimeout(() => {
|
|
@@ -435,7 +435,7 @@ const Se = () => "rounded-md text-base h-20 min-h-[80px] resize-none overflow-hi
|
|
|
435
435
|
}, [A, a]), I(() => {
|
|
436
436
|
var u, $;
|
|
437
437
|
if (!a && x && x.current && A !== void 0) {
|
|
438
|
-
const { labelOffset: P, helperTextOffset:
|
|
438
|
+
const { labelOffset: P, helperTextOffset: H, scrollHeight: fe } = De({
|
|
439
439
|
scrollHeight: x.current.scrollHeight,
|
|
440
440
|
currentHeight: w.current,
|
|
441
441
|
currentLabelOffset: V.current,
|
|
@@ -444,30 +444,30 @@ const Se = () => "rounded-md text-base h-20 min-h-[80px] resize-none overflow-hi
|
|
|
444
444
|
P && (V.current = P, (u = m == null ? void 0 : m.current) == null || u.style.setProperty(
|
|
445
445
|
"--av-text-area-label",
|
|
446
446
|
`${P}px`
|
|
447
|
-
)),
|
|
447
|
+
)), H && (X.current = H, ($ = S == null ? void 0 : S.current) == null || $.style.setProperty(
|
|
448
448
|
"--av-text-area-helper-text",
|
|
449
|
-
`${
|
|
449
|
+
`${H}px`
|
|
450
450
|
)), w.current = fe || w.current;
|
|
451
451
|
}
|
|
452
|
-
}, [A, a]),
|
|
452
|
+
}, [A, a]), R.width > 0 && ((B = m == null ? void 0 : m.current) == null || B.style.setProperty(
|
|
453
453
|
"--tw-translate-x",
|
|
454
|
-
`${12 +
|
|
455
|
-
)), /* @__PURE__ */ pe("div", { className:
|
|
454
|
+
`${12 + R.width + 5}px`
|
|
455
|
+
)), /* @__PURE__ */ pe("div", { className: _.wrapper, children: [
|
|
456
456
|
/* @__PURE__ */ T(
|
|
457
457
|
"label",
|
|
458
458
|
{
|
|
459
459
|
htmlFor: C,
|
|
460
460
|
id: g,
|
|
461
|
-
className:
|
|
461
|
+
className: _.accessibleLabel,
|
|
462
462
|
children: t
|
|
463
463
|
}
|
|
464
464
|
),
|
|
465
|
-
|
|
465
|
+
k && /* @__PURE__ */ T(
|
|
466
466
|
"div",
|
|
467
467
|
{
|
|
468
468
|
ref: ne,
|
|
469
|
-
className:
|
|
470
|
-
children:
|
|
469
|
+
className: _.leftElement,
|
|
470
|
+
children: k
|
|
471
471
|
}
|
|
472
472
|
),
|
|
473
473
|
/* @__PURE__ */ T(
|
|
@@ -476,15 +476,15 @@ const Se = () => "rounded-md text-base h-20 min-h-[80px] resize-none overflow-hi
|
|
|
476
476
|
ref: te,
|
|
477
477
|
id: C,
|
|
478
478
|
name: r,
|
|
479
|
-
disabled:
|
|
479
|
+
disabled: b,
|
|
480
480
|
placeholder: a ? void 0 : " ",
|
|
481
|
-
className:
|
|
481
|
+
className: _.textArea,
|
|
482
482
|
rows: 1,
|
|
483
483
|
...d && { "aria-describedby": `${C}-helper` },
|
|
484
484
|
...n && { "aria-invalid": "true" },
|
|
485
|
-
...h && !
|
|
486
|
-
...
|
|
487
|
-
...h &&
|
|
485
|
+
...h && !k && !a && { style: { paddingRight: j } },
|
|
486
|
+
...k && !h && !a && { style: { paddingLeft: G } },
|
|
487
|
+
...h && k && !a && {
|
|
488
488
|
style: {
|
|
489
489
|
paddingRight: j,
|
|
490
490
|
paddingLeft: G
|
|
@@ -503,7 +503,7 @@ const Se = () => "rounded-md text-base h-20 min-h-[80px] resize-none overflow-hi
|
|
|
503
503
|
ref: m,
|
|
504
504
|
"aria-hidden": !0,
|
|
505
505
|
htmlFor: C,
|
|
506
|
-
className: `${
|
|
506
|
+
className: `${_.visibleLabel}`,
|
|
507
507
|
children: t
|
|
508
508
|
}
|
|
509
509
|
),
|
|
@@ -512,7 +512,7 @@ const Se = () => "rounded-md text-base h-20 min-h-[80px] resize-none overflow-hi
|
|
|
512
512
|
{
|
|
513
513
|
ref: S,
|
|
514
514
|
id: `${C}-helper`,
|
|
515
|
-
className:
|
|
515
|
+
className: _.helperText,
|
|
516
516
|
children: d
|
|
517
517
|
}
|
|
518
518
|
),
|
|
@@ -520,7 +520,7 @@ const Se = () => "rounded-md text-base h-20 min-h-[80px] resize-none overflow-hi
|
|
|
520
520
|
"div",
|
|
521
521
|
{
|
|
522
522
|
ref: re,
|
|
523
|
-
className:
|
|
523
|
+
className: _.rightElement,
|
|
524
524
|
children: h
|
|
525
525
|
}
|
|
526
526
|
),
|
|
@@ -533,7 +533,7 @@ export {
|
|
|
533
533
|
K as TEXT_AREA_CLASSNAME,
|
|
534
534
|
ge as TEXT_AREA_CONTROL_LEFT_CLASSNAME,
|
|
535
535
|
Te as TEXT_AREA_CONTROL_RIGHT_CLASSNAME,
|
|
536
|
-
|
|
536
|
+
M as TEXT_AREA_HELPER_TEXT_CLASSNAME,
|
|
537
537
|
Ae as TEXT_AREA_WRAPPER_CLASSNAME,
|
|
538
538
|
Fe as TextArea
|
|
539
539
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@versini/ui-textarea",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.2",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "Arno Versini",
|
|
6
6
|
"publishConfig": {
|
|
@@ -40,13 +40,13 @@
|
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"@tailwindcss/typography": "0.5.15",
|
|
42
42
|
"@versini/ui-hooks": "4.3.0",
|
|
43
|
-
"@versini/ui-liveregion": "1.2.
|
|
44
|
-
"@versini/ui-types": "3.0.
|
|
43
|
+
"@versini/ui-liveregion": "1.2.8",
|
|
44
|
+
"@versini/ui-types": "3.0.3",
|
|
45
45
|
"clsx": "2.1.1",
|
|
46
46
|
"tailwindcss": "3.4.17"
|
|
47
47
|
},
|
|
48
48
|
"sideEffects": [
|
|
49
49
|
"**/*.css"
|
|
50
50
|
],
|
|
51
|
-
"gitHead": "
|
|
51
|
+
"gitHead": "c43b9e0ea4ad97fde6cc3d088c32374ff34c6495"
|
|
52
52
|
}
|