@onpe/ui 1.0.28 → 1.0.30
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 +72 -88
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -29,69 +29,40 @@ npx onpe-ui add <componente>
|
|
|
29
29
|
|
|
30
30
|
## ⚠️ Importante sobre Estilos
|
|
31
31
|
|
|
32
|
-
|
|
33
|
-
Esta librería **NO requiere** que instales TailwindCSS en tu proyecto. Los estilos ya están compilados y optimizados. Solo necesitas importar los estilos:
|
|
34
|
-
|
|
35
|
-
```tsx
|
|
36
|
-
// En tu archivo principal (index.tsx, App.tsx, etc.)
|
|
37
|
-
import '@onpe/ui/styles';
|
|
38
|
-
import { Button } from '@onpe/ui/components';
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
### Opción 2: Componentes Individuales (CLI)
|
|
42
|
-
Si instalas componentes individualmente con la CLI, **SÍ necesitas** instalar y configurar TailwindCSS en tu proyecto, y crear un archivo CSS con las variables personalizadas.
|
|
32
|
+
**Esta librería requiere que instales y configures TailwindCSS en tu proyecto.** Los componentes usan clases de TailwindCSS que necesitan estar configuradas correctamente.
|
|
43
33
|
|
|
44
34
|
## 📖 Uso Básico
|
|
45
35
|
|
|
46
|
-
###
|
|
47
|
-
|
|
48
|
-
#### Importar estilos
|
|
49
|
-
```tsx
|
|
50
|
-
// Importar estilos de la librería
|
|
51
|
-
import '@onpe/ui/styles';
|
|
52
|
-
import { Button } from '@onpe/ui/components';
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
#### Usar componentes
|
|
56
|
-
```tsx
|
|
57
|
-
import '@onpe/ui/styles';
|
|
58
|
-
import { Button } from '@onpe/ui/components';
|
|
59
|
-
|
|
60
|
-
function App() {
|
|
61
|
-
return (
|
|
62
|
-
<div>
|
|
63
|
-
<Button color="primary" title="Votar Ahora" size="normal" />
|
|
64
|
-
<Button color="skyblue" title="Ver Resultados" size="large" />
|
|
65
|
-
</div>
|
|
66
|
-
);
|
|
67
|
-
}
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
### Opción 2: Instalar Componentes Individualmente con CLI
|
|
36
|
+
### Instalar Componentes con CLI
|
|
71
37
|
|
|
72
|
-
#### Instalar
|
|
38
|
+
#### Instalar componentes específicos
|
|
73
39
|
```bash
|
|
74
|
-
#
|
|
40
|
+
# Componentes
|
|
75
41
|
npx onpe-ui add button
|
|
76
|
-
|
|
77
|
-
# Instalar Modal (instala automáticamente Portal y Overlay)
|
|
78
42
|
npx onpe-ui add modal
|
|
79
|
-
|
|
80
|
-
# Instalar Portal
|
|
81
43
|
npx onpe-ui add portal
|
|
82
|
-
|
|
83
|
-
# Instalar Overlay
|
|
84
44
|
npx onpe-ui add overlay
|
|
85
|
-
|
|
86
|
-
# Instalar Show
|
|
87
45
|
npx onpe-ui add show
|
|
46
|
+
|
|
47
|
+
# Iconos
|
|
48
|
+
npx onpe-ui add icon-close
|
|
49
|
+
npx onpe-ui add icon-check
|
|
50
|
+
npx onpe-ui add icon-warning
|
|
51
|
+
npx onpe-ui add icon-chrome
|
|
52
|
+
npx onpe-ui add icon-firefox
|
|
53
|
+
npx onpe-ui add icon-safari
|
|
54
|
+
npx onpe-ui add icon-edge
|
|
55
|
+
npx onpe-ui add icon-windows
|
|
56
|
+
npx onpe-ui add icon-apple
|
|
57
|
+
npx onpe-ui add icon-android
|
|
88
58
|
```
|
|
89
59
|
|
|
90
60
|
#### Usar componentes instalados individualmente
|
|
91
61
|
```tsx
|
|
92
62
|
// Después de instalar con CLI
|
|
93
|
-
import { Button } from './components/ui/Button';
|
|
94
|
-
import { Modal } from './components/ui/Modal';
|
|
63
|
+
import { Button } from './components/onpe-ui/Button';
|
|
64
|
+
import { Modal } from './components/onpe-ui/Modal';
|
|
65
|
+
import { IconClose } from './components/onpe-icons/IconClose';
|
|
95
66
|
import { useState } from 'react';
|
|
96
67
|
|
|
97
68
|
function App() {
|
|
@@ -114,11 +85,14 @@ function App() {
|
|
|
114
85
|
<div className="p-6">
|
|
115
86
|
<h2 className="text-xl font-bold mb-4">Contenido del Modal</h2>
|
|
116
87
|
<p className="mb-4">Este es un ejemplo de modal con contenido.</p>
|
|
117
|
-
<
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
88
|
+
<div className="flex items-center gap-2">
|
|
89
|
+
<IconClose className="w-4 h-4" />
|
|
90
|
+
<Button
|
|
91
|
+
color="green"
|
|
92
|
+
title="Cerrar"
|
|
93
|
+
onClick={() => setIsOpen(false)}
|
|
94
|
+
/>
|
|
95
|
+
</div>
|
|
122
96
|
</div>
|
|
123
97
|
</Modal>
|
|
124
98
|
</div>
|
|
@@ -248,12 +222,21 @@ npx onpe-ui add show # Sin dependencias
|
|
|
248
222
|
```
|
|
249
223
|
src/
|
|
250
224
|
└── components/
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
225
|
+
├── ui/ # shadcn/ui (si está instalado)
|
|
226
|
+
│ ├── button.tsx
|
|
227
|
+
│ └── input.tsx
|
|
228
|
+
├── onpe-ui/ # ONPE UI - Componentes
|
|
229
|
+
│ ├── Button.tsx
|
|
230
|
+
│ ├── Modal.tsx
|
|
231
|
+
│ ├── Overlay.tsx
|
|
232
|
+
│ ├── Portal.tsx
|
|
233
|
+
│ └── Show.tsx
|
|
234
|
+
└── onpe-icons/ # ONPE UI - Iconos
|
|
235
|
+
├── IconClose.tsx
|
|
236
|
+
├── IconCheck.tsx
|
|
237
|
+
├── IconChrome.tsx
|
|
238
|
+
├── IconFirefox.tsx
|
|
239
|
+
└── IconWindows.tsx
|
|
257
240
|
```
|
|
258
241
|
|
|
259
242
|
## 🧩 Componentes Disponibles
|
|
@@ -1382,18 +1365,19 @@ npm install @onpe/ui
|
|
|
1382
1365
|
**Estilos no se cargan**
|
|
1383
1366
|
```tsx
|
|
1384
1367
|
/* Verificar que tengas la importación correcta */
|
|
1385
|
-
import '
|
|
1386
|
-
import { Button } from '
|
|
1368
|
+
import './onpe-ui.css';
|
|
1369
|
+
import { Button } from './components/onpe-ui/Button';
|
|
1387
1370
|
```
|
|
1388
1371
|
|
|
1389
1372
|
**Solución: Verificar rutas de importación**
|
|
1390
1373
|
```tsx
|
|
1391
|
-
// ✅ CORRECTO: Importar
|
|
1392
|
-
import '
|
|
1393
|
-
import { Button } from '
|
|
1374
|
+
// ✅ CORRECTO: Importar archivo CSS personalizado
|
|
1375
|
+
import './onpe-ui.css';
|
|
1376
|
+
import { Button } from './components/onpe-ui/Button';
|
|
1377
|
+
import { IconClose } from './components/onpe-icons/IconClose';
|
|
1394
1378
|
|
|
1395
|
-
// ❌ INCORRECTO: No importar
|
|
1396
|
-
import { Button } from '
|
|
1379
|
+
// ❌ INCORRECTO: No importar el archivo CSS
|
|
1380
|
+
import { Button } from './components/onpe-ui/Button';
|
|
1397
1381
|
```
|
|
1398
1382
|
|
|
1399
1383
|
**Solución: Verificar configuración de bundler**
|
|
@@ -1550,34 +1534,14 @@ export default preview;
|
|
|
1550
1534
|
npm list @onpe/ui
|
|
1551
1535
|
```
|
|
1552
1536
|
|
|
1553
|
-
**Paso 2:
|
|
1554
|
-
```tsx
|
|
1555
|
-
// En tu archivo principal (index.tsx)
|
|
1556
|
-
import '@onpe/ui/styles';
|
|
1557
|
-
import { Button } from '@onpe/ui/components';
|
|
1558
|
-
```
|
|
1559
|
-
|
|
1560
|
-
**Paso 3: Verificar orden de importación**
|
|
1561
|
-
```tsx
|
|
1562
|
-
// ✅ CORRECTO
|
|
1563
|
-
import '@onpe/ui/styles';
|
|
1564
|
-
import { Button } from '@onpe/ui/components';
|
|
1565
|
-
|
|
1566
|
-
// ❌ INCORRECTO
|
|
1567
|
-
import { Button } from '@onpe/ui/components';
|
|
1568
|
-
// Falta importar los estilos
|
|
1569
|
-
```
|
|
1570
|
-
|
|
1571
|
-
### ¿Usas CLI para componentes individuales?
|
|
1572
|
-
|
|
1573
|
-
**Entonces SÍ necesitas configurar TailwindCSS:**
|
|
1537
|
+
**Paso 2: Configurar TailwindCSS**
|
|
1574
1538
|
```bash
|
|
1575
1539
|
# Instalar TailwindCSS
|
|
1576
1540
|
npm install -D tailwindcss postcss autoprefixer
|
|
1577
1541
|
npx tailwindcss init -p
|
|
1578
1542
|
```
|
|
1579
1543
|
|
|
1580
|
-
**
|
|
1544
|
+
**Paso 3: Crear archivo CSS personalizado**
|
|
1581
1545
|
```css
|
|
1582
1546
|
/* Crear archivo onpe-ui.css */
|
|
1583
1547
|
:root {
|
|
@@ -1592,6 +1556,26 @@ npx tailwindcss init -p
|
|
|
1592
1556
|
}
|
|
1593
1557
|
```
|
|
1594
1558
|
|
|
1559
|
+
**Paso 4: Importar archivo CSS**
|
|
1560
|
+
```tsx
|
|
1561
|
+
// En tu archivo principal (index.tsx)
|
|
1562
|
+
import './onpe-ui.css';
|
|
1563
|
+
import { Button } from './components/onpe-ui/Button';
|
|
1564
|
+
import { IconClose } from './components/onpe-icons/IconClose';
|
|
1565
|
+
```
|
|
1566
|
+
|
|
1567
|
+
**Paso 5: Verificar orden de importación**
|
|
1568
|
+
```tsx
|
|
1569
|
+
// ✅ CORRECTO
|
|
1570
|
+
import './onpe-ui.css';
|
|
1571
|
+
import { Button } from './components/onpe-ui/Button';
|
|
1572
|
+
import { IconClose } from './components/onpe-icons/IconClose';
|
|
1573
|
+
|
|
1574
|
+
// ❌ INCORRECTO
|
|
1575
|
+
import { Button } from './components/onpe-ui/Button';
|
|
1576
|
+
// Falta importar el archivo CSS
|
|
1577
|
+
```
|
|
1578
|
+
|
|
1595
1579
|
### ¿Los colores no funcionan?
|
|
1596
1580
|
|
|
1597
1581
|
**Solución: Usar clases correctas**
|