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