@mks2508/sidebar-headless 0.2.1 → 0.3.1
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 +171 -2234
- 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 +113 -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
|
@@ -0,0 +1,285 @@
|
|
|
1
|
+
import { type SidebarDimensions, type SidebarSafeAreas, type SidebarAnimations, type SidebarConfig } from "./Sidebar.types";
|
|
2
|
+
/**
|
|
3
|
+
* Dimensiones por defecto del sidebar
|
|
4
|
+
* @constant
|
|
5
|
+
*/
|
|
6
|
+
export declare const DEFAULT_DIMENSIONS: SidebarDimensions;
|
|
7
|
+
/**
|
|
8
|
+
* Áreas seguras por defecto
|
|
9
|
+
* @constant
|
|
10
|
+
*/
|
|
11
|
+
export declare const DEFAULT_SAFE_AREAS: SidebarSafeAreas;
|
|
12
|
+
/**
|
|
13
|
+
* Animaciones por defecto
|
|
14
|
+
* @constant
|
|
15
|
+
*/
|
|
16
|
+
export declare const DEFAULT_ANIMATIONS: SidebarAnimations;
|
|
17
|
+
/**
|
|
18
|
+
* Configuración por defecto del sidebar
|
|
19
|
+
* @constant
|
|
20
|
+
*
|
|
21
|
+
* @description
|
|
22
|
+
* Los colores se obtienen automáticamente de los tokens CSS de shadcn:
|
|
23
|
+
* - --sidebar: Color de fondo
|
|
24
|
+
* - --sidebar-foreground: Color de texto
|
|
25
|
+
* - --sidebar-primary: Color primario (indicador)
|
|
26
|
+
* - --sidebar-accent: Color de hover
|
|
27
|
+
* - --sidebar-border: Color de bordes
|
|
28
|
+
*/
|
|
29
|
+
export declare const DEFAULT_CONFIG: SidebarConfig;
|
|
30
|
+
/**
|
|
31
|
+
* Teclas de navegación del sidebar
|
|
32
|
+
* @constant
|
|
33
|
+
*/
|
|
34
|
+
export declare const SIDEBAR_KEYBOARD_KEYS: {
|
|
35
|
+
/** Flecha abajo - navegar al siguiente item */
|
|
36
|
+
readonly ARROW_DOWN: "ArrowDown";
|
|
37
|
+
/** Flecha arriba - navegar al item anterior */
|
|
38
|
+
readonly ARROW_UP: "ArrowUp";
|
|
39
|
+
/** Home - ir al primer item */
|
|
40
|
+
readonly HOME: "Home";
|
|
41
|
+
/** End - ir al último item */
|
|
42
|
+
readonly END: "End";
|
|
43
|
+
/** Tab - navegación estándar */
|
|
44
|
+
readonly TAB: "Tab";
|
|
45
|
+
/** Escape - cerrar sidebar o quitar focus */
|
|
46
|
+
readonly ESCAPE: "Escape";
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* Tipo derivado de las teclas del teclado
|
|
50
|
+
*/
|
|
51
|
+
export type SidebarKeyboardKey = (typeof SIDEBAR_KEYBOARD_KEYS)[keyof typeof SIDEBAR_KEYBOARD_KEYS];
|
|
52
|
+
/**
|
|
53
|
+
* Timing functions perfectas para animaciones suaves
|
|
54
|
+
* @constant
|
|
55
|
+
*/
|
|
56
|
+
export declare const SIDEBAR_TIMING_FUNCTIONS: {
|
|
57
|
+
/** Ease-out perfecto para elevación de iconos */
|
|
58
|
+
readonly EASE_OUT_PERFECT: "cubic-bezier(0.4, 0, 0.2, 1)";
|
|
59
|
+
/** Ease-in-out suave */
|
|
60
|
+
readonly EASE_IN_OUT_SMOOTH: "cubic-bezier(0.45, 0, 0.55, 1)";
|
|
61
|
+
/** Spring suave */
|
|
62
|
+
readonly SPRING_SOFT: "cubic-bezier(0.34, 1.56, 0.64, 1)";
|
|
63
|
+
};
|
|
64
|
+
/**
|
|
65
|
+
* Atributos data-* para styling CSS y selección de elementos
|
|
66
|
+
* @constant
|
|
67
|
+
*/
|
|
68
|
+
export declare const SIDEBAR_DATA_ATTRIBUTES: {
|
|
69
|
+
/** data-open - indica si el sidebar está abierto */
|
|
70
|
+
readonly OPEN: "data-open";
|
|
71
|
+
/** data-collapsed - indica si el sidebar está colapsado */
|
|
72
|
+
readonly COLLAPSED: "data-collapsed";
|
|
73
|
+
/** data-focused - indica si un elemento está enfocado */
|
|
74
|
+
readonly FOCUSED: "data-focused";
|
|
75
|
+
/** data-hovered - indica si el mouse está sobre un elemento */
|
|
76
|
+
readonly HOVERED: "data-hovered";
|
|
77
|
+
/** data-disabled - indica si un elemento está deshabilitado */
|
|
78
|
+
readonly DISABLED: "data-disabled";
|
|
79
|
+
/** data-sidebar-item - marca un item del sidebar para navegación */
|
|
80
|
+
readonly ITEM: "data-sidebar-item";
|
|
81
|
+
/** data-active - indica si un toggle/botón está activo */
|
|
82
|
+
readonly ACTIVE: "data-active";
|
|
83
|
+
/** data-visible - indica si un elemento es visible */
|
|
84
|
+
readonly VISIBLE: "data-visible";
|
|
85
|
+
};
|
|
86
|
+
/**
|
|
87
|
+
* Clases Tailwind reutilizables para componentes del sidebar
|
|
88
|
+
* @constant
|
|
89
|
+
*/
|
|
90
|
+
export declare const SIDEBAR_TAILWIND_CLASSES: {
|
|
91
|
+
/** Clases base para el wrapper */
|
|
92
|
+
readonly wrapper: "relative";
|
|
93
|
+
/** Clases base para el nav */
|
|
94
|
+
readonly nav: "relative h-screen border-r";
|
|
95
|
+
/** Clases base para el indicador */
|
|
96
|
+
readonly indicator: "absolute left-0 rounded-r-full pointer-events-none";
|
|
97
|
+
/** Clases base para el botón toggle */
|
|
98
|
+
readonly toggleButton: "block w-6 h-6 rounded-full cursor-pointer flex items-center justify-center transition-colors";
|
|
99
|
+
/** Clases para el wrapper del botón toggle */
|
|
100
|
+
readonly toggleButtonWrapper: "absolute top-6 z-30";
|
|
101
|
+
/** Clases base para el contenedor de items */
|
|
102
|
+
readonly content: "flex flex-col items-center";
|
|
103
|
+
/** Clases base para áreas seguras */
|
|
104
|
+
readonly safeArea: "flex items-center justify-center";
|
|
105
|
+
/** Clases de borde debug */
|
|
106
|
+
readonly debugBorder: "border-dashed";
|
|
107
|
+
/** Clases de focus ring (accesibilidad) */
|
|
108
|
+
readonly focusRing: "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:ring-offset-2";
|
|
109
|
+
/** Clases SR-only (screen reader only) */
|
|
110
|
+
readonly srOnly: "sr-only";
|
|
111
|
+
};
|
|
112
|
+
/**
|
|
113
|
+
* Tipo derivado de las clases Tailwind
|
|
114
|
+
*/
|
|
115
|
+
export type SidebarTailwindClass = (typeof SIDEBAR_TAILWIND_CLASSES)[keyof typeof SIDEBAR_TAILWIND_CLASSES];
|
|
116
|
+
/**
|
|
117
|
+
* Patrones visuales para modo debug
|
|
118
|
+
* @constant
|
|
119
|
+
*/
|
|
120
|
+
export declare const SIDEBAR_DEBUG_PATTERNS: {
|
|
121
|
+
/** Patrón de rayas para áreas seguras */
|
|
122
|
+
readonly safeArea: "repeating-linear-gradient(45deg, transparent, transparent 10px, rgba(255,255,255,0.03) 10px, rgba(255,255,255,0.03) 20px)";
|
|
123
|
+
/** Fondo semi-transparente para área de contenido */
|
|
124
|
+
readonly contentArea: "rgba(0, 0, 0, 0.5)";
|
|
125
|
+
/** Color de borde para debug */
|
|
126
|
+
readonly borderColor: "rgb(34 197 94)";
|
|
127
|
+
/** Opacidad de borde debug */
|
|
128
|
+
readonly borderOpacity: "0.3";
|
|
129
|
+
};
|
|
130
|
+
/**
|
|
131
|
+
* Roles ARIA para accesibilidad
|
|
132
|
+
* @constant
|
|
133
|
+
*/
|
|
134
|
+
export declare const SIDEBAR_ARIA_ROLES: {
|
|
135
|
+
/** Rol para el nav principal */
|
|
136
|
+
readonly navigation: "navigation";
|
|
137
|
+
/** Rol para lista de items */
|
|
138
|
+
readonly list: "list";
|
|
139
|
+
/** Rol para item individual */
|
|
140
|
+
readonly listitem: "listitem";
|
|
141
|
+
/** Rol para botón toggle */
|
|
142
|
+
readonly button: "button";
|
|
143
|
+
};
|
|
144
|
+
/**
|
|
145
|
+
* Labels ARIA por defecto para accesibilidad
|
|
146
|
+
* @constant
|
|
147
|
+
*/
|
|
148
|
+
export declare const SIDEBAR_ARIA_LABELS: {
|
|
149
|
+
/** Label para toggle */
|
|
150
|
+
readonly toggleSidebar: "Alternar sidebar";
|
|
151
|
+
/** Label para navegación principal */
|
|
152
|
+
readonly mainNavigation: "Navegación principal";
|
|
153
|
+
/** Label cuando sidebar está abierto */
|
|
154
|
+
readonly sidebarOpen: "Sidebar abierto";
|
|
155
|
+
/** Label cuando sidebar está cerrado */
|
|
156
|
+
readonly sidebarClosed: "Sidebar cerrado";
|
|
157
|
+
};
|
|
158
|
+
/**
|
|
159
|
+
* Configuración de estilo visual por defecto del sidebar
|
|
160
|
+
* @constant
|
|
161
|
+
*/
|
|
162
|
+
export declare const DEFAULT_VISUAL_STYLE: {
|
|
163
|
+
readonly marginTop: "0";
|
|
164
|
+
readonly marginBottom: "0";
|
|
165
|
+
readonly marginLeft: "0";
|
|
166
|
+
readonly marginRight: "0";
|
|
167
|
+
readonly height: "100vh";
|
|
168
|
+
readonly borderRadius: "0";
|
|
169
|
+
readonly boxShadow: "none";
|
|
170
|
+
};
|
|
171
|
+
/**
|
|
172
|
+
* Preconfiguraciones de estilo visual para el sidebar
|
|
173
|
+
* @constant
|
|
174
|
+
*/
|
|
175
|
+
export declare const SIDEBAR_VISUAL_PRESETS: {
|
|
176
|
+
/** Estilo por defecto: pegado a bordes */
|
|
177
|
+
readonly DEFAULT: {
|
|
178
|
+
readonly marginTop: "0";
|
|
179
|
+
readonly marginBottom: "0";
|
|
180
|
+
readonly marginLeft: "0";
|
|
181
|
+
readonly marginRight: "0";
|
|
182
|
+
readonly height: "100vh";
|
|
183
|
+
readonly borderRadius: "0";
|
|
184
|
+
readonly boxShadow: "none";
|
|
185
|
+
};
|
|
186
|
+
/** Estilo floating: separado y con sombra */
|
|
187
|
+
readonly FLOATING_CARD: {
|
|
188
|
+
readonly marginTop: "1rem";
|
|
189
|
+
readonly marginBottom: "1rem";
|
|
190
|
+
readonly marginLeft: "1rem";
|
|
191
|
+
readonly marginRight: "0";
|
|
192
|
+
readonly height: "calc(100vh - 2rem)";
|
|
193
|
+
readonly borderRadius: "0.75rem";
|
|
194
|
+
readonly boxShadow: "0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04)";
|
|
195
|
+
};
|
|
196
|
+
/** Estilo moderno: esquinas redondeadas suaves */
|
|
197
|
+
readonly MODERN_ROUNDED: {
|
|
198
|
+
readonly marginTop: "0.5rem";
|
|
199
|
+
readonly marginBottom: "0.5rem";
|
|
200
|
+
readonly marginLeft: "0.5rem";
|
|
201
|
+
readonly marginRight: "0";
|
|
202
|
+
readonly height: "calc(100vh - 1rem)";
|
|
203
|
+
readonly borderRadius: "1rem";
|
|
204
|
+
readonly boxShadow: "0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)";
|
|
205
|
+
};
|
|
206
|
+
/** Estilo minimal: ligera separación */
|
|
207
|
+
readonly MINIMAL_SPACED: {
|
|
208
|
+
readonly marginTop: "0.25rem";
|
|
209
|
+
readonly marginBottom: "0.25rem";
|
|
210
|
+
readonly marginLeft: "0.25rem";
|
|
211
|
+
readonly marginRight: "0";
|
|
212
|
+
readonly height: "calc(100vh - 0.5rem)";
|
|
213
|
+
readonly borderRadius: "0.5rem";
|
|
214
|
+
readonly boxShadow: "0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06)";
|
|
215
|
+
};
|
|
216
|
+
};
|
|
217
|
+
/**
|
|
218
|
+
* Tipo para los presets de estilo visual
|
|
219
|
+
*/
|
|
220
|
+
export type SidebarVisualPreset = keyof typeof SIDEBAR_VISUAL_PRESETS;
|
|
221
|
+
/**
|
|
222
|
+
* Breakpoints para responsive behavior
|
|
223
|
+
* @constant
|
|
224
|
+
*/
|
|
225
|
+
export declare const SIDEBAR_BREAKPOINTS: {
|
|
226
|
+
/** Ancho mínimo para mostrar sidebar expandido */
|
|
227
|
+
readonly minExpandedWidth: 768;
|
|
228
|
+
/** Ancho mínimo para sidebar colapsado */
|
|
229
|
+
readonly minCollapsedWidth: 640;
|
|
230
|
+
/** Ancho para forzar modo mobile */
|
|
231
|
+
readonly mobileWidth: 480;
|
|
232
|
+
};
|
|
233
|
+
/**
|
|
234
|
+
* Límites y valores seguros para validación
|
|
235
|
+
* @constant
|
|
236
|
+
*/
|
|
237
|
+
export declare const SIDEBAR_LIMITS: {
|
|
238
|
+
/** Porcentaje mínimo para safe area */
|
|
239
|
+
readonly minSafeAreaPercent: 0;
|
|
240
|
+
/** Porcentaje máximo para safe area */
|
|
241
|
+
readonly maxSafeAreaPercent: 50;
|
|
242
|
+
/** Número máximo de items recomendado */
|
|
243
|
+
readonly maxRecommendedItems: 20;
|
|
244
|
+
/** Duración mínima de transición (ms) */
|
|
245
|
+
readonly minTransitionDuration: 0;
|
|
246
|
+
/** Duración máxima de transición (ms) */
|
|
247
|
+
readonly maxTransitionDuration: 1000;
|
|
248
|
+
};
|
|
249
|
+
/**
|
|
250
|
+
* Nombres de CSS variables utilizadas
|
|
251
|
+
* @constant
|
|
252
|
+
*/
|
|
253
|
+
export declare const SIDEBAR_CSS_VARIABLES: {
|
|
254
|
+
/** Ancho cuando cerrado */
|
|
255
|
+
readonly widthClosed: "--sidebar-width-closed";
|
|
256
|
+
/** Ancho cuando abierto */
|
|
257
|
+
readonly widthOpen: "--sidebar-width-open";
|
|
258
|
+
/** Ancho actual */
|
|
259
|
+
readonly width: "--sidebar-width";
|
|
260
|
+
/** Color de fondo */
|
|
261
|
+
readonly background: "--sidebar-bg";
|
|
262
|
+
/** Color de borde (variable interna para evitar colisión con --sidebar-border de shadcn) */
|
|
263
|
+
readonly borderColor: "--sidebar-border-color";
|
|
264
|
+
/** Color de hover */
|
|
265
|
+
readonly hover: "--sidebar-hover";
|
|
266
|
+
/** Color del indicador */
|
|
267
|
+
readonly indicator: "--sidebar-indicator";
|
|
268
|
+
/** Altura del indicador */
|
|
269
|
+
readonly indicatorHeight: "--sidebar-indicator-height";
|
|
270
|
+
/** Distancia del tooltip al sidebar */
|
|
271
|
+
readonly tooltipDistance: "--sidebar-tooltip-distance";
|
|
272
|
+
/** Comportamiento de layout */
|
|
273
|
+
readonly layoutBehaviour: "--sidebar-layout-behaviour";
|
|
274
|
+
/** Flag para modo inline */
|
|
275
|
+
readonly isInline: "--sidebar-is-inline";
|
|
276
|
+
/** Variables de estilo visual */
|
|
277
|
+
readonly marginTop: "--sidebar-margin-top";
|
|
278
|
+
readonly marginBottom: "--sidebar-margin-bottom";
|
|
279
|
+
readonly marginLeft: "--sidebar-margin-left";
|
|
280
|
+
readonly marginRight: "--sidebar-margin-right";
|
|
281
|
+
readonly sidebarHeight: "--sidebar-height";
|
|
282
|
+
readonly sidebarBorderRadius: "--sidebar-border-radius";
|
|
283
|
+
readonly sidebarBoxShadow: "--sidebar-box-shadow";
|
|
284
|
+
};
|
|
285
|
+
//# sourceMappingURL=Sidebar.constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Sidebar.constants.d.ts","sourceRoot":"","sources":["../../../src/components/Sidebar/Sidebar.constants.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import type { SidebarProps } from "./Sidebar.types";
|
|
2
|
+
/**
|
|
3
|
+
* Componente raíz del Sidebar con arquitectura headless
|
|
4
|
+
*
|
|
5
|
+
* @description
|
|
6
|
+
* Componente principal que provee el contexto compartido a todos los
|
|
7
|
+
* componentes primitivos del sidebar (SidebarNav, SidebarToggle, etc.).
|
|
8
|
+
*
|
|
9
|
+
* Este componente NO renderiza ningún elemento visual por sí mismo,
|
|
10
|
+
* solo provee el Provider de contexto. Los estilos y estructura visual
|
|
11
|
+
* se definen componiendo los primitivos hijos.
|
|
12
|
+
*
|
|
13
|
+
* Soporta dos modos:
|
|
14
|
+
* - **Uncontrolled**: Usa `defaultOpen` para estado interno
|
|
15
|
+
* - **Controlled**: Usa `open` + `onOpenChange` para control externo
|
|
16
|
+
*
|
|
17
|
+
* También soporta render props para acceder al estado del sidebar:
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```tsx
|
|
21
|
+
* // Uso básico (children estáticos)
|
|
22
|
+
* <Sidebar defaultOpen={true} collapseMode="collapse">
|
|
23
|
+
* <SidebarNav>
|
|
24
|
+
* <SidebarToggle />
|
|
25
|
+
* <SidebarContent>
|
|
26
|
+
* <SidebarItem href="/" icon={<HomeIcon />} />
|
|
27
|
+
* </SidebarContent>
|
|
28
|
+
* </SidebarNav>
|
|
29
|
+
* </Sidebar>
|
|
30
|
+
* ```
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```tsx
|
|
34
|
+
* // Con render props (acceso al estado)
|
|
35
|
+
* <Sidebar>
|
|
36
|
+
* {({ open, collapsed }) => (
|
|
37
|
+
* <>
|
|
38
|
+
* <SidebarNav className={cn(!open && 'hidden')}>
|
|
39
|
+
* <SidebarContent>
|
|
40
|
+
* <SidebarItem label={open ? "Home" : undefined} />
|
|
41
|
+
* </SidebarContent>
|
|
42
|
+
* </SidebarNav>
|
|
43
|
+
* <div>Sidebar is {open ? 'open' : 'closed'}</div>
|
|
44
|
+
* </>
|
|
45
|
+
* )}
|
|
46
|
+
* </Sidebar>
|
|
47
|
+
* ```
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* ```tsx
|
|
51
|
+
* // Modo controlled
|
|
52
|
+
* function App() {
|
|
53
|
+
* const [open, setOpen] = useState(true)
|
|
54
|
+
*
|
|
55
|
+
* return (
|
|
56
|
+
* <Sidebar open={open} onOpenChange={setOpen}>
|
|
57
|
+
* <SidebarNav>...</SidebarNav>
|
|
58
|
+
* </Sidebar>
|
|
59
|
+
* )
|
|
60
|
+
* }
|
|
61
|
+
* ```
|
|
62
|
+
*
|
|
63
|
+
* @example
|
|
64
|
+
* ```tsx
|
|
65
|
+
* // Con configuración custom
|
|
66
|
+
* <Sidebar
|
|
67
|
+
* collapseMode="hide"
|
|
68
|
+
* dimensions={{ expandedWidth: "20rem" }}
|
|
69
|
+
* animations={{ widthTransitionDuration: 500 }}
|
|
70
|
+
* >
|
|
71
|
+
* <SidebarNav>...</SidebarNav>
|
|
72
|
+
* </Sidebar>
|
|
73
|
+
* ```
|
|
74
|
+
*
|
|
75
|
+
* @note
|
|
76
|
+
* Los colores se obtienen automáticamente de los tokens CSS de shadcn definidos
|
|
77
|
+
* en globals.css (--sidebar, --sidebar-accent, --sidebar-primary, etc.)
|
|
78
|
+
*/
|
|
79
|
+
export declare function Sidebar({ children, className, style, defaultOpen, open, onOpenChange, collapseMode, hideBehaviour, hideOpensBehavior, layoutBehaviour, dimensions, animations, toggleId, debug, enableFluidIndicator, enableTooltip, liquidGlass, as }: SidebarProps): import("react/jsx-runtime").JSX.Element;
|
|
80
|
+
//# sourceMappingURL=Sidebar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Sidebar.d.ts","sourceRoot":"","sources":["../../../src/components/Sidebar/Sidebar.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,YAAY,EAAqB,MAAM,iBAAiB,CAAA;AAGtE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4EG;AACH,wBAAgB,OAAO,CAAC,EACtB,QAAQ,EACR,SAAS,EACT,KAAK,EACL,WAAwC,EACxC,IAAI,EACJ,YAAY,EACZ,YAA0C,EAC1C,aAA4C,EAC5C,iBAAoD,EACpD,eAAgD,EAChD,UAAU,EACV,UAAU,EACV,QAAkC,EAClC,KAA4B,EAC5B,oBAA4B,EAC5B,aAAoB,EACpB,WAAW,EACX,EAAE,EACH,EAAE,YAAY,2CAoCd"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import type { SidebarDimensions, SidebarAnimations, SidebarCollapseMode, SidebarHideOpensBehavior, SidebarVisualStyle } from "./Sidebar.types";
|
|
2
|
+
import { SidebarLayoutBehaviour } from "./Sidebar.types";
|
|
3
|
+
/**
|
|
4
|
+
* Configuración para el generador de estilos
|
|
5
|
+
* @interface
|
|
6
|
+
*/
|
|
7
|
+
interface StyleGeneratorConfig {
|
|
8
|
+
dimensions: SidebarDimensions;
|
|
9
|
+
animations: SidebarAnimations;
|
|
10
|
+
collapseMode: SidebarCollapseMode;
|
|
11
|
+
hideOpensBehavior: SidebarHideOpensBehavior;
|
|
12
|
+
layoutBehaviour: SidebarLayoutBehaviour;
|
|
13
|
+
visualStyle: SidebarVisualStyle;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Genera los estilos CSS del sidebar usando CSS-in-JS y tokens de shadcn
|
|
17
|
+
*
|
|
18
|
+
* @description
|
|
19
|
+
* Función que genera todo el CSS necesario para el sidebar,
|
|
20
|
+
* utilizando los tokens CSS de shadcn definidos en globals.css:
|
|
21
|
+
*
|
|
22
|
+
* **Tokens utilizados:**
|
|
23
|
+
* - `--sidebar`: Color de fondo
|
|
24
|
+
* - `--sidebar-foreground`: Color de texto
|
|
25
|
+
* - `--sidebar-primary`: Color primario (indicador, elementos activos)
|
|
26
|
+
* - `--sidebar-accent`: Color de hover y estados secundarios
|
|
27
|
+
* - `--sidebar-border`: Color de bordes
|
|
28
|
+
* - `--sidebar-ring`: Color de focus ring (accesibilidad)
|
|
29
|
+
*
|
|
30
|
+
* Usa CSS Layers para organización y control de especificidad:
|
|
31
|
+
* - sidebar-base: Variables y estilos base
|
|
32
|
+
* - sidebar-states: Estados (:checked, :hover, etc.)
|
|
33
|
+
* - sidebar-animations: Transiciones y animaciones
|
|
34
|
+
*
|
|
35
|
+
* @param {StyleGeneratorConfig} config - Configuración de dimensiones y animaciones
|
|
36
|
+
* @returns {string} String con el CSS completo
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* ```tsx
|
|
40
|
+
* const styles = generateSidebarStyles({
|
|
41
|
+
* dimensions: DEFAULT_DIMENSIONS,
|
|
42
|
+
* animations: DEFAULT_ANIMATIONS,
|
|
43
|
+
* collapseMode: SidebarCollapseMode.COLLAPSE,
|
|
44
|
+
* hideOpensBehavior: SidebarHideOpensBehavior.COLLAPSED
|
|
45
|
+
* })
|
|
46
|
+
*
|
|
47
|
+
* <style jsx>{styles}</style>
|
|
48
|
+
* ```
|
|
49
|
+
*
|
|
50
|
+
* @note
|
|
51
|
+
* Los colores NO se configuran aquí, se obtienen automáticamente de los tokens
|
|
52
|
+
* CSS de shadcn. Esto permite soporte automático para dark/light mode.
|
|
53
|
+
*/
|
|
54
|
+
export declare function generateSidebarStyles({ dimensions, animations, collapseMode, hideOpensBehavior, layoutBehaviour, visualStyle }: StyleGeneratorConfig): string;
|
|
55
|
+
/**
|
|
56
|
+
* Genera estilos para el indicador visual usando tokens CSS
|
|
57
|
+
*
|
|
58
|
+
* @description
|
|
59
|
+
* Función auxiliar para generar estilos dinámicos del indicador.
|
|
60
|
+
* Útil para aplicar estilos inline con estado reactivo.
|
|
61
|
+
*
|
|
62
|
+
* Utiliza el token `--sidebar-primary` para el color del indicador,
|
|
63
|
+
* asegurando consistencia con el theme del sidebar.
|
|
64
|
+
*
|
|
65
|
+
* @param {boolean} isVisible - Si el indicador está visible
|
|
66
|
+
* @returns {React.CSSProperties} Objeto de estilos inline
|
|
67
|
+
*
|
|
68
|
+
* @example
|
|
69
|
+
* ```tsx
|
|
70
|
+
* const indicatorStyles = generateIndicatorStyles(isHovering && isOverItems)
|
|
71
|
+
*
|
|
72
|
+
* <div style={indicatorStyles} />
|
|
73
|
+
* ```
|
|
74
|
+
*/
|
|
75
|
+
export declare function generateIndicatorStyles(isVisible: boolean): React.CSSProperties;
|
|
76
|
+
export {};
|
|
77
|
+
//# sourceMappingURL=Sidebar.styles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Sidebar.styles.d.ts","sourceRoot":"","sources":["../../../src/components/Sidebar/Sidebar.styles.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,iBAAiB,EACjB,iBAAiB,EACjB,mBAAmB,EACnB,wBAAwB,EACxB,kBAAkB,EACnB,MAAM,iBAAiB,CAAA;AACxB,OAAO,EACL,sBAAsB,EACvB,MAAM,iBAAiB,CAAA;AAMxB;;;GAGG;AACH,UAAU,oBAAoB;IAC5B,UAAU,EAAE,iBAAiB,CAAA;IAC7B,UAAU,EAAE,iBAAiB,CAAA;IAC7B,YAAY,EAAE,mBAAmB,CAAA;IACjC,iBAAiB,EAAE,wBAAwB,CAAA;IAC3C,eAAe,EAAE,sBAAsB,CAAA;IACvC,WAAW,EAAE,kBAAkB,CAAA;CAChC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,wBAAgB,qBAAqB,CAAC,EACpC,UAAU,EACV,UAAU,EACV,YAAY,EACZ,iBAAiB,EACjB,eAAe,EACf,WAAW,EACZ,EAAE,oBAAoB,GAAG,MAAM,CAyP/B;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,uBAAuB,CAAC,SAAS,EAAE,OAAO,GAAG,KAAK,CAAC,aAAa,CAQ/E"}
|