@brightlocal/ui-components 2.9.2 → 2.11.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 (67) hide show
  1. package/README.md +3 -1
  2. package/component-meta.json +41 -9
  3. package/dist/badge.cjs +1 -1
  4. package/dist/badge.d.ts.map +1 -1
  5. package/dist/badge.js +42 -25
  6. package/dist/blocks/sidebar.cjs +1 -1
  7. package/dist/blocks/sidebar.d.ts +1 -3
  8. package/dist/blocks/sidebar.d.ts.map +1 -1
  9. package/dist/blocks/sidebar.js +46 -49
  10. package/dist/browser-entry.d.ts +17 -0
  11. package/dist/browser-entry.d.ts.map +1 -0
  12. package/dist/button.cjs +1 -1
  13. package/dist/button.js +25 -25
  14. package/dist/card.cjs +1 -1
  15. package/dist/card.d.ts +10 -1
  16. package/dist/card.d.ts.map +1 -1
  17. package/dist/card.js +85 -82
  18. package/dist/carousel.cjs +1 -1
  19. package/dist/carousel.d.ts +13 -1
  20. package/dist/carousel.d.ts.map +1 -1
  21. package/dist/carousel.js +196 -150
  22. package/dist/combobox.cjs +3 -3
  23. package/dist/combobox.d.ts +3 -3
  24. package/dist/combobox.d.ts.map +1 -1
  25. package/dist/combobox.js +480 -440
  26. package/dist/command.cjs +1 -1
  27. package/dist/command.d.ts +101 -1
  28. package/dist/command.d.ts.map +1 -1
  29. package/dist/command.js +383 -119
  30. package/dist/hooks/use-breakpoint.cjs +1 -1
  31. package/dist/hooks/use-breakpoint.d.ts.map +1 -1
  32. package/dist/hooks/use-breakpoint.js +10 -10
  33. package/dist/index.cjs +1 -1
  34. package/dist/index.d.ts +1 -0
  35. package/dist/index.d.ts.map +1 -1
  36. package/dist/index.js +402 -391
  37. package/dist/input-chip.cjs +1 -1
  38. package/dist/input-chip.d.ts +1 -4
  39. package/dist/input-chip.d.ts.map +1 -1
  40. package/dist/input-chip.js +163 -170
  41. package/dist/map.cjs +1 -0
  42. package/dist/map.d.ts +192 -0
  43. package/dist/map.d.ts.map +1 -0
  44. package/dist/map.js +250 -0
  45. package/dist/sonner.cjs +1 -1
  46. package/dist/sonner.d.ts.map +1 -1
  47. package/dist/sonner.js +32 -30
  48. package/dist/tabs.cjs +1 -1
  49. package/dist/tabs.d.ts +4 -0
  50. package/dist/tabs.d.ts.map +1 -1
  51. package/dist/tabs.js +101 -52
  52. package/package.json +4 -1
  53. package/src/blocks/sidebar.tsx +21 -26
  54. package/src/browser-entry.ts +89 -0
  55. package/src/browser-tokens.css +1 -0
  56. package/src/components/badge.tsx +22 -5
  57. package/src/components/button.tsx +13 -13
  58. package/src/components/card.tsx +35 -19
  59. package/src/components/carousel.tsx +101 -9
  60. package/src/components/combobox.tsx +106 -28
  61. package/src/components/command.tsx +637 -16
  62. package/src/components/input-chip.tsx +102 -65
  63. package/src/components/map.tsx +574 -0
  64. package/src/components/sonner.tsx +9 -3
  65. package/src/components/tabs.tsx +118 -22
  66. package/src/hooks/use-breakpoint.ts +2 -3
  67. package/src/index.ts +1 -0
package/dist/command.js CHANGED
@@ -1,76 +1,117 @@
1
- import { jsx as n, jsxs as x } from "react/jsx-runtime";
2
- import * as r from "react";
3
- import { Command as s } from "cmdk";
4
- import { Search as v, X as w, Check as R } from "@brightlocal/icons";
5
- import { Button as I } from "@brightlocal/ui-components/button";
6
- import { cn as l } from "@brightlocal/ui-components/lib/utils";
7
- const S = r.forwardRef(({ className: e, dataHook: t, trackingEl: a, trackingLabel: o, ...d }, m) => /* @__PURE__ */ n(
8
- s,
9
- {
10
- ref: m,
11
- className: l(
12
- "bg-popover text-popover-foreground flex w-full flex-col overflow-hidden rounded-lg border shadow-md",
13
- e
14
- ),
15
- "data-hook": t,
16
- "data-slot": "command",
17
- "data-tracking-el": a,
18
- "data-tracking-label": o,
19
- ...d
1
+ import { jsx as c, jsxs as _ } from "react/jsx-runtime";
2
+ import * as e from "react";
3
+ import { Command as E, defaultFilter as B } from "cmdk";
4
+ import { useVirtualizer as U } from "@tanstack/react-virtual";
5
+ import { Search as W, X, Check as F } from "@brightlocal/icons";
6
+ import { Button as Y } from "@brightlocal/ui-components/button";
7
+ import { cn as y } from "@brightlocal/ui-components/lib/utils";
8
+ import { useDevWarning as q } from "@brightlocal/ui-components/lib/use-dev-warning";
9
+ const T = e.createContext({
10
+ searchValue: "",
11
+ setSearchValue: () => {
12
+ },
13
+ activeDescendantId: void 0,
14
+ setActiveDescendantId: () => {
15
+ },
16
+ listboxId: void 0,
17
+ setListboxId: () => {
20
18
  }
21
- ));
22
- S.displayName = "Command";
23
- const _ = r.forwardRef(
19
+ }), J = e.forwardRef(({ className: t, dataHook: n, trackingEl: a, trackingLabel: r, ...s }, u) => {
20
+ const [g, p] = e.useState(""), [C, I] = e.useState(void 0), [v, N] = e.useState(
21
+ void 0
22
+ ), b = e.useMemo(
23
+ () => ({
24
+ searchValue: g,
25
+ setSearchValue: p,
26
+ activeDescendantId: C,
27
+ setActiveDescendantId: I,
28
+ listboxId: v,
29
+ setListboxId: N
30
+ }),
31
+ [g, C, v]
32
+ );
33
+ return /* @__PURE__ */ c(T.Provider, { value: b, children: /* @__PURE__ */ c(
34
+ E,
35
+ {
36
+ ref: u,
37
+ className: y(
38
+ "bg-popover text-popover-foreground flex w-full flex-col overflow-hidden rounded-lg border shadow-md",
39
+ t
40
+ ),
41
+ "data-hook": n,
42
+ "data-slot": "command",
43
+ "data-tracking-el": a,
44
+ "data-tracking-label": r,
45
+ ...s
46
+ }
47
+ ) });
48
+ });
49
+ J.displayName = "Command";
50
+ const Q = e.forwardRef(
24
51
  ({
25
- className: e,
26
- dataHook: t,
52
+ className: t,
53
+ dataHook: n,
27
54
  trackingEl: a,
28
- trackingLabel: o,
29
- value: d,
30
- onValueChange: m,
31
- onClear: c,
32
- ...i
33
- }, k) => {
34
- const u = r.useRef(null), [C, f] = r.useState("");
35
- r.useImperativeHandle(k, () => u.current, []);
36
- const p = d !== void 0, g = p ? d : C, b = String(g).length > 0, y = (h) => {
37
- p || f(h), m?.(h);
38
- }, N = () => {
39
- p || f(""), m?.(""), c?.(), u.current?.focus();
55
+ trackingLabel: r,
56
+ value: s,
57
+ onValueChange: u,
58
+ onClear: g,
59
+ debounceMs: p,
60
+ ...C
61
+ }, I) => {
62
+ const v = e.useRef(null), [N, b] = e.useState(""), h = e.useRef(
63
+ void 0
64
+ ), { setSearchValue: m, activeDescendantId: w, listboxId: x } = e.useContext(T);
65
+ e.useImperativeHandle(I, () => v.current, []), q(
66
+ () => !!(p && p > 0 && s !== void 0),
67
+ "debounceMs is set on <CommandInput> 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.",
68
+ [p, s]
69
+ ), e.useEffect(() => () => {
70
+ h.current && clearTimeout(h.current);
71
+ }, []), e.useEffect(() => {
72
+ const o = v.current;
73
+ o && (x && o.setAttribute("aria-controls", x), w ? o.setAttribute("aria-activedescendant", w) : o.removeAttribute("aria-activedescendant"));
74
+ });
75
+ const l = s !== void 0, S = l ? s : N, D = String(S).length > 0, A = (o) => {
76
+ l || b(o), m(o), p && p > 0 ? (clearTimeout(h.current), h.current = setTimeout(() => {
77
+ u?.(o);
78
+ }, p)) : u?.(o);
79
+ }, M = () => {
80
+ l || b(""), m(""), clearTimeout(h.current), u?.(""), g?.(), v.current?.focus();
40
81
  };
41
- return /* @__PURE__ */ x(
82
+ return /* @__PURE__ */ _(
42
83
  "div",
43
84
  {
44
85
  className: "border-base-border flex h-12 items-center gap-2 self-stretch border-b px-3",
45
- "data-hook": t,
86
+ "data-hook": n,
46
87
  "data-slot": "command-input-wrapper",
47
88
  children: [
48
- /* @__PURE__ */ n(v, { className: "shrink-0 opacity-50" }),
49
- /* @__PURE__ */ n(
50
- s.Input,
89
+ /* @__PURE__ */ c(W, { className: "shrink-0 opacity-50" }),
90
+ /* @__PURE__ */ c(
91
+ E.Input,
51
92
  {
52
- ref: u,
53
- className: l(
93
+ ref: v,
94
+ className: y(
54
95
  "placeholder:text-muted-foreground flex w-full bg-transparent text-base outline-hidden disabled:cursor-not-allowed disabled:opacity-50",
55
- e
96
+ t
56
97
  ),
57
98
  "data-slot": "command-input",
58
99
  "data-tracking-el": a,
59
- "data-tracking-label": o,
60
- value: g,
61
- onValueChange: y,
62
- ...i
100
+ "data-tracking-label": r,
101
+ value: S,
102
+ onValueChange: A,
103
+ ...C
63
104
  }
64
105
  ),
65
- b && /* @__PURE__ */ n(
66
- I,
106
+ D && /* @__PURE__ */ c(
107
+ Y,
67
108
  {
68
109
  "aria-label": "Clear search",
69
110
  className: "text-muted-foreground hover:text-foreground",
70
111
  dataHook: "command-input-clear",
71
112
  variant: "ghost",
72
- onClick: N,
73
- children: /* @__PURE__ */ n(w, {})
113
+ onClick: M,
114
+ children: /* @__PURE__ */ c(X, {})
74
115
  }
75
116
  )
76
117
  ]
@@ -78,123 +119,346 @@ const _ = r.forwardRef(
78
119
  );
79
120
  }
80
121
  );
81
- _.displayName = "CommandInput";
82
- const E = r.forwardRef(({ className: e, dataHook: t, ...a }, o) => /* @__PURE__ */ n(
83
- s.List,
122
+ Q.displayName = "CommandInput";
123
+ const Z = e.forwardRef(({ className: t, dataHook: n, ...a }, r) => /* @__PURE__ */ c(
124
+ E.List,
84
125
  {
85
- ref: o,
86
- className: l(
126
+ ref: r,
127
+ className: y(
87
128
  "max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto",
88
- e
129
+ t
89
130
  ),
90
- "data-hook": t,
131
+ "data-hook": n,
91
132
  "data-slot": "command-list",
92
133
  ...a
93
134
  }
94
135
  ));
95
- E.displayName = "CommandList";
96
- const G = r.forwardRef(({ dataHook: e, ...t }, a) => {
97
- const o = r.useCallback(
98
- (d) => {
99
- d?.setAttribute("role", "option"), typeof a == "function" ? a(d) : a && (a.current = d);
136
+ Z.displayName = "CommandList";
137
+ const ee = e.forwardRef(({ dataHook: t, ...n }, a) => {
138
+ const r = e.useCallback(
139
+ (s) => {
140
+ s?.setAttribute("role", "option"), typeof a == "function" ? a(s) : a && (a.current = s);
100
141
  },
101
142
  [a]
102
143
  );
103
- return /* @__PURE__ */ n(
104
- s.Empty,
144
+ return /* @__PURE__ */ c(
145
+ E.Empty,
105
146
  {
106
- ref: o,
147
+ ref: r,
107
148
  "aria-disabled": "true",
108
149
  "aria-selected": "false",
109
150
  className: "py-6 text-center text-sm",
110
- "data-hook": e,
151
+ "data-hook": t,
111
152
  "data-slot": "command-empty",
112
- ...t
153
+ ...n
113
154
  }
114
155
  );
115
156
  });
116
- G.displayName = "CommandEmpty";
117
- const L = r.forwardRef(({ className: e, dataHook: t, ...a }, o) => /* @__PURE__ */ n(
118
- s.Group,
157
+ ee.displayName = "CommandEmpty";
158
+ const te = e.forwardRef(({ className: t, dataHook: n, ...a }, r) => /* @__PURE__ */ c(
159
+ E.Group,
119
160
  {
120
- ref: o,
121
- className: l(
161
+ ref: r,
162
+ className: y(
122
163
  "text-foreground [&_[cmdk-group-heading]]:text-muted-foreground overflow-hidden px-2 py-1 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium",
123
- e
164
+ t
124
165
  ),
125
- "data-hook": t,
166
+ "data-hook": n,
126
167
  "data-slot": "command-group",
127
168
  ...a
128
169
  }
129
170
  ));
130
- L.displayName = "CommandGroup";
131
- const j = r.forwardRef(({ className: e, dataHook: t, ...a }, o) => /* @__PURE__ */ n(
132
- s.Separator,
171
+ te.displayName = "CommandGroup";
172
+ const ae = e.forwardRef(({ className: t, dataHook: n, ...a }, r) => /* @__PURE__ */ c(
173
+ E.Separator,
133
174
  {
134
- ref: o,
135
- className: l("bg-border -mx-1 h-px", e),
136
- "data-hook": t,
175
+ ref: r,
176
+ className: y("bg-border -mx-1 h-px", t),
177
+ "data-hook": n,
137
178
  "data-slot": "command-separator",
138
179
  ...a
139
180
  }
140
181
  ));
141
- j.displayName = "CommandSeparator";
142
- const B = r.forwardRef(
182
+ ae.displayName = "CommandSeparator";
183
+ const oe = e.forwardRef(
143
184
  ({
144
- className: e,
145
- dataHook: t,
185
+ className: t,
186
+ dataHook: n,
146
187
  trackingEl: a,
147
- trackingLabel: o,
148
- selected: d,
149
- children: m,
150
- ...c
151
- }, i) => /* @__PURE__ */ x(
152
- s.Item,
188
+ trackingLabel: r,
189
+ selected: s,
190
+ children: u,
191
+ ...g
192
+ }, p) => /* @__PURE__ */ _(
193
+ E.Item,
153
194
  {
154
- ref: i,
155
- className: l(
195
+ ref: p,
196
+ className: y(
156
197
  "data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-3 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0",
157
- e
198
+ t
158
199
  ),
159
- "data-hook": t,
160
- "data-selected-item": d || void 0,
200
+ "data-hook": n,
201
+ "data-selected-item": s || void 0,
161
202
  "data-slot": "command-item",
162
203
  "data-tracking-el": a,
163
- "data-tracking-label": o,
164
- ...c,
204
+ "data-tracking-label": r,
205
+ ...g,
165
206
  children: [
166
- m,
167
- d && /* @__PURE__ */ n(R, { className: "text-foreground ml-auto" })
207
+ u,
208
+ s && /* @__PURE__ */ c(F, { className: "text-foreground ml-auto" })
168
209
  ]
169
210
  }
170
211
  )
171
212
  );
172
- B.displayName = "CommandItem";
173
- const H = r.forwardRef(
174
- ({ className: e, dataHook: t, trackingEl: a, trackingLabel: o, ...d }, m) => /* @__PURE__ */ n(
213
+ oe.displayName = "CommandItem";
214
+ const ne = e.forwardRef(
215
+ ({ className: t, dataHook: n, trackingEl: a, trackingLabel: r, ...s }, u) => /* @__PURE__ */ c(
175
216
  "span",
176
217
  {
177
- ref: m,
178
- className: l(
218
+ ref: u,
219
+ className: y(
179
220
  "text-muted-foreground ml-auto text-xs tracking-widest",
180
- e
221
+ t
181
222
  ),
182
- "data-hook": t,
223
+ "data-hook": n,
183
224
  "data-slot": "command-shortcut",
184
225
  "data-tracking-el": a,
185
- "data-tracking-label": o,
186
- ...d
226
+ "data-tracking-label": r,
227
+ ...s
187
228
  }
188
229
  )
189
230
  );
190
- H.displayName = "CommandShortcut";
231
+ ne.displayName = "CommandShortcut";
232
+ const K = e.createContext(null);
233
+ function re({
234
+ items: t,
235
+ getItemValue: n,
236
+ getItemLabel: a,
237
+ getItemKeywords: r,
238
+ estimateSize: s = 44,
239
+ overscan: u = 5,
240
+ children: g,
241
+ renderEmpty: p,
242
+ "aria-label": C,
243
+ className: I,
244
+ dataHook: v
245
+ }, N) {
246
+ const b = e.useRef(null), { searchValue: h, setActiveDescendantId: m, setListboxId: w } = e.useContext(T), [x, l] = e.useState(0), S = e.useId(), D = e.useId(), A = e.useRef(/* @__PURE__ */ new Map());
247
+ e.useImperativeHandle(N, () => b.current, []);
248
+ const M = e.useMemo(
249
+ () => a ?? n,
250
+ [a, n]
251
+ ), o = e.useMemo(() => {
252
+ if (!h.trim()) return t;
253
+ const d = [];
254
+ for (const f of t) {
255
+ let i = B(M(f), h);
256
+ if (r)
257
+ for (const k of r(f))
258
+ i = Math.max(i, B(k, h));
259
+ i > 0 && d.push({ item: f, score: i });
260
+ }
261
+ return d.sort((f, i) => i.score - f.score), d.map((f) => f.item);
262
+ }, [t, h, M, r]), L = U({
263
+ count: o.length,
264
+ getScrollElement: () => b.current,
265
+ estimateSize: () => s,
266
+ overscan: u
267
+ }), R = x >= 0 && x < o.length ? n(o[x]) : null;
268
+ e.useEffect(() => {
269
+ l(0);
270
+ }, [h, o.length]);
271
+ const P = e.useRef(!1);
272
+ e.useEffect(() => {
273
+ P.current && x >= 0 && x < o.length && L.scrollToIndex(x, { align: "auto" }), P.current = !1;
274
+ }, [x, o.length, L]), e.useEffect(() => {
275
+ const d = b.current?.closest(
276
+ '[data-slot="command"]'
277
+ );
278
+ if (!d) return;
279
+ const f = (i) => {
280
+ switch (i.key) {
281
+ case "ArrowDown":
282
+ i.preventDefault(), i.stopPropagation(), P.current = !0, l(
283
+ (k) => k < o.length - 1 ? k + 1 : k
284
+ );
285
+ break;
286
+ case "ArrowUp":
287
+ i.preventDefault(), i.stopPropagation(), P.current = !0, l((k) => k > 0 ? k - 1 : k);
288
+ break;
289
+ case "Enter": {
290
+ i.preventDefault(), i.stopPropagation(), R != null && A.current.get(R)?.();
291
+ break;
292
+ }
293
+ case "Home":
294
+ i.preventDefault(), i.stopPropagation(), P.current = !0, l(0);
295
+ break;
296
+ case "End":
297
+ i.preventDefault(), i.stopPropagation(), P.current = !0, l(o.length - 1);
298
+ break;
299
+ }
300
+ };
301
+ return d.addEventListener("keydown", f, { capture: !0 }), () => d.removeEventListener("keydown", f, { capture: !0 });
302
+ }, [o, R]);
303
+ const V = e.useMemo(() => {
304
+ const d = /* @__PURE__ */ new Map();
305
+ return o.forEach((f, i) => {
306
+ d.set(n(f), i);
307
+ }), d;
308
+ }, [o, n]), $ = e.useCallback(
309
+ (d) => {
310
+ const f = V.get(d);
311
+ f !== void 0 && l(f);
312
+ },
313
+ [V]
314
+ ), z = e.useCallback(
315
+ (d) => (V.get(d) ?? 0) + 1,
316
+ [V]
317
+ ), H = o.length, O = e.useMemo(
318
+ () => ({
319
+ activeValue: R,
320
+ onItemPointerMove: $,
321
+ idPrefix: S,
322
+ filteredCount: H,
323
+ getItemPosition: z,
324
+ onSelectCallbacks: A
325
+ }),
326
+ [R, $, S, H, z]
327
+ ), G = R != null ? `${S}item-${R}` : void 0;
328
+ e.useEffect(() => (m(G), () => m(void 0)), [G, m]), e.useEffect(() => (w(D), () => w(void 0)), [D, w]);
329
+ const j = y(
330
+ "scrollbar max-h-[300px] min-h-0 flex-1 scroll-py-1 overflow-x-hidden overflow-y-auto py-1",
331
+ I
332
+ );
333
+ return o.length === 0 ? /* @__PURE__ */ c(
334
+ "div",
335
+ {
336
+ ref: b,
337
+ "aria-label": C,
338
+ className: j,
339
+ "data-hook": v,
340
+ "data-slot": "command-virtual-list",
341
+ id: D,
342
+ role: "listbox",
343
+ tabIndex: -1,
344
+ children: p
345
+ }
346
+ ) : /* @__PURE__ */ c(K.Provider, { value: O, children: /* @__PURE__ */ c(
347
+ "div",
348
+ {
349
+ ref: b,
350
+ "aria-label": C,
351
+ className: j,
352
+ "data-hook": v,
353
+ "data-slot": "command-virtual-list",
354
+ id: D,
355
+ role: "listbox",
356
+ tabIndex: -1,
357
+ children: /* @__PURE__ */ c(
358
+ "div",
359
+ {
360
+ className: "relative w-full",
361
+ style: { height: `${L.getTotalSize()}px` },
362
+ children: L.getVirtualItems().map((d) => /* @__PURE__ */ c(
363
+ "div",
364
+ {
365
+ ref: L.measureElement,
366
+ className: "absolute top-0 left-0 w-full px-2",
367
+ "data-index": d.index,
368
+ style: {
369
+ transform: `translateY(${d.start}px)`
370
+ },
371
+ children: g(
372
+ o[d.index],
373
+ d.index,
374
+ h
375
+ )
376
+ },
377
+ d.key
378
+ ))
379
+ }
380
+ )
381
+ }
382
+ ) });
383
+ }
384
+ const pe = e.forwardRef(re), se = e.forwardRef(
385
+ ({
386
+ value: t,
387
+ dataHook: n,
388
+ trackingEl: a,
389
+ trackingLabel: r,
390
+ selected: s,
391
+ disabled: u,
392
+ onSelect: g,
393
+ children: p,
394
+ className: C,
395
+ onClick: I,
396
+ onKeyDown: v,
397
+ onPointerMove: N,
398
+ ...b
399
+ }, h) => {
400
+ const m = e.useContext(K), w = m?.activeValue === t, x = e.useRef(g);
401
+ return e.useEffect(() => {
402
+ x.current = g;
403
+ }), e.useEffect(() => {
404
+ if (m)
405
+ return m.onSelectCallbacks.current.set(
406
+ t,
407
+ () => x.current?.()
408
+ ), () => {
409
+ m.onSelectCallbacks.current.delete(t);
410
+ };
411
+ }, [t, m]), /* @__PURE__ */ _(
412
+ "div",
413
+ {
414
+ ref: h,
415
+ ...b,
416
+ "aria-disabled": u || void 0,
417
+ "aria-posinset": m?.getItemPosition(t),
418
+ "aria-selected": s || void 0,
419
+ "aria-setsize": m?.filteredCount,
420
+ className: y(
421
+ "data-[highlighted=true]:bg-accent data-[highlighted=true]:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-3 text-sm outline-hidden select-none",
422
+ "[&_svg]:pointer-events-none [&_svg]:shrink-0",
423
+ u && "pointer-events-none opacity-50",
424
+ C
425
+ ),
426
+ "data-highlighted": w || void 0,
427
+ "data-hook": n,
428
+ "data-selected-item": s || void 0,
429
+ "data-slot": "command-virtual-item",
430
+ "data-tracking-el": a,
431
+ "data-tracking-label": r,
432
+ id: m ? `${m.idPrefix}item-${t}` : void 0,
433
+ role: "option",
434
+ tabIndex: -1,
435
+ onClick: u ? void 0 : (l) => {
436
+ g?.(), I?.(l);
437
+ },
438
+ onKeyDown: u ? void 0 : (l) => {
439
+ (l.key === "Enter" || l.key === " ") && g?.(), v?.(l);
440
+ },
441
+ onPointerMove: u ? void 0 : (l) => {
442
+ m?.onItemPointerMove(t), N?.(l);
443
+ },
444
+ children: [
445
+ p,
446
+ s && /* @__PURE__ */ c(F, { className: "text-foreground ml-auto" })
447
+ ]
448
+ }
449
+ );
450
+ }
451
+ );
452
+ se.displayName = "CommandVirtualItem";
191
453
  export {
192
- S as Command,
193
- G as CommandEmpty,
194
- L as CommandGroup,
195
- _ as CommandInput,
196
- B as CommandItem,
197
- E as CommandList,
198
- j as CommandSeparator,
199
- H as CommandShortcut
454
+ J as Command,
455
+ ee as CommandEmpty,
456
+ te as CommandGroup,
457
+ Q as CommandInput,
458
+ oe as CommandItem,
459
+ Z as CommandList,
460
+ ae as CommandSeparator,
461
+ ne as CommandShortcut,
462
+ se as CommandVirtualItem,
463
+ pe as CommandVirtualList
200
464
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react");function d(e){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const o=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,o.get?o:{enumerable:!0,get:()=>e[t]})}}return n.default=e,Object.freeze(n)}const u=d(s),c={sm:640,md:768,lg:1024,xl:1280,"2xl":1536};function r(e="sm"){if(typeof document>"u")return c[e];const n=getComputedStyle(document.documentElement).getPropertyValue(`--ds-breakpoint-${e}`).trim(),t=parseInt(n,10);return Number.isNaN(t)?c[e]:t}function l(e="sm"){return typeof window<"u"&&window.innerWidth<r(e)}function p(e="sm"){const[n,t]=u.useState(void 0);return u.useEffect(()=>{const o=r(e),i=window.matchMedia(`(max-width: ${o-1}px)`),a=()=>{t(window.innerWidth<o)};return i.addEventListener("change",a),t(window.innerWidth<o),()=>i.removeEventListener("change",a)},[e]),!!n}exports.getBreakpointValue=r;exports.isBelowBreakpoint=l;exports.useIsBelowBreakpoint=p;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("react");function l(e){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const o=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,o.get?o:{enumerable:!0,get:()=>e[t]})}}return n.default=e,Object.freeze(n)}const u=l(d),c={sm:640,md:768,lg:1024,xl:1280,"2xl":1536};function r(e="sm"){if(typeof document>"u")return c[e];const n=getComputedStyle(document.documentElement).getPropertyValue(`--ds-breakpoint-${e}`).trim(),t=parseInt(n,10);return Number.isNaN(t)?c[e]:t}function s(e="sm"){return typeof window<"u"&&window.innerWidth<r(e)}function p(e="sm"){const[n,t]=u.useState(()=>s(e));return u.useEffect(()=>{const o=r(e),i=window.matchMedia(`(max-width: ${o-1}px)`),a=()=>{t(window.innerWidth<o)};return i.addEventListener("change",a),()=>i.removeEventListener("change",a)},[e]),n}exports.getBreakpointValue=r;exports.isBelowBreakpoint=s;exports.useIsBelowBreakpoint=p;
@@ -1 +1 @@
1
- {"version":3,"file":"use-breakpoint.d.ts","sourceRoot":"","sources":["../../src/hooks/use-breakpoint.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,KAAK,UAAU,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,KAAK,CAAC;AAWpD,wBAAgB,kBAAkB,CAAC,IAAI,GAAE,UAAiB,GAAG,MAAM,CASlE;AAED,wBAAgB,iBAAiB,CAAC,IAAI,GAAE,UAAiB,GAAG,OAAO,CAKlE;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,GAAE,UAAiB,WAe3D;AAED,YAAY,EAAE,UAAU,EAAE,CAAC"}
1
+ {"version":3,"file":"use-breakpoint.d.ts","sourceRoot":"","sources":["../../src/hooks/use-breakpoint.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,KAAK,UAAU,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,KAAK,CAAC;AAWpD,wBAAgB,kBAAkB,CAAC,IAAI,GAAE,UAAiB,GAAG,MAAM,CASlE;AAED,wBAAgB,iBAAiB,CAAC,IAAI,GAAE,UAAiB,GAAG,OAAO,CAKlE;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,GAAE,UAAiB,WAc3D;AAED,YAAY,EAAE,UAAU,EAAE,CAAC"}
@@ -1,5 +1,5 @@
1
- import * as d from "react";
2
- const s = {
1
+ import * as s from "react";
2
+ const d = {
3
3
  sm: 640,
4
4
  md: 768,
5
5
  lg: 1024,
@@ -7,21 +7,21 @@ const s = {
7
7
  "2xl": 1536
8
8
  };
9
9
  function a(e = "sm") {
10
- if (typeof document > "u") return s[e];
11
- const t = getComputedStyle(document.documentElement).getPropertyValue(`--ds-breakpoint-${e}`).trim(), n = parseInt(t, 10);
12
- return Number.isNaN(n) ? s[e] : n;
10
+ if (typeof document > "u") return d[e];
11
+ const n = getComputedStyle(document.documentElement).getPropertyValue(`--ds-breakpoint-${e}`).trim(), t = parseInt(n, 10);
12
+ return Number.isNaN(t) ? d[e] : t;
13
13
  }
14
14
  function u(e = "sm") {
15
15
  return typeof window < "u" && window.innerWidth < a(e);
16
16
  }
17
17
  function c(e = "sm") {
18
- const [t, n] = d.useState(void 0);
19
- return d.useEffect(() => {
18
+ const [n, t] = s.useState(() => u(e));
19
+ return s.useEffect(() => {
20
20
  const o = a(e), r = window.matchMedia(`(max-width: ${o - 1}px)`), i = () => {
21
- n(window.innerWidth < o);
21
+ t(window.innerWidth < o);
22
22
  };
23
- return r.addEventListener("change", i), n(window.innerWidth < o), () => r.removeEventListener("change", i);
24
- }, [e]), !!t;
23
+ return r.addEventListener("change", i), () => r.removeEventListener("change", i);
24
+ }, [e]), n;
25
25
  }
26
26
  export {
27
27
  a as getBreakpointValue,