@mks2508/sidebar-headless 0.2.0 → 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 +14087 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +10 -2231
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +13132 -52336
- 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 +12 -6
- 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,48 @@
|
|
|
1
|
+
import type { SidebarContextValue } from "../Sidebar.types";
|
|
2
|
+
/**
|
|
3
|
+
* Hook para acceder al contexto del Sidebar
|
|
4
|
+
*
|
|
5
|
+
* @description
|
|
6
|
+
* Hook personalizado que provee acceso al contexto compartido del Sidebar.
|
|
7
|
+
* Debe ser utilizado dentro de un componente que esté envuelto por
|
|
8
|
+
* `<Sidebar>` o `<SidebarProvider>`.
|
|
9
|
+
*
|
|
10
|
+
* Lanza un error si se utiliza fuera del contexto apropiado, ayudando
|
|
11
|
+
* a detectar problemas de composición durante el desarrollo.
|
|
12
|
+
*
|
|
13
|
+
* @throws {Error} Si se usa fuera de un SidebarProvider
|
|
14
|
+
*
|
|
15
|
+
* @returns {SidebarContextValue} El valor del contexto del sidebar
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```tsx
|
|
19
|
+
* function CustomToggle() {
|
|
20
|
+
* const { open, setOpen } = useSidebarContext()
|
|
21
|
+
*
|
|
22
|
+
* return (
|
|
23
|
+
* <button onClick={() => setOpen(!open)}>
|
|
24
|
+
* {open ? 'Cerrar' : 'Abrir'}
|
|
25
|
+
* </button>
|
|
26
|
+
* )
|
|
27
|
+
* }
|
|
28
|
+
* ```
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```tsx
|
|
32
|
+
* // Acceder a configuración
|
|
33
|
+
* function CustomItem() {
|
|
34
|
+
* const { colors, dimensions } = useSidebarContext()
|
|
35
|
+
*
|
|
36
|
+
* return (
|
|
37
|
+
* <div style={{
|
|
38
|
+
* background: colors.hover,
|
|
39
|
+
* width: dimensions.expandedWidth
|
|
40
|
+
* }}>
|
|
41
|
+
* Item
|
|
42
|
+
* </div>
|
|
43
|
+
* )
|
|
44
|
+
* }
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
47
|
+
export declare function useSidebarContext(): SidebarContextValue;
|
|
48
|
+
//# sourceMappingURL=useSidebarContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useSidebarContext.d.ts","sourceRoot":"","sources":["../../../../src/components/Sidebar/hooks/useSidebarContext.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAA;AAE3D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AACH,wBAAgB,iBAAiB,IAAI,mBAAmB,CAWvD"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import type { MouseEvent } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* Valor de retorno del hook useSidebarIndicator
|
|
4
|
+
* @interface
|
|
5
|
+
*/
|
|
6
|
+
interface UseSidebarIndicatorReturn {
|
|
7
|
+
/** Indica si el indicador está visible */
|
|
8
|
+
isVisible: boolean;
|
|
9
|
+
/** Indica si el mouse está sobre el área de items */
|
|
10
|
+
isOverItems: boolean;
|
|
11
|
+
/** Elemento del item actualmente hovered o enfocado (para FluidHoverIndicator) */
|
|
12
|
+
currentItemElement: HTMLElement | null;
|
|
13
|
+
/** ID del item bajo el indicador (para tooltip con subContent) */
|
|
14
|
+
hoveredItemId: string | null;
|
|
15
|
+
/** Label del item hovered (para tooltip simple) */
|
|
16
|
+
hoveredLabel: string | null;
|
|
17
|
+
/** Manejador de evento mousemove */
|
|
18
|
+
handleMouseMove: (e: MouseEvent<HTMLDivElement>) => void;
|
|
19
|
+
/** Manejador de evento mouseenter */
|
|
20
|
+
handleMouseEnter: () => void;
|
|
21
|
+
/** Manejador de evento mouseleave */
|
|
22
|
+
handleMouseLeave: () => void;
|
|
23
|
+
/** Manejador de evento focus */
|
|
24
|
+
handleFocus: () => void;
|
|
25
|
+
/** Manejador de evento blur */
|
|
26
|
+
handleBlur: (e: React.FocusEvent) => void;
|
|
27
|
+
/** Función para limpiar el estado hovered desde fuera (tooltip mouseleave) */
|
|
28
|
+
clearHoveredState: () => void;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Hook para gestionar el indicador visual del Sidebar
|
|
32
|
+
*
|
|
33
|
+
* @description
|
|
34
|
+
* Hook que implementa la lógica del indicador visual que sigue al cursor
|
|
35
|
+
* del mouse dentro del sidebar. El indicador se muestra cuando:
|
|
36
|
+
* - El mouse está sobre el sidebar (isHovering = true)
|
|
37
|
+
* - El cursor está en el área de items (isOverItems = true)
|
|
38
|
+
*
|
|
39
|
+
* Utiliza requestAnimationFrame para optimizar el rendimiento y evitar
|
|
40
|
+
* cálculos excesivos durante el movimiento del mouse.
|
|
41
|
+
*
|
|
42
|
+
* El indicador también se actualiza cuando se navega por teclado,
|
|
43
|
+
* integrándose con useSidebarKeyboard.
|
|
44
|
+
*
|
|
45
|
+
* @returns {UseSidebarIndicatorReturn} Estado y manejadores de eventos
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* ```tsx
|
|
49
|
+
* function SidebarNav() {
|
|
50
|
+
* const {
|
|
51
|
+
* isVisible,
|
|
52
|
+
* handleMouseMove,
|
|
53
|
+
* handleMouseEnter,
|
|
54
|
+
* handleMouseLeave
|
|
55
|
+
* } = useSidebarIndicator()
|
|
56
|
+
*
|
|
57
|
+
* return (
|
|
58
|
+
* <nav
|
|
59
|
+
* onMouseMove={handleMouseMove}
|
|
60
|
+
* onMouseEnter={handleMouseEnter}
|
|
61
|
+
* onMouseLeave={handleMouseLeave}
|
|
62
|
+
* >
|
|
63
|
+
* <SidebarIndicator visible={isVisible} />
|
|
64
|
+
* {children}
|
|
65
|
+
* </nav>
|
|
66
|
+
* )
|
|
67
|
+
* }
|
|
68
|
+
* ```
|
|
69
|
+
*/
|
|
70
|
+
export declare function useSidebarIndicator(): UseSidebarIndicatorReturn;
|
|
71
|
+
export {};
|
|
72
|
+
//# sourceMappingURL=useSidebarIndicator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useSidebarIndicator.d.ts","sourceRoot":"","sources":["../../../../src/components/Sidebar/hooks/useSidebarIndicator.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAGvC;;;GAGG;AACH,UAAU,yBAAyB;IACjC,2CAA0C;IAC1C,SAAS,EAAE,OAAO,CAAA;IAClB,uDAAqD;IACrD,WAAW,EAAE,OAAO,CAAA;IACpB,kFAAkF;IAClF,kBAAkB,EAAE,WAAW,GAAG,IAAI,CAAA;IACtC,kEAAkE;IAClE,aAAa,EAAE,MAAM,GAAG,IAAI,CAAA;IAC5B,mDAAmD;IACnD,YAAY,EAAE,MAAM,GAAG,IAAI,CAAA;IAC3B,oCAAoC;IACpC,eAAe,EAAE,CAAC,CAAC,EAAE,UAAU,CAAC,cAAc,CAAC,KAAK,IAAI,CAAA;IACxD,qCAAqC;IACrC,gBAAgB,EAAE,MAAM,IAAI,CAAA;IAC5B,qCAAqC;IACrC,gBAAgB,EAAE,MAAM,IAAI,CAAA;IAC5B,gCAAgC;IAChC,WAAW,EAAE,MAAM,IAAI,CAAA;IACvB,+BAA+B;IAC/B,UAAU,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,KAAK,IAAI,CAAA;IACzC,+EAA8E;IAC9E,iBAAiB,EAAE,MAAM,IAAI,CAAA;CAC9B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,wBAAgB,mBAAmB,IAAI,yBAAyB,CA2K/D"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Valor de retorno del hook useSidebarKeyboard
|
|
3
|
+
* @interface
|
|
4
|
+
*/
|
|
5
|
+
interface UseSidebarKeyboardReturn {
|
|
6
|
+
/** Índice del item actualmente enfocado (-1 si ninguno) */
|
|
7
|
+
focusedIndex: number;
|
|
8
|
+
/** Función para cambiar el índice enfocado manualmente */
|
|
9
|
+
setFocusedIndex: (index: number) => void;
|
|
10
|
+
/** Callback para actualizar el indicador según el item enfocado */
|
|
11
|
+
updateIndicatorForFocus: (index: number) => void;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Hook para gestionar la navegación por teclado en el Sidebar
|
|
15
|
+
*
|
|
16
|
+
* @description
|
|
17
|
+
* Hook que implementa navegación accesible por teclado para los items
|
|
18
|
+
* del sidebar, siguiendo las especificaciones WAI-ARIA:
|
|
19
|
+
*
|
|
20
|
+
* - ArrowDown: Navegar al siguiente item
|
|
21
|
+
* - ArrowUp: Navegar al item anterior
|
|
22
|
+
* - Home: Ir al primer item
|
|
23
|
+
* - End: Ir al último item
|
|
24
|
+
* - Tab: Navegación estándar que actualiza el indicador
|
|
25
|
+
*
|
|
26
|
+
* También sincroniza el indicador visual con el item enfocado.
|
|
27
|
+
*
|
|
28
|
+
* @returns {UseSidebarKeyboardReturn} Estado y funciones para navegación
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```tsx
|
|
32
|
+
* function SidebarNav() {
|
|
33
|
+
* const { focusedIndex, updateIndicatorForFocus } = useSidebarKeyboard()
|
|
34
|
+
*
|
|
35
|
+
* return (
|
|
36
|
+
* <nav>
|
|
37
|
+
* {items.map((item, index) => (
|
|
38
|
+
* <SidebarItem
|
|
39
|
+
* key={item.id}
|
|
40
|
+
* focused={index === focusedIndex}
|
|
41
|
+
* onFocus={() => updateIndicatorForFocus(index)}
|
|
42
|
+
* />
|
|
43
|
+
* ))}
|
|
44
|
+
* </nav>
|
|
45
|
+
* )
|
|
46
|
+
* }
|
|
47
|
+
* ```
|
|
48
|
+
*/
|
|
49
|
+
export declare function useSidebarKeyboard(): UseSidebarKeyboardReturn;
|
|
50
|
+
export {};
|
|
51
|
+
//# sourceMappingURL=useSidebarKeyboard.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useSidebarKeyboard.d.ts","sourceRoot":"","sources":["../../../../src/components/Sidebar/hooks/useSidebarKeyboard.ts"],"names":[],"mappings":"AAMA;;;GAGG;AACH,UAAU,wBAAwB;IAChC,4DAA2D;IAC3D,YAAY,EAAE,MAAM,CAAA;IACpB,4DAA0D;IAC1D,eAAe,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IACxC,oEAAmE;IACnE,uBAAuB,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;CACjD;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,wBAAgB,kBAAkB,IAAI,wBAAwB,CA+I7D"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare function useSubContent(): {
|
|
2
|
+
subContentMap: Map<string, import("../SidebarContext").SubContentData>;
|
|
3
|
+
registerSubContent: (itemId: string, data: import("../SidebarContext").SubContentData) => void;
|
|
4
|
+
unregisterSubContent: (itemId: string) => void;
|
|
5
|
+
getSubContent: (itemId: string) => import("../SidebarContext").SubContentData | undefined;
|
|
6
|
+
};
|
|
7
|
+
//# sourceMappingURL=useSubContent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useSubContent.d.ts","sourceRoot":"","sources":["../../../../src/components/Sidebar/hooks/useSubContent.ts"],"names":[],"mappings":"AAKA,wBAAgB,aAAa;;;;;EAQ5B"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* useTitleHistory
|
|
3
|
+
*
|
|
4
|
+
* Hook para mantener un historial circular de títulos del tooltip.
|
|
5
|
+
* Sincroniza con la dirección de navegación (up/down) para determinar el índice actual.
|
|
6
|
+
*
|
|
7
|
+
* Features:
|
|
8
|
+
* - Historial circular con límite máximo (default: 10 títulos)
|
|
9
|
+
* - Sincronización con dirección de navegación
|
|
10
|
+
* - Reset del historial
|
|
11
|
+
* - Manejo de primera renderización
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```typescript
|
|
15
|
+
* const { titles, currentIndex, addTitle } = useTitleHistory({
|
|
16
|
+
* maxHistory: 10
|
|
17
|
+
* });
|
|
18
|
+
*
|
|
19
|
+
* // Al cambiar de item
|
|
20
|
+
* addTitle('New Item', 'down');
|
|
21
|
+
* // titles = ['New Item']
|
|
22
|
+
* // currentIndex = 0
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
import type { TooltipDirection } from './useTooltipDirection';
|
|
26
|
+
export interface UseTitleHistoryOptions {
|
|
27
|
+
/** Máximo número de títulos en historial (default: 10) */
|
|
28
|
+
maxHistory?: number;
|
|
29
|
+
}
|
|
30
|
+
export interface UseTitleHistoryReturn {
|
|
31
|
+
/** Array de títulos en el historial */
|
|
32
|
+
titles: string[];
|
|
33
|
+
/** Índice actual en el historial */
|
|
34
|
+
currentIndex: number;
|
|
35
|
+
/** Agregar nuevo título según dirección de navegación */
|
|
36
|
+
addTitle: (newTitle: string, direction: TooltipDirection) => void;
|
|
37
|
+
/** Resetear historial */
|
|
38
|
+
reset: () => void;
|
|
39
|
+
}
|
|
40
|
+
export declare function useTitleHistory({ maxHistory }?: UseTitleHistoryOptions): UseTitleHistoryReturn;
|
|
41
|
+
//# sourceMappingURL=useTitleHistory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useTitleHistory.d.ts","sourceRoot":"","sources":["../../../../src/components/Sidebar/hooks/useTitleHistory.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAGH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AAE7D,MAAM,WAAW,sBAAsB;IACrC,6DAA0D;IAC1D,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB;AAED,MAAM,WAAW,qBAAqB;IACpC,wCAAuC;IACvC,MAAM,EAAE,MAAM,EAAE,CAAA;IAChB,qCAAoC;IACpC,YAAY,EAAE,MAAM,CAAA;IACpB,6DAAyD;IACzD,QAAQ,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,gBAAgB,KAAK,IAAI,CAAA;IACjE,yBAAyB;IACzB,KAAK,EAAE,MAAM,IAAI,CAAA;CAClB;AAED,wBAAgB,eAAe,CAAC,EAC9B,UAAe,EAChB,GAAE,sBAA2B,GAAG,qBAAqB,CAoFrD"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* useTooltipDirection
|
|
3
|
+
*
|
|
4
|
+
* Hook para detectar la dirección de navegación en el sidebar basado en índices.
|
|
5
|
+
*
|
|
6
|
+
* Direction-aware animations:
|
|
7
|
+
* - Si navegamos a un item con índice mayor → direction: 'down'
|
|
8
|
+
* - Si navegamos a un item con índice menor → direction: 'up'
|
|
9
|
+
* - Primera navegación → direction: 'down' (default)
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```typescript
|
|
13
|
+
* const { getDirection, currentIndex } = useTooltipDirection();
|
|
14
|
+
*
|
|
15
|
+
* // Al cambiar de item
|
|
16
|
+
* const direction = getDirection(newItemIndex);
|
|
17
|
+
* // direction = 'up' | 'down'
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
export type TooltipDirection = 'up' | 'down';
|
|
21
|
+
export interface UseTooltipDirectionReturn {
|
|
22
|
+
getDirection: (currentIndex: number) => TooltipDirection;
|
|
23
|
+
currentIndex: number | null;
|
|
24
|
+
previousIndex: number | null;
|
|
25
|
+
reset: () => void;
|
|
26
|
+
}
|
|
27
|
+
export declare function useTooltipDirection(): UseTooltipDirectionReturn;
|
|
28
|
+
export default useTooltipDirection;
|
|
29
|
+
//# sourceMappingURL=useTooltipDirection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useTooltipDirection.d.ts","sourceRoot":"","sources":["../../../../src/components/Sidebar/hooks/useTooltipDirection.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAIH,MAAM,MAAM,gBAAgB,GAAG,IAAI,GAAG,MAAM,CAAC;AAE7C,MAAM,WAAW,yBAAyB;IACxC,YAAY,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,gBAAgB,CAAC;IACzD,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,KAAK,EAAE,MAAM,IAAI,CAAC;CACnB;AAED,wBAAgB,mBAAmB,IAAI,yBAAyB,CAkC/D;AAED,eAAe,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* useTooltipTransition
|
|
3
|
+
*
|
|
4
|
+
* Hook principal para orquestar animaciones de tooltip con:
|
|
5
|
+
* - Direction-aware animations (up/down)
|
|
6
|
+
* - Cancelación automática en hover rápido
|
|
7
|
+
* - Sincronización de título, items y height
|
|
8
|
+
* - Soporte para ambos enfoques de título 3D
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```typescript
|
|
12
|
+
* const {
|
|
13
|
+
* transition,
|
|
14
|
+
* isAnimating,
|
|
15
|
+
* controller
|
|
16
|
+
* } = useTooltipTransition({
|
|
17
|
+
* debug: false,
|
|
18
|
+
* customTimings: { titleDuration: 300 }
|
|
19
|
+
* });
|
|
20
|
+
*
|
|
21
|
+
* // Al cambiar de item
|
|
22
|
+
* await transition({
|
|
23
|
+
* oldTitleEl: titleOldRef.current,
|
|
24
|
+
* newTitleEl: titleNewRef.current,
|
|
25
|
+
* oldItemsContainer: itemsOldRef.current,
|
|
26
|
+
* newItemsContainer: itemsNewRef.current,
|
|
27
|
+
* heightContainer: heightRef.current,
|
|
28
|
+
* currentItemIndex: 2
|
|
29
|
+
* });
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
import { TooltipAnimationController } from '@/utils/TooltipAnimationController';
|
|
33
|
+
import type { AnimationTimings } from '@/utils/TooltipAnimationController';
|
|
34
|
+
import type { TooltipDirection } from './useTooltipDirection';
|
|
35
|
+
export interface UseTooltipTransitionOptions {
|
|
36
|
+
debug?: boolean;
|
|
37
|
+
customTimings?: Partial<AnimationTimings>;
|
|
38
|
+
onTransitionStart?: (direction: TooltipDirection) => void;
|
|
39
|
+
onTransitionEnd?: () => void;
|
|
40
|
+
onTransitionCancel?: () => void;
|
|
41
|
+
}
|
|
42
|
+
export interface TransitionOptions {
|
|
43
|
+
oldTitleEl: HTMLElement | null;
|
|
44
|
+
newTitleEl: HTMLElement | null;
|
|
45
|
+
oldItemsContainer: HTMLElement | null;
|
|
46
|
+
newItemsContainer: HTMLElement | null;
|
|
47
|
+
heightContainer: HTMLElement | null;
|
|
48
|
+
currentItemIndex: number;
|
|
49
|
+
skipTitleAnimation?: boolean;
|
|
50
|
+
}
|
|
51
|
+
export interface UseTooltipTransitionReturn {
|
|
52
|
+
transition: (options: TransitionOptions) => Promise<void>;
|
|
53
|
+
isAnimating: boolean;
|
|
54
|
+
currentDirection: TooltipDirection | null;
|
|
55
|
+
controller: TooltipAnimationController;
|
|
56
|
+
cancel: () => void;
|
|
57
|
+
}
|
|
58
|
+
export declare function useTooltipTransition(options?: UseTooltipTransitionOptions): UseTooltipTransitionReturn;
|
|
59
|
+
export default useTooltipTransition;
|
|
60
|
+
//# sourceMappingURL=useTooltipTransition.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useTooltipTransition.d.ts","sourceRoot":"","sources":["../../../../src/components/Sidebar/hooks/useTooltipTransition.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAGH,OAAO,EAAE,0BAA0B,EAAE,MAAM,oCAAoC,CAAC;AAChF,OAAO,KAAK,EAAE,gBAAgB,EAA2B,MAAM,oCAAoC,CAAC;AAEpG,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAE9D,MAAM,WAAW,2BAA2B;IAC1C,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,aAAa,CAAC,EAAE,OAAO,CAAC,gBAAgB,CAAC,CAAC;IAC1C,iBAAiB,CAAC,EAAE,CAAC,SAAS,EAAE,gBAAgB,KAAK,IAAI,CAAC;IAC1D,eAAe,CAAC,EAAE,MAAM,IAAI,CAAC;IAC7B,kBAAkB,CAAC,EAAE,MAAM,IAAI,CAAC;CACjC;AAED,MAAM,WAAW,iBAAiB;IAChC,UAAU,EAAE,WAAW,GAAG,IAAI,CAAC;IAC/B,UAAU,EAAE,WAAW,GAAG,IAAI,CAAC;IAC/B,iBAAiB,EAAE,WAAW,GAAG,IAAI,CAAC;IACtC,iBAAiB,EAAE,WAAW,GAAG,IAAI,CAAC;IACtC,eAAe,EAAE,WAAW,GAAG,IAAI,CAAC;IACpC,gBAAgB,EAAE,MAAM,CAAC;IACzB,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B;AAED,MAAM,WAAW,0BAA0B;IACzC,UAAU,EAAE,CAAC,OAAO,EAAE,iBAAiB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1D,WAAW,EAAE,OAAO,CAAC;IACrB,gBAAgB,EAAE,gBAAgB,GAAG,IAAI,CAAC;IAC1C,UAAU,EAAE,0BAA0B,CAAC;IACvC,MAAM,EAAE,MAAM,IAAI,CAAC;CACpB;AAED,wBAAgB,oBAAoB,CAClC,OAAO,GAAE,2BAAgC,GACxC,0BAA0B,CAkF5B;AAED,eAAe,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sidebar Component - Componente headless de sidebar con arquitectura primitiva
|
|
3
|
+
*
|
|
4
|
+
* @module Sidebar
|
|
5
|
+
*
|
|
6
|
+
* @description
|
|
7
|
+
* Sistema de sidebar altamente configurable siguiendo el patrón de componentes
|
|
8
|
+
* headless inspirado en Headless UI y shadcn/ui.
|
|
9
|
+
*
|
|
10
|
+
* **Características principales:**
|
|
11
|
+
* - Arquitectura headless con primitivos componibles
|
|
12
|
+
* - Soporte para render props y data attributes
|
|
13
|
+
* - Navegación por teclado (arrows, home, end)
|
|
14
|
+
* - Indicador visual animado
|
|
15
|
+
* - Modos de colapso (hide/collapse)
|
|
16
|
+
* - Accesibilidad WAI-ARIA completa
|
|
17
|
+
* - Usa tokens CSS de shadcn para colores
|
|
18
|
+
* - Dark/Light mode automático
|
|
19
|
+
* - TypeScript strict mode
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```tsx
|
|
23
|
+
* import {
|
|
24
|
+
* Sidebar,
|
|
25
|
+
* SidebarNav,
|
|
26
|
+
* SidebarToggle,
|
|
27
|
+
* SidebarContent,
|
|
28
|
+
* SidebarIndicator,
|
|
29
|
+
* SidebarItem,
|
|
30
|
+
* SidebarIconLibrary
|
|
31
|
+
* } from '@/components/Sidebar'
|
|
32
|
+
*
|
|
33
|
+
* function App() {
|
|
34
|
+
* return (
|
|
35
|
+
* <Sidebar defaultOpen={true}>
|
|
36
|
+
* <SidebarNav>
|
|
37
|
+
* <SidebarToggle iconLibrary={SidebarIconLibrary.LUCIDE} />
|
|
38
|
+
* <SidebarIndicator />
|
|
39
|
+
* <SidebarContent>
|
|
40
|
+
* <SidebarItem href="/" icon={<HomeIcon />} label="Home" />
|
|
41
|
+
* <SidebarItem href="/settings" icon={<SettingsIcon />} label="Settings" />
|
|
42
|
+
* </SidebarContent>
|
|
43
|
+
* </SidebarNav>
|
|
44
|
+
* </Sidebar>
|
|
45
|
+
* )
|
|
46
|
+
* }
|
|
47
|
+
* ```
|
|
48
|
+
*/
|
|
49
|
+
/**
|
|
50
|
+
* Componente raíz del Sidebar (Provider)
|
|
51
|
+
*/
|
|
52
|
+
export { Sidebar } from "./Sidebar";
|
|
53
|
+
/**
|
|
54
|
+
* Contenedor de navegación con gestión de eventos
|
|
55
|
+
*/
|
|
56
|
+
export { SidebarNav } from "./SidebarNav";
|
|
57
|
+
/**
|
|
58
|
+
* Botón toggle para abrir/cerrar el sidebar
|
|
59
|
+
*/
|
|
60
|
+
export { SidebarToggle } from "./SidebarToggle";
|
|
61
|
+
/**
|
|
62
|
+
* Contenedor de items de navegación
|
|
63
|
+
*/
|
|
64
|
+
export { SidebarContent } from "./SidebarContent";
|
|
65
|
+
/**
|
|
66
|
+
* Indicador visual que sigue al cursor/focus
|
|
67
|
+
*/
|
|
68
|
+
export { SidebarIndicator } from "./SidebarIndicator";
|
|
69
|
+
/**
|
|
70
|
+
* Indicador fluid glassmorphism con spring physics (experimental)
|
|
71
|
+
*/
|
|
72
|
+
export { SidebarFluidIndicator } from "./SidebarFluidIndicator";
|
|
73
|
+
/**
|
|
74
|
+
* Área segura (top/bottom) para contenido especial
|
|
75
|
+
*/
|
|
76
|
+
export { SidebarSafeArea } from "./SidebarSafeArea";
|
|
77
|
+
/**
|
|
78
|
+
* Item individual de navegación
|
|
79
|
+
*/
|
|
80
|
+
export { SidebarItem } from "./SidebarItem";
|
|
81
|
+
/**
|
|
82
|
+
* Contenedor de subcontenido para tooltips (slot component)
|
|
83
|
+
*/
|
|
84
|
+
export { SidebarSubContent } from "./SidebarSubContent";
|
|
85
|
+
/**
|
|
86
|
+
* Link individual dentro de tooltip de subcontenido
|
|
87
|
+
*/
|
|
88
|
+
export { SidebarSubLink } from "./SidebarSubLink";
|
|
89
|
+
/**
|
|
90
|
+
* Tooltip genérico anclado al indicador
|
|
91
|
+
*/
|
|
92
|
+
export { SidebarTooltip } from "./SidebarTooltip";
|
|
93
|
+
/**
|
|
94
|
+
* Hook para acceder al contexto del sidebar
|
|
95
|
+
*
|
|
96
|
+
* @throws {Error} Si se usa fuera de un componente <Sidebar>
|
|
97
|
+
*
|
|
98
|
+
* @example
|
|
99
|
+
* ```tsx
|
|
100
|
+
* const { open, setOpen, dimensions } = useSidebarContext()
|
|
101
|
+
* ```
|
|
102
|
+
*/
|
|
103
|
+
export { useSidebarContext } from "./hooks/useSidebarContext";
|
|
104
|
+
/**
|
|
105
|
+
* Hook para navegación por teclado (arrows, home, end)
|
|
106
|
+
*
|
|
107
|
+
* @example
|
|
108
|
+
* ```tsx
|
|
109
|
+
* const { focusedIndex, updateIndicatorForFocus } = useSidebarKeyboard()
|
|
110
|
+
* ```
|
|
111
|
+
*/
|
|
112
|
+
export { useSidebarKeyboard } from "./hooks/useSidebarKeyboard";
|
|
113
|
+
/**
|
|
114
|
+
* Hook para gestión del indicador visual
|
|
115
|
+
*
|
|
116
|
+
* @example
|
|
117
|
+
* ```tsx
|
|
118
|
+
* const { isVisible, handleMouseMove } = useSidebarIndicator()
|
|
119
|
+
* ```
|
|
120
|
+
*/
|
|
121
|
+
export { useSidebarIndicator } from "./hooks/useSidebarIndicator";
|
|
122
|
+
/**
|
|
123
|
+
* Hook para acceder al contexto de subcontenido
|
|
124
|
+
*
|
|
125
|
+
* @throws {Error} Si se usa fuera de un componente <Sidebar>
|
|
126
|
+
*
|
|
127
|
+
* @example
|
|
128
|
+
* ```tsx
|
|
129
|
+
* const { registerSubContent, getSubContent } = useSubContent()
|
|
130
|
+
* ```
|
|
131
|
+
*/
|
|
132
|
+
export { useSubContent } from "./hooks/useSubContent";
|
|
133
|
+
/**
|
|
134
|
+
* Todos los tipos e interfaces del sidebar
|
|
135
|
+
*/
|
|
136
|
+
export type { SidebarProps, SidebarNavProps, SidebarToggleProps, SidebarContentProps, SidebarIndicatorProps, SidebarSafeAreaProps, SidebarItemProps, SidebarState, SidebarToggleState, SidebarItemState, SidebarIndicatorState, SidebarContextValue, SidebarDimensions, SidebarSafeAreas, SidebarAnimations, SidebarConfig, SidebarRenderProp, SidebarToggleRenderProp, SidebarItemRenderProp, SidebarIndicatorRenderProp, SidebarVisualStyle, } from "./Sidebar.types";
|
|
137
|
+
/**
|
|
138
|
+
* Tipos de componentes de subcontenido
|
|
139
|
+
*/
|
|
140
|
+
export type { SidebarSubContentProps } from "./SidebarSubContent";
|
|
141
|
+
export type { SidebarSubLinkProps } from "./SidebarSubLink";
|
|
142
|
+
export type { SidebarTooltipProps } from "./SidebarTooltip";
|
|
143
|
+
/**
|
|
144
|
+
* Enums exportados
|
|
145
|
+
*/
|
|
146
|
+
export { SidebarCollapseMode, SidebarHideBehaviour, SidebarHideOpensBehavior, SidebarLayoutBehaviour, SidebarWidth, SidebarTransitionDuration, SidebarZIndex, SidebarBorderRadius, SidebarSafeAreaPosition, SidebarTimingFunction, SidebarIconLibrary, } from "./Sidebar.types";
|
|
147
|
+
/**
|
|
148
|
+
* Constantes y valores por defecto
|
|
149
|
+
*/
|
|
150
|
+
export { DEFAULT_DIMENSIONS, DEFAULT_SAFE_AREAS, DEFAULT_ANIMATIONS, DEFAULT_CONFIG, DEFAULT_VISUAL_STYLE, SIDEBAR_KEYBOARD_KEYS, SIDEBAR_DATA_ATTRIBUTES, SIDEBAR_TAILWIND_CLASSES, SIDEBAR_DEBUG_PATTERNS, SIDEBAR_ARIA_ROLES, SIDEBAR_ARIA_LABELS, SIDEBAR_BREAKPOINTS, SIDEBAR_LIMITS, SIDEBAR_CSS_VARIABLES, SIDEBAR_VISUAL_PRESETS, } from "./Sidebar.constants";
|
|
151
|
+
/**
|
|
152
|
+
* Tipos de constantes
|
|
153
|
+
*/
|
|
154
|
+
export type { SidebarVisualPreset } from "./Sidebar.constants";
|
|
155
|
+
/**
|
|
156
|
+
* Funciones para generar estilos CSS dinámicos
|
|
157
|
+
*
|
|
158
|
+
* @note
|
|
159
|
+
* Los estilos usan tokens CSS de shadcn (--sidebar, --sidebar-primary, etc.)
|
|
160
|
+
* definidos en globals.css, permitiendo soporte automático de dark/light mode.
|
|
161
|
+
*/
|
|
162
|
+
export { generateSidebarStyles, generateIndicatorStyles } from "./Sidebar.styles";
|
|
163
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Sidebar/index.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AAMH;;GAEG;AACH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAEnC;;GAEG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAEzC;;GAEG;AACH,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAE/C;;GAEG;AACH,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAEjD;;GAEG;AACH,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAErD;;GAEG;AACH,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAA;AAE/D;;GAEG;AACH,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAEnD;;GAEG;AACH,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAE3C;;GAEG;AACH,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AAEvD;;GAEG;AACH,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAEjD;;GAEG;AACH,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAMjD;;;;;;;;;GASG;AACH,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAA;AAE7D;;;;;;;GAOG;AACH,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAA;AAE/D;;;;;;;GAOG;AACH,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAA;AAEjE;;;;;;;;;GASG;AACH,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AAMrD;;GAEG;AACH,YAAY,EACV,YAAY,EACZ,eAAe,EACf,kBAAkB,EAClB,mBAAmB,EACnB,qBAAqB,EACrB,oBAAoB,EACpB,gBAAgB,EAChB,YAAY,EACZ,kBAAkB,EAClB,gBAAgB,EAChB,qBAAqB,EACrB,mBAAmB,EACnB,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,EACjB,aAAa,EACb,iBAAiB,EACjB,uBAAuB,EACvB,qBAAqB,EACrB,0BAA0B,EAC1B,kBAAkB,GACnB,MAAM,iBAAiB,CAAA;AAExB;;GAEG;AACH,YAAY,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAA;AACjE,YAAY,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAA;AAC3D,YAAY,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAA;AAE3D;;GAEG;AACH,OAAO,EACL,mBAAmB,EACnB,oBAAoB,EACpB,wBAAwB,EACxB,sBAAsB,EACtB,YAAY,EACZ,yBAAyB,EACzB,aAAa,EACb,mBAAmB,EACnB,uBAAuB,EACvB,qBAAqB,EACrB,kBAAkB,GACnB,MAAM,iBAAiB,CAAA;AAMxB;;GAEG;AACH,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,kBAAkB,EAClB,cAAc,EACd,oBAAoB,EACpB,qBAAqB,EACrB,uBAAuB,EACvB,wBAAwB,EACxB,sBAAsB,EACtB,kBAAkB,EAClB,mBAAmB,EACnB,mBAAmB,EACnB,cAAc,EACd,qBAAqB,EACrB,sBAAsB,GACvB,MAAM,qBAAqB,CAAA;AAE5B;;GAEG;AACH,YAAY,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;AAM9D;;;;;;GAMG;AACH,OAAO,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAA"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { SidebarLiquidGlassConfig } from './Sidebar.types';
|
|
2
|
+
/**
|
|
3
|
+
* Valores por defecto para Liquid Glass V2
|
|
4
|
+
*
|
|
5
|
+
* @description
|
|
6
|
+
* Configuración conservadora que prioriza compatibilidad y performance:
|
|
7
|
+
* - Liquid Glass V2 desactivado por defecto (opt-in)
|
|
8
|
+
* - Chromatic Aberration desactivado (requiere opt-in explícito)
|
|
9
|
+
* - Edge Glass 3D y Backdrop Extension activados cuando V2 está habilitado
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```tsx
|
|
13
|
+
* // Activar todas las features V2
|
|
14
|
+
* <Sidebar
|
|
15
|
+
* liquidGlass={{
|
|
16
|
+
* enableLiquidGlassV2: true,
|
|
17
|
+
* enableChromaticAberration: true
|
|
18
|
+
* }}
|
|
19
|
+
* />
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
export declare const DEFAULT_LIQUID_GLASS_CONFIG: SidebarLiquidGlassConfig;
|
|
23
|
+
/**
|
|
24
|
+
* Helper para merge de configuración liquid glass con defaults
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```tsx
|
|
28
|
+
* const config = mergeLiquidGlassConfig({ enableLiquidGlassV2: true })
|
|
29
|
+
* // { enableLiquidGlassV2: true, enableChromaticAberration: false, ... }
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
export declare function mergeLiquidGlassConfig(override?: Partial<SidebarLiquidGlassConfig>): SidebarLiquidGlassConfig;
|
|
33
|
+
/**
|
|
34
|
+
* Validar configuración de liquid glass
|
|
35
|
+
*
|
|
36
|
+
* @description
|
|
37
|
+
* Verifica que las flags dependientes tengan sus requisitos satisfechos:
|
|
38
|
+
* - Chromatic Aberration requiere Liquid Glass V2
|
|
39
|
+
* - Edge Glass 3D requiere Liquid Glass V2
|
|
40
|
+
* - Backdrop Extension requiere Liquid Glass V2
|
|
41
|
+
*
|
|
42
|
+
* @returns Configuración validada con warnings en consola si hay conflictos
|
|
43
|
+
*/
|
|
44
|
+
export declare function validateLiquidGlassConfig(config: SidebarLiquidGlassConfig): SidebarLiquidGlassConfig;
|
|
45
|
+
/**
|
|
46
|
+
* Tipo guard para verificar si Liquid Glass V2 está habilitado
|
|
47
|
+
*/
|
|
48
|
+
export declare function isLiquidGlassV2Enabled(config: SidebarLiquidGlassConfig): boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Tipo guard para verificar si Chromatic Aberration está habilitado
|
|
51
|
+
* (y sus requisitos están satisfechos)
|
|
52
|
+
*/
|
|
53
|
+
export declare function isChromaticAberrationEnabled(config: SidebarLiquidGlassConfig): boolean;
|
|
54
|
+
//# sourceMappingURL=sidebar-defaults.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sidebar-defaults.d.ts","sourceRoot":"","sources":["../../../src/components/Sidebar/sidebar-defaults.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,iBAAiB,CAAA;AAE/D;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,2BAA2B,EAAE,wBAmDzC,CAAA;AAED;;;;;;;;GAQG;AACH,wBAAgB,sBAAsB,CACpC,QAAQ,CAAC,EAAE,OAAO,CAAC,wBAAwB,CAAC,GAC3C,wBAAwB,CAK1B;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,yBAAyB,CACvC,MAAM,EAAE,wBAAwB,GAC/B,wBAAwB,CA+B1B;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,wBAAwB,GAC/B,OAAO,CAET;AAED;;;GAGG;AACH,wBAAgB,4BAA4B,CAC1C,MAAM,EAAE,wBAAwB,GAC/B,OAAO,CAGT"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { type SwitchProps as SwitchPrimitiveProps } from '@/components/animate-ui/primitives/base/switch';
|
|
3
|
+
type SwitchProps = SwitchPrimitiveProps & {
|
|
4
|
+
pressedWidth?: number;
|
|
5
|
+
startIcon?: React.ReactElement;
|
|
6
|
+
endIcon?: React.ReactElement;
|
|
7
|
+
thumbIcon?: React.ReactElement;
|
|
8
|
+
};
|
|
9
|
+
declare function Switch({ className, pressedWidth, startIcon, endIcon, thumbIcon, ...props }: SwitchProps): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export { Switch, type SwitchProps };
|
|
11
|
+
//# sourceMappingURL=switch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"switch.d.ts","sourceRoot":"","sources":["../../../../../src/components/animate-ui/components/base/switch.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAIL,KAAK,WAAW,IAAI,oBAAoB,EACzC,MAAM,gDAAgD,CAAC;AAGxD,KAAK,WAAW,GAAG,oBAAoB,GAAG;IACxC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,KAAK,CAAC,YAAY,CAAC;IAC/B,OAAO,CAAC,EAAE,KAAK,CAAC,YAAY,CAAC;IAC7B,SAAS,CAAC,EAAE,KAAK,CAAC,YAAY,CAAC;CAChC,CAAC;AAEF,iBAAS,MAAM,CAAC,EACd,SAAS,EACT,YAAiB,EACjB,SAAS,EACT,OAAO,EACP,SAAS,EACT,GAAG,KAAK,EACT,EAAE,WAAW,2CA4Cb;AAED,OAAO,EAAE,MAAM,EAAE,KAAK,WAAW,EAAE,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { Switch as SwitchPrimitives } from '@base-ui-components/react/switch';
|
|
3
|
+
import { type TargetAndTransition, type VariantLabels, type HTMLMotionProps, type LegacyAnimationControls } from 'motion/react';
|
|
4
|
+
type SwitchContextType = {
|
|
5
|
+
isChecked: boolean;
|
|
6
|
+
setIsChecked: SwitchProps['onCheckedChange'];
|
|
7
|
+
isPressed: boolean;
|
|
8
|
+
setIsPressed: (isPressed: boolean) => void;
|
|
9
|
+
};
|
|
10
|
+
declare const useSwitch: () => SwitchContextType;
|
|
11
|
+
type SwitchProps = Omit<React.ComponentProps<typeof SwitchPrimitives.Root>, 'render'> & HTMLMotionProps<'button'>;
|
|
12
|
+
declare function Switch({ name, defaultChecked, checked, onCheckedChange, nativeButton, disabled, readOnly, required, inputRef, id, ...props }: SwitchProps): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
type SwitchThumbProps = Omit<React.ComponentProps<typeof SwitchPrimitives.Thumb>, 'render'> & HTMLMotionProps<'div'> & {
|
|
14
|
+
pressedAnimation?: TargetAndTransition | VariantLabels | boolean | LegacyAnimationControls;
|
|
15
|
+
};
|
|
16
|
+
declare function SwitchThumb({ pressedAnimation, transition, ...props }: SwitchThumbProps): import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
type SwitchIconPosition = 'left' | 'right' | 'thumb';
|
|
18
|
+
type SwitchIconProps = HTMLMotionProps<'div'> & {
|
|
19
|
+
position: SwitchIconPosition;
|
|
20
|
+
};
|
|
21
|
+
declare function SwitchIcon({ position, transition, ...props }: SwitchIconProps): import("react/jsx-runtime").JSX.Element;
|
|
22
|
+
export { Switch, SwitchThumb, SwitchIcon, useSwitch, type SwitchProps, type SwitchThumbProps, type SwitchIconProps, type SwitchIconPosition, type SwitchContextType, };
|
|
23
|
+
//# sourceMappingURL=switch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"switch.d.ts","sourceRoot":"","sources":["../../../../../src/components/animate-ui/primitives/base/switch.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,MAAM,IAAI,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AAC9E,OAAO,EAEL,KAAK,mBAAmB,EACxB,KAAK,aAAa,EAClB,KAAK,eAAe,EACpB,KAAK,uBAAuB,EAC7B,MAAM,cAAc,CAAC;AAKtB,KAAK,iBAAiB,GAAG;IACvB,SAAS,EAAE,OAAO,CAAC;IACnB,YAAY,EAAE,WAAW,CAAC,iBAAiB,CAAC,CAAC;IAC7C,SAAS,EAAE,OAAO,CAAC;IACnB,YAAY,EAAE,CAAC,SAAS,EAAE,OAAO,KAAK,IAAI,CAAC;CAC5C,CAAC;AAEF,QAAA,MAAuB,SAAS,yBACsB,CAAC;AAEvD,KAAK,WAAW,GAAG,IAAI,CACrB,KAAK,CAAC,cAAc,CAAC,OAAO,gBAAgB,CAAC,IAAI,CAAC,EAClD,QAAQ,CACT,GACC,eAAe,CAAC,QAAQ,CAAC,CAAC;AAE5B,iBAAS,MAAM,CAAC,EACd,IAAI,EACJ,cAAc,EACd,OAAO,EACP,eAAe,EACf,YAAY,EACZ,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,EAAE,EACF,GAAG,KAAK,EACT,EAAE,WAAW,2CAqCb;AAED,KAAK,gBAAgB,GAAG,IAAI,CAC1B,KAAK,CAAC,cAAc,CAAC,OAAO,gBAAgB,CAAC,KAAK,CAAC,EACnD,QAAQ,CACT,GACC,eAAe,CAAC,KAAK,CAAC,GAAG;IACvB,gBAAgB,CAAC,EACb,mBAAmB,GACnB,aAAa,GACb,OAAO,GACP,uBAAuB,CAAC;CAC7B,CAAC;AAEJ,iBAAS,WAAW,CAAC,EACnB,gBAAgB,EAChB,UAA4D,EAC5D,GAAG,KAAK,EACT,EAAE,gBAAgB,2CAiBlB;AAED,KAAK,kBAAkB,GAAG,MAAM,GAAG,OAAO,GAAG,OAAO,CAAC;AAErD,KAAK,eAAe,GAAG,eAAe,CAAC,KAAK,CAAC,GAAG;IAC9C,QAAQ,EAAE,kBAAkB,CAAC;CAC9B,CAAC;AAEF,iBAAS,UAAU,CAAC,EAClB,QAAQ,EACR,UAA0C,EAC1C,GAAG,KAAK,EACT,EAAE,eAAe,2CAkBjB;AAED,OAAO,EACL,MAAM,EACN,WAAW,EACX,UAAU,EACV,SAAS,EACT,KAAK,WAAW,EAChB,KAAK,gBAAgB,EACrB,KAAK,eAAe,EACpB,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,GACvB,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { RefObject } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* FluidHoverIndicatorV2 Props
|
|
4
|
+
*/
|
|
5
|
+
export interface FluidHoverIndicatorV2Props {
|
|
6
|
+
/** Target element to track */
|
|
7
|
+
targetElement: HTMLElement | null;
|
|
8
|
+
/** Whether the indicator should be visible */
|
|
9
|
+
isVisible: boolean;
|
|
10
|
+
/** Optional className for customization */
|
|
11
|
+
className?: string;
|
|
12
|
+
/** Container ref for relative positioning (default: targetElement.parentElement) */
|
|
13
|
+
containerRef?: RefObject<HTMLElement>;
|
|
14
|
+
/** Enable chromatic aberration (Phase 2) */
|
|
15
|
+
enableChromaticAberration?: boolean;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Fluid Hover Indicator V2 - Con Liquid Glass Effect
|
|
19
|
+
*
|
|
20
|
+
* @description
|
|
21
|
+
* Versión mejorada del FluidHoverIndicator que combina:
|
|
22
|
+
* - **Spring physics** del original (anticipation, stretch, overshoot)
|
|
23
|
+
* - **Liquid glass effect** con SVG displacement mapping
|
|
24
|
+
* - **Refracción real** según Snell's Law
|
|
25
|
+
* - **Chromatic aberration** RGB opcional (Phase 2)
|
|
26
|
+
* - **Backdrop extension** para capturar elementos cercanos
|
|
27
|
+
*
|
|
28
|
+
* Features del research aplicadas:
|
|
29
|
+
* - ✅ SVG Displacement (Kube.io) → Refracción física
|
|
30
|
+
* - ✅ Chromatic Aberration (Atlas Pup Labs) → RGB channels
|
|
31
|
+
* - ✅ Performance Optimizations → GPU acceleration
|
|
32
|
+
* - ✅ Backdrop Extension (Josh Comeau) → Captura elementos nearby
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```tsx
|
|
36
|
+
* <SidebarNav>
|
|
37
|
+
* <FluidHoverIndicatorV2
|
|
38
|
+
* targetElement={hoveredItem}
|
|
39
|
+
* isVisible={isHovering}
|
|
40
|
+
* enableChromaticAberration={true}
|
|
41
|
+
* />
|
|
42
|
+
* </SidebarNav>
|
|
43
|
+
* ```
|
|
44
|
+
*/
|
|
45
|
+
export declare function FluidHoverIndicatorV2({ targetElement, isVisible, className, containerRef, enableChromaticAberration }: FluidHoverIndicatorV2Props): import("react/jsx-runtime").JSX.Element;
|
|
46
|
+
//# sourceMappingURL=fluid-hover-indicator-v2.d.ts.map
|