impact-nova 1.2.4 → 1.3.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.
@@ -1,121 +1,115 @@
1
1
  import { jsxs as p, jsx as a, Fragment as st } from "react/jsx-runtime";
2
- import { useState as q, useRef as M, useEffect as F } from "react";
2
+ import { useState as H, useRef as E, useEffect as R } from "react";
3
3
  import * as Y from "@radix-ui/react-popover";
4
4
  import { useVirtualizer as it } from "@tanstack/react-virtual";
5
5
  import at from "./components/LabelWithSequence.js";
6
6
  import rt from "./components/Submenu.js";
7
- import { LoadingSpinner as ot, Cross as ct, ChevronRight as Ve, Search as ut, Info as se } from "../../../icons/index.js";
8
- import { Checkbox as Ne } from "../checkbox.js";
7
+ import { LoadingSpinner as ot, Cross as ct, ChevronRight as Ne, Search as ut, Info as ie } from "../../../icons/index.js";
8
+ import { Checkbox as Pe } from "../checkbox.js";
9
9
  import { Button as dt } from "../button.js";
10
10
  import { cn as O } from "../../../lib/utils.js";
11
11
  import { isInvertedSelection as k, isOptionArray as y, isSelected as ft, getSequence as mt, getLeafOptions as pt } from "./utils/select.js";
12
12
  import { useFlattenOptions as ht } from "./hooks/useFlattenOptions.js";
13
13
  import { useSelectionModel as xt } from "./hooks/useSelectionModel.js";
14
14
  import { useVisibleStats as bt } from "./hooks/useVisibleStats.js";
15
- const gt = (ie) => {
15
+ const gt = (ae) => {
16
16
  const {
17
- options: $,
17
+ options: T,
18
18
  value: J,
19
- defaultValue: Pe,
19
+ defaultValue: Oe,
20
20
  onChange: u,
21
21
  isMulti: f,
22
22
  isDisabled: C,
23
23
  isLoading: A,
24
- isClearable: Oe = !0,
25
- isSearchable: E = !0,
26
- placeholder: Ce = "Select...",
24
+ isClearable: Ce = !0,
25
+ isSearchable: F = !0,
26
+ placeholder: ke = "Select...",
27
27
  // menuPortalTarget is kept for API compatibility but no longer used (Radix handles portalling)
28
28
  menuPortalTarget: vt,
29
- autoFocus: ke,
30
- closeMenuOnSelect: Ae = !f,
31
- defaultMenuIsOpen: De = !1,
32
- scrollToSelectedOnOpen: ae = !1,
29
+ autoFocus: Ae,
30
+ closeMenuOnSelect: De = !f,
31
+ defaultMenuIsOpen: $e = !1,
32
+ scrollToSelectedOnOpen: re = !1,
33
33
  maxSelectableOptions: h,
34
- showSequence: re,
34
+ showSequence: oe,
35
35
  selectionOrder: Te,
36
- label: oe,
37
- isRequired: $e,
36
+ label: ce,
37
+ isRequired: Ge,
38
38
  error: K,
39
- helperText: ce,
39
+ helperText: ue,
40
40
  id: V,
41
- className: Ge,
42
- parentClassName: Ie,
41
+ className: Me,
42
+ parentClassName: ze,
43
43
  onMenuScrollToBottom: Q,
44
- name: ze,
45
- isSelectAllEnabled: ue = !0,
44
+ name: Ie,
45
+ isSelectAllEnabled: de = !0,
46
46
  isReadOnly: b = !1,
47
- searchPosition: R = "menu",
48
- footerContent: de,
49
- onInputChange: Me,
50
- getOptionLabel: fe,
51
- renderOption: me,
52
- onMenuOpen: Fe,
53
- onMenuClose: pe,
54
- labelOrientation: he = "top",
55
- leftContent: xe,
56
- ignoreCase: Ee,
57
- ignoreAccents: Re,
58
- matchFrom: Le,
59
- stringify: je,
47
+ searchPosition: L = "menu",
48
+ footerContent: fe,
49
+ onInputChange: Ee,
50
+ getOptionLabel: me,
51
+ renderOption: pe,
52
+ onMenuOpen: Re,
53
+ onMenuClose: he,
54
+ labelOrientation: xe = "top",
55
+ leftContent: be,
56
+ ignoreCase: Fe,
57
+ ignoreAccents: Le,
58
+ matchFrom: je,
59
+ stringify: He,
60
60
  trim: qe,
61
- filterOption: He,
61
+ filterOption: _e,
62
62
  enableSubMenus: v = !1,
63
63
  enableGroups: N = !1,
64
- fetchError: H,
65
- onRefetch: be,
66
- menuWidth: _e,
67
- onClearAll: ge,
68
- onFocus: Be,
69
- onBlur: We
70
- } = ie, [S, ve] = q(De), [L, _] = q(""), [Ue, Se] = q(null), [d, g] = q(Pe || (f ? [] : null)), [Ye, X] = q(null), Je = M(null), Z = M(null), Ke = M(null), j = M(null), ee = M(null);
71
- F(() => {
64
+ fetchError: q,
65
+ onRefetch: ge,
66
+ menuWidth: Be,
67
+ onClearAll: ve,
68
+ onFocus: We,
69
+ onBlur: Ue
70
+ } = ae, [S, Se] = H($e), [G, _] = H(""), [we, X] = H(void 0), [d, g] = H(Oe || (f ? [] : null)), [Ye, Z] = H(null), Je = E(null), ee = E(null), Ke = E(null), j = E(null), te = E(null);
71
+ R(() => {
72
72
  J !== void 0 && g(J);
73
- }, [J]), F(() => {
73
+ }, [J]), R(() => {
74
74
  let e;
75
- return S && E && R === "menu" && ee.current && (e = setTimeout(() => {
76
- ee.current?.focus();
75
+ return S && F && L === "menu" && te.current && (e = setTimeout(() => {
76
+ te.current?.focus();
77
77
  }, 50)), () => {
78
78
  e && clearTimeout(e);
79
79
  };
80
- }, [S, E, R]), F(() => {
81
- if (S) {
82
- const e = requestAnimationFrame(() => {
83
- Z.current && Se(Z.current.offsetHeight);
84
- });
85
- return () => cancelAnimationFrame(e);
86
- } else
87
- Se(null);
88
- }, [S]);
89
- const { flatOptions: x, isProcessing: P, totalOptionsCount: we, workerSelectAll: Qe } = ht($, L, {
90
- ignoreCase: Ee,
91
- ignoreAccents: Re,
92
- matchFrom: Le,
93
- stringify: je,
80
+ }, [S, F, L]);
81
+ const { flatOptions: x, isProcessing: P, totalOptionsCount: ye, workerSelectAll: Qe } = ht(T, G, {
82
+ ignoreCase: Fe,
83
+ ignoreAccents: Le,
84
+ matchFrom: je,
85
+ stringify: He,
94
86
  trim: qe,
95
- filterOption: He,
87
+ filterOption: _e,
96
88
  enableSubMenus: v,
97
89
  enableGroups: N
98
- }), w = xt(d, f ?? !1), { stats: G, getGroupStats: te } = bt(
90
+ }), w = xt(d, f ?? !1), { stats: M, getGroupStats: le } = bt(
99
91
  x,
100
- we,
101
- L,
92
+ ye,
93
+ G,
102
94
  w,
103
95
  d,
104
96
  f ?? !1
105
97
  ), D = it({
106
98
  count: x.length,
107
99
  getScrollElement: () => j.current,
108
- estimateSize: () => 40,
100
+ estimateSize: () => 34,
109
101
  overscan: 5
110
102
  });
111
- F(() => {
103
+ R(() => {
104
+ S || X(void 0);
105
+ }, [S]), R(() => {
112
106
  if (!S) return;
113
107
  const e = requestAnimationFrame(() => {
114
108
  D.measure();
115
109
  });
116
110
  return () => cancelAnimationFrame(e);
117
- }, [S, D]), F(() => {
118
- if (S && ae && !P && x.length > 0) {
111
+ }, [S, D]), R(() => {
112
+ if (S && re && !P && x.length > 0) {
119
113
  const e = x.findIndex((t) => f ? w.mode === "exclude" ? !w.set.has(t.value) : w.set.has(t.value) : d?.value === t.value);
120
114
  if (e !== -1) {
121
115
  const t = setTimeout(() => {
@@ -124,22 +118,22 @@ const gt = (ie) => {
124
118
  return () => clearTimeout(t);
125
119
  }
126
120
  }
127
- }, [S, ae, P, x.length, f, w.mode, w.set, d, D]);
128
- const I = M(null);
129
- F(() => {
121
+ }, [S, re, P, x.length, f, w.mode, w.set, d, D]);
122
+ const z = E(null);
123
+ R(() => {
130
124
  if (!j.current || !Q) return;
131
125
  const e = () => {
132
126
  if (A || P) return;
133
127
  const { scrollTop: n, scrollHeight: r, clientHeight: s } = j.current;
134
128
  if (r - n - s <= 10) {
135
- if (I.current) return;
136
- Q(), I.current = setTimeout(() => {
137
- I.current = null;
129
+ if (z.current) return;
130
+ Q(), z.current = setTimeout(() => {
131
+ z.current = null;
138
132
  }, 500);
139
133
  }
140
134
  }, t = j.current;
141
135
  return t.addEventListener("scroll", e), !A && !P && e(), () => {
142
- t.removeEventListener("scroll", e), I.current && (clearTimeout(I.current), I.current = null);
136
+ t.removeEventListener("scroll", e), z.current && (clearTimeout(z.current), z.current = null);
143
137
  };
144
138
  }, [
145
139
  Q,
@@ -150,13 +144,13 @@ const gt = (ie) => {
150
144
  ]);
151
145
  const Xe = (e) => {
152
146
  if (!C)
153
- if (ve(e), e)
154
- Fe?.();
147
+ if (Se(e), e)
148
+ Re?.();
155
149
  else {
156
150
  const t = d, n = f && y(d) ? d.map((r) => r.value) : void 0;
157
- pe?.(t, n), _(""), X(null);
151
+ he?.(t, n), _(""), Z(null);
158
152
  }
159
- }, ye = (e) => {
153
+ }, Ve = (e) => {
160
154
  if (!(C || b || e.isDisabled || ("children" in e || "options" in e) && e.isParentSelectable === !1))
161
155
  if (f) {
162
156
  const n = d || [];
@@ -231,10 +225,10 @@ const gt = (ie) => {
231
225
  g(e), u && u(e, {
232
226
  action: "select-option",
233
227
  option: e
234
- }), Ae && (ve(!1), pe?.(e, void 0), _(""));
228
+ }), De && (Se(!1), he?.(e, void 0), _(""));
235
229
  }, Ze = async () => {
236
230
  if (!(!f || C || b)) {
237
- if ($.length > 3e3) {
231
+ if (T.length > 3e3) {
238
232
  try {
239
233
  const e = await Qe(
240
234
  d,
@@ -246,7 +240,7 @@ const gt = (ie) => {
246
240
  }
247
241
  return;
248
242
  }
249
- if (L) {
243
+ if (G) {
250
244
  let e = !1;
251
245
  for (const n of x)
252
246
  if (!n.isGroup && !n.isSubmenuParent && !n.isDisabled) {
@@ -257,7 +251,7 @@ const gt = (ie) => {
257
251
  return;
258
252
  const t = d || [];
259
253
  if (k(t)) {
260
- const n = t.excludedValues, { totalVisible: r, selectedVisible: s } = G, l = r > 0 && r === s;
254
+ const n = t.excludedValues, { totalVisible: r, selectedVisible: s } = M, l = r > 0 && r === s;
261
255
  let i = [...n];
262
256
  if (l)
263
257
  for (const o of x)
@@ -274,7 +268,7 @@ const gt = (ie) => {
274
268
  };
275
269
  g(c), u && u(c, { action: "select-option" });
276
270
  } else if (y(t)) {
277
- const n = t, { totalVisible: r, selectedVisible: s } = G, l = r > 0 && r === s;
271
+ const n = t, { totalVisible: r, selectedVisible: s } = M, l = r > 0 && r === s;
278
272
  let i = [...n];
279
273
  if (l) {
280
274
  const c = /* @__PURE__ */ new Set();
@@ -291,7 +285,7 @@ const gt = (ie) => {
291
285
  g(i), u && u(i, { action: "select-option" });
292
286
  }
293
287
  } else if (h) {
294
- const e = d, { totalVisible: t } = G, n = y(e) ? e.length : 0, r = Math.min(t, h);
288
+ const e = d, { totalVisible: t } = M, n = y(e) ? e.length : 0, r = Math.min(t, h);
295
289
  if (y(e) && n >= r && n > 0) {
296
290
  const s = e.filter((l) => l.isDisabled);
297
291
  g(s), u && u(s, {
@@ -311,7 +305,7 @@ const gt = (ie) => {
311
305
  }
312
306
  } else {
313
307
  const e = d, t = k(e) && e.excludedValues.length === 0;
314
- if (ie.enableInvertedSelection)
308
+ if (ae.enableInvertedSelection)
315
309
  if (t) {
316
310
  const n = y(e) ? e.filter((r) => r.isDisabled) : [];
317
311
  g(n), u && u(n, {
@@ -327,7 +321,7 @@ const gt = (ie) => {
327
321
  g(r), u && u(r, { action: "select-option" });
328
322
  }
329
323
  else {
330
- const { totalVisible: n, selectedVisible: r } = G;
324
+ const { totalVisible: n, selectedVisible: r } = M;
331
325
  if (n > 0 && n === r) {
332
326
  const s = y(e) ? e.filter((l) => l.isDisabled) : [];
333
327
  g(s), u && u(s, {
@@ -363,9 +357,9 @@ const gt = (ie) => {
363
357
  i.isDisabled && (w.mode === "exclude" ? !w.set.has(i.value) : w.set.has(i.value)) && t.push(i);
364
358
  }
365
359
  };
366
- n($);
360
+ n(T);
367
361
  const r = t;
368
- g(r), u && u(r, { action: "clear" }), ge?.();
362
+ g(r), u && u(r, { action: "clear" }), ve?.();
369
363
  } else {
370
364
  const t = d;
371
365
  if (t) {
@@ -392,23 +386,23 @@ const gt = (ie) => {
392
386
  }
393
387
  }
394
388
  };
395
- if (s($), r?.isDisabled)
389
+ if (s(T), r?.isDisabled)
396
390
  return;
397
391
  }
398
392
  const n = null;
399
- g(n), u && u(n, { action: "clear" }), ge?.();
393
+ g(n), u && u(n, { action: "clear" }), ve?.();
400
394
  }
401
395
  }, tt = (e) => mt(
402
396
  e,
403
- re ?? !1,
397
+ oe ?? !1,
404
398
  f ?? !1,
405
399
  Te,
406
400
  d
407
- ), B = (e) => fe ? fe(e) : e.label, lt = () => {
401
+ ), B = (e) => me ? me(e) : e.label, lt = () => {
408
402
  if (f) {
409
403
  const e = d || [];
410
404
  let t = 0;
411
- return k(e) ? t = we - e.excludedValues.length : y(e) && (t = e.length), t === 0 ? null : t === 1 && y(e) ? /* @__PURE__ */ a("span", { className: "text-[#1f2b4d] text-[14px] font-medium truncate min-w-0 block", children: B(e[0]) }) : /* @__PURE__ */ p("span", { className: "text-[#1f2b4d] text-[14px] font-medium truncate min-w-0 block", children: [
405
+ return k(e) ? t = ye - e.excludedValues.length : y(e) && (t = e.length), t === 0 ? null : t === 1 && y(e) ? /* @__PURE__ */ a("span", { className: "text-[#1f2b4d] text-[14px] font-medium truncate min-w-0 block", children: B(e[0]) }) : /* @__PURE__ */ p("span", { className: "text-[#1f2b4d] text-[14px] font-medium truncate min-w-0 block", children: [
412
406
  "Selected (",
413
407
  t,
414
408
  ")"
@@ -423,26 +417,26 @@ const gt = (ie) => {
423
417
  {
424
418
  className: O(
425
419
  "flex gap-[6px]",
426
- he === "left" ? "w-fit flex-row items-center" : "w-full flex-col",
427
- Ie
420
+ xe === "left" ? "w-fit flex-row items-center" : "w-full flex-col",
421
+ ze
428
422
  ),
429
- onFocus: Be,
430
- onBlur: We,
423
+ onFocus: We,
424
+ onBlur: Ue,
431
425
  tabIndex: C ? -1 : 0,
432
426
  "data-testid": `select-${V || "default"}`,
433
427
  "data-component": "select",
434
428
  children: [
435
- oe && /* @__PURE__ */ p(
429
+ ce && /* @__PURE__ */ p(
436
430
  "label",
437
431
  {
438
432
  className: O(
439
433
  "text-[12px] font-medium text-[#60697d] leading-[18px]",
440
- he === "left" ? "shrink-0" : ""
434
+ xe === "left" ? "shrink-0" : ""
441
435
  ),
442
436
  children: [
443
- oe,
437
+ ce,
444
438
  " ",
445
- $e && /* @__PURE__ */ a("span", { className: "text-[red]", children: "*" })
439
+ Ge && /* @__PURE__ */ a("span", { className: "text-[red]", children: "*" })
446
440
  ]
447
441
  }
448
442
  ),
@@ -458,14 +452,14 @@ const gt = (ie) => {
458
452
  b ? "cursor-default bg-[#f2f4fb]" : "",
459
453
  S ? "ring-1 ring-indigo-500 border-indigo-500" : "",
460
454
  !C && !b && "bg-white",
461
- Ge
455
+ Me
462
456
  ),
463
457
  id: V,
464
458
  "data-component": "select-trigger",
465
459
  "data-disabled": C || void 0,
466
460
  "data-state": S ? "open" : "closed",
467
461
  children: /* @__PURE__ */ p("div", { className: "flex items-center justify-between w-full min-w-0 max-w-full", children: [
468
- xe && /* @__PURE__ */ a("div", { className: "flex items-center text-gray-500 shrink-0", children: xe }),
462
+ be && /* @__PURE__ */ a("div", { className: "flex items-center text-gray-500 shrink-0", children: be }),
469
463
  /* @__PURE__ */ p(
470
464
  "div",
471
465
  {
@@ -478,27 +472,27 @@ const gt = (ie) => {
478
472
  className: "text-[#b4bac7] font-normal text-[14px] truncate min-w-0 block",
479
473
  "data-testid": `select-placeholder-${V || "default"}`,
480
474
  "data-has-value": !1,
481
- children: Ce
475
+ children: ke
482
476
  }
483
477
  ),
484
- E && S && R === "trigger" && !b && /* @__PURE__ */ a(
478
+ F && S && L === "trigger" && !b && /* @__PURE__ */ a(
485
479
  "input",
486
480
  {
487
481
  ref: Ke,
488
482
  type: "text",
489
483
  className: "flex-1 min-w-[50px] border-none p-0 focus:ring-0 text-sm outline-none h-full",
490
- value: L,
484
+ value: G,
491
485
  onChange: (e) => _(e.target.value),
492
486
  onClick: (e) => e.stopPropagation(),
493
- autoFocus: ke,
494
- name: ze || void 0
487
+ autoFocus: Ae,
488
+ name: Ie || void 0
495
489
  }
496
490
  )
497
491
  ]
498
492
  }
499
493
  ),
500
494
  /* @__PURE__ */ a("div", { className: "flex items-center gap-1 text-gray-400 shrink-0", children: !S && (A || P) ? /* @__PURE__ */ a(ot, { size: "14px" }) : /* @__PURE__ */ p(st, { children: [
501
- Oe && !b && (f && (k(
495
+ Ce && !b && (f && (k(
502
496
  d
503
497
  ) && d.isAllSelected || y(d) && d.length > 0) || !f && d) && /* @__PURE__ */ a(
504
498
  "div",
@@ -510,7 +504,7 @@ const gt = (ie) => {
510
504
  }
511
505
  ),
512
506
  /* @__PURE__ */ a(
513
- Ve,
507
+ Ne,
514
508
  {
515
509
  size: "16px",
516
510
  className: O(
@@ -526,7 +520,7 @@ const gt = (ie) => {
526
520
  /* @__PURE__ */ a(Y.Portal, { children: /* @__PURE__ */ p(
527
521
  Y.Content,
528
522
  {
529
- ref: Z,
523
+ ref: ee,
530
524
  side: "bottom",
531
525
  sideOffset: 4,
532
526
  align: "start",
@@ -538,11 +532,12 @@ const gt = (ie) => {
538
532
  onWheel: (e) => e.stopPropagation(),
539
533
  onPointerDown: (e) => e.stopPropagation(),
540
534
  style: {
541
- width: _e || "var(--radix-popover-trigger-width)",
542
- minHeight: Ue ?? void 0
535
+ width: Be || "var(--radix-popover-trigger-width)",
536
+ maxHeight: "var(--radix-popover-content-available-height)",
537
+ minHeight: we ? `${we}px` : void 0
543
538
  },
544
539
  className: O(
545
- "z-50 max-h-80 overflow-hidden rounded-[12px] text-base shadow-[0px_1px_6px_0px_rgba(26,39,124,0.14)] focus:outline-none sm:text-sm flex flex-col border-none pointer-events-auto",
540
+ "z-50 overflow-hidden rounded-[12px] text-base shadow-[0px_1px_6px_0px_rgba(26,39,124,0.14)] focus:outline-none sm:text-sm flex flex-col border-none pointer-events-auto",
546
541
  b ? "bg-[#f5f5f5]" : "bg-white"
547
542
  ),
548
543
  "data-testid": `select-menu-${V || "default"}`,
@@ -554,10 +549,10 @@ const gt = (ie) => {
554
549
  className: O(
555
550
  "flex flex-col z-10 sticky top-0 px-[6px] pt-[8px]",
556
551
  b ? "bg-[#f5f5f5]" : "bg-white",
557
- !H && (E && R === "menu" && !b || f && ue && !b && x.length > 0) ? "border-b border-solid border-gray-100" : ""
552
+ !q && (F && L === "menu" && !b || f && de && !b && x.length > 0) ? "border-b border-solid border-gray-100" : ""
558
553
  ),
559
554
  children: [
560
- E && R === "menu" && !b && !H && /* @__PURE__ */ a(
555
+ F && L === "menu" && !b && !q && /* @__PURE__ */ a(
561
556
  "div",
562
557
  {
563
558
  className: "p-0",
@@ -567,13 +562,14 @@ const gt = (ie) => {
567
562
  /* @__PURE__ */ a(
568
563
  "input",
569
564
  {
570
- ref: ee,
565
+ ref: te,
571
566
  type: "text",
572
567
  className: "block w-full pl-[34px] pr-4 h-[35px] border-none border-b border-primary text-sm outline-none focus:ring-0",
573
568
  placeholder: "Search here...",
574
- value: L,
569
+ value: G,
575
570
  onChange: (e) => {
576
- _(e.target.value), Me?.(e.target.value);
571
+ const t = e.target.value;
572
+ G === "" && t !== "" ? ee.current && X(ee.current.offsetHeight) : t === "" && X(void 0), _(t), Ee?.(t);
577
573
  },
578
574
  onClick: (e) => e.stopPropagation(),
579
575
  "data-testid": `select-search-input-${V || "default"}`
@@ -582,7 +578,7 @@ const gt = (ie) => {
582
578
  ] })
583
579
  }
584
580
  ),
585
- !A && !P && !H && f && ue && !b && x.length > 0 && /* @__PURE__ */ a(
581
+ !A && !P && !q && f && de && !b && x.length > 0 && /* @__PURE__ */ a(
586
582
  "div",
587
583
  {
588
584
  className: "pb-1",
@@ -595,10 +591,10 @@ const gt = (ie) => {
595
591
  "data-testid": `select-select-all-button-${V || "default"}`,
596
592
  children: /* @__PURE__ */ p("div", { className: "flex items-center flex-1", children: [
597
593
  /* @__PURE__ */ a("div", { className: "pointer-events-none flex", children: /* @__PURE__ */ a(
598
- Ne,
594
+ Pe,
599
595
  {
600
596
  checked: (() => {
601
- const { totalVisible: e, selectedVisible: t } = G;
597
+ const { totalVisible: e, selectedVisible: t } = M;
602
598
  if (e === 0) return !1;
603
599
  const n = h ? Math.min(e, h) : e;
604
600
  return t > 0 && t < n ? "indeterminate" : t >= n;
@@ -615,7 +611,7 @@ const gt = (ie) => {
615
611
  className: "text-sm font-medium text-gray-700",
616
612
  "data-testid": `select-select-all-label-${V || "default"}`,
617
613
  children: (() => {
618
- const { totalVisible: e, selectedVisible: t } = G, n = h ? Math.min(e, h) : e;
614
+ const { totalVisible: e, selectedVisible: t } = M, n = h ? Math.min(e, h) : e;
619
615
  return e > 0 && t >= n ? "Unselect All" : "Select All";
620
616
  })()
621
617
  }
@@ -633,17 +629,20 @@ const gt = (ie) => {
633
629
  {
634
630
  ref: j,
635
631
  className: "flex-1 overflow-auto py-1 px-[6px]",
636
- style: { maxHeight: "300px", overscrollBehavior: "contain" },
632
+ style: {
633
+ maxHeight: "297px",
634
+ overscrollBehavior: "contain"
635
+ },
637
636
  onWheel: (e) => e.stopPropagation(),
638
637
  onPointerDown: (e) => e.stopPropagation(),
639
- children: H ? /* @__PURE__ */ p("div", { className: "flex flex-col items-center justify-center py-8 px-4 text-center", children: [
638
+ children: q ? /* @__PURE__ */ p("div", { className: "flex flex-col items-center justify-center py-8 px-4 text-center", children: [
640
639
  /* @__PURE__ */ a("p", { className: "text-sm text-gray-500 font-medium mb-3", children: "Something went wrong" }),
641
- be && /* @__PURE__ */ a(
640
+ ge && /* @__PURE__ */ a(
642
641
  dt,
643
642
  {
644
643
  size: "sm",
645
644
  variant: "outline",
646
- onClick: () => be(),
645
+ onClick: () => ge(),
647
646
  children: "Refetch"
648
647
  }
649
648
  )
@@ -666,9 +665,9 @@ const gt = (ie) => {
666
665
  position: "relative"
667
666
  },
668
667
  children: D.getVirtualItems().map((e) => {
669
- const t = x[e.index], n = f ? w.mode === "exclude" ? !w.set.has(t.value) : w.set.has(t.value) : d?.value === t.value, r = d || [], s = f && h ? k(r) ? !1 : y(r) && r.length >= h : !1, l = t.isDisabled || s && !n && !(N && t.isGroup) && !(v && t.isSubmenuParent), i = N && t.isGroup || v && t.isSubmenuParent ? te(t.original) : void 0, c = i?.selected || 0, o = i?.total || 0, m = c > 0 && c < o, W = t.isParentSelectable !== !1, le = V || "default", U = String(t.value || ""), ne = B(
668
+ const t = x[e.index], n = f ? w.mode === "exclude" ? !w.set.has(t.value) : w.set.has(t.value) : d?.value === t.value, r = d || [], s = f && h ? k(r) ? !1 : y(r) && r.length >= h : !1, l = t.isDisabled || s && !n && !(N && t.isGroup) && !(v && t.isSubmenuParent), i = N && t.isGroup || v && t.isSubmenuParent ? le(t.original) : void 0, c = i?.selected || 0, o = i?.total || 0, m = c > 0 && c < o, W = t.isParentSelectable !== !1, ne = V || "default", U = String(t.value || ""), se = B(
670
669
  t
671
- ), nt = typeof ne == "string" ? ne : U;
670
+ ), nt = typeof se == "string" ? se : U;
672
671
  return /* @__PURE__ */ p(
673
672
  "div",
674
673
  {
@@ -679,7 +678,7 @@ const gt = (ie) => {
679
678
  transform: `translateY(${e.start}px)`,
680
679
  width: "100%"
681
680
  },
682
- "data-testid": `select-option-wrapper-${le}-${U}`,
681
+ "data-testid": `select-option-wrapper-${ne}-${U}`,
683
682
  children: [
684
683
  /* @__PURE__ */ a(
685
684
  "div",
@@ -693,21 +692,21 @@ const gt = (ie) => {
693
692
  paddingLeft: `${t.depth * 16 + 12}px`
694
693
  },
695
694
  onClick: () => {
696
- l || (N && t.isGroup || v && t.isSubmenuParent) && !W || ye(t);
695
+ l || (N && t.isGroup || v && t.isSubmenuParent) && !W || Ve(t);
697
696
  },
698
- onMouseEnter: (T) => {
697
+ onMouseEnter: ($) => {
699
698
  if (v && t.isSubmenuParent) {
700
- X(t.value);
701
- const z = T.currentTarget.getBoundingClientRect();
702
- t.rect = z;
699
+ Z(t.value);
700
+ const I = $.currentTarget.getBoundingClientRect();
701
+ t.rect = I;
703
702
  } else
704
- X(null);
703
+ Z(null);
705
704
  },
706
- "data-testid": `select-option-${le}-${U}`,
705
+ "data-testid": `select-option-${ne}-${U}`,
707
706
  "data-state": n ? "checked" : "unchecked",
708
707
  "data-disabled": l || void 0,
709
708
  "data-component": "select-option",
710
- children: me ? me(
709
+ children: pe ? pe(
711
710
  {
712
711
  onClick: () => {
713
712
  },
@@ -718,7 +717,7 @@ const gt = (ie) => {
718
717
  t
719
718
  ) : /* @__PURE__ */ p("div", { className: "flex items-center flex-1 overflow-hidden", children: [
720
719
  f && (N && t.isGroup || v && t.isSubmenuParent ? W : !0) && /* @__PURE__ */ a(
721
- Ne,
720
+ Pe,
722
721
  {
723
722
  checked: m ? "indeterminate" : n,
724
723
  disabled: l || b,
@@ -726,7 +725,7 @@ const gt = (ie) => {
726
725
  }
727
726
  }
728
727
  ),
729
- re && !(N && t.isGroup) && !(v && t.isSubmenuParent) ? /* @__PURE__ */ a(
728
+ oe && !(N && t.isGroup) && !(v && t.isSubmenuParent) ? /* @__PURE__ */ a(
730
729
  at,
731
730
  {
732
731
  label: B(
@@ -743,16 +742,16 @@ const gt = (ie) => {
743
742
  N && t.isGroup ? "text-xs font-semibold text-gray-400 uppercase tracking-wider" : n && !(v && t.isSubmenuParent) ? "font-medium" : "font-normal",
744
743
  !(N && t.isGroup) && "text-[14px]"
745
744
  ),
746
- "data-testid": `select-option-label-${le}-${U}`,
745
+ "data-testid": `select-option-label-${ne}-${U}`,
747
746
  "data-state": n ? "checked" : "unchecked",
748
747
  title: nt,
749
- children: ne
748
+ children: se
750
749
  }
751
750
  ),
752
751
  (N && t.isGroup || v && t.isSubmenuParent) && c > 0 && /* @__PURE__ */ a("span", { className: "inline-flex items-center justify-center px-1.5 py-0.5 rounded-full text-xs font-medium bg-indigo-100 text-indigo-800", children: c })
753
752
  ] }),
754
753
  v && t.isSubmenuParent && /* @__PURE__ */ a(
755
- Ve,
754
+ Ne,
756
755
  {
757
756
  size: "12px",
758
757
  className: "text-gray-400"
@@ -767,13 +766,13 @@ const gt = (ie) => {
767
766
  parentOption: t,
768
767
  isMulti: !!f,
769
768
  isReadOnly: !!b,
770
- isSelected: (T) => ft(T, d, !!f),
771
- getIndeterminateState: (T) => {
772
- const z = te(T);
773
- return z ? z.selected > 0 && z.selected < z.total : !1;
769
+ isSelected: ($) => ft($, d, !!f),
770
+ getIndeterminateState: ($) => {
771
+ const I = le($);
772
+ return I ? I.selected > 0 && I.selected < I.total : !1;
774
773
  },
775
- getSelectedCount: (T) => te(T)?.selected || 0,
776
- handleSelect: ye,
774
+ getSelectedCount: ($) => le($)?.selected || 0,
775
+ handleSelect: Ve,
777
776
  id: V
778
777
  }
779
778
  )
@@ -786,22 +785,22 @@ const gt = (ie) => {
786
785
  )
787
786
  }
788
787
  ),
789
- (de || h || $.length > 5e3) && /* @__PURE__ */ a("div", { className: "px-3 py-[10px] border-t border-solid border-gray-100 z-10 sticky bottom-0 bg-white", children: h ? /* @__PURE__ */ p("div", { className: "flex items-center gap-2 text-gray-500 px-2", children: [
790
- /* @__PURE__ */ a(se, { size: "12px", className: "text-gray-400" }),
788
+ (fe || h || T.length > 5e3) && /* @__PURE__ */ a("div", { className: "px-3 py-[10px] border-t border-solid border-gray-100 z-10 sticky bottom-0 bg-white", children: h ? /* @__PURE__ */ p("div", { className: "flex items-center gap-2 text-gray-500 px-2", children: [
789
+ /* @__PURE__ */ a(ie, { size: "12px", className: "text-gray-400" }),
791
790
  /* @__PURE__ */ p("span", { className: "text-xs font-medium leading-4 text-[#60697d]", children: [
792
791
  "Maximum ",
793
792
  h,
794
793
  " selections"
795
794
  ] })
796
- ] }) : $.length > 5e3 ? /* @__PURE__ */ p("div", { className: "flex items-center gap-2 text-gray-500 px-2", children: [
797
- /* @__PURE__ */ a(se, { size: "12px", className: "text-gray-400" }),
795
+ ] }) : T.length > 5e3 ? /* @__PURE__ */ p("div", { className: "flex items-center gap-2 text-gray-500 px-2", children: [
796
+ /* @__PURE__ */ a(ie, { size: "12px", className: "text-gray-400" }),
798
797
  /* @__PURE__ */ a("span", { className: "text-xs font-medium leading-4 text-[#60697d]", children: "Large dataset detected. Operations might be slower." })
799
- ] }) : de })
798
+ ] }) : fe })
800
799
  ]
801
800
  }
802
801
  ) })
803
802
  ] }),
804
- ce && /* @__PURE__ */ p(
803
+ ue && /* @__PURE__ */ p(
805
804
  "p",
806
805
  {
807
806
  className: O(
@@ -809,8 +808,8 @@ const gt = (ie) => {
809
808
  K ? "text-[#e15554]" : "text-gray-500"
810
809
  ),
811
810
  children: [
812
- K && /* @__PURE__ */ a(se, { size: "12px" }),
813
- ce
811
+ K && /* @__PURE__ */ a(ie, { size: "12px" }),
812
+ ue
814
813
  ]
815
814
  }
816
815
  )