prometeo-design-system 4.7.1 → 4.7.3

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.
package/dist/Select.es.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { j as s } from "./jsx-runtime-GkKLlHH4.js";
2
2
  import { c } from "./cn-B6yFEsav.js";
3
- import we, { memo as ee, useState as Se, useRef as se, useMemo as Z, useCallback as _, useEffect as he, useImperativeHandle as Qe } from "react";
3
+ import Se, { memo as ee, useState as we, useRef as se, useMemo as Z, useCallback as _, useEffect as he, useImperativeHandle as Qe } from "react";
4
4
  import Xe from "./Spinner.es.js";
5
5
  import { createPortal as Ye } from "react-dom";
6
6
  import { u as Ze } from "./useDragScroll-CHN9OMwn.js";
@@ -8,7 +8,7 @@ import { u as et } from "./useLabelBackground-D5SzHhl_.js";
8
8
  import { H as tt } from "./HelperComponent-ljsn0xD6.js";
9
9
  import nt from "./Chip.es.js";
10
10
  import rt from "./CheckBox.es.js";
11
- import { g as E, h as qe } from "./utils-X4-h3cum.js";
11
+ import { g as k, h as qe } from "./utils-X4-h3cum.js";
12
12
  import lt from "./Input.es.js";
13
13
  import Re from "./Skeleton.es.js";
14
14
  import { Cancel as ot } from "./Icons/Cancel.es.js";
@@ -75,7 +75,7 @@ const st = (e) => {
75
75
  )
76
76
  };
77
77
  function it(e) {
78
- const [n, p] = Se(!1), [x, y] = Se([]), [N, g] = Se(""), z = se(null), m = se(null), A = se(null), $ = se(null), F = se(
78
+ const [n, p] = we(!1), [x, y] = we([]), [N, g] = we(""), A = se(null), f = se(null), z = se(null), $ = se(null), F = se(
79
79
  () => {
80
80
  }
81
81
  ), Ne = se(null), pe = se(/* @__PURE__ */ new Set()), {
@@ -88,10 +88,10 @@ function it(e) {
88
88
  tabIndex: K,
89
89
  className: M,
90
90
  placeholder: W,
91
- optionValue: k,
91
+ optionValue: O,
92
92
  optionLabel: V,
93
93
  renderOption: B,
94
- renderOptionGroupHeader: Ae,
94
+ renderOptionGroupHeader: ze,
95
95
  renderSelection: De,
96
96
  renderOptionContext: je,
97
97
  buttonClassName: ne,
@@ -99,7 +99,7 @@ function it(e) {
99
99
  containerClassName: He,
100
100
  dropdownOptions: v,
101
101
  helperComponent: xe,
102
- errorComponent: ke,
102
+ errorComponent: Oe,
103
103
  onRemoveOption: re,
104
104
  onOptionClick: ie,
105
105
  onClose: ye,
@@ -112,8 +112,8 @@ function it(e) {
112
112
  displayMode: ve = "compact",
113
113
  labelVariant: le = "default",
114
114
  disableOpenOnFocus: Te = !1,
115
- emptyMessage: Oe = "No hay opciones disponibles"
116
- } = e, { ref: Ee } = et(), { bind: Q, ref: Pe } = Ze({
115
+ emptyMessage: Ee = "No hay opciones disponibles"
116
+ } = e, { ref: ke } = et(), { bind: Q, ref: Pe } = Ze({
117
117
  axis: "x",
118
118
  cursor: { idle: "default", dragging: "grabbing" }
119
119
  }), de = e.multiple ? Array.isArray(e.value) && e.value.length > 0 && e.value.every((t) => t != null && t !== "") : e.value !== void 0 && e.value !== null && e.value !== "", Le = {}, _e = Z(() => le === "static" && W ? W : "", [le, W]), Ie = Z(
@@ -133,11 +133,11 @@ function it(e) {
133
133
  return t[le][l];
134
134
  }, L = _(
135
135
  (t) => ({
136
- id: E(t, k),
137
- value: E(t, k),
138
- label: E(t, V)
136
+ id: k(t, O),
137
+ value: k(t, O),
138
+ label: k(t, V)
139
139
  }),
140
- [k, V]
140
+ [O, V]
141
141
  ), q = Z(() => st(R), [R]), fe = Z(
142
142
  () => q.map(L),
143
143
  [q, L]
@@ -146,18 +146,18 @@ function it(e) {
146
146
  if (e.multiple)
147
147
  e.value?.forEach((l) => {
148
148
  const a = q?.find(
149
- (b) => E(b, k) === l
149
+ (b) => k(b, O) === l
150
150
  );
151
151
  a && t.push(a);
152
152
  });
153
153
  else {
154
154
  const l = q?.find(
155
- (a) => E(a, k) === e.value
155
+ (a) => k(a, O) === e.value
156
156
  );
157
157
  l && t.push(l);
158
158
  }
159
159
  return t;
160
- }, [e.value, k, q, e.multiple]), o = Z(
160
+ }, [e.value, O, q, e.multiple]), o = Z(
161
161
  () => r.map(L),
162
162
  [r, L]
163
163
  ), i = Z(
@@ -166,57 +166,57 @@ function it(e) {
166
166
  ), u = Z(() => {
167
167
  const t = [];
168
168
  return R.forEach((l, a) => {
169
- const b = l, w = typeof b == "object" ? b?.options : [];
170
- if (Array.isArray(w) && w.length > 0) {
171
- const d = b.label, D = E(l, k), Y = `__group-${String(D ?? a)}`, me = {
169
+ const b = l, S = typeof b == "object" ? b?.options : [];
170
+ if (Array.isArray(S) && S.length > 0) {
171
+ const h = b.label, D = k(l, O), Y = `__group-${String(D ?? a)}`, me = {
172
172
  id: Y,
173
173
  value: Y,
174
- label: typeof d == "string" ? d : String(D ?? `Grupo ${a + 1}`),
174
+ label: typeof h == "string" ? h : String(D ?? `Grupo ${a + 1}`),
175
175
  isGroupHeader: !0,
176
- groupLabelNode: d,
176
+ groupLabelNode: h,
177
177
  originalOption: l,
178
178
  groupData: {
179
- groupOptions: w
179
+ groupOptions: S
180
180
  }
181
181
  };
182
- t.push(me), w.forEach((O) => {
183
- B ? t.push(O) : t.push(L(O));
182
+ t.push(me), S.forEach((E) => {
183
+ B ? t.push(E) : t.push(L(E));
184
184
  });
185
185
  } else
186
186
  B ? t.push(l) : t.push(L(l));
187
187
  }), t;
188
- }, [R, k, B, L]), C = _(
188
+ }, [R, O, B, L]), C = _(
189
189
  (t, l) => {
190
190
  if (!t || t.length === 0) return;
191
191
  const a = t.map(
192
- (f) => L(f)
192
+ (d) => L(d)
193
193
  );
194
194
  if (!e.multiple) {
195
- const f = a[0];
196
- if (!f) return;
197
- const S = i.has(f.id), ze = l ?? "toggle";
195
+ const d = a[0];
196
+ if (!d) return;
197
+ const w = i.has(d.id), Ae = l ?? "toggle";
198
198
  let Fe;
199
- ze === "select" || ze === "toggle" && !S ? Fe = f : Fe = void 0, e.onChange?.(Fe, j);
199
+ Ae === "select" || Ae === "toggle" && !w ? Fe = d : Fe = void 0, e.onChange?.(Fe, j);
200
200
  return;
201
201
  }
202
- const b = e.value || [], w = [];
203
- b.forEach((f) => {
204
- const S = fe.find((ze) => ze.value === f);
205
- S && w.push(S);
202
+ const b = e.value || [], S = [];
203
+ b.forEach((d) => {
204
+ const w = fe.find((Ae) => Ae.value === d);
205
+ w && S.push(w);
206
206
  });
207
- const d = new Set(w.map((f) => f.id)), D = new Set(a.map((f) => f.id)), Y = a.every(
208
- (f) => d.has(f.id)
209
- ), me = l ?? "toggle", O = me === "select" || me === "toggle" && !Y;
207
+ const h = new Set(S.map((d) => d.id)), D = new Set(a.map((d) => d.id)), Y = a.every(
208
+ (d) => h.has(d.id)
209
+ ), me = l ?? "toggle", E = me === "select" || me === "toggle" && !Y;
210
210
  let Ce;
211
- if (!O)
212
- Ce = w.filter((f) => !D.has(f.id));
211
+ if (!E)
212
+ Ce = S.filter((d) => !D.has(d.id));
213
213
  else {
214
- const f = new Map(
215
- w.map((S) => [S.id, S])
214
+ const d = new Map(
215
+ S.map((w) => [w.id, w])
216
216
  );
217
- a.forEach((S) => {
218
- f.set(S.id, S);
219
- }), Ce = Array.from(f.values());
217
+ a.forEach((w) => {
218
+ d.set(w.id, w);
219
+ }), Ce = Array.from(d.values());
220
220
  }
221
221
  e.onChange?.(Ce, j);
222
222
  },
@@ -237,17 +237,17 @@ function it(e) {
237
237
  e.onChange?.(t, j);
238
238
  else {
239
239
  const l = e.value || [], a = [], b = l.includes(t.value);
240
- l.forEach((d) => {
240
+ l.forEach((h) => {
241
241
  const D = fe.find(
242
- (Y) => Y.value === d
242
+ (Y) => Y.value === h
243
243
  );
244
244
  D && a.push(D);
245
245
  });
246
- const w = b ? a.filter((d) => d.value !== t.value) : [...a, t];
247
- e.onChange?.(w, j);
246
+ const S = b ? a.filter((h) => h.value !== t.value) : [...a, t];
247
+ e.onChange?.(S, j);
248
248
  }
249
249
  };
250
- const h = _(
250
+ const m = _(
251
251
  (t, l = !1) => {
252
252
  ie?.(t, j), F.current?.(t), l && (p(!1), ye?.());
253
253
  },
@@ -264,7 +264,7 @@ function it(e) {
264
264
  (t) => {
265
265
  e.multiple || e.onChange?.(void 0, j);
266
266
  const l = q.find(
267
- (b) => E(b, k) === t
267
+ (b) => k(b, O) === t
268
268
  );
269
269
  if (!l) return;
270
270
  const a = L(l);
@@ -278,7 +278,7 @@ function it(e) {
278
278
  e.multiple,
279
279
  e.onChange,
280
280
  L,
281
- k
281
+ O
282
282
  ]
283
283
  ), X = _(
284
284
  (t) => {
@@ -289,30 +289,26 @@ function it(e) {
289
289
  he(() => {
290
290
  if (!n) return;
291
291
  let t = !1, l = 0;
292
- const a = (d) => {
293
- const D = d.target;
294
- if (console.log("close dropdown target"), d.type === "mousedown") {
295
- if (z.current?.contains(D) || m.current?.contains(D)) return;
292
+ const a = (h) => {
293
+ const D = h.target;
294
+ if (h.type === "mousedown") {
295
+ if (A.current?.contains(D) || f.current?.contains(D)) return;
296
296
  p(!1);
297
297
  }
298
- if (d.type === "scroll") {
299
- if (console.log("close because scroll"), console.log(d, "event"), t || Date.now() - l < 500) {
300
- console.log("ignoring scroll - keyboard related");
301
- return;
302
- }
303
- if (m.current?.contains(D)) return;
298
+ if (h.type === "scroll") {
299
+ if (t || Date.now() - l < 500 || f.current?.contains(D)) return;
304
300
  p(!1);
305
301
  }
306
- d.type === "resize" && (console.log("close dropdown because resize"), console.log(d, "event"), p(!1));
307
- }, b = (d) => {
308
- const D = d.target;
309
- oe(D) && (console.log("focus in keyboard"), t = !0, l = Date.now());
310
- }, w = (d) => {
311
- const D = d.target;
312
- oe(D) && (console.log("focus out keyboard"), t = !1);
302
+ h.type === "resize" && p(!1);
303
+ }, b = (h) => {
304
+ const D = h.target;
305
+ oe(D) && (t = !0, l = Date.now());
306
+ }, S = (h) => {
307
+ const D = h.target;
308
+ oe(D) && (t = !1);
313
309
  };
314
- return document.addEventListener("focusin", b), document.addEventListener("focusout", w), document.addEventListener("mousedown", a), window.addEventListener("scroll", a, !0), window.addEventListener("resize", a, !0), () => {
315
- document.removeEventListener("focusin", b), document.removeEventListener("focusout", w), document.removeEventListener("mousedown", a), window.removeEventListener("scroll", a, !0), window.removeEventListener("resize", a, !0);
310
+ return document.addEventListener("focusin", b), document.addEventListener("focusout", S), document.addEventListener("mousedown", a), window.addEventListener("scroll", a, !0), window.addEventListener("resize", a, !0), () => {
311
+ document.removeEventListener("focusin", b), document.removeEventListener("focusout", S), document.removeEventListener("mousedown", a), window.removeEventListener("scroll", a, !0), window.removeEventListener("resize", a, !0);
316
312
  };
317
313
  }, [n]), he(() => {
318
314
  pe.current.forEach((t) => {
@@ -331,28 +327,28 @@ function it(e) {
331
327
  p(!1);
332
328
  },
333
329
  toggle: () => p((t) => !t),
334
- handleOptionSelect: h,
330
+ handleOptionSelect: m,
335
331
  subscribeOpenChange: (t) => (pe.current.add(t), () => {
336
332
  pe.current.delete(t);
337
333
  }),
338
- searchInputRef: A
334
+ searchInputRef: z
339
335
  }),
340
- [n, h]
336
+ [n, m]
341
337
  );
342
338
  const ae = (t) => {
343
339
  t.preventDefault(), t.stopPropagation(), t.target.matches(":focus-visible") && !Te && !n && (p(!0), setTimeout(() => {
344
- A.current?.focus();
340
+ z.current?.focus();
345
341
  }, 10));
346
342
  }, Ge = (t) => {
347
343
  t.key === "Tab" && n && p(!1), (t.keyCode === 32 || t.key === "ArrowDown") && (p(!0), setTimeout(() => {
348
- A.current?.focus();
344
+ z.current?.focus();
349
345
  }, 10));
350
346
  };
351
347
  return /* @__PURE__ */ s.jsxs(
352
348
  "div",
353
349
  {
354
350
  className: c("relative bg-inherit select-none w-full", M),
355
- ref: z,
351
+ ref: A,
356
352
  draggable: !1,
357
353
  style: Le,
358
354
  children: [
@@ -361,7 +357,7 @@ function it(e) {
361
357
  "label",
362
358
  {
363
359
  htmlFor: `select-${I}`,
364
- ref: Ee,
360
+ ref: ke,
365
361
  className: c(
366
362
  "left-3 pointer-events-none bg-inherit z-10 line-clamp-1 max-w-[calc(100%-2.5rem)] ",
367
363
  le === "default" && "transition-all duration-200 ease-in-out",
@@ -408,7 +404,7 @@ function it(e) {
408
404
  onPointerLeave: Q.onPointerLeave,
409
405
  onPointerCancel: Q.onPointerCancel,
410
406
  onClickCapture: Q.onClickCapture,
411
- children: De ? we.createElement(
407
+ children: De ? Se.createElement(
412
408
  ee(
413
409
  De,
414
410
  (t, l) => t.disabled === l.disabled && t.multiple === l.multiple
@@ -488,12 +484,12 @@ function it(e) {
488
484
  label: ge,
489
485
  isOpen: n,
490
486
  disabled: J,
491
- optionValue: k,
487
+ optionValue: O,
492
488
  optionLabel: V,
493
- emptyMessage: Oe,
489
+ emptyMessage: Ee,
494
490
  labelVariant: le,
495
491
  renderOption: B,
496
- renderOptionGroupHeader: Ae,
492
+ renderOptionGroupHeader: ze,
497
493
  attachToParent: Me,
498
494
  filteredOptions: x,
499
495
  multiple: e.multiple || !1,
@@ -502,15 +498,15 @@ function it(e) {
502
498
  setFilteredOptions: y,
503
499
  renderOptionContext: je,
504
500
  options: u,
505
- selectRef: z,
506
- dropdownRef: m,
501
+ selectRef: A,
502
+ dropdownRef: f,
507
503
  selectButtonRef: $,
508
504
  helperComponentRef: Ne,
509
- onOptionClick: h,
505
+ onOptionClick: m,
510
506
  onCloseDropdown: () => p(!1),
511
507
  searchValue: Ie,
512
508
  setSearchValue: g,
513
- searchInputRef: A,
509
+ searchInputRef: z,
514
510
  isLoading: v?.isLoading,
515
511
  onSearchClear: v?.onSearchClear,
516
512
  hideSearchBar: v?.hideSearchBar,
@@ -525,20 +521,20 @@ function it(e) {
525
521
  onGroupSelectChange: C
526
522
  }
527
523
  ),
528
- (ke || xe) && /* @__PURE__ */ s.jsx("div", { className: "min-h-6", children: /* @__PURE__ */ s.jsx(
524
+ (Oe || xe) && /* @__PURE__ */ s.jsx("div", { className: "min-h-6", children: /* @__PURE__ */ s.jsx(
529
525
  tt,
530
526
  {
531
527
  ref: Ne,
532
528
  variant: T,
533
529
  className: "absolute bottom-0 h-5 overflow-visible line-clamp-1!",
534
- children: ke || xe
530
+ children: Oe || xe
535
531
  }
536
532
  ) })
537
533
  ]
538
534
  }
539
535
  );
540
536
  }
541
- const ut = ee(it, (e, n) => e.value === n.value && e.options === n.options && e.isLoading === n.isLoading && e.disabled === n.disabled && e.errorComponent === n.errorComponent && e.helperComponent === n.helperComponent && e.variant === n.variant && e.label === n.label && e.id === n.id && e.name === n.name && e.placeholder === n.placeholder && e.renderOptionContext === n.renderOptionContext && e.dropdownOptions?.controledSearchValue === n.dropdownOptions?.controledSearchValue && e.dropdownOptions?.isLoading === n.dropdownOptions?.isLoading), kt = ut;
537
+ const ut = ee(it, (e, n) => e.value === n.value && e.options === n.options && e.isLoading === n.isLoading && e.disabled === n.disabled && e.errorComponent === n.errorComponent && e.helperComponent === n.helperComponent && e.variant === n.variant && e.label === n.label && e.id === n.id && e.name === n.name && e.placeholder === n.placeholder && e.renderOptionContext === n.renderOptionContext && e.dropdownOptions?.controledSearchValue === n.dropdownOptions?.controledSearchValue && e.dropdownOptions?.isLoading === n.dropdownOptions?.isLoading), Ot = ut;
542
538
  function ct({
543
539
  footer: e,
544
540
  isOpen: n,
@@ -547,9 +543,9 @@ function ct({
547
543
  multiple: y,
548
544
  disabled: N,
549
545
  selectRef: g,
550
- inputProps: z,
551
- dropdownRef: m,
552
- optionLabel: A,
546
+ inputProps: A,
547
+ dropdownRef: f,
548
+ optionLabel: z,
553
549
  optionValue: $,
554
550
  searchValue: F,
555
551
  labelVariant: Ne,
@@ -563,10 +559,10 @@ function ct({
563
559
  setSearchValue: K,
564
560
  dropdownHeight: M,
565
561
  attachToParent: W,
566
- filteredOptions: k,
562
+ filteredOptions: O,
567
563
  selectButtonRef: V,
568
564
  onCloseDropdown: B,
569
- loadingComponent: Ae,
565
+ loadingComponent: ze,
570
566
  dropdownClassName: De,
571
567
  helperComponentRef: je,
572
568
  selectedOptionsIds: ne,
@@ -574,20 +570,20 @@ function ct({
574
570
  onSearchValueChange: He,
575
571
  isLoading: v = !1,
576
572
  hideSearchBar: xe = !1,
577
- inputSearchPlaceholder: ke = "Buscar opciones",
573
+ inputSearchPlaceholder: Oe = "Buscar opciones",
578
574
  enableGroupToggle: re = !0,
579
575
  focusSearchInputOnOpen: ie = !1,
580
576
  onGroupSelectChange: ye
581
577
  }) {
582
- const ue = e ? 380 : 320, J = Ne === "static" ? p !== "" ? -20 : 4 : 7, T = _(() => M ? M.endsWith("px") ? Number(M.replace("px", "")) : M.endsWith("vh") ? window.innerHeight * Number(M.replace("vh", "")) / 100 : M.endsWith("%") ? window.innerHeight * Number(M.replace("%", "")) / 100 : ue : ue, [M, ue])(), [ce, Me] = Se({
578
+ const ue = e ? 380 : 320, J = Ne === "static" ? p !== "" ? -20 : 4 : 7, T = _(() => M ? M.endsWith("px") ? Number(M.replace("px", "")) : M.endsWith("vh") ? window.innerHeight * Number(M.replace("vh", "")) / 100 : M.endsWith("%") ? window.innerHeight * Number(M.replace("%", "")) / 100 : ue : ue, [M, ue])(), [ce, Me] = we({
583
579
  direction: "down",
584
580
  height: T
585
- }), [ve, le] = Se(
581
+ }), [ve, le] = we(
586
582
  () => /* @__PURE__ */ new Set()
587
583
  ), Te = _(
588
584
  (r) => !ve.has(r),
589
585
  [ve]
590
- ), Oe = _(
586
+ ), Ee = _(
591
587
  (r, o) => {
592
588
  le((i) => {
593
589
  const u = new Set(i), C = u.has(r);
@@ -595,40 +591,40 @@ function ct({
595
591
  });
596
592
  },
597
593
  []
598
- ), Ee = (r) => {
599
- if (!m.current || !g.current) return;
594
+ ), ke = (r) => {
595
+ if (!f.current || !g.current) return;
600
596
  const o = g.current.getBoundingClientRect();
601
597
  switch (r || ce.direction) {
602
598
  case "down":
603
- m.current.style.top = `${o.top + o.height - (je?.current?.offsetHeight ? je?.current?.offsetHeight + 4 : 0)}px`;
599
+ f.current.style.top = `${o.top + o.height - (je?.current?.offsetHeight ? je?.current?.offsetHeight + 4 : 0)}px`;
604
600
  break;
605
601
  case "up":
606
- m.current.style.top = "auto", m.current.style.bottom = `${window.innerHeight - o.top + J}px`;
602
+ f.current.style.top = "auto", f.current.style.bottom = `${window.innerHeight - o.top + J}px`;
607
603
  break;
608
604
  }
609
- m.current.style.left = `${o.left}px`, m.current.style.width = `${o.width}px`;
605
+ f.current.style.left = `${o.left}px`, f.current.style.width = `${o.width}px`;
610
606
  }, Q = (r) => {
611
- m.current && (m.current.style.maxHeight = `${r}px`);
607
+ f.current && (f.current.style.maxHeight = `${r}px`);
612
608
  }, Pe = () => {
613
- if (!m.current || !g.current) return ce;
609
+ if (!f.current || !g.current) return ce;
614
610
  const r = g.current.getBoundingClientRect(), o = window.innerHeight - (window.innerHeight - r.top), i = window.innerHeight - r.bottom, u = i >= T, C = o >= T;
615
- let H = "down", h;
616
- return u ? (H = "down", h = T) : C ? (H = "up", h = T) : i > o ? (H = "down", h = i - 16) : (H = "up", h = o - 16), { direction: H, height: h };
611
+ let H = "down", m;
612
+ return u ? (H = "down", m = T) : C ? (H = "up", m = T) : i > o ? (H = "down", m = i - 16) : (H = "up", m = o - 16), { direction: H, height: m };
617
613
  }, de = (r) => {
618
- if (!(!m.current || !g.current)) {
619
- if (m.current.style.transition = "max-height 0.2s ease,opacity 0.2s ease", !r) {
620
- m.current.style.maxHeight = "0", m.current.style.opacity = "0", m.current.style.pointerEvents = "none";
614
+ if (!(!f.current || !g.current)) {
615
+ if (f.current.style.transition = "max-height 0.2s ease,opacity 0.2s ease", !r) {
616
+ f.current.style.maxHeight = "0", f.current.style.opacity = "0", f.current.style.pointerEvents = "none";
621
617
  return;
622
618
  }
623
619
  if (!W) {
624
620
  const o = Pe();
625
- Me(o), Ee(o.direction), Q(o.height);
621
+ Me(o), ke(o.direction), Q(o.height);
626
622
  }
627
- m.current.style.opacity = "1", m.current.style.pointerEvents = "auto", ie && te?.current && te.current?.focus();
623
+ f.current.style.opacity = "1", f.current.style.pointerEvents = "auto", ie && te?.current && te.current?.focus();
628
624
  }
629
625
  };
630
626
  he(() => {
631
- W || !g.current || !n || Ee();
627
+ W || !g.current || !n || ke();
632
628
  }, [ne]), he(() => {
633
629
  de(n);
634
630
  }, [n]), he(() => {
@@ -641,10 +637,10 @@ function ct({
641
637
  const Le = (r, o) => {
642
638
  if (!o) return r;
643
639
  if (I) {
644
- const h = [];
640
+ const m = [];
645
641
  let G = null, P = [];
646
642
  const X = () => {
647
- G && P.length > 0 && h.push(G, ...P), G = null, P = [];
643
+ G && P.length > 0 && m.push(G, ...P), G = null, P = [];
648
644
  };
649
645
  return r.forEach((oe) => {
650
646
  const ae = oe;
@@ -652,26 +648,26 @@ function ct({
652
648
  X(), G = ae;
653
649
  return;
654
650
  }
655
- const t = oe, l = E(
651
+ const t = oe, l = k(
656
652
  t,
657
- A
653
+ z
658
654
  ), a = qe(String(l ?? ""), o);
659
- G ? a && P.push(t) : a && h.push(t);
660
- }), X(), h;
655
+ G ? a && P.push(t) : a && m.push(t);
656
+ }), X(), m;
661
657
  }
662
658
  const i = [];
663
659
  let u = null, C = [];
664
660
  const H = () => {
665
661
  u && C.length > 0 && i.push(u, ...C), u = null, C = [];
666
662
  };
667
- return r.forEach((h) => {
668
- if (typeof h != "object" || h === null) return;
669
- if ((h || {})?.isGroupHeader) {
670
- H(), u = h;
663
+ return r.forEach((m) => {
664
+ if (typeof m != "object" || m === null) return;
665
+ if ((m || {})?.isGroupHeader) {
666
+ H(), u = m;
671
667
  return;
672
668
  }
673
- const G = qe(h.label, o);
674
- u ? G && C.push(h) : G && i.push(h);
669
+ const G = qe(m.label, o);
670
+ u ? G && C.push(m) : G && i.push(m);
675
671
  }), H(), i;
676
672
  }, _e = (r) => {
677
673
  const o = Le(x, r);
@@ -688,7 +684,7 @@ function ct({
688
684
  if (R) {
689
685
  R(), U(
690
686
  x.filter((r) => {
691
- const o = I ? E(r, $) : r.id;
687
+ const o = I ? k(r, $) : r.id;
692
688
  return ne.has(o);
693
689
  })
694
690
  );
@@ -704,14 +700,14 @@ function ct({
704
700
  K,
705
701
  I
706
702
  ]), $e = (r) => {
707
- r.key === "ArrowDown" ? (r.preventDefault(), m.current?.querySelector(
703
+ r.key === "ArrowDown" ? (r.preventDefault(), f.current?.querySelector(
708
704
  "[role=listitem]"
709
705
  )?.focus()) : (r.key === "Tab" || r.key === "Escape") && setTimeout(() => {
710
706
  V.current?.focus(), B();
711
707
  }, 10);
712
708
  }, L = (r, o) => {
713
709
  const i = Array.from(
714
- m.current?.querySelectorAll("[role=listitem]") || []
710
+ f.current?.querySelectorAll("[role=listitem]") || []
715
711
  ), u = i.indexOf(r.currentTarget);
716
712
  if (r.key === "ArrowDown") {
717
713
  r.preventDefault();
@@ -735,7 +731,7 @@ function ct({
735
731
  V.current?.focus(), B();
736
732
  }, 10);
737
733
  }, q = Array.from({ length: 5 }).map(
738
- (r, o) => I ? we.createElement(
734
+ (r, o) => I ? Se.createElement(
739
735
  ee(I, (i, u) => i.isSelected === u.isSelected && i.option === u.option && i.disabled === u.disabled && i.multiple === u.multiple && i.renderContext === u.renderContext),
740
736
  {
741
737
  key: `skeleton-option-${o}`,
@@ -765,7 +761,7 @@ function ct({
765
761
  "div",
766
762
  {
767
763
  tabIndex: 0,
768
- ref: m,
764
+ ref: f,
769
765
  style: { opacity: "0" },
770
766
  className: c(
771
767
  " z-100! w-full mt-1 bg-neutral-default-default border border-neutral-default-default rounded-lg shadow-lg",
@@ -803,21 +799,21 @@ function ct({
803
799
  onKeyDown: $e,
804
800
  onClear: Ie,
805
801
  onChange: (r) => _e(r.target.value),
806
- placeholder: ke,
802
+ placeholder: Oe,
807
803
  className: " bg-neutral-medium-pressed *:max-h-8",
808
- ...z
804
+ ...A
809
805
  }
810
806
  ),
811
- /* @__PURE__ */ s.jsx("div", { className: " overflow-y-auto flex-1 max-h-max ", children: k.length === 0 ? v ? /* @__PURE__ */ s.jsx("div", { className: "flex flex-col gap-1 overflow-hidden w-full", children: Ae || q }) : /* @__PURE__ */ s.jsx("p", { className: "px-3 py-2 text-neutral-medium-default max-w-full text-pretty wrap-break-word ", children: F ? `No se encontraron resultados para "${F}"` : pe }) : (() => {
807
+ /* @__PURE__ */ s.jsx("div", { className: " overflow-y-auto flex-1 max-h-max ", children: O.length === 0 ? v ? /* @__PURE__ */ s.jsx("div", { className: "flex flex-col gap-1 overflow-hidden w-full", children: ze || q }) : /* @__PURE__ */ s.jsx("p", { className: "px-3 py-2 text-neutral-medium-default max-w-full text-pretty wrap-break-word ", children: F ? `No se encontraron resultados para "${F}"` : pe }) : (() => {
812
808
  let r = !0;
813
- return k.map((o) => {
814
- const i = o, u = !!(i || {}).isGroupHeader, C = I && !u ? E(o, $) : i.id, H = ne.has(C), h = (l) => !I || u ? l : {
809
+ return O.map((o) => {
810
+ const i = o, u = !!(i || {}).isGroupHeader, C = I && !u ? k(o, $) : i.id, H = ne.has(C), m = (l) => !I || u ? l : {
815
811
  id: C,
816
- label: String(E(l, A)),
817
- value: E(l, $)
812
+ label: String(k(l, z)),
813
+ value: k(l, $)
818
814
  }, G = (l) => {
819
815
  u || be(
820
- h(o),
816
+ m(o),
821
817
  l === void 0 ? !y : l
822
818
  );
823
819
  }, P = (l) => {
@@ -834,7 +830,7 @@ function ct({
834
830
  {
835
831
  tabIndex: 0,
836
832
  role: "listitem",
837
- onKeyDown: (w) => L(w, a),
833
+ onKeyDown: (S) => L(S, a),
838
834
  className: c(
839
835
  !b && !N && "focus-visible:bg-neutral-medium-hover outline-none hover:bg-neutral-medium-hover",
840
836
  H && "bg-neutral-medium-selected",
@@ -849,21 +845,21 @@ function ct({
849
845
  if (u) {
850
846
  const l = i.groupLabelNode ?? i.label, a = String(i.id), b = re === !1 ? !0 : Te(a);
851
847
  r = b;
852
- const w = i.originalOption, d = i.groupData?.groupOptions ?? [], D = (O) => {
853
- re && Oe(a, O);
854
- }, Y = (O) => {
855
- !d || d.length === 0 || ye && ye(d, O);
856
- }, me = d.filter(
857
- (O) => ne.has(E(O, $))
858
- ).map((O) => String(E(O, $)));
848
+ const S = i.originalOption, h = i.groupData?.groupOptions ?? [], D = (E) => {
849
+ re && Ee(a, E);
850
+ }, Y = (E) => {
851
+ !h || h.length === 0 || ye && ye(h, E);
852
+ }, me = h.filter(
853
+ (E) => ne.has(k(E, $))
854
+ ).map((E) => String(k(E, $)));
859
855
  if (ge) {
860
- const O = ee(
856
+ const E = ee(
861
857
  ge,
862
- (f, S) => f.label === S.label && f.group === S.group && f.groupOptions === S.groupOptions && f.disabled === S.disabled && f.multiple === S.multiple && f.expanded === S.expanded && f.renderContext === S.renderContext
863
- ), Ce = we.createElement(O, {
864
- group: w,
858
+ (d, w) => d.label === w.label && d.group === w.group && d.groupOptions === w.groupOptions && d.disabled === w.disabled && d.multiple === w.multiple && d.expanded === w.expanded && d.renderContext === w.renderContext
859
+ ), Ce = Se.createElement(E, {
860
+ group: S,
865
861
  label: l,
866
- groupOptions: d,
862
+ groupOptions: h,
867
863
  multiple: y,
868
864
  disabled: N,
869
865
  expanded: b,
@@ -881,7 +877,7 @@ function ct({
881
877
  "div",
882
878
  {
883
879
  className: "cursor-pointer",
884
- onClick: () => Oe(a),
880
+ onClick: () => Ee(a),
885
881
  children: /* @__PURE__ */ s.jsx(
886
882
  Ve,
887
883
  {
@@ -897,7 +893,7 @@ function ct({
897
893
  i
898
894
  );
899
895
  }
900
- const oe = I ? we.createElement(
896
+ const oe = I ? Se.createElement(
901
897
  ee(
902
898
  I,
903
899
  (l, a) => l.isSelected === a.isSelected && l.option === a.option && l.disabled === a.disabled && l.multiple === a.multiple && l.renderContext === a.renderContext
@@ -925,12 +921,12 @@ function ct({
925
921
  C
926
922
  ), ae = X(
927
923
  oe,
928
- h(o)
924
+ m(o)
929
925
  );
930
926
  if (!re)
931
927
  return ae;
932
928
  const Ge = !r, t = ae;
933
- return we.cloneElement(t, {
929
+ return Se.cloneElement(t, {
934
930
  className: c(
935
931
  t.props.className,
936
932
  "overflow-hidden transition-[max-height] duration-300 ease-out",
@@ -972,13 +968,13 @@ const dt = ee(
972
968
  },
973
969
  e.id
974
970
  );
975
- const z = (A) => {
976
- A.preventDefault(), A.stopPropagation(), !(y || g) && p?.(e);
977
- }, m = g && e.groupLabelNode ? e.groupLabelNode : e.label;
971
+ const A = (z) => {
972
+ z.preventDefault(), z.stopPropagation(), !(y || g) && p?.(e);
973
+ }, f = g && e.groupLabelNode ? e.groupLabelNode : e.label;
978
974
  return /* @__PURE__ */ s.jsxs(
979
975
  "div",
980
976
  {
981
- onMouseDown: z,
977
+ onMouseDown: A,
982
978
  className: c(
983
979
  "px-3 py-2 flex items-center transition-colors text-neutral-default-default ",
984
980
  g ? "cursor-default text-neutral-medium-default" : "cursor-pointer",
@@ -987,7 +983,7 @@ const dt = ee(
987
983
  ),
988
984
  children: [
989
985
  x && !g && /* @__PURE__ */ s.jsx(rt, { checked: n, disabled: y }),
990
- /* @__PURE__ */ s.jsx("span", { children: m })
986
+ /* @__PURE__ */ s.jsx("span", { children: f })
991
987
  ]
992
988
  },
993
989
  e.id
@@ -1005,16 +1001,16 @@ const Je = ee(
1005
1001
  multiple: y,
1006
1002
  className: N,
1007
1003
  disabled: g
1008
- }) => e?.length === 0 ? n ? /* @__PURE__ */ s.jsx("span", { className: "text-neutral-medium-default line-clamp-1", children: n }) : null : x === "chips" && y ? /* @__PURE__ */ s.jsx("div", { className: c("flex items-center gap-1 ", N), children: e.map((z) => /* @__PURE__ */ s.jsx(
1004
+ }) => e?.length === 0 ? n ? /* @__PURE__ */ s.jsx("span", { className: "text-neutral-medium-default line-clamp-1", children: n }) : null : x === "chips" && y ? /* @__PURE__ */ s.jsx("div", { className: c("flex items-center gap-1 ", N), children: e.map((A) => /* @__PURE__ */ s.jsx(
1009
1005
  nt,
1010
1006
  {
1011
1007
  tabIndex: -1,
1012
- id: z.id,
1013
- label: z.label,
1008
+ id: A.id,
1009
+ label: A.label,
1014
1010
  onRemove: p,
1015
1011
  disabled: g
1016
1012
  },
1017
- z.id
1013
+ A.id
1018
1014
  )) }) : e?.length === 1 ? /* @__PURE__ */ s.jsx("span", { className: "line-clamp-1", children: e[0].label }) : /* @__PURE__ */ s.jsxs("span", { className: "line-clamp-1", children: [
1019
1015
  e?.length,
1020
1016
  " seleccionados"
@@ -1023,5 +1019,5 @@ const Je = ee(
1023
1019
  );
1024
1020
  Je.displayName = "DefaultSelectionDisplay";
1025
1021
  export {
1026
- kt as default
1022
+ Ot as default
1027
1023
  };