@klu_dev/ui-klu-green 1.2.6 → 1.2.8

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 CHANGED
@@ -20,6 +20,11 @@ npm install @klu_dev/ui-klu-green
20
20
  - BalanceInfo
21
21
  - Toast
22
22
  - LoaderScreen
23
+ - PromoBanner
24
+ - SidebarTabs
25
+ - MobileMenuDrawer
26
+ - SearchSelect
27
+ - InputCode
23
28
 
24
29
  ## Antes de comenzar a agregar componentes
25
30
 
@@ -724,7 +729,6 @@ export function AppMobileLayout() {
724
729
  ```
725
730
 
726
731
 
727
- ### Props de MobileMenuDrawer
728
732
  ### Props de MobileMenuDrawer
729
733
 
730
734
  | Prop | Tipo | Descripción |
@@ -736,3 +740,84 @@ export function AppMobileLayout() {
736
740
  | `onTabChange` | `(id: string) => void` | Callback gatillado al pulsar una nueva opción del menú. Devuelve el `id`. |
737
741
 
738
742
 
743
+ ## Uso de InputCode
744
+
745
+ Componente modular de 6 celdas independientes para captura de tokens numéricos (MFA/OTP). Soporta autoenfoque secuencial inteligente, pegado (paste) masivo inteligente de cadenas numéricas enteras y control condicional de estados destructivos.
746
+
747
+
748
+ ```tsx
749
+ import { InputCode } from "@klu_dev/ui-klu-green"
750
+ import { useState } from "react"
751
+
752
+ export default function VerificationForm() {
753
+ const [hasError, setHasError] = useState(false)
754
+
755
+ const handleComplete = (code: string) => {
756
+ console.log("Código unificado enviado:", code)
757
+ if (code !== "123456") {
758
+ setHasError(true) // Pinta bordes y texto numérico en color destructivo
759
+ } else {
760
+ setHasError(false)
761
+ }
762
+ }
763
+
764
+ return (
765
+ <div className="uiklu-max-w-[400px] uiklu-mx-auto uiklu-p-6">
766
+ <InputCode hasError="{hasError}" onComplete="{handleComplete}" title="Código de seguridad SMS"/>
767
+ {hasError && (
768
+ <p className="uiklu-text-destructive uiklu-text-xs uiklu-text-center uiklu-mt-2">
769
+ Código inválido. Revisa tus dígitos e intenta de nuevo.
770
+ </p>
771
+ )}
772
+ </div>
773
+ )
774
+ }
775
+ ```
776
+
777
+ ### Props de InputCode
778
+
779
+ | Prop | Tipo | Por defecto | Descripción |
780
+ | :--- | :--- | :--- | :--- |
781
+ | `title` | `string` | `"Código de autenticación"` | Texto dinámico renderizado en la etiqueta del componente. |
782
+ | `hasError` | `boolean` | `false` | Modifica de forma síncrona el color de los bordes y el contenido numérico a la variable destructiva. |
783
+ | `onComplete` | `(code: string) => void` | - | Callback gatillado automáticamente cuando se ha rellenado la celda número 6. |
784
+
785
+ ## Uso de SearchSelect
786
+
787
+ Componente de menú desplegable de búsqueda avanzada impulsado con Radix UI Popover. Permite filtrado de texto reactivo en tiempo real con limpieza rápida integrada, slots dinámicos laterales adicionales y escala adaptativa de dimensiones.
788
+
789
+
790
+ ```tsx
791
+ import { SearchSelect } from "@klu_dev/ui-klu-green"
792
+ import { useState } from "react"
793
+
794
+ export default function BankSelector() {
795
+ const [selectedBank, setSelectedBank] = useState("")
796
+
797
+ const bancos = [
798
+ { value: "002", label: "Banamex", extra: <span className="uiklu-text-xs uiklu-opacity-50">Nacional</span> },
799
+ { value: "012", label: "BBVA Bancomer" },
800
+ { value: "014", label: "Santander", extra: <span className="uiklu-text-xs uiklu-text-primary">Popular</span> },
801
+ { value: "072", label: "Banorte" },
802
+ { value: "646", label: "KLU Banca Digital" }
803
+ ]
804
+
805
+ return (
806
+ <div className="uiklu-flex uiklu-flex-col uiklu-gap-4 uiklu-p-6">
807
+ <SearchSelect error="{false}" onChange="{setSelectedBank}" options="{bancos}" placeholder="Selecciona tu banco emisor..." size="lg" value="{selectedBank}"/>
808
+ <p className="uiklu-text-sm">ID Banco Seleccionado: <strong>{selectedBank || "Ninguno"}</strong></p>
809
+ </div>
810
+ )
811
+ }
812
+ ```
813
+
814
+ ### Props de SearchSelect
815
+ | Prop | Tipo | Por defecto | Descripción |
816
+ | :--- | :--- | :--- | :--- |
817
+ | `options` | `Option[]` | - | Listado de opciones de formato `{ value: string; label: string; extra?: ReactNode }`. |
818
+ | `value` | `string` | - | ID de la opción seleccionada. |
819
+ | `onChange` | `(value: string) => void` | - | Callback despachado al seleccionar o limpiar una opción. |
820
+ | `placeholder` | `string` | `"Buscar..."` | Texto de soporte visible cuando el campo se encuentra vacío. |
821
+ | `size` | `'sm' \| 'md' \| 'lg' \| 'full'` | `'lg'` | Determina la escala del ancho mínimo, alto de caja e interlineado tipográfico interno. |
822
+ | `error` | `boolean` | `false` | Alterna el color de la caja a la paleta destructiva y formatea el color del placeholder. |
823
+ | `disabled` | `boolean` | `false` | Inactiva por completo la interacción del gatillo y cancela el despliegue del Popover. |
package/dist/index.css CHANGED
@@ -321,6 +321,10 @@ button,
321
321
  .uiklu-mb-\[10px\]{
322
322
  margin-bottom: 10px;
323
323
 
324
+ }
325
+ .uiklu-mb-\[12px\]{
326
+ margin-bottom: 12px;
327
+
324
328
  }
325
329
  .uiklu-mb-\[18px\]{
326
330
  margin-bottom: 18px;
@@ -461,6 +465,10 @@ button,
461
465
  .uiklu-h-\[40px\]{
462
466
  height: 40px;
463
467
 
468
+ }
469
+ .uiklu-h-\[43px\]{
470
+ height: 43px;
471
+
464
472
  }
465
473
  .uiklu-h-\[44px\]{
466
474
  height: 44px;
@@ -593,6 +601,10 @@ button,
593
601
  .uiklu-w-\[383px\]{
594
602
  width: 383px;
595
603
 
604
+ }
605
+ .uiklu-w-\[39px\]{
606
+ width: 39px;
607
+
596
608
  }
597
609
  .uiklu-w-\[40px\]{
598
610
  width: 40px;
@@ -1018,6 +1030,10 @@ button,
1018
1030
  .uiklu-rounded-\[50px\]{
1019
1031
  border-radius: 50px;
1020
1032
 
1033
+ }
1034
+ .uiklu-rounded-\[8px\]{
1035
+ border-radius: 8px;
1036
+
1021
1037
  }
1022
1038
  .uiklu-rounded-full{
1023
1039
  border-radius: 9999px;
@@ -1629,6 +1645,10 @@ button,
1629
1645
  .uiklu-text-\[24px\]{
1630
1646
  font-size: 24px;
1631
1647
 
1648
+ }
1649
+ .uiklu-text-\[28px\]{
1650
+ font-size: 28px;
1651
+
1632
1652
  }
1633
1653
  .uiklu-text-\[32px\]{
1634
1654
  font-size: 32px;
@@ -1666,6 +1686,10 @@ button,
1666
1686
  line-height: 14px;
1667
1687
  font-weight: 500;
1668
1688
 
1689
+ }
1690
+ .uiklu-font-\[600\]{
1691
+ font-weight: 600;
1692
+
1669
1693
  }
1670
1694
  .uiklu-font-bold{
1671
1695
  font-weight: 700;
@@ -2176,6 +2200,12 @@ input.uiklu-flex:not(:placeholder-shown) {
2176
2200
 
2177
2201
  }
2178
2202
 
2203
+ .focus\:uiklu-border-gray800:focus{
2204
+ --tw-border-opacity: 1;
2205
+ border-color: hsl(var(--uiklu-gray-800) / var(--tw-border-opacity, 1));
2206
+
2207
+ }
2208
+
2179
2209
  .focus\:uiklu-border-primary900:focus{
2180
2210
  --tw-border-opacity: 1;
2181
2211
  border-color: hsl(var(--uiklu-primary-900) / var(--tw-border-opacity, 1));
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import { ReactNode } from 'react';
2
+ import React__default, { ReactNode } from 'react';
3
3
  import * as class_variance_authority_types from 'class-variance-authority/types';
4
4
  import { VariantProps } from 'class-variance-authority';
5
5
  import * as SelectPrimitive from '@radix-ui/react-select';
@@ -131,6 +131,15 @@ interface SidebarTabsProps {
131
131
  }
132
132
  declare function SidebarTabs({ items }: SidebarTabsProps): react_jsx_runtime.JSX.Element;
133
133
 
134
+ interface MobileMenuDrawerProps {
135
+ isOpen: boolean;
136
+ onClose: () => void;
137
+ items: NavItem[];
138
+ activeTab: string;
139
+ onTabChange: (id: string) => void;
140
+ }
141
+ declare function MobileMenuDrawer({ isOpen, onClose, items, activeTab, onTabChange }: MobileMenuDrawerProps): react_jsx_runtime.JSX.Element | null;
142
+
134
143
  declare const Icons: {
135
144
  CARD: react_jsx_runtime.JSX.Element;
136
145
  TICKET: react_jsx_runtime.JSX.Element;
@@ -159,4 +168,30 @@ declare const Icons: {
159
168
  CIRCLE_MOVEMENTS: react_jsx_runtime.JSX.Element;
160
169
  };
161
170
 
162
- export { BackButton, BalanceInfo, Button, Icons, Input, LoadingScreen, Modal, PromoBanner, Select, SidebarTabs, ToastAction, Toaster, Typography, useToast };
171
+ declare const searchSelectTriggerVariants: (props?: ({
172
+ size?: "sm" | "md" | "lg" | "full" | null | undefined;
173
+ error?: boolean | null | undefined;
174
+ } & class_variance_authority_types.ClassProp) | undefined) => string;
175
+ interface Option {
176
+ value: string;
177
+ label: string;
178
+ extra?: React.ReactNode;
179
+ }
180
+ interface SearchSelectProps extends VariantProps<typeof searchSelectTriggerVariants> {
181
+ options: Option[];
182
+ value: string;
183
+ onChange: (value: string) => void;
184
+ placeholder?: string;
185
+ disabled?: boolean;
186
+ className?: string;
187
+ }
188
+ declare const SearchSelect: ({ options, value, onChange, placeholder, size, error, disabled, className, }: SearchSelectProps) => react_jsx_runtime.JSX.Element;
189
+
190
+ interface AuthCodeProps {
191
+ onComplete?: (code: string) => void;
192
+ title?: string;
193
+ hasError?: boolean;
194
+ }
195
+ declare const InputCode: React__default.FC<AuthCodeProps>;
196
+
197
+ export { BackButton, BalanceInfo, Button, Icons, Input, InputCode, LoadingScreen, MobileMenuDrawer, Modal, PromoBanner, SearchSelect, Select, SidebarTabs, ToastAction, Toaster, Typography, useToast };
package/dist/index.js CHANGED
@@ -1402,15 +1402,350 @@ function SidebarTabs({ items }) {
1402
1402
  /* @__PURE__ */ jsx17("div", { className: "uiklu-flex-1", children: currentActiveItem?.content ? currentActiveItem.content : /* @__PURE__ */ jsx17("div", { className: "uiklu-p-8", children: /* @__PURE__ */ jsx17("h2", { children: "Pr\xF3ximamente..." }) }) })
1403
1403
  ] });
1404
1404
  }
1405
+
1406
+ // src/components/ui/sidebarTabs/mobileMenuDrawer.tsx
1407
+ import { X } from "lucide-react";
1408
+ import { jsx as jsx18, jsxs as jsxs15 } from "react/jsx-runtime";
1409
+ function MobileMenuDrawer({ isOpen, onClose, items, activeTab, onTabChange }) {
1410
+ if (!isOpen) return null;
1411
+ return /* @__PURE__ */ jsxs15(
1412
+ "div",
1413
+ {
1414
+ className: "uiklu-fixed uiklu-inset-0 uiklu-z-50 uiklu-flex uiklu-bg-white",
1415
+ style: {
1416
+ position: "fixed",
1417
+ top: 0,
1418
+ left: 0,
1419
+ right: 0,
1420
+ bottom: 0,
1421
+ zIndex: 9999,
1422
+ display: "flex",
1423
+ flexDirection: "column",
1424
+ backgroundColor: "#FFFFFF"
1425
+ },
1426
+ children: [
1427
+ /* @__PURE__ */ jsx18(
1428
+ "div",
1429
+ {
1430
+ className: "uiklu-flex uiklu-items-center uiklu-justify-end uiklu-px-6 uiklu-pb-4 uiklu-border-b uiklu-border-gray-100",
1431
+ style: {
1432
+ display: "flex",
1433
+ alignItems: "center",
1434
+ justifyContent: "flex-end",
1435
+ paddingLeft: "24px",
1436
+ paddingRight: "24px",
1437
+ paddingTop: "40px",
1438
+ paddingBottom: "16px",
1439
+ borderBottom: "1px solid #E5E7EB"
1440
+ },
1441
+ children: /* @__PURE__ */ jsx18(
1442
+ "button",
1443
+ {
1444
+ onClick: onClose,
1445
+ className: "uiklu-text-primary600 hover:uiklu-opacity-70 uiklu-transition-opacity uiklu-p-1",
1446
+ style: {
1447
+ background: "transparent",
1448
+ border: "none",
1449
+ cursor: "pointer",
1450
+ color: "#157C70"
1451
+ },
1452
+ children: /* @__PURE__ */ jsx18(X, { className: "uiklu-h-6 uiklu-w-6", style: { width: "24px", height: "24px" } })
1453
+ }
1454
+ )
1455
+ }
1456
+ ),
1457
+ /* @__PURE__ */ jsx18(
1458
+ "div",
1459
+ {
1460
+ className: "uiklu-flex-1 uiklu-overflow-y-auto uiklu-p-6 uiklu-w-full",
1461
+ style: {
1462
+ flex: 1,
1463
+ overflowY: "auto",
1464
+ padding: "24px",
1465
+ boxSizing: "border-box"
1466
+ },
1467
+ children: /* @__PURE__ */ jsx18(
1468
+ SidebarNav,
1469
+ {
1470
+ items,
1471
+ activeTab,
1472
+ onTabChange: (id) => {
1473
+ onTabChange(id);
1474
+ onClose();
1475
+ }
1476
+ }
1477
+ )
1478
+ }
1479
+ )
1480
+ ]
1481
+ }
1482
+ );
1483
+ }
1484
+
1485
+ // src/components/ui/searchSelect/searchSelect.tsx
1486
+ import * as React10 from "react";
1487
+ import * as PopoverPrimitive from "@radix-ui/react-popover";
1488
+ import { Check as Check2, ChevronDown as ChevronDown2, X as X2 } from "lucide-react";
1489
+ import { cva as cva5 } from "class-variance-authority";
1490
+ import { jsx as jsx19, jsxs as jsxs16 } from "react/jsx-runtime";
1491
+ var searchSelectTriggerVariants = cva5(
1492
+ [
1493
+ "uiklu-flex uiklu-items-center uiklu-justify-between uiklu-transition-all",
1494
+ "uiklu-rounded-[50px] uiklu-border-[1px] uiklu-border-solid uiklu-bg-background uiklu-font-sans",
1495
+ "uiklu-outline-none focus-within:uiklu-border-baseblack focus-within:uiklu-border-[1px]",
1496
+ "disabled:uiklu-cursor-not-allowed disabled:uiklu-opacity-50",
1497
+ "uiklu-leading-none"
1498
+ ],
1499
+ {
1500
+ variants: {
1501
+ size: {
1502
+ sm: "uiklu-h-[40px] uiklu-w-[150px] uiklu-min-w-[150px] uiklu-px-4 uiklu-text-sm",
1503
+ md: "uiklu-h-[40px] uiklu-w-[250px] uiklu-min-w-[250px] uiklu-px-5 uiklu-text-md",
1504
+ lg: "uiklu-h-[50px] uiklu-w-[350px] uiklu-min-w-[350px] uiklu-px-5 uiklu-text-lg",
1505
+ full: "uiklu-h-[50px] uiklu-w-full uiklu-px-5 uiklu-text-lg"
1506
+ },
1507
+ error: {
1508
+ true: "uiklu-border-destructive uiklu-text-destructive focus-within:uiklu-border-destructive",
1509
+ false: "uiklu-border-border uiklu-text-inputtext"
1510
+ }
1511
+ },
1512
+ defaultVariants: {
1513
+ size: "lg",
1514
+ error: false
1515
+ }
1516
+ }
1517
+ );
1518
+ var inputFontSizes = {
1519
+ sm: "uiklu-text-sm",
1520
+ md: "uiklu-text-md",
1521
+ lg: "uiklu-text-lg",
1522
+ full: "uiklu-text-lg"
1523
+ };
1524
+ var SearchSelect = ({
1525
+ options,
1526
+ value,
1527
+ onChange,
1528
+ placeholder = "Buscar...",
1529
+ size = "lg",
1530
+ error = false,
1531
+ disabled = false,
1532
+ className
1533
+ }) => {
1534
+ const [open, setOpen] = React10.useState(false);
1535
+ const [search, setSearch] = React10.useState("");
1536
+ const containerRef = React10.useRef(null);
1537
+ const inputRef = React10.useRef(null);
1538
+ const selectedOption = options.find((opt) => opt.value === value);
1539
+ React10.useEffect(() => {
1540
+ if (selectedOption) {
1541
+ setSearch(selectedOption.label);
1542
+ } else {
1543
+ setSearch("");
1544
+ }
1545
+ }, [selectedOption]);
1546
+ const filteredOptions = options.filter(
1547
+ (option) => option.label.toLowerCase().includes(search.toLowerCase())
1548
+ );
1549
+ const handleClear = (e) => {
1550
+ e.stopPropagation();
1551
+ onChange("");
1552
+ setSearch("");
1553
+ setOpen(true);
1554
+ inputRef.current?.focus();
1555
+ };
1556
+ return /* @__PURE__ */ jsxs16(PopoverPrimitive.Root, { open, onOpenChange: setOpen, children: [
1557
+ /* @__PURE__ */ jsx19(PopoverPrimitive.Anchor, { asChild: true, children: /* @__PURE__ */ jsxs16(
1558
+ "div",
1559
+ {
1560
+ ref: containerRef,
1561
+ className: cn(
1562
+ searchSelectTriggerVariants({ size, error, className }),
1563
+ "uiklu-cursor-text uiklu-relative",
1564
+ disabled && "uiklu-opacity-50 uiklu-pointer-events-none"
1565
+ ),
1566
+ onClick: () => {
1567
+ inputRef.current?.focus();
1568
+ setOpen(true);
1569
+ },
1570
+ children: [
1571
+ /* @__PURE__ */ jsx19(
1572
+ "input",
1573
+ {
1574
+ ref: inputRef,
1575
+ type: "text",
1576
+ className: cn(
1577
+ "uiklu-w-full uiklu-bg-transparent uiklu-outline-none uiklu-border-none uiklu-p-0",
1578
+ "uiklu-font-sans uiklu-text-gray800 placeholder:uiklu-opacity-100",
1579
+ inputFontSizes[size || "lg"],
1580
+ !error ? "placeholder:uiklu-text-gray500" : "placeholder:uiklu-text-destructive"
1581
+ ),
1582
+ placeholder,
1583
+ value: search,
1584
+ disabled,
1585
+ onFocus: () => setOpen(true),
1586
+ onClick: (e) => {
1587
+ e.stopPropagation();
1588
+ setOpen(true);
1589
+ },
1590
+ onChange: (e) => {
1591
+ setSearch(e.target.value);
1592
+ if (!open) setOpen(true);
1593
+ }
1594
+ }
1595
+ ),
1596
+ /* @__PURE__ */ jsxs16("div", { className: "uiklu-flex uiklu-items-center uiklu-ml-2 uiklu-shrink-0", children: [
1597
+ search && /* @__PURE__ */ jsx19(
1598
+ "button",
1599
+ {
1600
+ type: "button",
1601
+ onClick: handleClear,
1602
+ className: "uiklu-mr-1 uiklu-opacity-50 hover:uiklu-opacity-100 uiklu-transition-opacity\n uiklu-bg-transparent uiklu-border-none uiklu-outline-none uiklu-p-0 \n uiklu-cursor-pointer uiklu-flex uiklu-items-center uiklu-justify-center",
1603
+ children: /* @__PURE__ */ jsx19(X2, { className: "uiklu-h-4 uiklu-w-4" })
1604
+ }
1605
+ ),
1606
+ /* @__PURE__ */ jsx19(
1607
+ ChevronDown2,
1608
+ {
1609
+ className: cn(
1610
+ "uiklu-h-5 uiklu-w-5 uiklu-transition-opacity uiklu-opacity-70 uiklu-cursor-pointer",
1611
+ error ? "uiklu-text-destructive" : "uiklu-text-inputtext"
1612
+ ),
1613
+ onClick: (e) => {
1614
+ e.stopPropagation();
1615
+ setOpen((prev) => !prev);
1616
+ }
1617
+ }
1618
+ )
1619
+ ] })
1620
+ ]
1621
+ }
1622
+ ) }),
1623
+ /* @__PURE__ */ jsx19(PopoverPrimitive.Portal, { children: /* @__PURE__ */ jsx19(
1624
+ PopoverPrimitive.Content,
1625
+ {
1626
+ className: cn(
1627
+ "uiklu-relative uiklu-z-50 uiklu-overflow-hidden uiklu-rounded-[20px] uiklu-border-[1px] uiklu-border-border uiklu-bg-background uiklu-text-inputtext uiklu-font-sans uiklu-shadow-md uiklu-translate-y-1"
1628
+ ),
1629
+ style: {
1630
+ width: containerRef.current ? containerRef.current.offsetWidth : "var(--radix-popover-trigger-width)"
1631
+ },
1632
+ align: "start",
1633
+ sideOffset: 4,
1634
+ onOpenAutoFocus: (e) => e.preventDefault(),
1635
+ children: /* @__PURE__ */ jsx19("div", { className: "uiklu-py-1 uiklu-px-0 uiklu-max-h-96 uiklu-overflow-y-auto uiklu-overflow-x-hidden uiklu-w-full uiklu-box-border", children: filteredOptions.length === 0 ? /* @__PURE__ */ jsx19("div", { className: "uiklu-py-3 uiklu-px-4 uiklu-text-sm uiklu-text-center uiklu-opacity-50 uiklu-font-sans", children: "No se encontraron resultados" }) : filteredOptions.map((option) => {
1636
+ const isSelected = value === option.value;
1637
+ return /* @__PURE__ */ jsxs16(
1638
+ "div",
1639
+ {
1640
+ onClick: () => {
1641
+ onChange(option.value);
1642
+ setSearch(option.label);
1643
+ setOpen(false);
1644
+ },
1645
+ className: cn(
1646
+ "uiklu-relative uiklu-flex uiklu-w-full uiklu-box-border uiklu-cursor-pointer uiklu-select-none uiklu-items-center uiklu-py-2.5 uiklu-pl-10 uiklu-pr-4 uiklu-text-md uiklu-font-sans uiklu-outline-none hover:uiklu-bg-primary/10 hover:uiklu-text-primary uiklu-transition-colors",
1647
+ isSelected && "uiklu-bg-primary/5 uiklu-text-primary uiklu-font-medium"
1648
+ ),
1649
+ children: [
1650
+ /* @__PURE__ */ jsx19("span", { className: "uiklu-absolute uiklu-left-3 uiklu-flex uiklu-h-3.5 uiklu-w-3.5 uiklu-items-center uiklu-justify-center", children: isSelected && /* @__PURE__ */ jsx19(Check2, { className: "uiklu-h-4 uiklu-w-4 uiklu-text-primary" }) }),
1651
+ /* @__PURE__ */ jsx19("span", { className: "uiklu-flex-1 uiklu-truncate uiklu-min-w-0", children: option.label }),
1652
+ option.extra && /* @__PURE__ */ jsx19("span", { className: "uiklu-ml-2 uiklu-shrink-0 uiklu-flex uiklu-items-center", children: option.extra })
1653
+ ]
1654
+ },
1655
+ option.value
1656
+ );
1657
+ }) })
1658
+ }
1659
+ ) })
1660
+ ] });
1661
+ };
1662
+
1663
+ // src/components/ui/inputCode/inputCode.tsx
1664
+ import { useRef as useRef2, useState as useState6 } from "react";
1665
+ import { jsx as jsx20, jsxs as jsxs17 } from "react/jsx-runtime";
1666
+ var InputCode = ({
1667
+ onComplete,
1668
+ title = "C\xF3digo de autenticaci\xF3n",
1669
+ hasError = false
1670
+ }) => {
1671
+ const [code, setCode] = useState6(Array(6).fill(""));
1672
+ const inputsRef = useRef2([]);
1673
+ const handleChange = (e, index) => {
1674
+ const value = e.target.value;
1675
+ if (isNaN(Number(value))) return;
1676
+ const newCode = [...code];
1677
+ newCode[index] = value.substring(value.length - 1);
1678
+ setCode(newCode);
1679
+ const fullCode = newCode.join("");
1680
+ if (fullCode.length === 6 && onComplete) {
1681
+ onComplete(fullCode);
1682
+ }
1683
+ if (value && index < 5) {
1684
+ inputsRef.current[index + 1]?.focus();
1685
+ }
1686
+ };
1687
+ const handleKeyDown = (e, index) => {
1688
+ if (e.key === "Backspace" && !code[index] && index > 0) {
1689
+ inputsRef.current[index - 1]?.focus();
1690
+ }
1691
+ };
1692
+ const handlePaste = (e) => {
1693
+ e.preventDefault();
1694
+ const pastedData = e.clipboardData.getData("text").trim();
1695
+ if (!/^\d+$/.test(pastedData)) return;
1696
+ const pastedCode = pastedData.slice(0, 6).split("");
1697
+ const newCode = [...code];
1698
+ pastedCode.forEach((char, index) => {
1699
+ if (index < 6) newCode[index] = char;
1700
+ });
1701
+ setCode(newCode);
1702
+ const focusIndex = Math.min(pastedCode.length, 5);
1703
+ inputsRef.current[focusIndex]?.focus();
1704
+ const fullCode = newCode.join("");
1705
+ if (fullCode.length === 6 && onComplete) {
1706
+ onComplete(fullCode);
1707
+ }
1708
+ };
1709
+ return /* @__PURE__ */ jsxs17("div", { className: "uiklu-flex uiklu-flex-col uiklu-items-center \n uiklu-justify-center uiklu-font-sans uiklu-w-full", children: [
1710
+ /* @__PURE__ */ jsx20("label", { className: "uiklu-text-[14px] uiklu-text-gray600 uiklu-font-normal\n uiklu-block uiklu-mb-[12px]", children: title }),
1711
+ /* @__PURE__ */ jsx20("div", { className: "uiklu-flex uiklu-justify-center uiklu-gap-[14px] uiklu-w-full", children: code.map((digit, index) => /* @__PURE__ */ jsx20(
1712
+ "input",
1713
+ {
1714
+ ref: (el) => {
1715
+ if (el) inputsRef.current[index] = el;
1716
+ },
1717
+ type: "text",
1718
+ inputMode: "numeric",
1719
+ pattern: "[0-9]*",
1720
+ maxLength: 1,
1721
+ value: digit,
1722
+ onChange: (e) => handleChange(e, index),
1723
+ onKeyDown: (e) => handleKeyDown(e, index),
1724
+ onPaste: index === 0 ? handlePaste : void 0,
1725
+ className: `uiklu-w-[39px] uiklu-h-[43px]
1726
+ uiklu-flex-shrink-0 uiklu-box-border uiklu-text-center
1727
+ uiklu-text-[28px] uiklu-font-sans uiklu-font-[600]
1728
+ uiklu-border-[1px] uiklu-border-solid
1729
+ uiklu-rounded-[8px] uiklu-transition-colors uiklu-text-ellipsis
1730
+ focus:uiklu-outline-none
1731
+ ${hasError ? "uiklu-border-destructive uiklu-text-destructive focus:uiklu-border-destructive" : "uiklu-border-inputlight uiklu-text-gray800 focus:uiklu-border-gray800"}`
1732
+ },
1733
+ index
1734
+ )) })
1735
+ ] });
1736
+ };
1405
1737
  export {
1406
1738
  BackButton,
1407
1739
  BalanceInfo,
1408
1740
  Button,
1409
1741
  Icons,
1410
1742
  Input,
1743
+ InputCode,
1411
1744
  LoadingScreen,
1745
+ MobileMenuDrawer,
1412
1746
  Modal,
1413
1747
  PromoBanner,
1748
+ SearchSelect,
1414
1749
  Select,
1415
1750
  SidebarTabs,
1416
1751
  ToastAction,