responsive-system 1.0.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/ARCHITECTURE.md +195 -0
- package/INSTALLATION.md +403 -0
- package/README.md +382 -0
- package/dist/components/LayoutSwitcher.d.ts +6 -0
- package/dist/components/layout/Footer.d.ts +3 -0
- package/dist/components/layout/Header.d.ts +3 -0
- package/dist/components/layout/Navigation.d.ts +3 -0
- package/dist/components/layout/Sidebar.d.ts +3 -0
- package/dist/components/layout/index.d.ts +5 -0
- package/dist/config/layout.d.ts +15 -0
- package/dist/constants/breakpoints.d.ts +19 -0
- package/dist/context/NavigationContext.d.ts +13 -0
- package/dist/context/ResponsiveLayoutContext.d.ts +22 -0
- package/dist/context/SidebarContext.d.ts +11 -0
- package/dist/context/index.d.ts +4 -0
- package/dist/hooks/index.d.ts +4 -0
- package/dist/hooks/useLayout.d.ts +27 -0
- package/dist/hooks/useResponsive.d.ts +7 -0
- package/dist/hooks/useResponsiveLayout.d.ts +64 -0
- package/dist/index.d.ts +11 -0
- package/dist/layouts/DashboardLayout.d.ts +7 -0
- package/dist/layouts/DefaultLayout.d.ts +7 -0
- package/dist/layouts/MainLayout.d.ts +12 -0
- package/dist/layouts/MinimalLayout.d.ts +7 -0
- package/dist/layouts/SidebarLayout.d.ts +7 -0
- package/dist/layouts/index.d.ts +6 -0
- package/dist/providers/ResponsiveLayoutProvider.d.ts +15 -0
- package/dist/providers/ResponsiveProvider.d.ts +11 -0
- package/dist/providers/index.d.ts +3 -0
- package/dist/responsive-system.cjs +9 -0
- package/dist/responsive-system.cjs.map +1 -0
- package/dist/responsive-system.mjs +580 -0
- package/dist/responsive-system.mjs.map +1 -0
- package/dist/types/responsive.d.ts +43 -0
- package/package.json +97 -0
- package/scripts/copy-types.js +46 -0
- package/scripts/generate-types.js +163 -0
- package/scripts/postinstall.js +76 -0
- package/src/plugin/responsiveScalePlugin.d.ts +57 -0
- package/src/plugin/responsiveScalePlugin.js +296 -0
package/README.md
ADDED
|
@@ -0,0 +1,382 @@
|
|
|
1
|
+
# 🎯 Responsive System - Auto-Scaling para Tailwind CSS
|
|
2
|
+
|
|
3
|
+
**Sistema de escalado automático para todas las pantallas.** Usa Tailwind CSS normal, TODO escala automáticamente.
|
|
4
|
+
|
|
5
|
+
## ✨ Características
|
|
6
|
+
|
|
7
|
+
- ✅ **100% Automático**: Instala, configura una vez, olvídate del responsive
|
|
8
|
+
- ✅ **Tailwind Normal**: Usa `text-base`, `p-4`, `gap-6`, `leading-relaxed`, `shadow-lg` como siempre
|
|
9
|
+
- ✅ **Auto-Scaling Completo**: Typography, spacing, line-height, letter-spacing y shadows
|
|
10
|
+
- ✅ **Sistema de Layouts**: 4 layouts predefinidos (Default, Sidebar, Dashboard, Minimal)
|
|
11
|
+
- ✅ **9 Breakpoints**: xs, sm, md, lg, xl, 2xl, 3xl (1920px), 4xl (2560px), 5xl (3840px)
|
|
12
|
+
- ✅ **TypeScript**: 100% type-safe
|
|
13
|
+
- ✅ **Zero Runtime Dependencies**: Solo requiere React y Tailwind como peer dependencies
|
|
14
|
+
- ✅ **No Invasivo**: Instala solo lo que necesites ([Ver guía](INSTALLATION.md))
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## 📦 Instalación desde npm
|
|
19
|
+
|
|
20
|
+
### **Instalación Automática**
|
|
21
|
+
|
|
22
|
+
Este paquete instala automáticamente todas las dependencias necesarias:
|
|
23
|
+
|
|
24
|
+
- ✅ **React** (v19.1.1) - Se instala automáticamente
|
|
25
|
+
- ✅ **React DOM** (v19.1.1) - Se instala automáticamente
|
|
26
|
+
- ✅ **Tailwind CSS** (v4.1.14) - Se instala automáticamente
|
|
27
|
+
- ✅ **PostCSS** y **Autoprefixer** - Se instalan automáticamente
|
|
28
|
+
- ✅ **TypeScript** (v5.9.3) - Se instala automáticamente
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
# Solo necesitas esto:
|
|
32
|
+
npm install responsive-system
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
El script `postinstall` detectará si faltan dependencias y las instalará automáticamente.
|
|
36
|
+
|
|
37
|
+
### **Inicializar Tailwind (solo la primera vez)**
|
|
38
|
+
|
|
39
|
+
Después de instalar, inicializa Tailwind:
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
npx tailwindcss init -p
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
O con yarn/pnpm:
|
|
46
|
+
```bash
|
|
47
|
+
yarn add responsive-system
|
|
48
|
+
# o
|
|
49
|
+
pnpm add responsive-system
|
|
50
|
+
|
|
51
|
+
# Inicializar Tailwind
|
|
52
|
+
npx tailwindcss init -p
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
## 📦 ¿Tenés un proyecto existente?
|
|
58
|
+
|
|
59
|
+
**Este sistema NO es invasivo.** Podés instalarlo de 3 formas:
|
|
60
|
+
|
|
61
|
+
1. **Solo el plugin** (1 archivo) - Auto-scaling sin tocar tu código
|
|
62
|
+
2. **Con hooks** (~8 archivos) - Detección de breakpoints en JS
|
|
63
|
+
3. **Sistema completo** (~30 archivos) - Layouts incluidos
|
|
64
|
+
|
|
65
|
+
👉 **[Ver guía completa de instalación](INSTALLATION.md)**
|
|
66
|
+
|
|
67
|
+
---
|
|
68
|
+
|
|
69
|
+
## 🚀 Inicio Rápido (Proyecto Nuevo)
|
|
70
|
+
|
|
71
|
+
### **Paso 0: Instalar el paquete**
|
|
72
|
+
|
|
73
|
+
Si estás empezando desde cero:
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
# Crear proyecto React (si no lo tienes)
|
|
77
|
+
npm create vite@latest mi-proyecto -- --template react-ts
|
|
78
|
+
|
|
79
|
+
# Instalar el paquete (instala React y Tailwind automáticamente)
|
|
80
|
+
cd mi-proyecto
|
|
81
|
+
npm install
|
|
82
|
+
npm install responsive-system
|
|
83
|
+
|
|
84
|
+
# Inicializar Tailwind (solo la primera vez)
|
|
85
|
+
npx tailwindcss init -p
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
**¡Eso es todo!** El paquete instala automáticamente React, Tailwind y todas las dependencias necesarias.
|
|
89
|
+
|
|
90
|
+
### **1. Configura el Plugin en Tailwind**
|
|
91
|
+
|
|
92
|
+
```js
|
|
93
|
+
// tailwind.config.js
|
|
94
|
+
import responsiveScalePlugin from 'responsive-system/plugin'
|
|
95
|
+
|
|
96
|
+
export default {
|
|
97
|
+
content: ["./src/**/*.{js,ts,jsx,tsx}"],
|
|
98
|
+
theme: {
|
|
99
|
+
extend: {
|
|
100
|
+
screens: {
|
|
101
|
+
'xs': '475px', 'sm': '640px', 'md': '768px', 'lg': '1024px',
|
|
102
|
+
'xl': '1280px', '2xl': '1536px', '3xl': '1920px', '4xl': '2560px', '5xl': '3840px'
|
|
103
|
+
}
|
|
104
|
+
},
|
|
105
|
+
},
|
|
106
|
+
plugins: [
|
|
107
|
+
responsiveScalePlugin({
|
|
108
|
+
scaleProperties: {
|
|
109
|
+
typography: true, // font-size
|
|
110
|
+
spacing: true, // padding, margin, gap
|
|
111
|
+
lineHeight: true, // line-height
|
|
112
|
+
letterSpacing: true, // letter-spacing
|
|
113
|
+
shadows: true, // box-shadow
|
|
114
|
+
borderWidth: false,
|
|
115
|
+
sizing: false,
|
|
116
|
+
borderRadius: false
|
|
117
|
+
},
|
|
118
|
+
scales: {
|
|
119
|
+
xs: 1.0, sm: 1.0, md: 1.0, lg: 1.0, xl: 1.0,
|
|
120
|
+
'2xl': 1.05, '3xl': 1.15, '4xl': 1.25, '5xl': 1.35
|
|
121
|
+
}
|
|
122
|
+
})
|
|
123
|
+
],
|
|
124
|
+
}
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
### **2. Configura el Sistema de Layouts**
|
|
128
|
+
|
|
129
|
+
```tsx
|
|
130
|
+
// App.tsx
|
|
131
|
+
import { ResponsiveLayoutProvider, MainLayout } from 'responsive-system'
|
|
132
|
+
|
|
133
|
+
function App() {
|
|
134
|
+
return (
|
|
135
|
+
<ResponsiveLayoutProvider defaultLayout="default">
|
|
136
|
+
<MainLayout>
|
|
137
|
+
<YourContent />
|
|
138
|
+
</MainLayout>
|
|
139
|
+
</ResponsiveLayoutProvider>
|
|
140
|
+
)
|
|
141
|
+
}
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
---
|
|
145
|
+
|
|
146
|
+
## 🎨 Cómo Funciona
|
|
147
|
+
|
|
148
|
+
### **Sistema Responsivo (Auto-Scaling)**
|
|
149
|
+
|
|
150
|
+
El plugin genera CSS variables que escalan automáticamente:
|
|
151
|
+
|
|
152
|
+
```css
|
|
153
|
+
/* Plugin genera automáticamente */
|
|
154
|
+
:root { --scale-text: 1.0; --scale-spacing: 1.0; }
|
|
155
|
+
|
|
156
|
+
.text-base { font-size: calc(1rem * var(--scale-text)); }
|
|
157
|
+
.p-4 { padding: calc(1rem * var(--scale-spacing)); }
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
**En 1920px (3xl):** `--scale-text: 1.15` → `text-base` = 18.4px
|
|
161
|
+
|
|
162
|
+
### **Sistema de Layouts**
|
|
163
|
+
|
|
164
|
+
**4 Layouts Predefinidos:**
|
|
165
|
+
|
|
166
|
+
| Layout | Componentes | Uso |
|
|
167
|
+
|--------|-------------|-----|
|
|
168
|
+
| `default` | Navigation + Footer | Páginas estáticas |
|
|
169
|
+
| `sidebar` | Sidebar | Apps con navegación lateral |
|
|
170
|
+
| `dashboard` | Header + Sidebar + Footer | Dashboards complejos |
|
|
171
|
+
| `minimal` | Solo contenido | Landing pages |
|
|
172
|
+
|
|
173
|
+
**Cambio Dinámico:**
|
|
174
|
+
```tsx
|
|
175
|
+
import { useLayout } from 'responsive-system'
|
|
176
|
+
|
|
177
|
+
function MyComponent() {
|
|
178
|
+
const { setLayout } = useLayout()
|
|
179
|
+
|
|
180
|
+
return (
|
|
181
|
+
<button onClick={() => setLayout('dashboard')}>
|
|
182
|
+
Cambiar a Dashboard
|
|
183
|
+
</button>
|
|
184
|
+
)
|
|
185
|
+
}
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
---
|
|
189
|
+
|
|
190
|
+
## 📊 Breakpoints y Escalas
|
|
191
|
+
|
|
192
|
+
| Breakpoint | Tamaño | Factor | Ejemplo `text-base` |
|
|
193
|
+
|------------|--------|--------|---------------------|
|
|
194
|
+
| `xs` | 475px+ | 1.0 | 16px |
|
|
195
|
+
| `sm` | 640px+ | 1.0 | 16px |
|
|
196
|
+
| `md` | 768px+ | 1.0 | 16px |
|
|
197
|
+
| `lg` | 1024px+ | 1.0 | 16px |
|
|
198
|
+
| `xl` | 1280px+ | 1.0 | 16px |
|
|
199
|
+
| `2xl` | 1536px+ | 1.05 | 16.8px |
|
|
200
|
+
| `3xl` | 1920px+ | 1.15 | 18.4px |
|
|
201
|
+
| `4xl` | 2560px+ | 1.25 | 20px |
|
|
202
|
+
| `5xl` | 3840px+ | 1.35 | 21.6px |
|
|
203
|
+
|
|
204
|
+
---
|
|
205
|
+
|
|
206
|
+
## 🔧 Uso del Hook
|
|
207
|
+
|
|
208
|
+
```tsx
|
|
209
|
+
import { useResponsiveLayout } from 'responsive-system'
|
|
210
|
+
|
|
211
|
+
function MyComponent() {
|
|
212
|
+
const {
|
|
213
|
+
// Estado responsivo
|
|
214
|
+
breakpoint, width, height, isMobile, isDesktop,
|
|
215
|
+
// Estado del layout
|
|
216
|
+
layout: { current, setLayout },
|
|
217
|
+
// Utilidades
|
|
218
|
+
layoutUtils
|
|
219
|
+
} = useResponsiveLayout()
|
|
220
|
+
|
|
221
|
+
return (
|
|
222
|
+
<div className="p-6"> {/* ✅ Escala automáticamente */}
|
|
223
|
+
<h1 className="text-4xl">Título</h1> {/* ✅ Escala automáticamente */}
|
|
224
|
+
|
|
225
|
+
{/* Renderizado condicional */}
|
|
226
|
+
{isMobile && <MobileMenu />}
|
|
227
|
+
{isDesktop && <DesktopSidebar />}
|
|
228
|
+
|
|
229
|
+
{/* Cambio de layout */}
|
|
230
|
+
<button onClick={() => setLayout('sidebar')}>
|
|
231
|
+
Cambiar Layout
|
|
232
|
+
</button>
|
|
233
|
+
</div>
|
|
234
|
+
)
|
|
235
|
+
}
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
---
|
|
239
|
+
|
|
240
|
+
## 🎯 Qué Escala Automáticamente
|
|
241
|
+
|
|
242
|
+
### ✅ **SÍ Escala:**
|
|
243
|
+
- **Typography**: `text-base`, `text-lg`, `text-xl`, etc.
|
|
244
|
+
- **Spacing**: `p-4`, `m-6`, `gap-3`, `space-y-2`
|
|
245
|
+
- **Line Height**: `leading-relaxed`, `leading-loose`
|
|
246
|
+
- **Letter Spacing**: `tracking-tight`, `tracking-wide`
|
|
247
|
+
- **Shadows**: `shadow-lg`, `shadow-xl`
|
|
248
|
+
|
|
249
|
+
### ❌ **NO Escala:**
|
|
250
|
+
- **Sizing**: `w-64`, `h-32` (puede romper layouts)
|
|
251
|
+
- **Border Radius**: `rounded-lg` (mantiene proporciones)
|
|
252
|
+
- **Valores Arbitrarios**: `text-[16px]`, `p-[10px]`
|
|
253
|
+
|
|
254
|
+
---
|
|
255
|
+
|
|
256
|
+
## 📱 Layouts en Acción
|
|
257
|
+
|
|
258
|
+
### **Default Layout**
|
|
259
|
+
```tsx
|
|
260
|
+
import { ResponsiveLayoutProvider, MainLayout } from 'responsive-system'
|
|
261
|
+
|
|
262
|
+
<ResponsiveLayoutProvider defaultLayout="default">
|
|
263
|
+
<MainLayout>
|
|
264
|
+
{/* Navigation arriba, Footer abajo */}
|
|
265
|
+
<YourContent />
|
|
266
|
+
</MainLayout>
|
|
267
|
+
</ResponsiveLayoutProvider>
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
### **Sidebar Layout**
|
|
271
|
+
```tsx
|
|
272
|
+
import { ResponsiveLayoutProvider, MainLayout } from 'responsive-system'
|
|
273
|
+
|
|
274
|
+
<ResponsiveLayoutProvider defaultLayout="sidebar">
|
|
275
|
+
<MainLayout>
|
|
276
|
+
{/* Sidebar izquierda, contenido principal */}
|
|
277
|
+
<YourContent />
|
|
278
|
+
</MainLayout>
|
|
279
|
+
</ResponsiveLayoutProvider>
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
### **Dashboard Layout**
|
|
283
|
+
```tsx
|
|
284
|
+
import { ResponsiveLayoutProvider, MainLayout } from 'responsive-system'
|
|
285
|
+
|
|
286
|
+
<ResponsiveLayoutProvider defaultLayout="dashboard">
|
|
287
|
+
<MainLayout>
|
|
288
|
+
{/* Header + Sidebar + Main + Footer */}
|
|
289
|
+
<YourContent />
|
|
290
|
+
</MainLayout>
|
|
291
|
+
</ResponsiveLayoutProvider>
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
---
|
|
295
|
+
|
|
296
|
+
## 🏗️ Estructura del Proyecto
|
|
297
|
+
|
|
298
|
+
```
|
|
299
|
+
src/
|
|
300
|
+
├── plugin/
|
|
301
|
+
│ └── responsiveScalePlugin.js # Plugin de Tailwind
|
|
302
|
+
├── providers/
|
|
303
|
+
│ ├── index.ts # ✅ Barrel exports
|
|
304
|
+
│ ├── ResponsiveProvider.tsx # Provider base
|
|
305
|
+
│ └── ResponsiveLayoutProvider.tsx # Provider con layouts
|
|
306
|
+
├── hooks/
|
|
307
|
+
│ ├── index.ts # ✅ Barrel exports
|
|
308
|
+
│ ├── useResponsive.ts # Hook responsivo
|
|
309
|
+
│ ├── useResponsiveLayout.ts # Hook unificado
|
|
310
|
+
│ └── useLayout.ts # Hook de layout
|
|
311
|
+
├── layouts/
|
|
312
|
+
│ ├── index.ts # ✅ Barrel exports
|
|
313
|
+
│ ├── MainLayout.tsx # Layout principal
|
|
314
|
+
│ ├── DefaultLayout.tsx # Layout por defecto
|
|
315
|
+
│ ├── SidebarLayout.tsx # Layout con sidebar
|
|
316
|
+
│ ├── DashboardLayout.tsx # Layout dashboard
|
|
317
|
+
│ └── MinimalLayout.tsx # Layout mínimo
|
|
318
|
+
├── components/layout/
|
|
319
|
+
│ ├── index.ts # ✅ Barrel exports
|
|
320
|
+
│ ├── Navigation.tsx # Navegación
|
|
321
|
+
│ ├── Sidebar.tsx # Sidebar
|
|
322
|
+
│ ├── Header.tsx # Header
|
|
323
|
+
│ └── Footer.tsx # Footer
|
|
324
|
+
├── context/
|
|
325
|
+
│ ├── index.ts # ✅ Barrel exports
|
|
326
|
+
│ ├── ResponsiveLayoutContext.tsx # Context principal
|
|
327
|
+
│ └── SidebarContext.tsx # Context del sidebar
|
|
328
|
+
├── config/
|
|
329
|
+
│ └── layout.ts # Configuración de layouts
|
|
330
|
+
└── index.ts # ✅ Export principal
|
|
331
|
+
```
|
|
332
|
+
|
|
333
|
+
---
|
|
334
|
+
|
|
335
|
+
## 🎉 Ejemplo Completo
|
|
336
|
+
|
|
337
|
+
```tsx
|
|
338
|
+
// App.tsx
|
|
339
|
+
import { ResponsiveLayoutProvider, MainLayout, useResponsiveLayout } from 'responsive-system'
|
|
340
|
+
|
|
341
|
+
function MyApp() {
|
|
342
|
+
return (
|
|
343
|
+
<ResponsiveLayoutProvider defaultLayout="default">
|
|
344
|
+
<MainLayout>
|
|
345
|
+
<Dashboard />
|
|
346
|
+
</MainLayout>
|
|
347
|
+
</ResponsiveLayoutProvider>
|
|
348
|
+
)
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
function Dashboard() {
|
|
352
|
+
const { breakpoint, isMobile } = useResponsiveLayout()
|
|
353
|
+
|
|
354
|
+
return (
|
|
355
|
+
<div className="p-6 space-y-6"> {/* ✅ Auto-scaling */}
|
|
356
|
+
<h1 className="text-4xl font-bold">Dashboard</h1> {/* ✅ Auto-scaling */}
|
|
357
|
+
|
|
358
|
+
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
|
|
359
|
+
<div className="p-6 bg-white rounded-lg shadow-lg"> {/* ✅ Auto-scaling */}
|
|
360
|
+
<h2 className="text-xl mb-4">Card 1</h2>
|
|
361
|
+
<p className="text-base leading-relaxed">Contenido...</p>
|
|
362
|
+
</div>
|
|
363
|
+
{/* Más cards... */}
|
|
364
|
+
</div>
|
|
365
|
+
</div>
|
|
366
|
+
)
|
|
367
|
+
}
|
|
368
|
+
```
|
|
369
|
+
|
|
370
|
+
---
|
|
371
|
+
|
|
372
|
+
## 🚀 Resultado
|
|
373
|
+
|
|
374
|
+
**¡Eso es todo!** Tu aplicación ahora:
|
|
375
|
+
|
|
376
|
+
- ✅ **Escala automáticamente** en todas las pantallas
|
|
377
|
+
- ✅ **Usa layouts profesionales** predefinidos
|
|
378
|
+
- ✅ **Mantiene código limpio** con Tailwind normal
|
|
379
|
+
- ✅ **Funciona en móvil y desktop** sin media queries manuales
|
|
380
|
+
- ✅ **Se adapta a pantallas grandes** (1920px, 4K, etc.)
|
|
381
|
+
|
|
382
|
+
**Desarrollado por [Felipe Caroca](https://github.com/FelipeCaroca1)**
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export interface LayoutConfig {
|
|
2
|
+
name: string;
|
|
3
|
+
description: string;
|
|
4
|
+
components: string[];
|
|
5
|
+
spacing: string;
|
|
6
|
+
responsive: {
|
|
7
|
+
mobile: string;
|
|
8
|
+
tablet: string;
|
|
9
|
+
desktop: string;
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
export declare const LAYOUT_CONFIG: Record<string, LayoutConfig>;
|
|
13
|
+
export declare const DEFAULT_LAYOUT = "default";
|
|
14
|
+
export declare const AVAILABLE_LAYOUTS: string[];
|
|
15
|
+
//# sourceMappingURL=layout.d.ts.map
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { Breakpoint } from '../types/responsive';
|
|
2
|
+
/**
|
|
3
|
+
* Default breakpoint values
|
|
4
|
+
* Deben coincidir con tailwind.config.js
|
|
5
|
+
*/
|
|
6
|
+
export declare const DEFAULT_BREAKPOINTS: Record<Breakpoint, number>;
|
|
7
|
+
/**
|
|
8
|
+
* Get current breakpoint based on window width
|
|
9
|
+
*/
|
|
10
|
+
export declare const getCurrentBreakpoint: (width: number) => Breakpoint;
|
|
11
|
+
/**
|
|
12
|
+
* Get breakpoint index (for comparisons)
|
|
13
|
+
*/
|
|
14
|
+
export declare const getBreakpointIndex: (breakpoint: Breakpoint) => number;
|
|
15
|
+
/**
|
|
16
|
+
* Get breakpoint value in pixels
|
|
17
|
+
*/
|
|
18
|
+
export declare const getBreakpointValue: (breakpoint: Breakpoint) => number;
|
|
19
|
+
//# sourceMappingURL=breakpoints.d.ts.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface NavigationContextType {
|
|
3
|
+
currentPage: 'demo' | 'test';
|
|
4
|
+
setCurrentPage: (page: 'demo' | 'test') => void;
|
|
5
|
+
}
|
|
6
|
+
export declare const useNavigation: () => NavigationContextType;
|
|
7
|
+
interface NavigationProviderProps {
|
|
8
|
+
children: React.ReactNode;
|
|
9
|
+
defaultPage?: 'demo' | 'test';
|
|
10
|
+
}
|
|
11
|
+
export declare const NavigationProvider: React.FC<NavigationProviderProps>;
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=NavigationContext.d.ts.map
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { ResponsiveState } from '../types/responsive';
|
|
2
|
+
import type { LayoutConfig } from '../config/layout';
|
|
3
|
+
export interface ResponsiveLayoutState {
|
|
4
|
+
responsive: ResponsiveState;
|
|
5
|
+
layout: {
|
|
6
|
+
current: string;
|
|
7
|
+
config: LayoutConfig;
|
|
8
|
+
setLayout: (layout: string) => void;
|
|
9
|
+
};
|
|
10
|
+
layoutUtils: {
|
|
11
|
+
getContainerClass: () => string;
|
|
12
|
+
getMainClass: () => string;
|
|
13
|
+
hasSidebar: () => boolean;
|
|
14
|
+
hasHeader: () => boolean;
|
|
15
|
+
hasFooter: () => boolean;
|
|
16
|
+
hasNavigation: () => boolean;
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
declare const ResponsiveLayoutContext: import("react").Context<ResponsiveLayoutState | undefined>;
|
|
20
|
+
export declare const useResponsiveLayoutContext: () => ResponsiveLayoutState;
|
|
21
|
+
export { ResponsiveLayoutContext };
|
|
22
|
+
//# sourceMappingURL=ResponsiveLayoutContext.d.ts.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface SidebarContextType {
|
|
3
|
+
sidebarOpen: boolean;
|
|
4
|
+
setSidebarOpen: (open: boolean) => void;
|
|
5
|
+
}
|
|
6
|
+
export declare const SidebarProvider: React.FC<{
|
|
7
|
+
children: React.ReactNode;
|
|
8
|
+
}>;
|
|
9
|
+
export declare const useSidebar: () => SidebarContextType;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=SidebarContext.d.ts.map
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
// Auto-generated from src/context/index.ts
|
|
2
|
+
export { ResponsiveLayoutContext, useResponsiveLayoutContext } from './ResponsiveLayoutContext'
|
|
3
|
+
export { SidebarProvider, useSidebar } from './SidebarContext'
|
|
4
|
+
export { NavigationProvider, useNavigation } from './NavigationContext'
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export declare const useLayout: () => {
|
|
2
|
+
isDefaultLayout: boolean;
|
|
3
|
+
isSidebarLayout: boolean;
|
|
4
|
+
isDashboardLayout: boolean;
|
|
5
|
+
isMinimalLayout: boolean;
|
|
6
|
+
grid: {
|
|
7
|
+
auto: (minWidth?: string) => string;
|
|
8
|
+
responsive: (breakpoints: Record<string, number>) => string;
|
|
9
|
+
fixed: (cols: number) => string;
|
|
10
|
+
};
|
|
11
|
+
spacing: {
|
|
12
|
+
container: string;
|
|
13
|
+
section: string;
|
|
14
|
+
card: string;
|
|
15
|
+
gap: string;
|
|
16
|
+
};
|
|
17
|
+
getContainerClass: () => string;
|
|
18
|
+
getMainClass: () => string;
|
|
19
|
+
hasSidebar: () => boolean;
|
|
20
|
+
hasHeader: () => boolean;
|
|
21
|
+
hasFooter: () => boolean;
|
|
22
|
+
hasNavigation: () => boolean;
|
|
23
|
+
current: string;
|
|
24
|
+
config: import("..").LayoutConfig;
|
|
25
|
+
setLayout: (layout: string) => void;
|
|
26
|
+
};
|
|
27
|
+
//# sourceMappingURL=useLayout.d.ts.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ResponsiveState } from '../types/responsive';
|
|
2
|
+
/**
|
|
3
|
+
* Hook principal useResponsive
|
|
4
|
+
* Provee información sobre el breakpoint actual y helpers para responsive
|
|
5
|
+
*/
|
|
6
|
+
export declare const useResponsive: () => ResponsiveState;
|
|
7
|
+
//# sourceMappingURL=useResponsive.d.ts.map
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
export declare const useResponsiveLayout: () => {
|
|
2
|
+
layout: {
|
|
3
|
+
current: string;
|
|
4
|
+
config: import("..").LayoutConfig;
|
|
5
|
+
setLayout: (layout: string) => void;
|
|
6
|
+
};
|
|
7
|
+
layoutUtils: {
|
|
8
|
+
getContainerClass: () => string;
|
|
9
|
+
getMainClass: () => string;
|
|
10
|
+
hasSidebar: () => boolean;
|
|
11
|
+
hasHeader: () => boolean;
|
|
12
|
+
hasFooter: () => boolean;
|
|
13
|
+
hasNavigation: () => boolean;
|
|
14
|
+
};
|
|
15
|
+
isDefaultLayout: () => boolean;
|
|
16
|
+
isSidebarLayout: () => boolean;
|
|
17
|
+
isDashboardLayout: () => boolean;
|
|
18
|
+
isMinimalLayout: () => boolean;
|
|
19
|
+
grid: {
|
|
20
|
+
auto: (minWidth?: string) => string;
|
|
21
|
+
responsive: (breakpoints: Record<string, number>) => string;
|
|
22
|
+
fixed: (cols: number) => string;
|
|
23
|
+
};
|
|
24
|
+
spacing: {
|
|
25
|
+
container: string;
|
|
26
|
+
section: string;
|
|
27
|
+
card: string;
|
|
28
|
+
gap: string;
|
|
29
|
+
};
|
|
30
|
+
breakpoint: import("..").Breakpoint;
|
|
31
|
+
width: number;
|
|
32
|
+
height: number;
|
|
33
|
+
orientation: import("..").Orientation;
|
|
34
|
+
isPortrait: boolean;
|
|
35
|
+
isLandscape: boolean;
|
|
36
|
+
isXs: boolean;
|
|
37
|
+
isSm: boolean;
|
|
38
|
+
isMd: boolean;
|
|
39
|
+
isLg: boolean;
|
|
40
|
+
isXl: boolean;
|
|
41
|
+
is2Xl: boolean;
|
|
42
|
+
is3Xl: boolean;
|
|
43
|
+
is4Xl: boolean;
|
|
44
|
+
is5Xl: boolean;
|
|
45
|
+
isMobile: boolean;
|
|
46
|
+
isTablet: boolean;
|
|
47
|
+
isDesktop: boolean;
|
|
48
|
+
isSmall: boolean;
|
|
49
|
+
isLarge: boolean;
|
|
50
|
+
isUltraWide: boolean;
|
|
51
|
+
is4K: boolean;
|
|
52
|
+
is5K: boolean;
|
|
53
|
+
isBreakpointUp: (breakpoint: import("..").Breakpoint) => boolean;
|
|
54
|
+
isBreakpointDown: (breakpoint: import("..").Breakpoint) => boolean;
|
|
55
|
+
isBreakpointBetween: (min: import("..").Breakpoint, max: import("..").Breakpoint) => boolean;
|
|
56
|
+
isWidthUp: (width: number) => boolean;
|
|
57
|
+
isWidthDown: (width: number) => boolean;
|
|
58
|
+
isWidthBetween: (min: number, max: number) => boolean;
|
|
59
|
+
isHeightUp: (height: number) => boolean;
|
|
60
|
+
isHeightDown: (height: number) => boolean;
|
|
61
|
+
isHeightBetween: (min: number, max: number) => boolean;
|
|
62
|
+
debug: boolean;
|
|
63
|
+
};
|
|
64
|
+
//# sourceMappingURL=useResponsiveLayout.d.ts.map
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// Auto-generated from src/index.ts
|
|
2
|
+
export { ResponsiveLayoutProvider, ResponsiveProvider } from './providers'
|
|
3
|
+
export { MainLayout, DefaultLayout, SidebarLayout, DashboardLayout, MinimalLayout } from './layouts'
|
|
4
|
+
export { useResponsiveLayout, useLayout, useResponsive } from './hooks'
|
|
5
|
+
export { Header, Sidebar, Footer, Navigation } from './components/layout'
|
|
6
|
+
export { default as LayoutSwitcher } from './components/LayoutSwitcher'
|
|
7
|
+
export { useResponsiveLayoutContext, SidebarProvider, useSidebar, NavigationProvider, useNavigation } from './context'
|
|
8
|
+
export type { Breakpoint, Orientation, ResponsiveState, ResponsiveProviderProps } from './types/responsive'
|
|
9
|
+
export { DEFAULT_BREAKPOINTS, getCurrentBreakpoint, getBreakpointIndex, getBreakpointValue } from './constants/breakpoints'
|
|
10
|
+
export { LAYOUT_CONFIG, DEFAULT_LAYOUT, AVAILABLE_LAYOUTS } from './config/layout'
|
|
11
|
+
export type { LayoutConfig } from './config/layout'
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface MainLayoutProps {
|
|
3
|
+
children: React.ReactNode;
|
|
4
|
+
/**
|
|
5
|
+
* Layout específico a usar. Si se proporciona, sobrescribe el layout del contexto.
|
|
6
|
+
* Valores posibles: 'default', 'sidebar', 'dashboard', 'minimal'
|
|
7
|
+
*/
|
|
8
|
+
layout?: 'default' | 'sidebar' | 'dashboard' | 'minimal';
|
|
9
|
+
}
|
|
10
|
+
declare const MainLayout: React.FC<MainLayoutProps>;
|
|
11
|
+
export default MainLayout;
|
|
12
|
+
//# sourceMappingURL=MainLayout.d.ts.map
|