prometeo-design-system 8.2.4 → 8.2.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,21 +1,21 @@
1
- import { j as o } from "./jsx-runtime-GkKLlHH4.js";
2
- import { u as Fe } from "./useDevice-S7cYqLVh.js";
3
- import { c as Z } from "./cn-B6yFEsav.js";
1
+ import { j as a } from "./jsx-runtime-GkKLlHH4.js";
2
+ import { u as _e } from "./useDevice-S7cYqLVh.js";
3
+ import { c as V } from "./cn-B6yFEsav.js";
4
4
  import { f as Ue } from "./MenuFloating-DQsbU8n3.js";
5
- import { g as S, h as we } from "./utils-X4-h3cum.js";
6
- import { memo as pe, forwardRef as Oe, useCallback as j, useMemo as Y, useRef as J, useState as Ie, useEffect as se, useLayoutEffect as _e } from "react";
7
- import { Menu as he, useMenuControl as We, useMenuState as $e } from "./Menu.es.js";
8
- import Te from "./Input.es.js";
5
+ import { g as S, h as je } from "./utils-X4-h3cum.js";
6
+ import { memo as pe, useCallback as D, forwardRef as Ie, useMemo as Z, useRef as Q, useState as Te, useEffect as se, useLayoutEffect as We } from "react";
7
+ import { Menu as he, useMenuControl as $e, useMenuState as Le } from "./Menu.es.js";
8
+ import Oe from "./Input.es.js";
9
9
  import { MenuList as Ne } from "./MenuList.es.js";
10
+ import Re from "./Spinner.es.js";
10
11
  import ke from "./ListItem.es.js";
11
12
  import { KeyboardArrowUp as qe } from "./Icon-KeyboardArrowUp.es.js";
12
13
  import { KeyboardArrowDown as Xe } from "./Icon-KeyboardArrowDown.es.js";
13
14
  import { S as De } from "./Skeleton-B0cQzX3_.js";
14
15
  import { Search as Je } from "./Icon-Search.es.js";
15
- import { useDragScroll as Le } from "./useDragScroll.es.js";
16
- import Qe from "./IconButton.es.js";
17
- import Ye from "./Spinner.es.js";
18
- import je from "./Chip.es.js";
16
+ import { useDragScroll as Qe } from "./useDragScroll.es.js";
17
+ import Ye from "./IconButton.es.js";
18
+ import we from "./Chip.es.js";
19
19
  import { Close as ye } from "./Icon-Close.es.js";
20
20
  import { ChevronDown as Ze } from "./Icon-ChevronDown.es.js";
21
21
  const Ve = pe(
@@ -23,13 +23,13 @@ const Ve = pe(
23
23
  label: t,
24
24
  expanded: n,
25
25
  onToggle: r,
26
- onSelectGroup: a,
26
+ onSelectGroup: o,
27
27
  multiple: c,
28
28
  selectedCount: s,
29
29
  totalCount: l
30
30
  }) {
31
- const b = l > 0 && s === l;
32
- return typeof t != "string" ? /* @__PURE__ */ o.jsx("div", { className: "flex items-center gap-2 px-3 py-2", children: t }) : /* @__PURE__ */ o.jsx(
31
+ const j = l > 0 && s === l;
32
+ return typeof t != "string" ? /* @__PURE__ */ a.jsx("div", { className: "flex items-center gap-2 px-3 py-2", children: t }) : /* @__PURE__ */ a.jsx(
33
33
  ke,
34
34
  {
35
35
  label: t,
@@ -37,8 +37,8 @@ const Ve = pe(
37
37
  trailingIcon: n ? qe : Xe,
38
38
  onClick: r,
39
39
  showSelectionComponent: c,
40
- isSelected: b,
41
- onSelectionClick: () => a?.("toggle"),
40
+ isSelected: j,
41
+ onSelectionClick: () => o?.("toggle"),
42
42
  showDivider: !1,
43
43
  supportingText: c ? `${s}/${l}` : void 0
44
44
  }
@@ -50,9 +50,9 @@ function et(e) {
50
50
  return e ?? "medium";
51
51
  }
52
52
  function Ae() {
53
- return /* @__PURE__ */ o.jsxs("div", { className: "flex items-center gap-2 px-3 py-2 animate-pulse", children: [
54
- /* @__PURE__ */ o.jsx(De, { className: "size-6 aspect-square" }),
55
- /* @__PURE__ */ o.jsx(De, { className: "h-6 flex-1 max-w-[60%]" })
53
+ return /* @__PURE__ */ a.jsxs("div", { className: "flex items-center gap-2 px-3 py-2 animate-pulse", children: [
54
+ /* @__PURE__ */ a.jsx(De, { className: "size-6 aspect-square" }),
55
+ /* @__PURE__ */ a.jsx(De, { className: "h-6 flex-1 max-w-[60%]" })
56
56
  ] });
57
57
  }
58
58
  const tt = pe(
@@ -60,18 +60,18 @@ const tt = pe(
60
60
  label: t,
61
61
  isSelected: n,
62
62
  multiple: r,
63
- disabled: a,
63
+ disabled: o,
64
64
  isOptionActive: c,
65
65
  isLoading: s,
66
66
  size: l
67
67
  }) {
68
- return s ? /* @__PURE__ */ o.jsx(Ae, {}) : /* @__PURE__ */ o.jsx(
68
+ return s ? /* @__PURE__ */ a.jsx(Ae, {}) : /* @__PURE__ */ a.jsx(
69
69
  ke,
70
70
  {
71
71
  label: t,
72
72
  isSelected: n,
73
73
  showSelectionComponent: r,
74
- disabled: a || !c,
74
+ disabled: o || !c,
75
75
  showDivider: !1,
76
76
  size: et(l)
77
77
  }
@@ -79,10 +79,10 @@ const tt = pe(
79
79
  },
80
80
  (e, t) => e.isSelected === t.isSelected && e.disabled === t.disabled && e.isOptionActive === t.isOptionActive && e.isLoading === t.isLoading && e.label === t.label
81
81
  );
82
- function Re(e) {
82
+ function Ee(e) {
83
83
  return e.length === 0 ? [] : e.flatMap((t) => {
84
84
  const n = t.options;
85
- return n?.length ? Re(n) : [t];
85
+ return n?.length ? Ee(n) : [t];
86
86
  });
87
87
  }
88
88
  function rt(e) {
@@ -107,28 +107,28 @@ function ct(e) {
107
107
  controledSearchValue: t,
108
108
  inputSearchPlaceholder: n,
109
109
  dropdownHeight: r,
110
- controlledSearchValue: a,
110
+ controlledSearchValue: o,
111
111
  searchPlaceholder: c,
112
112
  maxHeight: s,
113
113
  ...l
114
114
  } = e;
115
115
  return {
116
116
  ...l,
117
- controlledSearchValue: a ?? t,
117
+ controlledSearchValue: o ?? t,
118
118
  searchPlaceholder: c ?? n,
119
119
  maxHeight: s ?? r
120
120
  };
121
121
  }
122
- const st = Oe(
123
- function({ value: t, onChange: n, onClear: r, onKeyDown: a, placeholder: c, ...s }, l) {
124
- return /* @__PURE__ */ o.jsx(
125
- Te,
122
+ const st = Ie(
123
+ function({ value: t, onChange: n, onClear: r, onKeyDown: o, placeholder: c, ...s }, l) {
124
+ return /* @__PURE__ */ a.jsx(
125
+ Oe,
126
126
  {
127
127
  ref: l,
128
128
  value: t,
129
- onChange: (b) => n(b.target.value),
129
+ onChange: (j) => n(j.target.value),
130
130
  onClear: r,
131
- onKeyDown: a,
131
+ onKeyDown: o,
132
132
  placeholder: c,
133
133
  size: "small",
134
134
  leadingIcon: Je,
@@ -138,51 +138,55 @@ const st = Oe(
138
138
  }
139
139
  );
140
140
  function at({ message: e }) {
141
- return /* @__PURE__ */ o.jsx("div", { className: "flex items-center justify-center px-3 py-6 text-sm text-neutral-secondary-default", children: e });
141
+ return /* @__PURE__ */ a.jsx("div", { className: "flex items-center justify-center px-3 py-6 text-sm text-neutral-secondary-default", children: e });
142
142
  }
143
143
  function ot({
144
144
  loadingComponent: e
145
145
  }) {
146
- return e ? /* @__PURE__ */ o.jsx(o.Fragment, { children: e }) : /* @__PURE__ */ o.jsx("div", { className: "flex flex-col gap-1 p-2", children: Array.from({ length: 5 }, (t, n) => /* @__PURE__ */ o.jsx(Ae, {}, n)) });
146
+ return e ? /* @__PURE__ */ a.jsx(a.Fragment, { children: e }) : /* @__PURE__ */ a.jsx("div", { className: "flex flex-col gap-1 p-2", children: Array.from({ length: 5 }, (t, n) => /* @__PURE__ */ a.jsx(Ae, {}, n)) });
147
147
  }
148
- function Ge({
148
+ const it = 48;
149
+ function lt() {
150
+ return /* @__PURE__ */ a.jsx("div", { className: "flex items-center justify-center py-3", children: /* @__PURE__ */ a.jsx(Re, { size: "small", variant: "sync", className: "opacity-90" }) });
151
+ }
152
+ function He({
149
153
  option: e,
150
154
  optionLabel: t,
151
155
  optionValue: n,
152
156
  optionActive: r,
153
- selectedIds: a,
157
+ selectedIds: o,
154
158
  multiple: c,
155
159
  disabled: s,
156
160
  size: l,
157
- renderOption: b,
161
+ renderOption: j,
158
162
  renderOptionContext: w,
159
163
  onSelect: f,
160
- createOptionKeyHandler: D
164
+ createOptionKeyHandler: I
161
165
  }) {
162
- const i = S(e, n), p = S(e, t), R = a.has(i), g = ae(e, r), N = () => {
166
+ const i = S(e, n), p = S(e, t), E = o.has(i), g = ae(e, r), N = () => {
163
167
  g && f(i);
164
- }, O = Y(
165
- () => D(i),
166
- [D, i]
168
+ }, T = Z(
169
+ () => I(i),
170
+ [I, i]
167
171
  ), M = {
168
172
  role: "option",
169
- "aria-selected": R,
173
+ "aria-selected": E,
170
174
  "aria-disabled": !g,
171
175
  "data-option-value": i,
172
176
  tabIndex: -1,
173
- onKeyDown: O,
177
+ onKeyDown: T,
174
178
  // Custom renderOption owns click via onSelect; wrapper onClick would double-toggle.
175
- ...!b && { onClick: N }
179
+ ...!j && { onClick: N }
176
180
  };
177
- if (b) {
178
- const G = b;
179
- return /* @__PURE__ */ o.jsx("div", { ...M, children: /* @__PURE__ */ o.jsx(
180
- G,
181
+ if (j) {
182
+ const H = j;
183
+ return /* @__PURE__ */ a.jsx("div", { ...M, children: /* @__PURE__ */ a.jsx(
184
+ H,
181
185
  {
182
186
  option: e,
183
- isSelected: R,
184
- onSelect: (k) => {
185
- f(i, k);
187
+ isSelected: E,
188
+ onSelect: (R) => {
189
+ f(i, R);
186
190
  },
187
191
  multiple: c,
188
192
  disabled: s,
@@ -192,11 +196,11 @@ function Ge({
192
196
  }
193
197
  ) });
194
198
  }
195
- return /* @__PURE__ */ o.jsx("div", { ...M, children: /* @__PURE__ */ o.jsx(
199
+ return /* @__PURE__ */ a.jsx("div", { ...M, children: /* @__PURE__ */ a.jsx(
196
200
  tt,
197
201
  {
198
202
  label: p,
199
- isSelected: R,
203
+ isSelected: E,
200
204
  multiple: c,
201
205
  disabled: s,
202
206
  isOptionActive: g,
@@ -204,7 +208,7 @@ function Ge({
204
208
  }
205
209
  ) });
206
210
  }
207
- function it(e, t, n) {
211
+ function ut(e, t, n) {
208
212
  return (r) => {
209
213
  switch (r.key) {
210
214
  case " ": {
@@ -239,60 +243,60 @@ function it(e, t, n) {
239
243
  }
240
244
  };
241
245
  }
242
- function lt({
246
+ function ft({
243
247
  group: e,
244
248
  children: t,
245
249
  optionLabel: n,
246
250
  optionValue: r,
247
- optionActive: a,
251
+ optionActive: o,
248
252
  selectedIds: c,
249
253
  multiple: s,
250
254
  disabled: l,
251
- size: b,
255
+ size: j,
252
256
  dropdownOptions: w,
253
257
  renderOption: f,
254
- renderOptionGroupHeader: D,
258
+ renderOptionGroupHeader: I,
255
259
  renderOptionContext: i,
256
260
  onSelect: p,
257
- onSelectGroup: R,
261
+ onSelectGroup: E,
258
262
  closeDropdown: g,
259
263
  createOptionKeyHandler: N,
260
- navigateNext: O,
264
+ navigateNext: T,
261
265
  navigatePrev: M,
262
- hasActiveSearch: G
266
+ hasActiveSearch: H
263
267
  }) {
264
- const k = S(e, r), I = S(e, n), K = w?.enableGroupToggle !== !1, W = t.filter(
265
- (A) => ae(A, a)
266
- ), B = W.filter(
267
- (A) => c.has(S(A, r))
268
- ), z = j(
269
- (A) => R(k, A),
270
- [R, k]
271
- ), $ = w?.allGroupsExpanded === !0 || (w?.initialExpandedGroupIds?.includes(k) ?? !1), F = (A) => {
272
- const h = !K || !A.isCollapsed, d = K ? A.toggle : () => {
273
- }, C = it(k, A, {
274
- onSelectGroup: R,
275
- navigateNext: O,
268
+ const R = S(e, r), b = S(e, n), P = w?.enableGroupToggle !== !1, $ = t.filter(
269
+ (k) => ae(k, o)
270
+ ), F = $.filter(
271
+ (k) => c.has(S(k, r))
272
+ ), z = D(
273
+ (k) => E(R, k),
274
+ [E, R]
275
+ ), L = w?.allGroupsExpanded === !0 || (w?.initialExpandedGroupIds?.includes(R) ?? !1), _ = (k) => {
276
+ const h = !P || !k.isCollapsed, d = P ? k.toggle : () => {
277
+ }, C = ut(R, k, {
278
+ onSelectGroup: E,
279
+ navigateNext: T,
276
280
  navigatePrev: M,
277
281
  closeDropdown: g
278
282
  });
279
283
  let m;
280
- if (D) {
281
- const y = D;
282
- m = /* @__PURE__ */ o.jsx(
284
+ if (I) {
285
+ const y = I;
286
+ m = /* @__PURE__ */ a.jsx(
283
287
  y,
284
288
  {
285
289
  group: e,
286
- label: I,
290
+ label: b,
287
291
  groupOptions: t,
288
- groupSelectedIds: B.map(
292
+ groupSelectedIds: F.map(
289
293
  (u) => S(u, r)
290
294
  ),
291
295
  multiple: s,
292
296
  disabled: l,
293
297
  expanded: h,
294
298
  toggleGroup: (u) => {
295
- if (K) {
299
+ if (P) {
296
300
  if (u === void 0) {
297
301
  d();
298
302
  return;
@@ -300,28 +304,28 @@ function lt({
300
304
  u !== h && d();
301
305
  }
302
306
  },
303
- selectGroup: (u) => R(k, u ?? "toggle"),
307
+ selectGroup: (u) => E(R, u ?? "toggle"),
304
308
  renderContext: i
305
309
  }
306
310
  );
307
311
  } else
308
- m = /* @__PURE__ */ o.jsx(
312
+ m = /* @__PURE__ */ a.jsx(
309
313
  Ve,
310
314
  {
311
- label: I,
315
+ label: b,
312
316
  expanded: h,
313
317
  onToggle: d,
314
318
  onSelectGroup: z,
315
319
  multiple: s,
316
- selectedCount: B.length,
317
- totalCount: W.length
320
+ selectedCount: F.length,
321
+ totalCount: $.length
318
322
  }
319
323
  );
320
- return /* @__PURE__ */ o.jsx(
324
+ return /* @__PURE__ */ a.jsx(
321
325
  "div",
322
326
  {
323
327
  "data-group-header": !0,
324
- "data-group-id": k,
328
+ "data-group-id": R,
325
329
  tabIndex: -1,
326
330
  "aria-expanded": h,
327
331
  onKeyDown: C,
@@ -329,58 +333,58 @@ function lt({
329
333
  }
330
334
  );
331
335
  };
332
- return /* @__PURE__ */ o.jsx(
336
+ return /* @__PURE__ */ a.jsx(
333
337
  Ne.Group,
334
338
  {
335
- header: F,
336
- forceExpanded: G || !K,
337
- defaultExpanded: $,
338
- defaultCollapsed: !!K,
339
+ header: _,
340
+ forceExpanded: H || !P,
341
+ defaultExpanded: L,
342
+ defaultCollapsed: !!P,
339
343
  className: w?.groupContainerClassName,
340
- children: t.map((A) => /* @__PURE__ */ o.jsx(
341
- Ge,
344
+ children: t.map((k) => /* @__PURE__ */ a.jsx(
345
+ He,
342
346
  {
343
- option: A,
347
+ option: k,
344
348
  optionLabel: n,
345
349
  optionValue: r,
346
- optionActive: a,
350
+ optionActive: o,
347
351
  selectedIds: c,
348
352
  multiple: s,
349
353
  disabled: l,
350
- size: b,
354
+ size: j,
351
355
  renderOption: f,
352
356
  renderOptionContext: i,
353
357
  onSelect: p,
354
358
  closeDropdown: g,
355
359
  createOptionKeyHandler: N
356
360
  },
357
- S(A, r)
361
+ S(k, r)
358
362
  ))
359
363
  }
360
364
  );
361
365
  }
362
- function ut({
366
+ function dt({
363
367
  filteredOptions: e,
364
368
  emptyMessage: t,
365
369
  ...n
366
370
  }) {
367
- return e.length === 0 ? /* @__PURE__ */ o.jsx(at, { message: t }) : /* @__PURE__ */ o.jsx(
371
+ return e.length === 0 ? /* @__PURE__ */ a.jsx(at, { message: t }) : /* @__PURE__ */ a.jsx(
368
372
  Ne,
369
373
  {
370
374
  className: n.dropdownOptions?.optionContainerClassName,
371
375
  accordion: n.dropdownOptions?.groupAccordion !== !1,
372
376
  children: e.map((r) => {
373
- const a = r.options;
374
- return a?.length ? /* @__PURE__ */ o.jsx(
375
- lt,
377
+ const o = r.options;
378
+ return o?.length ? /* @__PURE__ */ a.jsx(
379
+ ft,
376
380
  {
377
381
  group: r,
378
- children: a,
382
+ children: o,
379
383
  ...n
380
384
  },
381
385
  S(r, n.optionValue)
382
- ) : /* @__PURE__ */ o.jsx(
383
- Ge,
386
+ ) : /* @__PURE__ */ a.jsx(
387
+ He,
384
388
  {
385
389
  option: r,
386
390
  ...n
@@ -391,43 +395,50 @@ function ut({
391
395
  }
392
396
  );
393
397
  }
394
- function ft({
398
+ function gt({
395
399
  menuRef: e,
396
400
  triggerRef: t,
397
401
  anchorRef: n,
398
402
  dropdownVariant: r = "list",
399
- attachToParent: a,
403
+ attachToParent: o,
400
404
  filteredOptions: c,
401
405
  selectedIds: s,
402
406
  optionLabel: l,
403
- optionValue: b,
407
+ optionValue: j,
404
408
  optionActive: w,
405
409
  multiple: f,
406
- renderOption: D,
410
+ renderOption: I,
407
411
  renderOptionGroupHeader: i,
408
412
  renderOptionContext: p,
409
- onSelect: R,
413
+ onSelect: E,
410
414
  onSelectGroup: g,
411
415
  closeDropdown: N,
412
- searchValue: O,
416
+ searchValue: T,
413
417
  onSearchChange: M,
414
- onSearchClear: G,
415
- searchInputRef: k,
416
- dropdownOptions: I,
417
- onSearchKeyDown: K,
418
- createOptionKeyHandler: W,
419
- navigateNext: B,
418
+ onSearchClear: H,
419
+ searchInputRef: R,
420
+ dropdownOptions: b,
421
+ onSearchKeyDown: P,
422
+ createOptionKeyHandler: $,
423
+ navigateNext: F,
420
424
  navigatePrev: z,
421
- optionsContainerRef: $,
422
- isLoading: F,
423
- emptyMessage: A,
425
+ optionsContainerRef: L,
426
+ isLoading: _,
427
+ emptyMessage: k,
424
428
  disabled: h,
425
429
  size: d,
426
430
  dropdownClassName: C,
427
431
  label: m
428
432
  }) {
429
- const y = O.trim().length > 0, u = I?.maxHeight ?? (r === "drawer" ? "auto" : nt);
430
- return /* @__PURE__ */ o.jsxs(
433
+ const y = T.trim().length > 0, u = b?.maxHeight ?? (r === "drawer" ? "auto" : nt), G = D(
434
+ (X) => {
435
+ if (!b?.hasMore || b?.isLoadingMore) return;
436
+ const { scrollHeight: A, scrollTop: q, clientHeight: B } = X.currentTarget;
437
+ A - q - B < it && b.onEndReached?.();
438
+ },
439
+ [b]
440
+ );
441
+ return /* @__PURE__ */ a.jsxs(
431
442
  he,
432
443
  {
433
444
  ref: e,
@@ -436,7 +447,7 @@ function ft({
436
447
  variant: r,
437
448
  matchTriggerWidth: r === "list",
438
449
  placement: "bottom-start",
439
- attachToParent: a,
450
+ attachToParent: o,
440
451
  closeOnScroll: !1,
441
452
  scrollTriggerWhenCovered: r === "list",
442
453
  autoFocus: !1,
@@ -446,98 +457,102 @@ function ft({
446
457
  snapPoints: r === "drawer" ? ["60%", "90%"] : void 0,
447
458
  className: C,
448
459
  children: [
449
- !I?.hideSearchBar && /* @__PURE__ */ o.jsx(he.Header, { className: Z(r === "drawer" && "px-3"), children: /* @__PURE__ */ o.jsx(
460
+ !b?.hideSearchBar && /* @__PURE__ */ a.jsx(he.Header, { className: V(r === "drawer" && "px-3"), children: /* @__PURE__ */ a.jsx(
450
461
  st,
451
462
  {
452
- ref: k,
453
- value: O,
454
- onClear: G,
455
- onKeyDown: K,
456
- placeholder: I?.searchPlaceholder ?? "Buscar opciones",
457
- ...I?.inputProps,
463
+ ref: R,
464
+ value: T,
465
+ onClear: H,
466
+ onKeyDown: P,
467
+ placeholder: b?.searchPlaceholder ?? "Buscar opciones",
468
+ ...b?.inputProps,
458
469
  onChange: M
459
470
  }
460
471
  ) }),
461
- /* @__PURE__ */ o.jsx(he.Content, { className: Z("overflow-y-hidden!", r === "drawer" && "px-3"), children: /* @__PURE__ */ o.jsx(
472
+ /* @__PURE__ */ a.jsx(he.Content, { className: V("overflow-y-hidden!", r === "drawer" && "px-3"), children: /* @__PURE__ */ a.jsx(
462
473
  "div",
463
474
  {
464
- ref: $,
475
+ ref: L,
465
476
  role: "listbox",
466
477
  "aria-label": m,
467
478
  "aria-multiselectable": f,
468
- className: Z(
479
+ className: V(
469
480
  "overflow-y-auto w-full min-h-0 flex-1",
470
- I?.optionContainerClassName
481
+ b?.optionContainerClassName
471
482
  ),
472
483
  style: u === "auto" ? void 0 : { maxHeight: u },
473
- children: F ? /* @__PURE__ */ o.jsx(ot, { loadingComponent: I?.loadingComponent }) : /* @__PURE__ */ o.jsx(
474
- ut,
475
- {
476
- filteredOptions: c,
477
- emptyMessage: A,
478
- optionLabel: l,
479
- optionValue: b,
480
- optionActive: w,
481
- selectedIds: s,
482
- multiple: f,
483
- disabled: h,
484
- size: d,
485
- dropdownOptions: I,
486
- renderOption: D,
487
- renderOptionGroupHeader: i,
488
- renderOptionContext: p,
489
- onSelect: R,
490
- onSelectGroup: g,
491
- closeDropdown: N,
492
- createOptionKeyHandler: W,
493
- navigateNext: B,
494
- navigatePrev: z,
495
- hasActiveSearch: y
496
- }
497
- )
484
+ onScroll: G,
485
+ children: _ ? /* @__PURE__ */ a.jsx(ot, { loadingComponent: b?.loadingComponent }) : /* @__PURE__ */ a.jsxs(a.Fragment, { children: [
486
+ /* @__PURE__ */ a.jsx(
487
+ dt,
488
+ {
489
+ filteredOptions: c,
490
+ emptyMessage: k,
491
+ optionLabel: l,
492
+ optionValue: j,
493
+ optionActive: w,
494
+ selectedIds: s,
495
+ multiple: f,
496
+ disabled: h,
497
+ size: d,
498
+ dropdownOptions: b,
499
+ renderOption: I,
500
+ renderOptionGroupHeader: i,
501
+ renderOptionContext: p,
502
+ onSelect: E,
503
+ onSelectGroup: g,
504
+ closeDropdown: N,
505
+ createOptionKeyHandler: $,
506
+ navigateNext: F,
507
+ navigatePrev: z,
508
+ hasActiveSearch: y
509
+ }
510
+ ),
511
+ b?.isLoadingMore && /* @__PURE__ */ a.jsx(lt, {})
512
+ ] })
498
513
  }
499
514
  ) }),
500
- I?.footer && /* @__PURE__ */ o.jsx(he.Footer, { children: I.footer })
515
+ b?.footer && /* @__PURE__ */ a.jsx(he.Footer, { children: b.footer })
501
516
  ]
502
517
  }
503
518
  );
504
519
  }
505
- const dt = pe(function({
520
+ const ht = pe(function({
506
521
  chipItems: t,
507
522
  selectedCount: n,
508
523
  displayMode: r,
509
- overflow: a,
524
+ overflow: o,
510
525
  disabled: c,
511
526
  placeholder: s,
512
527
  onRemoveOption: l,
513
- onRemoveGroup: b,
528
+ onRemoveGroup: j,
514
529
  resolveOptionId: w
515
530
  }) {
516
- return n === 0 ? s ? /* @__PURE__ */ o.jsx("span", { className: "text-neutral-tertiary-default pyrion-fonts-body-medium line-clamp-1 truncate", children: s }) : null : r === "compact" ? /* @__PURE__ */ o.jsxs("span", { className: "line-clamp-1 truncate", children: [
531
+ return n === 0 ? s ? /* @__PURE__ */ a.jsx("span", { className: "text-neutral-tertiary-default pyrion-fonts-body-medium line-clamp-1 truncate", children: s }) : null : r === "compact" ? /* @__PURE__ */ a.jsxs("span", { className: "line-clamp-1 truncate", children: [
517
532
  n,
518
533
  " seleccionados"
519
- ] }) : /* @__PURE__ */ o.jsx(
534
+ ] }) : /* @__PURE__ */ a.jsx(
520
535
  "div",
521
536
  {
522
- className: Z(
537
+ className: V(
523
538
  "flex gap-1",
524
- a === "wrap" ? "flex-wrap" : "flex-nowrap"
539
+ o === "wrap" ? "flex-wrap" : "flex-nowrap"
525
540
  ),
526
541
  children: t.map(
527
- (f) => f.type === "group" ? /* @__PURE__ */ o.jsx(
528
- je,
542
+ (f) => f.type === "group" ? /* @__PURE__ */ a.jsx(
543
+ we,
529
544
  {
530
545
  label: `${f.groupLabel} (${f.count})`,
531
546
  disabled: c,
532
547
  trailingIcon: ye,
533
548
  onTrailingIconClick: () => {
534
- b(f.options.map(w));
549
+ j(f.options.map(w));
535
550
  },
536
551
  isSelected: !0
537
552
  },
538
553
  `group-${f.groupId}`
539
- ) : /* @__PURE__ */ o.jsx(
540
- je,
554
+ ) : /* @__PURE__ */ a.jsx(
555
+ we,
541
556
  {
542
557
  label: f.label,
543
558
  disabled: c,
@@ -550,20 +565,20 @@ const dt = pe(function({
550
565
  )
551
566
  }
552
567
  );
553
- }), gt = pe(function({
568
+ }), pt = pe(function({
554
569
  label: t,
555
570
  placeholder: n
556
571
  }) {
557
- return t ? /* @__PURE__ */ o.jsx("span", { className: "line-clamp-1 truncate", children: t }) : n ? /* @__PURE__ */ o.jsx("span", { className: "text-neutral-tertiary-default pyrion-fonts-body-medium line-clamp-1 truncate", children: n }) : null;
572
+ return t ? /* @__PURE__ */ a.jsx("span", { className: "line-clamp-1 truncate", children: t }) : n ? /* @__PURE__ */ a.jsx("span", { className: "text-neutral-tertiary-default pyrion-fonts-body-medium line-clamp-1 truncate", children: n }) : null;
558
573
  });
559
- function ht({
574
+ function mt({
560
575
  isOpen: e,
561
576
  disabled: t
562
577
  }) {
563
- return /* @__PURE__ */ o.jsx(
578
+ return /* @__PURE__ */ a.jsx(
564
579
  Ze,
565
580
  {
566
- className: Z(
581
+ className: V(
567
582
  "transition-transform duration-200 shrink-0",
568
583
  e && "rotate-180",
569
584
  t ? "text-disabled-default" : "text-neutral-secondary-default"
@@ -571,99 +586,99 @@ function ht({
571
586
  }
572
587
  );
573
588
  }
574
- const pt = Oe(function({
589
+ const xt = Ie(function({
575
590
  label: t,
576
591
  size: n,
577
592
  variant: r,
578
- disabled: a,
593
+ disabled: o,
579
594
  isLoading: c,
580
595
  placeholder: s,
581
596
  selectedOptions: l,
582
- chipItems: b,
597
+ chipItems: j,
583
598
  multiple: w,
584
599
  displayMode: f,
585
- overflow: D,
600
+ overflow: I,
586
601
  optionLabel: i,
587
602
  optionValue: p,
588
- renderSelection: R,
603
+ renderSelection: E,
589
604
  onRemoveOption: g,
590
605
  onRemoveGroup: N,
591
- onClear: O,
606
+ onClear: T,
592
607
  onClick: M,
593
- onFocus: G,
594
- isOpen: k,
595
- onKeyDown: I,
596
- className: K,
597
- containerClassName: W,
598
- buttonClassName: B,
608
+ onFocus: H,
609
+ isOpen: R,
610
+ onKeyDown: b,
611
+ className: P,
612
+ containerClassName: $,
613
+ buttonClassName: F,
599
614
  width: z,
600
- height: $,
601
- tabIndex: F,
602
- helperComponent: A,
615
+ height: L,
616
+ tabIndex: _,
617
+ helperComponent: k,
603
618
  errorComponent: h,
604
619
  inputProps: d
605
620
  }, C) {
606
- const m = w && f === "chips" && D === "wrap", { bind: y, ref: u } = Le({
621
+ const m = w && f === "chips" && I === "wrap", { bind: y, ref: u } = Qe({
607
622
  axis: "x",
608
623
  cursor: { idle: "default", dragging: "grabbing" },
609
- disabled: D !== "scroll" || !w || f !== "chips"
610
- }), P = j(
611
- (E) => {
612
- if (R) {
613
- const q = R;
614
- return /* @__PURE__ */ o.jsx(
615
- q,
624
+ disabled: I !== "scroll" || !w || f !== "chips"
625
+ }), G = D(
626
+ (A) => {
627
+ if (E) {
628
+ const B = E;
629
+ return /* @__PURE__ */ a.jsx(
630
+ B,
616
631
  {
617
632
  selectedOptions: l,
618
633
  placeholder: s,
619
634
  multiple: w,
620
635
  onRemoveOption: g,
621
- disabled: E.disabled
636
+ disabled: A.disabled
622
637
  }
623
638
  );
624
639
  }
625
640
  if (!w) {
626
- const q = l[0] ? S(l[0], i) : void 0;
627
- return /* @__PURE__ */ o.jsx(
628
- gt,
641
+ const B = l[0] ? S(l[0], i) : void 0;
642
+ return /* @__PURE__ */ a.jsx(
643
+ pt,
629
644
  {
630
- label: q,
645
+ label: B,
631
646
  placeholder: s,
632
- disabled: E.disabled
647
+ disabled: A.disabled
633
648
  }
634
649
  );
635
650
  }
636
- const L = /* @__PURE__ */ o.jsx(
637
- dt,
651
+ const q = /* @__PURE__ */ a.jsx(
652
+ ht,
638
653
  {
639
- chipItems: b,
654
+ chipItems: j,
640
655
  selectedCount: l.length,
641
656
  displayMode: f,
642
- overflow: D,
643
- disabled: E.disabled,
657
+ overflow: I,
658
+ disabled: A.disabled,
644
659
  placeholder: s,
645
660
  onRemoveOption: g,
646
661
  onRemoveGroup: N,
647
- resolveOptionId: (q) => S(q, p)
662
+ resolveOptionId: (B) => S(B, p)
648
663
  }
649
664
  );
650
- return D === "scroll" && f === "chips" ? /* @__PURE__ */ o.jsx(
665
+ return I === "scroll" && f === "chips" ? /* @__PURE__ */ a.jsx(
651
666
  "div",
652
667
  {
653
668
  ref: u,
654
669
  ...y,
655
670
  className: "flex overflow-x-auto pyrion-scrollbar-none w-full",
656
- children: L
671
+ children: q
657
672
  }
658
- ) : L;
673
+ ) : q;
659
674
  },
660
675
  [
661
- R,
676
+ E,
662
677
  l,
663
- b,
678
+ j,
664
679
  w,
665
680
  f,
666
- D,
681
+ I,
667
682
  s,
668
683
  g,
669
684
  i,
@@ -671,58 +686,58 @@ const pt = Oe(function({
671
686
  y,
672
687
  u
673
688
  ]
674
- ), V = j(
675
- (E) => /* @__PURE__ */ o.jsxs("div", { className: "flex items-center gap-1", children: [
676
- c && /* @__PURE__ */ o.jsx(Ye, { size: "small", variant: "sync", className: "opacity-90" }),
677
- O && l.length > 0 && /* @__PURE__ */ o.jsx(
678
- Qe,
689
+ ), X = D(
690
+ (A) => /* @__PURE__ */ a.jsxs("div", { className: "flex items-center gap-1", children: [
691
+ c && /* @__PURE__ */ a.jsx(Re, { size: "small", variant: "sync", className: "opacity-90" }),
692
+ T && l.length > 0 && /* @__PURE__ */ a.jsx(
693
+ Ye,
679
694
  {
680
695
  icon: ye,
681
696
  size: "small",
682
697
  variant: "text",
683
698
  color: "neutral",
684
699
  tabIndex: -1,
685
- onClick: (L) => {
686
- L.stopPropagation(), O();
700
+ onClick: (q) => {
701
+ q.stopPropagation(), T();
687
702
  },
688
- disabled: a,
703
+ disabled: o,
689
704
  "aria-label": "Clear selection"
690
705
  }
691
706
  ),
692
- /* @__PURE__ */ o.jsx(ht, { isOpen: k, disabled: a })
707
+ /* @__PURE__ */ a.jsx(mt, { isOpen: R, disabled: o })
693
708
  ] }),
694
- [c, O, l.length, a, k]
709
+ [c, T, l.length, o, R]
695
710
  );
696
- return /* @__PURE__ */ o.jsx(
711
+ return /* @__PURE__ */ a.jsx(
697
712
  "div",
698
713
  {
699
714
  ref: C,
700
715
  role: "combobox",
701
- "aria-expanded": k,
716
+ "aria-expanded": R,
702
717
  "aria-haspopup": "listbox",
703
- tabIndex: F ?? 0,
704
- onClick: (E) => {
705
- E.preventDefault(), a || M();
718
+ tabIndex: _ ?? 0,
719
+ onClick: (A) => {
720
+ A.preventDefault(), o || M();
706
721
  },
707
- onFocus: G,
708
- onKeyDown: I,
709
- className: Z("w-full outline-none", W, B),
710
- style: z ? { width: z } : $ ? { height: $ } : void 0,
711
- children: /* @__PURE__ */ o.jsx(
712
- Te,
722
+ onFocus: H,
723
+ onKeyDown: b,
724
+ className: V("w-full outline-none", $, F),
725
+ style: z ? { width: z } : L ? { height: L } : void 0,
726
+ children: /* @__PURE__ */ a.jsx(
727
+ Oe,
713
728
  {
714
729
  ...d,
715
730
  label: t,
716
731
  size: n,
717
732
  state: r,
718
- disabled: a,
733
+ disabled: o,
719
734
  readOnly: !0,
720
735
  hideClearButton: !0,
721
736
  flexibleHeight: m,
722
- className: Z(d?.className, K),
723
- renderValue: P,
724
- slotActions: V,
725
- helperComponent: A,
737
+ className: V(d?.className, P),
738
+ renderValue: G,
739
+ slotActions: X,
740
+ helperComponent: k,
726
741
  errorComponent: h,
727
742
  value: ""
728
743
  }
@@ -730,40 +745,40 @@ const pt = Oe(function({
730
745
  }
731
746
  );
732
747
  });
733
- function mt(e) {
748
+ function St(e) {
734
749
  if (!e) return [];
735
750
  const t = e.querySelectorAll(
736
751
  '[role="option"]:not([aria-disabled="true"]), [data-group-header]'
737
752
  );
738
753
  return Array.from(t).filter((n) => !n.closest("[inert]"));
739
754
  }
740
- function xt(e, t) {
755
+ function vt(e, t) {
741
756
  const n = t.getBoundingClientRect(), r = e.getBoundingClientRect();
742
757
  r.bottom > n.bottom ? t.scrollTop += r.bottom - n.bottom : r.top < n.top && (t.scrollTop -= n.top - r.top);
743
758
  }
744
- function St({
759
+ function yt({
745
760
  menuRef: e,
746
761
  searchInputRef: t,
747
762
  optionsContainerRef: n,
748
763
  onSelect: r
749
764
  }) {
750
- const a = J(-1), c = j(
765
+ const o = Q(-1), c = D(
751
766
  (i) => {
752
767
  const p = n.current;
753
768
  if (!p) return !1;
754
- const g = mt(p)[i];
755
- return g ? (g.focus(), xt(g, p), a.current = i, !0) : !1;
769
+ const g = St(p)[i];
770
+ return g ? (g.focus(), vt(g, p), o.current = i, !0) : !1;
756
771
  },
757
772
  [n]
758
- ), s = j(() => c(a.current + 1), [c]), l = j(() => {
759
- const i = a.current - 1;
760
- return i < 0 ? (a.current = -1, t.current?.focus(), !0) : c(i);
761
- }, [c, t]), b = j(
773
+ ), s = D(() => c(o.current + 1), [c]), l = D(() => {
774
+ const i = o.current - 1;
775
+ return i < 0 ? (o.current = -1, t.current?.focus(), !0) : c(i);
776
+ }, [c, t]), j = D(
762
777
  (i) => {
763
778
  (i.key === " " || i.key === "ArrowDown" || i.key === "Enter") && (i.preventDefault(), e.current?.open());
764
779
  },
765
780
  [e]
766
- ), w = j(
781
+ ), w = D(
767
782
  (i) => {
768
783
  switch (i.key) {
769
784
  case "ArrowDown": {
@@ -780,7 +795,7 @@ function St({
780
795
  }
781
796
  },
782
797
  [c, e]
783
- ), f = j(
798
+ ), f = D(
784
799
  (i) => (p) => {
785
800
  switch (p.key) {
786
801
  case "ArrowDown": {
@@ -804,108 +819,108 @@ function St({
804
819
  }
805
820
  },
806
821
  [s, l, r, e]
807
- ), D = j(() => {
808
- a.current = -1;
822
+ ), I = D(() => {
823
+ o.current = -1;
809
824
  }, []);
810
825
  return {
811
- handleTriggerKeyDown: b,
826
+ handleTriggerKeyDown: j,
812
827
  handleSearchKeyDown: w,
813
828
  createOptionKeyHandler: f,
814
829
  navigateNext: s,
815
830
  navigatePrev: l,
816
- resetFocus: D
831
+ resetFocus: I
817
832
  };
818
833
  }
819
- function vt(e, t, n) {
820
- return t.trim() ? e.reduce((r, a) => {
821
- const c = a.options;
834
+ function Ct(e, t, n) {
835
+ return t.trim() ? e.reduce((r, o) => {
836
+ const c = o.options;
822
837
  if (c?.length) {
823
838
  const s = c.filter(
824
- (l) => we(S(l, n), t)
839
+ (l) => je(S(l, n), t)
825
840
  );
826
- return s.length === 0 || r.push({ ...a, options: s }), r;
841
+ return s.length === 0 || r.push({ ...o, options: s }), r;
827
842
  }
828
- return we(S(a, n), t) && r.push(a), r;
843
+ return je(S(o, n), t) && r.push(o), r;
829
844
  }, []) : e;
830
845
  }
831
- function yt({
846
+ function bt({
832
847
  options: e,
833
848
  optionLabel: t,
834
849
  dropdownOptions: n
835
850
  }) {
836
- const [r, a] = Ie(""), c = n?.controlledSearchValue != null, s = c ? n.controlledSearchValue : r, l = Y(
837
- () => vt(e, s, t),
851
+ const [r, o] = Te(""), c = n?.controlledSearchValue != null, s = c ? n.controlledSearchValue : r, l = Z(
852
+ () => Ct(e, s, t),
838
853
  [e, s, t]
839
- ), b = j(
840
- (D) => {
854
+ ), j = D(
855
+ (I) => {
841
856
  if (c) {
842
- n?.onSearchValueChange?.(D);
857
+ n?.onSearchValueChange?.(I);
843
858
  return;
844
859
  }
845
- a(D), n?.onSearchValueChange?.(D);
860
+ o(I), n?.onSearchValueChange?.(I);
846
861
  },
847
862
  [c, n?.onSearchValueChange]
848
- ), w = j(() => {
863
+ ), w = D(() => {
849
864
  if (c) {
850
865
  n?.onSearchClear?.();
851
866
  return;
852
867
  }
853
- a(""), n?.onSearchClear?.();
854
- }, [c, n?.onSearchClear]), f = j(() => {
855
- c || a("");
868
+ o(""), n?.onSearchClear?.();
869
+ }, [c, n?.onSearchClear]), f = D(() => {
870
+ c || o("");
856
871
  }, [c]);
857
872
  return {
858
873
  searchValue: s,
859
874
  filteredOptions: l,
860
875
  isControlledSearch: c,
861
- handleSearchChange: b,
876
+ handleSearchChange: j,
862
877
  handleSearchClear: w,
863
878
  resetSearch: f
864
879
  };
865
880
  }
866
- function Ct({
881
+ function jt({
867
882
  options: e,
868
883
  value: t,
869
884
  defaultValue: n,
870
885
  isControlled: r,
871
- multiple: a,
886
+ multiple: o,
872
887
  optionLabel: c,
873
888
  optionValue: s,
874
889
  optionActive: l,
875
- groupSelection: b,
890
+ groupSelection: j,
876
891
  onChange: w,
877
892
  onOptionClick: f,
878
- onRemoveOption: D,
893
+ onRemoveOption: I,
879
894
  name: i
880
895
  }) {
881
- const p = J(
896
+ const p = Q(
882
897
  w
883
898
  );
884
899
  p.current = w;
885
- const [R, g] = Ie(() => {
900
+ const [E, g] = Te(() => {
886
901
  if (!r)
887
- return n ?? (a ? [] : void 0);
888
- }), N = r ? t : R, O = Y(() => Re(e), [e]), M = Y(
889
- () => O.map((h) => re(h, c, s)),
890
- [O, c, s]
891
- ), G = Y(() => {
902
+ return n ?? (o ? [] : void 0);
903
+ }), N = r ? t : E, T = Z(() => Ee(e), [e]), M = Z(
904
+ () => T.map((h) => re(h, c, s)),
905
+ [T, c, s]
906
+ ), H = Z(() => {
892
907
  if (N == null || N === "") return [];
893
908
  const h = Array.isArray(N) ? N : [N], d = new Map(
894
- O.map((C) => [
909
+ T.map((C) => [
895
910
  S(C, s),
896
911
  C
897
912
  ])
898
913
  );
899
914
  return h.map((C) => d.get(C)).filter((C) => C != null);
900
- }, [O, N, s]), k = Y(
901
- () => new Set(G.map((h) => S(h, s))),
902
- [G, s]
903
- ), I = J(G);
904
- I.current = G;
905
- const K = Y(() => {
906
- if (!a) return [];
907
- if (!b)
908
- return G.map((m) => ({
915
+ }, [T, N, s]), R = Z(
916
+ () => new Set(H.map((h) => S(h, s))),
917
+ [H, s]
918
+ ), b = Q(H);
919
+ b.current = H;
920
+ const P = Z(() => {
921
+ if (!o) return [];
922
+ if (!j)
923
+ return H.map((m) => ({
909
924
  type: "option",
910
925
  option: m,
911
926
  id: S(m, s),
@@ -914,25 +929,25 @@ function Ct({
914
929
  const h = rt(e), d = [];
915
930
  for (const m of h) {
916
931
  const u = (m.options ?? []).filter(
917
- (E) => ae(E, l)
918
- ), P = u.filter(
919
- (E) => k.has(S(E, s))
932
+ (A) => ae(A, l)
933
+ ), G = u.filter(
934
+ (A) => R.has(S(A, s))
920
935
  );
921
- if (u.length > 0 && P.length === u.length)
936
+ if (u.length > 0 && G.length === u.length)
922
937
  d.push({
923
938
  type: "group",
924
939
  groupLabel: S(m, c),
925
- count: P.length,
940
+ count: G.length,
926
941
  groupId: S(m, s),
927
- options: P
942
+ options: G
928
943
  });
929
944
  else
930
- for (const E of P)
945
+ for (const A of G)
931
946
  d.push({
932
947
  type: "option",
933
- option: E,
934
- id: S(E, s),
935
- label: S(E, c)
948
+ option: A,
949
+ id: S(A, s),
950
+ label: S(A, c)
936
951
  });
937
952
  }
938
953
  const C = new Set(
@@ -942,7 +957,7 @@ function Ct({
942
957
  )
943
958
  )
944
959
  );
945
- for (const m of G) {
960
+ for (const m of H) {
946
961
  const y = S(m, s);
947
962
  C.has(y) || d.push({
948
963
  type: "option",
@@ -954,36 +969,36 @@ function Ct({
954
969
  return d;
955
970
  }, [
956
971
  e,
957
- k,
958
- G,
959
- a,
960
- b,
972
+ R,
973
+ H,
974
+ o,
975
+ j,
961
976
  c,
962
977
  s,
963
978
  l
964
- ]), W = j(
979
+ ]), $ = D(
965
980
  (h) => {
966
981
  const d = M.find((u) => u.id === h);
967
982
  if (!d) return;
968
- if (f?.(d, i), !a) {
983
+ if (f?.(d, i), !o) {
969
984
  r || g(d.id), p.current?.(d, i);
970
985
  return;
971
986
  }
972
- const C = I.current.map(
987
+ const C = b.current.map(
973
988
  (u) => re(u, c, s)
974
989
  ), y = C.some((u) => u.id === h) ? C.filter((u) => u.id !== h) : [...C, d];
975
990
  r || g(y.map((u) => u.id)), p.current?.(y, i);
976
991
  },
977
992
  [
978
993
  M,
979
- a,
994
+ o,
980
995
  r,
981
996
  f,
982
997
  i,
983
998
  c,
984
999
  s
985
1000
  ]
986
- ), B = j(
1001
+ ), F = D(
987
1002
  (h, d) => {
988
1003
  const C = e.find(
989
1004
  (x) => S(x, s) === h
@@ -997,26 +1012,26 @@ function Ct({
997
1012
  if (y.length === 0) return;
998
1013
  const u = y.map(
999
1014
  (x) => re(x, c, s)
1000
- ), P = I.current.map(
1015
+ ), G = b.current.map(
1001
1016
  (x) => re(x, c, s)
1002
1017
  );
1003
- if (!a) {
1018
+ if (!o) {
1004
1019
  const x = u[0];
1005
1020
  if (!x) return;
1006
- const ee = P.some((X) => X.id === x.id), ue = d ?? "toggle", U = ue === "select" || ue === "toggle" && !ee;
1021
+ const ee = G.some((J) => J.id === x.id), ue = d ?? "toggle", U = ue === "select" || ue === "toggle" && !ee;
1007
1022
  r || g(U ? x.id : void 0), p.current?.(U ? x : void 0, i);
1008
1023
  return;
1009
1024
  }
1010
- const V = new Set(P.map((x) => x.id)), E = new Set(u.map((x) => x.id)), L = u.every(
1011
- (x) => V.has(x.id)
1012
- ), q = d ?? "toggle";
1013
- if (!(q === "select" || q === "toggle" && !L)) {
1014
- const x = P.filter((ee) => !E.has(ee.id));
1025
+ const X = new Set(G.map((x) => x.id)), A = new Set(u.map((x) => x.id)), q = u.every(
1026
+ (x) => X.has(x.id)
1027
+ ), B = d ?? "toggle";
1028
+ if (!(B === "select" || B === "toggle" && !q)) {
1029
+ const x = G.filter((ee) => !A.has(ee.id));
1015
1030
  r || g(x.map((ee) => ee.id)), p.current?.(x, i);
1016
1031
  return;
1017
1032
  }
1018
1033
  const ie = new Map(
1019
- P.map((x) => [x.id, x])
1034
+ G.map((x) => [x.id, x])
1020
1035
  );
1021
1036
  u.forEach((x) => {
1022
1037
  ie.set(x.id, x);
@@ -1028,49 +1043,49 @@ function Ct({
1028
1043
  e,
1029
1044
  s,
1030
1045
  l,
1031
- a,
1046
+ o,
1032
1047
  r,
1033
1048
  c,
1034
1049
  i
1035
1050
  ]
1036
- ), z = j(
1051
+ ), z = D(
1037
1052
  (h) => {
1038
- const d = O.find(
1053
+ const d = T.find(
1039
1054
  (u) => S(u, s) === h
1040
1055
  );
1041
1056
  if (!d) return;
1042
1057
  const C = re(d, c, s);
1043
- if (f?.(C, i), D?.(d), !a) {
1058
+ if (f?.(C, i), I?.(d), !o) {
1044
1059
  r || g(void 0), p.current?.(void 0, i);
1045
1060
  return;
1046
1061
  }
1047
- const y = I.current.map(
1062
+ const y = b.current.map(
1048
1063
  (u) => re(u, c, s)
1049
1064
  ).filter((u) => u.id !== h);
1050
1065
  r || g(y.map((u) => u.id)), p.current?.(y, i);
1051
1066
  },
1052
1067
  [
1053
- O,
1068
+ T,
1054
1069
  s,
1055
1070
  c,
1056
1071
  f,
1057
- D,
1072
+ I,
1058
1073
  i,
1059
- a,
1074
+ o,
1060
1075
  r
1061
1076
  ]
1062
- ), $ = j(
1077
+ ), L = D(
1063
1078
  (h) => {
1064
- if (!a) return;
1065
- const d = new Set(h), m = I.current.map(
1079
+ if (!o) return;
1080
+ const d = new Set(h), m = b.current.map(
1066
1081
  (y) => re(y, c, s)
1067
1082
  ).filter((y) => !d.has(y.id));
1068
1083
  r || g(m.map((y) => y.id)), p.current?.(m, i);
1069
1084
  },
1070
- [a, r, c, s, i]
1071
- ), F = j(() => {
1072
- r || g(a ? [] : void 0), p.current?.(a ? [] : void 0, i);
1073
- }, [r, a, i]), A = j(
1085
+ [o, r, c, s, i]
1086
+ ), _ = D(() => {
1087
+ r || g(o ? [] : void 0), p.current?.(o ? [] : void 0, i);
1088
+ }, [r, o, i]), k = D(
1074
1089
  (h) => {
1075
1090
  r || g(h);
1076
1091
  const d = M.find((C) => C.id === h);
@@ -1079,21 +1094,21 @@ function Ct({
1079
1094
  [r, M, i]
1080
1095
  );
1081
1096
  return {
1082
- flatOptions: O,
1097
+ flatOptions: T,
1083
1098
  sanitizedOptions: M,
1084
- selectedOptions: G,
1085
- selectedIds: k,
1086
- chipItems: K,
1087
- toggleOption: W,
1088
- selectGroup: B,
1099
+ selectedOptions: H,
1100
+ selectedIds: R,
1101
+ chipItems: P,
1102
+ toggleOption: $,
1103
+ selectGroup: F,
1089
1104
  removeOption: z,
1090
- removeOptions: $,
1091
- clearSelection: F,
1092
- selectByValue: A
1105
+ removeOptions: L,
1106
+ clearSelection: _,
1107
+ selectByValue: k
1093
1108
  };
1094
1109
  }
1095
- function bt(e) {
1096
- const t = J({
1110
+ function Dt(e) {
1111
+ const t = Q({
1097
1112
  renderOptionContext: !1,
1098
1113
  attachToParent: !1,
1099
1114
  onOptionClick: !1
@@ -1123,119 +1138,119 @@ function wt(e, t) {
1123
1138
  });
1124
1139
  });
1125
1140
  }
1126
- function Wt(e) {
1141
+ function Lt(e) {
1127
1142
  const t = "value" in e, n = t ? e.value : void 0, r = t ? void 0 : e.defaultValue, {
1128
- options: a,
1143
+ options: o,
1129
1144
  multiple: c,
1130
1145
  label: s,
1131
1146
  variant: l = "default",
1132
- size: b = "medium",
1147
+ size: j = "medium",
1133
1148
  labelVariant: w = "default",
1134
1149
  disabled: f = !1,
1135
- isLoading: D = !1,
1150
+ isLoading: I = !1,
1136
1151
  displayMode: i = "compact",
1137
1152
  overflow: p = "wrap",
1138
- groupSelection: R,
1153
+ groupSelection: E,
1139
1154
  optionLabel: g,
1140
1155
  optionValue: N,
1141
- optionActive: O,
1156
+ optionActive: T,
1142
1157
  renderOption: M,
1143
- renderOptionGroupHeader: G,
1144
- renderSelection: k,
1145
- renderOptionContext: I,
1146
- dropdownOptions: K,
1147
- onChange: W,
1148
- onClose: B,
1158
+ renderOptionGroupHeader: H,
1159
+ renderSelection: R,
1160
+ renderOptionContext: b,
1161
+ dropdownOptions: P,
1162
+ onChange: $,
1163
+ onClose: F,
1149
1164
  onClear: z,
1150
- onRemoveOption: $,
1151
- onOptionActivate: F,
1152
- onOptionClick: A,
1165
+ onRemoveOption: L,
1166
+ onOptionActivate: _,
1167
+ onOptionClick: k,
1153
1168
  controls: h,
1154
1169
  disableOpenOnFocus: d,
1155
1170
  emptyMessage: C = "No hay opciones disponibles",
1156
1171
  placeholder: m,
1157
1172
  helperComponent: y,
1158
1173
  errorComponent: u,
1159
- inputProps: P,
1160
- className: V,
1161
- containerClassName: E,
1162
- buttonClassName: L,
1163
- dropdownClassName: q,
1174
+ inputProps: G,
1175
+ className: X,
1176
+ containerClassName: A,
1177
+ buttonClassName: q,
1178
+ dropdownClassName: B,
1164
1179
  width: oe,
1165
1180
  height: ie,
1166
1181
  tabIndex: le,
1167
1182
  name: x,
1168
1183
  id: ee
1169
1184
  } = e;
1170
- bt(e);
1171
- const ue = Fe(), U = e.mobileDropdown === "drawer" && ue ? "drawer" : "list", X = Y(
1172
- () => ct(K),
1173
- [K]
1174
- ), fe = J(null), me = J(null), xe = J(!1), Se = J(!1), T = We(), te = $e(T.ref, U), H = Ct({
1175
- options: a,
1185
+ Dt(e);
1186
+ const ue = _e(), U = e.mobileDropdown === "drawer" && ue ? "drawer" : "list", J = Z(
1187
+ () => ct(P),
1188
+ [P]
1189
+ ), fe = Q(null), me = Q(null), xe = Q(!1), Se = Q(!1), O = $e(), te = Le(O.ref, U), K = jt({
1190
+ options: o,
1176
1191
  value: n,
1177
1192
  defaultValue: r,
1178
1193
  isControlled: t,
1179
1194
  multiple: !!c,
1180
1195
  optionLabel: g,
1181
1196
  optionValue: N,
1182
- optionActive: O,
1183
- groupSelection: c ? R : void 0,
1184
- onChange: W,
1185
- onOptionClick: A,
1186
- onRemoveOption: $,
1197
+ optionActive: T,
1198
+ groupSelection: c ? E : void 0,
1199
+ onChange: $,
1200
+ onOptionClick: k,
1201
+ onRemoveOption: L,
1187
1202
  name: x
1188
- }), ne = yt({
1189
- options: a,
1203
+ }), ne = bt({
1204
+ options: o,
1190
1205
  optionLabel: g,
1191
- dropdownOptions: X
1192
- }), ve = j(
1193
- (v, _) => {
1194
- H.toggleOption(v), _ !== !1 && (!c || _ === !0) && T.close();
1206
+ dropdownOptions: J
1207
+ }), ve = D(
1208
+ (v, W) => {
1209
+ K.toggleOption(v), W !== !1 && (!c || W === !0) && O.close();
1195
1210
  },
1196
- [H.toggleOption, c, T]
1197
- ), Ce = j(
1198
- (v, _, de) => {
1199
- const ce = H.flatOptions.find(
1211
+ [K.toggleOption, c, O]
1212
+ ), Ce = D(
1213
+ (v, W, de) => {
1214
+ const ce = K.flatOptions.find(
1200
1215
  (ge) => S(ge, N) === v
1201
1216
  );
1202
- if (!(!ce || !ae(ce, O))) {
1203
- if (!F) {
1217
+ if (!(!ce || !ae(ce, T))) {
1218
+ if (!_) {
1204
1219
  ve(v, de);
1205
1220
  return;
1206
1221
  }
1207
- F({
1222
+ _({
1208
1223
  option: ce,
1209
1224
  value: v,
1210
- isSelected: H.selectedIds.has(v),
1225
+ isSelected: K.selectedIds.has(v),
1211
1226
  multiple: !!c,
1212
- source: _,
1227
+ source: W,
1213
1228
  commit: () => ve(v),
1214
- close: () => T.close()
1229
+ close: () => O.close()
1215
1230
  });
1216
1231
  }
1217
1232
  },
1218
1233
  [
1219
- F,
1234
+ _,
1220
1235
  N,
1221
- O,
1236
+ T,
1222
1237
  c,
1223
1238
  ve,
1224
- T,
1225
- H.flatOptions,
1226
- H.selectedIds
1239
+ O,
1240
+ K.flatOptions,
1241
+ K.selectedIds
1227
1242
  ]
1228
- ), Q = St({
1229
- menuRef: T.ref,
1243
+ ), Y = yt({
1244
+ menuRef: O.ref,
1230
1245
  searchInputRef: fe,
1231
1246
  optionsContainerRef: me,
1232
1247
  onSelect: (v) => Ce(v, "keyboard")
1233
1248
  });
1234
- se(() => T.subscribeOpenChange((_) => {
1235
- _ || (xe.current = !0, ne.resetSearch(), Q.resetFocus(), B?.());
1236
- }), [T, ne.resetSearch, Q.resetFocus, B]), se(() => {
1237
- if (!(!te || X?.focusSearchInputOnOpen === !1)) {
1238
- if (X?.hideSearchBar) {
1249
+ se(() => O.subscribeOpenChange((W) => {
1250
+ W || (xe.current = !0, ne.resetSearch(), Y.resetFocus(), F?.());
1251
+ }), [O, ne.resetSearch, Y.resetFocus, F]), se(() => {
1252
+ if (!(!te || J?.focusSearchInputOnOpen === !1)) {
1253
+ if (J?.hideSearchBar) {
1239
1254
  me.current?.querySelector(
1240
1255
  '[role="option"]'
1241
1256
  )?.focus();
@@ -1245,19 +1260,19 @@ function Wt(e) {
1245
1260
  }
1246
1261
  }, [
1247
1262
  te,
1248
- X?.focusSearchInputOnOpen,
1249
- X?.hideSearchBar
1263
+ J?.focusSearchInputOnOpen,
1264
+ J?.hideSearchBar
1250
1265
  ]);
1251
- const Ee = j(() => {
1252
- Se.current = !0, !f && (U === "drawer" ? T.toggle(void 0, "60%") : T.toggle());
1253
- }, [f, T, U]), Me = j(
1266
+ const Me = D(() => {
1267
+ Se.current = !0, !f && (U === "drawer" ? O.toggle(void 0, "60%") : O.toggle());
1268
+ }, [f, O, U]), Ge = D(
1254
1269
  (v) => {
1255
- Se.current = !0, !(v.target !== v.currentTarget && (v.key === "Enter" || v.key === " ")) && Q.handleTriggerKeyDown(v);
1270
+ Se.current = !0, !(v.target !== v.currentTarget && (v.key === "Enter" || v.key === " ")) && Y.handleTriggerKeyDown(v);
1256
1271
  },
1257
- [Q.handleTriggerKeyDown]
1258
- ), He = j(() => {
1259
- H.clearSelection(), z?.();
1260
- }, [H.clearSelection, z]), Ke = j(
1272
+ [Y.handleTriggerKeyDown]
1273
+ ), Ke = D(() => {
1274
+ K.clearSelection(), z?.();
1275
+ }, [K.clearSelection, z]), Pe = D(
1261
1276
  (v) => {
1262
1277
  if (v.target !== v.currentTarget) return;
1263
1278
  if (xe.current) {
@@ -1265,110 +1280,110 @@ function Wt(e) {
1265
1280
  return;
1266
1281
  }
1267
1282
  if (!Se.current) return;
1268
- v.target.matches(":focus-visible") && !d && !te && !f && (U === "drawer" ? T.open(void 0, "60%") : T.open());
1283
+ v.target.matches(":focus-visible") && !d && !te && !f && (U === "drawer" ? O.open(void 0, "60%") : O.open());
1269
1284
  },
1270
- [d, te, f, T, U]
1285
+ [d, te, f, O, U]
1271
1286
  );
1272
1287
  se(() => {
1273
1288
  if (!te || U !== "drawer") return;
1274
- const v = T.triggerRef.current;
1289
+ const v = O.triggerRef.current;
1275
1290
  if (!v) return;
1276
- const _ = setTimeout(() => {
1291
+ const W = setTimeout(() => {
1277
1292
  const de = window.innerHeight * 0.33, ce = v.getBoundingClientRect(), ge = ce.top + ce.height / 2;
1278
1293
  if (ge > de) {
1279
- const ze = Ue(v), Be = ge - de;
1280
- ze.scrollBy({ top: Be, behavior: "smooth" });
1294
+ const Be = Ue(v), Fe = ge - de;
1295
+ Be.scrollBy({ top: Fe, behavior: "smooth" });
1281
1296
  }
1282
1297
  }, 250);
1283
- return () => clearTimeout(_);
1284
- }, [te, U, T.triggerRef]), wt(h, {
1285
- menu: T,
1286
- selectState: H,
1298
+ return () => clearTimeout(W);
1299
+ }, [te, U, O.triggerRef]), wt(h, {
1300
+ menu: O,
1301
+ selectState: K,
1287
1302
  searchInputRef: fe
1288
1303
  });
1289
- const Pe = c ? i ?? "compact" : "compact", be = J(null);
1290
- return _e(() => {
1291
- const v = T.triggerRef.current;
1304
+ const ze = c ? i ?? "compact" : "compact", be = Q(null);
1305
+ return We(() => {
1306
+ const v = O.triggerRef.current;
1292
1307
  be.current = v ? v.querySelector("[data-input-content]") : null;
1293
- }), /* @__PURE__ */ o.jsxs(
1308
+ }), /* @__PURE__ */ a.jsxs(
1294
1309
  "div",
1295
1310
  {
1296
- className: Z("relative inline-flex w-full flex-col", V),
1311
+ className: V("relative inline-flex w-full flex-col", X),
1297
1312
  style: oe ? { width: oe } : void 0,
1298
1313
  id: ee,
1299
1314
  children: [
1300
- /* @__PURE__ */ o.jsx(
1301
- pt,
1315
+ /* @__PURE__ */ a.jsx(
1316
+ xt,
1302
1317
  {
1303
- ref: T.triggerRef,
1318
+ ref: O.triggerRef,
1304
1319
  label: s,
1305
- size: b,
1320
+ size: j,
1306
1321
  variant: l,
1307
1322
  labelVariant: w,
1308
1323
  disabled: f,
1309
- isLoading: D,
1324
+ isLoading: I,
1310
1325
  placeholder: m,
1311
- selectedOptions: H.selectedOptions,
1312
- chipItems: H.chipItems,
1326
+ selectedOptions: K.selectedOptions,
1327
+ chipItems: K.chipItems,
1313
1328
  multiple: !!c,
1314
- displayMode: Pe,
1329
+ displayMode: ze,
1315
1330
  overflow: p,
1316
1331
  optionLabel: g,
1317
1332
  optionValue: N,
1318
- renderSelection: k,
1319
- onRemoveOption: H.removeOption,
1320
- onRemoveGroup: H.removeOptions,
1321
- onClear: z ? He : void 0,
1322
- onClick: Ee,
1323
- onFocus: Ke,
1333
+ renderSelection: R,
1334
+ onRemoveOption: K.removeOption,
1335
+ onRemoveGroup: K.removeOptions,
1336
+ onClear: z ? Ke : void 0,
1337
+ onClick: Me,
1338
+ onFocus: Pe,
1324
1339
  isOpen: te,
1325
- onKeyDown: Me,
1326
- className: V,
1327
- containerClassName: E,
1328
- buttonClassName: L,
1340
+ onKeyDown: Ge,
1341
+ className: X,
1342
+ containerClassName: A,
1343
+ buttonClassName: q,
1329
1344
  width: oe,
1330
1345
  height: ie,
1331
1346
  tabIndex: le,
1332
1347
  helperComponent: y,
1333
1348
  errorComponent: u,
1334
- inputProps: P
1349
+ inputProps: G
1335
1350
  }
1336
1351
  ),
1337
- /* @__PURE__ */ o.jsx(
1338
- ft,
1352
+ /* @__PURE__ */ a.jsx(
1353
+ gt,
1339
1354
  {
1340
- menuRef: T.ref,
1341
- triggerRef: T.triggerRef,
1355
+ menuRef: O.ref,
1356
+ triggerRef: O.triggerRef,
1342
1357
  anchorRef: be,
1343
1358
  dropdownVariant: U,
1344
1359
  attachToParent: e.attachToParent,
1345
1360
  filteredOptions: ne.filteredOptions,
1346
- selectedIds: H.selectedIds,
1361
+ selectedIds: K.selectedIds,
1347
1362
  optionLabel: g,
1348
1363
  optionValue: N,
1349
- optionActive: O,
1364
+ optionActive: T,
1350
1365
  multiple: !!c,
1351
1366
  renderOption: M,
1352
- renderOptionGroupHeader: G,
1353
- renderOptionContext: I,
1354
- onSelect: (v, _) => Ce(v, "mouse", _),
1355
- closeDropdown: T.close,
1356
- onSelectGroup: H.selectGroup,
1367
+ renderOptionGroupHeader: H,
1368
+ renderOptionContext: b,
1369
+ onSelect: (v, W) => Ce(v, "mouse", W),
1370
+ closeDropdown: O.close,
1371
+ onSelectGroup: K.selectGroup,
1357
1372
  searchValue: ne.searchValue,
1358
1373
  onSearchChange: ne.handleSearchChange,
1359
1374
  onSearchClear: ne.handleSearchClear,
1360
1375
  searchInputRef: fe,
1361
- dropdownOptions: X,
1362
- onSearchKeyDown: Q.handleSearchKeyDown,
1363
- createOptionKeyHandler: Q.createOptionKeyHandler,
1364
- navigateNext: Q.navigateNext,
1365
- navigatePrev: Q.navigatePrev,
1376
+ dropdownOptions: J,
1377
+ onSearchKeyDown: Y.handleSearchKeyDown,
1378
+ createOptionKeyHandler: Y.createOptionKeyHandler,
1379
+ navigateNext: Y.navigateNext,
1380
+ navigatePrev: Y.navigatePrev,
1366
1381
  optionsContainerRef: me,
1367
- isLoading: D || !!X?.isLoading,
1382
+ isLoading: I || !!J?.isLoading,
1368
1383
  emptyMessage: C,
1369
1384
  disabled: f,
1370
- size: b,
1371
- dropdownClassName: q,
1385
+ size: j,
1386
+ dropdownClassName: B,
1372
1387
  label: s
1373
1388
  }
1374
1389
  )
@@ -1377,5 +1392,5 @@ function Wt(e) {
1377
1392
  );
1378
1393
  }
1379
1394
  export {
1380
- Wt as default
1395
+ Lt as default
1381
1396
  };