@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
package/dist/combobox.js CHANGED
@@ -20,93 +20,93 @@ function Fe({
20
20
  onValueChange: r,
21
21
  open: n,
22
22
  onOpenChange: o,
23
- shouldFilter: i = !0,
23
+ shouldFilter: l = !0,
24
24
  disabled: c = !1,
25
25
  itemToStringValue: s,
26
- children: p
26
+ children: x
27
27
  }) {
28
- const [d, w] = t.useState(""), [D, h] = t.useState(!1), [f, y] = t.useState(
28
+ const [m, C] = t.useState(""), [S, v] = t.useState(!1), [d, y] = t.useState(
29
29
  () => /* @__PURE__ */ new Map()
30
- ), [v, C] = t.useState(""), [P, k] = t.useState(void 0), S = e !== void 0, I = n !== void 0, R = S ? e : d, L = I ? n : D, M = t.useCallback(
31
- (x) => {
32
- x || C(""), I || h(x), o?.(x);
30
+ ), [I, p] = t.useState(""), [V, D] = t.useState(void 0), k = e !== void 0, w = n !== void 0, L = k ? e : m, R = w ? n : S, M = t.useCallback(
31
+ (g) => {
32
+ g || p(""), w || v(g), o?.(g);
33
33
  },
34
- [I, o]
35
- ), N = t.useCallback(
36
- (x) => {
37
- S || w(x), r?.(x);
34
+ [w, o]
35
+ ), P = t.useCallback(
36
+ (g) => {
37
+ k || C(g), r?.(g);
38
38
  },
39
- [S, r]
40
- ), l = t.useRef(/* @__PURE__ */ new Map()), E = t.useRef(!1), z = t.useRef(!0);
39
+ [k, r]
40
+ ), i = t.useRef(/* @__PURE__ */ new Map()), E = t.useRef(!1), z = t.useRef(!0);
41
41
  t.useEffect(() => () => {
42
42
  z.current = !1;
43
43
  }, []);
44
- const b = t.useCallback(() => {
44
+ const f = t.useCallback(() => {
45
45
  E.current || (E.current = !0, queueMicrotask(() => {
46
- E.current = !1, z.current && y(new Map(l.current));
46
+ E.current = !1, z.current && y(new Map(i.current));
47
47
  }));
48
48
  }, []), F = t.useCallback(
49
- (x, $) => {
50
- l.current.get(x) !== $ && (l.current.set(x, $), b());
49
+ (g, $) => {
50
+ i.current.get(g) !== $ && (i.current.set(g, $), f());
51
51
  },
52
- [b]
52
+ [f]
53
53
  ), j = t.useCallback(
54
- (x) => {
55
- for (const [$, U] of x)
56
- l.current.set($, U);
57
- y(new Map(l.current));
54
+ (g) => {
55
+ for (const [$, U] of g)
56
+ i.current.set($, U);
57
+ y(new Map(i.current));
58
58
  },
59
59
  []
60
- ), q = t.useRef(R);
60
+ ), q = t.useRef(L);
61
61
  t.useLayoutEffect(() => {
62
- q.current = R;
63
- }, [R]);
62
+ q.current = L;
63
+ }, [L]);
64
64
  const T = t.useCallback(
65
- (x) => {
66
- x !== q.current && l.current.has(x) && (l.current.delete(x), b());
65
+ (g) => {
66
+ g !== q.current && i.current.has(g) && (i.current.delete(g), f());
67
67
  },
68
- [b]
68
+ [f]
69
69
  ), O = t.useMemo(
70
- () => s ? (x, $, U) => K(s(x), $, U) : K,
70
+ () => s ? (g, $, U) => K(s(g), $, U) : K,
71
71
  [s]
72
72
  ), H = t.useMemo(
73
73
  () => ({
74
- open: L,
74
+ open: R,
75
75
  setOpen: M,
76
- value: R,
77
- onValueChange: N,
78
- shouldFilter: i,
76
+ value: L,
77
+ onValueChange: P,
78
+ shouldFilter: l,
79
79
  disabled: c,
80
- itemLabels: f,
80
+ itemLabels: d,
81
81
  registerItem: F,
82
82
  registerItemsSync: j,
83
83
  unregisterItem: T,
84
84
  itemToStringValue: s,
85
85
  filterFn: O,
86
- searchValue: v,
87
- setSearchValue: C,
88
- activeDescendantId: P,
89
- setActiveDescendantId: k
86
+ searchValue: I,
87
+ setSearchValue: p,
88
+ activeDescendantId: V,
89
+ setActiveDescendantId: D
90
90
  }),
91
91
  [
92
- L,
93
- M,
94
92
  R,
95
- N,
96
- i,
93
+ M,
94
+ L,
95
+ P,
96
+ l,
97
97
  c,
98
- f,
98
+ d,
99
99
  F,
100
100
  j,
101
101
  T,
102
102
  s,
103
103
  O,
104
- v,
105
- P,
106
- k
104
+ I,
105
+ V,
106
+ D
107
107
  ]
108
108
  );
109
- return /* @__PURE__ */ u(J.Provider, { value: H, children: /* @__PURE__ */ u(re, { open: L, onOpenChange: M, children: p }) });
109
+ return /* @__PURE__ */ u(J.Provider, { value: H, children: /* @__PURE__ */ u(re, { open: R, onOpenChange: M, children: x }) });
110
110
  }
111
111
  const be = oe([
112
112
  // Base layout
@@ -137,17 +137,17 @@ const be = oe([
137
137
  dataHook: r,
138
138
  error: n,
139
139
  trackingEl: o,
140
- trackingLabel: i,
140
+ trackingLabel: l,
141
141
  children: c,
142
142
  ...s
143
- }, p) => {
144
- const { open: d, disabled: w, value: D } = _(), h = t.useId(), f = !D, y = n || s["aria-invalid"] === !0 || s["aria-invalid"] === "true";
143
+ }, x) => {
144
+ const { open: m, disabled: C, value: S } = _(), v = t.useId(), d = !S, y = n || s["aria-invalid"] === !0 || s["aria-invalid"] === "true";
145
145
  return /* @__PURE__ */ u(ae, { asChild: !0, children: /* @__PURE__ */ B(
146
146
  "button",
147
147
  {
148
- ref: p,
149
- "aria-controls": d ? h : void 0,
150
- "aria-expanded": d,
148
+ ref: x,
149
+ "aria-controls": m ? v : void 0,
150
+ "aria-expanded": m,
151
151
  "aria-haspopup": "listbox",
152
152
  "aria-invalid": y ? "true" : void 0,
153
153
  className: A(
@@ -156,12 +156,12 @@ const be = oe([
156
156
  e
157
157
  ),
158
158
  "data-hook": r,
159
- "data-placeholder": f,
159
+ "data-placeholder": d,
160
160
  "data-slot": "combobox-trigger",
161
- "data-state": d ? "open" : "closed",
161
+ "data-state": m ? "open" : "closed",
162
162
  "data-tracking-el": o || "combobox-trigger",
163
- "data-tracking-label": i,
164
- disabled: w || s.disabled,
163
+ "data-tracking-label": l,
164
+ disabled: C || s.disabled,
165
165
  role: "combobox",
166
166
  type: "button",
167
167
  ...s,
@@ -192,10 +192,10 @@ function X(e, r, n) {
192
192
  };
193
193
  const o = e[0];
194
194
  if (!pe(o)) return null;
195
- const i = (p) => p.value, c = "label" in o && typeof o.label == "string";
195
+ const l = (x) => x.value, c = "label" in o && typeof o.label == "string";
196
196
  return {
197
- getValue: i,
198
- getLabel: n ?? (c ? (p) => String(p.label) : i),
197
+ getValue: l,
198
+ getLabel: n ?? (c ? (x) => String(x.label) : l),
199
199
  hasDistinctLabel: c || !!n
200
200
  };
201
201
  }
@@ -204,21 +204,21 @@ function Ae({
204
204
  className: r,
205
205
  displayValue: n,
206
206
  items: o,
207
- getItemValue: i,
207
+ getItemValue: l,
208
208
  getItemLabel: c
209
209
  }) {
210
- const { value: s, itemLabels: p } = _(), d = t.useMemo(
211
- () => o ? X(o, i, c) : null,
212
- [o, i, c]
210
+ const { value: s, itemLabels: x } = _(), m = t.useMemo(
211
+ () => o ? X(o, l, c) : null,
212
+ [o, l, c]
213
213
  );
214
214
  G(
215
- () => !!o && o.length > 0 && !d,
215
+ () => !!o && o.length > 0 && !m,
216
216
  "ComboboxValue: could not infer `getItemValue` from item shape. Pass `getItemValue` explicitly, or use items with a `value` string property.",
217
- [o, d]
217
+ [o, m]
218
218
  );
219
- const w = t.useMemo(() => !o || !d ? null : new Map(
220
- o.map((h) => [d.getValue(h), d.getLabel(h)])
221
- ), [o, d]), D = s ? w?.get(s) || p.get(s) || n?.(s) || s : e;
219
+ const C = t.useMemo(() => !o || !m ? null : new Map(
220
+ o.map((v) => [m.getValue(v), m.getLabel(v)])
221
+ ), [o, m]), S = s ? C?.get(s) || x.get(s) || n?.(s) || s : e;
222
222
  return /* @__PURE__ */ u(
223
223
  "span",
224
224
  {
@@ -227,7 +227,7 @@ function Ae({
227
227
  r
228
228
  ),
229
229
  "data-slot": "combobox-value",
230
- children: D
230
+ children: S
231
231
  }
232
232
  );
233
233
  }
@@ -236,48 +236,49 @@ function Te({
236
236
  className: r,
237
237
  children: n,
238
238
  align: o = "start",
239
- side: i = "bottom",
239
+ side: l = "bottom",
240
240
  sideOffset: c,
241
241
  avoidCollisions: s,
242
- hideList: p = !1
242
+ hideList: x = !1,
243
+ ariaLabel: m
243
244
  }) {
244
- const { open: d, shouldFilter: w, filterFn: D, itemToStringValue: h } = _(), [f, y] = t.useState(
245
+ const { open: C, shouldFilter: S, filterFn: v, itemToStringValue: d } = _(), [y, I] = t.useState(
245
246
  null
246
- ), v = t.useRef(null), C = t.useCallback((k) => {
247
- if (v.current?.(), v.current = null, !k) return;
248
- let S = !1;
249
- const I = (N) => {
250
- S || (N === "top" || N === "bottom") && (S = !0, R.disconnect(), y(N));
247
+ ), p = t.useRef(null), V = t.useCallback((k) => {
248
+ if (p.current?.(), p.current = null, !k) return;
249
+ let w = !1;
250
+ const L = (i) => {
251
+ w || (i === "top" || i === "bottom") && (w = !0, R.disconnect(), I(i));
251
252
  }, R = new MutationObserver(() => {
252
- I(k.getAttribute("data-side"));
253
+ L(k.getAttribute("data-side"));
253
254
  });
254
255
  R.observe(k, {
255
256
  attributes: !0,
256
257
  attributeFilter: ["data-side"]
257
258
  });
258
- let L = 0, M = 0;
259
- L = requestAnimationFrame(() => {
260
- M = requestAnimationFrame(() => {
261
- I(k.getAttribute("data-side"));
259
+ let M = 0, P = 0;
260
+ M = requestAnimationFrame(() => {
261
+ P = requestAnimationFrame(() => {
262
+ L(k.getAttribute("data-side"));
262
263
  });
263
- }), v.current = () => {
264
- S = !0, R.disconnect(), cancelAnimationFrame(L), cancelAnimationFrame(M);
264
+ }), p.current = () => {
265
+ w = !0, R.disconnect(), cancelAnimationFrame(M), cancelAnimationFrame(P);
265
266
  };
266
267
  }, []);
267
268
  t.useEffect(() => {
268
- if (!d) {
269
- v.current?.(), v.current = null;
270
- const k = setTimeout(() => y(null), 150);
269
+ if (!C) {
270
+ p.current?.(), p.current = null;
271
+ const k = setTimeout(() => I(null), 150);
271
272
  return () => clearTimeout(k);
272
273
  }
273
- }, [d]);
274
- const P = h ? D : void 0;
274
+ }, [C]);
275
+ const D = d ? v : void 0;
275
276
  return /* @__PURE__ */ u(
276
277
  ne,
277
278
  {
278
- ref: C,
279
+ ref: V,
279
280
  align: o,
280
- "aria-label": "Options",
281
+ "aria-label": m ?? "Options",
281
282
  avoidCollisions: s,
282
283
  className: A(
283
284
  "flex max-h-[var(--radix-popover-content-available-height)] w-[var(--radix-popover-trigger-width)] flex-col overflow-hidden p-0",
@@ -285,7 +286,7 @@ function Te({
285
286
  ),
286
287
  collisionPadding: 4,
287
288
  "data-slot": "combobox-popover",
288
- side: f ?? i,
289
+ side: y ?? l,
289
290
  sideOffset: c,
290
291
  children: /* @__PURE__ */ u(
291
292
  se,
@@ -293,12 +294,12 @@ function Te({
293
294
  className: A(
294
295
  "min-h-0 flex-1 border-0 shadow-none",
295
296
  "[&_[data-slot='command-input-wrapper']]:shrink-0",
296
- p && "[&_[data-slot='command-input-wrapper']]:border-b-0"
297
+ x && "[&_[data-slot='command-input-wrapper']]:border-b-0"
297
298
  ),
298
299
  "data-slot": "combobox-command",
299
300
  dataHook: e || "combobox-command",
300
- filter: P,
301
- shouldFilter: w,
301
+ filter: D,
302
+ shouldFilter: S,
302
303
  children: n
303
304
  }
304
305
  )
@@ -306,7 +307,7 @@ function Te({
306
307
  );
307
308
  }
308
309
  const xe = t.forwardRef(({ debounceMs: e, onValueChange: r, ...n }, o) => {
309
- const { setSearchValue: i, shouldFilter: c, activeDescendantId: s } = _(), p = t.useRef(
310
+ const { setSearchValue: l, shouldFilter: c, activeDescendantId: s } = _(), x = t.useRef(
310
311
  void 0
311
312
  );
312
313
  G(
@@ -320,15 +321,15 @@ Set shouldFilter={false} on <Combobox> for async search, or remove debounceMs fo
320
321
  "debounceMs is set on <ComboboxInput> together with a controlled `value` prop.\nThe debounced onValueChange callback cannot update the controlled value synchronously, so the input will appear to lag behind typing.\nRemove `value` to let the input manage its own display, or remove debounceMs if you need a controlled input.",
321
322
  [e, n.value]
322
323
  ), t.useEffect(() => () => {
323
- p.current && clearTimeout(p.current);
324
+ x.current && clearTimeout(x.current);
324
325
  }, []);
325
- const d = t.useCallback(
326
- (w) => {
327
- i(w), e && e > 0 ? (clearTimeout(p.current), p.current = setTimeout(() => {
328
- r?.(w);
329
- }, e)) : r?.(w);
326
+ const m = t.useCallback(
327
+ (C) => {
328
+ l(C), e && e > 0 ? (clearTimeout(x.current), x.current = setTimeout(() => {
329
+ r?.(C);
330
+ }, e)) : r?.(C);
330
331
  },
331
- [e, r, i]
332
+ [e, r, l]
332
333
  );
333
334
  return /* @__PURE__ */ u(
334
335
  ue,
@@ -336,7 +337,7 @@ Set shouldFilter={false} on <Combobox> for async search, or remove debounceMs fo
336
337
  ref: o,
337
338
  "aria-activedescendant": s,
338
339
  "data-slot": "combobox-input",
339
- onValueChange: d,
340
+ onValueChange: m,
340
341
  ...n
341
342
  }
342
343
  );
@@ -357,170 +358,170 @@ function he({
357
358
  getItemValue: r,
358
359
  getItemLabel: n,
359
360
  getItemKeywords: o,
360
- estimateSize: i = 36,
361
+ estimateSize: l = 36,
361
362
  overscan: c = 5,
362
363
  children: s,
363
- renderEmpty: p,
364
- className: d,
365
- dataHook: w
366
- }, D) {
367
- const h = t.useMemo(
364
+ renderEmpty: x,
365
+ className: m,
366
+ dataHook: C
367
+ }, S) {
368
+ const v = t.useMemo(
368
369
  () => X(e, r, n),
369
370
  [e, r, n]
370
- ), f = t.useMemo(
371
- () => h?.getValue ?? ((a) => {
371
+ ), d = t.useMemo(
372
+ () => v?.getValue ?? ((a) => {
372
373
  if (typeof a == "string" || typeof a == "number")
373
374
  return String(a);
374
375
  throw new Error(
375
376
  "[BrightLocal DS] ComboboxVirtualList: `getItemValue` is required for non-primitive items without a `value` property."
376
377
  );
377
378
  }),
378
- [h]
379
+ [v]
379
380
  ), y = t.useMemo(
380
- () => h?.getLabel ?? f,
381
- [h, f]
381
+ () => v?.getLabel ?? d,
382
+ [v, d]
382
383
  );
383
384
  G(
384
- () => !h && e.length > 0,
385
+ () => !v && e.length > 0,
385
386
  "ComboboxVirtualList: could not infer `getItemValue` from item shape. Pass `getItemValue` explicitly, or use items with a `value` string property.",
386
- [h, e.length]
387
+ [v, e.length]
387
388
  );
388
- const v = t.useRef(null), {
389
- value: C,
390
- onValueChange: P,
391
- setOpen: k,
392
- shouldFilter: S,
393
- searchValue: I,
394
- filterFn: R,
395
- setActiveDescendantId: L,
389
+ const I = t.useRef(null), {
390
+ value: p,
391
+ onValueChange: V,
392
+ setOpen: D,
393
+ shouldFilter: k,
394
+ searchValue: w,
395
+ filterFn: L,
396
+ setActiveDescendantId: R,
396
397
  registerItemsSync: M,
397
- unregisterItem: N
398
- } = _(), [l, E] = t.useState(0), z = t.useId();
399
- t.useImperativeHandle(D, () => v.current, []), t.useLayoutEffect(() => {
400
- const a = e.map((m) => [
401
- f(m),
402
- y(m)
398
+ unregisterItem: P
399
+ } = _(), [i, E] = t.useState(0), z = t.useId();
400
+ t.useImperativeHandle(S, () => I.current, []), t.useLayoutEffect(() => {
401
+ const a = e.map((b) => [
402
+ d(b),
403
+ y(b)
403
404
  ]);
404
405
  return M(a), () => {
405
- for (const m of e)
406
- N(f(m));
406
+ for (const b of e)
407
+ P(d(b));
407
408
  };
408
- }, [e, f, y, M, N]);
409
- const b = t.useMemo(() => {
410
- if (!S || !I.trim()) return e;
409
+ }, [e, d, y, M, P]);
410
+ const f = t.useMemo(() => {
411
+ if (!k || !w.trim()) return e;
411
412
  const a = [];
412
- for (const m of e) {
413
- let g = h?.hasDistinctLabel ? K(y(m), I) : R(f(m), I);
413
+ for (const b of e) {
414
+ let h = v?.hasDistinctLabel ? K(y(b), w) : L(d(b), w);
414
415
  if (o)
415
- for (const V of o(m))
416
- g = Math.max(g, K(V, I));
417
- g > 0 && a.push({ item: m, score: g });
416
+ for (const N of o(b))
417
+ h = Math.max(h, K(N, w));
418
+ h > 0 && a.push({ item: b, score: h });
418
419
  }
419
- return a.sort((m, g) => g.score - m.score), a.map((m) => m.item);
420
+ return a.sort((b, h) => h.score - b.score), a.map((b) => b.item);
420
421
  }, [
421
422
  e,
422
- S,
423
- I,
424
- f,
423
+ k,
424
+ w,
425
+ d,
425
426
  y,
426
427
  o,
427
- R,
428
- h?.hasDistinctLabel
428
+ L,
429
+ v?.hasDistinctLabel
429
430
  ]), F = te({
430
- count: b.length,
431
- getScrollElement: () => v.current,
432
- estimateSize: () => i,
431
+ count: f.length,
432
+ getScrollElement: () => I.current,
433
+ estimateSize: () => l,
433
434
  overscan: c
434
- }), j = l >= 0 && l < b.length ? f(b[l]) : null;
435
+ }), j = i >= 0 && i < f.length ? d(f[i]) : null;
435
436
  t.useEffect(() => {
436
437
  E(0);
437
- }, [I, b.length]);
438
+ }, [w, f.length]);
438
439
  const q = t.useRef(!1);
439
440
  t.useEffect(() => {
440
- if (q.current || !C) return;
441
- const a = b.findIndex((m) => f(m) === C);
441
+ if (q.current || !p) return;
442
+ const a = f.findIndex((b) => d(b) === p);
442
443
  a >= 0 && (E(a), F.scrollToIndex(a, { align: "center" }), q.current = !0);
443
- }, [C, b, f, F]);
444
+ }, [p, f, d, F]);
444
445
  const T = t.useRef(!1);
445
446
  t.useEffect(() => {
446
- T.current && l >= 0 && l < b.length && F.scrollToIndex(l, { align: "auto" }), T.current = !1;
447
- }, [l, b.length, F]), t.useEffect(() => {
448
- const a = v.current?.closest(
447
+ T.current && i >= 0 && i < f.length && F.scrollToIndex(i, { align: "auto" }), T.current = !1;
448
+ }, [i, f.length, F]), t.useEffect(() => {
449
+ const a = I.current?.closest(
449
450
  '[data-slot="combobox-command"]'
450
451
  );
451
452
  if (!a) return;
452
- const m = (g) => {
453
- switch (g.key) {
453
+ const b = (h) => {
454
+ switch (h.key) {
454
455
  case "ArrowDown":
455
- g.preventDefault(), g.stopPropagation(), T.current = !0, E(
456
- (V) => V < b.length - 1 ? V + 1 : V
456
+ h.preventDefault(), h.stopPropagation(), T.current = !0, E(
457
+ (N) => N < f.length - 1 ? N + 1 : N
457
458
  );
458
459
  break;
459
460
  case "ArrowUp":
460
- g.preventDefault(), g.stopPropagation(), T.current = !0, E((V) => V > 0 ? V - 1 : V);
461
+ h.preventDefault(), h.stopPropagation(), T.current = !0, E((N) => N > 0 ? N - 1 : N);
461
462
  break;
462
463
  case "Enter":
463
- if (g.preventDefault(), g.stopPropagation(), l >= 0 && l < b.length) {
464
- const V = f(b[l]);
465
- P(V === C ? "" : V), k(!1);
464
+ if (h.preventDefault(), h.stopPropagation(), i >= 0 && i < f.length) {
465
+ const N = d(f[i]);
466
+ V(N === p ? "" : N), D(!1);
466
467
  }
467
468
  break;
468
469
  case "Home":
469
- g.preventDefault(), g.stopPropagation(), T.current = !0, E(0);
470
+ h.preventDefault(), h.stopPropagation(), T.current = !0, E(0);
470
471
  break;
471
472
  case "End":
472
- g.preventDefault(), g.stopPropagation(), T.current = !0, E(b.length - 1);
473
+ h.preventDefault(), h.stopPropagation(), T.current = !0, E(f.length - 1);
473
474
  break;
474
475
  }
475
476
  };
476
- return a.addEventListener("keydown", m, { capture: !0 }), () => a.removeEventListener("keydown", m, { capture: !0 });
477
- }, [b, l, C, P, k, f]);
477
+ return a.addEventListener("keydown", b, { capture: !0 }), () => a.removeEventListener("keydown", b, { capture: !0 });
478
+ }, [f, i, p, V, D, d]);
478
479
  const O = t.useMemo(() => {
479
480
  const a = /* @__PURE__ */ new Map();
480
- return b.forEach((m, g) => {
481
- a.set(f(m), g);
481
+ return f.forEach((b, h) => {
482
+ a.set(d(b), h);
482
483
  }), a;
483
- }, [b, f]), H = t.useCallback(
484
+ }, [f, d]), H = t.useCallback(
484
485
  (a) => {
485
- const m = O.get(a);
486
- m !== void 0 && E(m);
486
+ const b = O.get(a);
487
+ b !== void 0 && E(b);
487
488
  },
488
489
  [O]
489
- ), x = t.useCallback(
490
+ ), g = t.useCallback(
490
491
  (a) => (O.get(a) ?? 0) + 1,
491
492
  [O]
492
- ), $ = b.length, U = t.useMemo(
493
+ ), $ = f.length, U = t.useMemo(
493
494
  () => ({
494
495
  activeValue: j,
495
496
  onItemPointerMove: H,
496
497
  idPrefix: z,
497
498
  filteredCount: $,
498
- getItemPosition: x
499
+ getItemPosition: g
499
500
  }),
500
- [j, H, z, $, x]
501
+ [j, H, z, $, g]
501
502
  ), W = j != null ? `${z}item-${j}` : void 0;
502
- return t.useEffect(() => (L(W), () => L(void 0)), [W, L]), b.length === 0 ? /* @__PURE__ */ u(
503
+ return t.useEffect(() => (R(W), () => R(void 0)), [W, R]), f.length === 0 ? /* @__PURE__ */ u(
503
504
  "div",
504
505
  {
505
- ref: v,
506
+ ref: I,
506
507
  className: A(
507
508
  "scrollbar max-h-[300px] min-h-0 flex-1 scroll-py-1 overflow-x-hidden overflow-y-auto py-1",
508
- d
509
+ m
509
510
  ),
510
- "data-hook": w,
511
+ "data-hook": C,
511
512
  "data-slot": "combobox-virtual-list",
512
513
  role: "listbox",
513
- children: p
514
+ children: x
514
515
  }
515
516
  ) : /* @__PURE__ */ u(Q.Provider, { value: U, children: /* @__PURE__ */ u(
516
517
  "div",
517
518
  {
518
- ref: v,
519
+ ref: I,
519
520
  className: A(
520
521
  "scrollbar max-h-[300px] min-h-0 flex-1 scroll-py-1 overflow-x-hidden overflow-y-auto py-1",
521
- d
522
+ m
522
523
  ),
523
- "data-hook": w,
524
+ "data-hook": C,
524
525
  "data-slot": "combobox-virtual-list",
525
526
  role: "listbox",
526
527
  children: /* @__PURE__ */ u(
@@ -538,9 +539,9 @@ function he({
538
539
  transform: `translateY(${a.start}px)`
539
540
  },
540
541
  children: s(
541
- b[a.index],
542
+ f[a.index],
542
543
  a.index,
543
- I
544
+ w
544
545
  )
545
546
  },
546
547
  a.key
@@ -562,8 +563,8 @@ Import: import { ComboboxVirtualList } from "@brightlocal/ui-components/combobox
562
563
  ), /* @__PURE__ */ u(
563
564
  le,
564
565
  {
565
- ref: (i) => {
566
- o.current = i, typeof n == "function" ? n(i) : n && (n.current = i);
566
+ ref: (l) => {
567
+ o.current = l, typeof n == "function" ? n(l) : n && (n.current = l);
567
568
  },
568
569
  "data-slot": "combobox-group",
569
570
  ...r,
@@ -578,8 +579,8 @@ function we(e, r, n) {
578
579
  const o = new RegExp(
579
580
  `(${r.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")})`,
580
581
  "gi"
581
- ), i = e.split(o);
582
- return /* @__PURE__ */ u("span", { children: i.map(
582
+ ), l = e.split(o);
583
+ return /* @__PURE__ */ u("span", { children: l.map(
583
584
  (c, s) => s % 2 === 1 ? /* @__PURE__ */ u("span", { className: n, children: c }, s) : /* @__PURE__ */ u(t.Fragment, { children: c }, s)
584
585
  ) });
585
586
  }
@@ -589,58 +590,58 @@ const ye = t.forwardRef(
589
590
  label: r,
590
591
  dataHook: n,
591
592
  children: o,
592
- className: i,
593
+ className: l,
593
594
  highlight: c,
594
595
  highlightClassName: s,
595
- keywords: p,
596
- ...d
597
- }, w) => {
598
- const { value: D, onValueChange: h, setOpen: f, registerItem: y, unregisterItem: v } = _(), C = t.useContext(Q), P = D === e, k = t.useMemo(() => r || (typeof o == "string" ? o : typeof o == "number" ? String(o) : e), [r, o, e]), S = t.useRef(y), I = t.useRef(v);
596
+ keywords: x,
597
+ ...m
598
+ }, C) => {
599
+ const { value: S, onValueChange: v, setOpen: d, registerItem: y, unregisterItem: I } = _(), p = t.useContext(Q), V = S === e, D = t.useMemo(() => r || (typeof o == "string" ? o : typeof o == "number" ? String(o) : e), [r, o, e]), k = t.useRef(y), w = t.useRef(I);
599
600
  t.useEffect(() => {
600
- S.current = y, I.current = v;
601
- }, [y, v]);
602
- const R = !!C;
601
+ k.current = y, w.current = I;
602
+ }, [y, I]);
603
+ const L = !!p;
603
604
  t.useEffect(() => {
604
- if (!R)
605
- return S.current(e, k), () => I.current(e);
606
- }, [e, k, R]);
607
- const L = () => {
608
- h(e === D ? "" : e), f(!1);
605
+ if (!L)
606
+ return k.current(e, D), () => w.current(e);
607
+ }, [e, D, L]);
608
+ const R = () => {
609
+ v(e === S ? "" : e), d(!1);
609
610
  }, M = () => c && typeof o == "string" ? we(
610
611
  o,
611
612
  c,
612
613
  s || "text-sm leading-normal font-semibold"
613
614
  ) : o;
614
- if (C) {
615
- const N = C.activeValue === e, l = !!d.disabled;
615
+ if (p) {
616
+ const P = p.activeValue === e, i = !!m.disabled;
616
617
  return /* @__PURE__ */ B(
617
618
  "div",
618
619
  {
619
- ref: w,
620
- "aria-disabled": l || void 0,
621
- "aria-posinset": C.getItemPosition(e),
622
- "aria-selected": P,
623
- "aria-setsize": C.filteredCount,
620
+ ref: C,
621
+ "aria-disabled": i || void 0,
622
+ "aria-posinset": p.getItemPosition(e),
623
+ "aria-selected": V,
624
+ "aria-setsize": p.filteredCount,
624
625
  className: A(
625
626
  "data-[highlighted=true]:bg-accent data-[highlighted=true]:text-accent-foreground relative flex cursor-default items-center justify-between gap-2 rounded-sm px-2 py-3 text-sm outline-hidden select-none",
626
627
  "[&_svg]:pointer-events-none [&_svg]:shrink-0",
627
- l && "pointer-events-none opacity-50",
628
- i
628
+ i && "pointer-events-none opacity-50",
629
+ l
629
630
  ),
630
- "data-highlighted": N || void 0,
631
+ "data-highlighted": P || void 0,
631
632
  "data-hook": n,
632
633
  "data-slot": "combobox-item",
633
- id: `${C.idPrefix}item-${e}`,
634
+ id: `${p.idPrefix}item-${e}`,
634
635
  role: "option",
635
636
  tabIndex: -1,
636
- onClick: l ? void 0 : L,
637
- onKeyDown: l ? void 0 : (E) => {
638
- (E.key === "Enter" || E.key === " ") && L();
637
+ onClick: i ? void 0 : R,
638
+ onKeyDown: i ? void 0 : (E) => {
639
+ (E.key === "Enter" || E.key === " ") && R();
639
640
  },
640
- onPointerMove: l ? void 0 : () => C.onItemPointerMove(e),
641
+ onPointerMove: i ? void 0 : () => p.onItemPointerMove(e),
641
642
  children: [
642
643
  M(),
643
- P && /* @__PURE__ */ u(
644
+ V && /* @__PURE__ */ u(
644
645
  Y,
645
646
  {
646
647
  "aria-hidden": "true",
@@ -654,17 +655,17 @@ const ye = t.forwardRef(
654
655
  return /* @__PURE__ */ B(
655
656
  ce,
656
657
  {
657
- ref: w,
658
- className: A("justify-between", i),
658
+ ref: C,
659
+ className: A("justify-between", l),
659
660
  "data-slot": "combobox-item",
660
661
  dataHook: n,
661
- keywords: p ? [k, ...p] : [k],
662
+ keywords: x ? [D, ...x] : [D],
662
663
  value: e,
663
- onSelect: L,
664
- ...d,
664
+ onSelect: R,
665
+ ...m,
665
666
  children: [
666
667
  M(),
667
- P && /* @__PURE__ */ u(
668
+ V && /* @__PURE__ */ u(
668
669
  Y,
669
670
  {
670
671
  "aria-hidden": "true",
@@ -679,7 +680,11 @@ const ye = t.forwardRef(
679
680
  ye.displayName = "ComboboxItem";
680
681
  const ke = t.forwardRef((e, r) => /* @__PURE__ */ u(fe, { ref: r, "data-slot": "combobox-separator", ...e }));
681
682
  ke.displayName = "ComboboxSeparator";
682
- function je({ className: e, children: r }) {
683
+ function je({
684
+ className: e,
685
+ children: r,
686
+ loadingText: n
687
+ }) {
683
688
  return /* @__PURE__ */ u(
684
689
  "div",
685
690
  {
@@ -698,7 +703,7 @@ function je({ className: e, children: r }) {
698
703
  className: "size-4 animate-spin rounded-full border-2 border-current border-t-transparent [animation-duration:0.6s]"
699
704
  }
700
705
  ),
701
- "Loading..."
706
+ n ?? "Loading..."
702
707
  ] })
703
708
  }
704
709
  );