@brightlocal/ui-components 2.11.0 → 2.12.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.
Files changed (134) hide show
  1. package/component-meta.json +163 -12
  2. package/dist/blocks/data-table.cjs +1 -1
  3. package/dist/blocks/data-table.d.ts +16 -4
  4. package/dist/blocks/data-table.d.ts.map +1 -1
  5. package/dist/blocks/data-table.js +57 -53
  6. package/dist/blocks/input-list.cjs +2 -2
  7. package/dist/blocks/input-list.d.ts +7 -1
  8. package/dist/blocks/input-list.d.ts.map +1 -1
  9. package/dist/blocks/input-list.js +82 -81
  10. package/dist/blocks/sidebar.cjs +1 -1
  11. package/dist/blocks/sidebar.d.ts +18 -7
  12. package/dist/blocks/sidebar.d.ts.map +1 -1
  13. package/dist/blocks/sidebar.js +143 -136
  14. package/dist/breadcrumb.cjs +1 -1
  15. package/dist/breadcrumb.d.ts +14 -2
  16. package/dist/breadcrumb.d.ts.map +1 -1
  17. package/dist/breadcrumb.js +37 -37
  18. package/dist/callout.cjs +1 -1
  19. package/dist/callout.d.ts +3 -3
  20. package/dist/callout.d.ts.map +1 -1
  21. package/dist/callout.js +2 -1
  22. package/dist/carousel.cjs +1 -1
  23. package/dist/carousel.d.ts +24 -3
  24. package/dist/carousel.d.ts.map +1 -1
  25. package/dist/carousel.js +121 -117
  26. package/dist/chip.cjs +1 -1
  27. package/dist/chip.d.ts +11 -0
  28. package/dist/chip.d.ts.map +1 -1
  29. package/dist/chip.js +43 -38
  30. package/dist/combobox.cjs +3 -3
  31. package/dist/combobox.d.ts +12 -2
  32. package/dist/combobox.d.ts.map +1 -1
  33. package/dist/combobox.js +235 -230
  34. package/dist/command.cjs +1 -1
  35. package/dist/command.d.ts +5 -0
  36. package/dist/command.d.ts.map +1 -1
  37. package/dist/command.js +207 -206
  38. package/dist/date-picker.cjs +1 -1
  39. package/dist/date-picker.d.ts +10 -0
  40. package/dist/date-picker.d.ts.map +1 -1
  41. package/dist/date-picker.js +96 -96
  42. package/dist/dialog.cjs +1 -1
  43. package/dist/dialog.d.ts +7 -2
  44. package/dist/dialog.d.ts.map +1 -1
  45. package/dist/dialog.js +38 -30
  46. package/dist/drawer.d.ts +2 -2
  47. package/dist/global-layout.cjs +1 -1
  48. package/dist/global-layout.d.ts +5 -0
  49. package/dist/global-layout.d.ts.map +1 -1
  50. package/dist/global-layout.js +15 -7
  51. package/dist/index.cjs +1 -1
  52. package/dist/index.js +178 -178
  53. package/dist/input-chip.cjs +1 -1
  54. package/dist/input-chip.d.ts +7 -1
  55. package/dist/input-chip.d.ts.map +1 -1
  56. package/dist/input-chip.js +131 -130
  57. package/dist/input-group.d.ts +1 -1
  58. package/dist/input-password.cjs +1 -1
  59. package/dist/input-password.d.ts +10 -0
  60. package/dist/input-password.d.ts.map +1 -1
  61. package/dist/input-password.js +108 -106
  62. package/dist/link.cjs +1 -1
  63. package/dist/link.d.ts +1 -1
  64. package/dist/link.d.ts.map +1 -1
  65. package/dist/link.js +36 -37
  66. package/dist/list.d.ts +1 -1
  67. package/dist/logo.cjs +1 -1
  68. package/dist/logo.d.ts +6 -1
  69. package/dist/logo.d.ts.map +1 -1
  70. package/dist/logo.js +25 -22
  71. package/dist/map.cjs +1 -1
  72. package/dist/map.d.ts +17 -2
  73. package/dist/map.d.ts.map +1 -1
  74. package/dist/map.js +32 -26
  75. package/dist/pagination.cjs +1 -1
  76. package/dist/pagination.d.ts +29 -3
  77. package/dist/pagination.d.ts.map +1 -1
  78. package/dist/pagination.js +26 -25
  79. package/dist/rating.cjs +1 -1
  80. package/dist/rating.d.ts +6 -0
  81. package/dist/rating.d.ts.map +1 -1
  82. package/dist/rating.js +27 -19
  83. package/dist/resizable.d.ts +1 -1
  84. package/dist/select.cjs +2 -2
  85. package/dist/select.d.ts +7 -1
  86. package/dist/select.d.ts.map +1 -1
  87. package/dist/select.js +52 -51
  88. package/dist/separator.cjs +1 -1
  89. package/dist/separator.d.ts +16 -4
  90. package/dist/separator.d.ts.map +1 -1
  91. package/dist/separator.js +38 -35
  92. package/dist/sheet.cjs +1 -1
  93. package/dist/sheet.d.ts +6 -1
  94. package/dist/sheet.d.ts.map +1 -1
  95. package/dist/sheet.js +42 -41
  96. package/dist/skeleton.cjs +1 -1
  97. package/dist/skeleton.d.ts +5 -0
  98. package/dist/skeleton.d.ts.map +1 -1
  99. package/dist/skeleton.js +13 -11
  100. package/dist/text-reveal-motion.cjs +1 -1
  101. package/dist/text-reveal-motion.d.ts +5 -0
  102. package/dist/text-reveal-motion.d.ts.map +1 -1
  103. package/dist/text-reveal-motion.js +111 -110
  104. package/dist/typography.cjs +1 -1
  105. package/dist/typography.d.ts +1 -2
  106. package/dist/typography.d.ts.map +1 -1
  107. package/dist/typography.js +49 -50
  108. package/package.json +2 -3
  109. package/src/blocks/data-table.tsx +26 -9
  110. package/src/blocks/input-list.tsx +12 -1
  111. package/src/blocks/sidebar.tsx +43 -21
  112. package/src/components/breadcrumb.tsx +43 -26
  113. package/src/components/callout.tsx +5 -4
  114. package/src/components/carousel.tsx +33 -4
  115. package/src/components/chip.tsx +22 -2
  116. package/src/components/combobox.tsx +18 -3
  117. package/src/components/command.tsx +7 -1
  118. package/src/components/date-picker.tsx +17 -3
  119. package/src/components/dialog.tsx +17 -4
  120. package/src/components/drawer.tsx +2 -2
  121. package/src/components/global-layout.tsx +15 -2
  122. package/src/components/input-chip.tsx +12 -1
  123. package/src/components/input-password.tsx +73 -49
  124. package/src/components/link.tsx +29 -17
  125. package/src/components/logo.tsx +10 -2
  126. package/src/components/map.tsx +23 -0
  127. package/src/components/pagination.tsx +44 -11
  128. package/src/components/rating.tsx +20 -2
  129. package/src/components/select.tsx +9 -1
  130. package/src/components/separator.tsx +40 -25
  131. package/src/components/sheet.tsx +28 -20
  132. package/src/components/skeleton.tsx +13 -2
  133. package/src/components/text-reveal-motion.tsx +7 -1
  134. package/src/components/typography.tsx +6 -7
@@ -15,14 +15,14 @@ function R(e, n, l) {
15
15
  m.useEffect(() => {
16
16
  r.current = o;
17
17
  });
18
- const c = e !== void 0, d = m.useCallback(
18
+ const d = e !== void 0, c = m.useCallback(
19
19
  (s) => {
20
20
  const u = typeof s == "function" ? s(r.current) : s;
21
- c || i(u), l?.(u);
21
+ d || i(u), l?.(u);
22
22
  },
23
- [c, l]
23
+ [d, l]
24
24
  );
25
- return [o, d];
25
+ return [o, c];
26
26
  }
27
27
  function Qe(e) {
28
28
  const {
@@ -32,8 +32,8 @@ function Qe(e) {
32
32
  enableGlobalFiltering: i = !1,
33
33
  enableRowSelection: o = !1,
34
34
  enablePagination: r = !1,
35
- pageSize: c = 10,
36
- manualSorting: d = !1,
35
+ pageSize: d = 10,
36
+ manualSorting: c = !1,
37
37
  manualFiltering: s = !1,
38
38
  manualPagination: u = !1,
39
39
  rowCount: p,
@@ -53,7 +53,7 @@ function Qe(e) {
53
53
  onExpandedChange: q
54
54
  } = e, [J, K] = R(
55
55
  v,
56
- { pageIndex: 0, pageSize: c },
56
+ { pageIndex: 0, pageSize: d },
57
57
  k
58
58
  ), [O, Q] = R(
59
59
  b,
@@ -87,11 +87,11 @@ function Qe(e) {
87
87
  ...g != null && { pageCount: g }
88
88
  },
89
89
  ...t && {
90
- ...!d && {
90
+ ...!c && {
91
91
  getSortedRowModel: ie()
92
92
  },
93
93
  onSortingChange: Q,
94
- ...d && { manualSorting: !0 }
94
+ ...c && { manualSorting: !0 }
95
95
  },
96
96
  ...i && {
97
97
  ...!s && {
@@ -127,8 +127,8 @@ function ye({
127
127
  isLoading: i = !1,
128
128
  skeletonRowCount: o,
129
129
  noResultsMessage: r = "No results.",
130
- stickyHeader: c = !1,
131
- className: d,
130
+ stickyHeader: d = !1,
131
+ className: c,
132
132
  footer: s
133
133
  }) {
134
134
  const u = e.getVisibleLeafColumns().length, p = o ?? e.getState().pagination.pageSize ?? 10;
@@ -136,13 +136,13 @@ function ye({
136
136
  "div",
137
137
  {
138
138
  "aria-busy": i || void 0,
139
- className: h("border-border overflow-auto rounded-md border", d),
139
+ className: h("border-border overflow-auto rounded-md border", c),
140
140
  "data-hook": n,
141
141
  "data-slot": "data-table-view",
142
142
  "data-tracking-el": l,
143
143
  "data-tracking-label": t,
144
144
  children: /* @__PURE__ */ S(j, { dataHook: `${n}-table`, children: [
145
- /* @__PURE__ */ a(G, { stickyHeader: c, table: e }),
145
+ /* @__PURE__ */ a(G, { stickyHeader: d, table: e }),
146
146
  /* @__PURE__ */ a(E, { children: i ? /* @__PURE__ */ S(T, { children: [
147
147
  /* @__PURE__ */ a(
148
148
  B,
@@ -202,8 +202,8 @@ function Ne({
202
202
  isLoading: i = !1,
203
203
  skeletonRowCount: o,
204
204
  noResultsMessage: r = "No results.",
205
- stickyHeader: c = !1,
206
- className: d,
205
+ stickyHeader: d = !1,
206
+ className: c,
207
207
  footer: s,
208
208
  height: u,
209
209
  estimateSize: p = 48,
@@ -220,14 +220,14 @@ function Ne({
220
220
  {
221
221
  ref: P,
222
222
  "aria-busy": i || void 0,
223
- className: h("border-border overflow-auto rounded-md border", d),
223
+ className: h("border-border overflow-auto rounded-md border", c),
224
224
  "data-hook": n,
225
225
  "data-slot": "data-table-view",
226
226
  "data-tracking-el": l,
227
227
  "data-tracking-label": t,
228
228
  style: u != null ? { height: u } : void 0,
229
229
  children: /* @__PURE__ */ S(j, { dataHook: `${n}-table`, children: [
230
- /* @__PURE__ */ a(G, { stickyHeader: c, table: e }),
230
+ /* @__PURE__ */ a(G, { stickyHeader: d, table: e }),
231
231
  /* @__PURE__ */ a(E, { children: i ? /* @__PURE__ */ S(T, { children: [
232
232
  /* @__PURE__ */ a(
233
233
  B,
@@ -258,7 +258,8 @@ function De({
258
258
  dataHook: t,
259
259
  trackingEl: i,
260
260
  trackingLabel: o,
261
- align: r = "left"
261
+ align: r = "left",
262
+ getSortLabel: d
262
263
  }) {
263
264
  if (!e.getCanSort())
264
265
  return /* @__PURE__ */ a(
@@ -277,7 +278,7 @@ function De({
277
278
  children: n
278
279
  }
279
280
  );
280
- const c = e.getIsSorted(), d = c === "desc" ? `Sort by ${n}, currently descending` : c === "asc" ? `Sort by ${n}, currently ascending` : `Sort by ${n}`;
281
+ const c = e.getIsSorted(), s = d ? d(n, c) : c === "desc" ? `Sort by ${n}, currently descending` : c === "asc" ? `Sort by ${n}, currently ascending` : `Sort by ${n}`;
281
282
  return /* @__PURE__ */ a(
282
283
  "div",
283
284
  {
@@ -293,7 +294,7 @@ function De({
293
294
  children: /* @__PURE__ */ S(
294
295
  H,
295
296
  {
296
- "aria-label": d,
297
+ "aria-label": s,
297
298
  className: "text-muted-foreground h-auto p-0 text-sm font-medium",
298
299
  dataHook: t || `column-header-${e.id}`,
299
300
  size: "sm",
@@ -318,34 +319,35 @@ function De({
318
319
  De.displayName = "DataTableColumnHeader";
319
320
  function ze({
320
321
  table: e,
321
- ariaLabel: n = "Search table",
322
- placeholder: l = "Search...",
323
- ...t
322
+ ariaLabel: n,
323
+ placeholder: l,
324
+ clearSearchAriaLabel: t,
325
+ ...i
324
326
  }) {
325
- const i = e.getState().globalFilter ?? "", o = (r) => {
326
- e.setGlobalFilter(r);
327
+ const o = e.getState().globalFilter ?? "", r = (d) => {
328
+ e.setGlobalFilter(d);
327
329
  };
328
- return /* @__PURE__ */ S(he, { "data-slot": "data-table-search", ...t, children: [
330
+ return /* @__PURE__ */ S(he, { "data-slot": "data-table-search", ...i, children: [
329
331
  /* @__PURE__ */ a(M, { className: "pl-3", children: /* @__PURE__ */ a(me, {}) }),
330
332
  /* @__PURE__ */ a(
331
333
  fe,
332
334
  {
333
- "aria-label": n,
334
- placeholder: l,
335
+ "aria-label": n ?? "Search table",
336
+ placeholder: l ?? "Search...",
335
337
  type: "text",
336
- value: i,
337
- onChange: (r) => o(r.target.value)
338
+ value: o,
339
+ onChange: (d) => r(d.target.value)
338
340
  }
339
341
  ),
340
- i && /* @__PURE__ */ a(M, { className: "pr-1", children: /* @__PURE__ */ a(
342
+ o && /* @__PURE__ */ a(M, { className: "pr-1", children: /* @__PURE__ */ a(
341
343
  H,
342
344
  {
343
- "aria-label": "Clear search",
345
+ "aria-label": t ?? "Clear search",
344
346
  className: "h-auto p-1",
345
347
  "data-slot": "data-table-search-clear",
346
- dataHook: `${t.dataHook}-clear`,
348
+ dataHook: `${i.dataHook}-clear`,
347
349
  variant: "ghost",
348
- onClick: () => o(""),
350
+ onClick: () => r(""),
349
351
  children: /* @__PURE__ */ a(pe, { size: 14 })
350
352
  }
351
353
  ) })
@@ -353,7 +355,7 @@ function ze({
353
355
  }
354
356
  ze.displayName = "DataTableSearch";
355
357
  function Ie(e) {
356
- const { pageIndex: n, pageSize: l } = e.getState().pagination, t = e.getRowCount(), i = e.getPageCount(), o = e.getCanPreviousPage(), r = e.getCanNextPage(), c = n + 1, d = t === 0 ? 0 : n * l + 1, s = Math.min(c * l, t), u = m.useCallback(
358
+ const { pageIndex: n, pageSize: l } = e.getState().pagination, t = e.getRowCount(), i = e.getPageCount(), o = e.getCanPreviousPage(), r = e.getCanNextPage(), d = n + 1, c = t === 0 ? 0 : n * l + 1, s = Math.min(d * l, t), u = m.useCallback(
357
359
  (w) => e.setPageIndex(w - 1),
358
360
  [e]
359
361
  ), p = m.useCallback(() => e.nextPage(), [e]), g = m.useCallback(() => e.previousPage(), [e]), f = m.useCallback(
@@ -366,9 +368,9 @@ function Ie(e) {
366
368
  pageSize: l,
367
369
  totalRows: t,
368
370
  totalPages: i,
369
- startRow: d,
371
+ startRow: c,
370
372
  endRow: s,
371
- currentPage: c,
373
+ currentPage: d,
372
374
  canPrev: o,
373
375
  canNext: r,
374
376
  goToPage: u,
@@ -381,9 +383,9 @@ function Ie(e) {
381
383
  l,
382
384
  t,
383
385
  i,
384
- d,
385
- s,
386
386
  c,
387
+ s,
388
+ d,
387
389
  o,
388
390
  r,
389
391
  u,
@@ -406,13 +408,13 @@ function $e({
406
408
  renderText: e,
407
409
  className: n
408
410
  }) {
409
- const { info: l } = U(), { startRow: t, endRow: i, totalRows: o, pageIndex: r, pageSize: c } = l, d = e ? e({ startRow: t, endRow: i, totalRows: o, pageIndex: r, pageSize: c }) : o === 0 ? null : `${t}-${i} of ${o}`;
410
- return d == null ? null : /* @__PURE__ */ a(
411
+ const { info: l } = U(), { startRow: t, endRow: i, totalRows: o, pageIndex: r, pageSize: d } = l, c = e ? e({ startRow: t, endRow: i, totalRows: o, pageIndex: r, pageSize: d }) : o === 0 ? null : `${t}-${i} of ${o}`;
412
+ return c == null ? null : /* @__PURE__ */ a(
411
413
  "span",
412
414
  {
413
415
  className: h("text-muted-foreground text-sm", n),
414
416
  "data-slot": "data-table-pagination-row-count",
415
- children: d
417
+ children: c
416
418
  }
417
419
  );
418
420
  }
@@ -466,8 +468,8 @@ function Fe({
466
468
  trackingEl: i,
467
469
  trackingLabel: o,
468
470
  className: r,
469
- ariaLabel: c = "Table pagination",
470
- children: d
471
+ ariaLabel: d = "Table pagination",
472
+ children: c
471
473
  }) {
472
474
  const s = Ie(e), u = m.useMemo(
473
475
  () => ({ info: s }),
@@ -478,13 +480,13 @@ function Fe({
478
480
  "data-tracking-el": i,
479
481
  "data-tracking-label": o
480
482
  };
481
- if (d)
483
+ if (c)
482
484
  return /* @__PURE__ */ a(F.Provider, { value: u, children: /* @__PURE__ */ a(
483
485
  "div",
484
486
  {
485
487
  className: h("flex w-full items-center gap-4", r),
486
488
  ...p,
487
- children: d
489
+ children: c
488
490
  }
489
491
  ) });
490
492
  const g = !l || t === null ? null : t ? t({
@@ -508,7 +510,7 @@ function Fe({
508
510
  /* @__PURE__ */ a(
509
511
  _,
510
512
  {
511
- ariaLabel: c,
513
+ ariaLabel: d,
512
514
  dataHook: `${n}-nav`
513
515
  }
514
516
  )
@@ -521,17 +523,18 @@ function Me({
521
523
  table: e,
522
524
  dataHook: n,
523
525
  trackingEl: l,
524
- trackingLabel: t
526
+ trackingLabel: t,
527
+ selectAllAriaLabel: i
525
528
  }) {
526
529
  return /* @__PURE__ */ a(
527
530
  V,
528
531
  {
529
- "aria-label": "Select all",
532
+ "aria-label": i ?? "Select all",
530
533
  checked: e.getIsAllPageRowsSelected() || e.getIsSomePageRowsSelected() && "indeterminate",
531
534
  dataHook: n || "select-all-checkbox",
532
535
  trackingEl: l,
533
536
  trackingLabel: t,
534
- onCheckedChange: (i) => e.toggleAllPageRowsSelected(!!i)
537
+ onCheckedChange: (o) => e.toggleAllPageRowsSelected(!!o)
535
538
  }
536
539
  );
537
540
  }
@@ -540,18 +543,19 @@ function Ae({
540
543
  row: e,
541
544
  dataHook: n,
542
545
  trackingEl: l,
543
- trackingLabel: t
546
+ trackingLabel: t,
547
+ selectRowAriaLabel: i
544
548
  }) {
545
549
  return /* @__PURE__ */ a(
546
550
  V,
547
551
  {
548
- "aria-label": "Select row",
552
+ "aria-label": i ?? "Select row",
549
553
  checked: e.getIsSelected(),
550
554
  dataHook: n || `select-row-${e.id}`,
551
555
  disabled: !e.getCanSelect(),
552
556
  trackingEl: l,
553
557
  trackingLabel: t,
554
- onCheckedChange: (i) => e.toggleSelected(!!i)
558
+ onCheckedChange: (o) => e.toggleSelected(!!o)
555
559
  }
556
560
  );
557
561
  }
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),_=require("react"),k=require("framer-motion"),K=require("@brightlocal/icons"),x=require("@brightlocal/ui-components/lib/utils"),O=require("../button.cjs"),$=require("../input.cjs"),g=require("../list.cjs");function B(t){const s=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const r in t)if(r!=="default"){const i=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(s,r,i.get?i:{enumerable:!0,get:()=>t[r]})}}return s.default=t,Object.freeze(s)}const a=B(_),A=a.createContext(null);function y(){const t=a.useContext(A);if(!t)throw new Error("InputList components must be used within an <InputList>");return t}function w({value:t,onValueChange:s,children:r,className:i,dataHook:u,trackingEl:c,trackingLabel:I}){const[f,d]=a.useState(""),l=a.useRef(t.length),o=a.useRef(t.length),[b,h]=a.useState(()=>t.map((m,n)=>n)),[N,q]=a.useState(0);a.useEffect(()=>{const m=l.current;l.current=t.length,t.length>m&&d(""),h(n=>n.length===t.length?n:t.length>n.length?[...n,...Array.from({length:t.length-n.length},()=>o.current++)]:n.slice(0,t.length))},[t,N]);const j=a.useCallback(m=>{const n=m.map(p=>p.trim()).filter(Boolean);n.length&&(h(p=>[...p,...n.map(()=>o.current++)]),s([...t,...n]),q(p=>p+1))},[t,s]),L=a.useCallback(m=>{h(n=>n.filter((p,S)=>S!==m)),s(t.filter((n,p)=>p!==m))},[t,s]),P=a.useMemo(()=>({value:t,inputValue:f,setInputValue:d,addItems:j,removeItem:L,stableKeys:b}),[t,f,j,L,b]);return e.jsx(A.Provider,{value:P,children:e.jsx("div",{className:x.cn("flex flex-col gap-4",i),"data-hook":u,"data-slot":"input-list","data-tracking-el":c,"data-tracking-label":I,children:r})})}w.displayName="InputList";function C({dataHook:t="input-list",loading:s=!1,skeletonCount:r=5,disabled:i=!1,className:u}){const{value:c,removeItem:I,stableKeys:f}=y();return s?e.jsx("ul",{className:x.cn("flex flex-col gap-2",u),"data-slot":"input-list-skeleton",children:Array.from({length:r}).map((d,l)=>e.jsx(g.Item,{variant:"loading"},l))}):e.jsx("ul",{className:x.cn("flex flex-col gap-2",u),"data-hook":`${t}-list`,"data-slot":"list",children:e.jsx(k.AnimatePresence,{initial:!1,mode:"popLayout",children:c.map((d,l)=>e.jsx(k.motion.li,{layout:!0,animate:{opacity:1,scale:1},"data-hook":`${t}-item-${l}`,exit:{opacity:0,scale:.8,transition:{opacity:{duration:.15},scale:{duration:.12}}},initial:{opacity:0,scale:.8},transition:{opacity:{duration:.15},scale:{duration:.15},layout:{type:"spring",stiffness:500,damping:35}},children:e.jsx(g.Item,{asChild:!0,variant:"filled",children:e.jsxs("div",{children:[e.jsx(g.ItemContent,{children:e.jsx(g.ItemTitle,{children:d})}),e.jsx(g.ItemActions,{children:e.jsx("button",{"aria-label":`Remove ${d}`,className:x.cn("inline-flex size-9 cursor-pointer items-center justify-center rounded-full","text-muted-foreground","focus-visible:shadow-default outline-none","transition-colors duration-150 ease-in-out","disabled:pointer-events-none disabled:opacity-50"),"data-hook":`${t}-remove-${l}`,disabled:i,type:"button",onClick:()=>I(l),children:e.jsx(K.X,{})})})]})})},f[l]))})})}C.displayName="InputListItems";const R=a.forwardRef(({dataHook:t,error:s=!1,className:r,...i},u)=>{const{inputValue:c,setInputValue:I,addItems:f}=y(),d=o=>{o.key==="Enter"&&(o.preventDefault(),f([c])),i.onKeyDown?.(o)},l=o=>{const h=o.clipboardData.getData("text").split(`
2
- `);h.length>1&&(o.preventDefault(),f(h)),i.onPaste?.(o)};return e.jsx($.Input,{ref:u,...i,className:x.cn("flex-1",r),dataHook:t,error:s,value:c,onChange:o=>{I(o.target.value),i.onChange?.(o)},onKeyDown:d,onPaste:l})});R.displayName="InputListInput";const D=a.forwardRef(({dataHook:t,children:s,...r},i)=>{const{inputValue:u,addItems:c}=y();return e.jsx(O.Button,{ref:i,...r,dataHook:t,onClick:()=>c([u]),children:s})});D.displayName="InputListAddButton";exports.InputList=w;exports.InputListAddButton=D;exports.InputListInput=R;exports.InputListItems=C;exports.useInputListContext=y;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),_=require("react"),k=require("framer-motion"),K=require("@brightlocal/icons"),x=require("@brightlocal/ui-components/lib/utils"),O=require("../button.cjs"),$=require("../input.cjs"),g=require("../list.cjs");function B(t){const i=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const r in t)if(r!=="default"){const o=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(i,r,o.get?o:{enumerable:!0,get:()=>t[r]})}}return i.default=t,Object.freeze(i)}const a=B(_),w=a.createContext(null);function y(){const t=a.useContext(w);if(!t)throw new Error("InputList components must be used within an <InputList>");return t}function A({value:t,onValueChange:i,children:r,className:o,dataHook:u,trackingEl:l,trackingLabel:I}){const[p,m]=a.useState(""),c=a.useRef(t.length),e=a.useRef(t.length),[j,h]=a.useState(()=>t.map((f,s)=>s)),[N,q]=a.useState(0);a.useEffect(()=>{const f=c.current;c.current=t.length,t.length>f&&m(""),h(s=>s.length===t.length?s:t.length>s.length?[...s,...Array.from({length:t.length-s.length},()=>e.current++)]:s.slice(0,t.length))},[t,N]);const b=a.useCallback(f=>{const s=f.map(d=>d.trim()).filter(Boolean);s.length&&(h(d=>[...d,...s.map(()=>e.current++)]),i([...t,...s]),q(d=>d+1))},[t,i]),L=a.useCallback(f=>{h(s=>s.filter((d,S)=>S!==f)),i(t.filter((s,d)=>d!==f))},[t,i]),P=a.useMemo(()=>({value:t,inputValue:p,setInputValue:m,addItems:b,removeItem:L,stableKeys:j}),[t,p,b,L,j]);return n.jsx(w.Provider,{value:P,children:n.jsx("div",{className:x.cn("flex flex-col gap-4",o),"data-hook":u,"data-slot":"input-list","data-tracking-el":l,"data-tracking-label":I,children:r})})}A.displayName="InputList";function C({dataHook:t="input-list",loading:i=!1,skeletonCount:r=5,disabled:o=!1,removeAriaLabel:u,className:l}){const{value:I,removeItem:p,stableKeys:m}=y();return i?n.jsx("ul",{className:x.cn("flex flex-col gap-2",l),"data-slot":"input-list-skeleton",children:Array.from({length:r}).map((c,e)=>n.jsx(g.Item,{variant:"loading"},e))}):n.jsx("ul",{className:x.cn("flex flex-col gap-2",l),"data-hook":`${t}-list`,"data-slot":"list",children:n.jsx(k.AnimatePresence,{initial:!1,mode:"popLayout",children:I.map((c,e)=>n.jsx(k.motion.li,{layout:!0,animate:{opacity:1,scale:1},"data-hook":`${t}-item-${e}`,exit:{opacity:0,scale:.8,transition:{opacity:{duration:.15},scale:{duration:.12}}},initial:{opacity:0,scale:.8},transition:{opacity:{duration:.15},scale:{duration:.15},layout:{type:"spring",stiffness:500,damping:35}},children:n.jsx(g.Item,{asChild:!0,variant:"filled",children:n.jsxs("div",{children:[n.jsx(g.ItemContent,{children:n.jsx(g.ItemTitle,{children:c})}),n.jsx(g.ItemActions,{children:n.jsx("button",{"aria-label":u?u.replace("{item}",c):`Remove ${c}`,className:x.cn("inline-flex size-9 cursor-pointer items-center justify-center rounded-full","text-muted-foreground","focus-visible:shadow-default outline-none","transition-colors duration-150 ease-in-out","disabled:pointer-events-none disabled:opacity-50"),"data-hook":`${t}-remove-${e}`,disabled:o,type:"button",onClick:()=>p(e),children:n.jsx(K.X,{})})})]})})},m[e]))})})}C.displayName="InputListItems";const R=a.forwardRef(({dataHook:t,error:i=!1,className:r,...o},u)=>{const{inputValue:l,setInputValue:I,addItems:p}=y(),m=e=>{e.key==="Enter"&&(e.preventDefault(),p([l])),o.onKeyDown?.(e)},c=e=>{const h=e.clipboardData.getData("text").split(`
2
+ `);h.length>1&&(e.preventDefault(),p(h)),o.onPaste?.(e)};return n.jsx($.Input,{ref:u,...o,className:x.cn("flex-1",r),dataHook:t,error:i,value:l,onChange:e=>{I(e.target.value),o.onChange?.(e)},onKeyDown:m,onPaste:c})});R.displayName="InputListInput";const D=a.forwardRef(({dataHook:t,children:i,...r},o)=>{const{inputValue:u,addItems:l}=y();return n.jsx(O.Button,{ref:o,...r,dataHook:t,onClick:()=>l([u]),children:i})});D.displayName="InputListAddButton";exports.InputList=A;exports.InputListAddButton=D;exports.InputListInput=R;exports.InputListItems=C;exports.useInputListContext=y;
@@ -82,6 +82,12 @@ export interface InputListItemsProps {
82
82
  * Disables all remove buttons in the list.
83
83
  */
84
84
  disabled?: boolean;
85
+ /**
86
+ * Accessible label for each item's remove button.
87
+ * Supports `{item}` placeholder for interpolation.
88
+ * @default "Remove {item}"
89
+ */
90
+ removeAriaLabel?: string;
85
91
  /**
86
92
  * Additional CSS classes applied to the list element.
87
93
  */
@@ -99,7 +105,7 @@ export interface InputListItemsProps {
99
105
  * </InputList>
100
106
  * ```
101
107
  */
102
- declare function InputListItems({ dataHook, loading, skeletonCount, disabled, className, }: InputListItemsProps): import("react/jsx-runtime").JSX.Element;
108
+ declare function InputListItems({ dataHook, loading, skeletonCount, disabled, removeAriaLabel, className, }: InputListItemsProps): import("react/jsx-runtime").JSX.Element;
103
109
  declare namespace InputListItems {
104
110
  var displayName: string;
105
111
  }
@@ -1 +1 @@
1
- {"version":3,"file":"input-list.d.ts","sourceRoot":"","sources":["../../src/blocks/input-list.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,OAAO,EAAU,KAAK,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAQhE,UAAU,qBAAqB;IAC7B,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;IACpC,UAAU,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACpC,+CAA+C;IAC/C,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB;AAMD,iBAAS,mBAAmB,0BAM3B;AAMD;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC7B;;OAEG;IACH,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB;;OAEG;IACH,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;IACzC;;OAEG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;;;;;;;;;;GAWG;AACH,iBAAS,SAAS,CAAC,EACjB,KAAK,EACL,aAAa,EACb,QAAQ,EACR,SAAS,EACT,QAAQ,EACR,UAAU,EACV,aAAa,GACd,EAAE,cAAc,2CA2FhB;kBAnGQ,SAAS;;;AA2GlB;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;;;;GAWG;AACH,iBAAS,cAAc,CAAC,EACtB,QAAuB,EACvB,OAAe,EACf,aAAiB,EACjB,QAAgB,EAChB,SAAS,GACV,EAAE,mBAAmB,2CA8ErB;kBApFQ,cAAc;;;AA4FvB;;;;;;GAMG;AACH,MAAM,WAAW,mBAAoB,SAAQ,IAAI,CAC/C,KAAK,CAAC,wBAAwB,CAAC,OAAO,CAAC,EACvC,OAAO,GAAG,MAAM,CACjB;IACC;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED;;;;;;;;GAQG;AACH,QAAA,MAAM,cAAc,8FAuCnB,CAAC;AAOF;;;GAGG;AACH,MAAM,MAAM,uBAAuB,GAAG,IAAI,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC;AAEnE;;;;;;;;GAQG;AACH,QAAA,MAAM,kBAAkB,gHAgBtB,CAAC;AAOH,OAAO,EACL,SAAS,EACT,cAAc,EACd,cAAc,EACd,kBAAkB,EAClB,mBAAmB,GACpB,CAAC"}
1
+ {"version":3,"file":"input-list.d.ts","sourceRoot":"","sources":["../../src/blocks/input-list.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,OAAO,EAAU,KAAK,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAQhE,UAAU,qBAAqB;IAC7B,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;IACpC,UAAU,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACpC,+CAA+C;IAC/C,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB;AAMD,iBAAS,mBAAmB,0BAM3B;AAMD;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC7B;;OAEG;IACH,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB;;OAEG;IACH,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;IACzC;;OAEG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;;;;;;;;;;GAWG;AACH,iBAAS,SAAS,CAAC,EACjB,KAAK,EACL,aAAa,EACb,QAAQ,EACR,SAAS,EACT,QAAQ,EACR,UAAU,EACV,aAAa,GACd,EAAE,cAAc,2CA2FhB;kBAnGQ,SAAS;;;AA2GlB;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;;OAIG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;;;;GAWG;AACH,iBAAS,cAAc,CAAC,EACtB,QAAuB,EACvB,OAAe,EACf,aAAiB,EACjB,QAAgB,EAChB,eAAe,EACf,SAAS,GACV,EAAE,mBAAmB,2CAkFrB;kBAzFQ,cAAc;;;AAiGvB;;;;;;GAMG;AACH,MAAM,WAAW,mBAAoB,SAAQ,IAAI,CAC/C,KAAK,CAAC,wBAAwB,CAAC,OAAO,CAAC,EACvC,OAAO,GAAG,MAAM,CACjB;IACC;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED;;;;;;;;GAQG;AACH,QAAA,MAAM,cAAc,8FAuCnB,CAAC;AAOF;;;GAGG;AACH,MAAM,MAAM,uBAAuB,GAAG,IAAI,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC;AAEnE;;;;;;;;GAQG;AACH,QAAA,MAAM,kBAAkB,gHAgBtB,CAAC;AAOH,OAAO,EACL,SAAS,EACT,cAAc,EACd,cAAc,EACd,kBAAkB,EAClB,mBAAmB,GACpB,CAAC"}
@@ -1,107 +1,108 @@
1
- import { jsx as n, jsxs as D } from "react/jsx-runtime";
2
- import * as i from "react";
1
+ import { jsx as o, jsxs as D } from "react/jsx-runtime";
2
+ import * as s from "react";
3
3
  import { AnimatePresence as K, motion as $ } from "framer-motion";
4
4
  import { X as P } from "@brightlocal/icons";
5
5
  import { cn as g } from "@brightlocal/ui-components/lib/utils";
6
6
  import { Button as B } from "../button.js";
7
7
  import { Input as S } from "../input.js";
8
8
  import { Item as k, ItemContent as V, ItemTitle as _, ItemActions as j } from "../list.js";
9
- const A = i.createContext(
9
+ const w = s.createContext(
10
10
  null
11
11
  );
12
12
  function x() {
13
- const t = i.useContext(A);
13
+ const t = s.useContext(w);
14
14
  if (!t)
15
15
  throw new Error("InputList components must be used within an <InputList>");
16
16
  return t;
17
17
  }
18
18
  function E({
19
19
  value: t,
20
- onValueChange: a,
21
- children: m,
22
- className: r,
23
- dataHook: l,
24
- trackingEl: c,
20
+ onValueChange: i,
21
+ children: d,
22
+ className: a,
23
+ dataHook: c,
24
+ trackingEl: l,
25
25
  trackingLabel: I
26
26
  }) {
27
- const [p, u] = i.useState(""), s = i.useRef(t.length), o = i.useRef(t.length), [y, h] = i.useState(
28
- () => t.map((f, e) => e)
29
- ), [w, C] = i.useState(0);
30
- i.useEffect(() => {
31
- const f = s.current;
32
- s.current = t.length, t.length > f && u(""), h((e) => e.length === t.length ? e : t.length > e.length ? [
33
- ...e,
27
+ const [p, f] = s.useState(""), r = s.useRef(t.length), e = s.useRef(t.length), [y, h] = s.useState(
28
+ () => t.map((m, n) => n)
29
+ ), [A, C] = s.useState(0);
30
+ s.useEffect(() => {
31
+ const m = r.current;
32
+ r.current = t.length, t.length > m && f(""), h((n) => n.length === t.length ? n : t.length > n.length ? [
33
+ ...n,
34
34
  ...Array.from(
35
- { length: t.length - e.length },
36
- () => o.current++
35
+ { length: t.length - n.length },
36
+ () => e.current++
37
37
  )
38
- ] : e.slice(0, t.length));
39
- }, [t, w]);
40
- const L = i.useCallback(
41
- (f) => {
42
- const e = f.map((d) => d.trim()).filter(Boolean);
43
- e.length && (h((d) => [
44
- ...d,
45
- ...e.map(() => o.current++)
46
- ]), a([...t, ...e]), C((d) => d + 1));
38
+ ] : n.slice(0, t.length));
39
+ }, [t, A]);
40
+ const L = s.useCallback(
41
+ (m) => {
42
+ const n = m.map((u) => u.trim()).filter(Boolean);
43
+ n.length && (h((u) => [
44
+ ...u,
45
+ ...n.map(() => e.current++)
46
+ ]), i([...t, ...n]), C((u) => u + 1));
47
47
  },
48
- [t, a]
49
- ), b = i.useCallback(
50
- (f) => {
51
- h((e) => e.filter((d, R) => R !== f)), a(t.filter((e, d) => d !== f));
48
+ [t, i]
49
+ ), b = s.useCallback(
50
+ (m) => {
51
+ h((n) => n.filter((u, R) => R !== m)), i(t.filter((n, u) => u !== m));
52
52
  },
53
- [t, a]
54
- ), N = i.useMemo(
53
+ [t, i]
54
+ ), N = s.useMemo(
55
55
  () => ({
56
56
  value: t,
57
57
  inputValue: p,
58
- setInputValue: u,
58
+ setInputValue: f,
59
59
  addItems: L,
60
60
  removeItem: b,
61
61
  stableKeys: y
62
62
  }),
63
63
  [t, p, L, b, y]
64
64
  );
65
- return /* @__PURE__ */ n(A.Provider, { value: N, children: /* @__PURE__ */ n(
65
+ return /* @__PURE__ */ o(w.Provider, { value: N, children: /* @__PURE__ */ o(
66
66
  "div",
67
67
  {
68
- className: g("flex flex-col gap-4", r),
69
- "data-hook": l,
68
+ className: g("flex flex-col gap-4", a),
69
+ "data-hook": c,
70
70
  "data-slot": "input-list",
71
- "data-tracking-el": c,
71
+ "data-tracking-el": l,
72
72
  "data-tracking-label": I,
73
- children: m
73
+ children: d
74
74
  }
75
75
  ) });
76
76
  }
77
77
  E.displayName = "InputList";
78
78
  function z({
79
79
  dataHook: t = "input-list",
80
- loading: a = !1,
81
- skeletonCount: m = 5,
82
- disabled: r = !1,
80
+ loading: i = !1,
81
+ skeletonCount: d = 5,
82
+ disabled: a = !1,
83
+ removeAriaLabel: c,
83
84
  className: l
84
85
  }) {
85
- const { value: c, removeItem: I, stableKeys: p } = x();
86
- return a ? /* @__PURE__ */ n(
86
+ const { value: I, removeItem: p, stableKeys: f } = x();
87
+ return i ? /* @__PURE__ */ o(
87
88
  "ul",
88
89
  {
89
90
  className: g("flex flex-col gap-2", l),
90
91
  "data-slot": "input-list-skeleton",
91
- children: Array.from({ length: m }).map((u, s) => /* @__PURE__ */ n(k, { variant: "loading" }, s))
92
+ children: Array.from({ length: d }).map((r, e) => /* @__PURE__ */ o(k, { variant: "loading" }, e))
92
93
  }
93
- ) : /* @__PURE__ */ n(
94
+ ) : /* @__PURE__ */ o(
94
95
  "ul",
95
96
  {
96
97
  className: g("flex flex-col gap-2", l),
97
98
  "data-hook": `${t}-list`,
98
99
  "data-slot": "list",
99
- children: /* @__PURE__ */ n(K, { initial: !1, mode: "popLayout", children: c.map((u, s) => /* @__PURE__ */ n(
100
+ children: /* @__PURE__ */ o(K, { initial: !1, mode: "popLayout", children: I.map((r, e) => /* @__PURE__ */ o(
100
101
  $.li,
101
102
  {
102
103
  layout: !0,
103
104
  animate: { opacity: 1, scale: 1 },
104
- "data-hook": `${t}-item-${s}`,
105
+ "data-hook": `${t}-item-${e}`,
105
106
  exit: {
106
107
  opacity: 0,
107
108
  scale: 0.8,
@@ -120,12 +121,12 @@ function z({
120
121
  damping: 35
121
122
  }
122
123
  },
123
- children: /* @__PURE__ */ n(k, { asChild: !0, variant: "filled", children: /* @__PURE__ */ D("div", { children: [
124
- /* @__PURE__ */ n(V, { children: /* @__PURE__ */ n(_, { children: u }) }),
125
- /* @__PURE__ */ n(j, { children: /* @__PURE__ */ n(
124
+ children: /* @__PURE__ */ o(k, { asChild: !0, variant: "filled", children: /* @__PURE__ */ D("div", { children: [
125
+ /* @__PURE__ */ o(V, { children: /* @__PURE__ */ o(_, { children: r }) }),
126
+ /* @__PURE__ */ o(j, { children: /* @__PURE__ */ o(
126
127
  "button",
127
128
  {
128
- "aria-label": `Remove ${u}`,
129
+ "aria-label": c ? c.replace("{item}", r) : `Remove ${r}`,
129
130
  className: g(
130
131
  "inline-flex size-9 cursor-pointer items-center justify-center rounded-full",
131
132
  "text-muted-foreground",
@@ -133,59 +134,59 @@ function z({
133
134
  "transition-colors duration-150 ease-in-out",
134
135
  "disabled:pointer-events-none disabled:opacity-50"
135
136
  ),
136
- "data-hook": `${t}-remove-${s}`,
137
- disabled: r,
137
+ "data-hook": `${t}-remove-${e}`,
138
+ disabled: a,
138
139
  type: "button",
139
- onClick: () => I(s),
140
- children: /* @__PURE__ */ n(P, {})
140
+ onClick: () => p(e),
141
+ children: /* @__PURE__ */ o(P, {})
141
142
  }
142
143
  ) })
143
144
  ] }) })
144
145
  },
145
- p[s]
146
+ f[e]
146
147
  )) })
147
148
  }
148
149
  );
149
150
  }
150
151
  z.displayName = "InputListItems";
151
- const M = i.forwardRef(
152
- ({ dataHook: t, error: a = !1, className: m, ...r }, l) => {
153
- const { inputValue: c, setInputValue: I, addItems: p } = x(), u = (o) => {
154
- o.key === "Enter" && (o.preventDefault(), p([c])), r.onKeyDown?.(o);
155
- }, s = (o) => {
156
- const h = o.clipboardData.getData("text").split(`
152
+ const M = s.forwardRef(
153
+ ({ dataHook: t, error: i = !1, className: d, ...a }, c) => {
154
+ const { inputValue: l, setInputValue: I, addItems: p } = x(), f = (e) => {
155
+ e.key === "Enter" && (e.preventDefault(), p([l])), a.onKeyDown?.(e);
156
+ }, r = (e) => {
157
+ const h = e.clipboardData.getData("text").split(`
157
158
  `);
158
- h.length > 1 && (o.preventDefault(), p(h)), r.onPaste?.(o);
159
+ h.length > 1 && (e.preventDefault(), p(h)), a.onPaste?.(e);
159
160
  };
160
- return /* @__PURE__ */ n(
161
+ return /* @__PURE__ */ o(
161
162
  S,
162
163
  {
163
- ref: l,
164
- ...r,
165
- className: g("flex-1", m),
164
+ ref: c,
165
+ ...a,
166
+ className: g("flex-1", d),
166
167
  dataHook: t,
167
- error: a,
168
- value: c,
169
- onChange: (o) => {
170
- I(o.target.value), r.onChange?.(o);
168
+ error: i,
169
+ value: l,
170
+ onChange: (e) => {
171
+ I(e.target.value), a.onChange?.(e);
171
172
  },
172
- onKeyDown: u,
173
- onPaste: s
173
+ onKeyDown: f,
174
+ onPaste: r
174
175
  }
175
176
  );
176
177
  }
177
178
  );
178
179
  M.displayName = "InputListInput";
179
- const T = i.forwardRef(({ dataHook: t, children: a, ...m }, r) => {
180
- const { inputValue: l, addItems: c } = x();
181
- return /* @__PURE__ */ n(
180
+ const T = s.forwardRef(({ dataHook: t, children: i, ...d }, a) => {
181
+ const { inputValue: c, addItems: l } = x();
182
+ return /* @__PURE__ */ o(
182
183
  B,
183
184
  {
184
- ref: r,
185
- ...m,
185
+ ref: a,
186
+ ...d,
186
187
  dataHook: t,
187
- onClick: () => c([l]),
188
- children: a
188
+ onClick: () => l([c]),
189
+ children: i
189
190
  }
190
191
  );
191
192
  });