@brightlocal/ui-components 1.2.4 → 1.4.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.
@@ -0,0 +1,389 @@
1
+ import { jsx as y, jsxs as O } from "react/jsx-runtime";
2
+ import * as gt from "react";
3
+ import { useId as It, useMemo as yt, useRef as S, useState as Et, useCallback as Ft, useEffect as st } from "react";
4
+ import { animate as j } from "framer-motion";
5
+ import { cn as Xt } from "@brightlocal/ui-components/lib/utils";
6
+ import { usePrefersReducedMotion as $t } from "./hooks/use-prefers-reduced-motion.js";
7
+ const Ct = "M250 500C388.071 500 500 388.071 500 250C500 111.929 388.071 0 250 0C111.929 0 0 111.929 0 250C0 388.071 111.929 500 250 500Z", wt = "M492.425 259.355C332.265 293.145 293.145 332.265 259.355 492.425C257.225 502.525 242.775 502.525 240.645 492.425C206.855 332.265 167.735 293.145 7.575 259.355C-2.525 257.225 -2.525 242.775 7.575 240.645C167.735 206.855 206.855 167.735 240.645 7.575C242.775 -2.525 257.225 -2.525 259.355 7.575C293.145 167.735 332.265 206.855 492.425 240.645C502.525 242.775 502.525 257.225 492.425 259.355Z", bt = "M258.366 5.58795L296.379 97.3854C298.509 102.526 304.729 104.546 309.47 101.636L394.177 49.7215C401.057 45.5112 409.598 51.7117 407.708 59.5523L384.506 156.16C383.206 161.571 387.046 166.861 392.596 167.301L491.645 175.092C499.685 175.722 502.945 185.763 496.815 191.003L421.259 255.528C417.029 259.138 417.029 265.679 421.259 269.299L496.815 333.824C502.945 339.065 499.685 349.106 491.645 349.736L392.596 357.526C387.046 357.966 383.206 363.257 384.506 368.667L407.708 465.275C409.588 473.116 401.047 479.326 394.177 475.106L309.47 423.192C304.729 420.282 298.509 422.302 296.379 427.442L258.366 519.24C255.275 526.69 244.725 526.69 241.634 519.24L203.621 427.442C201.491 422.302 195.271 420.282 190.53 423.192L105.823 475.106C98.9428 479.316 90.4021 473.116 92.2922 465.275L115.494 368.667C116.794 363.257 112.954 357.966 107.403 357.526L8.35543 349.736C0.314784 349.106 -2.94548 339.065 3.18502 333.824L78.7411 269.299C82.9715 265.689 82.9715 259.148 78.7411 255.528L3.18502 191.003C-2.94548 185.763 0.314784 175.722 8.35543 175.092L107.403 167.301C112.954 166.861 116.794 161.571 115.494 156.16L92.2922 59.5523C90.4121 51.7117 98.9528 45.5012 105.823 49.7215L190.53 101.636C195.271 104.546 201.491 102.526 203.621 97.3854L241.634 5.58795C244.725 -1.86265 255.275 -1.86265 258.366 5.58795Z", z = (f) => f < 0 ? 0 : f > 1 ? 1 : f, Dt = [
8
+ Ct,
9
+ wt,
10
+ bt,
11
+ Ct,
12
+ bt,
13
+ wt
14
+ ], Ht = 30, Tt = 15, _t = typeof navigator < "u" && typeof navigator.hardwareConcurrency == "number" && navigator.hardwareConcurrency <= 4;
15
+ function qt(f, H, C) {
16
+ let w = !1, b = null;
17
+ const i = { ballX: 0, clipRight: 100, rotate: 0, pathD: "" };
18
+ function Z() {
19
+ w = !1, f.style.transform = `translateX(${i.ballX}px)`, b && (b.style.clipPath = `inset(0 ${i.clipRight}% 0 0)`), H.style.transform = `rotate(${i.rotate}deg)`, C.setAttribute("d", i.pathD);
20
+ }
21
+ function N(T, G, J, r) {
22
+ i.ballX = T, i.clipRight = G, i.rotate = J, i.pathD = r, w || (w = !0, requestAnimationFrame(Z));
23
+ }
24
+ return N.setItem = (T) => {
25
+ b = T;
26
+ }, N;
27
+ }
28
+ function Rt(f, H) {
29
+ return new Promise((C) => {
30
+ const w = performance.now();
31
+ function b() {
32
+ H.cancelled || performance.now() - w >= f ? C() : requestAnimationFrame(b);
33
+ }
34
+ requestAnimationFrame(b);
35
+ });
36
+ }
37
+ const zt = gt.forwardRef(
38
+ ({
39
+ className: f,
40
+ dataHook: H,
41
+ holdTime: C = 1300,
42
+ shimmer: w = !0,
43
+ gradientFrom: b = "var(--loading-gradient-from)",
44
+ gradientTo: i = "var(--loading-gradient-to)",
45
+ trackingEl: Z,
46
+ trackingLabel: N,
47
+ children: T,
48
+ ...G
49
+ }, J) => {
50
+ const r = Dt, K = 0.8, Q = 180, V = 24, Y = 1, U = $t(), lt = It(), it = yt(
51
+ () => `text-reveal-gradient-${lt.replace(/:/g, "")}`,
52
+ [lt]
53
+ ), tt = S(null), et = S(null), nt = S(null), rt = S(null), ct = S(null), at = S(null), ot = S(null), P = S([]), F = gt.Children.toArray(T), [xt, Mt] = Et({ widths: [], ballSize: 0 }), { widths: d, ballSize: o } = xt, Lt = Ft(
54
+ (n) => (t) => {
55
+ P.current[n] = t;
56
+ },
57
+ []
58
+ );
59
+ st(() => {
60
+ if (P.current.length === 0 || !P.current[0]) return;
61
+ let n = !1;
62
+ function t() {
63
+ if (n) return;
64
+ const u = [];
65
+ let R = 32;
66
+ for (let p = 0; p < F.length; p++) {
67
+ const x = P.current[p];
68
+ if (x && (u[p] = x.scrollWidth, p === 0)) {
69
+ const X = x.firstElementChild ?? x, e = parseFloat(getComputedStyle(X).fontSize) || 16;
70
+ R = Math.round(e * 1.5);
71
+ }
72
+ }
73
+ Mt({ widths: u, ballSize: R });
74
+ }
75
+ return document.fonts.ready.then(() => {
76
+ n || requestAnimationFrame(t);
77
+ }), () => {
78
+ n = !0;
79
+ };
80
+ }, [F.length]), st(() => {
81
+ if (U) return;
82
+ const n = ct.current;
83
+ if (!n) return;
84
+ const t = n;
85
+ let u, R = null;
86
+ const p = 0.12 + Math.random() * 0.06, x = 0.08 + Math.random() * 0.04, X = Math.random() * Math.PI * 2, e = Math.random() * Math.PI * 2;
87
+ let _ = -1 / 0;
88
+ function W(c) {
89
+ R || (R = c);
90
+ const s = (c - R) / 1e3, l = Math.sin(s * p + X) * Math.PI + Math.sin(s * x + e) * 0.5;
91
+ if (Math.abs(l - _) > 0.01) {
92
+ _ = l;
93
+ const k = Math.cos(l), q = Math.sin(l);
94
+ t.setAttribute("x1", `${50 + 45 * k}%`), t.setAttribute("y1", `${50 + 45 * q}%`), t.setAttribute("x2", `${50 - 45 * k}%`), t.setAttribute("y2", `${50 - 45 * q}%`);
95
+ }
96
+ u = requestAnimationFrame(W);
97
+ }
98
+ return u = requestAnimationFrame(W), () => cancelAnimationFrame(u);
99
+ }, [U]);
100
+ function vt(n) {
101
+ n.style.opacity = "1", j(0, 1, {
102
+ duration: 1.2,
103
+ ease: [0.25, 1, 0.5, 1],
104
+ onUpdate: (t) => {
105
+ n.style.transform = `translateX(${-100 + t * 200}%)`;
106
+ },
107
+ onComplete: () => {
108
+ n.style.opacity = "0";
109
+ }
110
+ });
111
+ }
112
+ st(() => {
113
+ if (!nt.current || !rt.current || !tt.current || !et.current || !at.current || !ot.current || d.length === 0 || o === 0)
114
+ return;
115
+ const n = nt.current, t = rt.current, u = tt.current, R = et.current, p = at.current, x = ot.current;
116
+ function X(c) {
117
+ const s = `${c}px`;
118
+ p.style.width = s, x.style.width = s;
119
+ }
120
+ if (U) {
121
+ n.setAttribute("d", r[0]), t.style.opacity = "1";
122
+ const c = P.current[0];
123
+ c && (c.style.opacity = "1", c.style.clipPath = "none"), X(d[0] ?? 0);
124
+ const s = o * 0.25, l = (d[0] ?? 0) + s + o / 2;
125
+ u.style.transform = `translateX(${l}px)`;
126
+ return;
127
+ }
128
+ const e = { cancelled: !1 }, _ = o * 0.25;
129
+ async function W() {
130
+ const { interpolate: c } = await import("flubber");
131
+ if (e.cancelled) return;
132
+ const s = _t ? Tt : Ht, l = [];
133
+ for (let M = 0; M < r.length; M++) {
134
+ const L = c(
135
+ r[M],
136
+ r[(M + 1) % r.length]
137
+ ), v = [];
138
+ for (let A = 0; A <= s; A++)
139
+ v.push(L(A / s));
140
+ l.push(v);
141
+ }
142
+ const k = qt(u, t, n);
143
+ t.style.opacity = "1";
144
+ let q = 0, m = 0, I = 0;
145
+ for (; !e.cancelled; ) {
146
+ const M = q % F.length, L = d[M] ?? 0;
147
+ X(L);
148
+ const v = -(_ + o / 2), A = L + _ + o / 2, dt = A - v, ut = P.current[M];
149
+ if (!ut) break;
150
+ k.setItem(ut);
151
+ for (let a = 0; a < F.length; a++) {
152
+ const h = P.current[a];
153
+ h && (h.style.opacity = a === M ? "1" : "0", h.style.clipPath = "inset(0 100% 0 0)");
154
+ }
155
+ const St = l[m % r.length], B = 360, pt = I;
156
+ if (await new Promise((a) => {
157
+ if (e.cancelled) {
158
+ a();
159
+ return;
160
+ }
161
+ const h = j(v, A, {
162
+ type: "spring",
163
+ stiffness: Q * K,
164
+ damping: V,
165
+ mass: Y,
166
+ onUpdate: (g) => {
167
+ if (e.cancelled) {
168
+ h.stop(), a();
169
+ return;
170
+ }
171
+ const E = z((g - v) / dt), $ = L > 0 ? 100 - z(g / L) * 100 : 100, D = Math.round(E * s);
172
+ k(
173
+ g,
174
+ $,
175
+ pt + E * B,
176
+ St[D]
177
+ );
178
+ },
179
+ onComplete: () => {
180
+ I = pt + B, m = (m + 1) % r.length, a();
181
+ }
182
+ });
183
+ }), e.cancelled) break;
184
+ if (w && vt(R), C > 0) {
185
+ const a = performance.now(), h = A;
186
+ for (; !e.cancelled && performance.now() - a < C && (await Rt(300, e), !(e.cancelled || performance.now() - a >= C)); ) {
187
+ const g = (m + 1) % r.length, E = l[m % r.length], $ = I, D = I + 360;
188
+ await j(0, 1, {
189
+ type: "spring",
190
+ stiffness: 30,
191
+ damping: 9,
192
+ mass: 0.5,
193
+ onUpdate: (ht) => {
194
+ const kt = Math.round(z(ht) * s);
195
+ k(
196
+ h,
197
+ 0,
198
+ $ + ht * (D - $),
199
+ E[kt]
200
+ );
201
+ }
202
+ }), I = D, m = g;
203
+ }
204
+ }
205
+ if (e.cancelled) break;
206
+ const Pt = l[m % r.length], mt = I;
207
+ if (await new Promise((a) => {
208
+ if (e.cancelled) {
209
+ a();
210
+ return;
211
+ }
212
+ const h = j(A, v, {
213
+ type: "spring",
214
+ stiffness: Q * K,
215
+ damping: V,
216
+ mass: Y,
217
+ onUpdate: (g) => {
218
+ if (e.cancelled) {
219
+ h.stop(), a();
220
+ return;
221
+ }
222
+ const E = z(1 - (g - v) / dt), $ = L > 0 ? 100 - z(g / L) * 100 : 100, D = Math.round(E * s);
223
+ k(
224
+ g,
225
+ $,
226
+ mt - E * B,
227
+ Pt[D]
228
+ );
229
+ },
230
+ onComplete: () => {
231
+ I = mt - B, m = (m + 1) % r.length, a();
232
+ }
233
+ });
234
+ }), e.cancelled) break;
235
+ await Rt(300, e), q++;
236
+ }
237
+ }
238
+ return W(), () => {
239
+ e.cancelled = !0;
240
+ };
241
+ }, [
242
+ d,
243
+ o,
244
+ F.length,
245
+ U,
246
+ K,
247
+ C,
248
+ w,
249
+ Q,
250
+ V,
251
+ Y,
252
+ r
253
+ ]);
254
+ const ft = yt(
255
+ () => d.length > 0 ? Math.max(...d) : 0,
256
+ [d]
257
+ ), At = d.length > 0 && o > 0;
258
+ return /* @__PURE__ */ y(
259
+ "div",
260
+ {
261
+ ref: J,
262
+ className: Xt("relative inline-flex items-center", f),
263
+ "data-hook": H,
264
+ "data-slot": "text-reveal",
265
+ "data-tracking-el": Z,
266
+ "data-tracking-label": N,
267
+ style: {
268
+ opacity: At ? 1 : 0,
269
+ transition: "opacity 0.4s ease-out"
270
+ },
271
+ ...G,
272
+ children: /* @__PURE__ */ O(
273
+ "div",
274
+ {
275
+ ref: at,
276
+ className: "relative flex items-center",
277
+ style: {
278
+ width: ft || void 0,
279
+ transition: "width 0.3s ease-out"
280
+ },
281
+ children: [
282
+ /* @__PURE__ */ O(
283
+ "span",
284
+ {
285
+ ref: ot,
286
+ className: "relative inline-block overflow-hidden",
287
+ style: {
288
+ width: ft || void 0,
289
+ transition: "width 0.3s ease-out"
290
+ },
291
+ children: [
292
+ F.map((n, t) => /* @__PURE__ */ y(
293
+ "span",
294
+ {
295
+ ref: Lt(t),
296
+ style: {
297
+ display: "block",
298
+ whiteSpace: "nowrap",
299
+ opacity: 0,
300
+ clipPath: "inset(0 100% 0 0)",
301
+ willChange: "clip-path",
302
+ ...t > 0 ? { position: "absolute", top: 0, left: 0 } : {}
303
+ },
304
+ children: n
305
+ },
306
+ t
307
+ )),
308
+ /* @__PURE__ */ y(
309
+ "div",
310
+ {
311
+ ref: et,
312
+ className: "pointer-events-none absolute inset-0",
313
+ style: {
314
+ opacity: 0,
315
+ transform: "translateX(-100%)",
316
+ willChange: "transform",
317
+ background: "linear-gradient(90deg, transparent 0%, color-mix(in srgb, var(--background) 40%, transparent) 40%, color-mix(in srgb, var(--background) 70%, transparent) 50%, color-mix(in srgb, var(--background) 40%, transparent) 60%, transparent 100%)"
318
+ }
319
+ }
320
+ )
321
+ ]
322
+ }
323
+ ),
324
+ /* @__PURE__ */ y(
325
+ "div",
326
+ {
327
+ ref: tt,
328
+ className: "absolute",
329
+ style: {
330
+ left: -o / 2,
331
+ top: "50%",
332
+ marginTop: -o / 2,
333
+ width: o,
334
+ height: o,
335
+ transform: "translateX(0px)",
336
+ willChange: "transform"
337
+ },
338
+ children: /* @__PURE__ */ O(
339
+ "svg",
340
+ {
341
+ "aria-label": "Loading",
342
+ "data-slot": "text-reveal-ball",
343
+ fill: "none",
344
+ height: o,
345
+ role: "img",
346
+ style: { overflow: "visible" },
347
+ viewBox: "-30 -30 560 560",
348
+ width: o,
349
+ xmlns: "http://www.w3.org/2000/svg",
350
+ children: [
351
+ /* @__PURE__ */ y("defs", { children: /* @__PURE__ */ O("linearGradient", { ref: ct, id: it, children: [
352
+ /* @__PURE__ */ y("stop", { offset: "-20%", stopColor: b }),
353
+ /* @__PURE__ */ y("stop", { offset: "120%", stopColor: i })
354
+ ] }) }),
355
+ /* @__PURE__ */ y(
356
+ "g",
357
+ {
358
+ ref: rt,
359
+ style: {
360
+ opacity: 0,
361
+ transformOrigin: "250px 250px",
362
+ willChange: "transform"
363
+ },
364
+ children: /* @__PURE__ */ y(
365
+ "path",
366
+ {
367
+ ref: nt,
368
+ d: r[0],
369
+ fill: `url(#${it})`
370
+ }
371
+ )
372
+ }
373
+ )
374
+ ]
375
+ }
376
+ )
377
+ }
378
+ )
379
+ ]
380
+ }
381
+ )
382
+ }
383
+ );
384
+ }
385
+ );
386
+ zt.displayName = "TextRevealMotion";
387
+ export {
388
+ zt as TextRevealMotion
389
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brightlocal/ui-components",
3
- "version": "1.2.4",
3
+ "version": "1.4.0",
4
4
  "description": "BrightLocal Design System UI Components",
5
5
  "type": "module",
6
6
  "private": false,
@@ -95,6 +95,7 @@
95
95
  },
96
96
  "devDependencies": {
97
97
  "@size-limit/file": "^12.0.0",
98
+ "@types/flubber": "^0.4.0",
98
99
  "@types/node": "^25.0.10",
99
100
  "@types/react": "^19.2.10",
100
101
  "@types/react-dom": "^19.2.3",
@@ -105,8 +106,8 @@
105
106
  "vite-bundle-visualizer": "^1.2.1",
106
107
  "vite-plugin-dts": "^4.5.4",
107
108
  "vite-plugin-lib-inject-css": "^2.2.2",
108
- "@workspace/typescript-config": "0.0.0",
109
- "@workspace/eslint-config": "0.0.0"
109
+ "@workspace/eslint-config": "0.0.0",
110
+ "@workspace/typescript-config": "0.0.0"
110
111
  },
111
112
  "publishConfig": {
112
113
  "access": "public",
@@ -150,6 +151,7 @@
150
151
  "cmdk": "^1.1.1",
151
152
  "date-fns": "^4.1.0",
152
153
  "embla-carousel-react": "^8.6.0",
154
+ "flubber": "^0.4.2",
153
155
  "framer-motion": "^12.29.2",
154
156
  "input-otp": "^1.4.2",
155
157
  "lucide-react": "^0.475.0",
@@ -28,10 +28,20 @@ export interface InputListProps {
28
28
  */
29
29
  onValueChange: (value: string[]) => void;
30
30
  /**
31
- * Maximum number of items allowed.
32
- * When reached, the input and add button are disabled and a count indicator is shown.
31
+ * Called before items are added to the list.
32
+ * Return `true` to allow the addition, or a `string` to block it
33
+ * and display that string as an error message.
34
+ * The input value is preserved when addition is blocked.
35
+ * @example
36
+ * ```tsx
37
+ * onBeforeAdd={(newItems, current) => {
38
+ * const existing = new Set(current.map((k) => k.toLowerCase()));
39
+ * const hasDupe = newItems.some((item) => existing.has(item.toLowerCase()));
40
+ * return hasDupe ? "Keyword already added" : true;
41
+ * }}
42
+ * ```
33
43
  */
34
- maxItems?: number;
44
+ onBeforeAdd?: (newItems: string[], currentValue: string[]) => true | string;
35
45
  /**
36
46
  * Placeholder text for the text input.
37
47
  * @default "Add item"
@@ -88,8 +98,7 @@ export interface InputListProps {
88
98
  /**
89
99
  * InputList block — a managed list of text items with an add-input and per-row remove controls.
90
100
  *
91
- * Supports a maximum item limit with count indicator,
92
- * multi-line paste (each line becomes a separate item), loading skeletons, disabled state,
101
+ * Supports multi-line paste (each line becomes a separate item), loading skeletons, disabled state,
93
102
  * and input error/validation state.
94
103
  *
95
104
  * @example
@@ -97,7 +106,6 @@ export interface InputListProps {
97
106
  * <InputList
98
107
  * value={keywords}
99
108
  * onValueChange={setKeywords}
100
- * maxItems={10}
101
109
  * dataHook="keywords"
102
110
  * />
103
111
  * ```
@@ -105,7 +113,7 @@ export interface InputListProps {
105
113
  function InputList({
106
114
  value,
107
115
  onValueChange,
108
- maxItems,
116
+ onBeforeAdd,
109
117
  placeholder = "Add item",
110
118
  addButtonLabel = "Add",
111
119
  skeletonCount = 3,
@@ -120,6 +128,9 @@ function InputList({
120
128
  className,
121
129
  }: InputListProps) {
122
130
  const [inputValue, setInputValue] = React.useState("");
131
+ const [validationError, setValidationError] = React.useState<string | null>(
132
+ null
133
+ );
123
134
 
124
135
  // Stable keys so AnimatePresence can track items across additions/removals
125
136
  const nextIdRef = React.useRef(value.length);
@@ -148,27 +159,31 @@ function InputList({
148
159
  });
149
160
  }, [value]);
150
161
 
151
- const atLimit = maxItems !== undefined && value.length >= maxItems;
152
- const inputDisabled = disabled || atLimit || loading;
153
- const buttonDisabled = disabled || atLimit || loading;
162
+ const inputDisabled = disabled || loading;
163
+ const buttonDisabled = disabled || loading;
154
164
 
155
165
  const addItems = React.useCallback(
156
166
  (items: string[]) => {
157
- const trimmed = items.map((s) => s.trim()).filter(Boolean);
158
- if (!trimmed.length) return;
159
- const available =
160
- maxItems !== undefined ? maxItems - value.length : Infinity;
161
- const toAdd = trimmed.slice(0, available);
162
- if (toAdd.length) {
163
- setStableKeys((prev) => [
164
- ...prev,
165
- ...toAdd.map(() => nextIdRef.current++),
166
- ]);
167
- onValueChange([...value, ...toAdd]);
168
- setInputValue("");
167
+ const toAdd = items.map((s) => s.trim()).filter(Boolean);
168
+ if (!toAdd.length) return;
169
+
170
+ if (onBeforeAdd) {
171
+ const result = onBeforeAdd(toAdd, value);
172
+ if (result !== true) {
173
+ setValidationError(result);
174
+ return;
175
+ }
169
176
  }
177
+
178
+ setValidationError(null);
179
+ setStableKeys((prev) => [
180
+ ...prev,
181
+ ...toAdd.map(() => nextIdRef.current++),
182
+ ]);
183
+ onValueChange([...value, ...toAdd]);
184
+ setInputValue("");
170
185
  },
171
- [value, maxItems, onValueChange]
186
+ [value, onValueChange, onBeforeAdd]
172
187
  );
173
188
 
174
189
  const removeItem = React.useCallback(
@@ -210,7 +225,7 @@ function InputList({
210
225
  <Item key={i} variant="loading" />
211
226
  ))}
212
227
  </ul>
213
- ) : value.length > 0 ? (
228
+ ) : (
214
229
  <ul
215
230
  className="flex flex-col gap-2"
216
231
  data-hook={`${dataHook}-list`}
@@ -270,7 +285,7 @@ function InputList({
270
285
  ))}
271
286
  </AnimatePresence>
272
287
  </ul>
273
- ) : null}
288
+ )}
274
289
 
275
290
  {/* Input row */}
276
291
  <div className="flex flex-col gap-2" data-slot="input-list-input-area">
@@ -279,10 +294,13 @@ function InputList({
279
294
  className="flex-1"
280
295
  dataHook={`${dataHook}-input`}
281
296
  disabled={inputDisabled}
282
- error={error}
297
+ error={error || !!validationError}
283
298
  placeholder={placeholder}
284
299
  value={inputValue}
285
- onChange={(e) => setInputValue(e.target.value)}
300
+ onChange={(e) => {
301
+ setInputValue(e.target.value);
302
+ if (validationError) setValidationError(null);
303
+ }}
286
304
  onKeyDown={handleKeyDown}
287
305
  onPaste={handlePaste}
288
306
  />
@@ -295,36 +313,25 @@ function InputList({
295
313
  </Button>
296
314
  </div>
297
315
 
298
- {/* Error message replaces description and counter */}
299
- {error && errorMessage ? (
316
+ {/* Error message replaces description */}
317
+ {(error && errorMessage) || validationError ? (
300
318
  <FieldError
319
+ className="text-left"
301
320
  data-slot="input-list-error"
302
321
  dataHook={`${dataHook}-error`}
303
322
  >
304
- {errorMessage}
323
+ {validationError ?? errorMessage}
305
324
  </FieldError>
306
325
  ) : (
307
- <>
308
- {/* Description */}
309
- {description && (
310
- <FieldDescription
311
- data-slot="input-list-description"
312
- dataHook={`${dataHook}-description`}
313
- >
314
- {description}
315
- </FieldDescription>
316
- )}
317
-
318
- {/* Count indicator — always shown when maxItems is set */}
319
- {maxItems !== undefined && (
320
- <FieldDescription
321
- data-slot="input-list-count"
322
- dataHook={`${dataHook}-count`}
323
- >
324
- {value.length}/{maxItems}
325
- </FieldDescription>
326
- )}
327
- </>
326
+ description && (
327
+ <FieldDescription
328
+ className="text-left"
329
+ data-slot="input-list-description"
330
+ dataHook={`${dataHook}-description`}
331
+ >
332
+ {description}
333
+ </FieldDescription>
334
+ )
328
335
  )}
329
336
  </div>
330
337
  </div>