prometeo-design-system 4.3.3 → 4.3.6

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,20 +1,20 @@
1
1
  import { j as a } from "./jsx-runtime-GkKLlHH4.js";
2
2
  import { c as d } from "./cn-B6yFEsav.js";
3
- import Se, { memo as J, useState as Ne, useRef as ae, useMemo as te, useCallback as _, useEffect as he, useImperativeHandle as Qe } from "react";
4
- import Xe from "./Spinner.es.js";
5
- import { createPortal as Ye } from "react-dom";
6
- import { u as Ze } from "./useDragScroll-CHN9OMwn.js";
7
- import { u as et } from "./useLabelBackground-D5SzHhl_.js";
8
- import { H as tt } from "./HelperComponent-ljsn0xD6.js";
9
- import { Close as nt } from "./Icons/Close.es.js";
10
- import rt from "./CheckBox.es.js";
11
- import { g as k, h as Fe } from "./utils-X4-h3cum.js";
12
- import lt from "./Input.es.js";
13
- import Ue from "./Skeleton.es.js";
3
+ import Se, { memo as J, useState as Ne, useRef as ae, useMemo as te, useCallback as $, useEffect as pe, useImperativeHandle as Xe } from "react";
4
+ import Ye from "./Spinner.es.js";
5
+ import { createPortal as Ze } from "react-dom";
6
+ import { u as et } from "./useDragScroll-CHN9OMwn.js";
7
+ import { u as tt } from "./useLabelBackground-D5SzHhl_.js";
8
+ import { H as nt } from "./HelperComponent-ljsn0xD6.js";
9
+ import { Close as rt } from "./Icons/Close.es.js";
10
+ import lt from "./CheckBox.es.js";
11
+ import { g as L, h as Ue } from "./utils-X4-h3cum.js";
12
+ import ot from "./Input.es.js";
13
+ import qe from "./Skeleton.es.js";
14
14
  import { Cancel as at } from "./Icons/Cancel.es.js";
15
- import { ChevronDown as Ve } from "./Icons/ChevronDown.es.js";
16
- import { Search as ot } from "./Icons/Search.es.js";
17
- const st = {
15
+ import { ChevronDown as Re } from "./Icons/ChevronDown.es.js";
16
+ import { Search as st } from "./Icons/Search.es.js";
17
+ const it = {
18
18
  default: {
19
19
  container: "text-neutral-default-default border-neutral-default-default ",
20
20
  icon: ""
@@ -27,49 +27,49 @@ const st = {
27
27
  container: "",
28
28
  icon: ""
29
29
  }
30
- }, qe = {
30
+ }, Ve = {
31
31
  icon: " text-neutral-default-disabled",
32
32
  container: " border-neutral-strong-default text-neutral-default-disabled"
33
- }, Re = ({ id: e, label: n, onRemove: h, className: y, disabled: g, variant: v = "default", tabIndex: b }) => /* @__PURE__ */ a.jsxs(
33
+ }, Je = ({ id: e, label: n, onRemove: f, className: x, disabled: h, variant: w = "default", tabIndex: p }) => /* @__PURE__ */ a.jsxs(
34
34
  "div",
35
35
  {
36
- tabIndex: b,
36
+ tabIndex: p,
37
37
  className: d(
38
38
  "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]",
39
- st[v].container,
40
- g && qe.container
39
+ it[w].container,
40
+ h && Ve.container
41
41
  ),
42
42
  children: [
43
43
  /* @__PURE__ */ a.jsx("span", { className: "truncate w-max ", children: n }),
44
- h && /* @__PURE__ */ a.jsx(
44
+ f && /* @__PURE__ */ a.jsx(
45
45
  "button",
46
46
  {
47
- onMouseDown: (H) => {
48
- g || (H.stopPropagation(), H.preventDefault(), h?.(e));
47
+ onMouseDown: (O) => {
48
+ h || (O.stopPropagation(), O.preventDefault(), f?.(e));
49
49
  },
50
50
  className: d(
51
51
  "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",
52
- g && "cursor-default hover:scale-100",
53
- y
52
+ h && "cursor-default hover:scale-100",
53
+ x
54
54
  ),
55
55
  type: "button",
56
- tabIndex: b,
57
- children: /* @__PURE__ */ a.jsx(nt, { size: 18, className: d(g && qe.icon) })
56
+ tabIndex: p,
57
+ children: /* @__PURE__ */ a.jsx(rt, { size: 18, className: d(h && Ve.icon) })
58
58
  }
59
59
  )
60
60
  ]
61
61
  }
62
62
  );
63
- Re.displayName = "Chip";
64
- const it = J(Re), ut = (e) => {
65
- const n = [], h = (y) => {
66
- y.forEach((g) => {
67
- const v = g, b = typeof v == "object" ? v?.options : [];
68
- Array.isArray(b) && b.length > 0 ? h(b) : n.push(g);
63
+ Je.displayName = "Chip";
64
+ const ut = J(Je), ct = (e) => {
65
+ const n = [], f = (x) => {
66
+ x.forEach((h) => {
67
+ const w = h, p = typeof w == "object" ? w?.options : [];
68
+ Array.isArray(p) && p.length > 0 ? f(p) : n.push(h);
69
69
  });
70
70
  };
71
- return h(e), n;
72
- }, We = {
71
+ return f(e), n;
72
+ }, Ke = {
73
73
  default: {
74
74
  container: "",
75
75
  input: d(
@@ -106,7 +106,7 @@ const it = J(Re), ut = (e) => {
106
106
  label: d("text-success", "peer-focus:text-success-light"),
107
107
  icon: d("text-success-medium-default", "peer-focus:text-success-light")
108
108
  }
109
- }, Be = {
109
+ }, We = {
110
110
  input: d(
111
111
  "border-neutral-strong-default text-neutral-default-default pointer-events-none",
112
112
  "focus:ring-0 focus:border-primary-default-disabled ",
@@ -121,50 +121,50 @@ const it = J(Re), ut = (e) => {
121
121
  "peer-focus:text-primary-default-default"
122
122
  )
123
123
  };
124
- function ct(e) {
125
- const [n, h] = Ne(!1), [y, g] = Ne([]), [v, b] = Ne(""), H = ae(null), p = ae(null), P = ae(null), W = ae(null), B = ae(
124
+ function dt(e) {
125
+ const [n, f] = Ne(!1), [x, h] = Ne([]), [w, p] = Ne(""), O = ae(null), m = ae(null), T = ae(null), _ = ae(null), F = ae(
126
126
  () => {
127
127
  }
128
- ), je = ae(null), pe = ae(/* @__PURE__ */ new Set()), {
129
- id: G,
130
- name: S,
131
- label: ge,
132
- height: be,
128
+ ), De = ae(null), ge = ae(/* @__PURE__ */ new Set()), {
129
+ id: A,
130
+ name: j,
131
+ label: be,
132
+ height: xe,
133
133
  options: Q,
134
134
  controls: ne,
135
135
  className: K,
136
- placeholder: E,
137
- optionValue: N,
138
- optionLabel: oe,
139
- renderOption: F,
140
- renderOptionGroupHeader: se,
141
- renderSelection: De,
136
+ placeholder: G,
137
+ optionValue: H,
138
+ optionLabel: se,
139
+ renderOption: W,
140
+ renderOptionGroupHeader: ie,
141
+ renderSelection: je,
142
142
  renderOptionContext: ze,
143
143
  buttonClassName: He,
144
144
  dropdownClassName: re,
145
- containerClassName: U,
146
- dropdownOptions: j,
145
+ containerClassName: B,
146
+ dropdownOptions: k,
147
147
  helperComponent: X,
148
- errorComponent: xe,
149
- onRemoveOption: Oe,
150
- onOptionClick: q,
151
- onClose: ke,
152
- onClear: ye,
153
- disabled: $ = !1,
148
+ errorComponent: ye,
149
+ onRemoveOption: ke,
150
+ onOptionClick: U,
151
+ onClose: Oe,
152
+ onClear: ve,
153
+ disabled: P = !1,
154
154
  overflow: Ae = "wrap",
155
- variant: ve = "default",
155
+ variant: Ce = "default",
156
156
  isLoading: le = !1,
157
- attachToParent: ie = !1,
157
+ attachToParent: ue = !1,
158
158
  displayMode: Ee = "compact",
159
159
  labelVariant: Y = "default",
160
160
  disableOpenOnFocus: Me = !1,
161
161
  emptyMessage: Te = "No hay opciones disponibles"
162
- } = e, { ref: Le } = et(), { bind: V, ref: Pe } = Ze({
162
+ } = e, { ref: Le } = tt(), { bind: q, ref: Pe } = et({
163
163
  axis: "x",
164
164
  cursor: { idle: "default", dragging: "grabbing" }
165
- }), ue = 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 !== "", $e = {}, Ge = te(() => Y === "static" && E ? E : "", [Y, E]), _e = te(
166
- () => j?.controledSearchValue || v,
167
- [j?.controledSearchValue, v]
165
+ }), ce = 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 !== "", $e = {}, Ge = te(() => Y === "static" && G ? G : "", [Y, G]), _e = te(
166
+ () => k?.controledSearchValue || w,
167
+ [k?.controledSearchValue, w]
168
168
  ), Ie = () => {
169
169
  const t = {
170
170
  static: {
@@ -175,257 +175,269 @@ function ct(e) {
175
175
  active: "absolute top-0 -translate-y-1/2 left-3 px-1 prometeo-fonts-body-small",
176
176
  default: "absolute top-1/2 -translate-y-1/2 "
177
177
  }
178
- }, o = n || ue ? "active" : "default";
179
- return t[Y][o];
180
- }, L = _(
178
+ }, s = n || ce ? "active" : "default";
179
+ return t[Y][s];
180
+ }, I = $(
181
181
  (t) => ({
182
- id: k(t, N),
183
- value: k(t, N),
184
- label: k(t, oe)
182
+ id: L(t, H),
183
+ value: L(t, H),
184
+ label: L(t, se)
185
185
  }),
186
- [N, oe]
187
- ), R = te(() => ut(Q), [Q]), Ce = te(
188
- () => R.map(L),
189
- [R, L]
190
- ), ce = te(() => {
186
+ [H, se]
187
+ ), V = te(() => ct(Q), [Q]), we = te(
188
+ () => V.map(I),
189
+ [V, I]
190
+ ), de = te(() => {
191
191
  const t = [];
192
192
  if (e.multiple)
193
- e.value?.forEach((o) => {
194
- const c = R?.find(
195
- (i) => k(i, N) === o
193
+ e.value?.forEach((s) => {
194
+ const l = V?.find(
195
+ (c) => L(c, H) === s
196
196
  );
197
- c && t.push(c);
197
+ l && t.push(l);
198
198
  });
199
199
  else {
200
- const o = R?.find(
201
- (c) => k(c, N) === e.value
200
+ const s = V?.find(
201
+ (l) => L(l, H) === e.value
202
202
  );
203
- o && t.push(o);
203
+ s && t.push(s);
204
204
  }
205
205
  return t;
206
- }, [e.value, N, R, e.multiple]), r = te(
207
- () => ce.map(L),
208
- [ce, L]
209
- ), l = te(
206
+ }, [e.value, H, V, e.multiple]), r = te(
207
+ () => de.map(I),
208
+ [de, I]
209
+ ), o = te(
210
210
  () => new Set(r.map((t) => t.id)),
211
211
  [r]
212
- ), s = te(() => {
212
+ ), i = te(() => {
213
213
  const t = [];
214
- return Q.forEach((o, c) => {
215
- const i = o, f = typeof i == "object" ? i?.options : [];
216
- if (Array.isArray(f) && f.length > 0) {
217
- const D = i.label, M = k(o, N), I = `__group-${String(M ?? c)}`, fe = {
218
- id: I,
219
- value: I,
220
- label: typeof D == "string" ? D : String(M ?? `Grupo ${c + 1}`),
214
+ return Q.forEach((s, l) => {
215
+ const c = s, v = typeof c == "object" ? c?.options : [];
216
+ if (Array.isArray(v) && v.length > 0) {
217
+ const g = c.label, y = L(s, H), ee = `__group-${String(y ?? l)}`, me = {
218
+ id: ee,
219
+ value: ee,
220
+ label: typeof g == "string" ? g : String(y ?? `Grupo ${l + 1}`),
221
221
  isGroupHeader: !0,
222
- groupLabelNode: D,
223
- originalOption: o,
222
+ groupLabelNode: g,
223
+ originalOption: s,
224
224
  groupData: {
225
- groupOptions: f
225
+ groupOptions: v
226
226
  }
227
227
  };
228
- t.push(fe), f.forEach((me) => {
229
- F ? t.push(me) : t.push(L(me));
228
+ t.push(me), v.forEach((he) => {
229
+ W ? t.push(he) : t.push(I(he));
230
230
  });
231
231
  } else
232
- F ? t.push(o) : t.push(L(o));
232
+ W ? t.push(s) : t.push(I(s));
233
233
  }), t;
234
- }, [Q, N, F, L]), u = _(
235
- (t, o) => {
234
+ }, [Q, H, W, I]), u = $(
235
+ (t, s) => {
236
236
  if (!t || t.length === 0) return;
237
- const c = t.map(
238
- (m) => L(m)
237
+ const l = t.map(
238
+ (C) => I(C)
239
239
  );
240
240
  if (!e.multiple) {
241
- const m = c[0];
242
- if (!m) return;
243
- const z = l.has(m.id), A = o ?? "toggle";
244
- let T;
245
- A === "select" || A === "toggle" && !z ? T = m : T = void 0, e.onChange?.(T, S);
241
+ const C = l[0];
242
+ if (!C) return;
243
+ const N = o.has(C.id), M = s ?? "toggle";
244
+ let Fe;
245
+ M === "select" || M === "toggle" && !N ? Fe = C : Fe = void 0, e.onChange?.(Fe, j);
246
246
  return;
247
247
  }
248
- const i = e.value || [], f = [];
249
- i.forEach((m) => {
250
- const z = Ce.find((A) => A.value === m);
251
- z && f.push(z);
248
+ const c = e.value || [], v = [];
249
+ c.forEach((C) => {
250
+ const N = we.find((M) => M.value === C);
251
+ N && v.push(N);
252
252
  });
253
- const D = new Set(f.map((m) => m.id)), M = new Set(c.map((m) => m.id)), I = c.every(
254
- (m) => D.has(m.id)
255
- ), fe = o ?? "toggle", me = fe === "select" || fe === "toggle" && !I;
256
- let we;
257
- if (!me)
258
- we = f.filter((m) => !M.has(m.id));
253
+ const g = new Set(v.map((C) => C.id)), y = new Set(l.map((C) => C.id)), ee = l.every(
254
+ (C) => g.has(C.id)
255
+ ), me = s ?? "toggle", he = me === "select" || me === "toggle" && !ee;
256
+ let z;
257
+ if (!he)
258
+ z = v.filter((C) => !y.has(C.id));
259
259
  else {
260
- const m = new Map(
261
- f.map((z) => [z.id, z])
260
+ const C = new Map(
261
+ v.map((N) => [N.id, N])
262
262
  );
263
- c.forEach((z) => {
264
- m.set(z.id, z);
265
- }), we = Array.from(m.values());
263
+ l.forEach((N) => {
264
+ C.set(N.id, N);
265
+ }), z = Array.from(C.values());
266
266
  }
267
- e.onChange?.(we, S);
267
+ e.onChange?.(z, j);
268
268
  },
269
269
  [
270
270
  e.multiple,
271
271
  e.value,
272
272
  e.onChange,
273
- Ce,
274
- l,
275
- L,
276
- S
273
+ we,
274
+ o,
275
+ I,
276
+ j
277
277
  ]
278
- ), C = _(() => {
279
- h((t) => !t);
278
+ ), S = $(() => {
279
+ f((t) => !t);
280
280
  }, []);
281
- B.current = (t) => {
281
+ F.current = (t) => {
282
282
  if (!e.multiple)
283
- e.onChange?.(t, S);
283
+ e.onChange?.(t, j);
284
284
  else {
285
- const o = e.value || [], c = [], i = o.includes(t.value);
286
- o.forEach((D) => {
287
- const M = Ce.find(
288
- (I) => I.value === D
285
+ const s = e.value || [], l = [], c = s.includes(t.value);
286
+ s.forEach((g) => {
287
+ const y = we.find(
288
+ (ee) => ee.value === g
289
289
  );
290
- M && c.push(M);
290
+ y && l.push(y);
291
291
  });
292
- const f = i ? c.filter((D) => D.value !== t.value) : [...c, t];
293
- e.onChange?.(f, S);
292
+ const v = c ? l.filter((g) => g.value !== t.value) : [...l, t];
293
+ e.onChange?.(v, j);
294
294
  }
295
295
  };
296
- const w = _(
297
- (t, o = !1) => {
298
- q?.(t, S), B.current?.(t), o && (h(!1), ke?.());
296
+ const D = $(
297
+ (t, s = !1) => {
298
+ U?.(t, j), F.current?.(t), s && (f(!1), Oe?.());
299
299
  },
300
- [q, ke, S]
301
- ), x = (t) => {
302
- if (t.preventDefault(), t.stopPropagation(), t.target.blur(), ye?.(), e.multiple) {
303
- const o = e.onChange;
304
- o?.([], S);
300
+ [U, Oe, j]
301
+ ), b = (t) => {
302
+ if (t.preventDefault(), t.stopPropagation(), t.target.blur(), ve?.(), e.multiple) {
303
+ const s = e.onChange;
304
+ s?.([], j);
305
305
  } else {
306
- const o = e.onChange;
307
- o?.(void 0, S);
306
+ const s = e.onChange;
307
+ s?.(void 0, j);
308
308
  }
309
- }, O = _(
309
+ }, E = $(
310
310
  (t) => {
311
- e.multiple || e.onChange?.(void 0, S);
312
- const o = R.find(
313
- (i) => k(i, N) === t
311
+ e.multiple || e.onChange?.(void 0, j);
312
+ const s = V.find(
313
+ (c) => L(c, H) === t
314
314
  );
315
- if (!o) return;
316
- const c = L(o);
317
- q?.(c, S), B.current?.(c), Oe?.(o);
315
+ if (!s) return;
316
+ const l = I(s);
317
+ U?.(l, j), F.current?.(l), ke?.(s);
318
318
  },
319
319
  [
320
- q,
321
- Oe,
322
- R,
323
- S,
320
+ U,
321
+ ke,
322
+ V,
323
+ j,
324
324
  e.multiple,
325
325
  e.onChange,
326
- L,
327
- N
326
+ I,
327
+ H
328
328
  ]
329
- ), Z = _(
329
+ ), Z = $(
330
330
  (t) => {
331
- O(t);
331
+ E(t);
332
332
  },
333
- [O]
334
- );
335
- he(() => {
333
+ [E]
334
+ ), R = (t) => t.tagName === "INPUT" && !["button", "submit", "checkbox", "file", "image"].includes(t.type) || t.hasAttribute("contenteditable");
335
+ pe(() => {
336
336
  if (!n) return;
337
- const t = (o) => {
338
- const c = o.target;
339
- if (o.type === "mousedown") {
340
- if (H.current?.contains(c) || p.current?.contains(c)) return;
341
- h(!1);
337
+ let t = !1, s = 0;
338
+ const l = (g) => {
339
+ const y = g.target;
340
+ if (console.log("close dropdown target"), g.type === "mousedown") {
341
+ if (O.current?.contains(y) || m.current?.contains(y)) return;
342
+ f(!1);
342
343
  }
343
- if (o.type === "scroll") {
344
- if (p.current?.contains(c)) return;
345
- h(!1);
344
+ if (g.type === "scroll") {
345
+ if (console.log("close because scroll"), console.log(g, "event"), t || Date.now() - s < 500) {
346
+ console.log("ignoring scroll - keyboard related");
347
+ return;
348
+ }
349
+ if (m.current?.contains(y)) return;
350
+ f(!1);
346
351
  }
347
- o.type === "resize" && h(!1);
352
+ g.type === "resize" && (console.log("close dropdown because resize"), console.log(g, "event"), f(!1));
353
+ }, c = (g) => {
354
+ const y = g.target;
355
+ R(y) && (console.log("focus in keyboard"), t = !0, s = Date.now());
356
+ }, v = (g) => {
357
+ const y = g.target;
358
+ R(y) && (console.log("focus out keyboard"), t = !1);
348
359
  };
349
- return document.addEventListener("mousedown", t), window.addEventListener("scroll", t, !0), window.addEventListener("resize", t, !0), () => {
350
- document.removeEventListener("mousedown", t), window.removeEventListener("scroll", t, !0), window.removeEventListener("resize", t, !0);
360
+ return document.addEventListener("focusin", c), document.addEventListener("focusout", v), document.addEventListener("mousedown", l), window.addEventListener("scroll", l, !0), window.addEventListener("resize", l, !0), () => {
361
+ document.removeEventListener("focusin", c), document.removeEventListener("focusout", v), document.removeEventListener("mousedown", l), window.removeEventListener("scroll", l, !0), window.removeEventListener("resize", l, !0);
351
362
  };
352
- }, [n]), he(() => {
353
- pe.current.forEach((t) => {
363
+ }, [n]), pe(() => {
364
+ ge.current.forEach((t) => {
354
365
  try {
355
366
  t(n);
356
367
  } catch {
357
368
  }
358
369
  });
359
- }, [n]), Qe(
370
+ }, [n]), Xe(
360
371
  ne,
361
372
  () => ({
362
373
  open: () => {
363
- h(!0);
374
+ f(!0);
364
375
  },
365
376
  close: () => {
366
- h(!1);
377
+ f(!1);
367
378
  },
368
- toggle: () => h((t) => !t),
369
- handleOptionSelect: w,
370
- subscribeOpenChange: (t) => (pe.current.add(t), () => {
371
- pe.current.delete(t);
379
+ toggle: () => f((t) => !t),
380
+ handleOptionSelect: D,
381
+ subscribeOpenChange: (t) => (ge.current.add(t), () => {
382
+ ge.current.delete(t);
372
383
  }),
373
- searchInputRef: P
384
+ searchInputRef: T
374
385
  }),
375
- [n, w]
386
+ [n, D]
376
387
  );
377
- const ee = (t) => {
378
- t.preventDefault(), t.stopPropagation(), t.target.matches(":focus-visible") && !Me && !n && (h(!0), setTimeout(() => {
379
- P.current?.focus();
388
+ const fe = (t) => {
389
+ t.preventDefault(), t.stopPropagation(), t.target.matches(":focus-visible") && !Me && !n && (f(!0), setTimeout(() => {
390
+ T.current?.focus();
380
391
  }, 10));
381
- }, de = (t) => {
382
- t.key === "Tab" && n && h(!1), (t.keyCode === 32 || t.key === "ArrowDown") && (h(!0), setTimeout(() => {
383
- P.current?.focus();
392
+ }, oe = (t) => {
393
+ t.key === "Tab" && n && f(!1), (t.keyCode === 32 || t.key === "ArrowDown") && (f(!0), setTimeout(() => {
394
+ T.current?.focus();
384
395
  }, 10));
385
396
  };
386
397
  return /* @__PURE__ */ a.jsxs(
387
398
  "div",
388
399
  {
389
400
  className: d("relative bg-inherit select-none w-full", K),
390
- ref: H,
401
+ ref: O,
391
402
  draggable: !1,
392
403
  style: $e,
393
404
  children: [
394
- /* @__PURE__ */ a.jsxs("div", { className: d("relative bg-inherit ", U), children: [
405
+ /* @__PURE__ */ a.jsxs("div", { className: d("relative bg-inherit ", B), children: [
395
406
  /* @__PURE__ */ a.jsx(
396
407
  "label",
397
408
  {
398
- htmlFor: G,
409
+ htmlFor: `select-${A}`,
399
410
  ref: Le,
400
411
  className: d(
401
412
  "left-3 pointer-events-none bg-inherit z-10 line-clamp-1 max-w-[calc(100%-2.5rem)] ",
402
413
  Y === "default" && "transition-all duration-200 ease-in-out",
403
414
  Ie(),
404
- ue || n ? We[ve].label : "text-neutral-medium-default",
405
- $ && Be.label
415
+ ce || n ? Ke[Ce].label : "text-neutral-medium-default",
416
+ P && We.label,
417
+ "mb-0.5"
406
418
  ),
407
- children: ge
419
+ children: be
408
420
  }
409
421
  ),
410
422
  /* @__PURE__ */ a.jsxs(
411
423
  "div",
412
424
  {
413
- id: G,
425
+ id: A,
414
426
  tabIndex: 0,
415
427
  role: "button",
416
- ref: W,
417
- onFocus: ee,
418
- onKeyDown: de,
428
+ ref: _,
429
+ onFocus: fe,
430
+ onKeyDown: oe,
419
431
  onClick: (t) => {
420
- t.preventDefault(), t.stopPropagation(), C();
432
+ t.preventDefault(), t.stopPropagation(), S();
421
433
  },
422
434
  className: d(
423
435
  "w-full px-2 text-left border rounded-lg transition-all duration-200 ease-in-out",
424
436
  "flex items-center justify-start bg-inherit ",
425
437
  "focus:outline-none",
426
- Ee === "chips" && e.multiple && ue ? "min-h-12 py-2 " : !be && "h-12 min-h-12",
427
- We[ve].input,
428
- $ && Be.input,
438
+ Ee === "chips" && e.multiple && ce ? "min-h-12 py-2 " : !xe && "h-12 min-h-12",
439
+ Ke[Ce].input,
440
+ P && We.input,
429
441
  He
430
442
  ),
431
443
  children: [
@@ -436,55 +448,55 @@ function ct(e) {
436
448
  "flex-1 overflow-x-auto overflow-y-hidden px-1 prometeo-scrollbar-none! "
437
449
  ),
438
450
  ref: Pe,
439
- onPointerUp: V.onPointerUp,
440
- onPointerDown: V.onPointerDown,
441
- onPointerMove: V.onPointerMove,
442
- onPointerLeave: V.onPointerLeave,
443
- onPointerCancel: V.onPointerCancel,
444
- onClickCapture: V.onClickCapture,
445
- children: De ? Se.createElement(
451
+ onPointerUp: q.onPointerUp,
452
+ onPointerDown: q.onPointerDown,
453
+ onPointerMove: q.onPointerMove,
454
+ onPointerLeave: q.onPointerLeave,
455
+ onPointerCancel: q.onPointerCancel,
456
+ onClickCapture: q.onClickCapture,
457
+ children: je ? Se.createElement(
446
458
  J(
447
- De,
448
- (t, o) => t.disabled === o.disabled && t.multiple === o.multiple
459
+ je,
460
+ (t, s) => t.disabled === s.disabled && t.multiple === s.multiple
449
461
  ),
450
462
  {
451
- disabled: $,
463
+ disabled: P,
452
464
  multiple: e.multiple || !1,
453
- placeholder: E,
454
- selectedOptions: ce,
465
+ placeholder: G,
466
+ selectedOptions: de,
455
467
  onRemoveOption: Z
456
468
  }
457
469
  ) : /* @__PURE__ */ a.jsx(
458
- Je,
470
+ Qe,
459
471
  {
460
472
  displayMode: Ee,
461
473
  selectedOptions: r,
462
474
  placeholder: Ge,
463
- onRemoveOption: O,
475
+ onRemoveOption: E,
464
476
  multiple: e.multiple || !1,
465
477
  className: d(
466
478
  Ae === "scroll" ? "flex-nowrap" : "flex-wrap"
467
479
  ),
468
- disabled: $
480
+ disabled: P
469
481
  }
470
482
  )
471
483
  }
472
484
  ),
473
485
  /* @__PURE__ */ a.jsxs("div", { className: "flex items-center gap-2", children: [
474
486
  le && /* @__PURE__ */ a.jsx(
475
- Xe,
487
+ Ye,
476
488
  {
477
489
  size: "small",
478
490
  variant: "sync",
479
491
  className: " opacity-90"
480
492
  }
481
493
  ),
482
- ue && ye && /* @__PURE__ */ a.jsx(
494
+ ce && ve && /* @__PURE__ */ a.jsx(
483
495
  "button",
484
496
  {
485
497
  className: "z-100",
486
498
  onClick: (t) => {
487
- t.preventDefault(), t.stopPropagation(), x(t);
499
+ t.preventDefault(), t.stopPropagation(), b(t);
488
500
  },
489
501
  type: "button",
490
502
  tabIndex: -1,
@@ -494,20 +506,20 @@ function ct(e) {
494
506
  size: 20,
495
507
  className: d(
496
508
  " cursor-pointer transition-all",
497
- We[ve].icon
509
+ Ke[Ce].icon
498
510
  )
499
511
  }
500
512
  )
501
513
  }
502
514
  ),
503
515
  /* @__PURE__ */ a.jsx(
504
- Ve,
516
+ Re,
505
517
  {
506
518
  size: 20,
507
519
  className: d(
508
520
  "transition-transform text-neutral-default-default min-w-max",
509
521
  n ? "rotate-180" : "",
510
- $ && Be.icon
522
+ P && We.icon
511
523
  )
512
524
  }
513
525
  )
@@ -517,295 +529,295 @@ function ct(e) {
517
529
  )
518
530
  ] }),
519
531
  n && /* @__PURE__ */ a.jsx(
520
- mt,
532
+ ht,
521
533
  {
522
- label: ge,
534
+ label: be,
523
535
  isOpen: n,
524
- disabled: $,
525
- optionValue: N,
526
- optionLabel: oe,
536
+ disabled: P,
537
+ optionValue: H,
538
+ optionLabel: se,
527
539
  emptyMessage: Te,
528
540
  labelVariant: Y,
529
- renderOption: F,
530
- renderOptionGroupHeader: se,
531
- attachToParent: ie,
532
- filteredOptions: y,
541
+ renderOption: W,
542
+ renderOptionGroupHeader: ie,
543
+ attachToParent: ue,
544
+ filteredOptions: x,
533
545
  multiple: e.multiple || !1,
534
546
  dropdownClassName: re,
535
- selectedOptionsIds: l,
536
- setFilteredOptions: g,
547
+ selectedOptionsIds: o,
548
+ setFilteredOptions: h,
537
549
  renderOptionContext: ze,
538
- options: s,
539
- selectRef: H,
540
- dropdownRef: p,
541
- selectButtonRef: W,
542
- helperComponentRef: je,
543
- onOptionClick: w,
544
- onCloseDropdown: () => h(!1),
550
+ options: i,
551
+ selectRef: O,
552
+ dropdownRef: m,
553
+ selectButtonRef: _,
554
+ helperComponentRef: De,
555
+ onOptionClick: D,
556
+ onCloseDropdown: () => f(!1),
545
557
  searchValue: _e,
546
- setSearchValue: b,
547
- searchInputRef: P,
548
- isLoading: j?.isLoading,
549
- onSearchClear: j?.onSearchClear,
550
- hideSearchBar: j?.hideSearchBar,
551
- dropdownHeight: j?.dropdownHeight,
552
- onSearchValueChange: j?.onSearchValueChange,
553
- inputSearchPlaceholder: j?.inputSearchPlaceholder,
554
- footer: j?.footer,
555
- loadingComponent: j?.loadingComponent,
556
- inputProps: j?.inputProps,
557
- enableGroupToggle: j?.enableGroupToggle,
558
- focusSearchInputOnOpen: j?.focusSearchInputOnOpen,
558
+ setSearchValue: p,
559
+ searchInputRef: T,
560
+ isLoading: k?.isLoading,
561
+ onSearchClear: k?.onSearchClear,
562
+ hideSearchBar: k?.hideSearchBar,
563
+ dropdownHeight: k?.dropdownHeight,
564
+ onSearchValueChange: k?.onSearchValueChange,
565
+ inputSearchPlaceholder: k?.inputSearchPlaceholder,
566
+ footer: k?.footer,
567
+ loadingComponent: k?.loadingComponent,
568
+ inputProps: k?.inputProps,
569
+ enableGroupToggle: k?.enableGroupToggle,
570
+ focusSearchInputOnOpen: k?.focusSearchInputOnOpen,
559
571
  onGroupSelectChange: u
560
572
  }
561
573
  ),
562
- (xe || X) && /* @__PURE__ */ a.jsx("div", { className: "min-h-6", children: /* @__PURE__ */ a.jsx(
563
- tt,
574
+ (ye || X) && /* @__PURE__ */ a.jsx("div", { className: "min-h-6", children: /* @__PURE__ */ a.jsx(
575
+ nt,
564
576
  {
565
- ref: je,
566
- variant: ve,
577
+ ref: De,
578
+ variant: Ce,
567
579
  className: "absolute bottom-0 h-5 overflow-visible line-clamp-1!",
568
- children: xe || X
580
+ children: ye || X
569
581
  }
570
582
  ) })
571
583
  ]
572
584
  }
573
585
  );
574
586
  }
575
- const dt = J(ct, (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), Et = dt;
576
- function ft({
587
+ const ft = J(dt, (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), Lt = ft;
588
+ function mt({
577
589
  footer: e,
578
590
  isOpen: n,
579
- label: h,
580
- options: y,
581
- multiple: g,
582
- disabled: v,
583
- selectRef: b,
584
- inputProps: H,
585
- dropdownRef: p,
586
- optionLabel: P,
587
- optionValue: W,
588
- searchValue: B,
589
- labelVariant: je,
590
- emptyMessage: pe,
591
- renderOption: G,
592
- renderOptionContext: S,
593
- renderOptionGroupHeader: ge,
594
- onOptionClick: be,
591
+ label: f,
592
+ options: x,
593
+ multiple: h,
594
+ disabled: w,
595
+ selectRef: p,
596
+ inputProps: O,
597
+ dropdownRef: m,
598
+ optionLabel: T,
599
+ optionValue: _,
600
+ searchValue: F,
601
+ labelVariant: De,
602
+ emptyMessage: ge,
603
+ renderOption: A,
604
+ renderOptionContext: j,
605
+ renderOptionGroupHeader: be,
606
+ onOptionClick: xe,
595
607
  onSearchClear: Q,
596
608
  searchInputRef: ne,
597
609
  setSearchValue: K,
598
- dropdownHeight: E,
599
- attachToParent: N,
600
- filteredOptions: oe,
601
- selectButtonRef: F,
602
- onCloseDropdown: se,
603
- loadingComponent: De,
610
+ dropdownHeight: G,
611
+ attachToParent: H,
612
+ filteredOptions: se,
613
+ selectButtonRef: W,
614
+ onCloseDropdown: ie,
615
+ loadingComponent: je,
604
616
  dropdownClassName: ze,
605
617
  helperComponentRef: He,
606
618
  selectedOptionsIds: re,
607
- setFilteredOptions: U,
608
- onSearchValueChange: j,
619
+ setFilteredOptions: B,
620
+ onSearchValueChange: k,
609
621
  isLoading: X = !1,
610
- hideSearchBar: xe = !1,
611
- inputSearchPlaceholder: Oe = "Buscar opciones",
612
- enableGroupToggle: q = !0,
613
- focusSearchInputOnOpen: ke = !1,
614
- onGroupSelectChange: ye
622
+ hideSearchBar: ye = !1,
623
+ inputSearchPlaceholder: ke = "Buscar opciones",
624
+ enableGroupToggle: U = !0,
625
+ focusSearchInputOnOpen: Oe = !1,
626
+ onGroupSelectChange: ve
615
627
  }) {
616
- const $ = e ? 380 : 320, Ae = je === "static" ? h !== "" ? -20 : 4 : 7, le = _(() => E ? E.endsWith("px") ? Number(E.replace("px", "")) : E.endsWith("vh") ? window.innerHeight * Number(E.replace("vh", "")) / 100 : E.endsWith("%") ? window.innerHeight * Number(E.replace("%", "")) / 100 : $ : $, [E, $])(), [ie, Ee] = Ne({
628
+ const P = e ? 380 : 320, Ae = De === "static" ? f !== "" ? -20 : 4 : 7, le = $(() => G ? G.endsWith("px") ? Number(G.replace("px", "")) : G.endsWith("vh") ? window.innerHeight * Number(G.replace("vh", "")) / 100 : G.endsWith("%") ? window.innerHeight * Number(G.replace("%", "")) / 100 : P : P, [G, P])(), [ue, Ee] = Ne({
617
629
  direction: "down",
618
630
  height: le
619
631
  }), [Y, Me] = Ne(
620
632
  () => /* @__PURE__ */ new Set()
621
- ), Te = _(
633
+ ), Te = $(
622
634
  (r) => !Y.has(r),
623
635
  [Y]
624
- ), Le = _(
625
- (r, l) => {
626
- Me((s) => {
627
- const u = new Set(s), C = u.has(r);
628
- return (l === void 0 ? !C : !l) ? u.add(r) : u.delete(r), u;
636
+ ), Le = $(
637
+ (r, o) => {
638
+ Me((i) => {
639
+ const u = new Set(i), S = u.has(r);
640
+ return (o === void 0 ? !S : !o) ? u.add(r) : u.delete(r), u;
629
641
  });
630
642
  },
631
643
  []
632
- ), V = (r) => {
633
- if (!p.current || !b.current) return;
634
- const l = b.current.getBoundingClientRect();
635
- switch (r || ie.direction) {
644
+ ), q = (r) => {
645
+ if (!m.current || !p.current) return;
646
+ const o = p.current.getBoundingClientRect();
647
+ switch (r || ue.direction) {
636
648
  case "down":
637
- p.current.style.top = `${l.top + l.height - (He?.current?.offsetHeight ? He?.current?.offsetHeight + 4 : 0)}px`;
649
+ m.current.style.top = `${o.top + o.height - (He?.current?.offsetHeight ? He?.current?.offsetHeight + 4 : 0)}px`;
638
650
  break;
639
651
  case "up":
640
- p.current.style.top = "auto", p.current.style.bottom = `${window.innerHeight - l.top + Ae}px`;
652
+ m.current.style.top = "auto", m.current.style.bottom = `${window.innerHeight - o.top + Ae}px`;
641
653
  break;
642
654
  }
643
- p.current.style.left = `${l.left}px`, p.current.style.width = `${l.width}px`;
655
+ m.current.style.left = `${o.left}px`, m.current.style.width = `${o.width}px`;
644
656
  }, Pe = (r) => {
645
- p.current && (p.current.style.maxHeight = `${r}px`);
646
- }, ue = () => {
647
- if (!p.current || !b.current) return ie;
648
- const r = b.current.getBoundingClientRect(), l = window.innerHeight - (window.innerHeight - r.top), s = window.innerHeight - r.bottom, u = s >= le, C = l >= le;
649
- let w = "down", x;
650
- return u ? (w = "down", x = le) : C ? (w = "up", x = le) : s > l ? (w = "down", x = s - 16) : (w = "up", x = l - 16), { direction: w, height: x };
657
+ m.current && (m.current.style.maxHeight = `${r}px`);
658
+ }, ce = () => {
659
+ if (!m.current || !p.current) return ue;
660
+ const r = p.current.getBoundingClientRect(), o = window.innerHeight - (window.innerHeight - r.top), i = window.innerHeight - r.bottom, u = i >= le, S = o >= le;
661
+ let D = "down", b;
662
+ return u ? (D = "down", b = le) : S ? (D = "up", b = le) : i > o ? (D = "down", b = i - 16) : (D = "up", b = o - 16), { direction: D, height: b };
651
663
  }, $e = (r) => {
652
- if (!(!p.current || !b.current)) {
653
- if (p.current.style.transition = "max-height 0.2s ease,opacity 0.2s ease", !r) {
654
- p.current.style.maxHeight = "0", p.current.style.opacity = "0", p.current.style.pointerEvents = "none";
664
+ if (!(!m.current || !p.current)) {
665
+ if (m.current.style.transition = "max-height 0.2s ease,opacity 0.2s ease", !r) {
666
+ m.current.style.maxHeight = "0", m.current.style.opacity = "0", m.current.style.pointerEvents = "none";
655
667
  return;
656
668
  }
657
- if (!N) {
658
- const l = ue();
659
- Ee(l), V(l.direction), Pe(l.height);
669
+ if (!H) {
670
+ const o = ce();
671
+ Ee(o), q(o.direction), Pe(o.height);
660
672
  }
661
- p.current.style.opacity = "1", p.current.style.pointerEvents = "auto", ke && ne?.current && ne.current?.focus();
673
+ m.current.style.opacity = "1", m.current.style.pointerEvents = "auto", Oe && ne?.current && ne.current?.focus();
662
674
  }
663
675
  };
664
- he(() => {
665
- N || !b.current || !n || V();
666
- }, [re]), he(() => {
676
+ pe(() => {
677
+ H || !p.current || !n || q();
678
+ }, [re]), pe(() => {
667
679
  $e(n);
668
- }, [n]), he(() => {
669
- y && U(y);
670
- }, [y]), he(() => {
671
- if (X || !B) return;
672
- const r = Ge(y, B);
673
- U(r);
674
- }, [y]);
675
- const Ge = (r, l) => {
676
- if (!l) return r;
677
- if (G) {
678
- const x = [];
679
- let O = null, Z = [];
680
- const ee = () => {
681
- O && Z.length > 0 && x.push(O, ...Z), O = null, Z = [];
680
+ }, [n]), pe(() => {
681
+ x && B(x);
682
+ }, [x]), pe(() => {
683
+ if (X || !F) return;
684
+ const r = Ge(x, F);
685
+ B(r);
686
+ }, [x]);
687
+ const Ge = (r, o) => {
688
+ if (!o) return r;
689
+ if (A) {
690
+ const b = [];
691
+ let E = null, Z = [];
692
+ const R = () => {
693
+ E && Z.length > 0 && b.push(E, ...Z), E = null, Z = [];
682
694
  };
683
- return r.forEach((de) => {
684
- const t = de;
685
- if (!!(t || {})?.isGroupHeader) {
686
- ee(), O = t;
695
+ return r.forEach((fe) => {
696
+ const oe = fe;
697
+ if (!!(oe || {})?.isGroupHeader) {
698
+ R(), E = oe;
687
699
  return;
688
700
  }
689
- const c = de, i = k(
690
- c,
691
- P
692
- ), f = Fe(String(i ?? ""), l);
693
- O ? f && Z.push(c) : f && x.push(c);
694
- }), ee(), x;
701
+ const s = fe, l = L(
702
+ s,
703
+ T
704
+ ), c = Ue(String(l ?? ""), o);
705
+ E ? c && Z.push(s) : c && b.push(s);
706
+ }), R(), b;
695
707
  }
696
- const s = [];
697
- let u = null, C = [];
698
- const w = () => {
699
- u && C.length > 0 && s.push(u, ...C), u = null, C = [];
708
+ const i = [];
709
+ let u = null, S = [];
710
+ const D = () => {
711
+ u && S.length > 0 && i.push(u, ...S), u = null, S = [];
700
712
  };
701
- return r.forEach((x) => {
702
- if (typeof x != "object" || x === null) return;
703
- if ((x || {})?.isGroupHeader) {
704
- w(), u = x;
713
+ return r.forEach((b) => {
714
+ if (typeof b != "object" || b === null) return;
715
+ if ((b || {})?.isGroupHeader) {
716
+ D(), u = b;
705
717
  return;
706
718
  }
707
- const O = Fe(x.label, l);
708
- u ? O && C.push(x) : O && s.push(x);
709
- }), w(), s;
719
+ const E = Ue(b.label, o);
720
+ u ? E && S.push(b) : E && i.push(b);
721
+ }), D(), i;
710
722
  }, _e = (r) => {
711
- const l = Ge(y, r);
712
- if (U(l), j) {
723
+ const o = Ge(x, r);
724
+ if (B(o), k) {
713
725
  if (r === "") {
714
726
  Ie();
715
727
  return;
716
728
  }
717
- j(r);
729
+ k(r);
718
730
  return;
719
731
  }
720
- K && y && K(r);
721
- }, Ie = _(() => {
732
+ K && x && K(r);
733
+ }, Ie = $(() => {
722
734
  if (Q) {
723
- Q(), U(
724
- y.filter((r) => {
725
- const l = G ? k(r, W) : r.id;
726
- return re.has(l);
735
+ Q(), B(
736
+ x.filter((r) => {
737
+ const o = A ? L(r, _) : r.id;
738
+ return re.has(o);
727
739
  })
728
740
  );
729
741
  return;
730
742
  }
731
- K && (K(""), U(y));
743
+ K && (K(""), B(x));
732
744
  }, [
733
- y,
745
+ x,
734
746
  re,
735
- W,
747
+ _,
736
748
  Q,
737
- U,
749
+ B,
738
750
  K,
739
- G
740
- ]), L = (r) => {
741
- r.key === "ArrowDown" ? (r.preventDefault(), p.current?.querySelector(
751
+ A
752
+ ]), I = (r) => {
753
+ r.key === "ArrowDown" ? (r.preventDefault(), m.current?.querySelector(
742
754
  "[role=listitem]"
743
755
  )?.focus()) : (r.key === "Tab" || r.key === "Escape") && setTimeout(() => {
744
- F.current?.focus(), se();
756
+ W.current?.focus(), ie();
745
757
  }, 10);
746
- }, R = (r, l) => {
747
- const s = Array.from(
748
- p.current?.querySelectorAll("[role=listitem]") || []
749
- ), u = s.indexOf(r.currentTarget);
758
+ }, V = (r, o) => {
759
+ const i = Array.from(
760
+ m.current?.querySelectorAll("[role=listitem]") || []
761
+ ), u = i.indexOf(r.currentTarget);
750
762
  if (r.key === "ArrowDown") {
751
763
  r.preventDefault();
752
- const C = u < s.length - 1 ? u + 1 : u;
753
- s[C]?.focus();
764
+ const S = u < i.length - 1 ? u + 1 : u;
765
+ i[S]?.focus();
754
766
  } else if (r.key === "ArrowUp")
755
767
  if (r.preventDefault(), u === 0)
756
768
  ne && ne.current?.focus();
757
769
  else {
758
- const C = u - 1;
759
- s[C]?.focus();
770
+ const S = u - 1;
771
+ i[S]?.focus();
760
772
  }
761
773
  else if (r.key === "Enter" || r.key === " ") {
762
- if (r.preventDefault(), (l || {})?.isGroupHeader || v) return;
763
- be(l, !g), g || setTimeout(() => {
764
- F.current?.focus(), se();
774
+ if (r.preventDefault(), (o || {})?.isGroupHeader || w) return;
775
+ xe(o, !h), h || setTimeout(() => {
776
+ W.current?.focus(), ie();
765
777
  }, 10);
766
778
  } else r.key === "Escape" ? (r.preventDefault(), setTimeout(() => {
767
- F.current?.focus(), se();
779
+ W.current?.focus(), ie();
768
780
  }, 10)) : r.key === "Tab" && setTimeout(() => {
769
- F.current?.focus(), se();
781
+ W.current?.focus(), ie();
770
782
  }, 10);
771
- }, Ce = Array.from({ length: 5 }).map(
772
- (r, l) => G ? Se.createElement(
773
- J(G, (s, u) => s.isSelected === u.isSelected && s.option === u.option && s.disabled === u.disabled && s.multiple === u.multiple && s.renderContext === u.renderContext),
783
+ }, we = Array.from({ length: 5 }).map(
784
+ (r, o) => A ? Se.createElement(
785
+ J(A, (i, u) => i.isSelected === u.isSelected && i.option === u.option && i.disabled === u.disabled && i.multiple === u.multiple && i.renderContext === u.renderContext),
774
786
  {
775
- key: `skeleton-option-${l}`,
776
- option: { id: l, label: "", value: "" },
787
+ key: `skeleton-option-${o}`,
788
+ option: { id: o, label: "", value: "" },
777
789
  isSelected: !1,
778
790
  multiple: !1,
779
791
  onSelect: () => {
780
792
  },
781
793
  disabled: !1,
782
794
  isLoading: !0,
783
- renderContext: S
795
+ renderContext: j
784
796
  }
785
797
  ) : /* @__PURE__ */ a.jsx(
786
- Ke,
798
+ Be,
787
799
  {
788
800
  multiple: !1,
789
801
  isLoading: !0,
790
802
  onSelect: () => {
791
803
  },
792
804
  isSelected: !1,
793
- option: { id: l, label: "", value: "" }
805
+ option: { id: o, label: "", value: "" }
794
806
  },
795
807
  `skeleton-option-${// biome-ignore lint/suspicious/noArrayIndexKey: <>
796
- l}`
808
+ o}`
797
809
  )
798
- ), ce = /* @__PURE__ */ a.jsx(
810
+ ), de = /* @__PURE__ */ a.jsx(
799
811
  "div",
800
812
  {
801
813
  tabIndex: 0,
802
- ref: p,
814
+ ref: m,
803
815
  style: { opacity: "0" },
804
816
  className: d(
805
817
  " z-100! w-full mt-1 bg-neutral-default-default border border-neutral-default-default rounded-lg shadow-lg",
806
818
  " overflow-hidden focus-visible:bg-neutral-default-hover ",
807
- N ? "absolute z-50 " : "fixed z-100 top-0 left-0",
808
- ie.direction === "up" ? "h-auto" : " h-max",
819
+ H ? "absolute z-50 " : "fixed z-100 top-0 left-0",
820
+ ue.direction === "up" ? "h-auto" : " h-max",
809
821
  ze,
810
822
  "w-full max-w-[max(100%,20vw)] min-w-[min(100%,20vw)]"
811
823
  ),
@@ -814,53 +826,53 @@ function ft({
814
826
  {
815
827
  className: d(
816
828
  "flex flex-col",
817
- xe ? "p-0" : "p-2 pt-0 gap-2"
829
+ ye ? "p-0" : "p-2 pt-0 gap-2"
818
830
  ),
819
831
  style: {
820
832
  height: "auto",
821
- maxHeight: ie.height
833
+ maxHeight: ue.height
822
834
  },
823
835
  children: [
824
- !xe && /* @__PURE__ */ a.jsx(
825
- lt,
836
+ !ye && /* @__PURE__ */ a.jsx(
837
+ ot,
826
838
  {
827
839
  name: "",
828
840
  label: "",
829
841
  size: "small",
830
842
  tabIndex: 0,
831
- value: B,
832
- disabled: v,
843
+ value: F,
844
+ disabled: w,
833
845
  ref: ne,
834
846
  labelVariant: "static",
835
- icon: /* @__PURE__ */ a.jsx(ot, { size: 22 }),
847
+ icon: /* @__PURE__ */ a.jsx(st, { size: 22 }),
836
848
  isFetching: X,
837
- onKeyDown: L,
849
+ onKeyDown: I,
838
850
  onClear: Ie,
839
851
  onChange: (r) => _e(r.target.value),
840
- placeholder: Oe,
852
+ placeholder: ke,
841
853
  className: " bg-neutral-medium-pressed",
842
- ...H
854
+ ...O
843
855
  }
844
856
  ),
845
- /* @__PURE__ */ a.jsx("div", { className: " overflow-y-auto flex-1 max-h-max ", children: oe.length === 0 ? X ? /* @__PURE__ */ a.jsx("div", { className: "flex flex-col gap-1 overflow-hidden w-full", children: De || Ce }) : /* @__PURE__ */ a.jsx("p", { className: "px-3 py-2 text-neutral-medium-default max-w-full text-pretty wrap-break-word ", children: B ? `No se encontraron resultados para "${B}"` : pe }) : (() => {
857
+ /* @__PURE__ */ a.jsx("div", { className: " overflow-y-auto flex-1 max-h-max ", children: se.length === 0 ? X ? /* @__PURE__ */ a.jsx("div", { className: "flex flex-col gap-1 overflow-hidden w-full", children: je || we }) : /* @__PURE__ */ a.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}"` : ge }) : (() => {
846
858
  let r = !0;
847
- return oe.map((l) => {
848
- const s = l, u = !!(s || {}).isGroupHeader, C = G && !u ? k(l, W) : s.id, w = re.has(C), x = (i) => !G || u ? i : {
849
- id: C,
850
- label: String(k(i, P)),
851
- value: k(i, W)
852
- }, O = (i) => {
853
- u || be(
854
- x(l),
855
- i === void 0 ? !g : i
859
+ return se.map((o) => {
860
+ const i = o, u = !!(i || {}).isGroupHeader, S = A && !u ? L(o, _) : i.id, D = re.has(S), b = (l) => !A || u ? l : {
861
+ id: S,
862
+ label: String(L(l, T)),
863
+ value: L(l, _)
864
+ }, E = (l) => {
865
+ u || xe(
866
+ b(o),
867
+ l === void 0 ? !h : l
856
868
  );
857
- }, Z = (i) => {
858
- if (be(i, !g), !g) {
869
+ }, Z = (l) => {
870
+ if (xe(l, !h), !h) {
859
871
  if (!K) return;
860
- K(""), U(y);
872
+ K(""), B(x);
861
873
  }
862
- }, ee = (i, f) => {
863
- const D = !!(f || {}).isGroupHeader;
874
+ }, R = (l, c) => {
875
+ const v = !!(c || {}).isGroupHeader;
864
876
  return (
865
877
  // biome-ignore lint/a11y/useSemanticElements: <>
866
878
  /* @__PURE__ */ a.jsx(
@@ -868,107 +880,107 @@ function ft({
868
880
  {
869
881
  tabIndex: 0,
870
882
  role: "listitem",
871
- onKeyDown: (M) => R(M, f),
883
+ onKeyDown: (g) => V(g, c),
872
884
  className: d(
873
- !D && !v && "focus-visible:bg-neutral-medium-hover outline-none hover:bg-neutral-medium-hover",
874
- w && "bg-neutral-medium-selected",
875
- v && "cursor-default pointer-events-none"
885
+ !v && !w && "focus-visible:bg-neutral-medium-hover outline-none hover:bg-neutral-medium-hover",
886
+ D && "bg-neutral-medium-selected",
887
+ w && "cursor-default pointer-events-none"
876
888
  ),
877
- children: i
889
+ children: l
878
890
  },
879
- f.id
891
+ c.id
880
892
  )
881
893
  );
882
894
  };
883
895
  if (u) {
884
- const i = s.groupLabelNode ?? s.label, f = String(s.id), D = q === !1 ? !0 : Te(f);
885
- r = D;
886
- const M = s.originalOption, I = s.groupData?.groupOptions ?? [], fe = (m) => {
887
- q && Le(f, m);
888
- }, me = (m) => {
889
- !I || I.length === 0 || ye && ye(I, m);
890
- }, we = I.filter(
891
- (m) => re.has(k(m, W))
892
- ).map((m) => String(k(m, W)));
893
- if (ge) {
894
- const m = J(
895
- ge,
896
- (A, T) => A.label === T.label && A.group === T.group && A.groupOptions === T.groupOptions && A.disabled === T.disabled && A.multiple === T.multiple && A.expanded === T.expanded && A.renderContext === T.renderContext
897
- ), z = Se.createElement(m, {
898
- group: M,
899
- label: i,
900
- groupOptions: I,
901
- multiple: g,
902
- disabled: v,
903
- expanded: D,
904
- toggleGroup: fe,
896
+ const l = i.groupLabelNode ?? i.label, c = String(i.id), v = U === !1 ? !0 : Te(c);
897
+ r = v;
898
+ const g = i.originalOption, y = i.groupData?.groupOptions ?? [], ee = (z) => {
899
+ U && Le(c, z);
900
+ }, me = (z) => {
901
+ !y || y.length === 0 || ve && ve(y, z);
902
+ }, he = y.filter(
903
+ (z) => re.has(L(z, _))
904
+ ).map((z) => String(L(z, _)));
905
+ if (be) {
906
+ const z = J(
907
+ be,
908
+ (N, M) => N.label === M.label && N.group === M.group && N.groupOptions === M.groupOptions && N.disabled === M.disabled && N.multiple === M.multiple && N.expanded === M.expanded && N.renderContext === M.renderContext
909
+ ), C = Se.createElement(z, {
910
+ group: g,
911
+ label: l,
912
+ groupOptions: y,
913
+ multiple: h,
914
+ disabled: w,
915
+ expanded: v,
916
+ toggleGroup: ee,
905
917
  selectGroup: me,
906
- renderContext: S,
907
- groupSelectedIds: we
918
+ renderContext: j,
919
+ groupSelectedIds: he
908
920
  });
909
- return ee(z, s);
921
+ return R(C, i);
910
922
  }
911
- return ee(
923
+ return R(
912
924
  /* @__PURE__ */ a.jsxs("div", { className: "px-3 py-2 text-neutral-medium-default font-medium text-sm w-full flex justify-between", children: [
913
- /* @__PURE__ */ a.jsx("div", { children: i }),
914
- q && /* @__PURE__ */ a.jsx(
925
+ /* @__PURE__ */ a.jsx("div", { children: l }),
926
+ U && /* @__PURE__ */ a.jsx(
915
927
  "div",
916
928
  {
917
929
  className: "cursor-pointer",
918
- onClick: () => Le(f),
930
+ onClick: () => Le(c),
919
931
  children: /* @__PURE__ */ a.jsx(
920
- Ve,
932
+ Re,
921
933
  {
922
934
  className: d(
923
935
  "transition-transform duration-300 ease-out",
924
- D ? "rotate-180" : "rotate-0"
936
+ v ? "rotate-180" : "rotate-0"
925
937
  )
926
938
  }
927
939
  )
928
940
  }
929
941
  )
930
942
  ] }),
931
- s
943
+ i
932
944
  );
933
945
  }
934
- const de = G ? Se.createElement(
946
+ const fe = A ? Se.createElement(
935
947
  J(
936
- G,
937
- (i, f) => i.isSelected === f.isSelected && i.option === f.option && i.disabled === f.disabled && i.multiple === f.multiple && i.renderContext === f.renderContext
948
+ A,
949
+ (l, c) => l.isSelected === c.isSelected && l.option === c.option && l.disabled === c.disabled && l.multiple === c.multiple && l.renderContext === c.renderContext
938
950
  ),
939
951
  {
940
- key: C,
941
- option: l,
942
- isSelected: w,
943
- multiple: g,
944
- onSelect: O,
945
- disabled: v,
952
+ key: S,
953
+ option: o,
954
+ isSelected: D,
955
+ multiple: h,
956
+ onSelect: E,
957
+ disabled: w,
946
958
  isLoading: X,
947
- renderContext: S
959
+ renderContext: j
948
960
  }
949
961
  ) : /* @__PURE__ */ a.jsx(
950
- Ke,
962
+ Be,
951
963
  {
952
- disabled: v,
953
- multiple: g,
964
+ disabled: w,
965
+ multiple: h,
954
966
  isLoading: X,
955
- isSelected: w,
967
+ isSelected: D,
956
968
  onSelect: Z,
957
- option: l
969
+ option: o
958
970
  },
959
- C
960
- ), t = ee(
961
- de,
962
- x(l)
971
+ S
972
+ ), oe = R(
973
+ fe,
974
+ b(o)
963
975
  );
964
- if (!q)
965
- return t;
966
- const o = !r, c = t;
967
- return Se.cloneElement(c, {
976
+ if (!U)
977
+ return oe;
978
+ const t = !r, s = oe;
979
+ return Se.cloneElement(s, {
968
980
  className: d(
969
- c.props.className,
981
+ s.props.className,
970
982
  "overflow-hidden transition-[max-height] duration-300 ease-out",
971
- o ? "max-h-0" : "max-h-[999px]"
983
+ t ? "max-h-0" : "max-h-[999px]"
972
984
  )
973
985
  });
974
986
  });
@@ -979,49 +991,49 @@ function ft({
979
991
  )
980
992
  }
981
993
  );
982
- return N ? ce : Ye(ce, document.body);
994
+ return H ? de : Ze(de, document.body);
983
995
  }
984
- const mt = J(
985
- ft,
996
+ const ht = J(
997
+ mt,
986
998
  (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
987
- ), Ke = J(
999
+ ), Be = J(
988
1000
  ({
989
1001
  option: e,
990
1002
  isSelected: n,
991
- onSelect: h,
992
- multiple: y,
993
- disabled: g,
994
- isLoading: v
1003
+ onSelect: f,
1004
+ multiple: x,
1005
+ disabled: h,
1006
+ isLoading: w
995
1007
  }) => {
996
- const b = (e || {})?.isGroupHeader;
997
- if (v)
1008
+ const p = (e || {})?.isGroupHeader;
1009
+ if (w)
998
1010
  return /* @__PURE__ */ a.jsxs(
999
1011
  "div",
1000
1012
  {
1001
1013
  className: "flex gap-2 w-full px-3 py-2 cursor-wait",
1002
1014
  children: [
1003
- /* @__PURE__ */ a.jsx(Ue, { className: "size-6 aspect-square" }),
1004
- /* @__PURE__ */ a.jsx(Ue, { className: "flex-1 h-6" })
1015
+ /* @__PURE__ */ a.jsx(qe, { className: "size-6 aspect-square" }),
1016
+ /* @__PURE__ */ a.jsx(qe, { className: "flex-1 h-6" })
1005
1017
  ]
1006
1018
  },
1007
1019
  e.id
1008
1020
  );
1009
- const H = (P) => {
1010
- P.preventDefault(), P.stopPropagation(), !(g || b) && h?.(e);
1011
- }, p = b && e.groupLabelNode ? e.groupLabelNode : e.label;
1021
+ const O = (T) => {
1022
+ T.preventDefault(), T.stopPropagation(), !(h || p) && f?.(e);
1023
+ }, m = p && e.groupLabelNode ? e.groupLabelNode : e.label;
1012
1024
  return /* @__PURE__ */ a.jsxs(
1013
1025
  "div",
1014
1026
  {
1015
- onMouseDown: H,
1027
+ onMouseDown: O,
1016
1028
  className: d(
1017
1029
  "px-3 py-2 flex items-center transition-colors text-neutral-default-default ",
1018
- b ? "cursor-default text-neutral-medium-default" : "cursor-pointer",
1019
- !b && (n ? " text-primary-default-default" : "hover:bg-neutral-medium-hover text-neutral-default-hover"),
1020
- g && !b && "text-neutral-default-disabled hover:bg-neutral-default-default"
1030
+ p ? "cursor-default text-neutral-medium-default" : "cursor-pointer",
1031
+ !p && (n ? " text-primary-default-default" : "hover:bg-neutral-medium-hover text-neutral-default-hover"),
1032
+ h && !p && "text-neutral-default-disabled hover:bg-neutral-default-default"
1021
1033
  ),
1022
1034
  children: [
1023
- y && !b && /* @__PURE__ */ a.jsx(rt, { checked: n, disabled: g }),
1024
- /* @__PURE__ */ a.jsx("span", { children: p })
1035
+ x && !p && /* @__PURE__ */ a.jsx(lt, { checked: n, disabled: h }),
1036
+ /* @__PURE__ */ a.jsx("span", { children: m })
1025
1037
  ]
1026
1038
  },
1027
1039
  e.id
@@ -1029,33 +1041,33 @@ const mt = J(
1029
1041
  },
1030
1042
  (e, n) => e.isSelected === n.isSelected && e.disabled === n.disabled
1031
1043
  );
1032
- Ke.displayName = "DefaultOptionRenderer";
1033
- const Je = J(
1044
+ Be.displayName = "DefaultOptionRenderer";
1045
+ const Qe = J(
1034
1046
  ({
1035
1047
  selectedOptions: e,
1036
1048
  placeholder: n,
1037
- onRemoveOption: h,
1038
- displayMode: y,
1039
- multiple: g,
1040
- className: v,
1041
- disabled: b
1042
- }) => e?.length === 0 ? n ? /* @__PURE__ */ a.jsx("span", { className: "text-neutral-medium-default line-clamp-1", children: n }) : null : y === "chips" && g ? /* @__PURE__ */ a.jsx("div", { className: d("flex items-center gap-1 ", v), children: e.map((H) => /* @__PURE__ */ a.jsx(
1043
- it,
1049
+ onRemoveOption: f,
1050
+ displayMode: x,
1051
+ multiple: h,
1052
+ className: w,
1053
+ disabled: p
1054
+ }) => e?.length === 0 ? n ? /* @__PURE__ */ a.jsx("span", { className: "text-neutral-medium-default line-clamp-1", children: n }) : null : x === "chips" && h ? /* @__PURE__ */ a.jsx("div", { className: d("flex items-center gap-1 ", w), children: e.map((O) => /* @__PURE__ */ a.jsx(
1055
+ ut,
1044
1056
  {
1045
1057
  tabIndex: -1,
1046
- id: H.id,
1047
- label: H.label,
1048
- onRemove: h,
1049
- disabled: b
1058
+ id: O.id,
1059
+ label: O.label,
1060
+ onRemove: f,
1061
+ disabled: p
1050
1062
  },
1051
- H.id
1063
+ O.id
1052
1064
  )) }) : e?.length === 1 ? /* @__PURE__ */ a.jsx("span", { className: "line-clamp-1", children: e[0].label }) : /* @__PURE__ */ a.jsxs("span", { className: "line-clamp-1", children: [
1053
1065
  e?.length,
1054
1066
  " seleccionados"
1055
1067
  ] }),
1056
1068
  (e, n) => e.selectedOptions === n.selectedOptions && e.disabled === n.disabled
1057
1069
  );
1058
- Je.displayName = "DefaultSelectionDisplay";
1070
+ Qe.displayName = "DefaultSelectionDisplay";
1059
1071
  export {
1060
- Et as default
1072
+ Lt as default
1061
1073
  };