@klu_dev/ui-klu-green 1.2.10 → 1.2.12

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,8 @@ npm install @klu_dev/ui-klu-green
27
27
  - InputCode
28
28
  - GridCard
29
29
  - CheckBox
30
+ - InputPhone
31
+ - IconBadge
30
32
 
31
33
  ## Antes de comenzar a agregar componentes
32
34
 
@@ -897,3 +899,103 @@ export default function CheckboxExample() {
897
899
  | `checked` | `boolean` | - | Estado binario síncrono en modo controlado. |
898
900
  | `onChange` | `(checked: boolean) => void` | - | Callback gatillado automáticamente al alterar la interacción del recuadro. |
899
901
 
902
+
903
+
904
+ ## Uso de InputPhone
905
+ 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).
906
+
907
+ ```tsx
908
+ import React, { useState } from 'react';
909
+ import { InputPhone } from './components/InputPhone';
910
+
911
+ const RegistrationForm = () => {
912
+ const [phoneNumber, setPhoneNumber] = useState('');
913
+ const [error, setError] = useState('');
914
+
915
+ const paisesLadas = [
916
+ { label: 'MX', code: '+52' },
917
+ { label: 'US', code: '+1' },
918
+ { label: 'ES', code: '+34' },
919
+ { label: 'AR', code: '+54' },
920
+ { label: 'CO', code: '+57' },
921
+ { label: 'CL', code: '+56' },
922
+ { label: 'PE', code: '+51' },
923
+ ];
924
+
925
+ const handlePhoneChange = (value: string) => {
926
+ setPhoneNumber(value);
927
+ // Validación simple de longitud sin espacios
928
+ const pureNumbers = value.replace(/\s/g, '');
929
+ if (pureNumbers.length > 0 && pureNumbers.length < 10) {
930
+ setError('El número telefónico debe tener al menos 10 dígitos.');
931
+ } else {
932
+ setError('');
933
+ }
934
+ };
935
+
936
+ return (
937
+ <div style={{ maxWidth: '400px', padding: '20px' }}>
938
+ <label htmlFor="phone">Número de Teléfono</label>
939
+ <InputPhone
940
+ id="phone"
941
+ size="full"
942
+ placeholder="55 0000 0000"
943
+ value={phoneNumber}
944
+ onChange={handlePhoneChange}
945
+ error={error}
946
+ ladas={paisesLadas}
947
+ defaultLadaIndex={0} // Selecciona MX por defecto
948
+ />
949
+ </div>
950
+ );
951
+ };
952
+
953
+ export default RegistrationForm;
954
+ ```
955
+
956
+ ### Props de InputPhone
957
+
958
+ | Prop | Tipo | Por Defecto | Descripción |
959
+ | :--- | :--- | :--- | :--- |
960
+ | `size` | `'sm' \| 'md' \| 'lg' \| 'full'` | `'lg'` | Define las dimensiones del componente. `full` expande el input al 100% del ancho del contenedor. |
961
+ | `placeholder` | `string` | *Opcional* | Texto de ayuda que se muestra cuando el input está vacío. |
962
+ | `value` | `string` | *Opcional* | El valor actual del campo de texto (para componentes controlados). |
963
+ | `onChange` | `(value: string) => void` | *Opcional* | Función callback que se ejecuta cada vez que el usuario escribe o modifica el valor. |
964
+ | `error` | `string` | *Opcional* | Mensaje de error. Si se proporciona, el componente cambia visualmente a un estado de error y despliega el texto. |
965
+ | `ladas` | `Array<{ label: string; code: string }>` | *Opcional* | Listado de códigos telefónicos de país para el menú desplegable. |
966
+ | `defaultLadaIndex` | `number` | *Opcional* | Índice del arreglo de `ladas` que se seleccionará de manera inicial por defecto. |
967
+
968
+
969
+ ## Uso de IconBadge
970
+ El componente IconBadge es un contenedor circular optimizado para destacar iconografía de la interfaz o elementos de marca. Permite envolver dinámicamente cualquier elemento SVG/icono pasándole un elemento JSX instanciado, centralizando el control de colores corporativos (`uiklu-bg-primary300` y `uiklu-text-basewhite`) junto con un centrado de precisión matemática mediante Flexbox en variantes fijas de tamaño.
971
+
972
+ ```tsx
973
+ import React from 'react';
974
+ import { IconBadge } from './components/IconBadge';
975
+ import { Icons } from '../../assets/icons';
976
+
977
+ const BadgeContainer = () => {
978
+ return (
979
+ <div className="uiklu-flex uiklu-gap-4 uiklu-p-4">
980
+ <IconBadge
981
+ size="md"
982
+ icon={Icons.SEAL}
983
+ />
984
+
985
+ <IconBadge
986
+ size="lg"
987
+ icon={Icons.BOOKMARK}
988
+ />
989
+ </div>
990
+ );
991
+ };
992
+
993
+ export default BadgeContainer;
994
+ ```
995
+
996
+ ### Props de IconBadge
997
+
998
+ | Prop | Tipo | Por Defecto | Descripción |
999
+ | :--- | :--- | :--- | :--- |
1000
+ | `icon` | `React.ReactElement<{ className?: string }>` | *Requerido* | El elemento del icono a renderizar en formato JSX (ej: `<Icons.SEAL />`). Recibe de forma transparente las utilidades de tamaño asignadas por el contenedor. |
1001
+ | `size` | `'sm' \| 'md' \| 'lg'` | `'sm'` | Define las dimensiones fijas en píxeles tanto del contenedor circular como del icono interior (`sm`: 24px/14px, `md`: 30px/20px, `lg`: 36px/26px). |
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;
@@ -457,6 +462,10 @@ button,
457
462
  .uiklu-h-\[100px\]{
458
463
  height: 100px;
459
464
 
465
+ }
466
+ .uiklu-h-\[14px\]{
467
+ height: 14px;
468
+
460
469
  }
461
470
  .uiklu-h-\[1px\]{
462
471
  height: 1px;
@@ -469,10 +478,22 @@ button,
469
478
  .uiklu-h-\[24px\]{
470
479
  height: 24px;
471
480
 
481
+ }
482
+ .uiklu-h-\[26px\]{
483
+ height: 26px;
484
+
485
+ }
486
+ .uiklu-h-\[30px\]{
487
+ height: 30px;
488
+
472
489
  }
473
490
  .uiklu-h-\[34px\]{
474
491
  height: 34px;
475
492
 
493
+ }
494
+ .uiklu-h-\[36px\]{
495
+ height: 36px;
496
+
476
497
  }
477
498
  .uiklu-h-\[40px\]{
478
499
  height: 40px;
@@ -522,8 +543,8 @@ button,
522
543
  max-height: 24rem;
523
544
 
524
545
  }
525
- .uiklu-max-h-\[200px\]{
526
- max-height: 200px;
546
+ .uiklu-max-h-\[150px\]{
547
+ max-height: 150px;
527
548
 
528
549
  }
529
550
  .uiklu-max-h-\[40px\]{
@@ -581,14 +602,14 @@ button,
581
602
  .uiklu-w-8{
582
603
  width: 2rem;
583
604
 
584
- }
585
- .uiklu-w-\[120px\]{
586
- width: 120px;
587
-
588
605
  }
589
606
  .uiklu-w-\[141px\]{
590
607
  width: 141px;
591
608
 
609
+ }
610
+ .uiklu-w-\[14px\]{
611
+ width: 14px;
612
+
592
613
  }
593
614
  .uiklu-w-\[150px\]{
594
615
  width: 150px;
@@ -609,10 +630,22 @@ button,
609
630
  .uiklu-w-\[20px\]{
610
631
  width: 20px;
611
632
 
633
+ }
634
+ .uiklu-w-\[24px\]{
635
+ width: 24px;
636
+
612
637
  }
613
638
  .uiklu-w-\[250px\]{
614
639
  width: 250px;
615
640
 
641
+ }
642
+ .uiklu-w-\[26px\]{
643
+ width: 26px;
644
+
645
+ }
646
+ .uiklu-w-\[30px\]{
647
+ width: 30px;
648
+
616
649
  }
617
650
  .uiklu-w-\[317px\]{
618
651
  width: 317px;
@@ -621,6 +654,10 @@ button,
621
654
  .uiklu-w-\[350px\]{
622
655
  width: 350px;
623
656
 
657
+ }
658
+ .uiklu-w-\[36px\]{
659
+ width: 36px;
660
+
624
661
  }
625
662
  .uiklu-w-\[383px\]{
626
663
  width: 383px;
@@ -938,6 +975,10 @@ button,
938
975
  .uiklu-gap-\[20px\]{
939
976
  gap: 20px;
940
977
 
978
+ }
979
+ .uiklu-gap-\[2px\]{
980
+ gap: 2px;
981
+
941
982
  }
942
983
  .uiklu-gap-x-1\.5{
943
984
  -moz-column-gap: 0.375rem;
@@ -1646,6 +1687,10 @@ button,
1646
1687
  .uiklu-pt-4{
1647
1688
  padding-top: 1rem;
1648
1689
 
1690
+ }
1691
+ .uiklu-pt-\[10px\]{
1692
+ padding-top: 10px;
1693
+
1649
1694
  }
1650
1695
  .uiklu-pt-\[20px\]{
1651
1696
  padding-top: 20px;
@@ -2268,11 +2313,6 @@ input.uiklu-flex:not(:placeholder-shown) {
2268
2313
 
2269
2314
  }
2270
2315
 
2271
- .hover\:uiklu-bg-primary900\/10:hover{
2272
- background-color: hsl(var(--uiklu-primary-900) / 0.1);
2273
-
2274
- }
2275
-
2276
2316
  .hover\:uiklu-bg-primary900\/5:hover{
2277
2317
  background-color: hsl(var(--uiklu-primary-900) / 0.05);
2278
2318
 
@@ -2441,18 +2481,6 @@ input.uiklu-flex:not(:placeholder-shown) {
2441
2481
 
2442
2482
  }
2443
2483
 
2444
- .data-\[highlighted\]\:uiklu-bg-primary900[data-highlighted]{
2445
- --tw-bg-opacity: 1;
2446
- background-color: hsl(var(--uiklu-primary-900) / var(--tw-bg-opacity, 1));
2447
-
2448
- }
2449
-
2450
- .data-\[highlighted\]\:uiklu-text-white[data-highlighted]{
2451
- --tw-text-opacity: 1;
2452
- color: rgb(255 255 255 / var(--tw-text-opacity, 1));
2453
-
2454
- }
2455
-
2456
2484
  .data-\[placeholder\]\:uiklu-text-gray500[data-placeholder]{
2457
2485
  --tw-text-opacity: 1;
2458
2486
  color: hsl(var(--uiklu-gray-500) / var(--tw-text-opacity, 1));
package/dist/index.d.ts CHANGED
@@ -6,9 +6,9 @@ import * as SelectPrimitive from '@radix-ui/react-select';
6
6
  import * as react_jsx_runtime from 'react/jsx-runtime';
7
7
  import * as ToastPrimitives from '@radix-ui/react-toast';
8
8
 
9
- type InputSize = "sm" | "md" | "lg" | "full";
9
+ type InputSize$1 = "sm" | "md" | "lg" | "full";
10
10
  interface InputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, "size"> {
11
- size?: InputSize;
11
+ size?: InputSize$1;
12
12
  error?: string;
13
13
  isSearchable?: boolean;
14
14
  onSearchClick?: () => void;
@@ -173,6 +173,10 @@ declare const Icons: {
173
173
  GAMES: react_jsx_runtime.JSX.Element;
174
174
  CHECKED: react_jsx_runtime.JSX.Element;
175
175
  FILTER: react_jsx_runtime.JSX.Element;
176
+ SEAL: react_jsx_runtime.JSX.Element;
177
+ BOOKMARK: react_jsx_runtime.JSX.Element;
178
+ EDIT: react_jsx_runtime.JSX.Element;
179
+ DELETE: react_jsx_runtime.JSX.Element;
176
180
  };
177
181
 
178
182
  declare const searchSelectTriggerVariants: (props?: ({
@@ -219,4 +223,31 @@ interface CheckboxProps {
219
223
  }
220
224
  declare const Checkbox: React__default.FC<CheckboxProps>;
221
225
 
222
- export { BackButton, BalanceInfo, Button, Checkbox, type CheckboxProps, GridCard, Icons, Input, InputCode, LoadingScreen, MobileMenuDrawer, Modal, PromoBanner, SearchSelect, Select, SidebarTabs, ToastAction, Toaster, Typography, useToast };
226
+ interface LadaOption {
227
+ code: string;
228
+ label: string;
229
+ }
230
+ type InputSize = "sm" | "md" | "lg" | "full";
231
+ interface InputPhoneProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, "size" | "value" | "onChange"> {
232
+ size?: InputSize;
233
+ error?: string;
234
+ value?: string;
235
+ onChange?: (value: string) => void;
236
+ ladas?: LadaOption[];
237
+ defaultLadaIndex?: number;
238
+ }
239
+ declare const InputPhone: React.ForwardRefExoticComponent<InputPhoneProps & React.RefAttributes<HTMLInputElement>>;
240
+
241
+ type IconBadgeSize = 'sm' | 'md' | 'lg';
242
+ interface IconBadgeProps {
243
+ icon: React.ReactElement<{
244
+ className?: string;
245
+ }>;
246
+ /**
247
+ * @default 'sm'
248
+ */
249
+ size?: IconBadgeSize;
250
+ }
251
+ declare const IconBadge: React.FC<IconBadgeProps>;
252
+
253
+ export { BackButton, BalanceInfo, Button, Checkbox, type CheckboxProps, GridCard, IconBadge, type IconBadgeProps, Icons, Input, InputCode, InputPhone, type InputPhoneProps, type LadaOption, LoadingScreen, MobileMenuDrawer, Modal, PromoBanner, SearchSelect, Select, SidebarTabs, ToastAction, Toaster, Typography, useToast };