neogestify-ui-components 1.2.17 → 1.2.19
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/README.md +349 -342
- package/dist/components/alerts/index.js +1 -1
- package/dist/components/alerts/index.js.map +1 -1
- package/dist/components/alerts/index.mjs +1 -1
- package/dist/components/alerts/index.mjs.map +1 -1
- package/dist/components/html/index.js +7 -4
- package/dist/components/html/index.js.map +1 -1
- package/dist/components/html/index.mjs +7 -4
- package/dist/components/html/index.mjs.map +1 -1
- package/dist/components/icons/index.js.map +1 -1
- package/dist/components/icons/index.mjs.map +1 -1
- package/dist/context/theme/index.js +1 -1
- package/dist/context/theme/index.js.map +1 -1
- package/dist/context/theme/index.mjs +1 -1
- package/dist/context/theme/index.mjs.map +1 -1
- package/dist/index.js +7 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +7 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/components/alerts/InfoAlert.tsx +25 -25
- package/src/components/alerts/alerta.ts +93 -93
- package/src/components/alerts/index.ts +1 -1
- package/src/components/html/Button.tsx +71 -71
- package/src/components/html/Form.tsx +39 -39
- package/src/components/html/Input.tsx +136 -132
- package/src/components/html/Loading.tsx +104 -104
- package/src/components/html/Modal.tsx +79 -79
- package/src/components/html/Select.tsx +81 -81
- package/src/components/html/Table.tsx +61 -61
- package/src/components/html/TextArea.tsx +70 -70
- package/src/components/html/index.ts +7 -7
- package/src/components/icons/icons.tsx +550 -550
- package/src/components/icons/index.ts +1 -1
- package/src/context/theme/ThemeContext.tsx +37 -37
- package/src/context/theme/ThemeToggle.tsx +23 -23
- package/src/context/theme/index.ts +3 -3
- package/src/context/theme/theme.types.ts +11 -11
- package/src/context/theme/useTheme.ts +10 -10
- package/src/index.ts +5 -5
- package/src/types/types.ts +3 -3
package/README.md
CHANGED
|
@@ -1,342 +1,349 @@
|
|
|
1
|
-
# UI Components
|
|
2
|
-
|
|
3
|
-
Biblioteca de componentes UI reutilizables con React, Tailwind CSS y SweetAlert2.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
-
|
|
10
|
-
-
|
|
11
|
-
-
|
|
12
|
-
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
@
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
<
|
|
88
|
-
label="
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
'
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
```
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
```
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
###
|
|
308
|
-
|
|
309
|
-
```
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
//
|
|
337
|
-
|
|
338
|
-
```
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
1
|
+
# UI Components
|
|
2
|
+
|
|
3
|
+
Biblioteca de componentes UI reutilizables con React, Tailwind CSS y SweetAlert2.
|
|
4
|
+
|
|
5
|
+
## Características
|
|
6
|
+
|
|
7
|
+
- Componentes HTML preestilizados (Button, Input, Form, Select, Table, Modal)
|
|
8
|
+
- Colección de iconos SVG
|
|
9
|
+
- Alertas preconfiguradas con SweetAlert2
|
|
10
|
+
- Soporte para modo claro/oscuro
|
|
11
|
+
- TypeScript incluido
|
|
12
|
+
- Compatible con Tailwind CSS 4.1
|
|
13
|
+
|
|
14
|
+
## Instalación
|
|
15
|
+
|
|
16
|
+
Si estás usando workspaces con npm/bun:
|
|
17
|
+
|
|
18
|
+
### NPM
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
# En tu proyecto
|
|
22
|
+
npm i neogestify-ui-components
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
### BUN
|
|
26
|
+
```bash
|
|
27
|
+
# En tu proyecto
|
|
28
|
+
npm i neogestify-ui-components
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
## Configuración
|
|
33
|
+
|
|
34
|
+
### 1. Asegúrate de tener Tailwind CSS configurado en tu proyecto
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
bun add -D tailwindcss@4.1.0
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Tu proyecto debe tener Tailwind configurado ya que los componentes solo usan clases de Tailwind (no incluyen CSS compilado).
|
|
41
|
+
|
|
42
|
+
### 2. Configura Tailwind para escanear los componentes de la biblioteca
|
|
43
|
+
|
|
44
|
+
**⚠️ IMPORTANTE:** Esta librería requiere que configures Tailwind para escanear sus archivos fuente.
|
|
45
|
+
|
|
46
|
+
**Para Tailwind CSS v4:**
|
|
47
|
+
|
|
48
|
+
En tu archivo CSS principal (por ejemplo `src/index.css`):
|
|
49
|
+
|
|
50
|
+
```css
|
|
51
|
+
@import "tailwindcss";
|
|
52
|
+
|
|
53
|
+
@source "../node_modules/neogestify-ui-components/src";
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
**Agrega este script a tu index.html**
|
|
57
|
+
```html
|
|
58
|
+
<script>
|
|
59
|
+
// Prevenir flash de contenido sin estilo (FOUC)
|
|
60
|
+
const theme = localStorage.getItem('theme') || 'light';
|
|
61
|
+
if (theme === 'dark') {
|
|
62
|
+
document.documentElement.classList.add('dark');
|
|
63
|
+
} else {
|
|
64
|
+
document.documentElement.classList.remove('dark');
|
|
65
|
+
}
|
|
66
|
+
</script>
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### 3. Instala las dependencias peer
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
bun add react react-dom sweetalert2 sweetalert2-react-content
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## Uso
|
|
76
|
+
|
|
77
|
+
La biblioteca está organizada en módulos independientes:
|
|
78
|
+
|
|
79
|
+
### Componentes HTML
|
|
80
|
+
|
|
81
|
+
```tsx
|
|
82
|
+
import { Button, Input, Form, Select, Table, Modal } from 'neogestify-ui-components/html';
|
|
83
|
+
|
|
84
|
+
function MiComponente() {
|
|
85
|
+
return (
|
|
86
|
+
<Form onSubmit={handleSubmit}>
|
|
87
|
+
<Input
|
|
88
|
+
label="Nombre"
|
|
89
|
+
placeholder="Tu nombre"
|
|
90
|
+
value={nombre}
|
|
91
|
+
onChange={(e) => setNombre(e.target.value)}
|
|
92
|
+
/>
|
|
93
|
+
|
|
94
|
+
<Select
|
|
95
|
+
label="País"
|
|
96
|
+
options={[
|
|
97
|
+
{ value: 'mx', label: 'México' },
|
|
98
|
+
{ value: 'ar', label: 'Argentina' }
|
|
99
|
+
]}
|
|
100
|
+
/>
|
|
101
|
+
|
|
102
|
+
<Button variant="primary" type="submit">
|
|
103
|
+
Enviar
|
|
104
|
+
</Button>
|
|
105
|
+
</Form>
|
|
106
|
+
);
|
|
107
|
+
}
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### Iconos
|
|
111
|
+
|
|
112
|
+
```tsx
|
|
113
|
+
import {
|
|
114
|
+
HomeIcon,
|
|
115
|
+
SaveIcon,
|
|
116
|
+
DeleteIcon,
|
|
117
|
+
EditIcon
|
|
118
|
+
} from 'neogestify-ui-components/icons';
|
|
119
|
+
|
|
120
|
+
function MiComponente() {
|
|
121
|
+
return (
|
|
122
|
+
<div>
|
|
123
|
+
<HomeIcon className="w-6 h-6 text-blue-500" />
|
|
124
|
+
<SaveIcon className="w-5 h-5 text-green-600" />
|
|
125
|
+
</div>
|
|
126
|
+
);
|
|
127
|
+
}
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
### Alertas
|
|
131
|
+
|
|
132
|
+
```tsx
|
|
133
|
+
import {
|
|
134
|
+
AlertaExito,
|
|
135
|
+
AlertaError,
|
|
136
|
+
AlertaAdvertencia,
|
|
137
|
+
AlertaConfirmacion,
|
|
138
|
+
AlertaToast
|
|
139
|
+
} from 'neogestify-ui-components/alerts';
|
|
140
|
+
|
|
141
|
+
function MiComponente() {
|
|
142
|
+
const handleGuardar = async () => {
|
|
143
|
+
try {
|
|
144
|
+
await guardarDatos();
|
|
145
|
+
AlertaExito('¡Guardado!', 'Los datos se guardaron correctamente');
|
|
146
|
+
} catch (error) {
|
|
147
|
+
AlertaError('Error', 'No se pudieron guardar los datos');
|
|
148
|
+
}
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
const handleEliminar = () => {
|
|
152
|
+
AlertaAdvertencia(
|
|
153
|
+
'¿Estás seguro?',
|
|
154
|
+
'Esta acción no se puede deshacer',
|
|
155
|
+
async () => {
|
|
156
|
+
await eliminarDatos();
|
|
157
|
+
AlertaToast('Eliminado', 'Registro eliminado', 'success');
|
|
158
|
+
}
|
|
159
|
+
);
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
return (
|
|
163
|
+
<Button variant="danger" onClick={handleEliminar}>
|
|
164
|
+
Eliminar
|
|
165
|
+
</Button>
|
|
166
|
+
);
|
|
167
|
+
}
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
### Sistema de Tema
|
|
171
|
+
|
|
172
|
+
El sistema de tema incluye un Context Provider y un componente toggle listo para usar.
|
|
173
|
+
|
|
174
|
+
#### 1. Configurar el ThemeProvider
|
|
175
|
+
|
|
176
|
+
Envuelve tu aplicación con el `ThemeProvider`:
|
|
177
|
+
|
|
178
|
+
```tsx
|
|
179
|
+
// main.tsx o App.tsx
|
|
180
|
+
import { ThemeProvider } from 'neogestify-ui-components/theme';
|
|
181
|
+
|
|
182
|
+
function Main() {
|
|
183
|
+
return (
|
|
184
|
+
<ThemeProvider>
|
|
185
|
+
<App />
|
|
186
|
+
</ThemeProvider>
|
|
187
|
+
);
|
|
188
|
+
}
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
#### 2. Usar el ThemeToggle
|
|
192
|
+
|
|
193
|
+
```tsx
|
|
194
|
+
import { ThemeToggle } from 'neogestify-ui-components/theme';
|
|
195
|
+
|
|
196
|
+
function Header() {
|
|
197
|
+
return (
|
|
198
|
+
<nav>
|
|
199
|
+
<ThemeToggle />
|
|
200
|
+
</nav>
|
|
201
|
+
);
|
|
202
|
+
}
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
#### 3. Usar el hook useTheme
|
|
206
|
+
|
|
207
|
+
```tsx
|
|
208
|
+
import { useTheme } from 'neogestify-ui-components/theme';
|
|
209
|
+
|
|
210
|
+
function MiComponente() {
|
|
211
|
+
const { theme, toggleTheme, setTheme } = useTheme();
|
|
212
|
+
|
|
213
|
+
return (
|
|
214
|
+
<div>
|
|
215
|
+
<p>Tema actual: {theme}</p>
|
|
216
|
+
<button onClick={toggleTheme}>Cambiar tema</button>
|
|
217
|
+
<button onClick={() => setTheme('dark')}>Modo oscuro</button>
|
|
218
|
+
<button onClick={() => setTheme('light')}>Modo claro</button>
|
|
219
|
+
</div>
|
|
220
|
+
);
|
|
221
|
+
}
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
El tema se guarda automáticamente en `localStorage` y se aplica al cargar la página.
|
|
225
|
+
|
|
226
|
+
## Componentes Disponibles
|
|
227
|
+
|
|
228
|
+
### Button
|
|
229
|
+
|
|
230
|
+
Variantes: `primary`, `secondary`, `danger`, `success`, `warning`, `outline`, `icon`, `nav`, `link`, `toggle`
|
|
231
|
+
|
|
232
|
+
```tsx
|
|
233
|
+
<Button variant="primary" isLoading loadingText="Guardando...">
|
|
234
|
+
Guardar
|
|
235
|
+
</Button>
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
### Input
|
|
239
|
+
|
|
240
|
+
Soporta tipos: `text`, `email`, `password`, `number`, `checkbox`, etc.
|
|
241
|
+
|
|
242
|
+
```tsx
|
|
243
|
+
<Input
|
|
244
|
+
label="Email"
|
|
245
|
+
type="email"
|
|
246
|
+
error="Email inválido"
|
|
247
|
+
helperText="Ingresa tu correo electrónico"
|
|
248
|
+
/>
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
### Select
|
|
252
|
+
|
|
253
|
+
```tsx
|
|
254
|
+
<Select
|
|
255
|
+
label="Categoría"
|
|
256
|
+
placeholder="Selecciona..."
|
|
257
|
+
options={categorias}
|
|
258
|
+
variant="default"
|
|
259
|
+
/>
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
### Table
|
|
263
|
+
|
|
264
|
+
```tsx
|
|
265
|
+
<Table
|
|
266
|
+
headers={['ID', 'Nombre', 'Email']}
|
|
267
|
+
rows={[
|
|
268
|
+
['1', 'Juan', 'juan@ejemplo.com'],
|
|
269
|
+
['2', 'María', 'maria@ejemplo.com']
|
|
270
|
+
]}
|
|
271
|
+
/>
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
### Modal
|
|
275
|
+
|
|
276
|
+
```tsx
|
|
277
|
+
const modalRef = useRef<ModalRef>(null);
|
|
278
|
+
|
|
279
|
+
<Modal
|
|
280
|
+
ref={modalRef}
|
|
281
|
+
title="Mi Modal"
|
|
282
|
+
onClose={() => setShowModal(false)}
|
|
283
|
+
footer={
|
|
284
|
+
<Button onClick={() => modalRef.current?.handleClose()}>
|
|
285
|
+
Cerrar
|
|
286
|
+
</Button>
|
|
287
|
+
}
|
|
288
|
+
>
|
|
289
|
+
<p>Contenido del modal</p>
|
|
290
|
+
</Modal>
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
## Showcase / Demo
|
|
294
|
+
|
|
295
|
+
Para ver todos los componentes en acción:
|
|
296
|
+
|
|
297
|
+
```bash
|
|
298
|
+
cd showcase
|
|
299
|
+
bun install
|
|
300
|
+
bun dev
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
Abre http://localhost:5173 en tu navegador.
|
|
304
|
+
|
|
305
|
+
## Desarrollo
|
|
306
|
+
|
|
307
|
+
### Build
|
|
308
|
+
|
|
309
|
+
```bash
|
|
310
|
+
bun install
|
|
311
|
+
bun run build
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
### Estructura del proyecto
|
|
315
|
+
|
|
316
|
+
```
|
|
317
|
+
ui-components/
|
|
318
|
+
├── src/
|
|
319
|
+
│ ├── components/
|
|
320
|
+
│ │ ├── html/ # Componentes HTML
|
|
321
|
+
│ │ ├── icons/ # Iconos SVG
|
|
322
|
+
│ │ └── alerts/ # Alertas SweetAlert2
|
|
323
|
+
│ └── types/ # Tipos TypeScript
|
|
324
|
+
├── showcase/ # Demo/Showcase
|
|
325
|
+
└── dist/ # Build output
|
|
326
|
+
```
|
|
327
|
+
|
|
328
|
+
## Modo Oscuro
|
|
329
|
+
|
|
330
|
+
Los componentes soportan modo oscuro automáticamente usando las clases `dark:` de Tailwind. Asegúrate de configurar el modo oscuro en tu proyecto:
|
|
331
|
+
|
|
332
|
+
```js
|
|
333
|
+
// tailwind.config.js
|
|
334
|
+
export default {
|
|
335
|
+
darkMode: 'class', // o 'media'
|
|
336
|
+
// ...
|
|
337
|
+
}
|
|
338
|
+
```
|
|
339
|
+
|
|
340
|
+
Para activar el modo oscuro:
|
|
341
|
+
|
|
342
|
+
```tsx
|
|
343
|
+
// Agregar/quitar la clase 'dark' en el html
|
|
344
|
+
document.documentElement.classList.add('dark');
|
|
345
|
+
```
|
|
346
|
+
|
|
347
|
+
## Licencia
|
|
348
|
+
|
|
349
|
+
MIT
|