@directo-ui/web 0.0.0-stage → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/README.md +25 -2
  2. package/dist/bundle.d.ts +2 -0
  3. package/dist/components/Accordion.d.ts +16 -0
  4. package/dist/components/Alert.d.ts +14 -0
  5. package/dist/components/Avatar.d.ts +16 -0
  6. package/dist/components/Badge.d.ts +11 -0
  7. package/dist/components/BottomSheet.d.ts +9 -0
  8. package/dist/components/Breadcrumb.d.ts +15 -0
  9. package/dist/components/Button.d.ts +3 -0
  10. package/dist/components/Card.d.ts +15 -0
  11. package/dist/components/Checkbox.d.ts +4 -0
  12. package/dist/components/DatePicker.d.ts +15 -0
  13. package/dist/components/Dialog.d.ts +28 -0
  14. package/dist/components/Divider.d.ts +6 -0
  15. package/dist/components/Dropdown.d.ts +20 -0
  16. package/dist/components/EmptyState.d.ts +9 -0
  17. package/dist/components/IconButton.d.ts +10 -0
  18. package/dist/components/Loading.d.ts +31 -0
  19. package/dist/components/Pagination.d.ts +9 -0
  20. package/dist/components/RadioGroup.d.ts +6 -0
  21. package/dist/components/Select.d.ts +5 -0
  22. package/dist/components/SlidingButton.d.ts +7 -0
  23. package/dist/components/Switch.d.ts +4 -0
  24. package/dist/components/Tabs.d.ts +6 -0
  25. package/dist/components/TextField.d.ts +11 -0
  26. package/dist/components/Textarea.d.ts +10 -0
  27. package/dist/components/Toast.d.ts +7 -0
  28. package/dist/components/Tooltip.d.ts +10 -0
  29. package/dist/components/index.d.ts +28 -0
  30. package/dist/core/dates.d.ts +6 -0
  31. package/dist/core/generated.d.ts +34 -0
  32. package/dist/core/index.d.ts +2 -0
  33. package/dist/core/pagination.d.ts +3 -0
  34. package/dist/core/toast.d.ts +19 -0
  35. package/dist/core/tokens.d.ts +178 -0
  36. package/dist/core/types.d.ts +227 -0
  37. package/dist/figma-components-directo.js +1288 -0
  38. package/dist/figma-components-directo.js.map +1 -0
  39. package/dist/index.d.ts +23 -0
  40. package/dist/styles.css +2 -0
  41. package/dist/tokens.css +321 -0
  42. package/package.json +51 -4
@@ -0,0 +1,1288 @@
1
+ import { createContext as e, forwardRef as t, useCallback as n, useContext as r, useEffect as i, useId as a, useMemo as o, useRef as s, useState as c } from "react";
2
+ import { jsx as l, jsxs as u } from "react/jsx-runtime";
3
+ import * as d from "@radix-ui/react-tabs";
4
+ import * as f from "@radix-ui/react-select";
5
+ import { CaretDown as p, CaretLeft as m, CaretRight as h, Check as g, CheckCircle as _, Info as v, MagnifyingGlass as y, SquaresFour as b, Tray as x, Warning as S, WarningCircle as C, X as w } from "phosphor-react";
6
+ import * as T from "@radix-ui/react-dialog";
7
+ import * as E from "@radix-ui/react-checkbox";
8
+ import * as D from "@radix-ui/react-radio-group";
9
+ import * as O from "@radix-ui/react-switch";
10
+ import * as k from "@radix-ui/react-tooltip";
11
+ import * as A from "@radix-ui/react-dropdown-menu";
12
+ //#region src/components/Button.tsx
13
+ var j = t(function({ variant: e = "primary", size: t = "md", disabled: n = !1, loading: r = !1, fullWidth: i = !1, leftIcon: a, rightIcon: o, children: s, type: c = "button", className: d = "", ...f }, p) {
14
+ return /* @__PURE__ */ u("button", {
15
+ ...f,
16
+ ref: p,
17
+ type: c,
18
+ disabled: n || r,
19
+ "aria-busy": r || void 0,
20
+ "data-variant": e,
21
+ "data-size": t,
22
+ "data-full-width": i || void 0,
23
+ className: `ds-button ${d}`.trim(),
24
+ children: [
25
+ r ? /* @__PURE__ */ l("span", {
26
+ className: "ds-spinner",
27
+ "data-size": "sm",
28
+ "aria-hidden": "true"
29
+ }) : a && /* @__PURE__ */ l("span", {
30
+ className: "ds-button-icon",
31
+ "aria-hidden": "true",
32
+ children: a
33
+ }),
34
+ s,
35
+ o && !r && /* @__PURE__ */ l("span", {
36
+ className: "ds-button-icon",
37
+ "aria-hidden": "true",
38
+ children: o
39
+ })
40
+ ]
41
+ });
42
+ }), M = /* @__PURE__ */ u("svg", {
43
+ width: "20",
44
+ height: "20",
45
+ viewBox: "0 0 24 24",
46
+ fill: "none",
47
+ stroke: "currentColor",
48
+ strokeWidth: "2",
49
+ strokeLinecap: "round",
50
+ strokeLinejoin: "round",
51
+ children: [/* @__PURE__ */ l("path", { d: "M20 10c0 6-8 12-8 12s-8-6-8-12a8 8 0 0 1 16 0Z" }), /* @__PURE__ */ l("circle", {
52
+ cx: "12",
53
+ cy: "10",
54
+ r: "3"
55
+ })]
56
+ }), N = t(function({ variant: e = "primary", size: t = "md", disabled: n = !1, icon: r, ariaLabel: i, type: a = "button", className: o = "", children: s, ...c }, u) {
57
+ return /* @__PURE__ */ l("button", {
58
+ ...c,
59
+ ref: u,
60
+ type: a,
61
+ disabled: n,
62
+ className: `ds-icon-button ${o}`.trim(),
63
+ "data-variant": e,
64
+ "data-size": t,
65
+ "aria-label": i ?? c["aria-label"] ?? "Acción",
66
+ children: /* @__PURE__ */ l("span", {
67
+ "aria-hidden": "true",
68
+ children: r ?? s ?? M
69
+ })
70
+ });
71
+ }), P = {
72
+ default: {
73
+ background: "var(--ds-color-neutral-800)",
74
+ handle: "var(--ds-color-primary-500)",
75
+ label: "Desliza cuando estés ubicado"
76
+ },
77
+ libre: {
78
+ background: "var(--ds-bg-success-primary)",
79
+ handle: "var(--ds-color-success-800)",
80
+ label: "Ponerme como libre"
81
+ },
82
+ ocupado: {
83
+ background: "var(--ds-color-primary-500)",
84
+ handle: "var(--ds-color-primary-700)",
85
+ label: "Ponerme como ocupado"
86
+ },
87
+ desactivar: {
88
+ background: "var(--ds-color-error-500)",
89
+ handle: "var(--ds-color-error-700)",
90
+ label: "Desactivar mi sesión"
91
+ }
92
+ };
93
+ function F({ variant: e = "default", disabled: t = !1, label: n, onComplete: r }) {
94
+ let [a, o] = c(0), [d, f] = c(!1), [p, m] = c(!1), h = s(null), g = s(0), _ = s(0), v = s(null), y = s(!1), b = P[e] ?? P.default, x = n ?? b.label, S = () => Math.max(0, (h.current?.clientWidth ?? 64) - 64);
95
+ function C() {
96
+ t || y.current || (y.current = !0, m(!0), o(S()), r?.());
97
+ }
98
+ function w() {
99
+ v.current = null, f(!1), y.current || (_.current = 0, o(0));
100
+ }
101
+ return i(() => {
102
+ if (!p) return;
103
+ let e = setTimeout(() => {
104
+ y.current = !1, _.current = 0, o(0), m(!1);
105
+ }, 1500);
106
+ return () => clearTimeout(e);
107
+ }, [p]), /* @__PURE__ */ u("div", {
108
+ ref: h,
109
+ className: "ds-slide",
110
+ style: {
111
+ background: b.background,
112
+ opacity: t ? .5 : 1
113
+ },
114
+ children: [
115
+ /* @__PURE__ */ l("span", {
116
+ className: "ds-slide-progress",
117
+ "aria-hidden": "true",
118
+ style: { width: p ? "100%" : a ? `${a + 56}px` : 0 }
119
+ }),
120
+ /* @__PURE__ */ l("button", {
121
+ type: "button",
122
+ "aria-label": x,
123
+ title: "Desliza o pulsa Enter para confirmar",
124
+ className: "ds-slide-handle",
125
+ disabled: t || p,
126
+ style: {
127
+ background: b.handle,
128
+ transform: `translateX(${a}px)`,
129
+ transition: d ? "none" : void 0
130
+ },
131
+ onClick: (e) => {
132
+ e.detail === 0 && C();
133
+ },
134
+ onPointerDown: (e) => {
135
+ t || y.current || e.button !== 0 || (v.current = e.pointerId, g.current = e.clientX, _.current = 0, o(0), f(!0), e.currentTarget.setPointerCapture(e.pointerId));
136
+ },
137
+ onPointerMove: (e) => {
138
+ v.current !== e.pointerId || t || y.current || (_.current = Math.max(0, Math.min(S(), e.clientX - g.current)), o(_.current));
139
+ },
140
+ onPointerUp: (e) => {
141
+ if (v.current === e.pointerId) {
142
+ if (t) {
143
+ w();
144
+ return;
145
+ }
146
+ v.current = null, f(!1), S() > 0 && _.current >= S() * .7 ? C() : (_.current = 0, o(0)), e.currentTarget.hasPointerCapture(e.pointerId) && e.currentTarget.releasePointerCapture(e.pointerId);
147
+ }
148
+ },
149
+ onPointerCancel: w,
150
+ onLostPointerCapture: () => {
151
+ v.current !== null && w();
152
+ },
153
+ children: /* @__PURE__ */ l("svg", {
154
+ "aria-hidden": "true",
155
+ width: "24",
156
+ height: "24",
157
+ viewBox: "0 0 24 24",
158
+ fill: "none",
159
+ stroke: "currentColor",
160
+ strokeWidth: "2",
161
+ children: /* @__PURE__ */ l("path", { d: "M5 12h14M12 5l7 7-7 7" })
162
+ })
163
+ }),
164
+ /* @__PURE__ */ l("span", {
165
+ className: "ds-slide-label",
166
+ "aria-hidden": "true",
167
+ style: { opacity: p ? 0 : Math.max(0, 1 - a / 140) },
168
+ children: x
169
+ }),
170
+ /* @__PURE__ */ l("span", {
171
+ role: "status",
172
+ className: "ds-slide-status",
173
+ children: p ? "Confirmado" : ""
174
+ })
175
+ ]
176
+ });
177
+ }
178
+ //#endregion
179
+ //#region src/components/Tabs.tsx
180
+ function I({ defaultValue: e, value: t, onValueChange: n, orientation: r = "horizontal", children: i }) {
181
+ return /* @__PURE__ */ l(d.Root, {
182
+ className: "ds-tabs",
183
+ defaultValue: e,
184
+ value: t,
185
+ onValueChange: n,
186
+ orientation: r,
187
+ children: i
188
+ });
189
+ }
190
+ function L({ variant: e = "default", children: t }) {
191
+ return /* @__PURE__ */ l(d.List, {
192
+ className: "ds-tabs-list",
193
+ "data-variant": e,
194
+ children: t
195
+ });
196
+ }
197
+ function R({ value: e, disabled: t, children: n }) {
198
+ return /* @__PURE__ */ l(d.Trigger, {
199
+ value: e,
200
+ disabled: t,
201
+ className: "ds-tab",
202
+ children: n
203
+ });
204
+ }
205
+ function z({ value: e, children: t }) {
206
+ return /* @__PURE__ */ l(d.Content, {
207
+ value: e,
208
+ className: "ds-tab-panel",
209
+ children: t
210
+ });
211
+ }
212
+ //#endregion
213
+ //#region src/components/Select.tsx
214
+ function B({ value: e, onValueChange: t, placeholder: n = "Seleccionar…", disabled: r, children: i, id: o, ariaLabel: s, label: c, supportingText: d, error: m = !1, ...h }) {
215
+ let g = a(), _ = o ?? g, v = `${_}-hint`, y = /* @__PURE__ */ u(f.Root, {
216
+ ...h,
217
+ value: e,
218
+ onValueChange: t,
219
+ disabled: r,
220
+ children: [/* @__PURE__ */ u(f.Trigger, {
221
+ id: _,
222
+ "aria-label": c ? void 0 : s,
223
+ "aria-invalid": m || void 0,
224
+ "aria-describedby": d ? v : void 0,
225
+ className: "ds-select-trigger",
226
+ children: [/* @__PURE__ */ l(f.Value, { placeholder: n }), /* @__PURE__ */ l(f.Icon, { children: /* @__PURE__ */ l(p, {
227
+ size: 16,
228
+ "aria-hidden": "true"
229
+ }) })]
230
+ }), /* @__PURE__ */ l(f.Portal, { children: /* @__PURE__ */ l(f.Content, {
231
+ position: "popper",
232
+ sideOffset: 6,
233
+ className: "ds-select-content",
234
+ children: /* @__PURE__ */ l(f.Viewport, {
235
+ className: "ds-select-viewport",
236
+ children: i
237
+ })
238
+ }) })]
239
+ });
240
+ return !c && !d ? y : /* @__PURE__ */ u("div", {
241
+ className: "ds-input",
242
+ "data-error": m,
243
+ "data-disabled": r,
244
+ children: [
245
+ c && /* @__PURE__ */ l("label", {
246
+ htmlFor: _,
247
+ children: c
248
+ }),
249
+ y,
250
+ d && /* @__PURE__ */ l("small", {
251
+ id: v,
252
+ children: d
253
+ })
254
+ ]
255
+ });
256
+ }
257
+ function V({ value: e, disabled: t, children: n }) {
258
+ return /* @__PURE__ */ u(f.Item, {
259
+ value: e,
260
+ disabled: t,
261
+ className: "ds-select-item",
262
+ children: [/* @__PURE__ */ l(f.ItemText, { children: n }), /* @__PURE__ */ l(f.ItemIndicator, {
263
+ className: "ds-select-check",
264
+ children: /* @__PURE__ */ l(g, {
265
+ size: 16,
266
+ "aria-hidden": "true"
267
+ })
268
+ })]
269
+ });
270
+ }
271
+ //#endregion
272
+ //#region src/components/Dialog.tsx
273
+ function H({ open: e, onOpenChange: t, children: n, ...r }) {
274
+ return /* @__PURE__ */ l(T.Root, {
275
+ ...r,
276
+ open: e,
277
+ onOpenChange: t,
278
+ children: n
279
+ });
280
+ }
281
+ function ee({ children: e, asChild: t }) {
282
+ return t ? /* @__PURE__ */ l(T.Trigger, {
283
+ asChild: !0,
284
+ children: e
285
+ }) : /* @__PURE__ */ l(T.Trigger, {
286
+ className: "ds-button",
287
+ "data-variant": "primary",
288
+ "data-size": "md",
289
+ children: e
290
+ });
291
+ }
292
+ function te({ children: e, className: t = "", size: n = "md", showClose: r = !0, ...i }) {
293
+ return /* @__PURE__ */ u(T.Portal, { children: [/* @__PURE__ */ l(T.Overlay, { className: "ds-modal-overlay" }), /* @__PURE__ */ u(T.Content, {
294
+ ...i,
295
+ "data-size": n,
296
+ className: `ds-modal-content ${t}`.trim(),
297
+ children: [e, r && /* @__PURE__ */ l(T.Close, {
298
+ "aria-label": "Cerrar diálogo",
299
+ className: "ds-modal-close",
300
+ children: /* @__PURE__ */ l(w, {
301
+ size: 18,
302
+ "aria-hidden": "true"
303
+ })
304
+ })]
305
+ })] });
306
+ }
307
+ function ne({ children: e }) {
308
+ return /* @__PURE__ */ l("div", {
309
+ className: "ds-modal-header",
310
+ children: e
311
+ });
312
+ }
313
+ function re({ children: e }) {
314
+ return /* @__PURE__ */ l(T.Title, {
315
+ className: "ds-modal-title",
316
+ children: e
317
+ });
318
+ }
319
+ function ie({ children: e }) {
320
+ return /* @__PURE__ */ l(T.Description, {
321
+ className: "ds-modal-description",
322
+ children: e
323
+ });
324
+ }
325
+ function ae({ children: e }) {
326
+ return /* @__PURE__ */ l("div", {
327
+ className: "ds-modal-body",
328
+ children: e
329
+ });
330
+ }
331
+ function oe({ children: e }) {
332
+ return /* @__PURE__ */ l("div", {
333
+ className: "ds-modal-footer",
334
+ children: e
335
+ });
336
+ }
337
+ function se({ children: e }) {
338
+ return /* @__PURE__ */ l(T.Close, {
339
+ asChild: !0,
340
+ children: e
341
+ });
342
+ }
343
+ //#endregion
344
+ //#region src/components/Checkbox.tsx
345
+ function ce({ checked: e, onCheckedChange: t, disabled: n, label: r, id: i, ...o }) {
346
+ let s = a(), c = i ?? s;
347
+ return /* @__PURE__ */ u("label", {
348
+ htmlFor: c,
349
+ className: "ds-react-choice",
350
+ children: [/* @__PURE__ */ l(E.Root, {
351
+ ...o,
352
+ id: c,
353
+ checked: e,
354
+ onCheckedChange: t,
355
+ disabled: n,
356
+ className: "ds-react-checkbox",
357
+ children: /* @__PURE__ */ l(E.Indicator, { children: /* @__PURE__ */ l(g, {
358
+ size: 14,
359
+ weight: "bold",
360
+ "aria-hidden": "true"
361
+ }) })
362
+ }), r && /* @__PURE__ */ l("span", { children: r })]
363
+ });
364
+ }
365
+ //#endregion
366
+ //#region src/components/RadioGroup.tsx
367
+ function le({ value: e, defaultValue: t, name: n, onValueChange: r, disabled: i, ariaLabel: a, orientation: o = "vertical", children: s }) {
368
+ return /* @__PURE__ */ l(D.Root, {
369
+ value: e,
370
+ defaultValue: t,
371
+ name: n,
372
+ onValueChange: r,
373
+ disabled: i,
374
+ "aria-label": a,
375
+ orientation: o,
376
+ className: "ds-react-radio-group",
377
+ children: s
378
+ });
379
+ }
380
+ function ue({ value: e, disabled: t, label: n, id: r }) {
381
+ let i = a(), o = r ?? i;
382
+ return /* @__PURE__ */ u("label", {
383
+ htmlFor: o,
384
+ className: "ds-react-choice",
385
+ children: [/* @__PURE__ */ l(D.Item, {
386
+ id: o,
387
+ value: e,
388
+ disabled: t,
389
+ className: "ds-react-radio",
390
+ children: /* @__PURE__ */ l(D.Indicator, { className: "ds-react-radio-indicator" })
391
+ }), n && /* @__PURE__ */ l("span", { children: n })]
392
+ });
393
+ }
394
+ //#endregion
395
+ //#region src/components/Switch.tsx
396
+ function de({ checked: e, onCheckedChange: t, disabled: n, label: r, id: i, ...o }) {
397
+ let s = a(), c = i ?? s;
398
+ return /* @__PURE__ */ u("label", {
399
+ htmlFor: c,
400
+ className: "ds-react-choice",
401
+ children: [/* @__PURE__ */ l(O.Root, {
402
+ ...o,
403
+ id: c,
404
+ checked: e,
405
+ onCheckedChange: t,
406
+ disabled: n,
407
+ className: "ds-react-switch",
408
+ children: /* @__PURE__ */ l(O.Thumb, { className: "ds-react-switch-thumb" })
409
+ }), r && /* @__PURE__ */ l("span", { children: r })]
410
+ });
411
+ }
412
+ //#endregion
413
+ //#region src/components/Alert.tsx
414
+ var fe = {
415
+ info: /* @__PURE__ */ l(v, { weight: "fill" }),
416
+ success: /* @__PURE__ */ l(_, { weight: "fill" }),
417
+ warning: /* @__PURE__ */ l(S, { weight: "fill" }),
418
+ error: /* @__PURE__ */ l(C, { weight: "fill" })
419
+ };
420
+ function pe({ variant: e = "info", title: t, description: n, dismissible: r = !1, icon: i, actions: a, onClose: o, children: s }) {
421
+ let [d, f] = c(!0);
422
+ return d ? /* @__PURE__ */ u("div", {
423
+ className: "ds-alert",
424
+ "data-variant": e,
425
+ role: e === "error" ? "alert" : "status",
426
+ children: [
427
+ /* @__PURE__ */ l("span", {
428
+ className: "ds-alert-icon",
429
+ "aria-hidden": "true",
430
+ children: i ?? fe[e]
431
+ }),
432
+ /* @__PURE__ */ u("div", {
433
+ className: "ds-alert-content",
434
+ children: [
435
+ /* @__PURE__ */ l("p", {
436
+ className: "ds-alert-title",
437
+ children: t
438
+ }),
439
+ n && /* @__PURE__ */ l("div", {
440
+ className: "ds-alert-description",
441
+ children: n
442
+ }),
443
+ s,
444
+ a && /* @__PURE__ */ l("div", {
445
+ className: "ds-alert-actions",
446
+ children: a
447
+ })
448
+ ]
449
+ }),
450
+ r && /* @__PURE__ */ l("button", {
451
+ type: "button",
452
+ className: "ds-alert-close",
453
+ "aria-label": "Cerrar alerta",
454
+ onClick: () => {
455
+ f(!1), o?.();
456
+ },
457
+ children: /* @__PURE__ */ l(w, {
458
+ size: 16,
459
+ "aria-hidden": "true"
460
+ })
461
+ })
462
+ ]
463
+ }) : null;
464
+ }
465
+ //#endregion
466
+ //#region src/components/Avatar.tsx
467
+ var me = {
468
+ online: "En línea",
469
+ offline: "Desconectado",
470
+ away: "Ausente",
471
+ busy: "Ocupado"
472
+ };
473
+ function he(e) {
474
+ return (e ?? "").trim().split(/\s+/).filter(Boolean).slice(0, 2).map((e) => e.charAt(0).toUpperCase()).join("") || "?";
475
+ }
476
+ function ge({ src: e, alt: t, size: n = "md", fallback: r, status: i, shape: a = "circle" }) {
477
+ let [o, s] = c(), d = !e || o === e, f = [t || r || "Usuario", i ? me[i] : null].filter(Boolean).join(", ");
478
+ return /* @__PURE__ */ u("span", {
479
+ className: "ds-avatar",
480
+ "data-size": n,
481
+ "data-shape": a,
482
+ role: "img",
483
+ "aria-label": f,
484
+ children: [d ? /* @__PURE__ */ l("span", {
485
+ className: "ds-avatar-fallback",
486
+ "aria-hidden": "true",
487
+ children: r || he(t)
488
+ }) : /* @__PURE__ */ l("img", {
489
+ src: e,
490
+ alt: "",
491
+ onError: () => s(e)
492
+ }), i && /* @__PURE__ */ l("span", {
493
+ className: "ds-avatar-status",
494
+ "data-status": i,
495
+ "aria-hidden": "true"
496
+ })]
497
+ });
498
+ }
499
+ function _e({ children: e, label: t }) {
500
+ return /* @__PURE__ */ l("span", {
501
+ className: "ds-avatar-group",
502
+ role: "group",
503
+ "aria-label": t,
504
+ children: e
505
+ });
506
+ }
507
+ //#endregion
508
+ //#region src/components/Badge.tsx
509
+ function ve({ variant: e = "primary", size: t = "md", dot: n = !1, removable: r = !1, removeLabel: i = "Quitar etiqueta", onRemove: a, children: o }) {
510
+ return /* @__PURE__ */ u("span", {
511
+ className: "ds-badge",
512
+ "data-variant": e,
513
+ "data-size": t,
514
+ children: [
515
+ n && /* @__PURE__ */ l("span", {
516
+ className: "ds-badge-dot",
517
+ "aria-hidden": "true"
518
+ }),
519
+ o,
520
+ r && a && /* @__PURE__ */ l("button", {
521
+ type: "button",
522
+ className: "ds-badge-remove",
523
+ onClick: a,
524
+ "aria-label": i,
525
+ children: /* @__PURE__ */ l(w, {
526
+ size: 12,
527
+ weight: "bold",
528
+ "aria-hidden": "true"
529
+ })
530
+ })
531
+ ]
532
+ });
533
+ }
534
+ //#endregion
535
+ //#region src/components/Card.tsx
536
+ function ye({ variant: e = "default", padding: t = "md", selected: n = !1, onClick: r, header: i, title: a, description: o, footer: s, className: c = "", children: d }) {
537
+ return /* @__PURE__ */ u("div", {
538
+ className: `ds-card ${c}`.trim(),
539
+ "data-variant": e,
540
+ "data-padding": t,
541
+ "data-selected": n || void 0,
542
+ role: r ? "button" : void 0,
543
+ tabIndex: r ? 0 : void 0,
544
+ "aria-pressed": r ? n : void 0,
545
+ onClick: r ? (e) => {
546
+ let t = e.target instanceof Element ? e.target.closest("a, button, input, select, textarea, [role=\"button\"], [role=\"link\"]") : null;
547
+ t && t !== e.currentTarget || r?.();
548
+ } : void 0,
549
+ onKeyDown: r ? (e) => {
550
+ r && e.target === e.currentTarget && (e.key === "Enter" || e.key === " ") && (e.preventDefault(), r());
551
+ } : void 0,
552
+ children: [
553
+ i && /* @__PURE__ */ l("div", {
554
+ className: "ds-card-header",
555
+ children: i
556
+ }),
557
+ (a || o) && /* @__PURE__ */ u("div", {
558
+ className: "ds-card-header",
559
+ children: [a && /* @__PURE__ */ l("h3", {
560
+ className: "ds-card-title",
561
+ children: a
562
+ }), o && /* @__PURE__ */ l("p", {
563
+ className: "ds-card-description",
564
+ children: o
565
+ })]
566
+ }),
567
+ d !== void 0 && /* @__PURE__ */ l("div", {
568
+ className: "ds-card-content",
569
+ children: d
570
+ }),
571
+ s && /* @__PURE__ */ l("div", {
572
+ className: "ds-card-footer",
573
+ children: s
574
+ })
575
+ ]
576
+ });
577
+ }
578
+ //#endregion
579
+ //#region src/components/Tooltip.tsx
580
+ function be({ content: e, position: t = "top", delay: n = 300, children: r }) {
581
+ return /* @__PURE__ */ l(k.Provider, {
582
+ delayDuration: n,
583
+ children: /* @__PURE__ */ u(k.Root, { children: [/* @__PURE__ */ l(k.Trigger, {
584
+ asChild: !0,
585
+ children: r
586
+ }), /* @__PURE__ */ l(k.Portal, { children: /* @__PURE__ */ u(k.Content, {
587
+ side: t,
588
+ sideOffset: 8,
589
+ className: "ds-tooltip",
590
+ children: [e, /* @__PURE__ */ l(k.Arrow, { className: "ds-tooltip-arrow" })]
591
+ }) })] })
592
+ });
593
+ }
594
+ //#endregion
595
+ //#region src/components/Loading.tsx
596
+ function xe({ variant: e = "spinner", size: t = "md", label: n, progress: r }) {
597
+ return e === "spinner" ? /* @__PURE__ */ l(U, {
598
+ size: t,
599
+ label: n,
600
+ showLabel: !!n
601
+ }) : e === "dots" ? /* @__PURE__ */ l("span", {
602
+ className: "ds-loading",
603
+ role: "status",
604
+ "aria-label": n || "Cargando",
605
+ children: /* @__PURE__ */ u("span", {
606
+ className: "ds-loading-dots",
607
+ "aria-hidden": "true",
608
+ children: [
609
+ /* @__PURE__ */ l("span", {}),
610
+ /* @__PURE__ */ l("span", {}),
611
+ /* @__PURE__ */ l("span", {})
612
+ ]
613
+ })
614
+ }) : e === "skeleton" ? /* @__PURE__ */ l(W, { label: n }) : /* @__PURE__ */ l(G, {
615
+ value: r ?? 0,
616
+ label: n
617
+ });
618
+ }
619
+ function U({ size: e = "md", label: t = "Cargando", showLabel: n = !1 }) {
620
+ return /* @__PURE__ */ u("span", {
621
+ className: "ds-loading",
622
+ role: "status",
623
+ "aria-label": n ? void 0 : t,
624
+ children: [/* @__PURE__ */ l("span", {
625
+ className: "ds-spinner",
626
+ "data-size": e,
627
+ "aria-hidden": "true"
628
+ }), n && /* @__PURE__ */ l("span", { children: t })]
629
+ });
630
+ }
631
+ function W({ lines: e = 3, avatar: t = !1, label: n = "Cargando contenido" }) {
632
+ return /* @__PURE__ */ u("div", {
633
+ role: "status",
634
+ "aria-label": n,
635
+ style: t ? {
636
+ display: "flex",
637
+ gap: 12,
638
+ alignItems: "flex-start"
639
+ } : void 0,
640
+ children: [t && /* @__PURE__ */ l("span", {
641
+ className: "ds-skeleton-circle",
642
+ "aria-hidden": "true"
643
+ }), /* @__PURE__ */ l("span", {
644
+ className: "ds-skeleton",
645
+ "aria-hidden": "true",
646
+ children: Array.from({ length: e }, (e, t) => /* @__PURE__ */ l("span", {}, t))
647
+ })]
648
+ });
649
+ }
650
+ function G({ value: e = 0, max: t = 100, label: n, showValue: r = !0, size: i = "md", variant: a = "primary", indeterminate: o = !1 }) {
651
+ let s = t > 0 ? t : 100, c = Math.round(Math.min(100, Math.max(0, (Number.isFinite(e) ? e : 0) / s * 100)));
652
+ return /* @__PURE__ */ u("div", {
653
+ className: "ds-progress",
654
+ "data-size": i,
655
+ "data-variant": a,
656
+ "data-indeterminate": o || void 0,
657
+ role: "progressbar",
658
+ "aria-label": n || "Progreso",
659
+ "aria-valuemin": 0,
660
+ "aria-valuemax": 100,
661
+ "aria-valuenow": o ? void 0 : c,
662
+ children: [n && /* @__PURE__ */ u("span", {
663
+ className: "ds-progress-header",
664
+ children: [/* @__PURE__ */ l("span", { children: n }), r && !o && /* @__PURE__ */ u("span", { children: [c, "%"] })]
665
+ }), /* @__PURE__ */ l("span", {
666
+ className: "ds-progress-track",
667
+ "aria-hidden": "true",
668
+ children: /* @__PURE__ */ l("span", {
669
+ className: "ds-progress-value",
670
+ style: { width: `${c}%` }
671
+ })
672
+ })]
673
+ });
674
+ }
675
+ //#endregion
676
+ //#region src/components/EmptyState.tsx
677
+ var Se = {
678
+ default: /* @__PURE__ */ l(b, {}),
679
+ "no-data": /* @__PURE__ */ l(x, {}),
680
+ error: /* @__PURE__ */ l(C, {}),
681
+ "no-results": /* @__PURE__ */ l(y, {})
682
+ };
683
+ function Ce({ variant: e = "default", title: t, description: n, action: r, icon: i }) {
684
+ return /* @__PURE__ */ u("div", {
685
+ className: "ds-empty-state",
686
+ "data-variant": e,
687
+ children: [
688
+ /* @__PURE__ */ l("div", {
689
+ className: "ds-empty-state-icon",
690
+ "aria-hidden": "true",
691
+ children: i ?? Se[e]
692
+ }),
693
+ /* @__PURE__ */ l("h3", { children: t }),
694
+ n && /* @__PURE__ */ l("p", { children: n }),
695
+ r && /* @__PURE__ */ l("div", {
696
+ className: "ds-empty-state-action",
697
+ children: r
698
+ })
699
+ ]
700
+ });
701
+ }
702
+ //#endregion
703
+ //#region src/components/BottomSheet.tsx
704
+ function we({ isOpen: e, onClose: t, title: n, children: r }) {
705
+ return /* @__PURE__ */ l(T.Root, {
706
+ open: e,
707
+ onOpenChange: (e) => {
708
+ e || t();
709
+ },
710
+ children: /* @__PURE__ */ u(T.Portal, { children: [/* @__PURE__ */ l(T.Overlay, { className: "ds-sheet-overlay" }), /* @__PURE__ */ u(T.Content, {
711
+ className: "ds-sheet",
712
+ "aria-describedby": void 0,
713
+ children: [
714
+ /* @__PURE__ */ l("div", {
715
+ className: "ds-sheet-handle",
716
+ "aria-hidden": "true"
717
+ }),
718
+ /* @__PURE__ */ u("header", {
719
+ className: "ds-sheet-header",
720
+ children: [/* @__PURE__ */ l(T.Title, { children: n ?? "Información" }), /* @__PURE__ */ l(T.Close, {
721
+ "aria-label": "Cerrar panel",
722
+ className: "ds-sheet-close",
723
+ children: /* @__PURE__ */ l(w, {
724
+ size: 20,
725
+ "aria-hidden": "true"
726
+ })
727
+ })]
728
+ }),
729
+ /* @__PURE__ */ l("div", {
730
+ className: "ds-sheet-body",
731
+ children: r
732
+ })
733
+ ]
734
+ })] })
735
+ });
736
+ }
737
+ //#endregion
738
+ //#region src/components/Dropdown.tsx
739
+ function Te({ trigger: e, items: t, onSelect: n, label: r, align: i = "start" }) {
740
+ return /* @__PURE__ */ u(A.Root, { children: [/* @__PURE__ */ l(A.Trigger, {
741
+ asChild: !0,
742
+ children: e
743
+ }), /* @__PURE__ */ l(A.Portal, { children: /* @__PURE__ */ u(A.Content, {
744
+ sideOffset: 6,
745
+ align: i,
746
+ className: "ds-dropdown",
747
+ children: [r && /* @__PURE__ */ l(A.Label, {
748
+ className: "ds-dropdown-label",
749
+ children: r
750
+ }), t.map((e) => e.divider ? /* @__PURE__ */ l(A.Separator, { className: "ds-dropdown-separator" }, e.id) : /* @__PURE__ */ u(A.Item, {
751
+ disabled: e.disabled,
752
+ onSelect: () => n(e.id),
753
+ className: "ds-dropdown-item",
754
+ "data-variant": e.danger ? "danger" : void 0,
755
+ children: [
756
+ e.icon && /* @__PURE__ */ l("span", {
757
+ className: "ds-dropdown-item-icon",
758
+ "aria-hidden": "true",
759
+ children: e.icon
760
+ }),
761
+ e.label,
762
+ e.shortcut && /* @__PURE__ */ l("span", {
763
+ className: "ds-dropdown-shortcut",
764
+ children: e.shortcut
765
+ })
766
+ ]
767
+ }, e.id))]
768
+ }) })] });
769
+ }
770
+ //#endregion
771
+ //#region src/components/TextField.tsx
772
+ var Ee = t(function({ label: e, supportingText: t, error: n = !1, disabled: r = !1, size: i = "md", leftIcon: o, rightIcon: s, onChange: c, id: d, type: f = "text", required: p, "aria-describedby": m, ...h }, g) {
773
+ let _ = a(), v = d ?? _, y = `${v}-hint`;
774
+ return /* @__PURE__ */ u("div", {
775
+ className: "ds-input",
776
+ "data-error": n,
777
+ "data-disabled": r,
778
+ "data-size": i,
779
+ children: [
780
+ e && /* @__PURE__ */ u("label", {
781
+ htmlFor: v,
782
+ children: [e, p && /* @__PURE__ */ l("span", {
783
+ className: "ds-input-required",
784
+ "aria-hidden": "true",
785
+ children: "*"
786
+ })]
787
+ }),
788
+ /* @__PURE__ */ u("div", {
789
+ className: "ds-input-shell",
790
+ children: [
791
+ o && /* @__PURE__ */ l("span", {
792
+ "aria-hidden": "true",
793
+ children: o
794
+ }),
795
+ /* @__PURE__ */ l("input", {
796
+ ...h,
797
+ ref: g,
798
+ id: v,
799
+ type: f,
800
+ disabled: r,
801
+ required: p,
802
+ "aria-invalid": n || void 0,
803
+ "aria-describedby": [m, t ? y : null].filter(Boolean).join(" ") || void 0,
804
+ onChange: (e) => c?.(e.target.value)
805
+ }),
806
+ s && /* @__PURE__ */ l("span", {
807
+ "aria-hidden": "true",
808
+ children: s
809
+ })
810
+ ]
811
+ }),
812
+ t && /* @__PURE__ */ l("small", {
813
+ id: y,
814
+ children: t
815
+ })
816
+ ]
817
+ });
818
+ }), De = t(function({ label: e, supportingText: t, error: n = !1, disabled: r = !1, showCount: i = !1, onChange: o, id: s, rows: d = 4, value: f, defaultValue: p, maxLength: m, required: h, "aria-describedby": g, ..._ }, v) {
819
+ let y = a(), b = s ?? y, x = `${b}-hint`, [S, C] = c(String(p ?? "")), w = String(f ?? S).length;
820
+ return /* @__PURE__ */ u("div", {
821
+ className: "ds-input",
822
+ "data-multiline": "true",
823
+ "data-error": n,
824
+ "data-disabled": r,
825
+ children: [
826
+ e && /* @__PURE__ */ u("label", {
827
+ htmlFor: b,
828
+ children: [e, h && /* @__PURE__ */ l("span", {
829
+ className: "ds-input-required",
830
+ "aria-hidden": "true",
831
+ children: "*"
832
+ })]
833
+ }),
834
+ /* @__PURE__ */ l("div", {
835
+ className: "ds-input-shell",
836
+ children: /* @__PURE__ */ l("textarea", {
837
+ ..._,
838
+ ref: v,
839
+ id: b,
840
+ rows: d,
841
+ disabled: r,
842
+ required: h,
843
+ value: f,
844
+ defaultValue: p,
845
+ maxLength: m,
846
+ "aria-invalid": n || void 0,
847
+ "aria-describedby": [g, t ? x : null].filter(Boolean).join(" ") || void 0,
848
+ onChange: (e) => {
849
+ C(e.target.value), o?.(e.target.value);
850
+ }
851
+ })
852
+ }),
853
+ (t || i && m) && /* @__PURE__ */ u("span", {
854
+ style: {
855
+ display: "flex",
856
+ gap: 12,
857
+ justifyContent: "space-between"
858
+ },
859
+ children: [t ? /* @__PURE__ */ l("small", {
860
+ id: x,
861
+ children: t
862
+ }) : /* @__PURE__ */ l("span", {}), i && m && /* @__PURE__ */ u("span", {
863
+ className: "ds-input-counter",
864
+ children: [
865
+ w,
866
+ "/",
867
+ m
868
+ ]
869
+ })]
870
+ })
871
+ ]
872
+ });
873
+ });
874
+ //#endregion
875
+ //#region src/core/dates.ts
876
+ function K(e) {
877
+ return e instanceof Date && Number.isFinite(e.getTime());
878
+ }
879
+ function q(e) {
880
+ return `${e.getFullYear().toString().padStart(4, "0")}-${(e.getMonth() + 1).toString().padStart(2, "0")}-${e.getDate().toString().padStart(2, "0")}`;
881
+ }
882
+ function Oe(e) {
883
+ let t = new Date(e.getFullYear(), e.getMonth(), 1), n = (t.getDay() + 6) % 7;
884
+ return Array.from({ length: 42 }, (e, r) => new Date(t.getFullYear(), t.getMonth(), 1 - n + r));
885
+ }
886
+ function J(e, t) {
887
+ return new Date(e.getFullYear(), e.getMonth(), e.getDate() + t);
888
+ }
889
+ function Y(e, t) {
890
+ let n = new Date(e.getFullYear(), e.getMonth() + t, 1), r = new Date(n.getFullYear(), n.getMonth() + 1, 0).getDate();
891
+ return new Date(n.getFullYear(), n.getMonth(), Math.min(e.getDate(), r));
892
+ }
893
+ function X(e, t, n) {
894
+ let r = q(e);
895
+ return (!K(t) || r >= q(t)) && (!K(n) || r <= q(n));
896
+ }
897
+ //#endregion
898
+ //#region src/components/DatePicker.tsx
899
+ var ke = [
900
+ "Lunes",
901
+ "Martes",
902
+ "Miércoles",
903
+ "Jueves",
904
+ "Viernes",
905
+ "Sábado",
906
+ "Domingo"
907
+ ];
908
+ function Ae({ value: e, defaultValue: t, onChange: r, placeholder: o = "Seleccionar fecha", disabled: d = !1, format: f = "dd/MM/yyyy", name: p, id: m, label: h, min: g, max: _ }) {
909
+ let [v, y] = c(t), b = e ?? v, [x, S] = c(!1), [C, w] = c(() => K(b) ? b : /* @__PURE__ */ new Date()), [E, D] = c({
910
+ left: 8,
911
+ top: 8
912
+ }), O = s(null), k = s(null), A = s(!1), j = a(), M = m ?? j, N = `${M}-calendar`, P = n(() => {
913
+ let e = O.current?.getBoundingClientRect();
914
+ e && D({
915
+ left: Math.max(8, Math.min(e.left, window.innerWidth - 318)),
916
+ top: Math.max(8, e.bottom + 360 < window.innerHeight ? e.bottom + 4 : e.top - 360)
917
+ });
918
+ }, []);
919
+ i(() => {
920
+ if (x) return window.addEventListener("resize", P), window.addEventListener("scroll", P, !0), () => {
921
+ window.removeEventListener("resize", P), window.removeEventListener("scroll", P, !0);
922
+ };
923
+ }, [x, P]), i(() => {
924
+ x && A.current && (k.current?.querySelector("[data-calendar-focus=\"true\"]")?.focus(), A.current = !1);
925
+ }, [C, x]);
926
+ function F(e) {
927
+ return K(g) && q(e) < q(g) ? new Date(g.getFullYear(), g.getMonth(), g.getDate()) : K(_) && q(e) > q(_) ? new Date(_.getFullYear(), _.getMonth(), _.getDate()) : e;
928
+ }
929
+ let I = C.toLocaleDateString("es-PE", {
930
+ month: "long",
931
+ year: "numeric"
932
+ }), L = K(b) ? f === "yyyy-MM-dd" ? q(b) : `${String(b.getDate()).padStart(2, "0")}/${String(b.getMonth() + 1).padStart(2, "0")}/${b.getFullYear()}` : "", R = Oe(C), z = q(/* @__PURE__ */ new Date()), B = !K(g) || q(new Date(C.getFullYear(), C.getMonth(), 0)) >= q(g), V = !K(_) || q(new Date(C.getFullYear(), C.getMonth() + 1, 1)) <= q(_);
933
+ function H(t) {
934
+ !d && X(t, g, _) && (e === void 0 && y(t), r?.(t), S(!1));
935
+ }
936
+ return /* @__PURE__ */ u("div", {
937
+ className: "ds-date-field",
938
+ children: [
939
+ h && /* @__PURE__ */ l("label", {
940
+ htmlFor: M,
941
+ children: h
942
+ }),
943
+ p && /* @__PURE__ */ l("input", {
944
+ type: "hidden",
945
+ name: p,
946
+ value: K(b) ? q(b) : "",
947
+ disabled: d
948
+ }),
949
+ /* @__PURE__ */ u(T.Root, {
950
+ modal: !1,
951
+ open: x,
952
+ onOpenChange: (e) => {
953
+ e && d || (e && (w(F(K(b) ? b : /* @__PURE__ */ new Date())), P()), S(e));
954
+ },
955
+ children: [/* @__PURE__ */ l(T.Trigger, {
956
+ asChild: !0,
957
+ children: /* @__PURE__ */ l("button", {
958
+ ref: O,
959
+ id: M,
960
+ type: "button",
961
+ disabled: d,
962
+ "aria-label": `${h ?? o}${L ? ": " + L : ""}`,
963
+ className: "ds-date-trigger",
964
+ children: L || o
965
+ })
966
+ }), /* @__PURE__ */ l(T.Portal, { children: /* @__PURE__ */ u(T.Content, {
967
+ ref: k,
968
+ className: "ds-calendar",
969
+ style: E,
970
+ "aria-labelledby": N,
971
+ "aria-describedby": void 0,
972
+ onOpenAutoFocus: (e) => {
973
+ e.preventDefault(), k.current?.querySelector("[data-calendar-focus=\"true\"]")?.focus();
974
+ },
975
+ children: [
976
+ /* @__PURE__ */ u("header", {
977
+ className: "ds-calendar-header",
978
+ children: [
979
+ /* @__PURE__ */ l("button", {
980
+ type: "button",
981
+ disabled: d || !B,
982
+ "aria-label": "Mes anterior",
983
+ onClick: () => w(F(Y(C, -1))),
984
+ children: "‹"
985
+ }),
986
+ /* @__PURE__ */ l(T.Title, {
987
+ id: N,
988
+ "aria-live": "polite",
989
+ children: I
990
+ }),
991
+ /* @__PURE__ */ l("button", {
992
+ type: "button",
993
+ disabled: d || !V,
994
+ "aria-label": "Mes siguiente",
995
+ onClick: () => w(F(Y(C, 1))),
996
+ children: "›"
997
+ })
998
+ ]
999
+ }),
1000
+ /* @__PURE__ */ u("table", {
1001
+ role: "grid",
1002
+ "aria-labelledby": N,
1003
+ className: "ds-calendar-grid",
1004
+ onKeyDown: (e) => {
1005
+ let t;
1006
+ e.key === "ArrowRight" && (t = J(C, 1)), e.key === "ArrowLeft" && (t = J(C, -1)), e.key === "ArrowDown" && (t = J(C, 7)), e.key === "ArrowUp" && (t = J(C, -7)), e.key === "Home" && (t = J(C, -((C.getDay() + 6) % 7))), e.key === "End" && (t = J(C, 6 - (C.getDay() + 6) % 7)), e.key === "PageUp" && (t = Y(C, e.shiftKey ? -12 : -1)), e.key === "PageDown" && (t = Y(C, e.shiftKey ? 12 : 1)), t && (e.preventDefault(), A.current = !0, w(F(t)));
1007
+ },
1008
+ children: [/* @__PURE__ */ l("thead", { children: /* @__PURE__ */ l("tr", { children: ke.map((e) => /* @__PURE__ */ l("th", {
1009
+ scope: "col",
1010
+ children: /* @__PURE__ */ l("abbr", {
1011
+ title: e,
1012
+ children: e.slice(0, 2)
1013
+ })
1014
+ }, e)) }) }), /* @__PURE__ */ l("tbody", { children: Array.from({ length: 6 }, (e, t) => /* @__PURE__ */ l("tr", { children: R.slice(t * 7, t * 7 + 7).map((e) => {
1015
+ let t = q(e), n = t === q(C), r = K(b) && t === q(b);
1016
+ return /* @__PURE__ */ l("td", {
1017
+ "aria-selected": r,
1018
+ children: /* @__PURE__ */ l("button", {
1019
+ type: "button",
1020
+ className: "ds-calendar-day",
1021
+ "data-other-month": e.getMonth() !== C.getMonth(),
1022
+ "data-selected": r,
1023
+ "data-calendar-focus": n,
1024
+ tabIndex: n ? 0 : -1,
1025
+ disabled: d || !X(e, g, _),
1026
+ "aria-label": e.toLocaleDateString("es-PE", {
1027
+ weekday: "long",
1028
+ day: "numeric",
1029
+ month: "long",
1030
+ year: "numeric"
1031
+ }),
1032
+ "aria-current": t === z ? "date" : void 0,
1033
+ onClick: () => H(e),
1034
+ children: e.getDate()
1035
+ })
1036
+ }, t);
1037
+ }) }, t)) })]
1038
+ }),
1039
+ /* @__PURE__ */ l(T.Close, {
1040
+ className: "ds-button",
1041
+ "aria-label": "Cerrar calendario",
1042
+ children: "Cerrar"
1043
+ })
1044
+ ]
1045
+ }) })]
1046
+ })
1047
+ ]
1048
+ });
1049
+ }
1050
+ //#endregion
1051
+ //#region src/components/Accordion.tsx
1052
+ function je({ variant: e = "default", children: t }) {
1053
+ return /* @__PURE__ */ l("div", {
1054
+ className: "ds-accordion",
1055
+ "data-variant": e,
1056
+ children: t
1057
+ });
1058
+ }
1059
+ function Me({ title: e, defaultOpen: t = !1, disabled: n = !1, name: r, children: i }) {
1060
+ return /* @__PURE__ */ u("details", {
1061
+ className: "ds-accordion-item",
1062
+ open: t || void 0,
1063
+ "aria-disabled": n || void 0,
1064
+ ...r ? { name: r } : {},
1065
+ onToggle: (e) => {
1066
+ n && e.currentTarget.open && (e.currentTarget.open = !1);
1067
+ },
1068
+ children: [/* @__PURE__ */ l("summary", {
1069
+ className: "ds-accordion-trigger",
1070
+ tabIndex: n ? -1 : void 0,
1071
+ children: e
1072
+ }), /* @__PURE__ */ l("div", {
1073
+ className: "ds-accordion-content",
1074
+ children: i
1075
+ })]
1076
+ });
1077
+ }
1078
+ //#endregion
1079
+ //#region src/components/Breadcrumb.tsx
1080
+ function Z({ items: e, separator: t = "chevron", label: n = "Ruta de navegación", renderLink: r }) {
1081
+ return /* @__PURE__ */ l("nav", {
1082
+ className: "ds-breadcrumb",
1083
+ "aria-label": n,
1084
+ "data-separator": t,
1085
+ children: /* @__PURE__ */ l("ol", { children: e.map((t, n) => {
1086
+ let i = n === e.length - 1;
1087
+ return /* @__PURE__ */ l("li", { children: i || !t.href ? /* @__PURE__ */ l("span", {
1088
+ "aria-current": i ? "page" : void 0,
1089
+ children: t.label
1090
+ }) : r ? r(t) : /* @__PURE__ */ l("a", {
1091
+ href: t.href,
1092
+ onClick: t.onClick,
1093
+ children: t.label
1094
+ }) }, n);
1095
+ }) })
1096
+ });
1097
+ }
1098
+ //#endregion
1099
+ //#region src/core/pagination.ts
1100
+ function Q(e, t, n = 1) {
1101
+ let r = Math.max(1, Math.floor(t)), i = Math.min(Math.max(1, Math.floor(e)), r), a = 3 + n * 2;
1102
+ if (r <= a + 2) return Array.from({ length: r }, (e, t) => t + 1);
1103
+ let o = Math.max(i - n, 1), s = Math.min(i + n, r);
1104
+ return o <= 3 ? [
1105
+ ...Array.from({ length: a }, (e, t) => t + 1),
1106
+ "ellipsis-end",
1107
+ r
1108
+ ] : s >= r - 2 ? [
1109
+ 1,
1110
+ "ellipsis-start",
1111
+ ...Array.from({ length: a }, (e, t) => r - a + t + 1)
1112
+ ] : [
1113
+ 1,
1114
+ "ellipsis-start",
1115
+ ...Array.from({ length: s - o + 1 }, (e, t) => o + t),
1116
+ "ellipsis-end",
1117
+ r
1118
+ ];
1119
+ }
1120
+ //#endregion
1121
+ //#region src/components/Pagination.tsx
1122
+ function Ne({ page: e, totalPages: t, onPageChange: n, siblings: r = 1, variant: i = "default", label: a = "Paginación" }) {
1123
+ let o = Math.max(1, t), s = (t) => {
1124
+ t >= 1 && t <= o && t !== e && n(t);
1125
+ };
1126
+ return /* @__PURE__ */ l("nav", {
1127
+ className: "ds-pagination",
1128
+ "aria-label": a,
1129
+ "data-variant": i,
1130
+ children: /* @__PURE__ */ u("ul", { children: [
1131
+ /* @__PURE__ */ l("li", { children: /* @__PURE__ */ l("button", {
1132
+ type: "button",
1133
+ className: "ds-page",
1134
+ onClick: () => s(e - 1),
1135
+ disabled: e <= 1,
1136
+ "aria-label": "Página anterior",
1137
+ children: /* @__PURE__ */ l(m, {
1138
+ size: 16,
1139
+ "aria-hidden": "true"
1140
+ })
1141
+ }) }),
1142
+ Q(e, o, r).map((t) => typeof t == "number" ? /* @__PURE__ */ l("li", { children: /* @__PURE__ */ l("button", {
1143
+ type: "button",
1144
+ className: "ds-page",
1145
+ "aria-current": t === e ? "page" : void 0,
1146
+ "aria-label": `Página ${t}`,
1147
+ onClick: () => s(t),
1148
+ children: t
1149
+ }) }, t) : /* @__PURE__ */ l("li", { children: /* @__PURE__ */ l("span", {
1150
+ className: "ds-page-ellipsis",
1151
+ "aria-hidden": "true",
1152
+ children: "…"
1153
+ }) }, t)),
1154
+ /* @__PURE__ */ l("li", { children: /* @__PURE__ */ l("button", {
1155
+ type: "button",
1156
+ className: "ds-page",
1157
+ onClick: () => s(e + 1),
1158
+ disabled: e >= o,
1159
+ "aria-label": "Página siguiente",
1160
+ children: /* @__PURE__ */ l(h, {
1161
+ size: 16,
1162
+ "aria-hidden": "true"
1163
+ })
1164
+ }) })
1165
+ ] })
1166
+ });
1167
+ }
1168
+ //#endregion
1169
+ //#region src/components/Divider.tsx
1170
+ function Pe({ orientation: e = "horizontal", label: t }) {
1171
+ return t ? /* @__PURE__ */ l("div", {
1172
+ className: "ds-divider",
1173
+ role: "separator",
1174
+ "data-label": t,
1175
+ children: t
1176
+ }) : /* @__PURE__ */ l("div", {
1177
+ className: "ds-divider",
1178
+ role: "separator",
1179
+ "aria-orientation": e,
1180
+ "data-orientation": e
1181
+ });
1182
+ }
1183
+ //#endregion
1184
+ //#region src/core/toast.ts
1185
+ var $ = e(null);
1186
+ function Fe() {
1187
+ let e = r($);
1188
+ if (!e) throw Error("useToast debe usarse dentro de <ToastProvider>.");
1189
+ return e;
1190
+ }
1191
+ //#endregion
1192
+ //#region src/components/Toast.tsx
1193
+ var Ie = {
1194
+ info: /* @__PURE__ */ l(v, { weight: "fill" }),
1195
+ success: /* @__PURE__ */ l(_, { weight: "fill" }),
1196
+ warning: /* @__PURE__ */ l(S, { weight: "fill" }),
1197
+ error: /* @__PURE__ */ l(C, { weight: "fill" })
1198
+ };
1199
+ function Le({ children: e, position: t = "bottom-right" }) {
1200
+ let [r, a] = c([]), d = s(0), f = s(/* @__PURE__ */ new Map()), p = n((e) => {
1201
+ clearTimeout(f.current.get(e)), f.current.delete(e), a((t) => t.map((t) => t.id === e ? {
1202
+ ...t,
1203
+ closing: !0
1204
+ } : t)), setTimeout(() => a((t) => t.filter((t) => t.id !== e)), 180);
1205
+ }, []), m = n((e) => {
1206
+ let t = ++d.current;
1207
+ a((n) => [...n.slice(-4), {
1208
+ variant: "info",
1209
+ ...e,
1210
+ id: t,
1211
+ closing: !1
1212
+ }]);
1213
+ let n = e.duration ?? 5e3;
1214
+ return n > 0 && f.current.set(t, setTimeout(() => p(t), n)), t;
1215
+ }, [p]);
1216
+ i(() => {
1217
+ let e = f.current;
1218
+ return () => {
1219
+ for (let t of e.values()) clearTimeout(t);
1220
+ };
1221
+ }, []);
1222
+ let h = o(() => ({
1223
+ toast: m,
1224
+ dismiss: p
1225
+ }), [m, p]);
1226
+ return /* @__PURE__ */ u($.Provider, {
1227
+ value: h,
1228
+ children: [e, /* @__PURE__ */ l("ol", {
1229
+ className: "ds-toaster",
1230
+ "data-position": t,
1231
+ "aria-label": "Notificaciones",
1232
+ children: r.map((e) => /* @__PURE__ */ u("li", {
1233
+ className: "ds-toast",
1234
+ "data-variant": e.variant,
1235
+ "data-state": e.closing ? "closing" : "open",
1236
+ role: e.variant === "error" ? "alert" : "status",
1237
+ "aria-atomic": "true",
1238
+ children: [
1239
+ /* @__PURE__ */ l("span", {
1240
+ className: "ds-toast-icon",
1241
+ "aria-hidden": "true",
1242
+ children: Ie[e.variant ?? "info"]
1243
+ }),
1244
+ /* @__PURE__ */ u("div", {
1245
+ className: "ds-toast-content",
1246
+ children: [
1247
+ /* @__PURE__ */ l("span", {
1248
+ className: "ds-toast-title",
1249
+ children: e.title
1250
+ }),
1251
+ e.description && /* @__PURE__ */ l("p", {
1252
+ className: "ds-toast-description",
1253
+ children: e.description
1254
+ }),
1255
+ e.action && /* @__PURE__ */ l("div", {
1256
+ className: "ds-toast-action",
1257
+ children: /* @__PURE__ */ l("button", {
1258
+ type: "button",
1259
+ className: "ds-button",
1260
+ "data-variant": "text",
1261
+ "data-size": "xs",
1262
+ onClick: () => {
1263
+ e.action?.onClick(), p(e.id);
1264
+ },
1265
+ children: e.action.label
1266
+ })
1267
+ })
1268
+ ]
1269
+ }),
1270
+ /* @__PURE__ */ l("button", {
1271
+ type: "button",
1272
+ className: "ds-toast-close",
1273
+ "aria-label": "Cerrar notificación",
1274
+ onClick: () => p(e.id),
1275
+ children: /* @__PURE__ */ l(w, {
1276
+ size: 14,
1277
+ "aria-hidden": "true"
1278
+ })
1279
+ })
1280
+ ]
1281
+ }, e.id))
1282
+ })]
1283
+ });
1284
+ }
1285
+ //#endregion
1286
+ export { je as Accordion, Me as AccordionItem, pe as Alert, ge as Avatar, _e as AvatarGroup, ve as Badge, we as BottomSheet, Z as Breadcrumb, j as Button, ye as Card, ce as Checkbox, E as CheckboxPrimitive, Ae as DatePicker, H as Dialog, ae as DialogBody, se as DialogClose, te as DialogContent, ie as DialogDescription, oe as DialogFooter, ne as DialogHeader, T as DialogPrimitive, re as DialogTitle, ee as DialogTrigger, Pe as Divider, Te as Dropdown, Ce as EmptyState, N as IconButton, xe as Loading, Ne as Pagination, G as Progress, le as RadioGroup, D as RadioGroupPrimitive, ue as RadioItem, B as Select, V as SelectItem, f as SelectPrimitive, W as Skeleton, F as SlidingButton, U as Spinner, de as Switch, O as SwitchPrimitive, R as Tab, L as TabList, z as TabPanel, I as Tabs, Ee as TextField, De as Textarea, Le as ToastProvider, be as Tooltip, Q as paginationRange, Fe as useToast };
1287
+
1288
+ //# sourceMappingURL=figma-components-directo.js.map