corekit-ui 0.1.21 → 0.1.25

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.
Files changed (118) hide show
  1. package/README.md +40 -39
  2. package/dist/corekit-ui.css +1 -1
  3. package/dist/index.d.ts +4276 -21
  4. package/dist/index.js +10821 -7096
  5. package/dist/index.js.map +1 -1
  6. package/dist/index.umd.cjs +659 -6
  7. package/dist/index.umd.cjs.map +1 -1
  8. package/package.json +145 -132
  9. package/dist/animations/Transiciones.d.ts +0 -9
  10. package/dist/animations/index.d.ts +0 -1
  11. package/dist/badge/Badge.d.ts +0 -3
  12. package/dist/badge/index.d.ts +0 -2
  13. package/dist/badge/types.d.ts +0 -62
  14. package/dist/boton/Boton.d.ts +0 -2
  15. package/dist/boton/index.d.ts +0 -2
  16. package/dist/boton/typesButton.d.ts +0 -35
  17. package/dist/checkbox/Checkbox.d.ts +0 -25
  18. package/dist/checkbox/CheckboxContext.d.ts +0 -3
  19. package/dist/checkbox/CheckboxGroup.d.ts +0 -11
  20. package/dist/checkbox/index.d.ts +0 -4
  21. package/dist/checkbox/types.d.ts +0 -108
  22. package/dist/drawer/Drawer.d.ts +0 -2
  23. package/dist/drawer/index.d.ts +0 -2
  24. package/dist/drawer/types.d.ts +0 -140
  25. package/dist/dropdown/ContextMenu.d.ts +0 -12
  26. package/dist/dropdown/DropdownContext.d.ts +0 -29
  27. package/dist/dropdown/DropdownMenu.d.ts +0 -3
  28. package/dist/dropdown/MenuItem.d.ts +0 -8
  29. package/dist/dropdown/Submenu.d.ts +0 -23
  30. package/dist/dropdown/index.d.ts +0 -11
  31. package/dist/dropdown/types.d.ts +0 -168
  32. package/dist/firma_manual/FirmaManual.d.ts +0 -3
  33. package/dist/firma_manual/Iconografia.d.ts +0 -16
  34. package/dist/firma_manual/TypesFirma.d.ts +0 -22
  35. package/dist/firma_manual/index.d.ts +0 -2
  36. package/dist/firma_manual/useFirmaLogica.d.ts +0 -10
  37. package/dist/hablar_escuchar/BadgeVoz.d.ts +0 -6
  38. package/dist/hablar_escuchar/Iconografia.d.ts +0 -10
  39. package/dist/hablar_escuchar/index.d.ts +0 -3
  40. package/dist/hablar_escuchar/useReconocimientoVoz.d.ts +0 -21
  41. package/dist/input_date/InputDate.d.ts +0 -342
  42. package/dist/input_date/funciones.d.ts +0 -27
  43. package/dist/input_date/index.d.ts +0 -3
  44. package/dist/input_date/types.d.ts +0 -70
  45. package/dist/input_numeric/Iconografia.d.ts +0 -5
  46. package/dist/input_numeric/InputNumeric.d.ts +0 -353
  47. package/dist/input_numeric/funciones.d.ts +0 -64
  48. package/dist/input_numeric/index.d.ts +0 -3
  49. package/dist/input_numeric/types.d.ts +0 -96
  50. package/dist/input_text/Iconografia.d.ts +0 -9
  51. package/dist/input_text/InputText.d.ts +0 -347
  52. package/dist/input_text/index.d.ts +0 -2
  53. package/dist/input_text/types.d.ts +0 -77
  54. package/dist/input_types_compartidos/index.d.ts +0 -1
  55. package/dist/input_types_compartidos/types.d.ts +0 -11
  56. package/dist/modal/Modal.d.ts +0 -2
  57. package/dist/modal/index.d.ts +0 -2
  58. package/dist/modal/types.d.ts +0 -115
  59. package/dist/modal_stack/ModalStack.d.ts +0 -14
  60. package/dist/modal_stack/index.d.ts +0 -2
  61. package/dist/panel_filtros/Iconografia.d.ts +0 -5
  62. package/dist/panel_filtros/PanelFiltros.d.ts +0 -49
  63. package/dist/panel_filtros/index.d.ts +0 -3
  64. package/dist/radio/Radio.d.ts +0 -16
  65. package/dist/radio/RadioContext.d.ts +0 -3
  66. package/dist/radio/RadioGroup.d.ts +0 -11
  67. package/dist/radio/index.d.ts +0 -3
  68. package/dist/radio/types.d.ts +0 -195
  69. package/dist/select/Iconografia.d.ts +0 -10
  70. package/dist/select/Select.d.ts +0 -42
  71. package/dist/select/SelectBase.d.ts +0 -17
  72. package/dist/select/SelectNativo.d.ts +0 -57
  73. package/dist/select/Types.d.ts +0 -629
  74. package/dist/select/funciones.d.ts +0 -244
  75. package/dist/select/index.d.ts +0 -4
  76. package/dist/tabla_datos/TablaDatos.d.ts +0 -80
  77. package/dist/tabla_datos/components/Iconografia.d.ts +0 -17
  78. package/dist/tabla_datos/components/TablaCards.d.ts +0 -1
  79. package/dist/tabla_datos/components/TablaEscritorio.d.ts +0 -1
  80. package/dist/tabla_datos/components/configuraciones/ConfigColumnas.d.ts +0 -1
  81. package/dist/tabla_datos/components/configuraciones/ConfigEncabezado.d.ts +0 -6
  82. package/dist/tabla_datos/components/configuraciones/ConfigFilas.d.ts +0 -1
  83. package/dist/tabla_datos/components/configuraciones/ConfigOpciones.d.ts +0 -6
  84. package/dist/tabla_datos/components/configuraciones/MenuConfiguraciones.d.ts +0 -1
  85. package/dist/tabla_datos/components/skeletons/SkeletonCargando.d.ts +0 -4
  86. package/dist/tabla_datos/components/skeletons/SkeletonCargandoCards.d.ts +0 -2
  87. package/dist/tabla_datos/components/tabla/BarraHerramientas.d.ts +0 -1
  88. package/dist/tabla_datos/components/tabla/BarraSeleccion.d.ts +0 -9
  89. package/dist/tabla_datos/components/tabla/Paginacion.d.ts +0 -1
  90. package/dist/tabla_datos/components/tabla/SinDatos.d.ts +0 -1
  91. package/dist/tabla_datos/components/tabla/tabla_cards/AccionesCards.d.ts +0 -3
  92. package/dist/tabla_datos/components/tabla/tabla_cards/ContenidoCards.d.ts +0 -3
  93. package/dist/tabla_datos/components/tabla/tabla_cards/EncabezadoCards.d.ts +0 -3
  94. package/dist/tabla_datos/constantes/ConstGenerales.d.ts +0 -18
  95. package/dist/tabla_datos/context/ContextTypes.d.ts +0 -23
  96. package/dist/tabla_datos/context/TablaDatosContext.d.ts +0 -3
  97. package/dist/tabla_datos/context/hooks.d.ts +0 -10
  98. package/dist/tabla_datos/hooks/useClickOutside.d.ts +0 -8
  99. package/dist/tabla_datos/hooks/useEscapeKey.d.ts +0 -1
  100. package/dist/tabla_datos/hooks/usePopoverPosition.d.ts +0 -15
  101. package/dist/tabla_datos/hooks/useScrollLock.d.ts +0 -1
  102. package/dist/tabla_datos/index.d.ts +0 -5
  103. package/dist/tabla_datos/types/TablaTypes.d.ts +0 -85
  104. package/dist/tabla_datos/types/tanstack-table.d.ts +0 -8
  105. package/dist/tabla_datos/utils/FuncionesColumnas.d.ts +0 -9
  106. package/dist/tabla_datos/utils/FuncionesPaginacion.d.ts +0 -12
  107. package/dist/tabla_datos/utils/FuncionesTabla.d.ts +0 -54
  108. package/dist/text_area/Iconografia.d.ts +0 -6
  109. package/dist/text_area/TextArea.d.ts +0 -333
  110. package/dist/text_area/index.d.ts +0 -2
  111. package/dist/text_area/types.d.ts +0 -76
  112. package/dist/texts/Texts.d.ts +0 -19
  113. package/dist/toggle/Toggle.d.ts +0 -21
  114. package/dist/toggle/index.d.ts +0 -2
  115. package/dist/toggle/types.d.ts +0 -90
  116. package/dist/tooltip/Tooltip.d.ts +0 -2
  117. package/dist/tooltip/index.d.ts +0 -2
  118. package/dist/tooltip/types.d.ts +0 -83
@@ -1,629 +0,0 @@
1
- import { ReactNode } from 'react';
2
- import { InputVariant, InputColor, InputSize, InputRadius, ResultadoValidacion } from '../input_types_compartidos/types';
3
- /** Opción del Select: string simple u objeto con `disabled` opcional */
4
- export type SelectOption<T = string> = T extends string ? string : T & {
5
- disabled?: boolean;
6
- };
7
- /**
8
- * Props principales del componente Select.
9
- *
10
- * @template T - Tipo de las opciones (string por defecto)
11
- *
12
- * @description
13
- * El componente Select soporta:
14
- * - Opciones simples (strings) o complejas (objetos)
15
- * - Modo controlado y no controlado
16
- * - Selección simple o múltiple
17
- * - Búsqueda/filtrado con función personalizable
18
- * - Virtualización para listas grandes
19
- * - Validación integrada
20
- * - Render personalizado de opciones y valor
21
- *
22
- * @example
23
- * ```tsx
24
- * // Props básicas
25
- * <Select
26
- * options={['Opción 1', 'Opción 2']}
27
- * value={seleccionado}
28
- * onChange={setSeleccionado}
29
- * />
30
- *
31
- * // Props avanzadas con objetos
32
- * interface Pais { codigo: string; nombre: string; bandera: string; }
33
- *
34
- * <Select<Pais>
35
- * options={paises}
36
- * optionLabelKey="nombre"
37
- * optionValueKey="codigo"
38
- * renderOption={(pais, { isSelected }) => (
39
- * <div className={isSelected ? 'selected' : ''}>
40
- * {pais.bandera} {pais.nombre}
41
- * </div>
42
- * )}
43
- * isSearchable
44
- * isVirtualized
45
- * />
46
- * ```
47
- */
48
- export type SelectProps<T = string> = {
49
- /**
50
- * Lista de opciones disponibles para seleccionar.
51
- *
52
- * Puede ser un array de strings o un array de objetos.
53
- * Para objetos, usar `optionLabelKey` y `optionValueKey`.
54
- *
55
- * @example
56
- * ```ts
57
- * // Strings
58
- * options={['Rojo', 'Verde', 'Azul']}
59
- *
60
- * // Objetos
61
- * options={[{ id: '1', nombre: 'Ana' }, { id: '2', nombre: 'Luis' }]}
62
- * ```
63
- */
64
- options: T[];
65
- /**
66
- * Valor actual seleccionado (modo controlado).
67
- *
68
- * En modo simple: `T | null`
69
- * En modo múltiple: `T[]`
70
- *
71
- * Si no se proporciona, el componente es no controlado.
72
- */
73
- value?: T | T[] | null;
74
- /**
75
- * Valor inicial (modo no controlado).
76
- *
77
- * Se usa solo si `value` no está definido.
78
- * El componente mantendrá su propio estado interno.
79
- */
80
- defaultValue?: T | T[] | null;
81
- /**
82
- * Callback cuando cambia la selección.
83
- *
84
- * @important Recibe el valor (T | T[] | null), NO el evento.
85
- * Esto es intencional para una API más limpia.
86
- *
87
- * @param value - Nueva selección (objeto/string, array, o null)
88
- *
89
- * @example
90
- * ```ts
91
- * onChange={(usuario) => {
92
- * console.log(usuario?.nombre); // Acceso directo al objeto
93
- * }}
94
- * ```
95
- */
96
- onChange?: (value: T | T[] | null) => void;
97
- /**
98
- * Callback alternativo con el mismo comportamiento que onChange.
99
- *
100
- * Útil para compatibilidad con librerías de formularios que
101
- * esperan un prop diferente a onChange.
102
- */
103
- onValueChange?: (value: T | T[] | null) => void;
104
- /**
105
- * Campo del objeto a mostrar como texto de la opción.
106
- *
107
- * @default 'label'
108
- *
109
- * @example
110
- * ```ts
111
- * // Con objetos { nombre: 'Ana', correo: 'ana@...' }
112
- * optionLabelKey="nombre" // Mostrará 'Ana'
113
- * ```
114
- */
115
- optionLabelKey?: keyof T | string;
116
- /**
117
- * Campo del objeto a usar como identificador único.
118
- *
119
- * Se usa para:
120
- * - Claves de React (keys)
121
- * - Comparar opciones seleccionadas
122
- * - Valor del input hidden
123
- *
124
- * @default 'id'
125
- *
126
- * @example
127
- * ```ts
128
- * // Con objetos { codigo: 'CO', nombre: 'Colombia' }
129
- * optionValueKey="codigo" // Usará 'CO' como identificador
130
- * ```
131
- */
132
- optionValueKey?: keyof T | string;
133
- /**
134
- * Render personalizado para cada opción en el dropdown.
135
- *
136
- * @param option - La opción a renderizar
137
- * @param state - Estado actual de la opción
138
- * @returns ReactNode con el contenido personalizado
139
- *
140
- * @example
141
- * ```tsx
142
- * renderOption={(usuario, { isSelected, isActive }) => (
143
- * <div className={clsx({ selected: isSelected, active: isActive })}>
144
- * <Avatar src={usuario.avatar} />
145
- * <span>{usuario.nombre}</span>
146
- * {isSelected && <CheckIcon />}
147
- * </div>
148
- * )}
149
- * ```
150
- */
151
- renderOption?: (option: T, state: {
152
- isSelected: boolean;
153
- isActive: boolean;
154
- }) => ReactNode;
155
- /**
156
- * Render personalizado del valor mostrado en el trigger.
157
- *
158
- * @param value - Valor actual (puede ser null, T, o T[])
159
- * @returns ReactNode con el contenido personalizado
160
- *
161
- * @example
162
- * ```tsx
163
- * renderValue={(usuario) => (
164
- * usuario ? (
165
- * <div className="selected-user">
166
- * <Avatar src={usuario.avatar} size="sm" />
167
- * {usuario.nombre}
168
- * </div>
169
- * ) : (
170
- * <span className="placeholder">Selecciona un usuario</span>
171
- * )
172
- * )}
173
- * ```
174
- */
175
- renderValue?: (value: T | T[] | null) => ReactNode;
176
- /**
177
- * Variante visual del componente.
178
- *
179
- * - `bordered`: Borde visible (default)
180
- * - `faded`: Fondo gris, sin borde
181
- * - `underlined`: Solo borde inferior
182
- * - `ghost`: Transparente con sombra
183
- *
184
- * @default 'bordered'
185
- */
186
- variant?: InputVariant;
187
- /**
188
- * Color del borde en estado focus.
189
- *
190
- * @default 'default'
191
- */
192
- color?: InputColor;
193
- /**
194
- * Tamaño del componente.
195
- *
196
- * Afecta altura, padding y tamaño de fuente.
197
- * Usa las mismas variables CSS que InputText para consistencia.
198
- *
199
- * @default 'md'
200
- */
201
- size?: InputSize;
202
- /**
203
- * Radio de borde del trigger.
204
- *
205
- * @default 'md'
206
- */
207
- radius?: InputRadius;
208
- /**
209
- * Si true, el componente ocupa el 100% del ancho disponible.
210
- *
211
- * @default true
212
- */
213
- fullWidth?: boolean;
214
- /**
215
- * Deshabilita todas las animaciones y transiciones.
216
- *
217
- * Útil para usuarios con preferencias de movimiento reducido
218
- * o para testing.
219
- *
220
- * @default false
221
- */
222
- disableAnimation?: boolean;
223
- /**
224
- * Etiqueta del campo, mostrada arriba del trigger.
225
- */
226
- label?: string;
227
- /**
228
- * Texto mostrado cuando no hay selección.
229
- *
230
- * @default 'Seleccione una opción'
231
- */
232
- placeholder?: string;
233
- /**
234
- * Texto de ayuda mostrado debajo del campo.
235
- *
236
- * Se oculta cuando hay error de validación.
237
- */
238
- description?: string;
239
- /**
240
- * Mensaje de error personalizado.
241
- *
242
- * Puede ser un string o una función que recibe el estado de validación.
243
- *
244
- * @example
245
- * ```tsx
246
- * // String simple
247
- * errorMessage="Campo requerido"
248
- *
249
- * // Función dinámica
250
- * errorMessage={({ invalido, mensaje }) =>
251
- * invalido ? `⚠️ ${mensaje}` : null
252
- * }
253
- * ```
254
- */
255
- errorMessage?: string | ((validation: ResultadoValidacion) => ReactNode);
256
- /**
257
- * Texto cuando la lista de opciones está vacía.
258
- *
259
- * @default 'No hay opciones'
260
- */
261
- emptyMessage?: string;
262
- /**
263
- * Texto cuando la búsqueda no encuentra resultados.
264
- *
265
- * @default 'Sin resultados'
266
- */
267
- noResultsMessage?: string;
268
- /**
269
- * Marca el campo como obligatorio.
270
- *
271
- * Muestra asterisco (*) junto al label.
272
- *
273
- * @default false
274
- */
275
- isRequired?: boolean;
276
- /**
277
- * Deshabilita el componente.
278
- *
279
- * El trigger se vuelve no interactivo y semi-transparente.
280
- *
281
- * @default false
282
- */
283
- isDisabled?: boolean;
284
- /**
285
- * Modo solo lectura.
286
- *
287
- * Similar a disabled pero semánticamente diferente:
288
- * el valor existe pero no se puede cambiar.
289
- *
290
- * @default false
291
- */
292
- isReadOnly?: boolean;
293
- /**
294
- * Muestra indicador de carga (spinner).
295
- *
296
- * También deshabilita la interacción mientras carga.
297
- *
298
- * @default false
299
- */
300
- isLoading?: boolean;
301
- /**
302
- * Muestra botón para limpiar la selección.
303
- *
304
- * @default true
305
- */
306
- isClearable?: boolean;
307
- /**
308
- * Fuerza el estado inválido del campo.
309
- *
310
- * Tiene prioridad sobre validationState y validate.
311
- */
312
- isInvalid?: boolean;
313
- /**
314
- * Estado de validación explícito.
315
- *
316
- * - `valid`: Muestra borde verde
317
- * - `invalid`: Muestra borde rojo y mensaje de error
318
- */
319
- validationState?: 'valid' | 'invalid';
320
- /**
321
- * Habilita selección múltiple.
322
- *
323
- * El valor será un array de opciones.
324
- * Muestra chips para las seleccionadas.
325
- *
326
- * @default false
327
- */
328
- isMultiple?: boolean;
329
- /**
330
- * Controla si se muestran todos los chips en modo multi-selección.
331
- *
332
- * - `true`: Renderiza todos los chips seleccionados, permitiendo que
333
- * el trigger crezca verticalmente con wrapping (múltiples líneas).
334
- * - `false`: Colapsa después de 2 chips y muestra contador "+N" (comportamiento default).
335
- *
336
- * Solo aplica cuando `isMultiple={true}`.
337
- *
338
- * @default false
339
- *
340
- * @example
341
- * ```tsx
342
- * // Mostrar solo 2 chips + contador (default)
343
- * <Select
344
- * options={opciones}
345
- * isMultiple
346
- * value={[opt1, opt2, opt3, opt4]}
347
- * />
348
- * // Renderiza: [Chip1] [Chip2] +2
349
- *
350
- * // Mostrar todos los chips (crece verticalmente)
351
- * <Select
352
- * options={opciones}
353
- * isMultiple
354
- * mostrarTodos
355
- * value={[opt1, opt2, opt3, opt4]}
356
- * />
357
- * // Renderiza:
358
- * // [Chip1] [Chip2] [Chip3]
359
- * // [Chip4]
360
- * ```
361
- */
362
- mostrarTodos?: boolean;
363
- /**
364
- * Habilita campo de búsqueda.
365
- *
366
- * Permite filtrar las opciones escribiendo.
367
- *
368
- * @default false
369
- */
370
- isSearchable?: boolean;
371
- /**
372
- * Habilita virtualización de la lista.
373
- *
374
- * Necesario para listas grandes (+500 opciones).
375
- * Solo renderiza los elementos visibles.
376
- *
377
- * @default false
378
- */
379
- isVirtualized?: boolean;
380
- /**
381
- * Altura estimada de cada opción (en píxeles).
382
- *
383
- * Solo se usa cuando `isVirtualized` es true.
384
- * Ayuda al virtualizador a calcular el scroll.
385
- *
386
- * @default 36
387
- */
388
- estimatedOptionHeight?: number;
389
- /**
390
- * Función de filtrado personalizada.
391
- *
392
- * Por defecto busca coincidencia en el label (case-insensitive).
393
- *
394
- * @param option - Opción a evaluar
395
- * @param searchValue - Texto de búsqueda actual
396
- * @returns true si la opción debe mostrarse
397
- *
398
- * @example
399
- * ```ts
400
- * // Buscar en múltiples campos
401
- * filterFn={(usuario, busqueda) =>
402
- * usuario.nombre.toLowerCase().includes(busqueda.toLowerCase()) ||
403
- * usuario.email.toLowerCase().includes(busqueda.toLowerCase())
404
- * }
405
- * ```
406
- */
407
- filterFn?: (option: T, searchValue: string) => boolean;
408
- /**
409
- * Función de validación.
410
- *
411
- * Se ejecuta cada vez que cambia el valor.
412
- *
413
- * @param value - Valor actual a validar
414
- * @returns
415
- * - `true` o `null`: válido
416
- * - `string`: mensaje de error
417
- * - `{ message?: string }`: objeto con mensaje
418
- *
419
- * @example
420
- * ```ts
421
- * validate={(valor) => {
422
- * if (!valor) return 'Seleccione una opción';
423
- * if (valor.activo === false) return 'Esta opción no está disponible';
424
- * return true;
425
- * }}
426
- * ```
427
- */
428
- validate?: (value: T | T[] | null) => boolean | string | {
429
- message?: string;
430
- } | null | undefined;
431
- /** Callback al abrir el menú desplegable */
432
- onOpen?: () => void;
433
- /** Callback al cerrar el menú desplegable */
434
- onClose?: () => void;
435
- /**
436
- * Callback cuando cambia el texto de búsqueda.
437
- *
438
- * Útil para búsqueda en servidor (debounced).
439
- *
440
- * @param search - Texto de búsqueda actual
441
- */
442
- onSearchChange?: (search: string) => void;
443
- /** Callback al limpiar la selección (botón X) */
444
- onClear?: () => void;
445
- /** Callback cuando el trigger recibe focus */
446
- onFocus?: () => void;
447
- /** Callback cuando el trigger pierde focus */
448
- onBlur?: () => void;
449
- /**
450
- * ID del elemento (para label y accesibilidad).
451
- *
452
- * Si no se proporciona, se genera automáticamente con useId().
453
- */
454
- id?: string;
455
- /**
456
- * Nombre del campo para formularios HTML.
457
- *
458
- * Se crea un input hidden con este nombre y el valor seleccionado.
459
- */
460
- name?: string;
461
- /**
462
- * Clase CSS adicional para el contenedor base.
463
- */
464
- className?: string;
465
- /**
466
- * Clases CSS para slots específicos.
467
- *
468
- * Permite personalizar cada parte del componente.
469
- */
470
- classNames?: {
471
- /** Contenedor principal */
472
- base?: string;
473
- /** Etiqueta del campo */
474
- label?: string;
475
- /** Botón/trigger que abre el menú */
476
- trigger?: string;
477
- /** Área donde se muestra el valor seleccionado */
478
- value?: string;
479
- /** Botón de limpiar */
480
- clearButton?: string;
481
- /** Contenedor del menú desplegable */
482
- menu?: string;
483
- /** Cada opción individual */
484
- option?: string;
485
- /** Input de búsqueda */
486
- searchInput?: string;
487
- /** Texto de descripción */
488
- description?: string;
489
- /** Mensaje de error */
490
- errorMessage?: string;
491
- };
492
- /**
493
- * Estilo en línea para el contenedor base.
494
- */
495
- style?: React.CSSProperties;
496
- /**
497
- * Contenido antes del valor (icono, prefijo, etc).
498
- */
499
- startContent?: ReactNode;
500
- /**
501
- * Contenido después del valor (antes del chevron).
502
- */
503
- endContent?: ReactNode;
504
- /**
505
- * Z-index del menú flotante.
506
- *
507
- * Por defecto usa `--z-popover` de las variables CSS.
508
- */
509
- menuZIndex?: number;
510
- /**
511
- * Contenedor donde se renderiza el portal del menú.
512
- *
513
- * Por defecto se renderiza al final del `<body>`.
514
- */
515
- portalContainer?: HTMLElement | null;
516
- };
517
- /**
518
- * Estado de una opción para el render personalizado.
519
- *
520
- * @description
521
- * Este estado se pasa a `renderOption` para permitir
522
- * estilos condicionales basados en la interacción.
523
- */
524
- export type SelectOptionState = {
525
- /** true si la opción está actualmente seleccionada */
526
- isSelected: boolean;
527
- /** true si la opción tiene el foco (hover o navegación por teclado) */
528
- isActive: boolean;
529
- /** true si la opción está deshabilitada */
530
- isDisabled: boolean;
531
- };
532
- /**
533
- * Métodos expuestos vía ref del componente Select.
534
- *
535
- * @description
536
- * Permite control imperativo del componente.
537
- * Usar con `useRef<SelectRef>()`.
538
- *
539
- * @example
540
- * ```tsx
541
- * const selectRef = useRef<SelectRef>(null);
542
- *
543
- * // Abrir programáticamente
544
- * selectRef.current?.open();
545
- *
546
- * // Limpiar selección
547
- * selectRef.current?.clear();
548
- *
549
- * // Enfocar después de una acción
550
- * selectRef.current?.focus();
551
- * ```
552
- */
553
- export type SelectRef = {
554
- focus: () => void;
555
- blur: () => void;
556
- open: () => void;
557
- close: () => void;
558
- clear: () => void;
559
- };
560
- /** Props base compartidas por todos los modos del Select */
561
- type BaseSelectProps<T> = Omit<SelectProps<T>, 'options' | 'value' | 'onChange' | 'optionValueKey' | 'optionLabelKey'>;
562
- /** Props del wrapper para control de retorno */
563
- type WrapperProps = {
564
- /** Si true, onChange devuelve el objeto completo en lugar del ID */
565
- devolverObjeto?: boolean;
566
- };
567
- /** Strings simples (selección única) */
568
- export type SelectStringProps = BaseSelectProps<string> & WrapperProps & {
569
- options: string[];
570
- value?: string;
571
- onChange?: (value: string) => void;
572
- optionValueKey?: never;
573
- optionLabelKey?: never;
574
- devolverObjeto?: never;
575
- isMultiple?: false;
576
- };
577
- /** Strings múltiples */
578
- export type SelectMultiStringProps = BaseSelectProps<string> & WrapperProps & {
579
- options: string[];
580
- value?: string[];
581
- onChange?: (value: string[]) => void;
582
- optionValueKey?: never;
583
- optionLabelKey?: never;
584
- devolverObjeto?: never;
585
- isMultiple: true;
586
- };
587
- /** Objetos - retorna ID (comportamiento por defecto) */
588
- export type SelectObjectIdProps<T> = BaseSelectProps<T> & WrapperProps & {
589
- options: T[];
590
- value?: string | number;
591
- onChange?: (value: string | number) => void;
592
- optionValueKey: keyof T;
593
- optionLabelKey?: keyof T;
594
- devolverObjeto?: false;
595
- isMultiple?: false;
596
- };
597
- /** Objetos múltiples - retorna array de IDs */
598
- export type SelectMultiObjectIdProps<T> = BaseSelectProps<T> & WrapperProps & {
599
- options: T[];
600
- value?: Array<string | number>;
601
- onChange?: (value: Array<string | number>) => void;
602
- optionValueKey: keyof T;
603
- optionLabelKey?: keyof T;
604
- devolverObjeto?: false;
605
- isMultiple: true;
606
- };
607
- /** Objetos - retorna objeto completo */
608
- export type SelectObjectFullProps<T> = BaseSelectProps<T> & WrapperProps & {
609
- options: T[];
610
- value?: T | null;
611
- onChange?: (value: T | null) => void;
612
- optionValueKey: keyof T;
613
- optionLabelKey?: keyof T;
614
- devolverObjeto: true;
615
- isMultiple?: false;
616
- };
617
- /** Objetos múltiples - retorna array de objetos */
618
- export type SelectMultiObjectFullProps<T> = BaseSelectProps<T> & WrapperProps & {
619
- options: T[];
620
- value?: T[];
621
- onChange?: (value: T[]) => void;
622
- optionValueKey: keyof T;
623
- optionLabelKey?: keyof T;
624
- devolverObjeto: true;
625
- isMultiple: true;
626
- };
627
- /** Unión discriminada de todos los tipos posibles */
628
- export type SmartSelectProps<T> = SelectStringProps | SelectMultiStringProps | SelectObjectIdProps<T> | SelectMultiObjectIdProps<T> | SelectObjectFullProps<T> | SelectMultiObjectFullProps<T>;
629
- export {};