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