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