@mks2508/sidebar-headless 0.2.1 → 0.3.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.
- package/CHANGELOG.md +53 -53
- package/LICENSE +21 -21
- package/README.md +165 -165
- package/dist/components/BottomNavBar/MobileBottomNav.d.ts +65 -0
- package/dist/components/BottomNavBar/MobileBottomNav.d.ts.map +1 -0
- package/dist/components/BottomNavBar/MobileBottomNav.styles.d.ts +94 -0
- package/dist/components/BottomNavBar/MobileBottomNav.styles.d.ts.map +1 -0
- package/dist/components/BottomNavBar/index.d.ts +10 -0
- package/dist/components/BottomNavBar/index.d.ts.map +1 -0
- package/dist/components/BottomNavBar/types.d.ts +363 -0
- package/dist/components/BottomNavBar/types.d.ts.map +1 -0
- package/dist/components/BottomNavBar/useIOSSafariFix.d.ts +74 -0
- package/dist/components/BottomNavBar/useIOSSafariFix.d.ts.map +1 -0
- package/dist/components/Sidebar/Sidebar.constants.d.ts +285 -0
- package/dist/components/Sidebar/Sidebar.constants.d.ts.map +1 -0
- package/dist/components/Sidebar/Sidebar.d.ts +80 -0
- package/dist/components/Sidebar/Sidebar.d.ts.map +1 -0
- package/dist/components/Sidebar/Sidebar.styles.d.ts +77 -0
- package/dist/components/Sidebar/Sidebar.styles.d.ts.map +1 -0
- package/dist/components/Sidebar/Sidebar.types.d.ts +638 -0
- package/dist/components/Sidebar/Sidebar.types.d.ts.map +1 -0
- package/dist/components/Sidebar/SidebarContent.d.ts +46 -0
- package/dist/components/Sidebar/SidebarContent.d.ts.map +1 -0
- package/dist/components/Sidebar/SidebarContext.d.ts +87 -0
- package/dist/components/Sidebar/SidebarContext.d.ts.map +1 -0
- package/dist/components/Sidebar/SidebarFluidIndicator.d.ts +37 -0
- package/dist/components/Sidebar/SidebarFluidIndicator.d.ts.map +1 -0
- package/dist/components/Sidebar/SidebarIndicator.d.ts +59 -0
- package/dist/components/Sidebar/SidebarIndicator.d.ts.map +1 -0
- package/dist/components/Sidebar/SidebarItem.d.ts +82 -0
- package/dist/components/Sidebar/SidebarItem.d.ts.map +1 -0
- package/dist/components/Sidebar/SidebarNav.d.ts +48 -0
- package/dist/components/Sidebar/SidebarNav.d.ts.map +1 -0
- package/dist/components/Sidebar/SidebarSafeArea.d.ts +56 -0
- package/dist/components/Sidebar/SidebarSafeArea.d.ts.map +1 -0
- package/dist/components/Sidebar/SidebarSubContent.d.ts +10 -0
- package/dist/components/Sidebar/SidebarSubContent.d.ts.map +1 -0
- package/dist/components/Sidebar/SidebarSubLink.d.ts +18 -0
- package/dist/components/Sidebar/SidebarSubLink.d.ts.map +1 -0
- package/dist/components/Sidebar/SidebarToggle.d.ts +52 -0
- package/dist/components/Sidebar/SidebarToggle.d.ts.map +1 -0
- package/dist/components/Sidebar/SidebarTooltip.d.ts +26 -0
- package/dist/components/Sidebar/SidebarTooltip.d.ts.map +1 -0
- package/dist/components/Sidebar/TooltipTitle3D.d.ts +42 -0
- package/dist/components/Sidebar/TooltipTitle3D.d.ts.map +1 -0
- package/dist/components/Sidebar/TooltipTitle3DCrossfade.d.ts +46 -0
- package/dist/components/Sidebar/TooltipTitle3DCrossfade.d.ts.map +1 -0
- package/dist/components/Sidebar/TooltipTitleCylinder.d.ts +9 -0
- package/dist/components/Sidebar/TooltipTitleCylinder.d.ts.map +1 -0
- package/dist/components/Sidebar/hooks/useSidebarContext.d.ts +48 -0
- package/dist/components/Sidebar/hooks/useSidebarContext.d.ts.map +1 -0
- package/dist/components/Sidebar/hooks/useSidebarIndicator.d.ts +72 -0
- package/dist/components/Sidebar/hooks/useSidebarIndicator.d.ts.map +1 -0
- package/dist/components/Sidebar/hooks/useSidebarKeyboard.d.ts +51 -0
- package/dist/components/Sidebar/hooks/useSidebarKeyboard.d.ts.map +1 -0
- package/dist/components/Sidebar/hooks/useSubContent.d.ts +7 -0
- package/dist/components/Sidebar/hooks/useSubContent.d.ts.map +1 -0
- package/dist/components/Sidebar/hooks/useTitleHistory.d.ts +41 -0
- package/dist/components/Sidebar/hooks/useTitleHistory.d.ts.map +1 -0
- package/dist/components/Sidebar/hooks/useTooltipDirection.d.ts +29 -0
- package/dist/components/Sidebar/hooks/useTooltipDirection.d.ts.map +1 -0
- package/dist/components/Sidebar/hooks/useTooltipTransition.d.ts +60 -0
- package/dist/components/Sidebar/hooks/useTooltipTransition.d.ts.map +1 -0
- package/dist/components/Sidebar/index.d.ts +163 -0
- package/dist/components/Sidebar/index.d.ts.map +1 -0
- package/dist/components/Sidebar/sidebar-defaults.d.ts +54 -0
- package/dist/components/Sidebar/sidebar-defaults.d.ts.map +1 -0
- package/dist/components/animate-ui/components/base/switch.d.ts +11 -0
- package/dist/components/animate-ui/components/base/switch.d.ts.map +1 -0
- package/dist/components/animate-ui/primitives/base/switch.d.ts +23 -0
- package/dist/components/animate-ui/primitives/base/switch.d.ts.map +1 -0
- package/dist/components/fluid-hover-indicator-v2.d.ts +46 -0
- package/dist/components/fluid-hover-indicator-v2.d.ts.map +1 -0
- package/dist/components/fluid-hover-indicator.d.ts +28 -0
- package/dist/components/fluid-hover-indicator.d.ts.map +1 -0
- package/dist/components/ui/TextCylinder.d.ts +21 -0
- package/dist/components/ui/TextCylinder.d.ts.map +1 -0
- package/dist/components/ui/button.d.ts +11 -0
- package/dist/components/ui/button.d.ts.map +1 -0
- package/dist/components/ui/card.d.ts +10 -0
- package/dist/components/ui/card.d.ts.map +1 -0
- package/dist/components/ui/custom-icon.d.ts +45 -0
- package/dist/components/ui/custom-icon.d.ts.map +1 -0
- package/dist/components/ui/dotted-glow-background.d.ts +42 -0
- package/dist/components/ui/dotted-glow-background.d.ts.map +1 -0
- package/dist/components/ui/input.d.ts +4 -0
- package/dist/components/ui/input.d.ts.map +1 -0
- package/dist/components/ui/label.d.ts +5 -0
- package/dist/components/ui/label.d.ts.map +1 -0
- package/dist/components/ui/optimized-image.d.ts +12 -0
- package/dist/components/ui/optimized-image.d.ts.map +1 -0
- package/dist/components/ui/select.d.ts +16 -0
- package/dist/components/ui/select.d.ts.map +1 -0
- package/dist/components/ui/slider.d.ts +5 -0
- package/dist/components/ui/slider.d.ts.map +1 -0
- package/dist/components/ui/textarea.d.ts +4 -0
- package/dist/components/ui/textarea.d.ts.map +1 -0
- package/dist/{index.css → dist/index.css} +945 -908
- package/dist/dist/index.css.map +1 -0
- package/dist/hooks/use-controlled-state.d.ts +9 -0
- package/dist/hooks/use-controlled-state.d.ts.map +1 -0
- package/dist/hooks/use-fluid-animation.d.ts +18 -0
- package/dist/hooks/use-fluid-animation.d.ts.map +1 -0
- package/dist/hooks/use-liquid-glass.d.ts +40 -0
- package/dist/hooks/use-liquid-glass.d.ts.map +1 -0
- package/dist/hooks/use-sidebar-liquid-glass.d.ts +48 -0
- package/dist/hooks/use-sidebar-liquid-glass.d.ts.map +1 -0
- package/dist/hooks/use-text-cylinder.d.ts +67 -0
- package/dist/hooks/use-text-cylinder.d.ts.map +1 -0
- package/dist/index.cjs +13192 -52272
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +10 -2231
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +13131 -52248
- package/dist/index.js.map +1 -1
- package/dist/lib/get-strict-context.d.ts +10 -0
- package/dist/lib/get-strict-context.d.ts.map +1 -0
- package/dist/lib/liquid-glass-presets.d.ts +43 -0
- package/dist/lib/liquid-glass-presets.d.ts.map +1 -0
- package/dist/lib/utils.d.ts +3 -0
- package/dist/lib/utils.d.ts.map +1 -0
- package/dist/types/sidebar-minimal.d.ts +21 -0
- package/dist/types/sidebar-minimal.d.ts.map +1 -0
- package/dist/utils/TooltipAnimationController.d.ts +122 -0
- package/dist/utils/TooltipAnimationController.d.ts.map +1 -0
- package/package.json +112 -106
- package/dist/MobileOptimizations.css +0 -570
- package/dist/index.css.map +0 -1
- package/dist/index.d.cts +0 -2235
- package/dist/tooltip-keyframes.css +0 -329
package/dist/index.d.ts
CHANGED
|
@@ -1,2235 +1,14 @@
|
|
|
1
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import * as react from 'react';
|
|
3
|
-
import react__default, { ReactNode, CSSProperties, ElementType, ComponentType, RefObject, MouseEvent as MouseEvent$1, HTMLAttributes, ComponentPropsWithoutRef } from 'react';
|
|
4
|
-
import * as class_variance_authority_types from 'class-variance-authority/types';
|
|
5
|
-
import { VariantProps } from 'class-variance-authority';
|
|
6
|
-
import { ClassValue } from 'clsx';
|
|
7
|
-
|
|
8
1
|
/**
|
|
9
|
-
*
|
|
10
|
-
* Made flexible to handle all liquid glass configuration properties
|
|
11
|
-
*/
|
|
12
|
-
interface SidebarLiquidConfig {
|
|
13
|
-
/** Habilitar chromatic aberration (Phase 2) - solo para tooltips por defecto */
|
|
14
|
-
enableChromaticAberration?: boolean;
|
|
15
|
-
/** Allow any property to avoid external dependency issues */
|
|
16
|
-
[key: string]: any;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Modo de colapso del sidebar
|
|
21
|
-
* @enum {string}
|
|
22
|
-
*/
|
|
23
|
-
declare enum SidebarCollapseMode {
|
|
24
|
-
/** Colapsa el sidebar a un ancho mínimo mostrando solo iconos */
|
|
25
|
-
COLLAPSE = "collapse",
|
|
26
|
-
/** Oculta completamente el sidebar */
|
|
27
|
-
HIDE = "hide"
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Comportamiento del sidebar cuando está en modo hide
|
|
31
|
-
* @enum {string}
|
|
32
|
-
*/
|
|
33
|
-
declare enum SidebarHideBehaviour {
|
|
34
|
-
/** Muestra un botón indicador para reabrir el sidebar */
|
|
35
|
-
SHOW_INDICATOR = "showIndicator",
|
|
36
|
-
/** El sidebar es completamente controlado externamente sin indicador */
|
|
37
|
-
CONTROLLED = "controlled"
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* Comportamiento al abrir desde el estado hide
|
|
41
|
-
* @enum {string}
|
|
42
|
-
*/
|
|
43
|
-
declare enum SidebarHideOpensBehavior {
|
|
44
|
-
/** Abre al tamaño colapsado (solo iconos) */
|
|
45
|
-
COLLAPSED = "collapsed",
|
|
46
|
-
/** Abre al tamaño expandido completo */
|
|
47
|
-
EXPANDED = "expanded"
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* Comportamiento de layout del sidebar
|
|
51
|
-
* @enum {string}
|
|
52
|
-
*/
|
|
53
|
-
declare enum SidebarLayoutBehaviour {
|
|
54
|
-
/** Sidebar flotante con z-index que NO desplaza el contenido (default) */
|
|
55
|
-
FLOATING = "floating",
|
|
56
|
-
/** Sidebar como parte del layout que SÍ desplaza el contenido */
|
|
57
|
-
INLINE = "inline"
|
|
58
|
-
}
|
|
59
|
-
/**
|
|
60
|
-
* Anchos predefinidos del sidebar
|
|
61
|
-
* @enum {string}
|
|
62
|
-
*/
|
|
63
|
-
declare enum SidebarWidth {
|
|
64
|
-
/** Ancho en estado colapsado (solo iconos) */
|
|
65
|
-
COLLAPSED = "5rem",
|
|
66
|
-
/** Ancho expandido completo */
|
|
67
|
-
EXPANDED = "16rem",
|
|
68
|
-
/** Ancho mínimo absoluto */
|
|
69
|
-
MIN = "3rem",
|
|
70
|
-
/** Ancho máximo absoluto */
|
|
71
|
-
MAX = "20rem"
|
|
72
|
-
}
|
|
73
|
-
/**
|
|
74
|
-
* Duraciones de transición en milisegundos
|
|
75
|
-
* @enum {number}
|
|
76
|
-
*/
|
|
77
|
-
declare enum SidebarTransitionDuration {
|
|
78
|
-
/** Transición rápida para cambios de opacidad */
|
|
79
|
-
FAST = 200,
|
|
80
|
-
/** Transición normal para width y transforms */
|
|
81
|
-
NORMAL = 300,
|
|
82
|
-
/** Transición lenta para animaciones complejas */
|
|
83
|
-
SLOW = 500
|
|
84
|
-
}
|
|
85
|
-
/**
|
|
86
|
-
* Índices Z para capas del sidebar
|
|
87
|
-
* @enum {number}
|
|
88
|
-
*/
|
|
89
|
-
declare enum SidebarZIndex {
|
|
90
|
-
/** Base del contenedor wrapper */
|
|
91
|
-
BASE = 0,
|
|
92
|
-
/** Indicador visual */
|
|
93
|
-
INDICATOR = 5,
|
|
94
|
-
/** Contenido interno del sidebar */
|
|
95
|
-
CONTENT = 10,
|
|
96
|
-
/** Botón de toggle */
|
|
97
|
-
TOGGLE = 30
|
|
98
|
-
}
|
|
99
|
-
/**
|
|
100
|
-
* Radios de borde predefinidos
|
|
101
|
-
* @enum {string}
|
|
102
|
-
*/
|
|
103
|
-
declare enum SidebarBorderRadius {
|
|
104
|
-
/** Sin radio de borde */
|
|
105
|
-
NONE = "0",
|
|
106
|
-
/** Radio pequeño */
|
|
107
|
-
SM = "0.25rem",
|
|
108
|
-
/** Radio medio */
|
|
109
|
-
MD = "0.5rem",
|
|
110
|
-
/** Radio grande */
|
|
111
|
-
LG = "1rem",
|
|
112
|
-
/** Radio completo (circular) */
|
|
113
|
-
FULL = "9999px"
|
|
114
|
-
}
|
|
115
|
-
/**
|
|
116
|
-
* Posiciones para SidebarSafeArea
|
|
117
|
-
* @enum {string}
|
|
118
|
-
*/
|
|
119
|
-
declare enum SidebarSafeAreaPosition {
|
|
120
|
-
/** Área segura superior */
|
|
121
|
-
TOP = "top",
|
|
122
|
-
/** Área segura inferior */
|
|
123
|
-
BOTTOM = "bottom"
|
|
124
|
-
}
|
|
125
|
-
/**
|
|
126
|
-
* Timing functions para transiciones CSS
|
|
127
|
-
* @enum {string}
|
|
128
|
-
*/
|
|
129
|
-
declare enum SidebarTimingFunction {
|
|
130
|
-
/** Ease estándar */
|
|
131
|
-
EASE = "ease",
|
|
132
|
-
/** Linear (velocidad constante) */
|
|
133
|
-
LINEAR = "linear",
|
|
134
|
-
/** Ease in (aceleración) */
|
|
135
|
-
EASE_IN = "ease-in",
|
|
136
|
-
/** Ease out (desaceleración) */
|
|
137
|
-
EASE_OUT = "ease-out",
|
|
138
|
-
/** Ease in out (aceleración y desaceleración) */
|
|
139
|
-
EASE_IN_OUT = "ease-in-out",
|
|
140
|
-
/** Cubic bezier personalizado */
|
|
141
|
-
CUSTOM = "cubic-bezier(0.4, 0, 0.2, 1)"
|
|
142
|
-
}
|
|
143
|
-
/**
|
|
144
|
-
* Configuración de estilo visual del sidebar
|
|
145
|
-
* @interface
|
|
146
|
-
*/
|
|
147
|
-
interface SidebarVisualStyle {
|
|
148
|
-
/** Margen superior (separación del borde superior) */
|
|
149
|
-
marginTop?: string;
|
|
150
|
-
/** Margen inferior (separación del borde inferior) */
|
|
151
|
-
marginBottom?: string;
|
|
152
|
-
/** Margen izquierdo (separación del borde izquierdo) */
|
|
153
|
-
marginLeft?: string;
|
|
154
|
-
/** Margen derecho (generalmente 0 en modo inline) */
|
|
155
|
-
marginRight?: string;
|
|
156
|
-
/** Altura del sidebar (default: "100vh") */
|
|
157
|
-
height?: string;
|
|
158
|
-
/** Radio de borde redondeado */
|
|
159
|
-
borderRadius?: string;
|
|
160
|
-
/** Sombra del sidebar */
|
|
161
|
-
boxShadow?: string;
|
|
162
|
-
}
|
|
163
|
-
/**
|
|
164
|
-
* Configuración de dimensiones del sidebar
|
|
165
|
-
* @interface
|
|
166
|
-
*/
|
|
167
|
-
interface SidebarDimensions {
|
|
168
|
-
/** Ancho cuando está colapsado */
|
|
169
|
-
collapsedWidth: string;
|
|
170
|
-
/** Ancho cuando está expandido */
|
|
171
|
-
expandedWidth: string;
|
|
172
|
-
/** Altura del indicador visual */
|
|
173
|
-
indicatorHeight: string;
|
|
174
|
-
/** Distancia del tooltip al borde del sidebar (CSS-first con Anchor API) */
|
|
175
|
-
tooltipDistance?: string;
|
|
176
|
-
/** Configuración de estilo visual */
|
|
177
|
-
visualStyle?: SidebarVisualStyle;
|
|
178
|
-
}
|
|
179
|
-
/**
|
|
180
|
-
* Configuración de áreas seguras (safe areas)
|
|
181
|
-
* @interface
|
|
182
|
-
*/
|
|
183
|
-
interface SidebarSafeAreas {
|
|
184
|
-
/** Porcentaje de altura para área segura superior */
|
|
185
|
-
topPercent: number;
|
|
186
|
-
/** Porcentaje de altura para área segura inferior */
|
|
187
|
-
bottomPercent: number;
|
|
188
|
-
}
|
|
189
|
-
/**
|
|
190
|
-
* Configuración de animaciones
|
|
191
|
-
* @interface
|
|
192
|
-
*/
|
|
193
|
-
interface SidebarAnimations {
|
|
194
|
-
/** Duración de transición de width en ms */
|
|
195
|
-
widthTransitionDuration: number;
|
|
196
|
-
/** Duración de transición de opacidad en ms */
|
|
197
|
-
opacityTransitionDuration: number;
|
|
198
|
-
/** Función de timing para animaciones */
|
|
199
|
-
timingFunction: string;
|
|
200
|
-
}
|
|
201
|
-
/**
|
|
202
|
-
* Configuración experimental de Liquid Glass V2
|
|
203
|
-
*
|
|
204
|
-
* @description
|
|
205
|
-
* Feature flags para habilitar efectos avanzados de liquid glass basados en:
|
|
206
|
-
* - SVG Displacement Mapping (Snell's Law refraction)
|
|
207
|
-
* - Chromatic Aberration (RGB channel separation)
|
|
208
|
-
* - Edge Glass 3D (dual backdrop layers)
|
|
209
|
-
* - Backdrop Extension (Josh Comeau technique)
|
|
210
|
-
*
|
|
211
|
-
* @interface
|
|
212
|
-
* @experimental
|
|
213
|
-
*/
|
|
214
|
-
interface SidebarLiquidGlassConfig {
|
|
215
|
-
/**
|
|
216
|
-
* Habilitar Liquid Glass V2 (master flag)
|
|
217
|
-
*
|
|
218
|
-
* @description
|
|
219
|
-
* Activa el uso de FluidHoverIndicatorV2 y SidebarTooltipV2 con SVG displacement mapping
|
|
220
|
-
* en lugar de las versiones básicas con backdrop-blur CSS.
|
|
221
|
-
*
|
|
222
|
-
* @default false
|
|
223
|
-
*/
|
|
224
|
-
enableLiquidGlassV2?: boolean;
|
|
225
|
-
/**
|
|
226
|
-
* Habilitar Chromatic Aberration (Phase 2)
|
|
227
|
-
*
|
|
228
|
-
* @description
|
|
229
|
-
* Activa la separación real de canales RGB usando feColorMatrix + feOffset
|
|
230
|
-
* en lugar del método legacy basado en diferentes escalas de displacement.
|
|
231
|
-
* Proporciona +15% de realismo visual según benchmarks.
|
|
232
|
-
*
|
|
233
|
-
* **Requiere**: enableLiquidGlassV2 = true
|
|
234
|
-
*
|
|
235
|
-
* @default false
|
|
236
|
-
*/
|
|
237
|
-
enableChromaticAberration?: boolean;
|
|
238
|
-
/**
|
|
239
|
-
* Habilitar Edge Glass 3D (tooltips)
|
|
240
|
-
*
|
|
241
|
-
* @description
|
|
242
|
-
* Activa dual backdrop layers con blur diferenciado para crear ilusión de profundidad:
|
|
243
|
-
* - Depth layer: blur alto (16px) con brightness 1.15
|
|
244
|
-
* - Surface layer: blur moderado (8px) con brightness 1.25
|
|
245
|
-
*
|
|
246
|
-
* **Solo aplica a**: SidebarTooltipV2
|
|
247
|
-
* **Requiere**: enableLiquidGlassV2 = true
|
|
248
|
-
*
|
|
249
|
-
* @default true
|
|
250
|
-
*/
|
|
251
|
-
enableEdgeGlass3D?: boolean;
|
|
252
|
-
/**
|
|
253
|
-
* Habilitar Backdrop Extension (Josh Comeau)
|
|
254
|
-
*
|
|
255
|
-
* @description
|
|
256
|
-
* Extiende el área de backdrop-filter al 200% de altura con mask
|
|
257
|
-
* para capturar elementos cercanos y mejorar el realismo de la refracción.
|
|
258
|
-
*
|
|
259
|
-
* **Solo aplica a**: SidebarTooltipV2
|
|
260
|
-
* **Requiere**: enableLiquidGlassV2 = true
|
|
261
|
-
*
|
|
262
|
-
* @default true
|
|
263
|
-
*/
|
|
264
|
-
enableBackdropExtension?: boolean;
|
|
265
|
-
/**
|
|
266
|
-
* Habilitar animaciones staggered de items en tooltips
|
|
267
|
-
*
|
|
268
|
-
* @description
|
|
269
|
-
* Activa entrada/salida escalonada de items del tooltip usando CSS custom properties.
|
|
270
|
-
* Incluye grid trick para height auto transitions y direction-aware animations.
|
|
271
|
-
*
|
|
272
|
-
* **Solo aplica a**: SidebarTooltipV2
|
|
273
|
-
*
|
|
274
|
-
* @default true
|
|
275
|
-
* @experimental
|
|
276
|
-
*/
|
|
277
|
-
enableTooltipItemAnimations?: boolean;
|
|
278
|
-
/**
|
|
279
|
-
* Habilitar animación 3D de cilindro para títulos de tooltips
|
|
280
|
-
*
|
|
281
|
-
* @description
|
|
282
|
-
* Activa efecto de cilindro rotatorio 3D para el título del tooltip usando Web Animations API.
|
|
283
|
-
* Mantiene historial circular de últimos 10 títulos y rota según dirección de navegación.
|
|
284
|
-
*
|
|
285
|
-
* **Features**:
|
|
286
|
-
* - Rotación 3D con rotateX
|
|
287
|
-
* - Direction-aware (up/down navigation)
|
|
288
|
-
* - Historial circular de títulos
|
|
289
|
-
* - Duración: 400ms, easing cubic-bezier
|
|
290
|
-
*
|
|
291
|
-
* **Solo aplica a**: SidebarTooltip
|
|
292
|
-
*
|
|
293
|
-
* @default false
|
|
294
|
-
* @experimental
|
|
295
|
-
*/
|
|
296
|
-
enableCylinderTitle?: boolean;
|
|
297
|
-
/**
|
|
298
|
-
* Overrides de preset para configuración avanzada de Liquid Glass
|
|
299
|
-
*
|
|
300
|
-
* @description
|
|
301
|
-
* Permite sobrescribir valores del preset 'sidebar' para debugging y ajuste fino.
|
|
302
|
-
* Incluye parámetros visuales como frost, blur, scale, chromatic aberration RGB, etc.
|
|
303
|
-
*
|
|
304
|
-
* **Ejemplo**:
|
|
305
|
-
* ```tsx
|
|
306
|
-
* presetOverrides: {
|
|
307
|
-
* frost: 0.08,
|
|
308
|
-
* blur: 12,
|
|
309
|
-
* blurBackground: 10,
|
|
310
|
-
* scale: -200,
|
|
311
|
-
* r: 5,
|
|
312
|
-
* g: 15,
|
|
313
|
-
* b: 25
|
|
314
|
-
* }
|
|
315
|
-
* ```
|
|
316
|
-
*
|
|
317
|
-
* **Requiere**: enableLiquidGlassV2 = true
|
|
318
|
-
*
|
|
319
|
-
* @default undefined
|
|
320
|
-
* @experimental
|
|
321
|
-
*/
|
|
322
|
-
presetOverrides?: Partial<SidebarLiquidConfig>;
|
|
323
|
-
}
|
|
324
|
-
/**
|
|
325
|
-
* Librería de iconos a utilizar
|
|
326
|
-
* @enum {string}
|
|
327
|
-
*/
|
|
328
|
-
declare enum SidebarIconLibrary {
|
|
329
|
-
/** Iconos de lucide-react */
|
|
330
|
-
LUCIDE = "lucide",
|
|
331
|
-
/** Iconos custom proporcionados por el usuario */
|
|
332
|
-
CUSTOM = "custom"
|
|
333
|
-
}
|
|
334
|
-
/**
|
|
335
|
-
* Estado compartido del sidebar
|
|
336
|
-
* @interface
|
|
337
|
-
*/
|
|
338
|
-
interface SidebarState {
|
|
339
|
-
/** Indica si el sidebar está abierto */
|
|
340
|
-
open: boolean;
|
|
341
|
-
/** Indica si el sidebar está colapsado (solo en modo COLLAPSE) */
|
|
342
|
-
collapsed: boolean;
|
|
343
|
-
/** Modo de colapso actual */
|
|
344
|
-
collapseMode: SidebarCollapseMode;
|
|
345
|
-
/** Comportamiento de layout actual */
|
|
346
|
-
layoutBehaviour: SidebarLayoutBehaviour;
|
|
347
|
-
}
|
|
348
|
-
/**
|
|
349
|
-
* Estado del botón toggle
|
|
350
|
-
* @interface
|
|
351
|
-
*/
|
|
352
|
-
interface SidebarToggleState {
|
|
353
|
-
/** Indica si el toggle está activo/presionado */
|
|
354
|
-
active: boolean;
|
|
355
|
-
/** Indica si el sidebar está abierto */
|
|
356
|
-
open: boolean;
|
|
357
|
-
}
|
|
358
|
-
/**
|
|
359
|
-
* Estado de un item del sidebar
|
|
360
|
-
* @interface
|
|
361
|
-
*/
|
|
362
|
-
interface SidebarItemState {
|
|
363
|
-
/** Indica si el item está enfocado por teclado */
|
|
364
|
-
focused: boolean;
|
|
365
|
-
/** Indica si el mouse está sobre el item */
|
|
366
|
-
hovered: boolean;
|
|
367
|
-
/** Indica si el item está deshabilitado */
|
|
368
|
-
disabled: boolean;
|
|
369
|
-
}
|
|
370
|
-
/**
|
|
371
|
-
* Estado del indicador visual
|
|
372
|
-
* @interface
|
|
373
|
-
*/
|
|
374
|
-
interface SidebarIndicatorState {
|
|
375
|
-
/** Indica si el indicador está visible */
|
|
376
|
-
visible: boolean;
|
|
377
|
-
/** Posición Y del indicador en píxeles */
|
|
378
|
-
position: number;
|
|
379
|
-
}
|
|
380
|
-
/**
|
|
381
|
-
* Tipo para render prop de Sidebar
|
|
382
|
-
*/
|
|
383
|
-
type SidebarRenderProp = (state: SidebarState) => ReactNode;
|
|
384
|
-
/**
|
|
385
|
-
* Tipo para render prop de SidebarToggle
|
|
386
|
-
*/
|
|
387
|
-
type SidebarToggleRenderProp = (state: SidebarToggleState) => ReactNode;
|
|
388
|
-
/**
|
|
389
|
-
* Tipo para render prop de SidebarItem
|
|
390
|
-
*/
|
|
391
|
-
type SidebarItemRenderProp = (state: SidebarItemState) => ReactNode;
|
|
392
|
-
/**
|
|
393
|
-
* Tipo para render prop de SidebarIndicator
|
|
394
|
-
*/
|
|
395
|
-
type SidebarIndicatorRenderProp = (state: SidebarIndicatorState) => ReactNode;
|
|
396
|
-
/**
|
|
397
|
-
* Valor del contexto compartido del Sidebar
|
|
398
|
-
* @interface
|
|
399
|
-
*/
|
|
400
|
-
interface SidebarContextValue {
|
|
401
|
-
/** Estado inicial del sidebar (solo lectura) */
|
|
402
|
-
defaultOpen: boolean;
|
|
403
|
-
/** Estado actual open/closed del sidebar */
|
|
404
|
-
open: boolean;
|
|
405
|
-
/** Función para actualizar el estado open */
|
|
406
|
-
setOpen: (open: boolean) => void;
|
|
407
|
-
/** Modo de colapso actual */
|
|
408
|
-
collapseMode: SidebarCollapseMode;
|
|
409
|
-
/** Comportamiento en modo hide */
|
|
410
|
-
hideBehaviour: SidebarHideBehaviour;
|
|
411
|
-
/** Comportamiento al abrir desde hide */
|
|
412
|
-
hideOpensBehavior: SidebarHideOpensBehavior;
|
|
413
|
-
/** Comportamiento de layout del sidebar */
|
|
414
|
-
layoutBehaviour: SidebarLayoutBehaviour;
|
|
415
|
-
/** Configuración de dimensiones */
|
|
416
|
-
dimensions: SidebarDimensions;
|
|
417
|
-
/** Configuración de safe areas */
|
|
418
|
-
safeAreas: SidebarSafeAreas;
|
|
419
|
-
/** Configuración de animaciones */
|
|
420
|
-
animations: SidebarAnimations;
|
|
421
|
-
/** ID del toggle input */
|
|
422
|
-
toggleId: string;
|
|
423
|
-
/** Modo debug para visualizar safe areas */
|
|
424
|
-
debug: boolean;
|
|
425
|
-
/** Ref al contenedor de navegación */
|
|
426
|
-
navRef: RefObject<HTMLElement | null>;
|
|
427
|
-
/** Ref al contenedor de items */
|
|
428
|
-
contentRef: RefObject<HTMLDivElement | null>;
|
|
429
|
-
/** Ref al indicador visual */
|
|
430
|
-
indicatorRef: RefObject<HTMLDivElement | null>;
|
|
431
|
-
/** Registrar un item para navegación por teclado */
|
|
432
|
-
registerItem: (element: HTMLElement) => void;
|
|
433
|
-
/** Des-registrar un item */
|
|
434
|
-
unregisterItem: (element: HTMLElement) => void;
|
|
435
|
-
/** Items registrados actualmente */
|
|
436
|
-
items: HTMLElement[];
|
|
437
|
-
/** Indica si el indicador debe mostrarse por navegación de teclado */
|
|
438
|
-
showIndicatorForKeyboard: boolean;
|
|
439
|
-
/** Función para activar/desactivar el indicador por teclado */
|
|
440
|
-
setShowIndicatorForKeyboard: (show: boolean) => void;
|
|
441
|
-
/** Indica si el cursor/focus está sobre el área de items */
|
|
442
|
-
isOverItems: boolean;
|
|
443
|
-
/** Función para actualizar el estado de isOverItems */
|
|
444
|
-
setIsOverItems: (isOver: boolean) => void;
|
|
445
|
-
/** Habilitar FluidHoverIndicator (glassmorphism + spring physics) */
|
|
446
|
-
enableFluidIndicator: boolean;
|
|
447
|
-
/** Habilitar tooltip en hover (muestra label o subcategorías) */
|
|
448
|
-
enableTooltip: boolean;
|
|
449
|
-
/** Elemento del item actualmente hovered/focused (para FluidIndicator) */
|
|
450
|
-
currentItemElement: HTMLElement | null;
|
|
451
|
-
/** Función para actualizar el currentItemElement */
|
|
452
|
-
setCurrentItemElement: (element: HTMLElement | null) => void;
|
|
453
|
-
/** Configuración experimental de Liquid Glass V2 */
|
|
454
|
-
liquidGlass: SidebarLiquidGlassConfig;
|
|
455
|
-
}
|
|
456
|
-
/**
|
|
457
|
-
* Props del componente Sidebar (root container)
|
|
458
|
-
* @interface
|
|
459
|
-
*/
|
|
460
|
-
interface SidebarProps {
|
|
461
|
-
/** Contenido del sidebar (puede ser ReactNode o render prop) */
|
|
462
|
-
children: ReactNode | SidebarRenderProp;
|
|
463
|
-
/** Clase CSS adicional para el wrapper */
|
|
464
|
-
className?: string;
|
|
465
|
-
/** Estilos inline para el wrapper */
|
|
466
|
-
style?: CSSProperties;
|
|
467
|
-
/** Estado inicial abierto (modo uncontrolled) */
|
|
468
|
-
defaultOpen?: boolean;
|
|
469
|
-
/** Estado abierto (modo controlled) */
|
|
470
|
-
open?: boolean;
|
|
471
|
-
/** Callback cuando cambia el estado open */
|
|
472
|
-
onOpenChange?: (open: boolean) => void;
|
|
473
|
-
/** Modo de colapso del sidebar */
|
|
474
|
-
collapseMode?: SidebarCollapseMode;
|
|
475
|
-
/** Comportamiento en modo hide */
|
|
476
|
-
hideBehaviour?: SidebarHideBehaviour;
|
|
477
|
-
/** Comportamiento al abrir desde hide */
|
|
478
|
-
hideOpensBehavior?: SidebarHideOpensBehavior;
|
|
479
|
-
/** Comportamiento de layout del sidebar */
|
|
480
|
-
layoutBehaviour?: SidebarLayoutBehaviour;
|
|
481
|
-
/** Configuración de dimensiones (partial override) */
|
|
482
|
-
dimensions?: Partial<SidebarDimensions>;
|
|
483
|
-
/** Configuración de áreas seguras (partial override) */
|
|
484
|
-
safeAreas?: Partial<SidebarSafeAreas>;
|
|
485
|
-
/** Configuración de animaciones (partial override) */
|
|
486
|
-
animations?: Partial<SidebarAnimations>;
|
|
487
|
-
/** ID personalizado para el toggle input */
|
|
488
|
-
toggleId?: string;
|
|
489
|
-
/** Modo debug (muestra bordes y labels) */
|
|
490
|
-
debug?: boolean;
|
|
491
|
-
/** Habilitar FluidHoverIndicator (glassmorphism + spring physics) */
|
|
492
|
-
enableFluidIndicator?: boolean;
|
|
493
|
-
/** Habilitar tooltip en hover (muestra label o subcategorías) */
|
|
494
|
-
enableTooltip?: boolean;
|
|
495
|
-
/**
|
|
496
|
-
* Configuración experimental de Liquid Glass V2 (partial override)
|
|
497
|
-
*
|
|
498
|
-
* @description
|
|
499
|
-
* Permite activar/desactivar features experimentales de liquid glass mediante flags:
|
|
500
|
-
*
|
|
501
|
-
* @example
|
|
502
|
-
* ```tsx
|
|
503
|
-
* <Sidebar
|
|
504
|
-
* liquidGlass={{
|
|
505
|
-
* enableLiquidGlassV2: true,
|
|
506
|
-
* enableChromaticAberration: true,
|
|
507
|
-
* enableEdgeGlass3D: true,
|
|
508
|
-
* enableBackdropExtension: true
|
|
509
|
-
* }}
|
|
510
|
-
* >
|
|
511
|
-
* ...
|
|
512
|
-
* </Sidebar>
|
|
513
|
-
* ```
|
|
514
|
-
*
|
|
515
|
-
* @experimental
|
|
516
|
-
*/
|
|
517
|
-
liquidGlass?: Partial<SidebarLiquidGlassConfig>;
|
|
518
|
-
/** Elemento o componente a renderizar */
|
|
519
|
-
as?: ElementType;
|
|
520
|
-
}
|
|
521
|
-
/**
|
|
522
|
-
* Props del componente SidebarNav
|
|
523
|
-
* @interface
|
|
524
|
-
*/
|
|
525
|
-
interface SidebarNavProps {
|
|
526
|
-
/** Contenido del nav */
|
|
527
|
-
children: ReactNode;
|
|
528
|
-
/** Clase CSS adicional */
|
|
529
|
-
className?: string;
|
|
530
|
-
/** Estilos inline */
|
|
531
|
-
style?: CSSProperties;
|
|
532
|
-
/** Label ARIA para el nav */
|
|
533
|
-
"aria-label"?: string;
|
|
534
|
-
/** Elemento o componente a renderizar */
|
|
535
|
-
as?: ElementType;
|
|
536
|
-
}
|
|
537
|
-
/**
|
|
538
|
-
* Props del componente SidebarToggle
|
|
539
|
-
* @interface
|
|
540
|
-
*/
|
|
541
|
-
interface SidebarToggleProps {
|
|
542
|
-
/** Contenido del botón (puede ser ReactNode o render prop) */
|
|
543
|
-
children?: ReactNode | SidebarToggleRenderProp;
|
|
544
|
-
/** Librería de iconos a utilizar (Lucide o custom) */
|
|
545
|
-
iconLibrary?: SidebarIconLibrary;
|
|
546
|
-
/** Clase CSS adicional */
|
|
547
|
-
className?: string;
|
|
548
|
-
/** Estilos inline */
|
|
549
|
-
style?: CSSProperties;
|
|
550
|
-
/** Label ARIA para el botón */
|
|
551
|
-
"aria-label"?: string;
|
|
552
|
-
/** Elemento o componente a renderizar */
|
|
553
|
-
as?: ElementType;
|
|
554
|
-
}
|
|
555
|
-
/**
|
|
556
|
-
* Props del componente SidebarContent
|
|
557
|
-
* @interface
|
|
558
|
-
*/
|
|
559
|
-
interface SidebarContentProps {
|
|
560
|
-
/** Contenido (items del sidebar) */
|
|
561
|
-
children: ReactNode;
|
|
562
|
-
/** Clase CSS adicional */
|
|
563
|
-
className?: string;
|
|
564
|
-
/** Estilos inline */
|
|
565
|
-
style?: CSSProperties;
|
|
566
|
-
/** Elemento o componente a renderizar */
|
|
567
|
-
as?: ElementType;
|
|
568
|
-
}
|
|
569
|
-
/**
|
|
570
|
-
* Props del componente SidebarIndicator
|
|
571
|
-
* @interface
|
|
572
|
-
*/
|
|
573
|
-
interface SidebarIndicatorProps {
|
|
574
|
-
/** Contenido personalizado del indicador (opcional) */
|
|
575
|
-
children?: ReactNode | SidebarIndicatorRenderProp;
|
|
576
|
-
/** Clase CSS adicional */
|
|
577
|
-
className?: string;
|
|
578
|
-
/** Estilos inline */
|
|
579
|
-
style?: CSSProperties;
|
|
580
|
-
/** Elemento o componente a renderizar */
|
|
581
|
-
as?: ElementType;
|
|
582
|
-
}
|
|
583
|
-
/**
|
|
584
|
-
* Props del componente SidebarSafeArea
|
|
585
|
-
* @interface
|
|
586
|
-
*/
|
|
587
|
-
interface SidebarSafeAreaProps {
|
|
588
|
-
/** Contenido del área segura */
|
|
589
|
-
children?: ReactNode;
|
|
590
|
-
/** Posición del área segura (top o bottom) */
|
|
591
|
-
position: SidebarSafeAreaPosition;
|
|
592
|
-
/** Porcentaje de altura del sidebar (override del config) */
|
|
593
|
-
percent?: number;
|
|
594
|
-
/** Clase CSS adicional */
|
|
595
|
-
className?: string;
|
|
596
|
-
/** Estilos inline */
|
|
597
|
-
style?: CSSProperties;
|
|
598
|
-
/** Elemento o componente a renderizar */
|
|
599
|
-
as?: ElementType;
|
|
600
|
-
}
|
|
601
|
-
/**
|
|
602
|
-
* Props del componente SidebarItem
|
|
603
|
-
* @interface
|
|
604
|
-
*/
|
|
605
|
-
interface SidebarItemProps {
|
|
606
|
-
/** URL de destino */
|
|
607
|
-
href?: string;
|
|
608
|
-
/** Icono del item */
|
|
609
|
-
icon?: ReactNode;
|
|
610
|
-
/** Label/texto del item */
|
|
611
|
-
label?: string;
|
|
612
|
-
/** Contenido del item (puede ser ReactNode o render prop) */
|
|
613
|
-
children?: ReactNode | SidebarItemRenderProp;
|
|
614
|
-
/** Componente Link personalizado (ej: React Router Link, Next Link) */
|
|
615
|
-
LinkComponent?: ComponentType<any>;
|
|
616
|
-
/** Props adicionales para el LinkComponent */
|
|
617
|
-
linkProps?: Record<string, any>;
|
|
618
|
-
/** Clase CSS adicional */
|
|
619
|
-
className?: string;
|
|
620
|
-
/** Estilos inline */
|
|
621
|
-
style?: CSSProperties;
|
|
622
|
-
/** Callback al hacer hover */
|
|
623
|
-
onHover?: () => void;
|
|
624
|
-
/** Callback al hacer click */
|
|
625
|
-
onClick?: () => void;
|
|
626
|
-
/** Item deshabilitado */
|
|
627
|
-
disabled?: boolean;
|
|
628
|
-
/** Elemento o componente a renderizar */
|
|
629
|
-
as?: ElementType;
|
|
630
|
-
}
|
|
631
|
-
/**
|
|
632
|
-
* Configuración completa del sidebar (sin partials)
|
|
633
|
-
*/
|
|
634
|
-
interface SidebarConfig {
|
|
635
|
-
defaultOpen: boolean;
|
|
636
|
-
collapseMode: SidebarCollapseMode;
|
|
637
|
-
hideBehaviour: SidebarHideBehaviour;
|
|
638
|
-
hideOpensBehavior: SidebarHideOpensBehavior;
|
|
639
|
-
layoutBehaviour: SidebarLayoutBehaviour;
|
|
640
|
-
dimensions: SidebarDimensions;
|
|
641
|
-
safeAreas: SidebarSafeAreas;
|
|
642
|
-
animations: SidebarAnimations;
|
|
643
|
-
toggleId: string;
|
|
644
|
-
debug: boolean;
|
|
645
|
-
liquidGlass: SidebarLiquidGlassConfig;
|
|
646
|
-
}
|
|
647
|
-
|
|
648
|
-
/**
|
|
649
|
-
* Componente raíz del Sidebar con arquitectura headless
|
|
650
|
-
*
|
|
651
|
-
* @description
|
|
652
|
-
* Componente principal que provee el contexto compartido a todos los
|
|
653
|
-
* componentes primitivos del sidebar (SidebarNav, SidebarToggle, etc.).
|
|
654
|
-
*
|
|
655
|
-
* Este componente NO renderiza ningún elemento visual por sí mismo,
|
|
656
|
-
* solo provee el Provider de contexto. Los estilos y estructura visual
|
|
657
|
-
* se definen componiendo los primitivos hijos.
|
|
658
|
-
*
|
|
659
|
-
* Soporta dos modos:
|
|
660
|
-
* - **Uncontrolled**: Usa `defaultOpen` para estado interno
|
|
661
|
-
* - **Controlled**: Usa `open` + `onOpenChange` para control externo
|
|
662
|
-
*
|
|
663
|
-
* También soporta render props para acceder al estado del sidebar:
|
|
664
|
-
*
|
|
665
|
-
* @example
|
|
666
|
-
* ```tsx
|
|
667
|
-
* // Uso básico (children estáticos)
|
|
668
|
-
* <Sidebar defaultOpen={true} collapseMode="collapse">
|
|
669
|
-
* <SidebarNav>
|
|
670
|
-
* <SidebarToggle />
|
|
671
|
-
* <SidebarContent>
|
|
672
|
-
* <SidebarItem href="/" icon={<HomeIcon />} />
|
|
673
|
-
* </SidebarContent>
|
|
674
|
-
* </SidebarNav>
|
|
675
|
-
* </Sidebar>
|
|
676
|
-
* ```
|
|
677
|
-
*
|
|
678
|
-
* @example
|
|
679
|
-
* ```tsx
|
|
680
|
-
* // Con render props (acceso al estado)
|
|
681
|
-
* <Sidebar>
|
|
682
|
-
* {({ open, collapsed }) => (
|
|
683
|
-
* <>
|
|
684
|
-
* <SidebarNav className={cn(!open && 'hidden')}>
|
|
685
|
-
* <SidebarContent>
|
|
686
|
-
* <SidebarItem label={open ? "Home" : undefined} />
|
|
687
|
-
* </SidebarContent>
|
|
688
|
-
* </SidebarNav>
|
|
689
|
-
* <div>Sidebar is {open ? 'open' : 'closed'}</div>
|
|
690
|
-
* </>
|
|
691
|
-
* )}
|
|
692
|
-
* </Sidebar>
|
|
693
|
-
* ```
|
|
694
|
-
*
|
|
695
|
-
* @example
|
|
696
|
-
* ```tsx
|
|
697
|
-
* // Modo controlled
|
|
698
|
-
* function App() {
|
|
699
|
-
* const [open, setOpen] = useState(true)
|
|
700
|
-
*
|
|
701
|
-
* return (
|
|
702
|
-
* <Sidebar open={open} onOpenChange={setOpen}>
|
|
703
|
-
* <SidebarNav>...</SidebarNav>
|
|
704
|
-
* </Sidebar>
|
|
705
|
-
* )
|
|
706
|
-
* }
|
|
707
|
-
* ```
|
|
708
|
-
*
|
|
709
|
-
* @example
|
|
710
|
-
* ```tsx
|
|
711
|
-
* // Con configuración custom
|
|
712
|
-
* <Sidebar
|
|
713
|
-
* collapseMode="hide"
|
|
714
|
-
* dimensions={{ expandedWidth: "20rem" }}
|
|
715
|
-
* animations={{ widthTransitionDuration: 500 }}
|
|
716
|
-
* >
|
|
717
|
-
* <SidebarNav>...</SidebarNav>
|
|
718
|
-
* </Sidebar>
|
|
719
|
-
* ```
|
|
720
|
-
*
|
|
721
|
-
* @note
|
|
722
|
-
* Los colores se obtienen automáticamente de los tokens CSS de shadcn definidos
|
|
723
|
-
* en globals.css (--sidebar, --sidebar-accent, --sidebar-primary, etc.)
|
|
724
|
-
*/
|
|
725
|
-
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;
|
|
726
|
-
|
|
727
|
-
/**
|
|
728
|
-
* Componente de navegación del Sidebar
|
|
729
|
-
*
|
|
730
|
-
* @description
|
|
731
|
-
* Contenedor de navegación que renderiza un elemento `<nav>` por defecto.
|
|
732
|
-
* Gestiona los eventos de mouse y teclado para el indicador visual y
|
|
733
|
-
* la navegación accesible.
|
|
734
|
-
*
|
|
735
|
-
* Este componente:
|
|
736
|
-
* - Aplica data attributes para reflejar el estado (open/collapsed)
|
|
737
|
-
* - Gestiona eventos de mouse para el indicador visual
|
|
738
|
-
* - Gestiona navegación por teclado (arrows, home, end)
|
|
739
|
-
* - Expone una ref al elemento DOM para mediciones
|
|
740
|
-
*
|
|
741
|
-
* Usa forwardRef para permitir acceso al elemento DOM desde componentes padre.
|
|
742
|
-
*
|
|
743
|
-
* @example
|
|
744
|
-
* ```tsx
|
|
745
|
-
* <Sidebar>
|
|
746
|
-
* <SidebarNav className="bg-zinc-900 border-zinc-800">
|
|
747
|
-
* <SidebarToggle />
|
|
748
|
-
* <SidebarIndicator />
|
|
749
|
-
* <SidebarContent>
|
|
750
|
-
* <SidebarItem href="/" />
|
|
751
|
-
* </SidebarContent>
|
|
752
|
-
* </SidebarNav>
|
|
753
|
-
* </Sidebar>
|
|
754
|
-
* ```
|
|
755
|
-
*
|
|
756
|
-
* @example
|
|
757
|
-
* ```tsx
|
|
758
|
-
* // Con data attributes para styling
|
|
759
|
-
* <SidebarNav className="data-[open=true]:w-64 data-[open=false]:w-16">
|
|
760
|
-
* {children}
|
|
761
|
-
* </SidebarNav>
|
|
762
|
-
* ```
|
|
763
|
-
*
|
|
764
|
-
* @example
|
|
765
|
-
* ```tsx
|
|
766
|
-
* // Con elemento personalizado
|
|
767
|
-
* <SidebarNav as="aside" aria-label="Navegación lateral">
|
|
768
|
-
* {children}
|
|
769
|
-
* </SidebarNav>
|
|
770
|
-
* ```
|
|
771
|
-
*/
|
|
772
|
-
declare const SidebarNav: react.ForwardRefExoticComponent<SidebarNavProps & react.RefAttributes<HTMLElement>>;
|
|
773
|
-
|
|
774
|
-
/**
|
|
775
|
-
* Componente de botón toggle del Sidebar
|
|
776
|
-
*
|
|
777
|
-
* @description
|
|
778
|
-
* Botón que controla el estado abierto/cerrado del sidebar.
|
|
779
|
-
* Renderiza un `<label>` por defecto que controla un checkbox oculto,
|
|
780
|
-
* permitiendo gestionar el estado con CSS puro (:checked selector).
|
|
781
|
-
*
|
|
782
|
-
* Características:
|
|
783
|
-
* - Soporta render props para acceso al estado (open, active)
|
|
784
|
-
* - Renderiza icono de chevron por defecto (customizable)
|
|
785
|
-
* - Aplica data attributes para styling CSS
|
|
786
|
-
* - Accesibilidad completa (aria-label, aria-expanded)
|
|
787
|
-
* - Soporta prop `as` para usar elemento/componente custom
|
|
788
|
-
*
|
|
789
|
-
* @example
|
|
790
|
-
* ```tsx
|
|
791
|
-
* // Uso básico con icono por defecto
|
|
792
|
-
* <SidebarToggle />
|
|
793
|
-
* ```
|
|
794
|
-
*
|
|
795
|
-
* @example
|
|
796
|
-
* ```tsx
|
|
797
|
-
* // Con render props para estado
|
|
798
|
-
* <SidebarToggle>
|
|
799
|
-
* {({ open, active }) => (
|
|
800
|
-
* <div className={cn(active && 'bg-blue-500')}>
|
|
801
|
-
* {open ? <CloseIcon /> : <MenuIcon />}
|
|
802
|
-
* </div>
|
|
803
|
-
* )}
|
|
804
|
-
* </SidebarToggle>
|
|
805
|
-
* ```
|
|
806
|
-
*
|
|
807
|
-
* @example
|
|
808
|
-
* ```tsx
|
|
809
|
-
* // Con icono custom
|
|
810
|
-
* <SidebarToggle className="bg-zinc-800">
|
|
811
|
-
* <CustomChevronIcon />
|
|
812
|
-
* </SidebarToggle>
|
|
813
|
-
* ```
|
|
814
|
-
*
|
|
815
|
-
* @example
|
|
816
|
-
* ```tsx
|
|
817
|
-
* // Como botón real (sin checkbox)
|
|
818
|
-
* <SidebarToggle as="button" onClick={() => setOpen(!open)}>
|
|
819
|
-
* Toggle
|
|
820
|
-
* </SidebarToggle>
|
|
821
|
-
* ```
|
|
822
|
-
*/
|
|
823
|
-
declare const SidebarToggle: react.ForwardRefExoticComponent<SidebarToggleProps & react.RefAttributes<HTMLButtonElement | HTMLLabelElement>>;
|
|
824
|
-
|
|
825
|
-
/**
|
|
826
|
-
* Componente de contenido del Sidebar (contenedor de items)
|
|
827
|
-
*
|
|
828
|
-
* @description
|
|
829
|
-
* Contenedor que agrupa los items de navegación (SidebarItem).
|
|
830
|
-
* Renderiza un `<div>` por defecto y aplica estilos de layout flex.
|
|
831
|
-
*
|
|
832
|
-
* Este componente:
|
|
833
|
-
* - Registra su ref en el contexto para cálculos del indicador
|
|
834
|
-
* - Aplica rol ARIA "list" para accesibilidad
|
|
835
|
-
* - Centra y distribuye items verticalmente
|
|
836
|
-
* - Permite customización completa con className y style
|
|
837
|
-
*
|
|
838
|
-
* Los items dentro de este contenedor son utilizados por:
|
|
839
|
-
* - useSidebarIndicator: Para calcular posición del indicador
|
|
840
|
-
* - useSidebarKeyboard: Para navegación por teclado
|
|
841
|
-
*
|
|
842
|
-
* @example
|
|
843
|
-
* ```tsx
|
|
844
|
-
* <SidebarNav>
|
|
845
|
-
* <SidebarContent>
|
|
846
|
-
* <SidebarItem href="/" icon={<HomeIcon />} />
|
|
847
|
-
* <SidebarItem href="/settings" icon={<SettingsIcon />} />
|
|
848
|
-
* </SidebarContent>
|
|
849
|
-
* </SidebarNav>
|
|
850
|
-
* ```
|
|
851
|
-
*
|
|
852
|
-
* @example
|
|
853
|
-
* ```tsx
|
|
854
|
-
* // Con estilos custom
|
|
855
|
-
* <SidebarContent className="gap-2 py-4">
|
|
856
|
-
* <SidebarItem href="/" />
|
|
857
|
-
* </SidebarContent>
|
|
858
|
-
* ```
|
|
859
|
-
*
|
|
860
|
-
* @example
|
|
861
|
-
* ```tsx
|
|
862
|
-
* // Como lista semántica
|
|
863
|
-
* <SidebarContent as="ul">
|
|
864
|
-
* <SidebarItem as="li" href="/" />
|
|
865
|
-
* </SidebarContent>
|
|
866
|
-
* ```
|
|
867
|
-
*/
|
|
868
|
-
declare const SidebarContent: react.ForwardRefExoticComponent<SidebarContentProps & react.RefAttributes<HTMLDivElement>>;
|
|
869
|
-
|
|
870
|
-
/**
|
|
871
|
-
* Componente de indicador visual del Sidebar
|
|
872
|
-
*
|
|
873
|
-
* @description
|
|
874
|
-
* Indicador visual que sigue al cursor del mouse (o item enfocado) dentro
|
|
875
|
-
* del área de navegación. Proporciona feedback visual claro al usuario.
|
|
876
|
-
*
|
|
877
|
-
* Características:
|
|
878
|
-
* - Se muestra solo cuando el mouse está sobre el área de items
|
|
879
|
-
* - Sigue al cursor con animación suave
|
|
880
|
-
* - Se posiciona en el item enfocado al navegar por teclado
|
|
881
|
-
* - Totalmente customizable con className y style
|
|
882
|
-
* - Soporta render props para control total del contenido
|
|
883
|
-
* - Color y dimensiones configurables via contexto
|
|
884
|
-
*
|
|
885
|
-
* El indicador se oculta automáticamente cuando:
|
|
886
|
-
* - El mouse sale del sidebar
|
|
887
|
-
* - El cursor está fuera del área de items
|
|
888
|
-
* - Se pierde el focus del sidebar
|
|
889
|
-
*
|
|
890
|
-
* @example
|
|
891
|
-
* ```tsx
|
|
892
|
-
* // Uso básico con estilos por defecto
|
|
893
|
-
* <SidebarNav>
|
|
894
|
-
* <SidebarIndicator />
|
|
895
|
-
* <SidebarContent>...</SidebarContent>
|
|
896
|
-
* </SidebarNav>
|
|
897
|
-
* ```
|
|
898
|
-
*
|
|
899
|
-
* @example
|
|
900
|
-
* ```tsx
|
|
901
|
-
* // Con estilos custom
|
|
902
|
-
* <SidebarIndicator className="bg-red-500 w-1" />
|
|
903
|
-
* ```
|
|
904
|
-
*
|
|
905
|
-
* @example
|
|
906
|
-
* ```tsx
|
|
907
|
-
* // Con render props
|
|
908
|
-
* <SidebarIndicator>
|
|
909
|
-
* {({ visible, position }) => (
|
|
910
|
-
* <div
|
|
911
|
-
* className={cn('indicator', visible && 'opacity-100')}
|
|
912
|
-
* style={{ top: position }}
|
|
913
|
-
* >
|
|
914
|
-
* <span>→</span>
|
|
915
|
-
* </div>
|
|
916
|
-
* )}
|
|
917
|
-
* </SidebarIndicator>
|
|
918
|
-
* ```
|
|
919
|
-
*
|
|
920
|
-
* @example
|
|
921
|
-
* ```tsx
|
|
922
|
-
* // Como elemento custom
|
|
923
|
-
* <SidebarIndicator as={motion.div} animate={{ opacity: 1 }} />
|
|
924
|
-
* ```
|
|
925
|
-
*/
|
|
926
|
-
declare const SidebarIndicator: react.ForwardRefExoticComponent<SidebarIndicatorProps & react.RefAttributes<HTMLDivElement>>;
|
|
927
|
-
|
|
928
|
-
/**
|
|
929
|
-
* Props del SidebarFluidIndicator
|
|
930
|
-
* @interface
|
|
931
|
-
*/
|
|
932
|
-
interface SidebarFluidIndicatorProps {
|
|
933
|
-
/** Elemento del item actualmente hovered/focused */
|
|
934
|
-
targetElement: HTMLElement | null;
|
|
935
|
-
/** Indica si el indicador está visible */
|
|
936
|
-
isVisible: boolean;
|
|
937
|
-
}
|
|
938
|
-
/**
|
|
939
|
-
* Componente wrapper de FluidHoverIndicator para Sidebar
|
|
940
|
-
*
|
|
941
|
-
* @description
|
|
942
|
-
* Wrapper que conecta el FluidHoverIndicator (glassmorphism + spring physics)
|
|
943
|
-
* con el sistema de estado del Sidebar. Este componente decide automáticamente
|
|
944
|
-
* qué versión renderizar basándose en las feature flags:
|
|
945
|
-
*
|
|
946
|
-
* - **V1 (default)**: FluidHoverIndicator con backdrop-blur CSS básico
|
|
947
|
-
* - **V2 (experimental)**: FluidHoverIndicatorV2 con SVG displacement mapping
|
|
948
|
-
*
|
|
949
|
-
* Feature flags del contexto:
|
|
950
|
-
* - `liquidGlass.enableLiquidGlassV2`: Activa la versión V2
|
|
951
|
-
* - `liquidGlass.enableChromaticAberration`: Activa chromatic aberration (Phase 2)
|
|
952
|
-
*
|
|
953
|
-
* @example
|
|
954
|
-
* ```tsx
|
|
955
|
-
* <SidebarNav>
|
|
956
|
-
* <SidebarIndicator />
|
|
957
|
-
* <SidebarFluidIndicator targetElement={currentItemElement} isVisible={isVisible} />
|
|
958
|
-
* <SidebarContent>...</SidebarContent>
|
|
959
|
-
* </SidebarNav>
|
|
960
|
-
* ```
|
|
961
|
-
*/
|
|
962
|
-
declare function SidebarFluidIndicator({ targetElement, isVisible }: SidebarFluidIndicatorProps): react_jsx_runtime.JSX.Element;
|
|
963
|
-
|
|
964
|
-
/**
|
|
965
|
-
* Componente de área segura del Sidebar
|
|
966
|
-
*
|
|
967
|
-
* @description
|
|
968
|
-
* Área reservada en la parte superior o inferior del sidebar para
|
|
969
|
-
* contenido especial como logos, usuario, configuración, etc.
|
|
970
|
-
*
|
|
971
|
-
* Las áreas seguras:
|
|
972
|
-
* - No contienen items de navegación
|
|
973
|
-
* - Tienen altura porcentual configurable
|
|
974
|
-
* - Pueden mostrar patrones de debug
|
|
975
|
-
* - Son completamente customizables
|
|
976
|
-
*
|
|
977
|
-
* Casos de uso comunes:
|
|
978
|
-
* - Top: Logo, título de la aplicación, búsqueda
|
|
979
|
-
* - Bottom: Usuario, configuración, logout
|
|
980
|
-
*
|
|
981
|
-
* @example
|
|
982
|
-
* ```tsx
|
|
983
|
-
* <SidebarNav>
|
|
984
|
-
* <SidebarSafeArea position="top" percent={20}>
|
|
985
|
-
* <img src="/logo.png" alt="Logo" />
|
|
986
|
-
* </SidebarSafeArea>
|
|
987
|
-
*
|
|
988
|
-
* <SidebarContent>
|
|
989
|
-
* <SidebarItem href="/" />
|
|
990
|
-
* </SidebarContent>
|
|
991
|
-
*
|
|
992
|
-
* <SidebarSafeArea position="bottom" percent={15}>
|
|
993
|
-
* <UserProfile />
|
|
994
|
-
* </SidebarSafeArea>
|
|
995
|
-
* </SidebarNav>
|
|
996
|
-
* ```
|
|
997
|
-
*
|
|
998
|
-
* @example
|
|
999
|
-
* ```tsx
|
|
1000
|
-
* // Con estilos custom
|
|
1001
|
-
* <SidebarSafeArea
|
|
1002
|
-
* position="top"
|
|
1003
|
-
* className="bg-zinc-950 border-b border-zinc-800"
|
|
1004
|
-
* >
|
|
1005
|
-
* <h1>Mi App</h1>
|
|
1006
|
-
* </SidebarSafeArea>
|
|
1007
|
-
* ```
|
|
1008
|
-
*
|
|
1009
|
-
* @example
|
|
1010
|
-
* ```tsx
|
|
1011
|
-
* // Override de porcentaje
|
|
1012
|
-
* <SidebarSafeArea position="bottom" percent={30}>
|
|
1013
|
-
* <ExtendedFooter />
|
|
1014
|
-
* </SidebarSafeArea>
|
|
1015
|
-
* ```
|
|
1016
|
-
*/
|
|
1017
|
-
declare const SidebarSafeArea: react.ForwardRefExoticComponent<SidebarSafeAreaProps & react.RefAttributes<HTMLDivElement>>;
|
|
1018
|
-
|
|
1019
|
-
/**
|
|
1020
|
-
* Componente item de navegación del Sidebar
|
|
1021
|
-
*
|
|
1022
|
-
* @description
|
|
1023
|
-
* Item individual de navegación dentro del sidebar.
|
|
1024
|
-
* Renderiza un `<a>` por defecto, pero puede ser cualquier elemento
|
|
1025
|
-
* o componente (ej: React Router Link, Next.js Link).
|
|
1026
|
-
*
|
|
1027
|
-
* Características:
|
|
1028
|
-
* - Soporta iconos y labels
|
|
1029
|
-
* - Gestiona estados de hover y focus
|
|
1030
|
-
* - Se registra automáticamente para navegación por teclado
|
|
1031
|
-
* - Aplica data attributes para styling
|
|
1032
|
-
* - Soporta render props para control total
|
|
1033
|
-
* - Compatible con React Router, Next.js, etc. via prop `as`
|
|
1034
|
-
* - Label oculto automáticamente cuando sidebar está colapsado (via CSS container queries)
|
|
1035
|
-
*
|
|
1036
|
-
* @example
|
|
1037
|
-
* ```tsx
|
|
1038
|
-
* // Uso básico
|
|
1039
|
-
* <SidebarItem
|
|
1040
|
-
* href="/"
|
|
1041
|
-
* icon={<HomeIcon />}
|
|
1042
|
-
* label="Home"
|
|
1043
|
-
* />
|
|
1044
|
-
* ```
|
|
1045
|
-
*
|
|
1046
|
-
* @example
|
|
1047
|
-
* ```tsx
|
|
1048
|
-
* // Con React Router
|
|
1049
|
-
* <SidebarItem
|
|
1050
|
-
* as={Link}
|
|
1051
|
-
* to="/dashboard"
|
|
1052
|
-
* icon={<DashboardIcon />}
|
|
1053
|
-
* label="Dashboard"
|
|
1054
|
-
* />
|
|
1055
|
-
* ```
|
|
1056
|
-
*
|
|
1057
|
-
* @example
|
|
1058
|
-
* ```tsx
|
|
1059
|
-
* // Con Next.js Link
|
|
1060
|
-
* <SidebarItem
|
|
1061
|
-
* LinkComponent={Link}
|
|
1062
|
-
* href="/profile"
|
|
1063
|
-
* icon={<UserIcon />}
|
|
1064
|
-
* label="Profile"
|
|
1065
|
-
* />
|
|
1066
|
-
* ```
|
|
1067
|
-
*
|
|
1068
|
-
* @example
|
|
1069
|
-
* ```tsx
|
|
1070
|
-
* // Con render props
|
|
1071
|
-
* <SidebarItem href="/settings">
|
|
1072
|
-
* {({ focused, hovered, disabled }) => (
|
|
1073
|
-
* <div className={cn(
|
|
1074
|
-
* 'flex items-center gap-2',
|
|
1075
|
-
* focused && 'ring-2',
|
|
1076
|
-
* hovered && 'bg-zinc-800',
|
|
1077
|
-
* disabled && 'opacity-50'
|
|
1078
|
-
* )}>
|
|
1079
|
-
* <SettingsIcon />
|
|
1080
|
-
* <span>Settings</span>
|
|
1081
|
-
* </div>
|
|
1082
|
-
* )}
|
|
1083
|
-
* </SidebarItem>
|
|
1084
|
-
* ```
|
|
1085
|
-
*
|
|
1086
|
-
* @example
|
|
1087
|
-
* ```tsx
|
|
1088
|
-
* // Con callbacks
|
|
1089
|
-
* <SidebarItem
|
|
1090
|
-
* href="/analytics"
|
|
1091
|
-
* icon={<ChartIcon />}
|
|
1092
|
-
* label="Analytics"
|
|
1093
|
-
* onHover={() => prefetchAnalytics()}
|
|
1094
|
-
* onClick={() => trackNavigation('analytics')}
|
|
1095
|
-
* />
|
|
1096
|
-
* ```
|
|
1097
|
-
*/
|
|
1098
|
-
declare const SidebarItem: react.ForwardRefExoticComponent<SidebarItemProps & react.RefAttributes<HTMLAnchorElement>>;
|
|
1099
|
-
|
|
1100
|
-
interface SidebarSubContentProps {
|
|
1101
|
-
children: ReactNode;
|
|
1102
|
-
title?: string;
|
|
1103
|
-
}
|
|
1104
|
-
declare function SidebarSubContent({ children, title }: SidebarSubContentProps): null;
|
|
1105
|
-
declare namespace SidebarSubContent {
|
|
1106
|
-
var displayName: string;
|
|
1107
|
-
}
|
|
1108
|
-
|
|
1109
|
-
interface SidebarSubLinkProps {
|
|
1110
|
-
href: string;
|
|
1111
|
-
children: ReactNode;
|
|
1112
|
-
icon?: ReactNode;
|
|
1113
|
-
LinkComponent?: ComponentType<any>;
|
|
1114
|
-
linkProps?: Record<string, any>;
|
|
1115
|
-
className?: string;
|
|
1116
|
-
onClick?: (e: MouseEvent$1<HTMLAnchorElement>) => void;
|
|
1117
|
-
animationOrder?: number;
|
|
1118
|
-
animationState?: 'entering' | 'leaving' | 'static';
|
|
1119
|
-
style?: CSSProperties;
|
|
1120
|
-
}
|
|
1121
|
-
declare function SidebarSubLink({ href, children, icon, LinkComponent, linkProps, className, onClick, animationOrder, animationState, style, }: SidebarSubLinkProps): react_jsx_runtime.JSX.Element;
|
|
1122
|
-
declare namespace SidebarSubLink {
|
|
1123
|
-
var displayName: string;
|
|
1124
|
-
}
|
|
1125
|
-
|
|
1126
|
-
interface SidebarTooltipProps {
|
|
1127
|
-
/** Contenido del tooltip */
|
|
1128
|
-
children: ReactNode;
|
|
1129
|
-
/** Título opcional del tooltip */
|
|
1130
|
-
title?: string;
|
|
1131
|
-
/** Modo debug para visualizar safety triangle y layers */
|
|
1132
|
-
debug?: boolean;
|
|
1133
|
-
/** Handler llamado cuando el mouse sale del tooltip */
|
|
1134
|
-
onMouseLeave?: () => void;
|
|
1135
|
-
/** Habilitar liquid glass con SVG displacement filters (false = backdrop-blur básico) */
|
|
1136
|
-
enableLiquidGlass?: boolean;
|
|
1137
|
-
/** Habilitar Edge Glass 3D (dual backdrop layers para profundidad) */
|
|
1138
|
-
enableEdgeGlass3D?: boolean;
|
|
1139
|
-
/** Habilitar Backdrop Extension (Josh Comeau technique - 200% height) */
|
|
1140
|
-
enableBackdropExtension?: boolean;
|
|
1141
|
-
/** Habilitar chromatic aberration RGB (requiere enableLiquidGlass) */
|
|
1142
|
-
enableChromaticAberration?: boolean;
|
|
1143
|
-
/** Habilitar animaciones staggered de items (entrada/salida escalonada) */
|
|
1144
|
-
enableTooltipItemAnimations?: boolean;
|
|
1145
|
-
/** Habilitar animación 3D de cilindro para el título del tooltip */
|
|
1146
|
-
enableCylinderTitle?: boolean;
|
|
1147
|
-
}
|
|
1148
|
-
declare const SidebarTooltip: react.NamedExoticComponent<SidebarTooltipProps>;
|
|
1149
|
-
|
|
1150
|
-
/**
|
|
1151
|
-
* Hook para acceder al contexto del Sidebar
|
|
1152
|
-
*
|
|
1153
|
-
* @description
|
|
1154
|
-
* Hook personalizado que provee acceso al contexto compartido del Sidebar.
|
|
1155
|
-
* Debe ser utilizado dentro de un componente que esté envuelto por
|
|
1156
|
-
* `<Sidebar>` o `<SidebarProvider>`.
|
|
1157
|
-
*
|
|
1158
|
-
* Lanza un error si se utiliza fuera del contexto apropiado, ayudando
|
|
1159
|
-
* a detectar problemas de composición durante el desarrollo.
|
|
1160
|
-
*
|
|
1161
|
-
* @throws {Error} Si se usa fuera de un SidebarProvider
|
|
1162
|
-
*
|
|
1163
|
-
* @returns {SidebarContextValue} El valor del contexto del sidebar
|
|
1164
|
-
*
|
|
1165
|
-
* @example
|
|
1166
|
-
* ```tsx
|
|
1167
|
-
* function CustomToggle() {
|
|
1168
|
-
* const { open, setOpen } = useSidebarContext()
|
|
1169
|
-
*
|
|
1170
|
-
* return (
|
|
1171
|
-
* <button onClick={() => setOpen(!open)}>
|
|
1172
|
-
* {open ? 'Cerrar' : 'Abrir'}
|
|
1173
|
-
* </button>
|
|
1174
|
-
* )
|
|
1175
|
-
* }
|
|
1176
|
-
* ```
|
|
1177
|
-
*
|
|
1178
|
-
* @example
|
|
1179
|
-
* ```tsx
|
|
1180
|
-
* // Acceder a configuración
|
|
1181
|
-
* function CustomItem() {
|
|
1182
|
-
* const { colors, dimensions } = useSidebarContext()
|
|
1183
|
-
*
|
|
1184
|
-
* return (
|
|
1185
|
-
* <div style={{
|
|
1186
|
-
* background: colors.hover,
|
|
1187
|
-
* width: dimensions.expandedWidth
|
|
1188
|
-
* }}>
|
|
1189
|
-
* Item
|
|
1190
|
-
* </div>
|
|
1191
|
-
* )
|
|
1192
|
-
* }
|
|
1193
|
-
* ```
|
|
1194
|
-
*/
|
|
1195
|
-
declare function useSidebarContext(): SidebarContextValue;
|
|
1196
|
-
|
|
1197
|
-
/**
|
|
1198
|
-
* Valor de retorno del hook useSidebarKeyboard
|
|
1199
|
-
* @interface
|
|
1200
|
-
*/
|
|
1201
|
-
interface UseSidebarKeyboardReturn {
|
|
1202
|
-
/** Índice del item actualmente enfocado (-1 si ninguno) */
|
|
1203
|
-
focusedIndex: number;
|
|
1204
|
-
/** Función para cambiar el índice enfocado manualmente */
|
|
1205
|
-
setFocusedIndex: (index: number) => void;
|
|
1206
|
-
/** Callback para actualizar el indicador según el item enfocado */
|
|
1207
|
-
updateIndicatorForFocus: (index: number) => void;
|
|
1208
|
-
}
|
|
1209
|
-
/**
|
|
1210
|
-
* Hook para gestionar la navegación por teclado en el Sidebar
|
|
1211
|
-
*
|
|
1212
|
-
* @description
|
|
1213
|
-
* Hook que implementa navegación accesible por teclado para los items
|
|
1214
|
-
* del sidebar, siguiendo las especificaciones WAI-ARIA:
|
|
1215
|
-
*
|
|
1216
|
-
* - ArrowDown: Navegar al siguiente item
|
|
1217
|
-
* - ArrowUp: Navegar al item anterior
|
|
1218
|
-
* - Home: Ir al primer item
|
|
1219
|
-
* - End: Ir al último item
|
|
1220
|
-
* - Tab: Navegación estándar que actualiza el indicador
|
|
1221
|
-
*
|
|
1222
|
-
* También sincroniza el indicador visual con el item enfocado.
|
|
1223
|
-
*
|
|
1224
|
-
* @returns {UseSidebarKeyboardReturn} Estado y funciones para navegación
|
|
1225
|
-
*
|
|
1226
|
-
* @example
|
|
1227
|
-
* ```tsx
|
|
1228
|
-
* function SidebarNav() {
|
|
1229
|
-
* const { focusedIndex, updateIndicatorForFocus } = useSidebarKeyboard()
|
|
1230
|
-
*
|
|
1231
|
-
* return (
|
|
1232
|
-
* <nav>
|
|
1233
|
-
* {items.map((item, index) => (
|
|
1234
|
-
* <SidebarItem
|
|
1235
|
-
* key={item.id}
|
|
1236
|
-
* focused={index === focusedIndex}
|
|
1237
|
-
* onFocus={() => updateIndicatorForFocus(index)}
|
|
1238
|
-
* />
|
|
1239
|
-
* ))}
|
|
1240
|
-
* </nav>
|
|
1241
|
-
* )
|
|
1242
|
-
* }
|
|
1243
|
-
* ```
|
|
1244
|
-
*/
|
|
1245
|
-
declare function useSidebarKeyboard(): UseSidebarKeyboardReturn;
|
|
1246
|
-
|
|
1247
|
-
/**
|
|
1248
|
-
* Valor de retorno del hook useSidebarIndicator
|
|
1249
|
-
* @interface
|
|
1250
|
-
*/
|
|
1251
|
-
interface UseSidebarIndicatorReturn {
|
|
1252
|
-
/** Indica si el indicador está visible */
|
|
1253
|
-
isVisible: boolean;
|
|
1254
|
-
/** Indica si el mouse está sobre el área de items */
|
|
1255
|
-
isOverItems: boolean;
|
|
1256
|
-
/** Elemento del item actualmente hovered o enfocado (para FluidHoverIndicator) */
|
|
1257
|
-
currentItemElement: HTMLElement | null;
|
|
1258
|
-
/** ID del item bajo el indicador (para tooltip con subContent) */
|
|
1259
|
-
hoveredItemId: string | null;
|
|
1260
|
-
/** Label del item hovered (para tooltip simple) */
|
|
1261
|
-
hoveredLabel: string | null;
|
|
1262
|
-
/** Manejador de evento mousemove */
|
|
1263
|
-
handleMouseMove: (e: MouseEvent$1<HTMLDivElement>) => void;
|
|
1264
|
-
/** Manejador de evento mouseenter */
|
|
1265
|
-
handleMouseEnter: () => void;
|
|
1266
|
-
/** Manejador de evento mouseleave */
|
|
1267
|
-
handleMouseLeave: () => void;
|
|
1268
|
-
/** Manejador de evento focus */
|
|
1269
|
-
handleFocus: () => void;
|
|
1270
|
-
/** Manejador de evento blur */
|
|
1271
|
-
handleBlur: (e: React.FocusEvent) => void;
|
|
1272
|
-
/** Función para limpiar el estado hovered desde fuera (tooltip mouseleave) */
|
|
1273
|
-
clearHoveredState: () => void;
|
|
1274
|
-
}
|
|
1275
|
-
/**
|
|
1276
|
-
* Hook para gestionar el indicador visual del Sidebar
|
|
1277
|
-
*
|
|
1278
|
-
* @description
|
|
1279
|
-
* Hook que implementa la lógica del indicador visual que sigue al cursor
|
|
1280
|
-
* del mouse dentro del sidebar. El indicador se muestra cuando:
|
|
1281
|
-
* - El mouse está sobre el sidebar (isHovering = true)
|
|
1282
|
-
* - El cursor está en el área de items (isOverItems = true)
|
|
1283
|
-
*
|
|
1284
|
-
* Utiliza requestAnimationFrame para optimizar el rendimiento y evitar
|
|
1285
|
-
* cálculos excesivos durante el movimiento del mouse.
|
|
1286
|
-
*
|
|
1287
|
-
* El indicador también se actualiza cuando se navega por teclado,
|
|
1288
|
-
* integrándose con useSidebarKeyboard.
|
|
1289
|
-
*
|
|
1290
|
-
* @returns {UseSidebarIndicatorReturn} Estado y manejadores de eventos
|
|
1291
|
-
*
|
|
1292
|
-
* @example
|
|
1293
|
-
* ```tsx
|
|
1294
|
-
* function SidebarNav() {
|
|
1295
|
-
* const {
|
|
1296
|
-
* isVisible,
|
|
1297
|
-
* handleMouseMove,
|
|
1298
|
-
* handleMouseEnter,
|
|
1299
|
-
* handleMouseLeave
|
|
1300
|
-
* } = useSidebarIndicator()
|
|
1301
|
-
*
|
|
1302
|
-
* return (
|
|
1303
|
-
* <nav
|
|
1304
|
-
* onMouseMove={handleMouseMove}
|
|
1305
|
-
* onMouseEnter={handleMouseEnter}
|
|
1306
|
-
* onMouseLeave={handleMouseLeave}
|
|
1307
|
-
* >
|
|
1308
|
-
* <SidebarIndicator visible={isVisible} />
|
|
1309
|
-
* {children}
|
|
1310
|
-
* </nav>
|
|
1311
|
-
* )
|
|
1312
|
-
* }
|
|
1313
|
-
* ```
|
|
1314
|
-
*/
|
|
1315
|
-
declare function useSidebarIndicator(): UseSidebarIndicatorReturn;
|
|
1316
|
-
|
|
1317
|
-
interface SubContentData {
|
|
1318
|
-
itemId: string;
|
|
1319
|
-
subContent: ReactNode;
|
|
1320
|
-
title?: string;
|
|
1321
|
-
}
|
|
1322
|
-
|
|
1323
|
-
declare function useSubContent(): {
|
|
1324
|
-
subContentMap: Map<string, SubContentData>;
|
|
1325
|
-
registerSubContent: (itemId: string, data: SubContentData) => void;
|
|
1326
|
-
unregisterSubContent: (itemId: string) => void;
|
|
1327
|
-
getSubContent: (itemId: string) => SubContentData | undefined;
|
|
1328
|
-
};
|
|
1329
|
-
|
|
1330
|
-
/**
|
|
1331
|
-
* Dimensiones por defecto del sidebar
|
|
1332
|
-
* @constant
|
|
1333
|
-
*/
|
|
1334
|
-
declare const DEFAULT_DIMENSIONS: SidebarDimensions;
|
|
1335
|
-
/**
|
|
1336
|
-
* Áreas seguras por defecto
|
|
1337
|
-
* @constant
|
|
1338
|
-
*/
|
|
1339
|
-
declare const DEFAULT_SAFE_AREAS: SidebarSafeAreas;
|
|
1340
|
-
/**
|
|
1341
|
-
* Animaciones por defecto
|
|
1342
|
-
* @constant
|
|
1343
|
-
*/
|
|
1344
|
-
declare const DEFAULT_ANIMATIONS: SidebarAnimations;
|
|
1345
|
-
/**
|
|
1346
|
-
* Configuración por defecto del sidebar
|
|
1347
|
-
* @constant
|
|
1348
|
-
*
|
|
1349
|
-
* @description
|
|
1350
|
-
* Los colores se obtienen automáticamente de los tokens CSS de shadcn:
|
|
1351
|
-
* - --sidebar: Color de fondo
|
|
1352
|
-
* - --sidebar-foreground: Color de texto
|
|
1353
|
-
* - --sidebar-primary: Color primario (indicador)
|
|
1354
|
-
* - --sidebar-accent: Color de hover
|
|
1355
|
-
* - --sidebar-border: Color de bordes
|
|
1356
|
-
*/
|
|
1357
|
-
declare const DEFAULT_CONFIG: SidebarConfig;
|
|
1358
|
-
/**
|
|
1359
|
-
* Teclas de navegación del sidebar
|
|
1360
|
-
* @constant
|
|
1361
|
-
*/
|
|
1362
|
-
declare const SIDEBAR_KEYBOARD_KEYS: {
|
|
1363
|
-
/** Flecha abajo - navegar al siguiente item */
|
|
1364
|
-
readonly ARROW_DOWN: "ArrowDown";
|
|
1365
|
-
/** Flecha arriba - navegar al item anterior */
|
|
1366
|
-
readonly ARROW_UP: "ArrowUp";
|
|
1367
|
-
/** Home - ir al primer item */
|
|
1368
|
-
readonly HOME: "Home";
|
|
1369
|
-
/** End - ir al último item */
|
|
1370
|
-
readonly END: "End";
|
|
1371
|
-
/** Tab - navegación estándar */
|
|
1372
|
-
readonly TAB: "Tab";
|
|
1373
|
-
/** Escape - cerrar sidebar o quitar focus */
|
|
1374
|
-
readonly ESCAPE: "Escape";
|
|
1375
|
-
};
|
|
1376
|
-
/**
|
|
1377
|
-
* Atributos data-* para styling CSS y selección de elementos
|
|
1378
|
-
* @constant
|
|
1379
|
-
*/
|
|
1380
|
-
declare const SIDEBAR_DATA_ATTRIBUTES: {
|
|
1381
|
-
/** data-open - indica si el sidebar está abierto */
|
|
1382
|
-
readonly OPEN: "data-open";
|
|
1383
|
-
/** data-collapsed - indica si el sidebar está colapsado */
|
|
1384
|
-
readonly COLLAPSED: "data-collapsed";
|
|
1385
|
-
/** data-focused - indica si un elemento está enfocado */
|
|
1386
|
-
readonly FOCUSED: "data-focused";
|
|
1387
|
-
/** data-hovered - indica si el mouse está sobre un elemento */
|
|
1388
|
-
readonly HOVERED: "data-hovered";
|
|
1389
|
-
/** data-disabled - indica si un elemento está deshabilitado */
|
|
1390
|
-
readonly DISABLED: "data-disabled";
|
|
1391
|
-
/** data-sidebar-item - marca un item del sidebar para navegación */
|
|
1392
|
-
readonly ITEM: "data-sidebar-item";
|
|
1393
|
-
/** data-active - indica si un toggle/botón está activo */
|
|
1394
|
-
readonly ACTIVE: "data-active";
|
|
1395
|
-
/** data-visible - indica si un elemento es visible */
|
|
1396
|
-
readonly VISIBLE: "data-visible";
|
|
1397
|
-
};
|
|
1398
|
-
/**
|
|
1399
|
-
* Clases Tailwind reutilizables para componentes del sidebar
|
|
1400
|
-
* @constant
|
|
1401
|
-
*/
|
|
1402
|
-
declare const SIDEBAR_TAILWIND_CLASSES: {
|
|
1403
|
-
/** Clases base para el wrapper */
|
|
1404
|
-
readonly wrapper: "relative";
|
|
1405
|
-
/** Clases base para el nav */
|
|
1406
|
-
readonly nav: "relative h-screen border-r";
|
|
1407
|
-
/** Clases base para el indicador */
|
|
1408
|
-
readonly indicator: "absolute left-0 rounded-r-full pointer-events-none";
|
|
1409
|
-
/** Clases base para el botón toggle */
|
|
1410
|
-
readonly toggleButton: "block w-6 h-6 rounded-full cursor-pointer flex items-center justify-center transition-colors";
|
|
1411
|
-
/** Clases para el wrapper del botón toggle */
|
|
1412
|
-
readonly toggleButtonWrapper: "absolute top-6 z-30";
|
|
1413
|
-
/** Clases base para el contenedor de items */
|
|
1414
|
-
readonly content: "flex flex-col items-center";
|
|
1415
|
-
/** Clases base para áreas seguras */
|
|
1416
|
-
readonly safeArea: "flex items-center justify-center";
|
|
1417
|
-
/** Clases de borde debug */
|
|
1418
|
-
readonly debugBorder: "border-dashed";
|
|
1419
|
-
/** Clases de focus ring (accesibilidad) */
|
|
1420
|
-
readonly focusRing: "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:ring-offset-2";
|
|
1421
|
-
/** Clases SR-only (screen reader only) */
|
|
1422
|
-
readonly srOnly: "sr-only";
|
|
1423
|
-
};
|
|
1424
|
-
/**
|
|
1425
|
-
* Patrones visuales para modo debug
|
|
1426
|
-
* @constant
|
|
1427
|
-
*/
|
|
1428
|
-
declare const SIDEBAR_DEBUG_PATTERNS: {
|
|
1429
|
-
/** Patrón de rayas para áreas seguras */
|
|
1430
|
-
readonly safeArea: "repeating-linear-gradient(45deg, transparent, transparent 10px, rgba(255,255,255,0.03) 10px, rgba(255,255,255,0.03) 20px)";
|
|
1431
|
-
/** Fondo semi-transparente para área de contenido */
|
|
1432
|
-
readonly contentArea: "rgba(0, 0, 0, 0.5)";
|
|
1433
|
-
/** Color de borde para debug */
|
|
1434
|
-
readonly borderColor: "rgb(34 197 94)";
|
|
1435
|
-
/** Opacidad de borde debug */
|
|
1436
|
-
readonly borderOpacity: "0.3";
|
|
1437
|
-
};
|
|
1438
|
-
/**
|
|
1439
|
-
* Roles ARIA para accesibilidad
|
|
1440
|
-
* @constant
|
|
1441
|
-
*/
|
|
1442
|
-
declare const SIDEBAR_ARIA_ROLES: {
|
|
1443
|
-
/** Rol para el nav principal */
|
|
1444
|
-
readonly navigation: "navigation";
|
|
1445
|
-
/** Rol para lista de items */
|
|
1446
|
-
readonly list: "list";
|
|
1447
|
-
/** Rol para item individual */
|
|
1448
|
-
readonly listitem: "listitem";
|
|
1449
|
-
/** Rol para botón toggle */
|
|
1450
|
-
readonly button: "button";
|
|
1451
|
-
};
|
|
1452
|
-
/**
|
|
1453
|
-
* Labels ARIA por defecto para accesibilidad
|
|
1454
|
-
* @constant
|
|
1455
|
-
*/
|
|
1456
|
-
declare const SIDEBAR_ARIA_LABELS: {
|
|
1457
|
-
/** Label para toggle */
|
|
1458
|
-
readonly toggleSidebar: "Alternar sidebar";
|
|
1459
|
-
/** Label para navegación principal */
|
|
1460
|
-
readonly mainNavigation: "Navegación principal";
|
|
1461
|
-
/** Label cuando sidebar está abierto */
|
|
1462
|
-
readonly sidebarOpen: "Sidebar abierto";
|
|
1463
|
-
/** Label cuando sidebar está cerrado */
|
|
1464
|
-
readonly sidebarClosed: "Sidebar cerrado";
|
|
1465
|
-
};
|
|
1466
|
-
/**
|
|
1467
|
-
* Configuración de estilo visual por defecto del sidebar
|
|
1468
|
-
* @constant
|
|
1469
|
-
*/
|
|
1470
|
-
declare const DEFAULT_VISUAL_STYLE: {
|
|
1471
|
-
readonly marginTop: "0";
|
|
1472
|
-
readonly marginBottom: "0";
|
|
1473
|
-
readonly marginLeft: "0";
|
|
1474
|
-
readonly marginRight: "0";
|
|
1475
|
-
readonly height: "100vh";
|
|
1476
|
-
readonly borderRadius: "0";
|
|
1477
|
-
readonly boxShadow: "none";
|
|
1478
|
-
};
|
|
1479
|
-
/**
|
|
1480
|
-
* Preconfiguraciones de estilo visual para el sidebar
|
|
1481
|
-
* @constant
|
|
1482
|
-
*/
|
|
1483
|
-
declare const SIDEBAR_VISUAL_PRESETS: {
|
|
1484
|
-
/** Estilo por defecto: pegado a bordes */
|
|
1485
|
-
readonly DEFAULT: {
|
|
1486
|
-
readonly marginTop: "0";
|
|
1487
|
-
readonly marginBottom: "0";
|
|
1488
|
-
readonly marginLeft: "0";
|
|
1489
|
-
readonly marginRight: "0";
|
|
1490
|
-
readonly height: "100vh";
|
|
1491
|
-
readonly borderRadius: "0";
|
|
1492
|
-
readonly boxShadow: "none";
|
|
1493
|
-
};
|
|
1494
|
-
/** Estilo floating: separado y con sombra */
|
|
1495
|
-
readonly FLOATING_CARD: {
|
|
1496
|
-
readonly marginTop: "1rem";
|
|
1497
|
-
readonly marginBottom: "1rem";
|
|
1498
|
-
readonly marginLeft: "1rem";
|
|
1499
|
-
readonly marginRight: "0";
|
|
1500
|
-
readonly height: "calc(100vh - 2rem)";
|
|
1501
|
-
readonly borderRadius: "0.75rem";
|
|
1502
|
-
readonly boxShadow: "0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04)";
|
|
1503
|
-
};
|
|
1504
|
-
/** Estilo moderno: esquinas redondeadas suaves */
|
|
1505
|
-
readonly MODERN_ROUNDED: {
|
|
1506
|
-
readonly marginTop: "0.5rem";
|
|
1507
|
-
readonly marginBottom: "0.5rem";
|
|
1508
|
-
readonly marginLeft: "0.5rem";
|
|
1509
|
-
readonly marginRight: "0";
|
|
1510
|
-
readonly height: "calc(100vh - 1rem)";
|
|
1511
|
-
readonly borderRadius: "1rem";
|
|
1512
|
-
readonly boxShadow: "0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)";
|
|
1513
|
-
};
|
|
1514
|
-
/** Estilo minimal: ligera separación */
|
|
1515
|
-
readonly MINIMAL_SPACED: {
|
|
1516
|
-
readonly marginTop: "0.25rem";
|
|
1517
|
-
readonly marginBottom: "0.25rem";
|
|
1518
|
-
readonly marginLeft: "0.25rem";
|
|
1519
|
-
readonly marginRight: "0";
|
|
1520
|
-
readonly height: "calc(100vh - 0.5rem)";
|
|
1521
|
-
readonly borderRadius: "0.5rem";
|
|
1522
|
-
readonly boxShadow: "0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06)";
|
|
1523
|
-
};
|
|
1524
|
-
};
|
|
1525
|
-
/**
|
|
1526
|
-
* Tipo para los presets de estilo visual
|
|
1527
|
-
*/
|
|
1528
|
-
type SidebarVisualPreset = keyof typeof SIDEBAR_VISUAL_PRESETS;
|
|
1529
|
-
/**
|
|
1530
|
-
* Breakpoints para responsive behavior
|
|
1531
|
-
* @constant
|
|
1532
|
-
*/
|
|
1533
|
-
declare const SIDEBAR_BREAKPOINTS: {
|
|
1534
|
-
/** Ancho mínimo para mostrar sidebar expandido */
|
|
1535
|
-
readonly minExpandedWidth: 768;
|
|
1536
|
-
/** Ancho mínimo para sidebar colapsado */
|
|
1537
|
-
readonly minCollapsedWidth: 640;
|
|
1538
|
-
/** Ancho para forzar modo mobile */
|
|
1539
|
-
readonly mobileWidth: 480;
|
|
1540
|
-
};
|
|
1541
|
-
/**
|
|
1542
|
-
* Límites y valores seguros para validación
|
|
1543
|
-
* @constant
|
|
1544
|
-
*/
|
|
1545
|
-
declare const SIDEBAR_LIMITS: {
|
|
1546
|
-
/** Porcentaje mínimo para safe area */
|
|
1547
|
-
readonly minSafeAreaPercent: 0;
|
|
1548
|
-
/** Porcentaje máximo para safe area */
|
|
1549
|
-
readonly maxSafeAreaPercent: 50;
|
|
1550
|
-
/** Número máximo de items recomendado */
|
|
1551
|
-
readonly maxRecommendedItems: 20;
|
|
1552
|
-
/** Duración mínima de transición (ms) */
|
|
1553
|
-
readonly minTransitionDuration: 0;
|
|
1554
|
-
/** Duración máxima de transición (ms) */
|
|
1555
|
-
readonly maxTransitionDuration: 1000;
|
|
1556
|
-
};
|
|
1557
|
-
/**
|
|
1558
|
-
* Nombres de CSS variables utilizadas
|
|
1559
|
-
* @constant
|
|
1560
|
-
*/
|
|
1561
|
-
declare const SIDEBAR_CSS_VARIABLES: {
|
|
1562
|
-
/** Ancho cuando cerrado */
|
|
1563
|
-
readonly widthClosed: "--sidebar-width-closed";
|
|
1564
|
-
/** Ancho cuando abierto */
|
|
1565
|
-
readonly widthOpen: "--sidebar-width-open";
|
|
1566
|
-
/** Ancho actual */
|
|
1567
|
-
readonly width: "--sidebar-width";
|
|
1568
|
-
/** Color de fondo */
|
|
1569
|
-
readonly background: "--sidebar-bg";
|
|
1570
|
-
/** Color de borde (variable interna para evitar colisión con --sidebar-border de shadcn) */
|
|
1571
|
-
readonly borderColor: "--sidebar-border-color";
|
|
1572
|
-
/** Color de hover */
|
|
1573
|
-
readonly hover: "--sidebar-hover";
|
|
1574
|
-
/** Color del indicador */
|
|
1575
|
-
readonly indicator: "--sidebar-indicator";
|
|
1576
|
-
/** Altura del indicador */
|
|
1577
|
-
readonly indicatorHeight: "--sidebar-indicator-height";
|
|
1578
|
-
/** Distancia del tooltip al sidebar */
|
|
1579
|
-
readonly tooltipDistance: "--sidebar-tooltip-distance";
|
|
1580
|
-
/** Comportamiento de layout */
|
|
1581
|
-
readonly layoutBehaviour: "--sidebar-layout-behaviour";
|
|
1582
|
-
/** Flag para modo inline */
|
|
1583
|
-
readonly isInline: "--sidebar-is-inline";
|
|
1584
|
-
/** Variables de estilo visual */
|
|
1585
|
-
readonly marginTop: "--sidebar-margin-top";
|
|
1586
|
-
readonly marginBottom: "--sidebar-margin-bottom";
|
|
1587
|
-
readonly marginLeft: "--sidebar-margin-left";
|
|
1588
|
-
readonly marginRight: "--sidebar-margin-right";
|
|
1589
|
-
readonly sidebarHeight: "--sidebar-height";
|
|
1590
|
-
readonly sidebarBorderRadius: "--sidebar-border-radius";
|
|
1591
|
-
readonly sidebarBoxShadow: "--sidebar-box-shadow";
|
|
1592
|
-
};
|
|
1593
|
-
|
|
1594
|
-
/**
|
|
1595
|
-
* Configuración para el generador de estilos
|
|
1596
|
-
* @interface
|
|
1597
|
-
*/
|
|
1598
|
-
interface StyleGeneratorConfig {
|
|
1599
|
-
dimensions: SidebarDimensions;
|
|
1600
|
-
animations: SidebarAnimations;
|
|
1601
|
-
collapseMode: SidebarCollapseMode;
|
|
1602
|
-
hideOpensBehavior: SidebarHideOpensBehavior;
|
|
1603
|
-
layoutBehaviour: SidebarLayoutBehaviour;
|
|
1604
|
-
visualStyle: SidebarVisualStyle;
|
|
1605
|
-
}
|
|
1606
|
-
/**
|
|
1607
|
-
* Genera los estilos CSS del sidebar usando CSS-in-JS y tokens de shadcn
|
|
1608
|
-
*
|
|
1609
|
-
* @description
|
|
1610
|
-
* Función que genera todo el CSS necesario para el sidebar,
|
|
1611
|
-
* utilizando los tokens CSS de shadcn definidos en globals.css:
|
|
1612
|
-
*
|
|
1613
|
-
* **Tokens utilizados:**
|
|
1614
|
-
* - `--sidebar`: Color de fondo
|
|
1615
|
-
* - `--sidebar-foreground`: Color de texto
|
|
1616
|
-
* - `--sidebar-primary`: Color primario (indicador, elementos activos)
|
|
1617
|
-
* - `--sidebar-accent`: Color de hover y estados secundarios
|
|
1618
|
-
* - `--sidebar-border`: Color de bordes
|
|
1619
|
-
* - `--sidebar-ring`: Color de focus ring (accesibilidad)
|
|
1620
|
-
*
|
|
1621
|
-
* Usa CSS Layers para organización y control de especificidad:
|
|
1622
|
-
* - sidebar-base: Variables y estilos base
|
|
1623
|
-
* - sidebar-states: Estados (:checked, :hover, etc.)
|
|
1624
|
-
* - sidebar-animations: Transiciones y animaciones
|
|
1625
|
-
*
|
|
1626
|
-
* @param {StyleGeneratorConfig} config - Configuración de dimensiones y animaciones
|
|
1627
|
-
* @returns {string} String con el CSS completo
|
|
1628
|
-
*
|
|
1629
|
-
* @example
|
|
1630
|
-
* ```tsx
|
|
1631
|
-
* const styles = generateSidebarStyles({
|
|
1632
|
-
* dimensions: DEFAULT_DIMENSIONS,
|
|
1633
|
-
* animations: DEFAULT_ANIMATIONS,
|
|
1634
|
-
* collapseMode: SidebarCollapseMode.COLLAPSE,
|
|
1635
|
-
* hideOpensBehavior: SidebarHideOpensBehavior.COLLAPSED
|
|
1636
|
-
* })
|
|
1637
|
-
*
|
|
1638
|
-
* <style jsx>{styles}</style>
|
|
1639
|
-
* ```
|
|
1640
|
-
*
|
|
1641
|
-
* @note
|
|
1642
|
-
* Los colores NO se configuran aquí, se obtienen automáticamente de los tokens
|
|
1643
|
-
* CSS de shadcn. Esto permite soporte automático para dark/light mode.
|
|
1644
|
-
*/
|
|
1645
|
-
declare function generateSidebarStyles({ dimensions, animations, collapseMode, hideOpensBehavior, layoutBehaviour, visualStyle, }: StyleGeneratorConfig): string;
|
|
1646
|
-
/**
|
|
1647
|
-
* Genera estilos para el indicador visual usando tokens CSS
|
|
1648
|
-
*
|
|
1649
|
-
* @description
|
|
1650
|
-
* Función auxiliar para generar estilos dinámicos del indicador.
|
|
1651
|
-
* Útil para aplicar estilos inline con estado reactivo.
|
|
1652
|
-
*
|
|
1653
|
-
* Utiliza el token `--sidebar-primary` para el color del indicador,
|
|
1654
|
-
* asegurando consistencia con el theme del sidebar.
|
|
1655
|
-
*
|
|
1656
|
-
* @param {boolean} isVisible - Si el indicador está visible
|
|
1657
|
-
* @returns {React.CSSProperties} Objeto de estilos inline
|
|
1658
|
-
*
|
|
1659
|
-
* @example
|
|
1660
|
-
* ```tsx
|
|
1661
|
-
* const indicatorStyles = generateIndicatorStyles(isHovering && isOverItems)
|
|
1662
|
-
*
|
|
1663
|
-
* <div style={indicatorStyles} />
|
|
1664
|
-
* ```
|
|
1665
|
-
*/
|
|
1666
|
-
declare function generateIndicatorStyles(isVisible: boolean): React.CSSProperties;
|
|
1667
|
-
|
|
1668
|
-
/**
|
|
1669
|
-
* Visual variant of the navigation bar
|
|
1670
|
-
* @enum {string}
|
|
1671
|
-
* @description Defines the visual style of the bottom navigation
|
|
1672
|
-
*/
|
|
1673
|
-
declare enum NavVariant {
|
|
1674
|
-
/** Glassmorphism effect with blur and transparency */
|
|
1675
|
-
GLASS = "glass",
|
|
1676
|
-
/** Solid background without transparency */
|
|
1677
|
-
SOLID = "solid",
|
|
1678
|
-
/** Transparent background - headless mode for custom styling */
|
|
1679
|
-
HEADLESS = "headless"
|
|
1680
|
-
}
|
|
1681
|
-
/**
|
|
1682
|
-
* Size preset for the navigation bar
|
|
1683
|
-
* @enum {string}
|
|
1684
|
-
* @description Controls the overall size and spacing of navigation elements
|
|
1685
|
-
*/
|
|
1686
|
-
declare enum NavSize {
|
|
1687
|
-
/** Compact size - 56px height, smaller touch targets */
|
|
1688
|
-
SMALL = "sm",
|
|
1689
|
-
/** Default size - 72px height, optimal touch targets */
|
|
1690
|
-
MEDIUM = "md",
|
|
1691
|
-
/** Large size - 88px height, larger touch targets */
|
|
1692
|
-
LARGE = "lg"
|
|
1693
|
-
}
|
|
1694
|
-
/**
|
|
1695
|
-
* Position of the label relative to the icon
|
|
1696
|
-
* @enum {string}
|
|
1697
|
-
* @description Determines how labels are displayed in navigation items
|
|
1698
|
-
*/
|
|
1699
|
-
declare enum LabelPosition {
|
|
1700
|
-
/** Label below the icon (default mobile pattern) */
|
|
1701
|
-
BELOW = "below",
|
|
1702
|
-
/** Label beside the icon (horizontal layout) */
|
|
1703
|
-
BESIDE = "beside",
|
|
1704
|
-
/** No label, icon only */
|
|
1705
|
-
HIDDEN = "hidden"
|
|
1706
|
-
}
|
|
1707
|
-
/**
|
|
1708
|
-
* Animation type for navigation interactions
|
|
1709
|
-
* @enum {string}
|
|
1710
|
-
* @description Defines the animation behavior for navigation items
|
|
1711
|
-
*/
|
|
1712
|
-
declare enum AnimationType {
|
|
1713
|
-
/** Spring animation for natural feel */
|
|
1714
|
-
SPRING = "spring",
|
|
1715
|
-
/** Tween animation for precise timing */
|
|
1716
|
-
TWEEN = "tween",
|
|
1717
|
-
/** No animation */
|
|
1718
|
-
NONE = "none"
|
|
1719
|
-
}
|
|
1720
|
-
/**
|
|
1721
|
-
* State of a navigation item
|
|
1722
|
-
* @enum {string}
|
|
1723
|
-
* @description Represents the current state of a navigation item
|
|
1724
|
-
*/
|
|
1725
|
-
declare enum NavItemState {
|
|
1726
|
-
/** Default inactive state */
|
|
1727
|
-
INACTIVE = "inactive",
|
|
1728
|
-
/** Currently selected/active item */
|
|
1729
|
-
ACTIVE = "active",
|
|
1730
|
-
/** Disabled and non-interactive */
|
|
1731
|
-
DISABLED = "disabled"
|
|
1732
|
-
}
|
|
1733
|
-
/**
|
|
1734
|
-
* Icon size preset
|
|
1735
|
-
* @enum {number}
|
|
1736
|
-
* @description Standard icon sizes in pixels
|
|
1737
|
-
*/
|
|
1738
|
-
declare enum IconSize {
|
|
1739
|
-
/** Small icons - 18px */
|
|
1740
|
-
SMALL = 18,
|
|
1741
|
-
/** Medium icons - 24px (default) */
|
|
1742
|
-
MEDIUM = 24,
|
|
1743
|
-
/** Large icons - 28px */
|
|
1744
|
-
LARGE = 28
|
|
1745
|
-
}
|
|
1746
|
-
/**
|
|
1747
|
-
* Z-index levels for layering
|
|
1748
|
-
* @enum {number}
|
|
1749
|
-
* @description Consistent z-index values for proper stacking
|
|
1750
|
-
*/
|
|
1751
|
-
declare enum ZIndexLevel {
|
|
1752
|
-
/** Below default content */
|
|
1753
|
-
BELOW = 40,
|
|
1754
|
-
/** Default navigation level */
|
|
1755
|
-
DEFAULT = 50,
|
|
1756
|
-
/** Above most content */
|
|
1757
|
-
ELEVATED = 60,
|
|
1758
|
-
/** Maximum elevation */
|
|
1759
|
-
MAX = 100
|
|
1760
|
-
}
|
|
1761
|
-
/**
|
|
1762
|
-
* Blur intensity for glassmorphism
|
|
1763
|
-
* @enum {number}
|
|
1764
|
-
* @description Backdrop blur values in pixels
|
|
1765
|
-
*/
|
|
1766
|
-
declare enum BlurIntensity {
|
|
1767
|
-
/** Subtle blur - 8px */
|
|
1768
|
-
LIGHT = 8,
|
|
1769
|
-
/** Standard blur - 20px (default) */
|
|
1770
|
-
MEDIUM = 20,
|
|
1771
|
-
/** Heavy blur - 40px */
|
|
1772
|
-
HEAVY = 40
|
|
1773
|
-
}
|
|
1774
|
-
/**
|
|
1775
|
-
* Border radius preset for navigation
|
|
1776
|
-
* @enum {string}
|
|
1777
|
-
* @description Defines the border radius style
|
|
1778
|
-
*/
|
|
1779
|
-
declare enum NavBorderRadius {
|
|
1780
|
-
/** No border radius */
|
|
1781
|
-
NONE = "none",
|
|
1782
|
-
/** Small radius - 8px */
|
|
1783
|
-
SMALL = "sm",
|
|
1784
|
-
/** Medium radius - 16px (default) */
|
|
1785
|
-
MEDIUM = "md",
|
|
1786
|
-
/** Large radius - 24px */
|
|
1787
|
-
LARGE = "lg",
|
|
1788
|
-
/** Extra large radius - 32px */
|
|
1789
|
-
EXTRA_LARGE = "xl",
|
|
1790
|
-
/** Full rounded (pill shape) */
|
|
1791
|
-
FULL = "full"
|
|
1792
|
-
}
|
|
1793
|
-
/**
|
|
1794
|
-
* Gap spacing preset for items
|
|
1795
|
-
* @enum {number}
|
|
1796
|
-
* @description Standard gap values in rem units
|
|
1797
|
-
*/
|
|
1798
|
-
declare enum NavGap {
|
|
1799
|
-
/** No gap */
|
|
1800
|
-
NONE = 0,
|
|
1801
|
-
/** Extra small - 0.25rem (4px) */
|
|
1802
|
-
EXTRA_SMALL = 0.25,
|
|
1803
|
-
/** Small - 0.5rem (8px) */
|
|
1804
|
-
SMALL = 0.5,
|
|
1805
|
-
/** Medium - 1rem (16px) */
|
|
1806
|
-
MEDIUM = 1,
|
|
1807
|
-
/** Large - 1.5rem (24px) */
|
|
1808
|
-
LARGE = 1.5,
|
|
1809
|
-
/** Extra large - 2rem (32px) */
|
|
1810
|
-
EXTRA_LARGE = 2
|
|
1811
|
-
}
|
|
1812
|
-
/**
|
|
1813
|
-
* Spring animation configuration
|
|
1814
|
-
* @interface SpringConfig
|
|
1815
|
-
* @description Configuration for spring-based animations
|
|
1816
|
-
*/
|
|
1817
|
-
interface SpringConfig {
|
|
1818
|
-
/** Spring stiffness (default: 400) */
|
|
1819
|
-
stiffness: number;
|
|
1820
|
-
/** Damping ratio (default: 30) */
|
|
1821
|
-
damping: number;
|
|
1822
|
-
/** Mass of the animated element (default: 1) */
|
|
1823
|
-
mass: number;
|
|
1824
|
-
}
|
|
1825
|
-
/**
|
|
1826
|
-
* Tween animation configuration
|
|
1827
|
-
* @interface TweenConfig
|
|
1828
|
-
* @description Configuration for tween-based animations
|
|
1829
|
-
*/
|
|
1830
|
-
interface TweenConfig {
|
|
1831
|
-
/** Duration in seconds */
|
|
1832
|
-
duration: number;
|
|
1833
|
-
/** Easing function name */
|
|
1834
|
-
ease: "linear" | "easeIn" | "easeOut" | "easeInOut";
|
|
1835
|
-
}
|
|
1836
|
-
/**
|
|
1837
|
-
* Animation configuration union type
|
|
1838
|
-
* @interface AnimationConfig
|
|
1839
|
-
* @description Complete animation configuration options
|
|
1840
|
-
*/
|
|
1841
|
-
interface AnimationConfig {
|
|
1842
|
-
/** Type of animation to use */
|
|
1843
|
-
type: AnimationType;
|
|
1844
|
-
/** Spring configuration (when type is SPRING) */
|
|
1845
|
-
spring?: SpringConfig;
|
|
1846
|
-
/** Tween configuration (when type is TWEEN) */
|
|
1847
|
-
tween?: TweenConfig;
|
|
1848
|
-
/** Scale factor for press animation */
|
|
1849
|
-
pressScale?: number;
|
|
1850
|
-
/** Scale factor for hover animation */
|
|
1851
|
-
hoverScale?: number;
|
|
1852
|
-
}
|
|
1853
|
-
/**
|
|
1854
|
-
* Glassmorphism style configuration
|
|
1855
|
-
* @interface GlassConfig
|
|
1856
|
-
* @description Configuration for glassmorphism visual effects
|
|
1857
|
-
*/
|
|
1858
|
-
interface GlassConfig {
|
|
1859
|
-
/** Blur intensity in pixels */
|
|
1860
|
-
blur: BlurIntensity | number;
|
|
1861
|
-
/** Saturation percentage (100-200) */
|
|
1862
|
-
saturation: number;
|
|
1863
|
-
/** Background opacity (0-1) */
|
|
1864
|
-
opacity: number;
|
|
1865
|
-
/** Border opacity (0-1) */
|
|
1866
|
-
borderOpacity: number;
|
|
1867
|
-
}
|
|
1868
|
-
/**
|
|
1869
|
-
* Base props shared by all MobileBottomNav components
|
|
1870
|
-
* @interface BaseNavProps
|
|
1871
|
-
* @description Common properties for navigation components
|
|
1872
|
-
*/
|
|
1873
|
-
interface BaseNavProps {
|
|
1874
|
-
/** Additional CSS classes */
|
|
1875
|
-
className?: string;
|
|
1876
|
-
/** Inline styles */
|
|
1877
|
-
style?: react__default.CSSProperties;
|
|
1878
|
-
/** Test ID for testing */
|
|
1879
|
-
"data-testid"?: string;
|
|
1880
|
-
}
|
|
1881
|
-
/**
|
|
1882
|
-
* Motion-specific props for components using Framer Motion
|
|
1883
|
-
* @interface MotionProps
|
|
1884
|
-
* @description Props that are specific to Framer Motion components
|
|
1885
|
-
*/
|
|
1886
|
-
interface MotionProps {
|
|
1887
|
-
onDrag?: (event: MouseEvent | TouchEvent | PointerEvent, info: any) => void;
|
|
1888
|
-
onDragStart?: (event: MouseEvent | TouchEvent | PointerEvent, info: any) => void;
|
|
1889
|
-
onDragEnd?: (event: MouseEvent | TouchEvent | PointerEvent, info: any) => void;
|
|
1890
|
-
drag?: boolean | "x" | "y";
|
|
1891
|
-
dragConstraints?: any;
|
|
1892
|
-
dragMomentum?: boolean;
|
|
1893
|
-
dragElastic?: boolean;
|
|
1894
|
-
dragPropagation?: boolean;
|
|
1895
|
-
dragTransition?: any;
|
|
1896
|
-
whileTap?: any;
|
|
1897
|
-
whileHover?: any;
|
|
1898
|
-
animate?: any;
|
|
1899
|
-
initial?: any;
|
|
1900
|
-
exit?: any;
|
|
1901
|
-
transition?: any;
|
|
1902
|
-
}
|
|
1903
|
-
/**
|
|
1904
|
-
* Root component props
|
|
1905
|
-
* @interface RootProps
|
|
1906
|
-
* @description Properties for the MobileBottomNav.Root component
|
|
1907
|
-
*/
|
|
1908
|
-
interface RootProps extends BaseNavProps, Omit<HTMLAttributes<HTMLElement>, "className" | "style" | keyof MotionProps> {
|
|
1909
|
-
/** Child components (NavList, custom content) */
|
|
1910
|
-
children: ReactNode;
|
|
1911
|
-
/** Visual variant of the navigation */
|
|
1912
|
-
variant?: NavVariant;
|
|
1913
|
-
/** Size preset */
|
|
1914
|
-
size?: NavSize;
|
|
1915
|
-
/** Z-index level */
|
|
1916
|
-
zIndex?: ZIndexLevel | number;
|
|
1917
|
-
/** Show/hide the navigation */
|
|
1918
|
-
visible?: boolean;
|
|
1919
|
-
/** Glassmorphism configuration (only for GLASS variant) */
|
|
1920
|
-
glassConfig?: Partial<GlassConfig>;
|
|
1921
|
-
/** Animation configuration */
|
|
1922
|
-
animationConfig?: Partial<AnimationConfig>;
|
|
1923
|
-
/** ARIA label for accessibility */
|
|
1924
|
-
"aria-label"?: string;
|
|
1925
|
-
/** Use full width container (adds max-width and centers) */
|
|
1926
|
-
full?: boolean;
|
|
1927
|
-
/** Border radius preset or custom value */
|
|
1928
|
-
rounded?: NavBorderRadius | number;
|
|
1929
|
-
/** Gap between nav items (uses NavGap enum or custom rem value) */
|
|
1930
|
-
gap?: NavGap | number;
|
|
1931
|
-
}
|
|
1932
|
-
/**
|
|
1933
|
-
* Props for the NavList component
|
|
1934
|
-
* @interface NavListProps
|
|
1935
|
-
* @extends {BaseNavProps}
|
|
1936
|
-
* @description Configuration for the navigation items container
|
|
1937
|
-
*/
|
|
1938
|
-
interface NavListProps extends BaseNavProps, Omit<ComponentPropsWithoutRef<"ul">, "className" | "style"> {
|
|
1939
|
-
/** NavItem children */
|
|
1940
|
-
children: ReactNode;
|
|
1941
|
-
/** Gap between items (in rem or px) */
|
|
1942
|
-
gap?: number;
|
|
1943
|
-
/** Justify content alignment */
|
|
1944
|
-
justify?: "start" | "center" | "end" | "around" | "between" | "evenly";
|
|
1945
|
-
}
|
|
1946
|
-
/**
|
|
1947
|
-
* Props for the NavItem component
|
|
1948
|
-
* @interface NavItemProps
|
|
1949
|
-
* @extends {BaseNavProps}
|
|
1950
|
-
* @extends {Omit<ComponentPropsWithoutRef<"button">, "className" | "style" | "children">}
|
|
1951
|
-
* @description Configuration for individual navigation items
|
|
1952
|
-
*/
|
|
1953
|
-
interface NavItemProps extends BaseNavProps, Omit<ComponentPropsWithoutRef<"button">, "className" | "style" | "children"> {
|
|
1954
|
-
/** Icon element to display */
|
|
1955
|
-
icon: ReactNode;
|
|
1956
|
-
/** Label text */
|
|
1957
|
-
label: string;
|
|
1958
|
-
/** Current state of the item */
|
|
1959
|
-
state?: NavItemState;
|
|
1960
|
-
/** Label position relative to icon */
|
|
1961
|
-
labelPosition?: LabelPosition;
|
|
1962
|
-
/** Click handler */
|
|
1963
|
-
onClick?: () => void;
|
|
1964
|
-
/** Href for navigation (renders as anchor) */
|
|
1965
|
-
href?: string;
|
|
1966
|
-
/** Icon size */
|
|
1967
|
-
iconSize?: IconSize | number;
|
|
1968
|
-
/** Show badge indicator */
|
|
1969
|
-
badge?: ReactNode;
|
|
1970
|
-
/** Accessible name override */
|
|
1971
|
-
"aria-label"?: string;
|
|
1972
|
-
}
|
|
1973
|
-
/**
|
|
1974
|
-
* Navigation context value
|
|
1975
|
-
* @interface NavContextValue
|
|
1976
|
-
* @description Shared context for navigation components
|
|
1977
|
-
*/
|
|
1978
|
-
interface NavContextValue {
|
|
1979
|
-
/** Current variant */
|
|
1980
|
-
variant: NavVariant;
|
|
1981
|
-
/** Current size */
|
|
1982
|
-
size: NavSize;
|
|
1983
|
-
/** Animation configuration */
|
|
1984
|
-
animationConfig: AnimationConfig;
|
|
1985
|
-
/** Gap between items (inherited from Root) */
|
|
1986
|
-
gap?: NavGap | number;
|
|
1987
|
-
/** Currently active item ID */
|
|
1988
|
-
activeItemId?: string;
|
|
1989
|
-
/** Callback to set active item */
|
|
1990
|
-
setActiveItem?: (id: string) => void;
|
|
1991
|
-
}
|
|
1992
|
-
/**
|
|
1993
|
-
* Default spring animation configuration
|
|
1994
|
-
* @constant
|
|
1995
|
-
*/
|
|
1996
|
-
declare const DEFAULT_SPRING_CONFIG: SpringConfig;
|
|
1997
|
-
/**
|
|
1998
|
-
* Default tween animation configuration
|
|
1999
|
-
* @constant
|
|
2000
|
-
*/
|
|
2001
|
-
declare const DEFAULT_TWEEN_CONFIG: TweenConfig;
|
|
2002
|
-
/**
|
|
2003
|
-
* Default animation configuration
|
|
2004
|
-
* @constant
|
|
2005
|
-
*/
|
|
2006
|
-
declare const DEFAULT_ANIMATION_CONFIG: AnimationConfig;
|
|
2007
|
-
/**
|
|
2008
|
-
* Default glassmorphism configuration
|
|
2009
|
-
* @constant
|
|
2010
|
-
*/
|
|
2011
|
-
declare const DEFAULT_GLASS_CONFIG: GlassConfig;
|
|
2012
|
-
|
|
2013
|
-
/**
|
|
2014
|
-
* @fileoverview MobileBottomNav component with slot architecture
|
|
2015
|
-
* @description A composable bottom navigation component optimized for mobile devices
|
|
2016
|
-
* @module MobileBottomNav
|
|
2017
|
-
* @version 2.0.0 - iOS 26 compatibility update
|
|
2018
|
-
*/
|
|
2019
|
-
|
|
2020
|
-
/**
|
|
2021
|
-
* Spacer component to prevent content from being hidden under navigation
|
|
2022
|
-
*
|
|
2023
|
-
* @component
|
|
2024
|
-
* @example
|
|
2025
|
-
* \`\`\`tsx
|
|
2026
|
-
* <main>
|
|
2027
|
-
* {content}
|
|
2028
|
-
* <MobileBottomNav.Spacer />
|
|
2029
|
-
* </main>
|
|
2030
|
-
* \`\`\`
|
|
2031
|
-
*
|
|
2032
|
-
* @param {object} props - Component props
|
|
2033
|
-
* @returns {React.ReactElement} Spacer element
|
|
2034
|
-
*/
|
|
2035
|
-
interface SpacerProps {
|
|
2036
|
-
/** Additional CSS classes */
|
|
2037
|
-
className?: string;
|
|
2038
|
-
/** Size matching the navigation */
|
|
2039
|
-
size?: NavSize;
|
|
2040
|
-
}
|
|
2041
|
-
/**
|
|
2042
|
-
* MobileBottomNav compound component
|
|
2043
|
-
*
|
|
2044
|
-
* A fully accessible, mobile-optimized bottom navigation with:
|
|
2045
|
-
* - Slot-based architecture (Root, NavList, NavItem)
|
|
2046
|
-
* - Glassmorphism visual effects
|
|
2047
|
-
* - Motion animations
|
|
2048
|
-
* - Safe area support for notched devices
|
|
2049
|
-
* - Headless mode for custom styling
|
|
2050
|
-
*
|
|
2051
|
-
* @example
|
|
2052
|
-
* \`\`\`tsx
|
|
2053
|
-
* <MobileBottomNav.Root variant={NavVariant.GLASS}>
|
|
2054
|
-
* <MobileBottomNav.NavList>
|
|
2055
|
-
* <MobileBottomNav.NavItem
|
|
2056
|
-
* icon={<Home />}
|
|
2057
|
-
* label="Home"
|
|
2058
|
-
* state={NavItemState.ACTIVE}
|
|
2059
|
-
* />
|
|
2060
|
-
* <MobileBottomNav.NavItem
|
|
2061
|
-
* icon={<Search />}
|
|
2062
|
-
* label="Search"
|
|
2063
|
-
* />
|
|
2064
|
-
* </MobileBottomNav.NavList>
|
|
2065
|
-
* </MobileBottomNav.Root>
|
|
2066
|
-
* \`\`\`
|
|
2067
|
-
*/
|
|
2068
|
-
declare const MobileBottomNav: {
|
|
2069
|
-
Root: react.ForwardRefExoticComponent<RootProps & react.RefAttributes<HTMLElement>>;
|
|
2070
|
-
NavList: react.ForwardRefExoticComponent<NavListProps & react.RefAttributes<HTMLUListElement>>;
|
|
2071
|
-
NavItem: react.ForwardRefExoticComponent<NavItemProps & react.RefAttributes<HTMLButtonElement>>;
|
|
2072
|
-
Spacer: react.FC<SpacerProps>;
|
|
2073
|
-
};
|
|
2074
|
-
|
|
2075
|
-
/**
|
|
2076
|
-
* Root container styles with variant support
|
|
2077
|
-
* @description Styles for the main navigation wrapper
|
|
2078
|
-
*/
|
|
2079
|
-
declare const rootVariants: (props?: ({
|
|
2080
|
-
variant?: NavVariant | null | undefined;
|
|
2081
|
-
size?: NavSize | null | undefined;
|
|
2082
|
-
visible?: boolean | null | undefined;
|
|
2083
|
-
full?: boolean | null | undefined;
|
|
2084
|
-
rounded?: "none" | "sm" | "md" | "lg" | "xl" | "full" | null | undefined;
|
|
2085
|
-
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
2086
|
-
/**
|
|
2087
|
-
* Extract variant props type for Root
|
|
2088
|
-
*/
|
|
2089
|
-
type RootVariantProps = VariantProps<typeof rootVariants>;
|
|
2090
|
-
/**
|
|
2091
|
-
* Navigation list styles
|
|
2092
|
-
* @description Styles for the ul element containing nav items
|
|
2093
|
-
*/
|
|
2094
|
-
declare const navListVariants: (props?: ({
|
|
2095
|
-
size?: NavSize | null | undefined;
|
|
2096
|
-
justify?: "center" | "start" | "end" | "around" | "between" | "evenly" | null | undefined;
|
|
2097
|
-
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
2098
|
-
/**
|
|
2099
|
-
* Extract variant props type for NavList
|
|
2100
|
-
*/
|
|
2101
|
-
type NavListVariantProps = VariantProps<typeof navListVariants>;
|
|
2102
|
-
/**
|
|
2103
|
-
* Navigation item styles
|
|
2104
|
-
* @description Styles for individual navigation buttons/links
|
|
2105
|
-
*/
|
|
2106
|
-
declare const navItemVariants: (props?: ({
|
|
2107
|
-
state?: NavItemState | null | undefined;
|
|
2108
|
-
labelPosition?: LabelPosition | null | undefined;
|
|
2109
|
-
size?: NavSize | null | undefined;
|
|
2110
|
-
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
2111
|
-
/**
|
|
2112
|
-
* Extract variant props type for NavItem
|
|
2113
|
-
*/
|
|
2114
|
-
type NavItemVariantProps = VariantProps<typeof navItemVariants>;
|
|
2115
|
-
/**
|
|
2116
|
-
* Icon container styles
|
|
2117
|
-
* @description Styles for the icon wrapper
|
|
2118
|
-
*/
|
|
2119
|
-
declare const iconVariants: (props?: ({
|
|
2120
|
-
size?: IconSize | null | undefined;
|
|
2121
|
-
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
2122
|
-
/**
|
|
2123
|
-
* Extract variant props type for Icon
|
|
2124
|
-
*/
|
|
2125
|
-
type IconVariantProps = VariantProps<typeof iconVariants>;
|
|
2126
|
-
/**
|
|
2127
|
-
* Label text styles
|
|
2128
|
-
* @description Styles for the navigation item label
|
|
2129
|
-
*/
|
|
2130
|
-
declare const labelVariants: (props?: ({
|
|
2131
|
-
position?: LabelPosition | null | undefined;
|
|
2132
|
-
size?: NavSize | null | undefined;
|
|
2133
|
-
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
2134
|
-
/**
|
|
2135
|
-
* Extract variant props type for Label
|
|
2136
|
-
*/
|
|
2137
|
-
type LabelVariantProps = VariantProps<typeof labelVariants>;
|
|
2138
|
-
/**
|
|
2139
|
-
* Badge indicator styles
|
|
2140
|
-
* @description Styles for notification badges on nav items
|
|
2141
|
-
*/
|
|
2142
|
-
declare const badgeVariants: (props?: ({
|
|
2143
|
-
type?: "dot" | "count" | null | undefined;
|
|
2144
|
-
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
2145
|
-
/**
|
|
2146
|
-
* Extract variant props type for Badge
|
|
2147
|
-
*/
|
|
2148
|
-
type BadgeVariantProps = VariantProps<typeof badgeVariants>;
|
|
2149
|
-
/**
|
|
2150
|
-
* Spacer styles to prevent content from going under navigation
|
|
2151
|
-
* @description Used as a placeholder element below main content
|
|
2152
|
-
*/
|
|
2153
|
-
declare const spacerVariants: (props?: ({
|
|
2154
|
-
size?: NavSize | null | undefined;
|
|
2155
|
-
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
2156
|
-
/**
|
|
2157
|
-
* Extract variant props type for Spacer
|
|
2158
|
-
*/
|
|
2159
|
-
type SpacerVariantProps = VariantProps<typeof spacerVariants>;
|
|
2160
|
-
|
|
2161
|
-
/**
|
|
2162
|
-
* iOS version detection result
|
|
2163
|
-
* @interface IOSVersion
|
|
2164
|
-
*/
|
|
2165
|
-
interface IOSVersion {
|
|
2166
|
-
/** Whether the device is running iOS */
|
|
2167
|
-
isIOS: boolean;
|
|
2168
|
-
/** Whether the browser is Safari */
|
|
2169
|
-
isSafari: boolean;
|
|
2170
|
-
/** Major iOS version number (e.g., 26 for iOS 26) */
|
|
2171
|
-
majorVersion: number | null;
|
|
2172
|
-
/** Minor iOS version number */
|
|
2173
|
-
minorVersion: number | null;
|
|
2174
|
-
/** Whether this is iOS 26 or later with known bugs */
|
|
2175
|
-
hasViewportBugs: boolean;
|
|
2176
|
-
}
|
|
2177
|
-
/**
|
|
2178
|
-
* Detects iOS version and Safari browser
|
|
2179
|
-
* @returns {IOSVersion} iOS detection result
|
|
2180
|
-
*/
|
|
2181
|
-
declare function detectIOSVersion(): IOSVersion;
|
|
2182
|
-
/**
|
|
2183
|
-
* Configuration for iOS Safari fix
|
|
2184
|
-
* @interface IOSSafariFixConfig
|
|
2185
|
-
*/
|
|
2186
|
-
interface IOSSafariFixConfig {
|
|
2187
|
-
/** Enable scroll-based body fix (moves scroll from window to body) */
|
|
2188
|
-
enableScrollFix?: boolean;
|
|
2189
|
-
/** Enable keyboard visibility detection */
|
|
2190
|
-
enableKeyboardFix?: boolean;
|
|
2191
|
-
/** Callback when keyboard visibility changes */
|
|
2192
|
-
onKeyboardVisibilityChange?: (visible: boolean) => void;
|
|
2193
|
-
/** Enable debug logging */
|
|
2194
|
-
debug?: boolean;
|
|
2195
|
-
}
|
|
2196
|
-
/**
|
|
2197
|
-
* Hook to apply iOS Safari viewport bug fixes
|
|
2198
|
-
*
|
|
2199
|
-
* @param {IOSSafariFixConfig} config - Configuration options
|
|
2200
|
-
* @returns {{ isKeyboardVisible: boolean; iosInfo: IOSVersion }} Hook state
|
|
2201
|
-
*
|
|
2202
|
-
* @example
|
|
2203
|
-
* ```tsx
|
|
2204
|
-
* const { isKeyboardVisible, iosInfo } = useIOSSafariFix({
|
|
2205
|
-
* enableScrollFix: true,
|
|
2206
|
-
* enableKeyboardFix: true,
|
|
2207
|
-
* onKeyboardVisibilityChange: (visible) => console.log('Keyboard:', visible)
|
|
2208
|
-
* });
|
|
2209
|
-
* ```
|
|
2210
|
-
*/
|
|
2211
|
-
declare function useIOSSafariFix(config?: IOSSafariFixConfig): {
|
|
2212
|
-
isKeyboardVisible: boolean;
|
|
2213
|
-
iosInfo: IOSVersion;
|
|
2214
|
-
};
|
|
2215
|
-
/**
|
|
2216
|
-
* Hook to force reset fixed element positioning after iOS viewport bugs
|
|
2217
|
-
*
|
|
2218
|
-
* @param {React.RefObject<HTMLElement>} elementRef - Ref to the fixed element
|
|
2219
|
-
* @returns {{ forceReset: () => void }} Reset function
|
|
2
|
+
* @mks2508/sidebar-headless
|
|
2220
3
|
*
|
|
2221
|
-
*
|
|
2222
|
-
*
|
|
2223
|
-
* const navRef = useRef<HTMLElement>(null);
|
|
2224
|
-
* const { forceReset } = useIOSFixedReset(navRef);
|
|
4
|
+
* Headless sidebar component for React with advanced animations,
|
|
5
|
+
* keyboard navigation, and full WAI-ARIA accessibility.
|
|
2225
6
|
*
|
|
2226
|
-
*
|
|
2227
|
-
*
|
|
7
|
+
* @module @mks2508/sidebar-headless
|
|
8
|
+
* @license MIT
|
|
9
|
+
* @author MKS2508
|
|
2228
10
|
*/
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
};
|
|
2232
|
-
|
|
2233
|
-
declare function cn(...inputs: ClassValue[]): string;
|
|
2234
|
-
|
|
2235
|
-
export { type AnimationConfig, AnimationType, type BadgeVariantProps, type BaseNavProps, BlurIntensity, DEFAULT_ANIMATIONS, DEFAULT_ANIMATION_CONFIG, DEFAULT_CONFIG, DEFAULT_DIMENSIONS, DEFAULT_GLASS_CONFIG, DEFAULT_SAFE_AREAS, DEFAULT_SPRING_CONFIG, DEFAULT_TWEEN_CONFIG, DEFAULT_VISUAL_STYLE, type GlassConfig, type IOSSafariFixConfig, IconSize, type IconVariantProps, LabelPosition, type LabelVariantProps, MobileBottomNav, type NavContextValue, type NavItemProps, NavItemState, type NavItemVariantProps, type NavListProps, type NavListVariantProps, NavSize, NavVariant, type RootProps, type RootVariantProps, 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, type SpacerVariantProps, type SpringConfig, type TweenConfig, ZIndexLevel, badgeVariants, cn, detectIOSVersion, generateIndicatorStyles, generateSidebarStyles, iconVariants, labelVariants, navItemVariants, navListVariants, rootVariants, spacerVariants, useIOSFixedReset, useIOSSafariFix, useSidebarContext, useSidebarIndicator, useSidebarKeyboard, useSubContent };
|
|
11
|
+
export * from './components/Sidebar';
|
|
12
|
+
export * from './components/BottomNavBar';
|
|
13
|
+
export { cn } from './lib/utils';
|
|
14
|
+
//# sourceMappingURL=index.d.ts.map
|