@mks2508/sidebar-headless 0.1.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.
@@ -0,0 +1,1663 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import * as react from 'react';
3
+ import { ReactNode, CSSProperties, ElementType, ComponentType, RefObject, MouseEvent } from 'react';
4
+ import { GlassConfig } from '@liquid-svg-glass/core';
5
+ import { ClassValue } from 'clsx';
6
+
7
+ interface SidebarLiquidConfig extends GlassConfig {
8
+ /** Habilitar chromatic aberration (Phase 2) - solo para tooltips por defecto */
9
+ enableChromaticAberration?: boolean;
10
+ }
11
+
12
+ /**
13
+ * Modo de colapso del sidebar
14
+ * @enum {string}
15
+ */
16
+ declare enum SidebarCollapseMode {
17
+ /** Colapsa el sidebar a un ancho mínimo mostrando solo iconos */
18
+ COLLAPSE = "collapse",
19
+ /** Oculta completamente el sidebar */
20
+ HIDE = "hide"
21
+ }
22
+ /**
23
+ * Comportamiento del sidebar cuando está en modo hide
24
+ * @enum {string}
25
+ */
26
+ declare enum SidebarHideBehaviour {
27
+ /** Muestra un botón indicador para reabrir el sidebar */
28
+ SHOW_INDICATOR = "showIndicator",
29
+ /** El sidebar es completamente controlado externamente sin indicador */
30
+ CONTROLLED = "controlled"
31
+ }
32
+ /**
33
+ * Comportamiento al abrir desde el estado hide
34
+ * @enum {string}
35
+ */
36
+ declare enum SidebarHideOpensBehavior {
37
+ /** Abre al tamaño colapsado (solo iconos) */
38
+ COLLAPSED = "collapsed",
39
+ /** Abre al tamaño expandido completo */
40
+ EXPANDED = "expanded"
41
+ }
42
+ /**
43
+ * Comportamiento de layout del sidebar
44
+ * @enum {string}
45
+ */
46
+ declare enum SidebarLayoutBehaviour {
47
+ /** Sidebar flotante con z-index que NO desplaza el contenido (default) */
48
+ FLOATING = "floating",
49
+ /** Sidebar como parte del layout que SÍ desplaza el contenido */
50
+ INLINE = "inline"
51
+ }
52
+ /**
53
+ * Anchos predefinidos del sidebar
54
+ * @enum {string}
55
+ */
56
+ declare enum SidebarWidth {
57
+ /** Ancho en estado colapsado (solo iconos) */
58
+ COLLAPSED = "5rem",
59
+ /** Ancho expandido completo */
60
+ EXPANDED = "16rem",
61
+ /** Ancho mínimo absoluto */
62
+ MIN = "3rem",
63
+ /** Ancho máximo absoluto */
64
+ MAX = "20rem"
65
+ }
66
+ /**
67
+ * Duraciones de transición en milisegundos
68
+ * @enum {number}
69
+ */
70
+ declare enum SidebarTransitionDuration {
71
+ /** Transición rápida para cambios de opacidad */
72
+ FAST = 200,
73
+ /** Transición normal para width y transforms */
74
+ NORMAL = 300,
75
+ /** Transición lenta para animaciones complejas */
76
+ SLOW = 500
77
+ }
78
+ /**
79
+ * Índices Z para capas del sidebar
80
+ * @enum {number}
81
+ */
82
+ declare enum SidebarZIndex {
83
+ /** Base del contenedor wrapper */
84
+ BASE = 0,
85
+ /** Indicador visual */
86
+ INDICATOR = 5,
87
+ /** Contenido interno del sidebar */
88
+ CONTENT = 10,
89
+ /** Botón de toggle */
90
+ TOGGLE = 30
91
+ }
92
+ /**
93
+ * Radios de borde predefinidos
94
+ * @enum {string}
95
+ */
96
+ declare enum SidebarBorderRadius {
97
+ /** Sin radio de borde */
98
+ NONE = "0",
99
+ /** Radio pequeño */
100
+ SM = "0.25rem",
101
+ /** Radio medio */
102
+ MD = "0.5rem",
103
+ /** Radio grande */
104
+ LG = "1rem",
105
+ /** Radio completo (circular) */
106
+ FULL = "9999px"
107
+ }
108
+ /**
109
+ * Posiciones para SidebarSafeArea
110
+ * @enum {string}
111
+ */
112
+ declare enum SidebarSafeAreaPosition {
113
+ /** Área segura superior */
114
+ TOP = "top",
115
+ /** Área segura inferior */
116
+ BOTTOM = "bottom"
117
+ }
118
+ /**
119
+ * Timing functions para transiciones CSS
120
+ * @enum {string}
121
+ */
122
+ declare enum SidebarTimingFunction {
123
+ /** Ease estándar */
124
+ EASE = "ease",
125
+ /** Linear (velocidad constante) */
126
+ LINEAR = "linear",
127
+ /** Ease in (aceleración) */
128
+ EASE_IN = "ease-in",
129
+ /** Ease out (desaceleración) */
130
+ EASE_OUT = "ease-out",
131
+ /** Ease in out (aceleración y desaceleración) */
132
+ EASE_IN_OUT = "ease-in-out",
133
+ /** Cubic bezier personalizado */
134
+ CUSTOM = "cubic-bezier(0.4, 0, 0.2, 1)"
135
+ }
136
+ /**
137
+ * Configuración de estilo visual del sidebar
138
+ * @interface
139
+ */
140
+ interface SidebarVisualStyle {
141
+ /** Margen superior (separación del borde superior) */
142
+ marginTop?: string;
143
+ /** Margen inferior (separación del borde inferior) */
144
+ marginBottom?: string;
145
+ /** Margen izquierdo (separación del borde izquierdo) */
146
+ marginLeft?: string;
147
+ /** Margen derecho (generalmente 0 en modo inline) */
148
+ marginRight?: string;
149
+ /** Altura del sidebar (default: "100vh") */
150
+ height?: string;
151
+ /** Radio de borde redondeado */
152
+ borderRadius?: string;
153
+ /** Sombra del sidebar */
154
+ boxShadow?: string;
155
+ }
156
+ /**
157
+ * Configuración de dimensiones del sidebar
158
+ * @interface
159
+ */
160
+ interface SidebarDimensions {
161
+ /** Ancho cuando está colapsado */
162
+ collapsedWidth: string;
163
+ /** Ancho cuando está expandido */
164
+ expandedWidth: string;
165
+ /** Altura del indicador visual */
166
+ indicatorHeight: string;
167
+ /** Distancia del tooltip al borde del sidebar (CSS-first con Anchor API) */
168
+ tooltipDistance?: string;
169
+ /** Configuración de estilo visual */
170
+ visualStyle?: SidebarVisualStyle;
171
+ }
172
+ /**
173
+ * Configuración de áreas seguras (safe areas)
174
+ * @interface
175
+ */
176
+ interface SidebarSafeAreas {
177
+ /** Porcentaje de altura para área segura superior */
178
+ topPercent: number;
179
+ /** Porcentaje de altura para área segura inferior */
180
+ bottomPercent: number;
181
+ }
182
+ /**
183
+ * Configuración de animaciones
184
+ * @interface
185
+ */
186
+ interface SidebarAnimations {
187
+ /** Duración de transición de width en ms */
188
+ widthTransitionDuration: number;
189
+ /** Duración de transición de opacidad en ms */
190
+ opacityTransitionDuration: number;
191
+ /** Función de timing para animaciones */
192
+ timingFunction: string;
193
+ }
194
+ /**
195
+ * Configuración experimental de Liquid Glass V2
196
+ *
197
+ * @description
198
+ * Feature flags para habilitar efectos avanzados de liquid glass basados en:
199
+ * - SVG Displacement Mapping (Snell's Law refraction)
200
+ * - Chromatic Aberration (RGB channel separation)
201
+ * - Edge Glass 3D (dual backdrop layers)
202
+ * - Backdrop Extension (Josh Comeau technique)
203
+ *
204
+ * @interface
205
+ * @experimental
206
+ */
207
+ interface SidebarLiquidGlassConfig {
208
+ /**
209
+ * Habilitar Liquid Glass V2 (master flag)
210
+ *
211
+ * @description
212
+ * Activa el uso de FluidHoverIndicatorV2 y SidebarTooltipV2 con SVG displacement mapping
213
+ * en lugar de las versiones básicas con backdrop-blur CSS.
214
+ *
215
+ * @default false
216
+ */
217
+ enableLiquidGlassV2?: boolean;
218
+ /**
219
+ * Habilitar Chromatic Aberration (Phase 2)
220
+ *
221
+ * @description
222
+ * Activa la separación real de canales RGB usando feColorMatrix + feOffset
223
+ * en lugar del método legacy basado en diferentes escalas de displacement.
224
+ * Proporciona +15% de realismo visual según benchmarks.
225
+ *
226
+ * **Requiere**: enableLiquidGlassV2 = true
227
+ *
228
+ * @default false
229
+ */
230
+ enableChromaticAberration?: boolean;
231
+ /**
232
+ * Habilitar Edge Glass 3D (tooltips)
233
+ *
234
+ * @description
235
+ * Activa dual backdrop layers con blur diferenciado para crear ilusión de profundidad:
236
+ * - Depth layer: blur alto (16px) con brightness 1.15
237
+ * - Surface layer: blur moderado (8px) con brightness 1.25
238
+ *
239
+ * **Solo aplica a**: SidebarTooltipV2
240
+ * **Requiere**: enableLiquidGlassV2 = true
241
+ *
242
+ * @default true
243
+ */
244
+ enableEdgeGlass3D?: boolean;
245
+ /**
246
+ * Habilitar Backdrop Extension (Josh Comeau)
247
+ *
248
+ * @description
249
+ * Extiende el área de backdrop-filter al 200% de altura con mask
250
+ * para capturar elementos cercanos y mejorar el realismo de la refracción.
251
+ *
252
+ * **Solo aplica a**: SidebarTooltipV2
253
+ * **Requiere**: enableLiquidGlassV2 = true
254
+ *
255
+ * @default true
256
+ */
257
+ enableBackdropExtension?: boolean;
258
+ /**
259
+ * Habilitar animaciones staggered de items en tooltips
260
+ *
261
+ * @description
262
+ * Activa entrada/salida escalonada de items del tooltip usando CSS custom properties.
263
+ * Incluye grid trick para height auto transitions y direction-aware animations.
264
+ *
265
+ * **Solo aplica a**: SidebarTooltipV2
266
+ *
267
+ * @default true
268
+ * @experimental
269
+ */
270
+ enableTooltipItemAnimations?: boolean;
271
+ /**
272
+ * Habilitar animación 3D de cilindro para títulos de tooltips
273
+ *
274
+ * @description
275
+ * Activa efecto de cilindro rotatorio 3D para el título del tooltip usando Web Animations API.
276
+ * Mantiene historial circular de últimos 10 títulos y rota según dirección de navegación.
277
+ *
278
+ * **Features**:
279
+ * - Rotación 3D con rotateX
280
+ * - Direction-aware (up/down navigation)
281
+ * - Historial circular de títulos
282
+ * - Duración: 400ms, easing cubic-bezier
283
+ *
284
+ * **Solo aplica a**: SidebarTooltip
285
+ *
286
+ * @default false
287
+ * @experimental
288
+ */
289
+ enableCylinderTitle?: boolean;
290
+ /**
291
+ * Overrides de preset para configuración avanzada de Liquid Glass
292
+ *
293
+ * @description
294
+ * Permite sobrescribir valores del preset 'sidebar' para debugging y ajuste fino.
295
+ * Incluye parámetros visuales como frost, blur, scale, chromatic aberration RGB, etc.
296
+ *
297
+ * **Ejemplo**:
298
+ * ```tsx
299
+ * presetOverrides: {
300
+ * frost: 0.08,
301
+ * blur: 12,
302
+ * blurBackground: 10,
303
+ * scale: -200,
304
+ * r: 5,
305
+ * g: 15,
306
+ * b: 25
307
+ * }
308
+ * ```
309
+ *
310
+ * **Requiere**: enableLiquidGlassV2 = true
311
+ *
312
+ * @default undefined
313
+ * @experimental
314
+ */
315
+ presetOverrides?: Partial<SidebarLiquidConfig>;
316
+ }
317
+ /**
318
+ * Librería de iconos a utilizar
319
+ * @enum {string}
320
+ */
321
+ declare enum SidebarIconLibrary {
322
+ /** Iconos de lucide-react */
323
+ LUCIDE = "lucide",
324
+ /** Iconos custom proporcionados por el usuario */
325
+ CUSTOM = "custom"
326
+ }
327
+ /**
328
+ * Estado compartido del sidebar
329
+ * @interface
330
+ */
331
+ interface SidebarState {
332
+ /** Indica si el sidebar está abierto */
333
+ open: boolean;
334
+ /** Indica si el sidebar está colapsado (solo en modo COLLAPSE) */
335
+ collapsed: boolean;
336
+ /** Modo de colapso actual */
337
+ collapseMode: SidebarCollapseMode;
338
+ /** Comportamiento de layout actual */
339
+ layoutBehaviour: SidebarLayoutBehaviour;
340
+ }
341
+ /**
342
+ * Estado del botón toggle
343
+ * @interface
344
+ */
345
+ interface SidebarToggleState {
346
+ /** Indica si el toggle está activo/presionado */
347
+ active: boolean;
348
+ /** Indica si el sidebar está abierto */
349
+ open: boolean;
350
+ }
351
+ /**
352
+ * Estado de un item del sidebar
353
+ * @interface
354
+ */
355
+ interface SidebarItemState {
356
+ /** Indica si el item está enfocado por teclado */
357
+ focused: boolean;
358
+ /** Indica si el mouse está sobre el item */
359
+ hovered: boolean;
360
+ /** Indica si el item está deshabilitado */
361
+ disabled: boolean;
362
+ }
363
+ /**
364
+ * Estado del indicador visual
365
+ * @interface
366
+ */
367
+ interface SidebarIndicatorState {
368
+ /** Indica si el indicador está visible */
369
+ visible: boolean;
370
+ /** Posición Y del indicador en píxeles */
371
+ position: number;
372
+ }
373
+ /**
374
+ * Tipo para render prop de Sidebar
375
+ */
376
+ type SidebarRenderProp = (state: SidebarState) => ReactNode;
377
+ /**
378
+ * Tipo para render prop de SidebarToggle
379
+ */
380
+ type SidebarToggleRenderProp = (state: SidebarToggleState) => ReactNode;
381
+ /**
382
+ * Tipo para render prop de SidebarItem
383
+ */
384
+ type SidebarItemRenderProp = (state: SidebarItemState) => ReactNode;
385
+ /**
386
+ * Tipo para render prop de SidebarIndicator
387
+ */
388
+ type SidebarIndicatorRenderProp = (state: SidebarIndicatorState) => ReactNode;
389
+ /**
390
+ * Valor del contexto compartido del Sidebar
391
+ * @interface
392
+ */
393
+ interface SidebarContextValue {
394
+ /** Estado inicial del sidebar (solo lectura) */
395
+ defaultOpen: boolean;
396
+ /** Estado actual open/closed del sidebar */
397
+ open: boolean;
398
+ /** Función para actualizar el estado open */
399
+ setOpen: (open: boolean) => void;
400
+ /** Modo de colapso actual */
401
+ collapseMode: SidebarCollapseMode;
402
+ /** Comportamiento en modo hide */
403
+ hideBehaviour: SidebarHideBehaviour;
404
+ /** Comportamiento al abrir desde hide */
405
+ hideOpensBehavior: SidebarHideOpensBehavior;
406
+ /** Comportamiento de layout del sidebar */
407
+ layoutBehaviour: SidebarLayoutBehaviour;
408
+ /** Configuración de dimensiones */
409
+ dimensions: SidebarDimensions;
410
+ /** Configuración de safe areas */
411
+ safeAreas: SidebarSafeAreas;
412
+ /** Configuración de animaciones */
413
+ animations: SidebarAnimations;
414
+ /** ID del toggle input */
415
+ toggleId: string;
416
+ /** Modo debug para visualizar safe areas */
417
+ debug: boolean;
418
+ /** Ref al contenedor de navegación */
419
+ navRef: RefObject<HTMLElement | null>;
420
+ /** Ref al contenedor de items */
421
+ contentRef: RefObject<HTMLDivElement | null>;
422
+ /** Ref al indicador visual */
423
+ indicatorRef: RefObject<HTMLDivElement | null>;
424
+ /** Registrar un item para navegación por teclado */
425
+ registerItem: (element: HTMLElement) => void;
426
+ /** Des-registrar un item */
427
+ unregisterItem: (element: HTMLElement) => void;
428
+ /** Items registrados actualmente */
429
+ items: HTMLElement[];
430
+ /** Indica si el indicador debe mostrarse por navegación de teclado */
431
+ showIndicatorForKeyboard: boolean;
432
+ /** Función para activar/desactivar el indicador por teclado */
433
+ setShowIndicatorForKeyboard: (show: boolean) => void;
434
+ /** Indica si el cursor/focus está sobre el área de items */
435
+ isOverItems: boolean;
436
+ /** Función para actualizar el estado de isOverItems */
437
+ setIsOverItems: (isOver: boolean) => void;
438
+ /** Habilitar FluidHoverIndicator (glassmorphism + spring physics) */
439
+ enableFluidIndicator: boolean;
440
+ /** Habilitar tooltip en hover (muestra label o subcategorías) */
441
+ enableTooltip: boolean;
442
+ /** Elemento del item actualmente hovered/focused (para FluidIndicator) */
443
+ currentItemElement: HTMLElement | null;
444
+ /** Función para actualizar el currentItemElement */
445
+ setCurrentItemElement: (element: HTMLElement | null) => void;
446
+ /** Configuración experimental de Liquid Glass V2 */
447
+ liquidGlass: SidebarLiquidGlassConfig;
448
+ }
449
+ /**
450
+ * Props del componente Sidebar (root container)
451
+ * @interface
452
+ */
453
+ interface SidebarProps {
454
+ /** Contenido del sidebar (puede ser ReactNode o render prop) */
455
+ children: ReactNode | SidebarRenderProp;
456
+ /** Clase CSS adicional para el wrapper */
457
+ className?: string;
458
+ /** Estilos inline para el wrapper */
459
+ style?: CSSProperties;
460
+ /** Estado inicial abierto (modo uncontrolled) */
461
+ defaultOpen?: boolean;
462
+ /** Estado abierto (modo controlled) */
463
+ open?: boolean;
464
+ /** Callback cuando cambia el estado open */
465
+ onOpenChange?: (open: boolean) => void;
466
+ /** Modo de colapso del sidebar */
467
+ collapseMode?: SidebarCollapseMode;
468
+ /** Comportamiento en modo hide */
469
+ hideBehaviour?: SidebarHideBehaviour;
470
+ /** Comportamiento al abrir desde hide */
471
+ hideOpensBehavior?: SidebarHideOpensBehavior;
472
+ /** Comportamiento de layout del sidebar */
473
+ layoutBehaviour?: SidebarLayoutBehaviour;
474
+ /** Configuración de dimensiones (partial override) */
475
+ dimensions?: Partial<SidebarDimensions>;
476
+ /** Configuración de áreas seguras (partial override) */
477
+ safeAreas?: Partial<SidebarSafeAreas>;
478
+ /** Configuración de animaciones (partial override) */
479
+ animations?: Partial<SidebarAnimations>;
480
+ /** ID personalizado para el toggle input */
481
+ toggleId?: string;
482
+ /** Modo debug (muestra bordes y labels) */
483
+ debug?: boolean;
484
+ /** Habilitar FluidHoverIndicator (glassmorphism + spring physics) */
485
+ enableFluidIndicator?: boolean;
486
+ /** Habilitar tooltip en hover (muestra label o subcategorías) */
487
+ enableTooltip?: boolean;
488
+ /**
489
+ * Configuración experimental de Liquid Glass V2 (partial override)
490
+ *
491
+ * @description
492
+ * Permite activar/desactivar features experimentales de liquid glass mediante flags:
493
+ *
494
+ * @example
495
+ * ```tsx
496
+ * <Sidebar
497
+ * liquidGlass={{
498
+ * enableLiquidGlassV2: true,
499
+ * enableChromaticAberration: true,
500
+ * enableEdgeGlass3D: true,
501
+ * enableBackdropExtension: true
502
+ * }}
503
+ * >
504
+ * ...
505
+ * </Sidebar>
506
+ * ```
507
+ *
508
+ * @experimental
509
+ */
510
+ liquidGlass?: Partial<SidebarLiquidGlassConfig>;
511
+ /** Elemento o componente a renderizar */
512
+ as?: ElementType;
513
+ }
514
+ /**
515
+ * Props del componente SidebarNav
516
+ * @interface
517
+ */
518
+ interface SidebarNavProps {
519
+ /** Contenido del nav */
520
+ children: ReactNode;
521
+ /** Clase CSS adicional */
522
+ className?: string;
523
+ /** Estilos inline */
524
+ style?: CSSProperties;
525
+ /** Label ARIA para el nav */
526
+ "aria-label"?: string;
527
+ /** Elemento o componente a renderizar */
528
+ as?: ElementType;
529
+ }
530
+ /**
531
+ * Props del componente SidebarToggle
532
+ * @interface
533
+ */
534
+ interface SidebarToggleProps {
535
+ /** Contenido del botón (puede ser ReactNode o render prop) */
536
+ children?: ReactNode | SidebarToggleRenderProp;
537
+ /** Librería de iconos a utilizar (Lucide o custom) */
538
+ iconLibrary?: SidebarIconLibrary;
539
+ /** Clase CSS adicional */
540
+ className?: string;
541
+ /** Estilos inline */
542
+ style?: CSSProperties;
543
+ /** Label ARIA para el botón */
544
+ "aria-label"?: string;
545
+ /** Elemento o componente a renderizar */
546
+ as?: ElementType;
547
+ }
548
+ /**
549
+ * Props del componente SidebarContent
550
+ * @interface
551
+ */
552
+ interface SidebarContentProps {
553
+ /** Contenido (items del sidebar) */
554
+ children: ReactNode;
555
+ /** Clase CSS adicional */
556
+ className?: string;
557
+ /** Estilos inline */
558
+ style?: CSSProperties;
559
+ /** Elemento o componente a renderizar */
560
+ as?: ElementType;
561
+ }
562
+ /**
563
+ * Props del componente SidebarIndicator
564
+ * @interface
565
+ */
566
+ interface SidebarIndicatorProps {
567
+ /** Contenido personalizado del indicador (opcional) */
568
+ children?: ReactNode | SidebarIndicatorRenderProp;
569
+ /** Clase CSS adicional */
570
+ className?: string;
571
+ /** Estilos inline */
572
+ style?: CSSProperties;
573
+ /** Elemento o componente a renderizar */
574
+ as?: ElementType;
575
+ }
576
+ /**
577
+ * Props del componente SidebarSafeArea
578
+ * @interface
579
+ */
580
+ interface SidebarSafeAreaProps {
581
+ /** Contenido del área segura */
582
+ children?: ReactNode;
583
+ /** Posición del área segura (top o bottom) */
584
+ position: SidebarSafeAreaPosition;
585
+ /** Porcentaje de altura del sidebar (override del config) */
586
+ percent?: number;
587
+ /** Clase CSS adicional */
588
+ className?: string;
589
+ /** Estilos inline */
590
+ style?: CSSProperties;
591
+ /** Elemento o componente a renderizar */
592
+ as?: ElementType;
593
+ }
594
+ /**
595
+ * Props del componente SidebarItem
596
+ * @interface
597
+ */
598
+ interface SidebarItemProps {
599
+ /** URL de destino */
600
+ href?: string;
601
+ /** Icono del item */
602
+ icon?: ReactNode;
603
+ /** Label/texto del item */
604
+ label?: string;
605
+ /** Contenido del item (puede ser ReactNode o render prop) */
606
+ children?: ReactNode | SidebarItemRenderProp;
607
+ /** Componente Link personalizado (ej: React Router Link, Next Link) */
608
+ LinkComponent?: ComponentType<any>;
609
+ /** Props adicionales para el LinkComponent */
610
+ linkProps?: Record<string, any>;
611
+ /** Clase CSS adicional */
612
+ className?: string;
613
+ /** Estilos inline */
614
+ style?: CSSProperties;
615
+ /** Callback al hacer hover */
616
+ onHover?: () => void;
617
+ /** Callback al hacer click */
618
+ onClick?: () => void;
619
+ /** Item deshabilitado */
620
+ disabled?: boolean;
621
+ /** Elemento o componente a renderizar */
622
+ as?: ElementType;
623
+ }
624
+ /**
625
+ * Configuración completa del sidebar (sin partials)
626
+ */
627
+ interface SidebarConfig {
628
+ defaultOpen: boolean;
629
+ collapseMode: SidebarCollapseMode;
630
+ hideBehaviour: SidebarHideBehaviour;
631
+ hideOpensBehavior: SidebarHideOpensBehavior;
632
+ layoutBehaviour: SidebarLayoutBehaviour;
633
+ dimensions: SidebarDimensions;
634
+ safeAreas: SidebarSafeAreas;
635
+ animations: SidebarAnimations;
636
+ toggleId: string;
637
+ debug: boolean;
638
+ liquidGlass: SidebarLiquidGlassConfig;
639
+ }
640
+
641
+ /**
642
+ * Componente raíz del Sidebar con arquitectura headless
643
+ *
644
+ * @description
645
+ * Componente principal que provee el contexto compartido a todos los
646
+ * componentes primitivos del sidebar (SidebarNav, SidebarToggle, etc.).
647
+ *
648
+ * Este componente NO renderiza ningún elemento visual por sí mismo,
649
+ * solo provee el Provider de contexto. Los estilos y estructura visual
650
+ * se definen componiendo los primitivos hijos.
651
+ *
652
+ * Soporta dos modos:
653
+ * - **Uncontrolled**: Usa `defaultOpen` para estado interno
654
+ * - **Controlled**: Usa `open` + `onOpenChange` para control externo
655
+ *
656
+ * También soporta render props para acceder al estado del sidebar:
657
+ *
658
+ * @example
659
+ * ```tsx
660
+ * // Uso básico (children estáticos)
661
+ * <Sidebar defaultOpen={true} collapseMode="collapse">
662
+ * <SidebarNav>
663
+ * <SidebarToggle />
664
+ * <SidebarContent>
665
+ * <SidebarItem href="/" icon={<HomeIcon />} />
666
+ * </SidebarContent>
667
+ * </SidebarNav>
668
+ * </Sidebar>
669
+ * ```
670
+ *
671
+ * @example
672
+ * ```tsx
673
+ * // Con render props (acceso al estado)
674
+ * <Sidebar>
675
+ * {({ open, collapsed }) => (
676
+ * <>
677
+ * <SidebarNav className={cn(!open && 'hidden')}>
678
+ * <SidebarContent>
679
+ * <SidebarItem label={open ? "Home" : undefined} />
680
+ * </SidebarContent>
681
+ * </SidebarNav>
682
+ * <div>Sidebar is {open ? 'open' : 'closed'}</div>
683
+ * </>
684
+ * )}
685
+ * </Sidebar>
686
+ * ```
687
+ *
688
+ * @example
689
+ * ```tsx
690
+ * // Modo controlled
691
+ * function App() {
692
+ * const [open, setOpen] = useState(true)
693
+ *
694
+ * return (
695
+ * <Sidebar open={open} onOpenChange={setOpen}>
696
+ * <SidebarNav>...</SidebarNav>
697
+ * </Sidebar>
698
+ * )
699
+ * }
700
+ * ```
701
+ *
702
+ * @example
703
+ * ```tsx
704
+ * // Con configuración custom
705
+ * <Sidebar
706
+ * collapseMode="hide"
707
+ * dimensions={{ expandedWidth: "20rem" }}
708
+ * animations={{ widthTransitionDuration: 500 }}
709
+ * >
710
+ * <SidebarNav>...</SidebarNav>
711
+ * </Sidebar>
712
+ * ```
713
+ *
714
+ * @note
715
+ * Los colores se obtienen automáticamente de los tokens CSS de shadcn definidos
716
+ * en globals.css (--sidebar, --sidebar-accent, --sidebar-primary, etc.)
717
+ */
718
+ declare function Sidebar({ children, className, style, defaultOpen, open, onOpenChange, collapseMode, hideBehaviour, hideOpensBehavior, layoutBehaviour, dimensions, animations, toggleId, debug, enableFluidIndicator, enableTooltip, liquidGlass, as, }: SidebarProps): react_jsx_runtime.JSX.Element;
719
+
720
+ /**
721
+ * Componente de navegación del Sidebar
722
+ *
723
+ * @description
724
+ * Contenedor de navegación que renderiza un elemento `<nav>` por defecto.
725
+ * Gestiona los eventos de mouse y teclado para el indicador visual y
726
+ * la navegación accesible.
727
+ *
728
+ * Este componente:
729
+ * - Aplica data attributes para reflejar el estado (open/collapsed)
730
+ * - Gestiona eventos de mouse para el indicador visual
731
+ * - Gestiona navegación por teclado (arrows, home, end)
732
+ * - Expone una ref al elemento DOM para mediciones
733
+ *
734
+ * Usa forwardRef para permitir acceso al elemento DOM desde componentes padre.
735
+ *
736
+ * @example
737
+ * ```tsx
738
+ * <Sidebar>
739
+ * <SidebarNav className="bg-zinc-900 border-zinc-800">
740
+ * <SidebarToggle />
741
+ * <SidebarIndicator />
742
+ * <SidebarContent>
743
+ * <SidebarItem href="/" />
744
+ * </SidebarContent>
745
+ * </SidebarNav>
746
+ * </Sidebar>
747
+ * ```
748
+ *
749
+ * @example
750
+ * ```tsx
751
+ * // Con data attributes para styling
752
+ * <SidebarNav className="data-[open=true]:w-64 data-[open=false]:w-16">
753
+ * {children}
754
+ * </SidebarNav>
755
+ * ```
756
+ *
757
+ * @example
758
+ * ```tsx
759
+ * // Con elemento personalizado
760
+ * <SidebarNav as="aside" aria-label="Navegación lateral">
761
+ * {children}
762
+ * </SidebarNav>
763
+ * ```
764
+ */
765
+ declare const SidebarNav: react.ForwardRefExoticComponent<SidebarNavProps & react.RefAttributes<HTMLElement>>;
766
+
767
+ /**
768
+ * Componente de botón toggle del Sidebar
769
+ *
770
+ * @description
771
+ * Botón que controla el estado abierto/cerrado del sidebar.
772
+ * Renderiza un `<label>` por defecto que controla un checkbox oculto,
773
+ * permitiendo gestionar el estado con CSS puro (:checked selector).
774
+ *
775
+ * Características:
776
+ * - Soporta render props para acceso al estado (open, active)
777
+ * - Renderiza icono de chevron por defecto (customizable)
778
+ * - Aplica data attributes para styling CSS
779
+ * - Accesibilidad completa (aria-label, aria-expanded)
780
+ * - Soporta prop `as` para usar elemento/componente custom
781
+ *
782
+ * @example
783
+ * ```tsx
784
+ * // Uso básico con icono por defecto
785
+ * <SidebarToggle />
786
+ * ```
787
+ *
788
+ * @example
789
+ * ```tsx
790
+ * // Con render props para estado
791
+ * <SidebarToggle>
792
+ * {({ open, active }) => (
793
+ * <div className={cn(active && 'bg-blue-500')}>
794
+ * {open ? <CloseIcon /> : <MenuIcon />}
795
+ * </div>
796
+ * )}
797
+ * </SidebarToggle>
798
+ * ```
799
+ *
800
+ * @example
801
+ * ```tsx
802
+ * // Con icono custom
803
+ * <SidebarToggle className="bg-zinc-800">
804
+ * <CustomChevronIcon />
805
+ * </SidebarToggle>
806
+ * ```
807
+ *
808
+ * @example
809
+ * ```tsx
810
+ * // Como botón real (sin checkbox)
811
+ * <SidebarToggle as="button" onClick={() => setOpen(!open)}>
812
+ * Toggle
813
+ * </SidebarToggle>
814
+ * ```
815
+ */
816
+ declare const SidebarToggle: react.ForwardRefExoticComponent<SidebarToggleProps & react.RefAttributes<HTMLButtonElement | HTMLLabelElement>>;
817
+
818
+ /**
819
+ * Componente de contenido del Sidebar (contenedor de items)
820
+ *
821
+ * @description
822
+ * Contenedor que agrupa los items de navegación (SidebarItem).
823
+ * Renderiza un `<div>` por defecto y aplica estilos de layout flex.
824
+ *
825
+ * Este componente:
826
+ * - Registra su ref en el contexto para cálculos del indicador
827
+ * - Aplica rol ARIA "list" para accesibilidad
828
+ * - Centra y distribuye items verticalmente
829
+ * - Permite customización completa con className y style
830
+ *
831
+ * Los items dentro de este contenedor son utilizados por:
832
+ * - useSidebarIndicator: Para calcular posición del indicador
833
+ * - useSidebarKeyboard: Para navegación por teclado
834
+ *
835
+ * @example
836
+ * ```tsx
837
+ * <SidebarNav>
838
+ * <SidebarContent>
839
+ * <SidebarItem href="/" icon={<HomeIcon />} />
840
+ * <SidebarItem href="/settings" icon={<SettingsIcon />} />
841
+ * </SidebarContent>
842
+ * </SidebarNav>
843
+ * ```
844
+ *
845
+ * @example
846
+ * ```tsx
847
+ * // Con estilos custom
848
+ * <SidebarContent className="gap-2 py-4">
849
+ * <SidebarItem href="/" />
850
+ * </SidebarContent>
851
+ * ```
852
+ *
853
+ * @example
854
+ * ```tsx
855
+ * // Como lista semántica
856
+ * <SidebarContent as="ul">
857
+ * <SidebarItem as="li" href="/" />
858
+ * </SidebarContent>
859
+ * ```
860
+ */
861
+ declare const SidebarContent: react.ForwardRefExoticComponent<SidebarContentProps & react.RefAttributes<HTMLDivElement>>;
862
+
863
+ /**
864
+ * Componente de indicador visual del Sidebar
865
+ *
866
+ * @description
867
+ * Indicador visual que sigue al cursor del mouse (o item enfocado) dentro
868
+ * del área de navegación. Proporciona feedback visual claro al usuario.
869
+ *
870
+ * Características:
871
+ * - Se muestra solo cuando el mouse está sobre el área de items
872
+ * - Sigue al cursor con animación suave
873
+ * - Se posiciona en el item enfocado al navegar por teclado
874
+ * - Totalmente customizable con className y style
875
+ * - Soporta render props para control total del contenido
876
+ * - Color y dimensiones configurables via contexto
877
+ *
878
+ * El indicador se oculta automáticamente cuando:
879
+ * - El mouse sale del sidebar
880
+ * - El cursor está fuera del área de items
881
+ * - Se pierde el focus del sidebar
882
+ *
883
+ * @example
884
+ * ```tsx
885
+ * // Uso básico con estilos por defecto
886
+ * <SidebarNav>
887
+ * <SidebarIndicator />
888
+ * <SidebarContent>...</SidebarContent>
889
+ * </SidebarNav>
890
+ * ```
891
+ *
892
+ * @example
893
+ * ```tsx
894
+ * // Con estilos custom
895
+ * <SidebarIndicator className="bg-red-500 w-1" />
896
+ * ```
897
+ *
898
+ * @example
899
+ * ```tsx
900
+ * // Con render props
901
+ * <SidebarIndicator>
902
+ * {({ visible, position }) => (
903
+ * <div
904
+ * className={cn('indicator', visible && 'opacity-100')}
905
+ * style={{ top: position }}
906
+ * >
907
+ * <span>→</span>
908
+ * </div>
909
+ * )}
910
+ * </SidebarIndicator>
911
+ * ```
912
+ *
913
+ * @example
914
+ * ```tsx
915
+ * // Como elemento custom
916
+ * <SidebarIndicator as={motion.div} animate={{ opacity: 1 }} />
917
+ * ```
918
+ */
919
+ declare const SidebarIndicator: react.ForwardRefExoticComponent<SidebarIndicatorProps & react.RefAttributes<HTMLDivElement>>;
920
+
921
+ /**
922
+ * Props del SidebarFluidIndicator
923
+ * @interface
924
+ */
925
+ interface SidebarFluidIndicatorProps {
926
+ /** Elemento del item actualmente hovered/focused */
927
+ targetElement: HTMLElement | null;
928
+ /** Indica si el indicador está visible */
929
+ isVisible: boolean;
930
+ }
931
+ /**
932
+ * Componente wrapper de FluidHoverIndicator para Sidebar
933
+ *
934
+ * @description
935
+ * Wrapper que conecta el FluidHoverIndicator (glassmorphism + spring physics)
936
+ * con el sistema de estado del Sidebar. Este componente decide automáticamente
937
+ * qué versión renderizar basándose en las feature flags:
938
+ *
939
+ * - **V1 (default)**: FluidHoverIndicator con backdrop-blur CSS básico
940
+ * - **V2 (experimental)**: FluidHoverIndicatorV2 con SVG displacement mapping
941
+ *
942
+ * Feature flags del contexto:
943
+ * - `liquidGlass.enableLiquidGlassV2`: Activa la versión V2
944
+ * - `liquidGlass.enableChromaticAberration`: Activa chromatic aberration (Phase 2)
945
+ *
946
+ * @example
947
+ * ```tsx
948
+ * <SidebarNav>
949
+ * <SidebarIndicator />
950
+ * <SidebarFluidIndicator targetElement={currentItemElement} isVisible={isVisible} />
951
+ * <SidebarContent>...</SidebarContent>
952
+ * </SidebarNav>
953
+ * ```
954
+ */
955
+ declare function SidebarFluidIndicator({ targetElement, isVisible }: SidebarFluidIndicatorProps): react_jsx_runtime.JSX.Element;
956
+
957
+ /**
958
+ * Componente de área segura del Sidebar
959
+ *
960
+ * @description
961
+ * Área reservada en la parte superior o inferior del sidebar para
962
+ * contenido especial como logos, usuario, configuración, etc.
963
+ *
964
+ * Las áreas seguras:
965
+ * - No contienen items de navegación
966
+ * - Tienen altura porcentual configurable
967
+ * - Pueden mostrar patrones de debug
968
+ * - Son completamente customizables
969
+ *
970
+ * Casos de uso comunes:
971
+ * - Top: Logo, título de la aplicación, búsqueda
972
+ * - Bottom: Usuario, configuración, logout
973
+ *
974
+ * @example
975
+ * ```tsx
976
+ * <SidebarNav>
977
+ * <SidebarSafeArea position="top" percent={20}>
978
+ * <img src="/logo.png" alt="Logo" />
979
+ * </SidebarSafeArea>
980
+ *
981
+ * <SidebarContent>
982
+ * <SidebarItem href="/" />
983
+ * </SidebarContent>
984
+ *
985
+ * <SidebarSafeArea position="bottom" percent={15}>
986
+ * <UserProfile />
987
+ * </SidebarSafeArea>
988
+ * </SidebarNav>
989
+ * ```
990
+ *
991
+ * @example
992
+ * ```tsx
993
+ * // Con estilos custom
994
+ * <SidebarSafeArea
995
+ * position="top"
996
+ * className="bg-zinc-950 border-b border-zinc-800"
997
+ * >
998
+ * <h1>Mi App</h1>
999
+ * </SidebarSafeArea>
1000
+ * ```
1001
+ *
1002
+ * @example
1003
+ * ```tsx
1004
+ * // Override de porcentaje
1005
+ * <SidebarSafeArea position="bottom" percent={30}>
1006
+ * <ExtendedFooter />
1007
+ * </SidebarSafeArea>
1008
+ * ```
1009
+ */
1010
+ declare const SidebarSafeArea: react.ForwardRefExoticComponent<SidebarSafeAreaProps & react.RefAttributes<HTMLDivElement>>;
1011
+
1012
+ /**
1013
+ * Componente item de navegación del Sidebar
1014
+ *
1015
+ * @description
1016
+ * Item individual de navegación dentro del sidebar.
1017
+ * Renderiza un `<a>` por defecto, pero puede ser cualquier elemento
1018
+ * o componente (ej: React Router Link, Next.js Link).
1019
+ *
1020
+ * Características:
1021
+ * - Soporta iconos y labels
1022
+ * - Gestiona estados de hover y focus
1023
+ * - Se registra automáticamente para navegación por teclado
1024
+ * - Aplica data attributes para styling
1025
+ * - Soporta render props para control total
1026
+ * - Compatible con React Router, Next.js, etc. via prop `as`
1027
+ * - Label oculto automáticamente cuando sidebar está colapsado (via CSS container queries)
1028
+ *
1029
+ * @example
1030
+ * ```tsx
1031
+ * // Uso básico
1032
+ * <SidebarItem
1033
+ * href="/"
1034
+ * icon={<HomeIcon />}
1035
+ * label="Home"
1036
+ * />
1037
+ * ```
1038
+ *
1039
+ * @example
1040
+ * ```tsx
1041
+ * // Con React Router
1042
+ * <SidebarItem
1043
+ * as={Link}
1044
+ * to="/dashboard"
1045
+ * icon={<DashboardIcon />}
1046
+ * label="Dashboard"
1047
+ * />
1048
+ * ```
1049
+ *
1050
+ * @example
1051
+ * ```tsx
1052
+ * // Con Next.js Link
1053
+ * <SidebarItem
1054
+ * LinkComponent={Link}
1055
+ * href="/profile"
1056
+ * icon={<UserIcon />}
1057
+ * label="Profile"
1058
+ * />
1059
+ * ```
1060
+ *
1061
+ * @example
1062
+ * ```tsx
1063
+ * // Con render props
1064
+ * <SidebarItem href="/settings">
1065
+ * {({ focused, hovered, disabled }) => (
1066
+ * <div className={cn(
1067
+ * 'flex items-center gap-2',
1068
+ * focused && 'ring-2',
1069
+ * hovered && 'bg-zinc-800',
1070
+ * disabled && 'opacity-50'
1071
+ * )}>
1072
+ * <SettingsIcon />
1073
+ * <span>Settings</span>
1074
+ * </div>
1075
+ * )}
1076
+ * </SidebarItem>
1077
+ * ```
1078
+ *
1079
+ * @example
1080
+ * ```tsx
1081
+ * // Con callbacks
1082
+ * <SidebarItem
1083
+ * href="/analytics"
1084
+ * icon={<ChartIcon />}
1085
+ * label="Analytics"
1086
+ * onHover={() => prefetchAnalytics()}
1087
+ * onClick={() => trackNavigation('analytics')}
1088
+ * />
1089
+ * ```
1090
+ */
1091
+ declare const SidebarItem: react.ForwardRefExoticComponent<SidebarItemProps & react.RefAttributes<HTMLAnchorElement>>;
1092
+
1093
+ interface SidebarSubContentProps {
1094
+ children: ReactNode;
1095
+ title?: string;
1096
+ }
1097
+ declare function SidebarSubContent({ children, title }: SidebarSubContentProps): null;
1098
+ declare namespace SidebarSubContent {
1099
+ var displayName: string;
1100
+ }
1101
+
1102
+ interface SidebarSubLinkProps {
1103
+ href: string;
1104
+ children: ReactNode;
1105
+ icon?: ReactNode;
1106
+ LinkComponent?: ComponentType<any>;
1107
+ linkProps?: Record<string, any>;
1108
+ className?: string;
1109
+ onClick?: (e: MouseEvent<HTMLAnchorElement>) => void;
1110
+ animationOrder?: number;
1111
+ animationState?: 'entering' | 'leaving' | 'static';
1112
+ style?: CSSProperties;
1113
+ }
1114
+ declare function SidebarSubLink({ href, children, icon, LinkComponent, linkProps, className, onClick, animationOrder, animationState, style, }: SidebarSubLinkProps): react_jsx_runtime.JSX.Element;
1115
+ declare namespace SidebarSubLink {
1116
+ var displayName: string;
1117
+ }
1118
+
1119
+ interface SidebarTooltipProps {
1120
+ /** Contenido del tooltip */
1121
+ children: ReactNode;
1122
+ /** Título opcional del tooltip */
1123
+ title?: string;
1124
+ /** Modo debug para visualizar safety triangle y layers */
1125
+ debug?: boolean;
1126
+ /** Handler llamado cuando el mouse sale del tooltip */
1127
+ onMouseLeave?: () => void;
1128
+ /** Habilitar liquid glass con SVG displacement filters (false = backdrop-blur básico) */
1129
+ enableLiquidGlass?: boolean;
1130
+ /** Habilitar Edge Glass 3D (dual backdrop layers para profundidad) */
1131
+ enableEdgeGlass3D?: boolean;
1132
+ /** Habilitar Backdrop Extension (Josh Comeau technique - 200% height) */
1133
+ enableBackdropExtension?: boolean;
1134
+ /** Habilitar chromatic aberration RGB (requiere enableLiquidGlass) */
1135
+ enableChromaticAberration?: boolean;
1136
+ /** Habilitar animaciones staggered de items (entrada/salida escalonada) */
1137
+ enableTooltipItemAnimations?: boolean;
1138
+ /** Habilitar animación 3D de cilindro para el título del tooltip */
1139
+ enableCylinderTitle?: boolean;
1140
+ }
1141
+ declare const SidebarTooltip: react.NamedExoticComponent<SidebarTooltipProps>;
1142
+
1143
+ /**
1144
+ * Hook para acceder al contexto del Sidebar
1145
+ *
1146
+ * @description
1147
+ * Hook personalizado que provee acceso al contexto compartido del Sidebar.
1148
+ * Debe ser utilizado dentro de un componente que esté envuelto por
1149
+ * `<Sidebar>` o `<SidebarProvider>`.
1150
+ *
1151
+ * Lanza un error si se utiliza fuera del contexto apropiado, ayudando
1152
+ * a detectar problemas de composición durante el desarrollo.
1153
+ *
1154
+ * @throws {Error} Si se usa fuera de un SidebarProvider
1155
+ *
1156
+ * @returns {SidebarContextValue} El valor del contexto del sidebar
1157
+ *
1158
+ * @example
1159
+ * ```tsx
1160
+ * function CustomToggle() {
1161
+ * const { open, setOpen } = useSidebarContext()
1162
+ *
1163
+ * return (
1164
+ * <button onClick={() => setOpen(!open)}>
1165
+ * {open ? 'Cerrar' : 'Abrir'}
1166
+ * </button>
1167
+ * )
1168
+ * }
1169
+ * ```
1170
+ *
1171
+ * @example
1172
+ * ```tsx
1173
+ * // Acceder a configuración
1174
+ * function CustomItem() {
1175
+ * const { colors, dimensions } = useSidebarContext()
1176
+ *
1177
+ * return (
1178
+ * <div style={{
1179
+ * background: colors.hover,
1180
+ * width: dimensions.expandedWidth
1181
+ * }}>
1182
+ * Item
1183
+ * </div>
1184
+ * )
1185
+ * }
1186
+ * ```
1187
+ */
1188
+ declare function useSidebarContext(): SidebarContextValue;
1189
+
1190
+ /**
1191
+ * Valor de retorno del hook useSidebarKeyboard
1192
+ * @interface
1193
+ */
1194
+ interface UseSidebarKeyboardReturn {
1195
+ /** Índice del item actualmente enfocado (-1 si ninguno) */
1196
+ focusedIndex: number;
1197
+ /** Función para cambiar el índice enfocado manualmente */
1198
+ setFocusedIndex: (index: number) => void;
1199
+ /** Callback para actualizar el indicador según el item enfocado */
1200
+ updateIndicatorForFocus: (index: number) => void;
1201
+ }
1202
+ /**
1203
+ * Hook para gestionar la navegación por teclado en el Sidebar
1204
+ *
1205
+ * @description
1206
+ * Hook que implementa navegación accesible por teclado para los items
1207
+ * del sidebar, siguiendo las especificaciones WAI-ARIA:
1208
+ *
1209
+ * - ArrowDown: Navegar al siguiente item
1210
+ * - ArrowUp: Navegar al item anterior
1211
+ * - Home: Ir al primer item
1212
+ * - End: Ir al último item
1213
+ * - Tab: Navegación estándar que actualiza el indicador
1214
+ *
1215
+ * También sincroniza el indicador visual con el item enfocado.
1216
+ *
1217
+ * @returns {UseSidebarKeyboardReturn} Estado y funciones para navegación
1218
+ *
1219
+ * @example
1220
+ * ```tsx
1221
+ * function SidebarNav() {
1222
+ * const { focusedIndex, updateIndicatorForFocus } = useSidebarKeyboard()
1223
+ *
1224
+ * return (
1225
+ * <nav>
1226
+ * {items.map((item, index) => (
1227
+ * <SidebarItem
1228
+ * key={item.id}
1229
+ * focused={index === focusedIndex}
1230
+ * onFocus={() => updateIndicatorForFocus(index)}
1231
+ * />
1232
+ * ))}
1233
+ * </nav>
1234
+ * )
1235
+ * }
1236
+ * ```
1237
+ */
1238
+ declare function useSidebarKeyboard(): UseSidebarKeyboardReturn;
1239
+
1240
+ /**
1241
+ * Valor de retorno del hook useSidebarIndicator
1242
+ * @interface
1243
+ */
1244
+ interface UseSidebarIndicatorReturn {
1245
+ /** Indica si el indicador está visible */
1246
+ isVisible: boolean;
1247
+ /** Indica si el mouse está sobre el área de items */
1248
+ isOverItems: boolean;
1249
+ /** Elemento del item actualmente hovered o enfocado (para FluidHoverIndicator) */
1250
+ currentItemElement: HTMLElement | null;
1251
+ /** ID del item bajo el indicador (para tooltip con subContent) */
1252
+ hoveredItemId: string | null;
1253
+ /** Label del item hovered (para tooltip simple) */
1254
+ hoveredLabel: string | null;
1255
+ /** Manejador de evento mousemove */
1256
+ handleMouseMove: (e: MouseEvent<HTMLDivElement>) => void;
1257
+ /** Manejador de evento mouseenter */
1258
+ handleMouseEnter: () => void;
1259
+ /** Manejador de evento mouseleave */
1260
+ handleMouseLeave: () => void;
1261
+ /** Manejador de evento focus */
1262
+ handleFocus: () => void;
1263
+ /** Manejador de evento blur */
1264
+ handleBlur: (e: React.FocusEvent) => void;
1265
+ /** Función para limpiar el estado hovered desde fuera (tooltip mouseleave) */
1266
+ clearHoveredState: () => void;
1267
+ }
1268
+ /**
1269
+ * Hook para gestionar el indicador visual del Sidebar
1270
+ *
1271
+ * @description
1272
+ * Hook que implementa la lógica del indicador visual que sigue al cursor
1273
+ * del mouse dentro del sidebar. El indicador se muestra cuando:
1274
+ * - El mouse está sobre el sidebar (isHovering = true)
1275
+ * - El cursor está en el área de items (isOverItems = true)
1276
+ *
1277
+ * Utiliza requestAnimationFrame para optimizar el rendimiento y evitar
1278
+ * cálculos excesivos durante el movimiento del mouse.
1279
+ *
1280
+ * El indicador también se actualiza cuando se navega por teclado,
1281
+ * integrándose con useSidebarKeyboard.
1282
+ *
1283
+ * @returns {UseSidebarIndicatorReturn} Estado y manejadores de eventos
1284
+ *
1285
+ * @example
1286
+ * ```tsx
1287
+ * function SidebarNav() {
1288
+ * const {
1289
+ * isVisible,
1290
+ * handleMouseMove,
1291
+ * handleMouseEnter,
1292
+ * handleMouseLeave
1293
+ * } = useSidebarIndicator()
1294
+ *
1295
+ * return (
1296
+ * <nav
1297
+ * onMouseMove={handleMouseMove}
1298
+ * onMouseEnter={handleMouseEnter}
1299
+ * onMouseLeave={handleMouseLeave}
1300
+ * >
1301
+ * <SidebarIndicator visible={isVisible} />
1302
+ * {children}
1303
+ * </nav>
1304
+ * )
1305
+ * }
1306
+ * ```
1307
+ */
1308
+ declare function useSidebarIndicator(): UseSidebarIndicatorReturn;
1309
+
1310
+ interface SubContentData {
1311
+ itemId: string;
1312
+ subContent: ReactNode;
1313
+ title?: string;
1314
+ }
1315
+
1316
+ declare function useSubContent(): {
1317
+ subContentMap: Map<string, SubContentData>;
1318
+ registerSubContent: (itemId: string, data: SubContentData) => void;
1319
+ unregisterSubContent: (itemId: string) => void;
1320
+ getSubContent: (itemId: string) => SubContentData | undefined;
1321
+ };
1322
+
1323
+ /**
1324
+ * Dimensiones por defecto del sidebar
1325
+ * @constant
1326
+ */
1327
+ declare const DEFAULT_DIMENSIONS: SidebarDimensions;
1328
+ /**
1329
+ * Áreas seguras por defecto
1330
+ * @constant
1331
+ */
1332
+ declare const DEFAULT_SAFE_AREAS: SidebarSafeAreas;
1333
+ /**
1334
+ * Animaciones por defecto
1335
+ * @constant
1336
+ */
1337
+ declare const DEFAULT_ANIMATIONS: SidebarAnimations;
1338
+ /**
1339
+ * Configuración por defecto del sidebar
1340
+ * @constant
1341
+ *
1342
+ * @description
1343
+ * Los colores se obtienen automáticamente de los tokens CSS de shadcn:
1344
+ * - --sidebar: Color de fondo
1345
+ * - --sidebar-foreground: Color de texto
1346
+ * - --sidebar-primary: Color primario (indicador)
1347
+ * - --sidebar-accent: Color de hover
1348
+ * - --sidebar-border: Color de bordes
1349
+ */
1350
+ declare const DEFAULT_CONFIG: SidebarConfig;
1351
+ /**
1352
+ * Teclas de navegación del sidebar
1353
+ * @constant
1354
+ */
1355
+ declare const SIDEBAR_KEYBOARD_KEYS: {
1356
+ /** Flecha abajo - navegar al siguiente item */
1357
+ readonly ARROW_DOWN: "ArrowDown";
1358
+ /** Flecha arriba - navegar al item anterior */
1359
+ readonly ARROW_UP: "ArrowUp";
1360
+ /** Home - ir al primer item */
1361
+ readonly HOME: "Home";
1362
+ /** End - ir al último item */
1363
+ readonly END: "End";
1364
+ /** Tab - navegación estándar */
1365
+ readonly TAB: "Tab";
1366
+ /** Escape - cerrar sidebar o quitar focus */
1367
+ readonly ESCAPE: "Escape";
1368
+ };
1369
+ /**
1370
+ * Atributos data-* para styling CSS y selección de elementos
1371
+ * @constant
1372
+ */
1373
+ declare const SIDEBAR_DATA_ATTRIBUTES: {
1374
+ /** data-open - indica si el sidebar está abierto */
1375
+ readonly OPEN: "data-open";
1376
+ /** data-collapsed - indica si el sidebar está colapsado */
1377
+ readonly COLLAPSED: "data-collapsed";
1378
+ /** data-focused - indica si un elemento está enfocado */
1379
+ readonly FOCUSED: "data-focused";
1380
+ /** data-hovered - indica si el mouse está sobre un elemento */
1381
+ readonly HOVERED: "data-hovered";
1382
+ /** data-disabled - indica si un elemento está deshabilitado */
1383
+ readonly DISABLED: "data-disabled";
1384
+ /** data-sidebar-item - marca un item del sidebar para navegación */
1385
+ readonly ITEM: "data-sidebar-item";
1386
+ /** data-active - indica si un toggle/botón está activo */
1387
+ readonly ACTIVE: "data-active";
1388
+ /** data-visible - indica si un elemento es visible */
1389
+ readonly VISIBLE: "data-visible";
1390
+ };
1391
+ /**
1392
+ * Clases Tailwind reutilizables para componentes del sidebar
1393
+ * @constant
1394
+ */
1395
+ declare const SIDEBAR_TAILWIND_CLASSES: {
1396
+ /** Clases base para el wrapper */
1397
+ readonly wrapper: "relative";
1398
+ /** Clases base para el nav */
1399
+ readonly nav: "relative h-screen border-r";
1400
+ /** Clases base para el indicador */
1401
+ readonly indicator: "absolute left-0 rounded-r-full pointer-events-none";
1402
+ /** Clases base para el botón toggle */
1403
+ readonly toggleButton: "block w-6 h-6 rounded-full cursor-pointer flex items-center justify-center transition-colors";
1404
+ /** Clases para el wrapper del botón toggle */
1405
+ readonly toggleButtonWrapper: "absolute top-6 z-30";
1406
+ /** Clases base para el contenedor de items */
1407
+ readonly content: "flex flex-col items-center";
1408
+ /** Clases base para áreas seguras */
1409
+ readonly safeArea: "flex items-center justify-center";
1410
+ /** Clases de borde debug */
1411
+ readonly debugBorder: "border-dashed";
1412
+ /** Clases de focus ring (accesibilidad) */
1413
+ readonly focusRing: "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:ring-offset-2";
1414
+ /** Clases SR-only (screen reader only) */
1415
+ readonly srOnly: "sr-only";
1416
+ };
1417
+ /**
1418
+ * Patrones visuales para modo debug
1419
+ * @constant
1420
+ */
1421
+ declare const SIDEBAR_DEBUG_PATTERNS: {
1422
+ /** Patrón de rayas para áreas seguras */
1423
+ readonly safeArea: "repeating-linear-gradient(45deg, transparent, transparent 10px, rgba(255,255,255,0.03) 10px, rgba(255,255,255,0.03) 20px)";
1424
+ /** Fondo semi-transparente para área de contenido */
1425
+ readonly contentArea: "rgba(0, 0, 0, 0.5)";
1426
+ /** Color de borde para debug */
1427
+ readonly borderColor: "rgb(34 197 94)";
1428
+ /** Opacidad de borde debug */
1429
+ readonly borderOpacity: "0.3";
1430
+ };
1431
+ /**
1432
+ * Roles ARIA para accesibilidad
1433
+ * @constant
1434
+ */
1435
+ declare const SIDEBAR_ARIA_ROLES: {
1436
+ /** Rol para el nav principal */
1437
+ readonly navigation: "navigation";
1438
+ /** Rol para lista de items */
1439
+ readonly list: "list";
1440
+ /** Rol para item individual */
1441
+ readonly listitem: "listitem";
1442
+ /** Rol para botón toggle */
1443
+ readonly button: "button";
1444
+ };
1445
+ /**
1446
+ * Labels ARIA por defecto para accesibilidad
1447
+ * @constant
1448
+ */
1449
+ declare const SIDEBAR_ARIA_LABELS: {
1450
+ /** Label para toggle */
1451
+ readonly toggleSidebar: "Alternar sidebar";
1452
+ /** Label para navegación principal */
1453
+ readonly mainNavigation: "Navegación principal";
1454
+ /** Label cuando sidebar está abierto */
1455
+ readonly sidebarOpen: "Sidebar abierto";
1456
+ /** Label cuando sidebar está cerrado */
1457
+ readonly sidebarClosed: "Sidebar cerrado";
1458
+ };
1459
+ /**
1460
+ * Configuración de estilo visual por defecto del sidebar
1461
+ * @constant
1462
+ */
1463
+ declare const DEFAULT_VISUAL_STYLE: {
1464
+ readonly marginTop: "0";
1465
+ readonly marginBottom: "0";
1466
+ readonly marginLeft: "0";
1467
+ readonly marginRight: "0";
1468
+ readonly height: "100vh";
1469
+ readonly borderRadius: "0";
1470
+ readonly boxShadow: "none";
1471
+ };
1472
+ /**
1473
+ * Preconfiguraciones de estilo visual para el sidebar
1474
+ * @constant
1475
+ */
1476
+ declare const SIDEBAR_VISUAL_PRESETS: {
1477
+ /** Estilo por defecto: pegado a bordes */
1478
+ readonly DEFAULT: {
1479
+ readonly marginTop: "0";
1480
+ readonly marginBottom: "0";
1481
+ readonly marginLeft: "0";
1482
+ readonly marginRight: "0";
1483
+ readonly height: "100vh";
1484
+ readonly borderRadius: "0";
1485
+ readonly boxShadow: "none";
1486
+ };
1487
+ /** Estilo floating: separado y con sombra */
1488
+ readonly FLOATING_CARD: {
1489
+ readonly marginTop: "1rem";
1490
+ readonly marginBottom: "1rem";
1491
+ readonly marginLeft: "1rem";
1492
+ readonly marginRight: "0";
1493
+ readonly height: "calc(100vh - 2rem)";
1494
+ readonly borderRadius: "0.75rem";
1495
+ readonly boxShadow: "0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04)";
1496
+ };
1497
+ /** Estilo moderno: esquinas redondeadas suaves */
1498
+ readonly MODERN_ROUNDED: {
1499
+ readonly marginTop: "0.5rem";
1500
+ readonly marginBottom: "0.5rem";
1501
+ readonly marginLeft: "0.5rem";
1502
+ readonly marginRight: "0";
1503
+ readonly height: "calc(100vh - 1rem)";
1504
+ readonly borderRadius: "1rem";
1505
+ readonly boxShadow: "0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)";
1506
+ };
1507
+ /** Estilo minimal: ligera separación */
1508
+ readonly MINIMAL_SPACED: {
1509
+ readonly marginTop: "0.25rem";
1510
+ readonly marginBottom: "0.25rem";
1511
+ readonly marginLeft: "0.25rem";
1512
+ readonly marginRight: "0";
1513
+ readonly height: "calc(100vh - 0.5rem)";
1514
+ readonly borderRadius: "0.5rem";
1515
+ readonly boxShadow: "0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06)";
1516
+ };
1517
+ };
1518
+ /**
1519
+ * Tipo para los presets de estilo visual
1520
+ */
1521
+ type SidebarVisualPreset = keyof typeof SIDEBAR_VISUAL_PRESETS;
1522
+ /**
1523
+ * Breakpoints para responsive behavior
1524
+ * @constant
1525
+ */
1526
+ declare const SIDEBAR_BREAKPOINTS: {
1527
+ /** Ancho mínimo para mostrar sidebar expandido */
1528
+ readonly minExpandedWidth: 768;
1529
+ /** Ancho mínimo para sidebar colapsado */
1530
+ readonly minCollapsedWidth: 640;
1531
+ /** Ancho para forzar modo mobile */
1532
+ readonly mobileWidth: 480;
1533
+ };
1534
+ /**
1535
+ * Límites y valores seguros para validación
1536
+ * @constant
1537
+ */
1538
+ declare const SIDEBAR_LIMITS: {
1539
+ /** Porcentaje mínimo para safe area */
1540
+ readonly minSafeAreaPercent: 0;
1541
+ /** Porcentaje máximo para safe area */
1542
+ readonly maxSafeAreaPercent: 50;
1543
+ /** Número máximo de items recomendado */
1544
+ readonly maxRecommendedItems: 20;
1545
+ /** Duración mínima de transición (ms) */
1546
+ readonly minTransitionDuration: 0;
1547
+ /** Duración máxima de transición (ms) */
1548
+ readonly maxTransitionDuration: 1000;
1549
+ };
1550
+ /**
1551
+ * Nombres de CSS variables utilizadas
1552
+ * @constant
1553
+ */
1554
+ declare const SIDEBAR_CSS_VARIABLES: {
1555
+ /** Ancho cuando cerrado */
1556
+ readonly widthClosed: "--sidebar-width-closed";
1557
+ /** Ancho cuando abierto */
1558
+ readonly widthOpen: "--sidebar-width-open";
1559
+ /** Ancho actual */
1560
+ readonly width: "--sidebar-width";
1561
+ /** Color de fondo */
1562
+ readonly background: "--sidebar-bg";
1563
+ /** Color de borde (variable interna para evitar colisión con --sidebar-border de shadcn) */
1564
+ readonly borderColor: "--sidebar-border-color";
1565
+ /** Color de hover */
1566
+ readonly hover: "--sidebar-hover";
1567
+ /** Color del indicador */
1568
+ readonly indicator: "--sidebar-indicator";
1569
+ /** Altura del indicador */
1570
+ readonly indicatorHeight: "--sidebar-indicator-height";
1571
+ /** Distancia del tooltip al sidebar */
1572
+ readonly tooltipDistance: "--sidebar-tooltip-distance";
1573
+ /** Comportamiento de layout */
1574
+ readonly layoutBehaviour: "--sidebar-layout-behaviour";
1575
+ /** Flag para modo inline */
1576
+ readonly isInline: "--sidebar-is-inline";
1577
+ /** Variables de estilo visual */
1578
+ readonly marginTop: "--sidebar-margin-top";
1579
+ readonly marginBottom: "--sidebar-margin-bottom";
1580
+ readonly marginLeft: "--sidebar-margin-left";
1581
+ readonly marginRight: "--sidebar-margin-right";
1582
+ readonly sidebarHeight: "--sidebar-height";
1583
+ readonly sidebarBorderRadius: "--sidebar-border-radius";
1584
+ readonly sidebarBoxShadow: "--sidebar-box-shadow";
1585
+ };
1586
+
1587
+ /**
1588
+ * Configuración para el generador de estilos
1589
+ * @interface
1590
+ */
1591
+ interface StyleGeneratorConfig {
1592
+ dimensions: SidebarDimensions;
1593
+ animations: SidebarAnimations;
1594
+ collapseMode: SidebarCollapseMode;
1595
+ hideOpensBehavior: SidebarHideOpensBehavior;
1596
+ layoutBehaviour: SidebarLayoutBehaviour;
1597
+ visualStyle: SidebarVisualStyle;
1598
+ }
1599
+ /**
1600
+ * Genera los estilos CSS del sidebar usando CSS-in-JS y tokens de shadcn
1601
+ *
1602
+ * @description
1603
+ * Función que genera todo el CSS necesario para el sidebar,
1604
+ * utilizando los tokens CSS de shadcn definidos en globals.css:
1605
+ *
1606
+ * **Tokens utilizados:**
1607
+ * - `--sidebar`: Color de fondo
1608
+ * - `--sidebar-foreground`: Color de texto
1609
+ * - `--sidebar-primary`: Color primario (indicador, elementos activos)
1610
+ * - `--sidebar-accent`: Color de hover y estados secundarios
1611
+ * - `--sidebar-border`: Color de bordes
1612
+ * - `--sidebar-ring`: Color de focus ring (accesibilidad)
1613
+ *
1614
+ * Usa CSS Layers para organización y control de especificidad:
1615
+ * - sidebar-base: Variables y estilos base
1616
+ * - sidebar-states: Estados (:checked, :hover, etc.)
1617
+ * - sidebar-animations: Transiciones y animaciones
1618
+ *
1619
+ * @param {StyleGeneratorConfig} config - Configuración de dimensiones y animaciones
1620
+ * @returns {string} String con el CSS completo
1621
+ *
1622
+ * @example
1623
+ * ```tsx
1624
+ * const styles = generateSidebarStyles({
1625
+ * dimensions: DEFAULT_DIMENSIONS,
1626
+ * animations: DEFAULT_ANIMATIONS,
1627
+ * collapseMode: SidebarCollapseMode.COLLAPSE,
1628
+ * hideOpensBehavior: SidebarHideOpensBehavior.COLLAPSED
1629
+ * })
1630
+ *
1631
+ * <style jsx>{styles}</style>
1632
+ * ```
1633
+ *
1634
+ * @note
1635
+ * Los colores NO se configuran aquí, se obtienen automáticamente de los tokens
1636
+ * CSS de shadcn. Esto permite soporte automático para dark/light mode.
1637
+ */
1638
+ declare function generateSidebarStyles({ dimensions, animations, collapseMode, hideOpensBehavior, layoutBehaviour, visualStyle, }: StyleGeneratorConfig): string;
1639
+ /**
1640
+ * Genera estilos para el indicador visual usando tokens CSS
1641
+ *
1642
+ * @description
1643
+ * Función auxiliar para generar estilos dinámicos del indicador.
1644
+ * Útil para aplicar estilos inline con estado reactivo.
1645
+ *
1646
+ * Utiliza el token `--sidebar-primary` para el color del indicador,
1647
+ * asegurando consistencia con el theme del sidebar.
1648
+ *
1649
+ * @param {boolean} isVisible - Si el indicador está visible
1650
+ * @returns {React.CSSProperties} Objeto de estilos inline
1651
+ *
1652
+ * @example
1653
+ * ```tsx
1654
+ * const indicatorStyles = generateIndicatorStyles(isHovering && isOverItems)
1655
+ *
1656
+ * <div style={indicatorStyles} />
1657
+ * ```
1658
+ */
1659
+ declare function generateIndicatorStyles(isVisible: boolean): React.CSSProperties;
1660
+
1661
+ declare function cn(...inputs: ClassValue[]): string;
1662
+
1663
+ export { DEFAULT_ANIMATIONS, DEFAULT_CONFIG, DEFAULT_DIMENSIONS, DEFAULT_SAFE_AREAS, DEFAULT_VISUAL_STYLE, SIDEBAR_ARIA_LABELS, SIDEBAR_ARIA_ROLES, SIDEBAR_BREAKPOINTS, SIDEBAR_CSS_VARIABLES, SIDEBAR_DATA_ATTRIBUTES, SIDEBAR_DEBUG_PATTERNS, SIDEBAR_KEYBOARD_KEYS, SIDEBAR_LIMITS, SIDEBAR_TAILWIND_CLASSES, SIDEBAR_VISUAL_PRESETS, Sidebar, type SidebarAnimations, SidebarBorderRadius, SidebarCollapseMode, type SidebarConfig, SidebarContent, type SidebarContentProps, type SidebarContextValue, type SidebarDimensions, SidebarFluidIndicator, SidebarHideBehaviour, SidebarHideOpensBehavior, SidebarIconLibrary, SidebarIndicator, type SidebarIndicatorProps, type SidebarIndicatorRenderProp, type SidebarIndicatorState, SidebarItem, type SidebarItemProps, type SidebarItemRenderProp, type SidebarItemState, SidebarLayoutBehaviour, SidebarNav, type SidebarNavProps, type SidebarProps, type SidebarRenderProp, SidebarSafeArea, SidebarSafeAreaPosition, type SidebarSafeAreaProps, type SidebarSafeAreas, type SidebarState, SidebarSubContent, type SidebarSubContentProps, SidebarSubLink, type SidebarSubLinkProps, SidebarTimingFunction, SidebarToggle, type SidebarToggleProps, type SidebarToggleRenderProp, type SidebarToggleState, SidebarTooltip, type SidebarTooltipProps, SidebarTransitionDuration, type SidebarVisualPreset, type SidebarVisualStyle, SidebarWidth, SidebarZIndex, cn, generateIndicatorStyles, generateSidebarStyles, useSidebarContext, useSidebarIndicator, useSidebarKeyboard, useSubContent };