@brightlocal/ui-components 2.11.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 (154) hide show
  1. package/component-meta.json +474 -27
  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 +221 -11
  12. package/dist/blocks/sidebar.d.ts.map +1 -1
  13. package/dist/blocks/sidebar.js +687 -406
  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 +20 -2
  32. package/dist/combobox.d.ts.map +1 -1
  33. package/dist/combobox.js +244 -238
  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/dropdown-menu.cjs +1 -1
  48. package/dist/dropdown-menu.js +1 -1
  49. package/dist/global-layout.cjs +1 -1
  50. package/dist/global-layout.d.ts +5 -0
  51. package/dist/global-layout.d.ts.map +1 -1
  52. package/dist/global-layout.js +15 -7
  53. package/dist/index.cjs +1 -1
  54. package/dist/index.js +313 -305
  55. package/dist/input-chip.cjs +1 -1
  56. package/dist/input-chip.d.ts +7 -1
  57. package/dist/input-chip.d.ts.map +1 -1
  58. package/dist/input-chip.js +131 -130
  59. package/dist/input-group.d.ts +1 -1
  60. package/dist/input-password.cjs +1 -1
  61. package/dist/input-password.d.ts +10 -0
  62. package/dist/input-password.d.ts.map +1 -1
  63. package/dist/input-password.js +108 -106
  64. package/dist/link.cjs +1 -1
  65. package/dist/link.d.ts +1 -1
  66. package/dist/link.d.ts.map +1 -1
  67. package/dist/link.js +36 -37
  68. package/dist/list.cjs +1 -1
  69. package/dist/list.d.ts +25 -4
  70. package/dist/list.d.ts.map +1 -1
  71. package/dist/list.js +71 -53
  72. package/dist/logo.cjs +1 -1
  73. package/dist/logo.d.ts +6 -1
  74. package/dist/logo.d.ts.map +1 -1
  75. package/dist/logo.js +25 -22
  76. package/dist/map.cjs +1 -1
  77. package/dist/map.d.ts +17 -2
  78. package/dist/map.d.ts.map +1 -1
  79. package/dist/map.js +32 -26
  80. package/dist/pagination.cjs +1 -1
  81. package/dist/pagination.d.ts +29 -3
  82. package/dist/pagination.d.ts.map +1 -1
  83. package/dist/pagination.js +26 -25
  84. package/dist/popover.cjs +1 -1
  85. package/dist/popover.js +7 -7
  86. package/dist/rating.cjs +1 -1
  87. package/dist/rating.d.ts +6 -0
  88. package/dist/rating.d.ts.map +1 -1
  89. package/dist/rating.js +28 -20
  90. package/dist/resizable.d.ts +1 -1
  91. package/dist/select.cjs +2 -2
  92. package/dist/select.d.ts +17 -3
  93. package/dist/select.d.ts.map +1 -1
  94. package/dist/select.js +65 -58
  95. package/dist/separator.cjs +1 -1
  96. package/dist/separator.d.ts +16 -4
  97. package/dist/separator.d.ts.map +1 -1
  98. package/dist/separator.js +38 -35
  99. package/dist/sheet.cjs +1 -1
  100. package/dist/sheet.d.ts +6 -1
  101. package/dist/sheet.d.ts.map +1 -1
  102. package/dist/sheet.js +42 -41
  103. package/dist/skeleton.cjs +1 -1
  104. package/dist/skeleton.d.ts +5 -0
  105. package/dist/skeleton.d.ts.map +1 -1
  106. package/dist/skeleton.js +13 -11
  107. package/dist/table.cjs +1 -1
  108. package/dist/table.d.ts +14 -0
  109. package/dist/table.d.ts.map +1 -1
  110. package/dist/table.js +57 -39
  111. package/dist/tabs.cjs +1 -1
  112. package/dist/tabs.d.ts +25 -9
  113. package/dist/tabs.d.ts.map +1 -1
  114. package/dist/tabs.js +128 -113
  115. package/dist/text-reveal-motion.cjs +1 -1
  116. package/dist/text-reveal-motion.d.ts +5 -0
  117. package/dist/text-reveal-motion.d.ts.map +1 -1
  118. package/dist/text-reveal-motion.js +111 -110
  119. package/dist/typography.cjs +1 -1
  120. package/dist/typography.d.ts +1 -2
  121. package/dist/typography.d.ts.map +1 -1
  122. package/dist/typography.js +49 -50
  123. package/package.json +2 -3
  124. package/src/blocks/data-table.tsx +26 -9
  125. package/src/blocks/input-list.tsx +12 -1
  126. package/src/blocks/sidebar.tsx +638 -29
  127. package/src/components/breadcrumb.tsx +43 -26
  128. package/src/components/callout.tsx +5 -4
  129. package/src/components/carousel.tsx +33 -4
  130. package/src/components/chip.tsx +22 -2
  131. package/src/components/combobox.tsx +28 -3
  132. package/src/components/command.tsx +7 -1
  133. package/src/components/date-picker.tsx +17 -3
  134. package/src/components/dialog.tsx +17 -4
  135. package/src/components/drawer.tsx +2 -2
  136. package/src/components/dropdown-menu.tsx +1 -1
  137. package/src/components/global-layout.tsx +15 -2
  138. package/src/components/input-chip.tsx +12 -1
  139. package/src/components/input-password.tsx +73 -49
  140. package/src/components/link.tsx +29 -17
  141. package/src/components/list.tsx +45 -2
  142. package/src/components/logo.tsx +10 -2
  143. package/src/components/map.tsx +23 -0
  144. package/src/components/pagination.tsx +44 -11
  145. package/src/components/popover.tsx +1 -1
  146. package/src/components/rating.tsx +21 -3
  147. package/src/components/select.tsx +33 -3
  148. package/src/components/separator.tsx +40 -25
  149. package/src/components/sheet.tsx +28 -20
  150. package/src/components/skeleton.tsx +13 -2
  151. package/src/components/table.tsx +39 -2
  152. package/src/components/tabs.tsx +195 -146
  153. package/src/components/text-reveal-motion.tsx +7 -1
  154. package/src/components/typography.tsx +6 -7
package/dist/combobox.js CHANGED
@@ -23,90 +23,90 @@ function Fe({
23
23
  shouldFilter: i = !0,
24
24
  disabled: c = !1,
25
25
  itemToStringValue: s,
26
- children: p
26
+ children: m
27
27
  }) {
28
- const [d, w] = t.useState(""), [D, h] = t.useState(!1), [f, y] = t.useState(
28
+ const [p, v] = t.useState(""), [M, x] = t.useState(!1), [d, L] = 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, 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
+ (g) => {
32
+ g || C(""), y || x(g), o?.(g);
33
33
  },
34
- [I, o]
35
- ), N = t.useCallback(
36
- (x) => {
37
- S || w(x), r?.(x);
34
+ [y, o]
35
+ ), V = t.useCallback(
36
+ (g) => {
37
+ w || v(g), r?.(g);
38
38
  },
39
- [S, r]
40
- ), l = 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
- const b = t.useCallback(() => {
45
- E.current || (E.current = !0, queueMicrotask(() => {
46
- E.current = !1, z.current && y(new Map(l.current));
44
+ const f = t.useCallback(() => {
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
- (x, $) => {
50
- l.current.get(x) !== $ && (l.current.set(x, $), b());
49
+ (g, j) => {
50
+ l.current.get(g) !== j && (l.current.set(g, j), f());
51
51
  },
52
- [b]
53
- ), j = t.useCallback(
54
- (x) => {
55
- for (const [$, U] of x)
56
- l.current.set($, U);
57
- y(new Map(l.current));
52
+ [f]
53
+ ), O = t.useCallback(
54
+ (g) => {
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(R);
60
+ ), q = t.useRef(E);
61
61
  t.useLayoutEffect(() => {
62
- q.current = R;
63
- }, [R]);
64
- const T = t.useCallback(
65
- (x) => {
66
- x !== q.current && l.current.has(x) && (l.current.delete(x), b());
62
+ q.current = E;
63
+ }, [E]);
64
+ const $ = t.useCallback(
65
+ (g) => {
66
+ g !== q.current && l.current.has(g) && (l.current.delete(g), f());
67
67
  },
68
- [b]
69
- ), O = t.useMemo(
70
- () => s ? (x, $, U) => K(s(x), $, U) : K,
68
+ [f]
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: L,
75
- setOpen: M,
76
- value: R,
77
- onValueChange: N,
74
+ open: S,
75
+ setOpen: D,
76
+ value: E,
77
+ onValueChange: V,
78
78
  shouldFilter: i,
79
79
  disabled: c,
80
- itemLabels: f,
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,
86
- searchValue: v,
85
+ filterFn: z,
86
+ searchValue: I,
87
87
  setSearchValue: C,
88
- activeDescendantId: P,
89
- setActiveDescendantId: k
88
+ activeDescendantId: R,
89
+ setActiveDescendantId: P
90
90
  }),
91
91
  [
92
- L,
93
- M,
94
- R,
95
- N,
92
+ S,
93
+ D,
94
+ E,
95
+ V,
96
96
  i,
97
97
  c,
98
- f,
98
+ d,
99
99
  F,
100
- j,
101
- T,
102
- s,
103
100
  O,
104
- v,
105
- P,
106
- k
101
+ $,
102
+ s,
103
+ z,
104
+ I,
105
+ R,
106
+ P
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: S, onOpenChange: D, children: m }) });
110
110
  }
111
111
  const be = oe([
112
112
  // Base layout
@@ -140,28 +140,28 @@ const be = oe([
140
140
  trackingLabel: i,
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
+ }, 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: p,
149
- "aria-controls": d ? h : void 0,
150
- "aria-expanded": d,
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
- "data-placeholder": f,
159
+ "data-placeholder": d,
160
160
  "data-slot": "combobox-trigger",
161
- "data-state": d ? "open" : "closed",
161
+ "data-state": p ? "open" : "closed",
162
162
  "data-tracking-el": o || "combobox-trigger",
163
163
  "data-tracking-label": i,
164
- disabled: w || s.disabled,
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 i = (p) => p.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
197
  getValue: i,
198
- getLabel: n ?? (c ? (p) => String(p.label) : i),
198
+ getLabel: n ?? (c ? (m) => String(m.label) : i),
199
199
  hasDistinctLabel: c || !!n
200
200
  };
201
201
  }
@@ -207,18 +207,18 @@ function Ae({
207
207
  getItemValue: i,
208
208
  getItemLabel: c
209
209
  }) {
210
- const { value: s, itemLabels: p } = _(), d = t.useMemo(
210
+ const { value: s, itemLabels: m } = _(), p = t.useMemo(
211
211
  () => o ? X(o, i, c) : null,
212
212
  [o, i, c]
213
213
  );
214
214
  G(
215
- () => !!o && o.length > 0 && !d,
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, d]
217
+ [o, p]
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 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: D
230
+ children: M
231
231
  }
232
232
  );
233
233
  }
@@ -239,45 +239,46 @@ function Te({
239
239
  side: i = "bottom",
240
240
  sideOffset: c,
241
241
  avoidCollisions: s,
242
- hideList: p = !1
242
+ hideList: m = !1,
243
+ ariaLabel: p
243
244
  }) {
244
- const { open: d, shouldFilter: w, filterFn: D, itemToStringValue: h } = _(), [f, y] = t.useState(
245
+ const { open: v, shouldFilter: M, filterFn: x, itemToStringValue: d } = _(), [L, 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));
251
- }, R = new MutationObserver(() => {
252
- I(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"));
253
254
  });
254
- R.observe(k, {
255
+ S.observe(w, {
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 D = 0, V = 0;
260
+ D = requestAnimationFrame(() => {
261
+ V = requestAnimationFrame(() => {
262
+ E(w.getAttribute("data-side"));
262
263
  });
263
- }), v.current = () => {
264
- S = !0, R.disconnect(), cancelAnimationFrame(L), cancelAnimationFrame(M);
264
+ }), C.current = () => {
265
+ y = !0, S.disconnect(), cancelAnimationFrame(D), cancelAnimationFrame(V);
265
266
  };
266
267
  }, []);
267
268
  t.useEffect(() => {
268
- if (!d) {
269
- v.current?.(), v.current = null;
270
- const k = setTimeout(() => y(null), 150);
271
- return () => clearTimeout(k);
269
+ if (!v) {
270
+ C.current?.(), C.current = null;
271
+ const w = setTimeout(() => I(null), 150);
272
+ return () => clearTimeout(w);
272
273
  }
273
- }, [d]);
274
- const P = h ? D : void 0;
274
+ }, [v]);
275
+ const P = d ? x : void 0;
275
276
  return /* @__PURE__ */ u(
276
277
  ne,
277
278
  {
278
- ref: C,
279
+ ref: R,
279
280
  align: o,
280
- "aria-label": "Options",
281
+ "aria-label": p ?? "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: L ?? i,
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
+ m && "[&_[data-slot='command-input-wrapper']]:border-b-0"
297
298
  ),
298
299
  "data-slot": "combobox-command",
299
300
  dataHook: e || "combobox-command",
300
301
  filter: P,
301
- shouldFilter: w,
302
+ shouldFilter: M,
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: i, shouldFilter: c, activeDescendantId: s } = _(), m = t.useRef(
310
311
  void 0
311
312
  );
312
313
  G(
@@ -320,13 +321,13 @@ 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
+ m.current && clearTimeout(m.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 p = t.useCallback(
327
+ (v) => {
328
+ i(v), e && e > 0 ? (clearTimeout(m.current), m.current = setTimeout(() => {
329
+ r?.(v);
330
+ }, e)) : r?.(v);
330
331
  },
331
332
  [e, r, i]
332
333
  );
@@ -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: p,
340
341
  ...n
341
342
  }
342
343
  );
@@ -360,167 +361,167 @@ function he({
360
361
  estimateSize: i = 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: m,
365
+ className: p,
366
+ dataHook: v
367
+ }, M) {
368
+ const x = 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
+ () => x?.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
- ), y = t.useMemo(
380
- () => h?.getLabel ?? f,
381
- [h, f]
379
+ [x]
380
+ ), L = t.useMemo(
381
+ () => x?.getLabel ?? d,
382
+ [x, d]
382
383
  );
383
384
  G(
384
- () => !h && e.length > 0,
385
+ () => !x && 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
+ [x, e.length]
387
388
  );
388
- const v = t.useRef(null), {
389
+ const I = t.useRef(null), {
389
390
  value: C,
390
- onValueChange: P,
391
- setOpen: k,
392
- shouldFilter: S,
393
- searchValue: I,
394
- filterFn: R,
395
- setActiveDescendantId: L,
396
- 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)
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
+ const a = e.map((b) => [
402
+ d(b),
403
+ L(b)
403
404
  ]);
404
- return M(a), () => {
405
- for (const m of e)
406
- N(f(m));
405
+ return D(a), () => {
406
+ for (const b of e)
407
+ V(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, L, D, V]);
410
+ const f = t.useMemo(() => {
411
+ if (!w || !y.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 = x?.hasDistinctLabel ? K(L(b), y) : E(d(b), y);
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, y));
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
+ w,
425
424
  y,
425
+ d,
426
+ L,
426
427
  o,
427
- R,
428
- h?.hasDistinctLabel
428
+ E,
429
+ x?.hasDistinctLabel
429
430
  ]), F = te({
430
- count: b.length,
431
- getScrollElement: () => v.current,
431
+ count: f.length,
432
+ getScrollElement: () => I.current,
432
433
  estimateSize: () => i,
433
434
  overscan: c
434
- }), j = l >= 0 && l < b.length ? f(b[l]) : null;
435
+ }), O = l >= 0 && l < f.length ? d(f[l]) : null;
435
436
  t.useEffect(() => {
436
- E(0);
437
- }, [I, b.length]);
437
+ k(0);
438
+ }, [y, f.length]);
438
439
  const q = t.useRef(!1);
439
440
  t.useEffect(() => {
440
441
  if (q.current || !C) return;
441
- const a = b.findIndex((m) => f(m) === C);
442
- a >= 0 && (E(a), F.scrollToIndex(a, { align: "center" }), q.current = !0);
443
- }, [C, b, f, F]);
444
- const T = t.useRef(!1);
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);
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
+ $.current && l >= 0 && l < f.length && F.scrollToIndex(l, { align: "auto" }), $.current = !1;
448
+ }, [l, 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(), $.current = !0, k(
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(), $.current = !0, k((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(), l >= 0 && l < f.length) {
465
+ const N = d(f[l]);
466
+ R(N === C ? "" : N), P(!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(), $.current = !0, k(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(), $.current = !0, k(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]);
478
- const O = t.useMemo(() => {
477
+ return a.addEventListener("keydown", b, { capture: !0 }), () => a.removeEventListener("keydown", b, { capture: !0 });
478
+ }, [f, l, C, R, P, d]);
479
+ const z = 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 = z.get(a);
487
+ b !== void 0 && k(b);
487
488
  },
488
- [O]
489
- ), x = t.useCallback(
490
- (a) => (O.get(a) ?? 0) + 1,
491
- [O]
492
- ), $ = b.length, U = t.useMemo(
489
+ [z]
490
+ ), g = t.useCallback(
491
+ (a) => (z.get(a) ?? 0) + 1,
492
+ [z]
493
+ ), j = f.length, U = t.useMemo(
493
494
  () => ({
494
- activeValue: j,
495
+ activeValue: O,
495
496
  onItemPointerMove: H,
496
- idPrefix: z,
497
- filteredCount: $,
498
- getItemPosition: x
497
+ idPrefix: T,
498
+ filteredCount: j,
499
+ getItemPosition: g
499
500
  }),
500
- [j, H, z, $, x]
501
- ), W = j != null ? `${z}item-${j}` : void 0;
502
- return t.useEffect(() => (L(W), () => L(void 0)), [W, L]), b.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(
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
+ p
509
510
  ),
510
- "data-hook": w,
511
+ "data-hook": v,
511
512
  "data-slot": "combobox-virtual-list",
512
513
  role: "listbox",
513
- children: p
514
+ children: m
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
+ p
522
523
  ),
523
- "data-hook": w,
524
+ "data-hook": v,
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
+ y
544
545
  )
545
546
  },
546
547
  a.key
@@ -592,54 +593,55 @@ const ye = t.forwardRef(
592
593
  className: i,
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: 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);
599
601
  t.useEffect(() => {
600
- S.current = y, I.current = v;
601
- }, [y, v]);
602
- const R = !!C;
602
+ y.current = I, E.current = C;
603
+ }, [I, C]);
604
+ const S = !!R;
603
605
  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);
609
- }, 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(
610
612
  o,
611
613
  c,
612
614
  s || "text-sm leading-normal font-semibold"
613
615
  ) : o;
614
- if (C) {
615
- const N = C.activeValue === e, l = !!d.disabled;
616
+ if (R) {
617
+ const l = R.activeValue === e, k = !!v.disabled;
616
618
  return /* @__PURE__ */ B(
617
619
  "div",
618
620
  {
619
- ref: w,
620
- "aria-disabled": l || void 0,
621
- "aria-posinset": C.getItemPosition(e),
621
+ ref: M,
622
+ "aria-disabled": k || void 0,
623
+ "aria-posinset": R.getItemPosition(e),
622
624
  "aria-selected": P,
623
- "aria-setsize": C.filteredCount,
625
+ "aria-setsize": R.filteredCount,
624
626
  className: A(
625
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",
626
628
  "[&_svg]:pointer-events-none [&_svg]:shrink-0",
627
- l && "pointer-events-none opacity-50",
629
+ k && "pointer-events-none opacity-50",
628
630
  i
629
631
  ),
630
- "data-highlighted": N || void 0,
632
+ "data-highlighted": l || void 0,
631
633
  "data-hook": n,
632
634
  "data-slot": "combobox-item",
633
- id: `${C.idPrefix}item-${e}`,
635
+ id: `${R.idPrefix}item-${e}`,
634
636
  role: "option",
635
637
  tabIndex: -1,
636
- onClick: l ? void 0 : L,
637
- onKeyDown: l ? void 0 : (E) => {
638
- (E.key === "Enter" || E.key === " ") && L();
638
+ onClick: k ? void 0 : D,
639
+ onKeyDown: k ? void 0 : (T) => {
640
+ (T.key === "Enter" || T.key === " ") && D();
639
641
  },
640
- onPointerMove: l ? void 0 : () => C.onItemPointerMove(e),
642
+ onPointerMove: k ? void 0 : () => R.onItemPointerMove(e),
641
643
  children: [
642
- M(),
644
+ V(),
643
645
  P && /* @__PURE__ */ u(
644
646
  Y,
645
647
  {
@@ -654,16 +656,16 @@ const ye = t.forwardRef(
654
656
  return /* @__PURE__ */ B(
655
657
  ce,
656
658
  {
657
- ref: w,
659
+ ref: M,
658
660
  className: A("justify-between", i),
659
661
  "data-slot": "combobox-item",
660
662
  dataHook: n,
661
- keywords: p ? [k, ...p] : [k],
663
+ keywords: m ? [w, ...m] : [w],
662
664
  value: e,
663
- onSelect: L,
664
- ...d,
665
+ onSelect: D,
666
+ ...v,
665
667
  children: [
666
- M(),
668
+ V(),
667
669
  P && /* @__PURE__ */ u(
668
670
  Y,
669
671
  {
@@ -679,7 +681,11 @@ const ye = t.forwardRef(
679
681
  ye.displayName = "ComboboxItem";
680
682
  const ke = t.forwardRef((e, r) => /* @__PURE__ */ u(fe, { ref: r, "data-slot": "combobox-separator", ...e }));
681
683
  ke.displayName = "ComboboxSeparator";
682
- function je({ className: e, children: r }) {
684
+ function je({
685
+ className: e,
686
+ children: r,
687
+ loadingText: n
688
+ }) {
683
689
  return /* @__PURE__ */ u(
684
690
  "div",
685
691
  {
@@ -698,7 +704,7 @@ function je({ className: e, children: r }) {
698
704
  className: "size-4 animate-spin rounded-full border-2 border-current border-t-transparent [animation-duration:0.6s]"
699
705
  }
700
706
  ),
701
- "Loading..."
707
+ n ?? "Loading..."
702
708
  ] })
703
709
  }
704
710
  );