@klu_dev/ui-klu-green 1.2.9 → 1.2.11

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
@@ -27,6 +27,7 @@ npm install @klu_dev/ui-klu-green
27
27
  - InputCode
28
28
  - GridCard
29
29
  - CheckBox
30
+ - InputPhone
30
31
 
31
32
  ## Antes de comenzar a agregar componentes
32
33
 
@@ -897,3 +898,68 @@ export default function CheckboxExample() {
897
898
  | `checked` | `boolean` | - | Estado binario síncrono en modo controlado. |
898
899
  | `onChange` | `(checked: boolean) => void` | - | Callback gatillado automáticamente al alterar la interacción del recuadro. |
899
900
 
901
+
902
+
903
+ ## Uso de InputPhone
904
+ El componente InputPhone es un campo de entrada de texto optimizado para la captura de números telefónicos. Permite la selección dinámica de prefijos internacionales (LADAS/códigos de país) mediante un menú desplegable integrado y ofrece soporte nativo para la validación y visualización de estados de error, variantes de tamaño y un comportamiento adaptables (full width).
905
+
906
+ ```tsx
907
+ import React, { useState } from 'react';
908
+ import { InputPhone } from './components/InputPhone';
909
+
910
+ const RegistrationForm = () => {
911
+ const [phoneNumber, setPhoneNumber] = useState('');
912
+ const [error, setError] = useState('');
913
+
914
+ const paisesLadas = [
915
+ { label: 'MX', code: '+52' },
916
+ { label: 'US', code: '+1' },
917
+ { label: 'ES', code: '+34' },
918
+ { label: 'AR', code: '+54' },
919
+ { label: 'CO', code: '+57' },
920
+ { label: 'CL', code: '+56' },
921
+ { label: 'PE', code: '+51' },
922
+ ];
923
+
924
+ const handlePhoneChange = (value: string) => {
925
+ setPhoneNumber(value);
926
+ // Validación simple de longitud sin espacios
927
+ const pureNumbers = value.replace(/\s/g, '');
928
+ if (pureNumbers.length > 0 && pureNumbers.length < 10) {
929
+ setError('El número telefónico debe tener al menos 10 dígitos.');
930
+ } else {
931
+ setError('');
932
+ }
933
+ };
934
+
935
+ return (
936
+ <div style={{ maxWidth: '400px', padding: '20px' }}>
937
+ <label htmlFor="phone">Número de Teléfono</label>
938
+ <InputPhone
939
+ id="phone"
940
+ size="full"
941
+ placeholder="55 0000 0000"
942
+ value={phoneNumber}
943
+ onChange={handlePhoneChange}
944
+ error={error}
945
+ ladas={paisesLadas}
946
+ defaultLadaIndex={0} // Selecciona MX por defecto
947
+ />
948
+ </div>
949
+ );
950
+ };
951
+
952
+ export default RegistrationForm;
953
+ ```
954
+
955
+ ### Props de InputPhone
956
+
957
+ | Prop | Tipo | Por Defecto | Descripción |
958
+ | :--- | :--- | :--- | :--- |
959
+ | `size` | `'sm' \| 'md' \| 'lg' \| 'full'` | `'lg'` | Define las dimensiones del componente. `full` expande el input al 100% del ancho del contenedor. |
960
+ | `placeholder` | `string` | *Opcional* | Texto de ayuda que se muestra cuando el input está vacío. |
961
+ | `value` | `string` | *Opcional* | El valor actual del campo de texto (para componentes controlados). |
962
+ | `onChange` | `(value: string) => void` | *Opcional* | Función callback que se ejecuta cada vez que el usuario escribe o modifica el valor. |
963
+ | `error` | `string` | *Opcional* | Mensaje de error. Si se proporciona, el componente cambia visualmente a un estado de error y despliega el texto. |
964
+ | `ladas` | `Array<{ label: string; code: string }>` | *Opcional* | Listado de códigos telefónicos de país para el menú desplegable. |
965
+ | `defaultLadaIndex` | `number` | *Opcional* | Índice del arreglo de `ladas` que se seleccionará de manera inicial por defecto. |
package/dist/index.css CHANGED
@@ -287,6 +287,11 @@ button,
287
287
  .uiklu-m-0{
288
288
  margin: 0px;
289
289
 
290
+ }
291
+ .uiklu-mx-2{
292
+ margin-left: 0.5rem;
293
+ margin-right: 0.5rem;
294
+
290
295
  }
291
296
  .uiklu-mx-auto{
292
297
  margin-left: auto;
@@ -521,6 +526,10 @@ button,
521
526
  .uiklu-max-h-96{
522
527
  max-height: 24rem;
523
528
 
529
+ }
530
+ .uiklu-max-h-\[150px\]{
531
+ max-height: 150px;
532
+
524
533
  }
525
534
  .uiklu-max-h-\[40px\]{
526
535
  max-height: 40px;
@@ -621,6 +630,10 @@ button,
621
630
  .uiklu-w-\[39px\]{
622
631
  width: 39px;
623
632
 
633
+ }
634
+ .uiklu-w-\[400px\]{
635
+ width: 400px;
636
+
624
637
  }
625
638
  .uiklu-w-\[40px\]{
626
639
  width: 40px;
@@ -926,6 +939,10 @@ button,
926
939
  .uiklu-gap-\[20px\]{
927
940
  gap: 20px;
928
941
 
942
+ }
943
+ .uiklu-gap-\[2px\]{
944
+ gap: 2px;
945
+
929
946
  }
930
947
  .uiklu-gap-x-1\.5{
931
948
  -moz-column-gap: 0.375rem;
@@ -1598,6 +1615,10 @@ button,
1598
1615
  .uiklu-pb-\[20px\]{
1599
1616
  padding-bottom: 20px;
1600
1617
 
1618
+ }
1619
+ .uiklu-pl-1{
1620
+ padding-left: 0.25rem;
1621
+
1601
1622
  }
1602
1623
  .uiklu-pl-10{
1603
1624
  padding-left: 2.5rem;
@@ -1606,6 +1627,10 @@ button,
1606
1627
  .uiklu-pl-3{
1607
1628
  padding-left: 0.75rem;
1608
1629
 
1630
+ }
1631
+ .uiklu-pl-6{
1632
+ padding-left: 1.5rem;
1633
+
1609
1634
  }
1610
1635
  .uiklu-pr-14{
1611
1636
  padding-right: 3.5rem;
@@ -1618,10 +1643,18 @@ button,
1618
1643
  .uiklu-pr-4{
1619
1644
  padding-right: 1rem;
1620
1645
 
1646
+ }
1647
+ .uiklu-pr-6{
1648
+ padding-right: 1.5rem;
1649
+
1621
1650
  }
1622
1651
  .uiklu-pt-4{
1623
1652
  padding-top: 1rem;
1624
1653
 
1654
+ }
1655
+ .uiklu-pt-\[10px\]{
1656
+ padding-top: 10px;
1657
+
1625
1658
  }
1626
1659
  .uiklu-pt-\[20px\]{
1627
1660
  padding-top: 20px;
@@ -2187,6 +2220,26 @@ input.uiklu-flex:not(:placeholder-shown) {
2187
2220
 
2188
2221
  }
2189
2222
 
2223
+ .focus-within\:uiklu-border-primary900:focus-within{
2224
+ --tw-border-opacity: 1;
2225
+ border-color: hsl(var(--uiklu-primary-900) / var(--tw-border-opacity, 1));
2226
+
2227
+ }
2228
+
2229
+ .focus-within\:uiklu-shadow-\[0_0_0_3px_\#AFD8D8\]:focus-within{
2230
+ --tw-shadow: 0 0 0 3px #AFD8D8;
2231
+ --tw-shadow-colored: 0 0 0 3px var(--tw-shadow-color);
2232
+ box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);
2233
+
2234
+ }
2235
+
2236
+ .focus-within\:uiklu-shadow-\[0_0_0_3px_rgba\(220\2c 38\2c 38\2c 0\.20\)\]:focus-within{
2237
+ --tw-shadow: 0 0 0 3px rgba(220,38,38,0.20);
2238
+ --tw-shadow-colored: 0 0 0 3px var(--tw-shadow-color);
2239
+ box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);
2240
+
2241
+ }
2242
+
2190
2243
  .hover\:uiklu-bg-gray-100:hover{
2191
2244
  --tw-bg-opacity: 1;
2192
2245
  background-color: rgb(243 244 246 / var(--tw-bg-opacity, 1));
@@ -2219,6 +2272,11 @@ input.uiklu-flex:not(:placeholder-shown) {
2219
2272
 
2220
2273
  }
2221
2274
 
2275
+ .hover\:uiklu-bg-primary500\/90:hover{
2276
+ background-color: hsl(var(--uiklu-primary-500) / 0.9);
2277
+
2278
+ }
2279
+
2222
2280
  .hover\:uiklu-bg-primary900\/5:hover{
2223
2281
  background-color: hsl(var(--uiklu-primary-900) / 0.05);
2224
2282
 
package/dist/index.d.ts CHANGED
@@ -16,7 +16,7 @@ interface InputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, "
16
16
  declare const Input: React.ForwardRefExoticComponent<InputProps & React.RefAttributes<HTMLInputElement>>;
17
17
 
18
18
  declare const buttonVariants: (props?: ({
19
- variant?: "primary" | "primaryOrange" | "secondary" | "outline" | "outlinePrimary" | "outlineSecondary" | "outlineWhite" | "iconCircle" | null | undefined;
19
+ variant?: "primary" | "primaryOrange" | "secondary" | "outline" | "outlinePrimary" | "outlineSecondary" | "outlineWhite" | "iconCircle" | "filterCircle" | null | undefined;
20
20
  size?: "sm" | "md" | "lg" | "full" | "xl" | "fullh" | "iconOnly" | null | undefined;
21
21
  } & class_variance_authority_types.ClassProp) | undefined) => string;
22
22
  interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof buttonVariants> {
@@ -172,6 +172,7 @@ declare const Icons: {
172
172
  SIGN: react_jsx_runtime.JSX.Element;
173
173
  GAMES: react_jsx_runtime.JSX.Element;
174
174
  CHECKED: react_jsx_runtime.JSX.Element;
175
+ FILTER: react_jsx_runtime.JSX.Element;
175
176
  };
176
177
 
177
178
  declare const searchSelectTriggerVariants: (props?: ({
package/dist/index.js CHANGED
@@ -210,6 +210,14 @@ var buttonVariants = cva(
210
210
  uiklu-rounded-full
211
211
  uiklu-border-transparent
212
212
  uiklu-p-0
213
+ `,
214
+ filterCircle: `
215
+ uiklu-bg-primary500
216
+ uiklu-text-white
217
+ hover:uiklu-bg-primary500/90
218
+ uiklu-rounded-full
219
+ uiklu-border-transparent
220
+ uiklu-p-0
213
221
  `
214
222
  },
215
223
  size: {
@@ -231,7 +239,7 @@ var buttonVariants = cva(
231
239
  var Button = React2.forwardRef(
232
240
  ({ className, variant, size, asChild = false, icon, iconAlign = "left", children, style, ...props }, ref) => {
233
241
  const Comp = asChild ? Slot : "button";
234
- const isIconCircle = variant === "iconCircle";
242
+ const isIconCircle = variant === "iconCircle" || variant === "filterCircle";
235
243
  return /* @__PURE__ */ jsxs2(
236
244
  Comp,
237
245
  {
@@ -857,6 +865,26 @@ var CHECKED = ({ className }) => /* @__PURE__ */ jsx7(
857
865
  )
858
866
  }
859
867
  );
868
+ var FILTER = ({ className }) => /* @__PURE__ */ jsx7(
869
+ "svg",
870
+ {
871
+ xmlns: "http://www.w3.org/2000/svg",
872
+ width: "18",
873
+ height: "16",
874
+ viewBox: "0 0 18 16",
875
+ fill: "none",
876
+ className,
877
+ style: {
878
+ display: "flex",
879
+ width: "18px",
880
+ height: "16px",
881
+ justifyContent: "center",
882
+ alignItems: "center",
883
+ aspectRatio: "1/1"
884
+ },
885
+ children: /* @__PURE__ */ jsx7("path", { d: "M0.75 3.75588H3.84375C4.00898 4.40119 4.38428 4.97316 \n 4.91048 5.38161C5.43669 5.79006 6.08387 6.01176 6.75 6.01176C7.41613 \n 6.01176 8.06331 5.79006 8.58952 5.38161C9.11572 4.97316 9.49102 \n 4.40119 9.65625 3.75588H17.25C17.4489 3.75588 17.6397 3.67686 17.7803 \n 3.53621C17.921 3.39556 18 3.20479 18 3.00588C18 2.80697 17.921 2.6162 \n 17.7803 2.47555C17.6397 2.3349 17.4489 2.25588 17.25 \n 2.25588H9.65625C9.49102 1.61057 9.11572 1.0386 8.58952 \n 0.630153C8.06331 0.221702 7.41613 0 6.75 0C6.08387 0 5.43669 0.221702 \n 4.91048 0.630153C4.38428 1.0386 4.00898 1.61057 3.84375 \n 2.25588H0.75C0.551088 2.25588 0.360322 2.3349 0.21967 \n 2.47555C0.0790178 2.6162 0 2.80697 0 3.00588C0 3.20479 0.0790178 \n 3.39556 0.21967 3.53621C0.360322 3.67686 0.551088 3.75588 0.75 \n 3.75588ZM6.75 1.50588C7.04667 1.50588 7.33668 1.59386 7.58335 \n 1.75868C7.83003 1.9235 8.02229 2.15777 8.13582 2.43186C8.24935 \n 2.70595 8.27906 3.00755 8.22118 3.29852C8.1633 3.58949 8.02044 \n 3.85676 7.81066 4.06654C7.60088 4.27632 7.33361 4.41918 7.04264 \n 4.47706C6.75166 4.53494 6.45006 4.50523 6.17597 4.3917C5.90189 \n 4.27817 5.66762 4.08591 5.5028 3.83924C5.33797 3.59256 5.25 \n 3.30255 5.25 3.00588C5.25 2.60806 5.40804 2.22653 5.68934 \n 1.94522C5.97064 1.66392 6.35218 1.50588 6.75 1.50588ZM17.25 \n 11.2559H15.6562C15.491 10.6106 15.1157 10.0386 14.5895 \n 9.63015C14.0633 9.2217 13.4161 9 12.75 9C12.0839 9 11.4367 9.2217 \n 10.9105 9.63015C10.3843 10.0386 10.009 10.6106 9.84375 \n 11.2559H0.75C0.551088 11.2559 0.360322 11.3349 0.21967 11.4756C0.0790178 \n 11.6162 0 11.807 0 12.0059C0 12.2048 0.0790178 12.3956 0.21967 \n 12.5362C0.360322 12.6769 0.551088 12.7559 0.75 12.7559H9.84375C10.009 \n 13.4012 10.3843 13.9732 10.9105 14.3816C11.4367 14.7901 12.0839 15.0118 \n 12.75 15.0118C13.4161 15.0118 14.0633 14.7901 14.5895 14.3816C15.1157 \n 13.9732 15.491 13.4012 15.6562 12.7559H17.25C17.4489 12.7559 17.6397 \n 12.6769 17.7803 12.5362C17.921 12.3956 18 12.2048 18 12.0059C18 11.807 \n 17.921 11.6162 17.7803 11.4756C17.6397 11.3349 17.4489 11.2559 17.25 \n 11.2559ZM12.75 13.5059C12.4533 13.5059 12.1633 13.4179 11.9166 \n 13.2531C11.67 13.0883 11.4777 12.854 11.3642 12.5799C11.2506 12.3058 \n 11.2209 12.0042 11.2788 11.7132C11.3367 11.4223 11.4796 11.155 11.6893 \n 10.9452C11.8991 10.7354 12.1664 10.5926 12.4574 10.5347C12.7483 10.4768 \n 13.0499 10.5065 13.324 10.6201C13.5981 10.7336 13.8324 10.9259 13.9972 \n 11.1725C14.162 11.4192 14.25 11.7092 14.25 12.0059C14.25 12.4037 \n 14.092 12.7852 13.8107 13.0665C13.5294 13.3478 13.1478 13.5059 12.75 \n 13.5059Z", fill: "white" })
886
+ }
887
+ );
860
888
  var Icons = {
861
889
  CARD: /* @__PURE__ */ jsx7(CardIcon, {}),
862
890
  TICKET: /* @__PURE__ */ jsx7(TicketIcon, {}),
@@ -888,7 +916,8 @@ var Icons = {
888
916
  HOMESERVICE: /* @__PURE__ */ jsx7(Home, {}),
889
917
  SIGN: /* @__PURE__ */ jsx7(SIGN, {}),
890
918
  GAMES: /* @__PURE__ */ jsx7(GAMES, {}),
891
- CHECKED: /* @__PURE__ */ jsx7(CHECKED, {})
919
+ CHECKED: /* @__PURE__ */ jsx7(CHECKED, {}),
920
+ FILTER: /* @__PURE__ */ jsx7(FILTER, {})
892
921
  };
893
922
 
894
923
  // src/components/ui/modal/modal.tsx
@@ -1451,12 +1480,30 @@ function PromoBanner({
1451
1480
  }
1452
1481
 
1453
1482
  // src/components/ui/sidebarTabs/sidebarTabs.tsx
1454
- import { useState as useState4 } from "react";
1483
+ import { useState as useState5 } from "react";
1455
1484
 
1456
1485
  // src/components/ui/sidebarTabs/siderTab.tsx
1457
1486
  import * as React9 from "react";
1458
1487
  import { jsx as jsx16, jsxs as jsxs13 } from "react/jsx-runtime";
1459
- function SidebarNav({ items, activeTab, onTabChange }) {
1488
+ function SidebarNav({
1489
+ items,
1490
+ activeTab: controlledActiveTab,
1491
+ onTabChange,
1492
+ defaultActiveTab
1493
+ }) {
1494
+ const [internalActiveTab, setInternalActiveTab] = React9.useState(
1495
+ defaultActiveTab || items[0]?.id || ""
1496
+ );
1497
+ const isControlled = controlledActiveTab !== void 0;
1498
+ const activeTab = isControlled ? controlledActiveTab : internalActiveTab;
1499
+ const handleTabClick = (id) => {
1500
+ if (!isControlled) {
1501
+ setInternalActiveTab(id);
1502
+ }
1503
+ if (onTabChange) {
1504
+ onTabChange(id);
1505
+ }
1506
+ };
1460
1507
  return /* @__PURE__ */ jsx16("nav", { className: "uiklu-flex uiklu-flex-col uiklu-gap-1 uiklu-w-full", children: items.map((item) => {
1461
1508
  const isActive = activeTab === item.id;
1462
1509
  const Icon2 = item.icon;
@@ -1465,7 +1512,7 @@ function SidebarNav({ items, activeTab, onTabChange }) {
1465
1512
  /* @__PURE__ */ jsxs13(
1466
1513
  "button",
1467
1514
  {
1468
- onClick: () => onTabChange(item.id),
1515
+ onClick: () => handleTabClick(item.id),
1469
1516
  className: cn(
1470
1517
  "uiklu-group uiklu-flex uiklu-items-center",
1471
1518
  "uiklu-py-3 uiklu-rounded-full",
@@ -1486,8 +1533,7 @@ function SidebarNav({ items, activeTab, onTabChange }) {
1486
1533
  className: cn(
1487
1534
  "uiklu-text-[10px] uiklu-font-semibold uiklu-uppercase uiklu-ml-[6px]",
1488
1535
  "uiklu-text-left uiklu-flex-1 uiklu-block",
1489
- isActive ? "uiklu-opacity-100 uiklu-truncate" : "uiklu-opacity-80",
1490
- isActive ? "" : "uiklu-whitespace-normal"
1536
+ isActive ? "uiklu-opacity-100 uiklu-truncate" : "uiklu-opacity-80"
1491
1537
  ),
1492
1538
  style: {
1493
1539
  fontSize: "10px",
@@ -1520,7 +1566,7 @@ function SidebarNav({ items, activeTab, onTabChange }) {
1520
1566
  // src/components/ui/sidebarTabs/sidebarTabs.tsx
1521
1567
  import { jsx as jsx17, jsxs as jsxs14 } from "react/jsx-runtime";
1522
1568
  function SidebarTabs({ items }) {
1523
- const [activeTab, setActiveTab] = useState4(items[0]?.id || "");
1569
+ const [activeTab, setActiveTab] = useState5(items[0]?.id || "");
1524
1570
  const currentActiveItem = items.find((item) => item.id === activeTab);
1525
1571
  return /* @__PURE__ */ jsxs14("div", { className: "uiklu-flex uiklu-w-full uiklu-h-screen uiklu-bg-white", children: [
1526
1572
  /* @__PURE__ */ jsx17("div", { className: "uiklu-w-[162px] uiklu-h-[40px] uiklu-p-4 ", children: /* @__PURE__ */ jsx17(
@@ -1793,14 +1839,14 @@ var SearchSelect = ({
1793
1839
  };
1794
1840
 
1795
1841
  // src/components/ui/inputCode/inputCode.tsx
1796
- import { useRef as useRef2, useState as useState6 } from "react";
1842
+ import { useRef as useRef2, useState as useState7 } from "react";
1797
1843
  import { jsx as jsx20, jsxs as jsxs17 } from "react/jsx-runtime";
1798
1844
  var InputCode = ({
1799
1845
  onComplete,
1800
1846
  title = "C\xF3digo de autenticaci\xF3n",
1801
1847
  hasError = false
1802
1848
  }) => {
1803
- const [code, setCode] = useState6(Array(6).fill(""));
1849
+ const [code, setCode] = useState7(Array(6).fill(""));
1804
1850
  const inputsRef = useRef2([]);
1805
1851
  const handleChange = (e, index) => {
1806
1852
  const value = e.target.value;
@@ -1901,7 +1947,7 @@ var GridCard = ({
1901
1947
  };
1902
1948
 
1903
1949
  // src/components/ui/checkBox/checkBox.tsx
1904
- import { useId, useState as useState7 } from "react";
1950
+ import { useId, useState as useState8 } from "react";
1905
1951
  import { jsx as jsx22, jsxs as jsxs19 } from "react/jsx-runtime";
1906
1952
  var Checkbox = ({
1907
1953
  id,
@@ -1913,7 +1959,7 @@ var Checkbox = ({
1913
1959
  }) => {
1914
1960
  const uniqueId = id || useId();
1915
1961
  const isControlled = controlledChecked !== void 0;
1916
- const [internalChecked, setInternalChecked] = useState7(defaultChecked || false);
1962
+ const [internalChecked, setInternalChecked] = useState8(defaultChecked || false);
1917
1963
  const isChecked = isControlled ? controlledChecked : internalChecked;
1918
1964
  const handleCheckboxChange = (e) => {
1919
1965
  const nextChecked = e.target.checked;