@dropi/ui 0.1.17 → 0.1.18
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/package.json +1 -1
- package/readme.md +189 -2
package/package.json
CHANGED
package/readme.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Librería de Web Components del Design System de Dropi, construida con **Stencil.js v4**.
|
|
4
4
|
Genera componentes reutilizables para Angular, React y Vue desde una única base de código.
|
|
5
5
|
|
|
6
|
-
- **Paquete npm:** `@dropi/ui` (v0.1.
|
|
6
|
+
- **Paquete npm:** `@dropi/ui` (v0.1.17)
|
|
7
7
|
- **React wrappers:** `@dropi/ui-react`
|
|
8
8
|
|
|
9
9
|
---
|
|
@@ -21,7 +21,7 @@ Ejecuta el siguiente comando en la raíz de tu proyecto:
|
|
|
21
21
|
```bash
|
|
22
22
|
npx @dropi/ui setup
|
|
23
23
|
```
|
|
24
|
-
*Este comando detectará tu framework (Angular, React o Vue), instalará las dependencias necesarias y configurará estilos
|
|
24
|
+
*Este comando detectará tu framework (Angular, React o Vue), instalará las dependencias necesarias y configurará estilos, iconos, animaciones Lottie y scripts automáticamente.*
|
|
25
25
|
|
|
26
26
|
---
|
|
27
27
|
|
|
@@ -79,6 +79,23 @@ onDropiChange={(e) => console.log(e.detail)}
|
|
|
79
79
|
|
|
80
80
|
---
|
|
81
81
|
|
|
82
|
+
## Uso en React (Métodos Imperativos)
|
|
83
|
+
|
|
84
|
+
Componentes como `DropiModal` y `DropiToast` tienen métodos que deben llamarse vía `ref`. Dado que los wrappers son generados, a veces es necesario castear a `any` para acceder a `show()` o `hide()`.
|
|
85
|
+
|
|
86
|
+
```tsx
|
|
87
|
+
const modalRef = useRef<any>(null);
|
|
88
|
+
const Modal = DropiModal as any; // Cast opcional para mejor DX
|
|
89
|
+
|
|
90
|
+
<Modal ref={modalRef} header="Título">
|
|
91
|
+
<p>Contenido</p>
|
|
92
|
+
</Modal>
|
|
93
|
+
|
|
94
|
+
<button onClick={() => modalRef.current?.show()}>Abrir</button>
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
---
|
|
98
|
+
|
|
82
99
|
## Componentes
|
|
83
100
|
|
|
84
101
|
---
|
|
@@ -301,6 +318,7 @@ interface SelectOption {
|
|
|
301
318
|
shortLabel?: string // para showCountryFlags
|
|
302
319
|
secondLabel?: string // subtítulo en radioOptions
|
|
303
320
|
countryCode?: string // código de país para flags
|
|
321
|
+
countryId?: string // id de país para flags
|
|
304
322
|
imageUrl?: string // imagen en radioOptions
|
|
305
323
|
preIcon?: string // ícono izquierdo
|
|
306
324
|
disabled?: boolean
|
|
@@ -477,6 +495,175 @@ Renderiza íconos SVG desde el sprite de Dropi. Sin eventos.
|
|
|
477
495
|
|
|
478
496
|
---
|
|
479
497
|
|
|
498
|
+
### `<dropi-tabs>`
|
|
499
|
+
|
|
500
|
+
Sistema de pestañas con contadores y estados.
|
|
501
|
+
|
|
502
|
+
**Props**
|
|
503
|
+
|
|
504
|
+
| Prop | Tipo | Default | Descripción |
|
|
505
|
+
|---|---|---|---|
|
|
506
|
+
| `tabs` | `TabItem[]` | `[]` | Lista de tabs `{ id, label, counter, active, disabled, completed }` |
|
|
507
|
+
| `showIcon` | `boolean` | `false` | Mostrar check si `completed` |
|
|
508
|
+
|
|
509
|
+
**Ejemplo React**
|
|
510
|
+
```tsx
|
|
511
|
+
<DropiTabs
|
|
512
|
+
tabs={[{ id: 1, label: 'Activos', counter: 5 }]}
|
|
513
|
+
onDropiTabChange={(e) => console.log(e.detail)}
|
|
514
|
+
/>
|
|
515
|
+
```
|
|
516
|
+
|
|
517
|
+
---
|
|
518
|
+
|
|
519
|
+
### `<dropi-accordion>`
|
|
520
|
+
|
|
521
|
+
Contenedor colapsable.
|
|
522
|
+
|
|
523
|
+
**Props**
|
|
524
|
+
|
|
525
|
+
| Prop | Tipo | Default | Descripción |
|
|
526
|
+
|---|---|---|---|
|
|
527
|
+
| `header` | `string` | `''` | Título del acordeón |
|
|
528
|
+
| `preIcon` | `string` | `''` | Ícono izquierdo |
|
|
529
|
+
| `disabled` | `boolean` | `false` | Deshabilitar |
|
|
530
|
+
|
|
531
|
+
**Ejemplo React**
|
|
532
|
+
```tsx
|
|
533
|
+
<DropiAccordion header="¿Cómo funciona?">
|
|
534
|
+
<p>Contenido interno</p>
|
|
535
|
+
</DropiAccordion>
|
|
536
|
+
```
|
|
537
|
+
|
|
538
|
+
---
|
|
539
|
+
|
|
540
|
+
### `<dropi-skeleton>`
|
|
541
|
+
|
|
542
|
+
Indicadores de carga.
|
|
543
|
+
|
|
544
|
+
**Props**
|
|
545
|
+
|
|
546
|
+
| Prop | Tipo | Default | Descripción |
|
|
547
|
+
|---|---|---|---|
|
|
548
|
+
| `variant` | `'text' \| 'circle' \| 'rect'` | `'text'` | Forma |
|
|
549
|
+
| `width` | `string` | `'100%'` | Ancho CSS |
|
|
550
|
+
| `height` | `string` | `'16px'` | Alto CSS |
|
|
551
|
+
|
|
552
|
+
---
|
|
553
|
+
|
|
554
|
+
### `<dropi-paginator>`
|
|
555
|
+
|
|
556
|
+
Control de paginación.
|
|
557
|
+
|
|
558
|
+
**Props**
|
|
559
|
+
|
|
560
|
+
| Prop | Tipo | Default | Descripción |
|
|
561
|
+
|---|---|---|---|
|
|
562
|
+
| `total` | `number` | `0` | Total de registros |
|
|
563
|
+
| `rows` | `number` | `10` | Registros por página |
|
|
564
|
+
| `showPageSizeSelector` | `boolean` | `false` | Selector de cantidad por página |
|
|
565
|
+
|
|
566
|
+
**Ejemplo React**
|
|
567
|
+
```tsx
|
|
568
|
+
<DropiPaginator
|
|
569
|
+
total={100}
|
|
570
|
+
onDropiPageChange={(e) => console.log(e.detail.page)}
|
|
571
|
+
/>
|
|
572
|
+
```
|
|
573
|
+
|
|
574
|
+
---
|
|
575
|
+
|
|
576
|
+
### `<dropi-empty-state>`
|
|
577
|
+
|
|
578
|
+
Pantalla de "no hay datos".
|
|
579
|
+
|
|
580
|
+
**Props**
|
|
581
|
+
|
|
582
|
+
| Prop | Tipo | Default | Descripción |
|
|
583
|
+
|---|---|---|---|
|
|
584
|
+
| `header` | `string` | `''` | Título principal |
|
|
585
|
+
| `description` | `string` | `''` | Subtítulo descriptivo |
|
|
586
|
+
| `actionLabel` | `string` | `''` | Texto botón principal |
|
|
587
|
+
| `secondaryLabel` | `string` | `''` | Texto botón secundario |
|
|
588
|
+
|
|
589
|
+
---
|
|
590
|
+
|
|
591
|
+
### `<dropi-tooltip>` (V2)
|
|
592
|
+
|
|
593
|
+
Burbuja de información al hover.
|
|
594
|
+
|
|
595
|
+
**Props**
|
|
596
|
+
|
|
597
|
+
| Prop | Tipo | Default | Descripción |
|
|
598
|
+
|---|---|---|---|
|
|
599
|
+
| `text` | `string` | `''` | Mensaje del tooltip |
|
|
600
|
+
| `position` | `'top' \| 'bottom' \| 'left' \| 'right'` | `'top'` | Posición |
|
|
601
|
+
| `maxWidth` | `string` | `'280px'` | Ancho máximo |
|
|
602
|
+
|
|
603
|
+
**Ejemplo React**
|
|
604
|
+
```tsx
|
|
605
|
+
<DropiTooltip text="Guardar cambios" position="bottom">
|
|
606
|
+
<DropiButton text="Hover me" />
|
|
607
|
+
</DropiTooltip>
|
|
608
|
+
```
|
|
609
|
+
|
|
610
|
+
---
|
|
611
|
+
|
|
612
|
+
### `<dropi-modal>`
|
|
613
|
+
|
|
614
|
+
Ventana de diálogo con overlays.
|
|
615
|
+
|
|
616
|
+
**Props**
|
|
617
|
+
|
|
618
|
+
| Prop | Tipo | Default | Descripción |
|
|
619
|
+
|---|---|---|---|
|
|
620
|
+
| `header` | `string` | `''` | Título del modal |
|
|
621
|
+
| `size` | `'s' \| 'm' \| 'l' \| 'full' ...` | `'m'` | Tamaño |
|
|
622
|
+
| `visible` | `boolean` | `false` | Controlar visibilidad vía prop |
|
|
623
|
+
|
|
624
|
+
**Ejemplo React (Imperativo)**
|
|
625
|
+
```tsx
|
|
626
|
+
const modalRef = useRef<any>(null);
|
|
627
|
+
const Modal = DropiModal as any;
|
|
628
|
+
|
|
629
|
+
<Modal ref={modalRef} header="Mi Modal">
|
|
630
|
+
<p>Contenido</p>
|
|
631
|
+
<div slot="footer">
|
|
632
|
+
<DropiButton text="Cerrar" onDropiClick={() => modalRef.current.hide()} />
|
|
633
|
+
</div>
|
|
634
|
+
</Modal>
|
|
635
|
+
```
|
|
636
|
+
|
|
637
|
+
---
|
|
638
|
+
|
|
639
|
+
### `<dropi-toast>`
|
|
640
|
+
|
|
641
|
+
Notificaciones tipo push con animaciones Lottie.
|
|
642
|
+
|
|
643
|
+
**Mapeo de Severidad a Lottie:**
|
|
644
|
+
- `success` -> `success.json`
|
|
645
|
+
- `error` -> `failure.json`
|
|
646
|
+
- `warn` -> `warning.json`
|
|
647
|
+
- `info` -> `question.json`
|
|
648
|
+
|
|
649
|
+
**Ejemplo React**
|
|
650
|
+
```tsx
|
|
651
|
+
const toastRef = useRef<any>(null);
|
|
652
|
+
const Toast = DropiToast as any;
|
|
653
|
+
|
|
654
|
+
<Toast ref={toastRef} position="top-right" />
|
|
655
|
+
|
|
656
|
+
<button onClick={() => toastRef.current.show({
|
|
657
|
+
severity: 'success',
|
|
658
|
+
summary: '¡Éxito!',
|
|
659
|
+
detail: 'Usuario creado.'
|
|
660
|
+
})}>
|
|
661
|
+
Lanzar Toast
|
|
662
|
+
</button>
|
|
663
|
+
```
|
|
664
|
+
|
|
665
|
+
---
|
|
666
|
+
|
|
480
667
|
## Build (desarrollo)
|
|
481
668
|
|
|
482
669
|
```bash
|