@mks2508/sidebar-headless 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +251 -0
- package/dist/index.css +238 -0
- package/dist/index.css.map +1 -0
- package/dist/index.d.cts +1663 -0
- package/dist/index.d.ts +1663 -0
- package/dist/index.js +44495 -0
- package/dist/index.js.map +1 -0
- package/package.json +99 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 MKS2508
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
# @mks2508/sidebar-headless
|
|
2
|
+
|
|
3
|
+
Headless sidebar component for React with advanced animations, keyboard navigation, and full WAI-ARIA accessibility.
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/@mks2508/sidebar-headless)
|
|
6
|
+
[](https://opensource.org/licenses/MIT)
|
|
7
|
+
|
|
8
|
+
## Features
|
|
9
|
+
|
|
10
|
+
- 🎨 **Headless Architecture** - Complete control over styling and behavior
|
|
11
|
+
- ⌨️ **Keyboard Navigation** - Full arrow key, Home/End support
|
|
12
|
+
- ♿ **WAI-ARIA Compliant** - Full accessibility out of the box
|
|
13
|
+
- 🎠**Advanced Animations** - Fluid hover indicators, glassmorphism effects, 3D transforms
|
|
14
|
+
- 🎯 **TypeScript First** - Full type safety with comprehensive declarations
|
|
15
|
+
- 🪶 **Lightweight** - Minimal dependencies (only clsx + tailwind-merge)
|
|
16
|
+
- 🎨 **Dark/Light Mode** - Automatic theme support via CSS tokens
|
|
17
|
+
- đź”§ **Highly Configurable** - Extensive customization options
|
|
18
|
+
|
|
19
|
+
## Installation
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
npm install @mks2508/sidebar-headless
|
|
23
|
+
# or
|
|
24
|
+
yarn add @mks2508/sidebar-headless
|
|
25
|
+
# or
|
|
26
|
+
pnpm add @mks2508/sidebar-headless
|
|
27
|
+
# or
|
|
28
|
+
bun add @mks2508/sidebar-headless
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### Peer Dependencies
|
|
32
|
+
|
|
33
|
+
This package requires React 18+:
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
npm install react react-dom
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### Optional Dependencies
|
|
40
|
+
|
|
41
|
+
For advanced liquid glass effects (optional):
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
npm install @liquid-svg-glass/core @liquid-svg-glass/react
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Quick Start
|
|
48
|
+
|
|
49
|
+
```tsx
|
|
50
|
+
import {
|
|
51
|
+
Sidebar,
|
|
52
|
+
SidebarNav,
|
|
53
|
+
SidebarToggle,
|
|
54
|
+
SidebarContent,
|
|
55
|
+
SidebarItem,
|
|
56
|
+
SidebarIconLibrary
|
|
57
|
+
} from '@mks2508/sidebar-headless'
|
|
58
|
+
import '@mks2508/sidebar-headless/styles.css'
|
|
59
|
+
|
|
60
|
+
function App() {
|
|
61
|
+
return (
|
|
62
|
+
<Sidebar defaultOpen={true}>
|
|
63
|
+
<SidebarNav>
|
|
64
|
+
<SidebarToggle iconLibrary={SidebarIconLibrary.LUCIDE} />
|
|
65
|
+
<SidebarContent>
|
|
66
|
+
<SidebarItem href="/" icon={<HomeIcon />} label="Home" />
|
|
67
|
+
<SidebarItem href="/settings" icon={<SettingsIcon />} label="Settings" />
|
|
68
|
+
</SidebarContent>
|
|
69
|
+
</SidebarNav>
|
|
70
|
+
</Sidebar>
|
|
71
|
+
)
|
|
72
|
+
}
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## Core Components
|
|
76
|
+
|
|
77
|
+
### Sidebar (Root Provider)
|
|
78
|
+
|
|
79
|
+
The main container that provides context to all child components.
|
|
80
|
+
|
|
81
|
+
```tsx
|
|
82
|
+
<Sidebar
|
|
83
|
+
defaultOpen={true}
|
|
84
|
+
collapseMode="hide"
|
|
85
|
+
layoutBehaviour="floating"
|
|
86
|
+
>
|
|
87
|
+
{/* ... */}
|
|
88
|
+
</Sidebar>
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### SidebarNav
|
|
92
|
+
|
|
93
|
+
Navigation container with event management.
|
|
94
|
+
|
|
95
|
+
```tsx
|
|
96
|
+
<SidebarNav>
|
|
97
|
+
<SidebarToggle />
|
|
98
|
+
<SidebarContent>
|
|
99
|
+
{/* items */}
|
|
100
|
+
</SidebarContent>
|
|
101
|
+
</SidebarNav>
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### SidebarItem
|
|
105
|
+
|
|
106
|
+
Individual navigation item with optional sub-content.
|
|
107
|
+
|
|
108
|
+
```tsx
|
|
109
|
+
<SidebarItem
|
|
110
|
+
href="/dashboard"
|
|
111
|
+
icon={<DashboardIcon />}
|
|
112
|
+
label="Dashboard"
|
|
113
|
+
>
|
|
114
|
+
<SidebarSubContent title="Dashboard">
|
|
115
|
+
<SidebarSubLink href="/analytics">Analytics</SidebarSubLink>
|
|
116
|
+
<SidebarSubLink href="/reports">Reports</SidebarSubLink>
|
|
117
|
+
</SidebarSubContent>
|
|
118
|
+
</SidebarItem>
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
## Configuration Options
|
|
122
|
+
|
|
123
|
+
### Collapse Modes
|
|
124
|
+
|
|
125
|
+
```tsx
|
|
126
|
+
import { SidebarCollapseMode } from '@mks2508/sidebar-headless'
|
|
127
|
+
|
|
128
|
+
// Collapse to icon-only width
|
|
129
|
+
<Sidebar collapseMode={SidebarCollapseMode.COLLAPSE} />
|
|
130
|
+
|
|
131
|
+
// Hide completely
|
|
132
|
+
<Sidebar collapseMode={SidebarCollapseMode.HIDE} />
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
### Layout Behaviours
|
|
136
|
+
|
|
137
|
+
```tsx
|
|
138
|
+
import { SidebarLayoutBehaviour } from '@mks2508/sidebar-headless'
|
|
139
|
+
|
|
140
|
+
// Floating sidebar (doesn't push content)
|
|
141
|
+
<Sidebar layoutBehaviour={SidebarLayoutBehaviour.FLOATING} />
|
|
142
|
+
|
|
143
|
+
// Inline sidebar (pushes content)
|
|
144
|
+
<Sidebar layoutBehaviour={SidebarLayoutBehaviour.INLINE} />
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
### Custom Dimensions
|
|
148
|
+
|
|
149
|
+
```tsx
|
|
150
|
+
<Sidebar
|
|
151
|
+
dimensions={{
|
|
152
|
+
collapsedWidth: "4rem",
|
|
153
|
+
expandedWidth: "18rem",
|
|
154
|
+
indicatorHeight: "3rem",
|
|
155
|
+
tooltipDistance: "16px"
|
|
156
|
+
}}
|
|
157
|
+
/>
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
## Advanced Features
|
|
161
|
+
|
|
162
|
+
### Fluid Indicators
|
|
163
|
+
|
|
164
|
+
Enable glassmorphism-style hover indicators:
|
|
165
|
+
|
|
166
|
+
```tsx
|
|
167
|
+
<Sidebar
|
|
168
|
+
enableFluidIndicator={true}
|
|
169
|
+
liquidGlass={{
|
|
170
|
+
enableLiquidGlassV2: true,
|
|
171
|
+
enableChromaticAberration: true
|
|
172
|
+
}}
|
|
173
|
+
/>
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
### Keyboard Navigation
|
|
177
|
+
|
|
178
|
+
Built-in keyboard shortcuts:
|
|
179
|
+
|
|
180
|
+
- **Arrow Up/Down**: Navigate between items
|
|
181
|
+
- **Home**: Jump to first item
|
|
182
|
+
- **End**: Jump to last item
|
|
183
|
+
- **Enter**: Activate focused item
|
|
184
|
+
|
|
185
|
+
### Render Props
|
|
186
|
+
|
|
187
|
+
Access sidebar state via render props:
|
|
188
|
+
|
|
189
|
+
```tsx
|
|
190
|
+
<Sidebar>
|
|
191
|
+
{({ open, collapsed }) => (
|
|
192
|
+
<div>
|
|
193
|
+
<SidebarNav />
|
|
194
|
+
<p>Sidebar is {open ? 'open' : 'closed'}</p>
|
|
195
|
+
</div>
|
|
196
|
+
)}
|
|
197
|
+
</Sidebar>
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
## Styling
|
|
201
|
+
|
|
202
|
+
The sidebar uses shadcn-style CSS tokens for theming:
|
|
203
|
+
|
|
204
|
+
```css
|
|
205
|
+
:root {
|
|
206
|
+
--sidebar: oklch(98% 0 0);
|
|
207
|
+
--sidebar-foreground: oklch(20% 0 0);
|
|
208
|
+
--sidebar-primary: oklch(55% 0.2 250);
|
|
209
|
+
--sidebar-accent: oklch(95% 0.01 250);
|
|
210
|
+
--sidebar-border: oklch(90% 0.01 250);
|
|
211
|
+
--sidebar-ring: oklch(55% 0.2 250);
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
.dark {
|
|
215
|
+
--sidebar: oklch(17% 0 0);
|
|
216
|
+
--sidebar-foreground: oklch(90% 0 0);
|
|
217
|
+
/* ... */
|
|
218
|
+
}
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
## TypeScript Support
|
|
222
|
+
|
|
223
|
+
Full TypeScript support with comprehensive type definitions:
|
|
224
|
+
|
|
225
|
+
```tsx
|
|
226
|
+
import type {
|
|
227
|
+
SidebarProps,
|
|
228
|
+
SidebarItemProps,
|
|
229
|
+
SidebarContextValue
|
|
230
|
+
} from '@mks2508/sidebar-headless'
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
## Browser Support
|
|
234
|
+
|
|
235
|
+
- Chrome/Edge (latest)
|
|
236
|
+
- Firefox (latest)
|
|
237
|
+
- Safari (latest)
|
|
238
|
+
- Modern browsers with ES2020 support
|
|
239
|
+
|
|
240
|
+
## License
|
|
241
|
+
|
|
242
|
+
MIT © MKS2508
|
|
243
|
+
|
|
244
|
+
## Contributing
|
|
245
|
+
|
|
246
|
+
Contributions are welcome! Please feel free to submit a Pull Request.
|
|
247
|
+
|
|
248
|
+
## Links
|
|
249
|
+
|
|
250
|
+
- [GitHub Repository](https://github.com/mks2508/sidebar-headless)
|
|
251
|
+
- [Report Issues](https://github.com/mks2508/sidebar-headless/issues)
|
package/dist/index.css
ADDED
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
/* src/components/ui/text-cylinder.module.css */
|
|
2
|
+
.container {
|
|
3
|
+
position: relative;
|
|
4
|
+
overflow: hidden;
|
|
5
|
+
perspective: var(--cylinder-perspective, 1000px);
|
|
6
|
+
}
|
|
7
|
+
.cylinder {
|
|
8
|
+
position: relative;
|
|
9
|
+
width: 100%;
|
|
10
|
+
height: 100%;
|
|
11
|
+
transform-style: preserve-3d;
|
|
12
|
+
transform: rotateX(var(--cylinder-rotation, 0deg));
|
|
13
|
+
}
|
|
14
|
+
.face {
|
|
15
|
+
position: absolute;
|
|
16
|
+
inset: 0;
|
|
17
|
+
display: flex;
|
|
18
|
+
align-items: center;
|
|
19
|
+
justify-content: center;
|
|
20
|
+
backface-visibility: hidden;
|
|
21
|
+
transition: opacity 0.3s ease;
|
|
22
|
+
}
|
|
23
|
+
.face.visible {
|
|
24
|
+
opacity: 1;
|
|
25
|
+
pointer-events: auto;
|
|
26
|
+
}
|
|
27
|
+
.face.hidden {
|
|
28
|
+
opacity: 0;
|
|
29
|
+
pointer-events: none;
|
|
30
|
+
}
|
|
31
|
+
.cylinder.animating .face {
|
|
32
|
+
will-change: opacity;
|
|
33
|
+
}
|
|
34
|
+
.cylinder.animating {
|
|
35
|
+
will-change: transform;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/* src/animations/tooltip-keyframes.css */
|
|
39
|
+
@keyframes tooltip-item-enter {
|
|
40
|
+
from {
|
|
41
|
+
opacity: 0;
|
|
42
|
+
transform: translateX(-8px);
|
|
43
|
+
}
|
|
44
|
+
to {
|
|
45
|
+
opacity: 1;
|
|
46
|
+
transform: translateX(0);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
@keyframes tooltip-item-exit {
|
|
50
|
+
from {
|
|
51
|
+
opacity: 1;
|
|
52
|
+
transform: translateX(0);
|
|
53
|
+
}
|
|
54
|
+
to {
|
|
55
|
+
opacity: 0;
|
|
56
|
+
transform: translateX(-4px);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
.sidebar-sublink[data-state=entering] {
|
|
60
|
+
animation: tooltip-item-enter 150ms cubic-bezier(0.4, 0, 0.2, 1);
|
|
61
|
+
animation-delay: calc(var(--animation-order, 0) * 30ms + 150ms);
|
|
62
|
+
animation-fill-mode: both;
|
|
63
|
+
}
|
|
64
|
+
.sidebar-sublink[data-state=leaving] {
|
|
65
|
+
animation: tooltip-item-exit 100ms cubic-bezier(0.4, 0, 0.6, 1);
|
|
66
|
+
animation-delay: calc(var(--animation-order, 0) * 20ms);
|
|
67
|
+
animation-fill-mode: both;
|
|
68
|
+
}
|
|
69
|
+
@keyframes tooltip-title-rotate-up {
|
|
70
|
+
from {
|
|
71
|
+
transform: rotateX(0deg);
|
|
72
|
+
opacity: 1;
|
|
73
|
+
}
|
|
74
|
+
to {
|
|
75
|
+
transform: rotateX(-90deg);
|
|
76
|
+
opacity: 0;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
@keyframes tooltip-title-enter-from-below {
|
|
80
|
+
from {
|
|
81
|
+
transform: rotateX(90deg);
|
|
82
|
+
opacity: 0;
|
|
83
|
+
}
|
|
84
|
+
to {
|
|
85
|
+
transform: rotateX(0deg);
|
|
86
|
+
opacity: 1;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
@keyframes tooltip-title-rotate-down {
|
|
90
|
+
from {
|
|
91
|
+
transform: rotateX(0deg);
|
|
92
|
+
opacity: 1;
|
|
93
|
+
}
|
|
94
|
+
to {
|
|
95
|
+
transform: rotateX(90deg);
|
|
96
|
+
opacity: 0;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
@keyframes tooltip-title-enter-from-above {
|
|
100
|
+
from {
|
|
101
|
+
transform: rotateX(-90deg);
|
|
102
|
+
opacity: 0;
|
|
103
|
+
}
|
|
104
|
+
to {
|
|
105
|
+
transform: rotateX(0deg);
|
|
106
|
+
opacity: 1;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
.tooltip-title[data-direction=up][data-state=leaving] {
|
|
110
|
+
animation: tooltip-title-rotate-up 250ms cubic-bezier(0.4, 0, 0.2, 1) forwards;
|
|
111
|
+
}
|
|
112
|
+
.tooltip-title[data-direction=up][data-state=entering] {
|
|
113
|
+
animation: tooltip-title-enter-from-below 250ms cubic-bezier(0.4, 0, 0.2, 1) forwards;
|
|
114
|
+
}
|
|
115
|
+
.tooltip-title[data-direction=down][data-state=leaving] {
|
|
116
|
+
animation: tooltip-title-rotate-down 250ms cubic-bezier(0.4, 0, 0.2, 1) forwards;
|
|
117
|
+
}
|
|
118
|
+
.tooltip-title[data-direction=down][data-state=entering] {
|
|
119
|
+
animation: tooltip-title-enter-from-above 250ms cubic-bezier(0.4, 0, 0.2, 1) forwards;
|
|
120
|
+
}
|
|
121
|
+
.title-scene {
|
|
122
|
+
perspective: 600px;
|
|
123
|
+
position: relative;
|
|
124
|
+
width: 100%;
|
|
125
|
+
height: 2rem;
|
|
126
|
+
}
|
|
127
|
+
.title-cube {
|
|
128
|
+
width: 100%;
|
|
129
|
+
height: 100%;
|
|
130
|
+
position: relative;
|
|
131
|
+
transform-style: preserve-3d;
|
|
132
|
+
transition: transform 250ms cubic-bezier(0.4, 0, 0.2, 1);
|
|
133
|
+
transform: translateZ(-1rem);
|
|
134
|
+
}
|
|
135
|
+
.title-face {
|
|
136
|
+
position: absolute;
|
|
137
|
+
width: 100%;
|
|
138
|
+
height: 100%;
|
|
139
|
+
backface-visibility: hidden;
|
|
140
|
+
display: flex;
|
|
141
|
+
align-items: center;
|
|
142
|
+
justify-content: flex-start;
|
|
143
|
+
padding: 0 1rem;
|
|
144
|
+
font-weight: 500;
|
|
145
|
+
}
|
|
146
|
+
.title-face--front {
|
|
147
|
+
transform: rotateX(0deg) translateZ(1rem);
|
|
148
|
+
}
|
|
149
|
+
.title-face--top {
|
|
150
|
+
transform: rotateX(90deg) translateZ(1rem);
|
|
151
|
+
}
|
|
152
|
+
.title-face--bottom {
|
|
153
|
+
transform: rotateX(-90deg) translateZ(1rem);
|
|
154
|
+
}
|
|
155
|
+
.title-face--back {
|
|
156
|
+
transform: rotateX(180deg) translateZ(1rem);
|
|
157
|
+
}
|
|
158
|
+
.title-cube[data-face=front] {
|
|
159
|
+
transform: translateZ(-1rem) rotateX(0deg);
|
|
160
|
+
}
|
|
161
|
+
.title-cube[data-face=top] {
|
|
162
|
+
transform: translateZ(-1rem) rotateX(-90deg);
|
|
163
|
+
}
|
|
164
|
+
.title-cube[data-face=bottom] {
|
|
165
|
+
transform: translateZ(-1rem) rotateX(90deg);
|
|
166
|
+
}
|
|
167
|
+
.title-cube[data-face=back] {
|
|
168
|
+
transform: translateZ(-1rem) rotateX(180deg);
|
|
169
|
+
}
|
|
170
|
+
.tooltip-content-grid {
|
|
171
|
+
display: grid;
|
|
172
|
+
grid-template-rows: 0fr;
|
|
173
|
+
transition: grid-template-rows 200ms cubic-bezier(0.4, 0, 0.2, 1);
|
|
174
|
+
transition-delay: 50ms;
|
|
175
|
+
}
|
|
176
|
+
.tooltip-content-grid[data-state=open] {
|
|
177
|
+
grid-template-rows: 1fr;
|
|
178
|
+
}
|
|
179
|
+
.tooltip-content-inner {
|
|
180
|
+
overflow: hidden;
|
|
181
|
+
min-height: 0;
|
|
182
|
+
}
|
|
183
|
+
.tooltip-title-perspective {
|
|
184
|
+
perspective: 600px;
|
|
185
|
+
position: relative;
|
|
186
|
+
width: 100%;
|
|
187
|
+
height: 2rem;
|
|
188
|
+
overflow: hidden;
|
|
189
|
+
}
|
|
190
|
+
.tooltip-no-animations * {
|
|
191
|
+
animation: none !important;
|
|
192
|
+
transition: none !important;
|
|
193
|
+
}
|
|
194
|
+
[data-tooltip-debug=true] .sidebar-sublink[data-state]::before {
|
|
195
|
+
content: attr(data-state);
|
|
196
|
+
position: absolute;
|
|
197
|
+
top: 0;
|
|
198
|
+
right: 0;
|
|
199
|
+
font-size: 8px;
|
|
200
|
+
background: rgba(255, 0, 0, 0.8);
|
|
201
|
+
color: white;
|
|
202
|
+
padding: 2px 4px;
|
|
203
|
+
border-radius: 2px;
|
|
204
|
+
pointer-events: none;
|
|
205
|
+
z-index: 1000;
|
|
206
|
+
}
|
|
207
|
+
[data-tooltip-debug=true] .tooltip-title[data-direction]::after {
|
|
208
|
+
content: "dir:" attr(data-direction);
|
|
209
|
+
position: absolute;
|
|
210
|
+
bottom: 0;
|
|
211
|
+
left: 0;
|
|
212
|
+
font-size: 8px;
|
|
213
|
+
background: rgba(0, 0, 255, 0.8);
|
|
214
|
+
color: white;
|
|
215
|
+
padding: 2px 4px;
|
|
216
|
+
border-radius: 2px;
|
|
217
|
+
pointer-events: none;
|
|
218
|
+
z-index: 1000;
|
|
219
|
+
}
|
|
220
|
+
.sidebar-sublink[data-state],
|
|
221
|
+
.tooltip-title[data-state],
|
|
222
|
+
.title-cube {
|
|
223
|
+
will-change: transform, opacity;
|
|
224
|
+
}
|
|
225
|
+
.tooltip-content-grid {
|
|
226
|
+
contain: layout style paint;
|
|
227
|
+
}
|
|
228
|
+
@media (prefers-reduced-motion: reduce) {
|
|
229
|
+
.sidebar-sublink[data-state],
|
|
230
|
+
.tooltip-title[data-state],
|
|
231
|
+
.title-cube,
|
|
232
|
+
.tooltip-content-grid {
|
|
233
|
+
animation-duration: 0.01ms !important;
|
|
234
|
+
animation-iteration-count: 1 !important;
|
|
235
|
+
transition-duration: 0.01ms !important;
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
/*# sourceMappingURL=index.css.map */
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/ui/text-cylinder.module.css","../src/animations/tooltip-keyframes.css"],"sourcesContent":["/* CSS Custom Properties for dynamic configuration */\n.container {\n position: relative;\n overflow: hidden;\n perspective: var(--cylinder-perspective, 1000px);\n}\n\n.cylinder {\n position: relative;\n width: 100%;\n height: 100%;\n transform-style: preserve-3d;\n /* Rotation is controlled by Web Animations API */\n transform: rotateX(var(--cylinder-rotation, 0deg));\n}\n\n.face {\n position: absolute;\n inset: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n backface-visibility: hidden;\n /* Transform is set via inline style for dynamic positioning */\n transition: opacity 0.3s ease;\n}\n\n.face.visible {\n opacity: 1;\n pointer-events: auto;\n}\n\n.face.hidden {\n opacity: 0;\n pointer-events: none;\n}\n\n/* Optional: Add will-change for performance on faces that are animating */\n.cylinder.animating .face {\n will-change: opacity;\n}\n\n.cylinder.animating {\n will-change: transform;\n}\n","/**\n * Tooltip Transition Keyframes\n *\n * Sistema de animaciones CSS para transiciones de tooltip con:\n * - Items staggered enter/exit\n * - Grid-based height transitions\n * - 3D title rotations\n *\n * Performance: GPU-accelerated (transform + opacity only)\n */\n\n/* ============================================================================\n ITEMS ANIMATIONS - Staggered Enter/Exit\n ============================================================================ */\n\n@keyframes tooltip-item-enter {\n from {\n opacity: 0;\n transform: translateX(-8px);\n }\n to {\n opacity: 1;\n transform: translateX(0);\n }\n}\n\n@keyframes tooltip-item-exit {\n from {\n opacity: 1;\n transform: translateX(0);\n }\n to {\n opacity: 0;\n transform: translateX(-4px);\n }\n}\n\n/**\n * Item States con CSS Custom Properties\n *\n * Uso: <div style=\"--animation-order: 0\" data-state=\"entering\">\n */\n.sidebar-sublink[data-state=\"entering\"] {\n animation: tooltip-item-enter 150ms cubic-bezier(0.4, 0, 0.2, 1);\n animation-delay: calc(var(--animation-order, 0) * 30ms + 150ms);\n animation-fill-mode: both;\n}\n\n.sidebar-sublink[data-state=\"leaving\"] {\n animation: tooltip-item-exit 100ms cubic-bezier(0.4, 0, 0.6, 1);\n animation-delay: calc(var(--animation-order, 0) * 20ms);\n animation-fill-mode: both;\n}\n\n/* ============================================================================\n TITLE 3D ROTATIONS\n ============================================================================ */\n\n/**\n * Title Rotate Up (direction-aware)\n * Usado cuando navegamos hacia arriba en el sidebar\n */\n@keyframes tooltip-title-rotate-up {\n from {\n transform: rotateX(0deg);\n opacity: 1;\n }\n to {\n transform: rotateX(-90deg);\n opacity: 0;\n }\n}\n\n@keyframes tooltip-title-enter-from-below {\n from {\n transform: rotateX(90deg);\n opacity: 0;\n }\n to {\n transform: rotateX(0deg);\n opacity: 1;\n }\n}\n\n/**\n * Title Rotate Down (direction-aware)\n * Usado cuando navegamos hacia abajo en el sidebar\n */\n@keyframes tooltip-title-rotate-down {\n from {\n transform: rotateX(0deg);\n opacity: 1;\n }\n to {\n transform: rotateX(90deg);\n opacity: 0;\n }\n}\n\n@keyframes tooltip-title-enter-from-above {\n from {\n transform: rotateX(-90deg);\n opacity: 0;\n }\n to {\n transform: rotateX(0deg);\n opacity: 1;\n }\n}\n\n/**\n * Title States\n */\n.tooltip-title[data-direction=\"up\"][data-state=\"leaving\"] {\n animation: tooltip-title-rotate-up 250ms cubic-bezier(0.4, 0, 0.2, 1) forwards;\n}\n\n.tooltip-title[data-direction=\"up\"][data-state=\"entering\"] {\n animation: tooltip-title-enter-from-below 250ms cubic-bezier(0.4, 0, 0.2, 1) forwards;\n}\n\n.tooltip-title[data-direction=\"down\"][data-state=\"leaving\"] {\n animation: tooltip-title-rotate-down 250ms cubic-bezier(0.4, 0, 0.2, 1) forwards;\n}\n\n.tooltip-title[data-direction=\"down\"][data-state=\"entering\"] {\n animation: tooltip-title-enter-from-above 250ms cubic-bezier(0.4, 0, 0.2, 1) forwards;\n}\n\n/* ============================================================================\n 3D CUBE FACES (Enfoque A: Multi-cara)\n ============================================================================ */\n\n/**\n * Cubo 3D con 6 caras para tĂtulos\n *\n * Estructura:\n * .title-scene (perspective)\n * └─ .title-cube (preserve-3d)\n * ├─ .title-face--front\n * ├─ .title-face--back\n * ├─ .title-face--top\n * ├─ .title-face--bottom\n * ├─ .title-face--left\n * └─ .title-face--right\n */\n\n.title-scene {\n perspective: 600px;\n position: relative;\n width: 100%;\n height: 2rem;\n}\n\n.title-cube {\n width: 100%;\n height: 100%;\n position: relative;\n transform-style: preserve-3d;\n transition: transform 250ms cubic-bezier(0.4, 0, 0.2, 1);\n /* Empujar hacia atrás para evitar blur en texto */\n transform: translateZ(-1rem);\n}\n\n.title-face {\n position: absolute;\n width: 100%;\n height: 100%;\n backface-visibility: hidden;\n display: flex;\n align-items: center;\n justify-content: flex-start;\n padding: 0 1rem;\n font-weight: 500;\n}\n\n/* Posicionamiento de caras - Vertical rotation (rotateX) */\n.title-face--front {\n transform: rotateX(0deg) translateZ(1rem);\n}\n\n.title-face--top {\n transform: rotateX(90deg) translateZ(1rem);\n}\n\n.title-face--bottom {\n transform: rotateX(-90deg) translateZ(1rem);\n}\n\n.title-face--back {\n transform: rotateX(180deg) translateZ(1rem);\n}\n\n/* Estados del cubo - Direction-aware */\n.title-cube[data-face=\"front\"] {\n transform: translateZ(-1rem) rotateX(0deg);\n}\n\n.title-cube[data-face=\"top\"] {\n transform: translateZ(-1rem) rotateX(-90deg);\n}\n\n.title-cube[data-face=\"bottom\"] {\n transform: translateZ(-1rem) rotateX(90deg);\n}\n\n.title-cube[data-face=\"back\"] {\n transform: translateZ(-1rem) rotateX(180deg);\n}\n\n/* ============================================================================\n GRID HEIGHT TRANSITION (Grid Trick)\n ============================================================================ */\n\n/**\n * Grid trick para height: auto transitions\n *\n * TĂ©cnica: grid-template-rows: 0fr → 1fr\n * Browser support: Chrome 107+, Firefox 117+, Safari 16.4+\n */\n\n.tooltip-content-grid {\n display: grid;\n grid-template-rows: 0fr;\n transition: grid-template-rows 200ms cubic-bezier(0.4, 0, 0.2, 1);\n transition-delay: 50ms; /* Empieza despuĂ©s del fade-out de items */\n}\n\n.tooltip-content-grid[data-state=\"open\"] {\n grid-template-rows: 1fr;\n}\n\n.tooltip-content-inner {\n overflow: hidden;\n min-height: 0; /* CrĂtico para que grid trick funcione */\n}\n\n/* ============================================================================\n UTILITY CLASSES\n ============================================================================ */\n\n/**\n * Contenedor con perspective para tĂtulos crossfade\n */\n.tooltip-title-perspective {\n perspective: 600px;\n position: relative;\n width: 100%;\n height: 2rem;\n overflow: hidden;\n}\n\n/**\n * Disable animations durante hover rápido (opcional)\n * Usar con cuidado: puede causar flickering\n */\n.tooltip-no-animations * {\n animation: none !important;\n transition: none !important;\n}\n\n/* ============================================================================\n DEBUG HELPERS\n ============================================================================ */\n\n/**\n * VisualizaciĂłn de estados en debug mode\n */\n[data-tooltip-debug=\"true\"] .sidebar-sublink[data-state]::before {\n content: attr(data-state);\n position: absolute;\n top: 0;\n right: 0;\n font-size: 8px;\n background: rgba(255, 0, 0, 0.8);\n color: white;\n padding: 2px 4px;\n border-radius: 2px;\n pointer-events: none;\n z-index: 1000;\n}\n\n[data-tooltip-debug=\"true\"] .tooltip-title[data-direction]::after {\n content: \"dir:\" attr(data-direction);\n position: absolute;\n bottom: 0;\n left: 0;\n font-size: 8px;\n background: rgba(0, 0, 255, 0.8);\n color: white;\n padding: 2px 4px;\n border-radius: 2px;\n pointer-events: none;\n z-index: 1000;\n}\n\n/* ============================================================================\n PERFORMANCE OPTIMIZATIONS\n ============================================================================ */\n\n/**\n * GPU acceleration hints\n */\n.sidebar-sublink[data-state],\n.tooltip-title[data-state],\n.title-cube {\n will-change: transform, opacity;\n}\n\n/**\n * Contain layout/paint/style para mejor performance\n */\n.tooltip-content-grid {\n contain: layout style paint;\n}\n\n/**\n * Reduce motion para accesibilidad\n */\n@media (prefers-reduced-motion: reduce) {\n .sidebar-sublink[data-state],\n .tooltip-title[data-state],\n .title-cube,\n .tooltip-content-grid {\n animation-duration: 0.01ms !important;\n animation-iteration-count: 1 !important;\n transition-duration: 0.01ms !important;\n }\n}\n"],"mappings":";AACA,CAAC;AACC,YAAU;AACV,YAAU;AACV,eAAa,IAAI,sBAAsB,EAAE;AAC3C;AAEA,CAAC;AACC,YAAU;AACV,SAAO;AACP,UAAQ;AACR,mBAAiB;AAEjB,aAAW,QAAQ,IAAI,mBAAmB,EAAE;AAC9C;AAEA,CAAC;AACC,YAAU;AACV,SAAO;AACP,WAAS;AACT,eAAa;AACb,mBAAiB;AACjB,uBAAqB;AAErB,cAAY,QAAQ,KAAK;AAC3B;AAEA,CAXC,IAWI,CAAC;AACJ,WAAS;AACT,kBAAgB;AAClB;AAEA,CAhBC,IAgBI,CAAC;AACJ,WAAS;AACT,kBAAgB;AAClB;AAGA,CA/BC,QA+BQ,CAAC,UAAU,CAtBnB;AAuBC,eAAa;AACf;AAEA,CAnCC,QAmCQ,CAJC;AAKR,eAAa;AACf;;;AC7BA,WAAW;AACT;AACE,aAAS;AACT,eAAW,WAAW;AACxB;AACA;AACE,aAAS;AACT,eAAW,WAAW;AACxB;AACF;AAEA,WAAW;AACT;AACE,aAAS;AACT,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