@klu_dev/ui-klu-green 1.2.3 → 1.2.4
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 +82 -1
- package/dist/index.css +93 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -654,4 +654,85 @@ export default function NavigationDashboard() {
|
|
|
654
654
|
| `id` | `string` | Identificador único de la pestaña. |
|
|
655
655
|
| `label` | `string` | Texto descriptivo de la opción que verá el usuario. |
|
|
656
656
|
| `icon` | `ReactNode` | Elemento gráfico/ícono extraído del objeto `Icons`. |
|
|
657
|
-
| `content` | `ReactNode` | (Opcional) Componente o vista que se renderizará automáticamente al activar la pestaña. |
|
|
657
|
+
| `content` | `ReactNode` | (Opcional) Componente o vista que se renderizará automáticamente al activar la pestaña. |
|
|
658
|
+
|
|
659
|
+
|
|
660
|
+
## Uso de MobileMenuDrawer
|
|
661
|
+
|
|
662
|
+
Componente presentacional ("tonto") diseñado para desplegar la barra de navegación en vistas responsivas móviles. Al cambiar de pestaña, delega el control de la acción a la aplicación contenedora para poder mutar layouts completos de forma dinámica mediante un Mapeo de Componentes.
|
|
663
|
+
|
|
664
|
+
|
|
665
|
+
|
|
666
|
+
```tsx
|
|
667
|
+
import { useState } from 'react'
|
|
668
|
+
import { MobileMenuDrawer, Button, Icons } from '@klu_dev/ui-klu-green'
|
|
669
|
+
import { MoreHorizontal } from 'lucide-react'
|
|
670
|
+
|
|
671
|
+
// 1. Importa tus componentes/vistas completos del proyecto
|
|
672
|
+
import { MiVistaInicio } from './views/MiVistaInicio'
|
|
673
|
+
import { MiVistaTarjeta } from './views/MiVistaTarjeta'
|
|
674
|
+
import { MiVistaMovimientos } from './views/MiVistaMovimientos'
|
|
675
|
+
|
|
676
|
+
export function AppMobileLayout() {
|
|
677
|
+
const [isMenuOpen, setIsMenuOpen] = useState(false)
|
|
678
|
+
const [activeTab, setActiveTab] = useState('inicio')
|
|
679
|
+
|
|
680
|
+
// Opciones compartidas con el menú
|
|
681
|
+
const opcionesMenu = [
|
|
682
|
+
{ id: 'inicio', label: 'Inicio', icon: Icons.HOME },
|
|
683
|
+
{ id: 'tarjeta', label: 'Mi Tarjeta', icon: Icons.MYCARD },
|
|
684
|
+
{ id: 'movimientos', label: 'Movimientos', icon: Icons.MOVEMENTS },
|
|
685
|
+
]
|
|
686
|
+
|
|
687
|
+
// 2. Diccionario de mapeo: Asocia cada ID string con su respectiva vista
|
|
688
|
+
const rendersDeVistas: Record<string, React.ReactNode> = {
|
|
689
|
+
inicio: <MiVistaInicio />,
|
|
690
|
+
tarjeta: <MiVistaTarjeta />,
|
|
691
|
+
movimientos: <MiVistaMovimientos />,
|
|
692
|
+
}
|
|
693
|
+
|
|
694
|
+
return (
|
|
695
|
+
<div className="uiklu-w-full uiklu-min-h-screen uiklu-bg-gray-50 uiklu-flex uiklu-flex-col">
|
|
696
|
+
<header className="uiklu-bg-white uiklu-p-4 uiklu-flex uiklu-justify-between uiklu-items-center uiklu-border-b">
|
|
697
|
+
<span>Mi Banca Web</span>
|
|
698
|
+
|
|
699
|
+
{/* Botón para abrir el drawer */}
|
|
700
|
+
<Button
|
|
701
|
+
variant="iconCircle"
|
|
702
|
+
size="iconOnly"
|
|
703
|
+
onClick={() => setIsMenuOpen(true)}
|
|
704
|
+
icon={<MoreHorizontal style={{ width: '20px', height: '20px', color: '#FFF' }} />}
|
|
705
|
+
/>
|
|
706
|
+
</header>
|
|
707
|
+
|
|
708
|
+
{/* 3. Contenedor Dinámico: Se monta la vista completa en base al ID seleccionado */}
|
|
709
|
+
<main className="uiklu-p-4 uiklu-flex-1">
|
|
710
|
+
{rendersDeVistas[activeTab] || <MiVistaInicio />}
|
|
711
|
+
</main>
|
|
712
|
+
|
|
713
|
+
{/* Render del Drawer Mobile */}
|
|
714
|
+
<MobileMenuDrawer
|
|
715
|
+
isOpen={isMenuOpen}
|
|
716
|
+
onClose={() => setIsMenuOpen(false)}
|
|
717
|
+
items={opcionesMenu}
|
|
718
|
+
activeTab={activeTab}
|
|
719
|
+
onTabChange={setActiveTab}
|
|
720
|
+
/>
|
|
721
|
+
</div>
|
|
722
|
+
)
|
|
723
|
+
}
|
|
724
|
+
```
|
|
725
|
+
|
|
726
|
+
|
|
727
|
+
### Props de MobileMenuDrawer
|
|
728
|
+
### Props de MobileMenuDrawer
|
|
729
|
+
|
|
730
|
+
| Prop | Tipo | Descripción |
|
|
731
|
+
| :--- | :--- | :--- |
|
|
732
|
+
| `isOpen` | `boolean` | Controla la visibilidad en pantalla del menú desplegable. |
|
|
733
|
+
| `onClose` | `() => void` | Callback ejecutado al presionar el botón de cerrar (`X`) o seleccionar una pestaña. |
|
|
734
|
+
| `items` | `NavItem[]` | Array de opciones con estructura `{ id, label, icon, hasDivider? }`. |
|
|
735
|
+
| `activeTab` | `string` | ID de la pestaña seleccionada actualmente. |
|
|
736
|
+
| `onTabChange` | `(id: string) => void` | Callback gatillado al pulsar una nueva opción del menú. Devuelve el `id`. |
|
|
737
|
+
|
|
738
|
+
|
package/dist/index.css
CHANGED
|
@@ -266,6 +266,10 @@ button,
|
|
|
266
266
|
.uiklu-m-0{
|
|
267
267
|
margin: 0px;
|
|
268
268
|
}
|
|
269
|
+
.uiklu-mx-auto{
|
|
270
|
+
margin-left: auto;
|
|
271
|
+
margin-right: auto;
|
|
272
|
+
}
|
|
269
273
|
.uiklu-my-2{
|
|
270
274
|
margin-top: 0.5rem;
|
|
271
275
|
margin-bottom: 0.5rem;
|
|
@@ -342,6 +346,9 @@ button,
|
|
|
342
346
|
.uiklu-block{
|
|
343
347
|
display: block;
|
|
344
348
|
}
|
|
349
|
+
.uiklu-inline-block{
|
|
350
|
+
display: inline-block;
|
|
351
|
+
}
|
|
345
352
|
.uiklu-flex{
|
|
346
353
|
display: flex;
|
|
347
354
|
}
|
|
@@ -363,6 +370,9 @@ button,
|
|
|
363
370
|
.uiklu-h-4{
|
|
364
371
|
height: 1rem;
|
|
365
372
|
}
|
|
373
|
+
.uiklu-h-44{
|
|
374
|
+
height: 11rem;
|
|
375
|
+
}
|
|
366
376
|
.uiklu-h-5{
|
|
367
377
|
height: 1.25rem;
|
|
368
378
|
}
|
|
@@ -435,6 +445,9 @@ button,
|
|
|
435
445
|
.uiklu-min-h-screen{
|
|
436
446
|
min-height: 100vh;
|
|
437
447
|
}
|
|
448
|
+
.uiklu-w-12{
|
|
449
|
+
width: 3rem;
|
|
450
|
+
}
|
|
438
451
|
.uiklu-w-2{
|
|
439
452
|
width: 0.5rem;
|
|
440
453
|
}
|
|
@@ -639,6 +652,9 @@ button,
|
|
|
639
652
|
.uiklu-grid-cols-1{
|
|
640
653
|
grid-template-columns: repeat(1, minmax(0, 1fr));
|
|
641
654
|
}
|
|
655
|
+
.uiklu-grid-cols-2{
|
|
656
|
+
grid-template-columns: repeat(2, minmax(0, 1fr));
|
|
657
|
+
}
|
|
642
658
|
.uiklu-flex-row{
|
|
643
659
|
flex-direction: row;
|
|
644
660
|
}
|
|
@@ -719,11 +735,30 @@ button,
|
|
|
719
735
|
margin-top: calc(0.5rem * calc(1 - var(--tw-space-y-reverse)));
|
|
720
736
|
margin-bottom: calc(0.5rem * var(--tw-space-y-reverse));
|
|
721
737
|
}
|
|
738
|
+
.uiklu-space-y-3 > :not([hidden]) ~ :not([hidden]){
|
|
739
|
+
--tw-space-y-reverse: 0;
|
|
740
|
+
margin-top: calc(0.75rem * calc(1 - var(--tw-space-y-reverse)));
|
|
741
|
+
margin-bottom: calc(0.75rem * var(--tw-space-y-reverse));
|
|
742
|
+
}
|
|
743
|
+
.uiklu-space-y-4 > :not([hidden]) ~ :not([hidden]){
|
|
744
|
+
--tw-space-y-reverse: 0;
|
|
745
|
+
margin-top: calc(1rem * calc(1 - var(--tw-space-y-reverse)));
|
|
746
|
+
margin-bottom: calc(1rem * var(--tw-space-y-reverse));
|
|
747
|
+
}
|
|
722
748
|
.uiklu-space-y-6 > :not([hidden]) ~ :not([hidden]){
|
|
723
749
|
--tw-space-y-reverse: 0;
|
|
724
750
|
margin-top: calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));
|
|
725
751
|
margin-bottom: calc(1.5rem * var(--tw-space-y-reverse));
|
|
726
752
|
}
|
|
753
|
+
.uiklu-divide-y > :not([hidden]) ~ :not([hidden]){
|
|
754
|
+
--tw-divide-y-reverse: 0;
|
|
755
|
+
border-top-width: calc(1px * calc(1 - var(--tw-divide-y-reverse)));
|
|
756
|
+
border-bottom-width: calc(1px * var(--tw-divide-y-reverse));
|
|
757
|
+
}
|
|
758
|
+
.uiklu-divide-gray-100 > :not([hidden]) ~ :not([hidden]){
|
|
759
|
+
--tw-divide-opacity: 1;
|
|
760
|
+
border-color: rgb(243 244 246 / var(--tw-divide-opacity, 1));
|
|
761
|
+
}
|
|
727
762
|
.uiklu-self-center{
|
|
728
763
|
align-self: center;
|
|
729
764
|
}
|
|
@@ -965,13 +1000,14 @@ button,
|
|
|
965
1000
|
--tw-bg-opacity: 1;
|
|
966
1001
|
background-color: rgb(220 252 231 / var(--tw-bg-opacity, 1));
|
|
967
1002
|
}
|
|
1003
|
+
.uiklu-bg-green-50{
|
|
1004
|
+
--tw-bg-opacity: 1;
|
|
1005
|
+
background-color: rgb(240 253 244 / var(--tw-bg-opacity, 1));
|
|
1006
|
+
}
|
|
968
1007
|
.uiklu-bg-orange{
|
|
969
1008
|
--tw-bg-opacity: 1;
|
|
970
1009
|
background-color: hsl(var(--uiklu-orange) / var(--tw-bg-opacity, 1));
|
|
971
1010
|
}
|
|
972
|
-
.uiklu-bg-orange\/20{
|
|
973
|
-
background-color: hsl(var(--uiklu-orange) / 0.2);
|
|
974
|
-
}
|
|
975
1011
|
.uiklu-bg-orange500{
|
|
976
1012
|
--tw-bg-opacity: 1;
|
|
977
1013
|
background-color: hsl(var(--uiklu-orange-500) / var(--tw-bg-opacity, 1));
|
|
@@ -1000,6 +1036,10 @@ button,
|
|
|
1000
1036
|
--tw-bg-opacity: 1;
|
|
1001
1037
|
background-color: hsl(var(--uiklu-primary-light) / var(--tw-bg-opacity, 1));
|
|
1002
1038
|
}
|
|
1039
|
+
.uiklu-bg-red-50{
|
|
1040
|
+
--tw-bg-opacity: 1;
|
|
1041
|
+
background-color: rgb(254 242 242 / var(--tw-bg-opacity, 1));
|
|
1042
|
+
}
|
|
1003
1043
|
.uiklu-bg-slate-50{
|
|
1004
1044
|
--tw-bg-opacity: 1;
|
|
1005
1045
|
background-color: rgb(248 250 252 / var(--tw-bg-opacity, 1));
|
|
@@ -1012,6 +1052,10 @@ button,
|
|
|
1012
1052
|
--tw-bg-opacity: 1;
|
|
1013
1053
|
background-color: rgb(13 148 136 / var(--tw-bg-opacity, 1));
|
|
1014
1054
|
}
|
|
1055
|
+
.uiklu-bg-teal-700{
|
|
1056
|
+
--tw-bg-opacity: 1;
|
|
1057
|
+
background-color: rgb(15 118 110 / var(--tw-bg-opacity, 1));
|
|
1058
|
+
}
|
|
1015
1059
|
.uiklu-bg-transparent{
|
|
1016
1060
|
background-color: transparent;
|
|
1017
1061
|
}
|
|
@@ -1038,6 +1082,11 @@ button,
|
|
|
1038
1082
|
--tw-gradient-to: rgb(251 160 34 / 0) var(--tw-gradient-to-position);
|
|
1039
1083
|
--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to);
|
|
1040
1084
|
}
|
|
1085
|
+
.uiklu-from-teal-600{
|
|
1086
|
+
--tw-gradient-from: #0d9488 var(--tw-gradient-from-position);
|
|
1087
|
+
--tw-gradient-to: rgb(13 148 136 / 0) var(--tw-gradient-to-position);
|
|
1088
|
+
--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to);
|
|
1089
|
+
}
|
|
1041
1090
|
.uiklu-via-\[\#225c4e\]{
|
|
1042
1091
|
--tw-gradient-to: rgb(34 92 78 / 0) var(--tw-gradient-to-position);
|
|
1043
1092
|
--tw-gradient-stops: var(--tw-gradient-from), #225c4e var(--tw-gradient-via-position), var(--tw-gradient-to);
|
|
@@ -1048,6 +1097,9 @@ button,
|
|
|
1048
1097
|
.uiklu-to-\[\#d9a041\]{
|
|
1049
1098
|
--tw-gradient-to: #d9a041 var(--tw-gradient-to-position);
|
|
1050
1099
|
}
|
|
1100
|
+
.uiklu-to-teal-700{
|
|
1101
|
+
--tw-gradient-to: #0f766e var(--tw-gradient-to-position);
|
|
1102
|
+
}
|
|
1051
1103
|
.uiklu-bg-cover{
|
|
1052
1104
|
background-size: cover;
|
|
1053
1105
|
}
|
|
@@ -1076,6 +1128,9 @@ button,
|
|
|
1076
1128
|
.uiklu-p-10{
|
|
1077
1129
|
padding: 2.5rem;
|
|
1078
1130
|
}
|
|
1131
|
+
.uiklu-p-2{
|
|
1132
|
+
padding: 0.5rem;
|
|
1133
|
+
}
|
|
1079
1134
|
.uiklu-p-2\.5{
|
|
1080
1135
|
padding: 0.625rem;
|
|
1081
1136
|
}
|
|
@@ -1214,6 +1269,10 @@ button,
|
|
|
1214
1269
|
font-size: 16px;
|
|
1215
1270
|
line-height: 28px;
|
|
1216
1271
|
}
|
|
1272
|
+
.uiklu-text-3xl{
|
|
1273
|
+
font-size: 18px;
|
|
1274
|
+
line-height: 28px;
|
|
1275
|
+
}
|
|
1217
1276
|
.uiklu-text-4xl{
|
|
1218
1277
|
font-size: 20px;
|
|
1219
1278
|
line-height: 22px;
|
|
@@ -1311,6 +1370,9 @@ button,
|
|
|
1311
1370
|
.uiklu-tracking-wider{
|
|
1312
1371
|
letter-spacing: 0.05em;
|
|
1313
1372
|
}
|
|
1373
|
+
.uiklu-tracking-widest{
|
|
1374
|
+
letter-spacing: 0.1em;
|
|
1375
|
+
}
|
|
1314
1376
|
.\!uiklu-text-destructive{
|
|
1315
1377
|
--tw-text-opacity: 1 !important;
|
|
1316
1378
|
color: hsl(var(--uiklu-destructive) / var(--tw-text-opacity, 1)) !important;
|
|
@@ -1375,6 +1437,14 @@ button,
|
|
|
1375
1437
|
--tw-text-opacity: 1;
|
|
1376
1438
|
color: hsl(var(--uiklu-gray-900) / var(--tw-text-opacity, 1));
|
|
1377
1439
|
}
|
|
1440
|
+
.uiklu-text-green-500{
|
|
1441
|
+
--tw-text-opacity: 1;
|
|
1442
|
+
color: rgb(34 197 94 / var(--tw-text-opacity, 1));
|
|
1443
|
+
}
|
|
1444
|
+
.uiklu-text-green-600{
|
|
1445
|
+
--tw-text-opacity: 1;
|
|
1446
|
+
color: rgb(22 163 74 / var(--tw-text-opacity, 1));
|
|
1447
|
+
}
|
|
1378
1448
|
.uiklu-text-green-700{
|
|
1379
1449
|
--tw-text-opacity: 1;
|
|
1380
1450
|
color: rgb(21 128 61 / var(--tw-text-opacity, 1));
|
|
@@ -1419,10 +1489,30 @@ button,
|
|
|
1419
1489
|
--tw-text-opacity: 1;
|
|
1420
1490
|
color: hsl(var(--uiklu-primary-900) / var(--tw-text-opacity, 1));
|
|
1421
1491
|
}
|
|
1492
|
+
.uiklu-text-red-500{
|
|
1493
|
+
--tw-text-opacity: 1;
|
|
1494
|
+
color: rgb(239 68 68 / var(--tw-text-opacity, 1));
|
|
1495
|
+
}
|
|
1496
|
+
.uiklu-text-red-600{
|
|
1497
|
+
--tw-text-opacity: 1;
|
|
1498
|
+
color: rgb(220 38 38 / var(--tw-text-opacity, 1));
|
|
1499
|
+
}
|
|
1422
1500
|
.uiklu-text-secondary{
|
|
1423
1501
|
--tw-text-opacity: 1;
|
|
1424
1502
|
color: hsl(var(--uiklu-secondary) / var(--tw-text-opacity, 1));
|
|
1425
1503
|
}
|
|
1504
|
+
.uiklu-text-teal-400{
|
|
1505
|
+
--tw-text-opacity: 1;
|
|
1506
|
+
color: rgb(45 212 191 / var(--tw-text-opacity, 1));
|
|
1507
|
+
}
|
|
1508
|
+
.uiklu-text-teal-600{
|
|
1509
|
+
--tw-text-opacity: 1;
|
|
1510
|
+
color: rgb(13 148 136 / var(--tw-text-opacity, 1));
|
|
1511
|
+
}
|
|
1512
|
+
.uiklu-text-teal-700{
|
|
1513
|
+
--tw-text-opacity: 1;
|
|
1514
|
+
color: rgb(15 118 110 / var(--tw-text-opacity, 1));
|
|
1515
|
+
}
|
|
1426
1516
|
.uiklu-text-white{
|
|
1427
1517
|
--tw-text-opacity: 1;
|
|
1428
1518
|
color: rgb(255 255 255 / var(--tw-text-opacity, 1));
|