prometeo-design-system 2.7.0 → 2.7.2

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 (39) hide show
  1. package/dist/Avatar.es.js +72 -33
  2. package/dist/Button.es.js +398 -2
  3. package/dist/DatePicker.es.js +2 -2
  4. package/dist/DrawerDesktop.es.js +31 -30
  5. package/dist/FAButton.es.js +69 -18
  6. package/dist/Header.es.js +14 -14
  7. package/dist/Icons/Icons.d.ts +5 -0
  8. package/dist/Icons.es.js +432 -330
  9. package/dist/{ImageGallery-DKzJg3un.js → ImageGallery-D8nIvBpV.js} +7 -7
  10. package/dist/ImageGallery.es.js +1 -1
  11. package/dist/Input-CnXDg2s7.js +253 -0
  12. package/dist/Input.es.js +1 -1
  13. package/dist/InputFormikV2.es.js +30 -18
  14. package/dist/ProgressBar.es.js +63 -35
  15. package/dist/{Select-BQMdfu1n.js → Select-CiaBY4E0.js} +332 -235
  16. package/dist/Select.es.js +1 -1
  17. package/dist/SelectFormik.es.js +21 -20
  18. package/dist/SelectSearch.es.js +1 -1
  19. package/dist/Switch.es.js +4 -4
  20. package/dist/Toast.es.js +1 -1
  21. package/dist/components/Avatar/Avatar.d.ts +9 -4
  22. package/dist/components/Button/Button.d.ts +8 -14
  23. package/dist/components/Button/Button_Legacy.d.ts +29 -0
  24. package/dist/components/Input/Input.d.ts +7 -10
  25. package/dist/components/ProgressBar/ProgressBar.d.ts +13 -3
  26. package/dist/components/RecurrentDatePicker/CustomFrequencySettings.d.ts +5 -5
  27. package/dist/components/Select/Select.d.ts +5 -5
  28. package/dist/exports/ProgressBar.d.ts +1 -1
  29. package/dist/index-BOQuZ0gG.js +34 -0
  30. package/dist/index.d.ts +1 -3
  31. package/dist/prometeo-design-system.css +1 -1
  32. package/dist/prometeo-design-system.es.js +19 -21
  33. package/package.json +1 -5
  34. package/dist/Button-CvBWH1HX.js +0 -183
  35. package/dist/ButtonV2.d.ts +0 -6
  36. package/dist/ButtonV2.es.js +0 -217
  37. package/dist/Input-BTsR-vNF.js +0 -281
  38. package/dist/components/Button/ButtonV2.d.ts +0 -23
  39. package/dist/exports/ButtonV2.d.ts +0 -2
@@ -5,7 +5,7 @@ import Ne, { memo as Z, useState as De, useRef as ce, useMemo as oe, useCallback
5
5
  import Xe from "./Spinner.es.js";
6
6
  import { createPortal as Ye } from "react-dom";
7
7
  import { u as Ze } from "./useDragScroll-CHN9OMwn.js";
8
- import { u as et, I as tt } from "./Input-BTsR-vNF.js";
8
+ import { u as et, I as tt } from "./Input-CnXDg2s7.js";
9
9
  import { H as nt } from "./HelperComponent-U6mPwuDH.js";
10
10
  import rt from "./CheckBox.es.js";
11
11
  import { Skeleton as Fe } from "./Skeleton.es.js";
@@ -25,10 +25,10 @@ const lt = {
25
25
  }, qe = {
26
26
  icon: " text-neutral-default-disabled",
27
27
  container: " border-neutral-strong-default text-neutral-default-disabled"
28
- }, Ve = ({ id: e, label: n, onRemove: m, className: i, disabled: u, variant: v = "default", tabIndex: h }) => /* @__PURE__ */ s.jsxs(
28
+ }, Ve = ({ id: e, label: n, onRemove: h, className: i, disabled: u, variant: v = "default", tabIndex: m }) => /* @__PURE__ */ s.jsxs(
29
29
  "div",
30
30
  {
31
- tabIndex: h,
31
+ tabIndex: m,
32
32
  className: f(
33
33
  "inline-flex max-w-[calc(50%-0.25rem)] items-center gap-1 px-2 py-1 bg-inherit text-xs rounded-lg border h-[30px]",
34
34
  lt[v].container,
@@ -36,11 +36,11 @@ const lt = {
36
36
  ),
37
37
  children: [
38
38
  /* @__PURE__ */ s.jsx("span", { className: "truncate w-max ", children: n }),
39
- m && /* @__PURE__ */ s.jsx(
39
+ h && /* @__PURE__ */ s.jsx(
40
40
  "button",
41
41
  {
42
42
  onMouseDown: (j) => {
43
- u || (j.stopPropagation(), j.preventDefault(), m?.(e));
43
+ u || (j.stopPropagation(), j.preventDefault(), h?.(e));
44
44
  },
45
45
  className: f(
46
46
  "shrink-0 p-0.5 transition-all duration-200 hover:text-neutral-default-hover cursor-pointer z-50 text-neutral-default-default hover:scale-105",
@@ -48,7 +48,7 @@ const lt = {
48
48
  i
49
49
  ),
50
50
  type: "button",
51
- tabIndex: h,
51
+ tabIndex: m,
52
52
  children: /* @__PURE__ */ s.jsx(je.Close, { size: 18, className: f(u && qe.icon) })
53
53
  }
54
54
  )
@@ -60,9 +60,9 @@ const ot = Z(Ve);
60
60
  function G(e, n) {
61
61
  if (typeof n == "function")
62
62
  return n(e);
63
- const m = n?.split(".");
63
+ const h = n?.split(".");
64
64
  let i = e;
65
- for (const u of m)
65
+ for (const u of h)
66
66
  if (i && typeof i == "object" && u in i)
67
67
  i = i[u];
68
68
  else
@@ -71,11 +71,11 @@ function G(e, n) {
71
71
  }
72
72
  const Ue = (e, n) => {
73
73
  if (!n) return !0;
74
- const m = 0.1, i = String(e).toLowerCase(), u = String(n).toLowerCase().trim();
74
+ const h = 0.1, i = String(e).toLowerCase(), u = String(n).toLowerCase().trim();
75
75
  if (i.includes(u)) return !0;
76
- const v = u.split(/\s+/).filter(Boolean), h = v.filter((b) => /^\d+$/.test(b));
77
- if (v.length > 1 || h.length > 0) {
78
- for (const b of h)
76
+ const v = u.split(/\s+/).filter(Boolean), m = v.filter((b) => /^\d+$/.test(b));
77
+ if (v.length > 1 || m.length > 0) {
78
+ for (const b of m)
79
79
  if (!new RegExp(`(^|\\D)${b}(\\D|$)`).test(i)) return !1;
80
80
  for (const b of v)
81
81
  if (!/^\d+$/.test(b) && !i.includes(b))
@@ -83,7 +83,7 @@ const Ue = (e, n) => {
83
83
  return !0;
84
84
  }
85
85
  if (u.length > i.length) return !1;
86
- const j = Math.floor(u.length * m);
86
+ const j = Math.floor(u.length * h);
87
87
  if (j <= 0) return !1;
88
88
  const p = (b, k) => {
89
89
  const I = b.length, W = k.length;
@@ -107,13 +107,13 @@ const Ue = (e, n) => {
107
107
  }
108
108
  return !1;
109
109
  }, st = (e) => {
110
- const n = [], m = (i) => {
110
+ const n = [], h = (i) => {
111
111
  i.forEach((u) => {
112
- const h = u.options;
113
- Array.isArray(h) && h.length > 0 ? m(h) : n.push(u);
112
+ const m = u.options;
113
+ Array.isArray(m) && m.length > 0 ? h(m) : n.push(u);
114
114
  });
115
115
  };
116
- return m(e), n;
116
+ return h(e), n;
117
117
  }, Re = {
118
118
  default: {
119
119
  container: "",
@@ -138,14 +138,8 @@ const Ue = (e, n) => {
138
138
  "focus:border-error-default focus:border-2",
139
139
  "focus:ring-0 focus:ring-error-default/20"
140
140
  ),
141
- label: f(
142
- "text-error-light",
143
- "peer-focus:text-error-light"
144
- ),
145
- icon: f(
146
- "text-error-medium-default",
147
- "peer-focus:text-error-light"
148
- )
141
+ label: f("text-error-light", "peer-focus:text-error-light"),
142
+ icon: f("text-error-medium-default", "peer-focus:text-error-light")
149
143
  },
150
144
  success: {
151
145
  container: "",
@@ -154,20 +148,14 @@ const Ue = (e, n) => {
154
148
  "focus:border-success-default focus:border-2",
155
149
  "focus:ring-0 focus:ring-success-default/20"
156
150
  ),
157
- label: f(
158
- "text-success",
159
- "peer-focus:text-success-light"
160
- ),
161
- icon: f(
162
- "text-success-medium-default",
163
- "peer-focus:text-success-light"
164
- )
151
+ label: f("text-success", "peer-focus:text-success-light"),
152
+ icon: f("text-success-medium-default", "peer-focus:text-success-light")
165
153
  }
166
154
  }, Be = {
167
155
  input: f(
168
- "border-neutral-strong-default text-neutral-default-default",
169
- "focus:ring-primary-default-default focus:ring-[1px] focus:border-primary-default-default ",
170
- "hover:border-primary-default-default"
156
+ "border-neutral-strong-default text-neutral-default-default pointer-events-none",
157
+ "focus:ring-0 focus:border-primary-default-disabled ",
158
+ "hover:border-neutral-default-disabled"
171
159
  ),
172
160
  label: f(
173
161
  "text-neutral-medium-disabled",
@@ -179,8 +167,10 @@ const Ue = (e, n) => {
179
167
  )
180
168
  };
181
169
  function at(e) {
182
- const [n, m] = De(!1), [i, u] = De([]), [v, h] = De(""), j = ce(null), p = ce(null), b = ce(null), k = ce(null), I = ce(() => {
183
- }), W = ce(null), A = ce(/* @__PURE__ */ new Set()), {
170
+ const [n, h] = De(!1), [i, u] = De([]), [v, m] = De(""), j = ce(null), p = ce(null), b = ce(null), k = ce(null), I = ce(
171
+ () => {
172
+ }
173
+ ), W = ce(null), A = ce(/* @__PURE__ */ new Set()), {
184
174
  id: x,
185
175
  name: S,
186
176
  label: M,
@@ -204,11 +194,11 @@ function at(e) {
204
194
  onRemoveOption: ke,
205
195
  onOptionClick: X,
206
196
  onClose: Se,
207
- onClear: me,
197
+ onClear: he,
208
198
  disabled: te = !1,
209
199
  overflow: Ke = "wrap",
210
200
  variant: F = "default",
211
- isLoading: he = !1,
201
+ isLoading: me = !1,
212
202
  attachToParent: Me = !1,
213
203
  displayMode: we = "compact",
214
204
  labelVariant: ie = "default",
@@ -232,32 +222,33 @@ function at(e) {
232
222
  }
233
223
  }, a = n || pe ? "active" : "default";
234
224
  return t[ie][a];
235
- }, T = U((t) => ({
236
- id: G(t, E),
237
- value: G(t, E),
238
- label: G(t, de)
239
- }), [E, de]), Y = oe(
240
- () => st(K),
241
- [K]
242
- ), ge = oe(
225
+ }, T = U(
226
+ (t) => ({
227
+ id: G(t, E),
228
+ value: G(t, E),
229
+ label: G(t, de)
230
+ }),
231
+ [E, de]
232
+ ), Y = oe(() => st(K), [K]), ge = oe(
243
233
  () => Y.map(T),
244
234
  [Y, T]
245
- ), r = oe(
246
- () => {
247
- const t = [];
248
- if (e.multiple)
249
- e.value?.forEach((a) => {
250
- const l = Y?.find((g) => G(g, E) === a);
251
- l && t.push(l);
252
- });
253
- else {
254
- const a = Y?.find((l) => G(l, E) === e.value);
255
- a && t.push(a);
256
- }
257
- return t;
258
- },
259
- [e.value, E, Y, e.multiple]
260
- ), o = oe(
235
+ ), r = oe(() => {
236
+ const t = [];
237
+ if (e.multiple)
238
+ e.value?.forEach((a) => {
239
+ const l = Y?.find(
240
+ (g) => G(g, E) === a
241
+ );
242
+ l && t.push(l);
243
+ });
244
+ else {
245
+ const a = Y?.find(
246
+ (l) => G(l, E) === e.value
247
+ );
248
+ a && t.push(a);
249
+ }
250
+ return t;
251
+ }, [e.value, E, Y, e.multiple]), o = oe(
261
252
  () => r.map(T),
262
253
  [r, T]
263
254
  ), c = oe(
@@ -288,7 +279,9 @@ function at(e) {
288
279
  }, [K, E, J, T]), w = U(
289
280
  (t, a) => {
290
281
  if (!t || t.length === 0) return;
291
- const l = t.map((C) => T(C));
282
+ const l = t.map(
283
+ (C) => T(C)
284
+ );
292
285
  if (!e.multiple) {
293
286
  const C = l[0];
294
287
  if (!C) return;
@@ -302,12 +295,16 @@ function at(e) {
302
295
  const D = ge.find((B) => B.value === C);
303
296
  D && H.push(D);
304
297
  });
305
- const $ = new Set(H.map((C) => C.id)), P = new Set(l.map((C) => C.id)), le = l.every((C) => $.has(C.id)), xe = a ?? "toggle", ye = xe === "select" || xe === "toggle" && !le;
298
+ const $ = new Set(H.map((C) => C.id)), P = new Set(l.map((C) => C.id)), le = l.every(
299
+ (C) => $.has(C.id)
300
+ ), xe = a ?? "toggle", ye = xe === "select" || xe === "toggle" && !le;
306
301
  let _;
307
302
  if (!ye)
308
303
  _ = H.filter((C) => !P.has(C.id));
309
304
  else {
310
- const C = new Map(H.map((D) => [D.id, D]));
305
+ const C = new Map(
306
+ H.map((D) => [D.id, D])
307
+ );
311
308
  l.forEach((D) => {
312
309
  C.set(D.id, D);
313
310
  }), _ = Array.from(C.values());
@@ -324,7 +321,7 @@ function at(e) {
324
321
  S
325
322
  ]
326
323
  ), L = U(() => {
327
- m((t) => !t);
324
+ h((t) => !t);
328
325
  }, []);
329
326
  I.current = (t) => {
330
327
  if (!e.multiple)
@@ -332,39 +329,61 @@ function at(e) {
332
329
  else {
333
330
  const a = e.value || [], l = [], g = a.includes(t.value);
334
331
  a.forEach(($) => {
335
- const P = ge.find((le) => le.value === $);
332
+ const P = ge.find(
333
+ (le) => le.value === $
334
+ );
336
335
  P && l.push(P);
337
336
  });
338
337
  const H = g ? l.filter(($) => $.value !== t.value) : [...l, t];
339
338
  e.onChange?.(H, S);
340
339
  }
341
340
  };
342
- const y = U((t, a = !1) => {
343
- X?.(t, S), I.current?.(t), a && (m(!1), Se?.());
344
- }, [X, Se, S]), R = (t) => {
345
- t.preventDefault(), t.stopPropagation(), t.target.blur(), me?.(), e.multiple ? e.onChange?.([], S) : e.onChange?.(void 0, S);
346
- }, q = U((t) => {
347
- e.multiple || e.onChange?.(void 0, S);
348
- const a = Y.find((g) => G(g, E) === t);
349
- if (!a) return;
350
- const l = T(a);
351
- X?.(l, S), I.current?.(l), ke?.(a);
352
- }, [X, ke, Y, S, e.multiple, e.onChange, T, E]), re = U((t) => {
353
- q(t);
354
- }, [q]);
341
+ const y = U(
342
+ (t, a = !1) => {
343
+ X?.(t, S), I.current?.(t), a && (h(!1), Se?.());
344
+ },
345
+ [X, Se, S]
346
+ ), R = (t) => {
347
+ t.preventDefault(), t.stopPropagation(), t.target.blur(), he?.(), e.multiple ? e.onChange?.([], S) : e.onChange?.(void 0, S);
348
+ }, q = U(
349
+ (t) => {
350
+ e.multiple || e.onChange?.(void 0, S);
351
+ const a = Y.find(
352
+ (g) => G(g, E) === t
353
+ );
354
+ if (!a) return;
355
+ const l = T(a);
356
+ X?.(l, S), I.current?.(l), ke?.(a);
357
+ },
358
+ [
359
+ X,
360
+ ke,
361
+ Y,
362
+ S,
363
+ e.multiple,
364
+ e.onChange,
365
+ T,
366
+ E
367
+ ]
368
+ ), re = U(
369
+ (t) => {
370
+ q(t);
371
+ },
372
+ [q]
373
+ );
355
374
  ve(() => {
356
375
  if (!n) return;
357
376
  const t = (a) => {
358
377
  const l = a.target;
359
378
  if (a.type === "mousedown") {
360
379
  if (j.current?.contains(l) || p.current?.contains(l)) return;
361
- m(!1);
380
+ h(!1);
362
381
  }
363
382
  if (a.type === "scroll") {
364
383
  if (p.current?.contains(l)) return;
365
- m(!1);
384
+ h(!1);
366
385
  }
367
- a.type === "resize" && m(!1);
386
+ a.type === "resize" && h(!1);
368
387
  };
369
388
  return document.addEventListener("mousedown", t), window.addEventListener("scroll", t, !0), window.addEventListener("resize", t, !0), () => {
370
389
  document.removeEventListener("mousedown", t), window.removeEventListener("scroll", t, !0), window.removeEventListener("resize", t, !0);
@@ -376,36 +395,37 @@ function at(e) {
376
395
  } catch {
377
396
  }
378
397
  });
379
- }, [n]), Qe(V, () => ({
380
- open: () => {
381
- !n && m(!0);
382
- },
383
- close: () => {
384
- n && m(!1);
385
- },
386
- toggle: () => m((t) => !t),
387
- handleOptionSelect: y,
388
- subscribeOpenChange: (t) => (A.current.add(t), () => {
389
- A.current.delete(t);
398
+ }, [n]), Qe(
399
+ V,
400
+ () => ({
401
+ open: () => {
402
+ !n && h(!0);
403
+ },
404
+ close: () => {
405
+ n && h(!1);
406
+ },
407
+ toggle: () => h((t) => !t),
408
+ handleOptionSelect: y,
409
+ subscribeOpenChange: (t) => (A.current.add(t), () => {
410
+ A.current.delete(t);
411
+ }),
412
+ searchInputRef: b
390
413
  }),
391
- searchInputRef: b
392
- }), [n, y]);
414
+ [n, y]
415
+ );
393
416
  const be = (t) => {
394
- t.preventDefault(), t.stopPropagation(), t.target.matches(":focus-visible") && !ze && !n && (m(!0), setTimeout(() => {
417
+ t.preventDefault(), t.stopPropagation(), t.target.matches(":focus-visible") && !ze && !n && (h(!0), setTimeout(() => {
395
418
  b.current?.focus();
396
419
  }, 10));
397
420
  }, ue = (t) => {
398
- t.key === "Tab" && n && m(!1), (t.keyCode === 32 || t.key === "ArrowDown") && (m(!0), setTimeout(() => {
421
+ t.key === "Tab" && n && h(!1), (t.keyCode === 32 || t.key === "ArrowDown") && (h(!0), setTimeout(() => {
399
422
  b.current?.focus();
400
423
  }, 10));
401
424
  };
402
425
  return /* @__PURE__ */ s.jsxs(
403
426
  "div",
404
427
  {
405
- className: f(
406
- "relative bg-inherit select-none w-full",
407
- z
408
- ),
428
+ className: f("relative bg-inherit select-none w-full", z),
409
429
  ref: j,
410
430
  draggable: !1,
411
431
  style: Ge,
@@ -451,7 +471,9 @@ function at(e) {
451
471
  /* @__PURE__ */ s.jsx(
452
472
  "div",
453
473
  {
454
- className: f("flex-1 overflow-x-auto overflow-y-hidden px-1 prometeo-scrollbar-none "),
474
+ className: f(
475
+ "flex-1 overflow-x-auto overflow-y-hidden px-1 prometeo-scrollbar-none "
476
+ ),
455
477
  ref: Te,
456
478
  onPointerUp: ne.onPointerUp,
457
479
  onPointerDown: ne.onPointerDown,
@@ -479,15 +501,25 @@ function at(e) {
479
501
  placeholder: $e,
480
502
  onRemoveOption: q,
481
503
  multiple: e.multiple || !1,
482
- className: f(Ke === "scroll" ? "flex-nowrap" : "flex-wrap"),
504
+ className: f(
505
+ Ke === "scroll" ? "flex-nowrap" : "flex-wrap"
506
+ ),
483
507
  disabled: te
484
508
  }
485
509
  )
486
510
  }
487
511
  ),
488
512
  /* @__PURE__ */ s.jsxs("div", { className: "flex items-center gap-2", children: [
489
- he && /* @__PURE__ */ s.jsx(Xe, { size: "small", variant: "clip", className: " translate-y-1", speedMultiplier: 0.7 }),
490
- pe && me && /* @__PURE__ */ s.jsx(
513
+ me && /* @__PURE__ */ s.jsx(
514
+ Xe,
515
+ {
516
+ size: "small",
517
+ variant: "clip",
518
+ className: " translate-y-1",
519
+ speedMultiplier: 0.7
520
+ }
521
+ ),
522
+ pe && he && /* @__PURE__ */ s.jsx(
491
523
  "button",
492
524
  {
493
525
  onMouseDown: (t) => {
@@ -495,7 +527,16 @@ function at(e) {
495
527
  },
496
528
  type: "button",
497
529
  tabIndex: -1,
498
- children: /* @__PURE__ */ s.jsx(je.Cancel, { size: 20, className: f(" cursor-pointer transition-all", Re[F].icon) })
530
+ children: /* @__PURE__ */ s.jsx(
531
+ je.Cancel,
532
+ {
533
+ size: 20,
534
+ className: f(
535
+ " cursor-pointer transition-all",
536
+ Re[F].icon
537
+ )
538
+ }
539
+ )
499
540
  }
500
541
  ),
501
542
  /* @__PURE__ */ s.jsx(
@@ -539,9 +580,9 @@ function at(e) {
539
580
  selectButtonRef: k,
540
581
  helperComponentRef: W,
541
582
  onOptionClick: y,
542
- onCloseDropdown: () => m(!1),
583
+ onCloseDropdown: () => h(!1),
543
584
  searchValue: Ie,
544
- setSearchValue: h,
585
+ setSearchValue: m,
545
586
  searchInputRef: b,
546
587
  isLoading: O?.isLoading,
547
588
  onSearchClear: O?.onSearchClear,
@@ -573,11 +614,11 @@ const it = Z(at, (e, n) => e.value === n.value && e.options === n.options && e.i
573
614
  function ut({
574
615
  footer: e,
575
616
  isOpen: n,
576
- label: m,
617
+ label: h,
577
618
  options: i,
578
619
  multiple: u,
579
620
  disabled: v,
580
- selectRef: h,
621
+ selectRef: m,
581
622
  inputProps: j,
582
623
  dropdownRef: p,
583
624
  optionLabel: b,
@@ -609,15 +650,26 @@ function ut({
609
650
  enableGroupToggle: X = !0,
610
651
  onGroupSelectChange: Se
611
652
  }) {
612
- const me = e ? 380 : 320, te = W === "static" ? m !== "" ? -20 : 4 : 7, F = U(() => N ? N.endsWith("px") ? Number(N.replace("px", "")) : N.endsWith("vh") ? window.innerHeight * Number(N.replace("vh", "")) / 100 : N.endsWith("%") ? window.innerHeight * Number(N.replace("%", "")) / 100 : me : me, [N, me])(), [he, Me] = De({ direction: "down", height: F }), [we, ie] = De(() => /* @__PURE__ */ new Set()), ze = U((r) => !we.has(r), [we]), Oe = U((r, o) => {
613
- ie((c) => {
614
- const d = new Set(c), w = d.has(r);
615
- return (o === void 0 ? !w : !o) ? d.add(r) : d.delete(r), d;
616
- });
617
- }, []), Le = (r) => {
618
- if (!p.current || !h.current) return;
619
- const o = h.current.getBoundingClientRect();
620
- switch (r || he.direction) {
653
+ const he = e ? 380 : 320, te = W === "static" ? h !== "" ? -20 : 4 : 7, F = U(() => N ? N.endsWith("px") ? Number(N.replace("px", "")) : N.endsWith("vh") ? window.innerHeight * Number(N.replace("vh", "")) / 100 : N.endsWith("%") ? window.innerHeight * Number(N.replace("%", "")) / 100 : he : he, [N, he])(), [me, Me] = De({
654
+ direction: "down",
655
+ height: F
656
+ }), [we, ie] = De(
657
+ () => /* @__PURE__ */ new Set()
658
+ ), ze = U(
659
+ (r) => !we.has(r),
660
+ [we]
661
+ ), Oe = U(
662
+ (r, o) => {
663
+ ie((c) => {
664
+ const d = new Set(c), w = d.has(r);
665
+ return (o === void 0 ? !w : !o) ? d.add(r) : d.delete(r), d;
666
+ });
667
+ },
668
+ []
669
+ ), Le = (r) => {
670
+ if (!p.current || !m.current) return;
671
+ const o = m.current.getBoundingClientRect();
672
+ switch (r || me.direction) {
621
673
  case "down":
622
674
  p.current.style.top = `${o.top + o.height - (Ee?.current?.offsetHeight ? Ee?.current?.offsetHeight + 4 : 0)}px`;
623
675
  break;
@@ -629,12 +681,12 @@ function ut({
629
681
  }, ne = (r) => {
630
682
  p.current && (p.current.style.maxHeight = `${r}px`);
631
683
  }, Te = () => {
632
- if (!p.current || !h.current) return he;
633
- const r = h.current.getBoundingClientRect(), o = window.innerHeight - (window.innerHeight - r.top), c = window.innerHeight - r.bottom, d = c >= F, w = o >= F;
684
+ if (!p.current || !m.current) return me;
685
+ const r = m.current.getBoundingClientRect(), o = window.innerHeight - (window.innerHeight - r.top), c = window.innerHeight - r.bottom, d = c >= F, w = o >= F;
634
686
  let L = "down", y;
635
687
  return d ? (L = "down", y = F) : w ? (L = "up", y = F) : c > o ? (L = "down", y = c - 16) : (L = "up", y = o - 16), { direction: L, height: y };
636
688
  }, pe = (r) => {
637
- if (!(!p.current || !h.current)) {
689
+ if (!(!p.current || !m.current)) {
638
690
  if (p.current.style.transition = "max-height 0.2s ease,opacity 0.2s ease", !r) {
639
691
  p.current.style.maxHeight = "0", p.current.style.opacity = "0", p.current.style.pointerEvents = "none";
640
692
  return;
@@ -647,7 +699,7 @@ function ut({
647
699
  }
648
700
  };
649
701
  ve(() => {
650
- E || !h.current || !n || Le();
702
+ E || !m.current || !n || Le();
651
703
  }, [ae]), ve(() => {
652
704
  pe(n);
653
705
  }, [n]), ve(() => {
@@ -671,7 +723,10 @@ function ut({
671
723
  re(), R = ue;
672
724
  return;
673
725
  }
674
- const a = be, l = G(a, b), g = Ue(String(l ?? ""), o);
726
+ const a = be, l = G(
727
+ a,
728
+ b
729
+ ), g = Ue(String(l ?? ""), o);
675
730
  R ? g && q.push(a) : g && y.push(a);
676
731
  }), re(), y;
677
732
  }
@@ -710,12 +765,24 @@ function ut({
710
765
  return;
711
766
  }
712
767
  z && (z(""), Q(i));
713
- }, [i, ae, k, K, Q, z, x]), Pe = (r) => {
714
- r.key === "ArrowDown" ? (r.preventDefault(), p.current?.querySelector("[role=listitem]")?.focus()) : (r.key === "Tab" || r.key === "Escape") && setTimeout(() => {
768
+ }, [
769
+ i,
770
+ ae,
771
+ k,
772
+ K,
773
+ Q,
774
+ z,
775
+ x
776
+ ]), Pe = (r) => {
777
+ r.key === "ArrowDown" ? (r.preventDefault(), p.current?.querySelector(
778
+ "[role=listitem]"
779
+ )?.focus()) : (r.key === "Tab" || r.key === "Escape") && setTimeout(() => {
715
780
  J.current?.focus(), fe();
716
781
  }, 10);
717
782
  }, T = (r, o) => {
718
- const c = Array.from(p.current?.querySelectorAll("[role=listitem]") || []), d = c.indexOf(r.currentTarget);
783
+ const c = Array.from(
784
+ p.current?.querySelectorAll("[role=listitem]") || []
785
+ ), d = c.indexOf(r.currentTarget);
719
786
  if (r.key === "ArrowDown") {
720
787
  r.preventDefault();
721
788
  const w = d < c.length - 1 ? d + 1 : d;
@@ -737,35 +804,34 @@ function ut({
737
804
  }, 10)) : r.key === "Tab" && setTimeout(() => {
738
805
  J.current?.focus(), fe();
739
806
  }, 10);
740
- }, Y = Array.from({ length: 5 }).map((r, o) => x ? Ne.createElement(
741
- Z(
742
- x,
743
- (c, d) => c.isSelected === d.isSelected && c.option === d.option && c.disabled === d.disabled && c.multiple === d.multiple && c.renderContext === d.renderContext
744
- ),
745
- {
746
- key: `skeleton-option-${o}`,
747
- option: { id: o, label: "", value: "" },
748
- isSelected: !1,
749
- multiple: !1,
750
- onSelect: () => {
751
- },
752
- disabled: !1,
753
- isLoading: !0,
754
- renderContext: S
755
- }
756
- ) : /* @__PURE__ */ s.jsx(
757
- We,
758
- {
759
- multiple: !1,
760
- isLoading: !0,
761
- onSelect: () => {
807
+ }, Y = Array.from({ length: 5 }).map(
808
+ (r, o) => x ? Ne.createElement(
809
+ Z(x, (c, d) => c.isSelected === d.isSelected && c.option === d.option && c.disabled === d.disabled && c.multiple === d.multiple && c.renderContext === d.renderContext),
810
+ {
811
+ key: `skeleton-option-${o}`,
812
+ option: { id: o, label: "", value: "" },
813
+ isSelected: !1,
814
+ multiple: !1,
815
+ onSelect: () => {
816
+ },
817
+ disabled: !1,
818
+ isLoading: !0,
819
+ renderContext: S
820
+ }
821
+ ) : /* @__PURE__ */ s.jsx(
822
+ We,
823
+ {
824
+ multiple: !1,
825
+ isLoading: !0,
826
+ onSelect: () => {
827
+ },
828
+ isSelected: !1,
829
+ option: { id: o, label: "", value: "" }
762
830
  },
763
- isSelected: !1,
764
- option: { id: o, label: "", value: "" }
765
- },
766
- `skeleton-option-${// biome-ignore lint/suspicious/noArrayIndexKey: <>
767
- o}`
768
- )), ge = /* @__PURE__ */ s.jsx(
831
+ `skeleton-option-${// biome-ignore lint/suspicious/noArrayIndexKey: <>
832
+ o}`
833
+ )
834
+ ), ge = /* @__PURE__ */ s.jsx(
769
835
  "div",
770
836
  {
771
837
  tabIndex: 0,
@@ -775,7 +841,7 @@ function ut({
775
841
  " z-100! w-full mt-1 bg-neutral-default-default border border-neutral-default-default rounded-lg shadow-lg",
776
842
  " overflow-hidden focus-visible:bg-neutral-default-hover ",
777
843
  E ? "absolute z-50 " : "fixed z-100 top-0 left-0",
778
- he.direction === "up" ? "h-auto" : " h-max",
844
+ me.direction === "up" ? "h-auto" : " h-max",
779
845
  Ae
780
846
  ),
781
847
  children: /* @__PURE__ */ s.jsxs(
@@ -787,7 +853,7 @@ function ut({
787
853
  ),
788
854
  style: {
789
855
  height: "auto",
790
- maxHeight: he.height
856
+ maxHeight: me.height
791
857
  },
792
858
  children: [
793
859
  !Ce && /* @__PURE__ */ s.jsx(
@@ -805,7 +871,7 @@ function ut({
805
871
  isFetching: ee,
806
872
  onKeyDown: Pe,
807
873
  onClear: Ie,
808
- onChange: $e,
874
+ onChange: (r) => $e(r.target.value),
809
875
  placeholder: ke,
810
876
  className: " bg-neutral-medium-pressed",
811
877
  ...j
@@ -819,7 +885,10 @@ function ut({
819
885
  label: String(G(l, b)),
820
886
  value: G(l, k)
821
887
  }, R = (l) => {
822
- d || se(y(o), l === void 0 ? !u : l);
888
+ d || se(
889
+ y(o),
890
+ l === void 0 ? !u : l
891
+ );
823
892
  }, q = (l) => {
824
893
  if (se(l, !u), !u) {
825
894
  if (!z) return;
@@ -853,7 +922,9 @@ function ut({
853
922
  X && Oe(g, _);
854
923
  }, xe = (_) => {
855
924
  !P || P.length === 0 || Se && Se(P, _);
856
- }, ye = P.filter((_) => ae.has(G(_, k))).map((_) => String(G(_, k)));
925
+ }, ye = P.filter(
926
+ (_) => ae.has(G(_, k))
927
+ ).map((_) => String(G(_, k)));
857
928
  if (M) {
858
929
  const _ = Z(
859
930
  M,
@@ -873,13 +944,14 @@ function ut({
873
944
  return re(C, c);
874
945
  }
875
946
  return re(
876
- /* @__PURE__ */ s.jsxs(
877
- "div",
878
- {
879
- className: "px-3 py-2 text-neutral-medium-default font-medium text-sm w-full flex justify-between",
880
- children: [
881
- /* @__PURE__ */ s.jsx("div", { children: l }),
882
- X && /* @__PURE__ */ s.jsx("div", { className: "cursor-pointer", onClick: () => Oe(g), children: /* @__PURE__ */ s.jsx(
947
+ /* @__PURE__ */ s.jsxs("div", { className: "px-3 py-2 text-neutral-medium-default font-medium text-sm w-full flex justify-between", children: [
948
+ /* @__PURE__ */ s.jsx("div", { children: l }),
949
+ X && /* @__PURE__ */ s.jsx(
950
+ "div",
951
+ {
952
+ className: "cursor-pointer",
953
+ onClick: () => Oe(g),
954
+ children: /* @__PURE__ */ s.jsx(
883
955
  je.ChevronDown,
884
956
  {
885
957
  className: f(
@@ -887,10 +959,10 @@ function ut({
887
959
  H ? "rotate-180" : "rotate-0"
888
960
  )
889
961
  }
890
- ) })
891
- ]
892
- }
893
- ),
962
+ )
963
+ }
964
+ )
965
+ ] }),
894
966
  c
895
967
  );
896
968
  }
@@ -920,20 +992,20 @@ function ut({
920
992
  option: o
921
993
  },
922
994
  w
923
- ), ue = re(be, y(o));
995
+ ), ue = re(
996
+ be,
997
+ y(o)
998
+ );
924
999
  if (!X)
925
1000
  return ue;
926
1001
  const t = !r, a = ue;
927
- return Ne.cloneElement(
928
- a,
929
- {
930
- className: f(
931
- a.props.className,
932
- "overflow-hidden transition-[max-height] duration-300 ease-out",
933
- t ? "max-h-0" : "max-h-[999px]"
934
- )
935
- }
936
- );
1002
+ return Ne.cloneElement(a, {
1003
+ className: f(
1004
+ a.props.className,
1005
+ "overflow-hidden transition-[max-height] duration-300 ease-out",
1006
+ t ? "max-h-0" : "max-h-[999px]"
1007
+ )
1008
+ });
937
1009
  });
938
1010
  })() }),
939
1011
  e && /* @__PURE__ */ s.jsx("div", { className: "border-t border-neutral-strong-default p-2", children: e })
@@ -944,58 +1016,83 @@ function ut({
944
1016
  );
945
1017
  return E ? ge : Ye(ge, document.body);
946
1018
  }
947
- const ct = Z(ut, (e, n) => e.options === n.options && e.selectedOptionsIds === n.selectedOptionsIds && e.multiple === n.multiple && e.disabled === n.disabled && e.emptyMessage === n.emptyMessage && e.renderOption === n.renderOption && e.renderOptionContext === n.renderOptionContext && e.isOpen === n.isOpen && e.attachToParent === n.attachToParent && e.optionValue === n.optionValue && e.optionLabel === n.optionLabel && e.filteredOptions === n.filteredOptions && e.isLoading === n.isLoading), We = Z(({ option: e, isSelected: n, onSelect: m, multiple: i, disabled: u, isLoading: v }) => {
948
- const h = e.isGroupHeader;
949
- if (v)
950
- return /* @__PURE__ */ s.jsxs("div", { className: "flex gap-2 w-full px-3 py-2 cursor-wait", children: [
951
- /* @__PURE__ */ s.jsx(Fe, { className: "size-6 aspect-square" }),
952
- /* @__PURE__ */ s.jsx(Fe, { className: "flex-1 h-6" })
953
- ] }, e.id);
954
- const j = (b) => {
955
- b.preventDefault(), b.stopPropagation(), !(u || h) && m?.(e);
956
- }, p = h && e.groupLabelNode ? e.groupLabelNode : e.label;
957
- return (
958
- // biome-ignore lint/a11y/noStaticElementInteractions: no keyboard interaction needed
959
- /* @__PURE__ */ s.jsxs(
960
- "div",
961
- {
962
- onMouseDown: j,
963
- className: f(
964
- "px-3 py-2 flex items-center transition-colors text-neutral-default-default ",
965
- h ? "cursor-default text-neutral-medium-default" : "cursor-pointer",
966
- !h && (n ? " text-primary-default-default" : "hover:bg-neutral-medium-hover text-neutral-default-hover"),
967
- u && !h && "text-neutral-default-disabled hover:bg-neutral-default-default"
968
- ),
969
- children: [
970
- i && !h && /* @__PURE__ */ s.jsx(
971
- rt,
972
- {
973
- checked: n,
974
- disabled: u
975
- }
1019
+ const ct = Z(
1020
+ ut,
1021
+ (e, n) => e.options === n.options && e.selectedOptionsIds === n.selectedOptionsIds && e.multiple === n.multiple && e.disabled === n.disabled && e.emptyMessage === n.emptyMessage && e.renderOption === n.renderOption && e.renderOptionContext === n.renderOptionContext && e.isOpen === n.isOpen && e.attachToParent === n.attachToParent && e.optionValue === n.optionValue && e.optionLabel === n.optionLabel && e.filteredOptions === n.filteredOptions && e.isLoading === n.isLoading
1022
+ ), We = Z(
1023
+ ({
1024
+ option: e,
1025
+ isSelected: n,
1026
+ onSelect: h,
1027
+ multiple: i,
1028
+ disabled: u,
1029
+ isLoading: v
1030
+ }) => {
1031
+ const m = e.isGroupHeader;
1032
+ if (v)
1033
+ return /* @__PURE__ */ s.jsxs(
1034
+ "div",
1035
+ {
1036
+ className: "flex gap-2 w-full px-3 py-2 cursor-wait",
1037
+ children: [
1038
+ /* @__PURE__ */ s.jsx(Fe, { className: "size-6 aspect-square" }),
1039
+ /* @__PURE__ */ s.jsx(Fe, { className: "flex-1 h-6" })
1040
+ ]
1041
+ },
1042
+ e.id
1043
+ );
1044
+ const j = (b) => {
1045
+ b.preventDefault(), b.stopPropagation(), !(u || m) && h?.(e);
1046
+ }, p = m && e.groupLabelNode ? e.groupLabelNode : e.label;
1047
+ return (
1048
+ // biome-ignore lint/a11y/noStaticElementInteractions: no keyboard interaction needed
1049
+ /* @__PURE__ */ s.jsxs(
1050
+ "div",
1051
+ {
1052
+ onMouseDown: j,
1053
+ className: f(
1054
+ "px-3 py-2 flex items-center transition-colors text-neutral-default-default ",
1055
+ m ? "cursor-default text-neutral-medium-default" : "cursor-pointer",
1056
+ !m && (n ? " text-primary-default-default" : "hover:bg-neutral-medium-hover text-neutral-default-hover"),
1057
+ u && !m && "text-neutral-default-disabled hover:bg-neutral-default-default"
976
1058
  ),
977
- /* @__PURE__ */ s.jsx("span", { children: p })
978
- ]
979
- },
980
- e.id
981
- )
982
- );
983
- }, (e, n) => e.isSelected === n.isSelected && e.disabled === n.disabled);
984
- We.displayName = "DefaultOptionRenderer";
985
- const Je = Z(({ selectedOptions: e, placeholder: n, onRemoveOption: m, displayMode: i, multiple: u, className: v, disabled: h }) => e?.length === 0 ? n ? /* @__PURE__ */ s.jsx("span", { className: "text-neutral-medium-default opacity-50", children: n }) : null : i === "chips" && u ? /* @__PURE__ */ s.jsx("div", { className: f("flex items-center gap-1 ", v), children: e.map((j) => /* @__PURE__ */ s.jsx(
986
- ot,
987
- {
988
- tabIndex: -1,
989
- id: j.id,
990
- label: j.label,
991
- onRemove: m,
992
- disabled: h
1059
+ children: [
1060
+ i && !m && /* @__PURE__ */ s.jsx(rt, { checked: n, disabled: u }),
1061
+ /* @__PURE__ */ s.jsx("span", { children: p })
1062
+ ]
1063
+ },
1064
+ e.id
1065
+ )
1066
+ );
993
1067
  },
994
- j.id
995
- )) }) : e?.length === 1 ? /* @__PURE__ */ s.jsx("span", { children: e[0].label }) : /* @__PURE__ */ s.jsxs("span", { children: [
996
- e?.length,
997
- " seleccionados"
998
- ] }), (e, n) => e.selectedOptions === n.selectedOptions && e.disabled === n.disabled);
1068
+ (e, n) => e.isSelected === n.isSelected && e.disabled === n.disabled
1069
+ );
1070
+ We.displayName = "DefaultOptionRenderer";
1071
+ const Je = Z(
1072
+ ({
1073
+ selectedOptions: e,
1074
+ placeholder: n,
1075
+ onRemoveOption: h,
1076
+ displayMode: i,
1077
+ multiple: u,
1078
+ className: v,
1079
+ disabled: m
1080
+ }) => e?.length === 0 ? n ? /* @__PURE__ */ s.jsx("span", { className: "text-neutral-medium-default opacity-50", children: n }) : null : i === "chips" && u ? /* @__PURE__ */ s.jsx("div", { className: f("flex items-center gap-1 ", v), children: e.map((j) => /* @__PURE__ */ s.jsx(
1081
+ ot,
1082
+ {
1083
+ tabIndex: -1,
1084
+ id: j.id,
1085
+ label: j.label,
1086
+ onRemove: h,
1087
+ disabled: m
1088
+ },
1089
+ j.id
1090
+ )) }) : e?.length === 1 ? /* @__PURE__ */ s.jsx("span", { children: e[0].label }) : /* @__PURE__ */ s.jsxs("span", { children: [
1091
+ e?.length,
1092
+ " seleccionados"
1093
+ ] }),
1094
+ (e, n) => e.selectedOptions === n.selectedOptions && e.disabled === n.disabled
1095
+ );
999
1096
  Je.displayName = "DefaultSelectionDisplay";
1000
1097
  export {
1001
1098
  St as S,