@rubenpazch/ui 0.7.0 → 0.8.0
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/AGENTS.md +10 -0
- package/dist/index.cjs.js +46 -0
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +6 -1
- package/dist/index.esm.js +6 -1
- package/dist/index.esm.js.map +1 -1
- package/docs/COMPONENTES.md +288 -80
- package/docs/catalogo.json +528 -3
- package/package.json +49 -44
package/docs/COMPONENTES.md
CHANGED
|
@@ -29,9 +29,12 @@ librería (ver AGENTS.md del repo lbyte-ui-library), no lo copies en la app.
|
|
|
29
29
|
| [`@rubenpazch/data-table`](#rubenpazchdata-table) | Datos | DataTable | Tabla de datos accesible: columnas con render, orden (aria-sort) en el navegador o en el servidor, carga con Skeleton, estado vacío, filas clicables, encabezado fijo y scroll horizontal en móvil. |
|
|
30
30
|
| [`@rubenpazch/date-input`](#rubenpazchdate-input) | Formularios | DateInput | Campo de fecha con formato local, mínimo/máximo, ayuda y error. |
|
|
31
31
|
| [`@rubenpazch/date-picker`](#rubenpazchdate-picker) | Formularios | DatePicker | Selector de fecha con calendario desplegable. |
|
|
32
|
+
| [`@rubenpazch/date-range-picker`](#rubenpazchdate-range-picker) | Formularios | DateRangePicker, DEFAULT_DATE_RANGE_LABELS, DEFAULT_DATE_RANGE_PRESETS, rangoValido | Dos fechas (desde y hasta) con validación del orden y atajos (este mes, mes anterior, últimos 30 días…). Valores ISO AAAA-MM-DD. |
|
|
33
|
+
| [`@rubenpazch/description-list`](#rubenpazchdescription-list) | Presentación de datos | DescriptionList | Pares etiqueta/valor en columnas: resumen de un registro (datos de un trámite, de un cliente, de un pago). |
|
|
32
34
|
| [`@rubenpazch/draggable-list`](#rubenpazchdraggable-list) | Datos | DraggableList | Lista reordenable arrastrando (también con teclado), basada en dnd-kit. |
|
|
33
35
|
| [`@rubenpazch/drawer`](#rubenpazchdrawer) | Navegación | Drawer | Panel lateral (izquierda/derecha/arriba/abajo) con animación y fondo. |
|
|
34
36
|
| [`@rubenpazch/empty-state`](#rubenpazchempty-state) | Retroalimentación | EmptyState | Estado vacío con icono, título, descripción y acciones ("No hay convocatorias · Crear"). |
|
|
37
|
+
| [`@rubenpazch/file-upload`](#rubenpazchfile-upload) | Formularios | FileUpload, DEFAULT_FILE_UPLOAD_LABELS, aceptaArchivo | Zona para subir uno o varios archivos (arrastrar y soltar o elegir), con validación de tipo, tamaño y cantidad, y lista para quitarlos. |
|
|
35
38
|
| [`@rubenpazch/form-field`](#rubenpazchform-field) | Formularios | FormField, FormRow, FormActions | FormField (etiqueta, ayuda y error asociados a cualquier control), FormRow (columnas que se apilan en móvil) y FormActions (pie con botones). |
|
|
36
39
|
| [`@rubenpazch/icon-button`](#rubenpazchicon-button) | Acciones | IconButton | Botón de solo icono con variantes, formas, tooltip y etiqueta accesible. |
|
|
37
40
|
| [`@rubenpazch/icons`](#rubenpazchicons) | Iconos | ArrowDetailsIcon, ArchiveIcon, BrandingIcon, BusinessPlanIcon, CalendarIcon, CheckIcon, … | Más de 60 iconos SVG como componentes React (y MaterialIcon para Material Icons). |
|
|
@@ -64,9 +67,11 @@ librería (ver AGENTS.md del repo lbyte-ui-library), no lo copies en la app.
|
|
|
64
67
|
| [`@rubenpazch/tabs`](#rubenpazchtabs) | Navegación | Tabs | Pestañas para alternar entre secciones de una misma vista. |
|
|
65
68
|
| [`@rubenpazch/text-input`](#rubenpazchtext-input) | Formularios | TextInput | Campo de texto con etiqueta, ayuda, advertencia, error, iconos y variantes. |
|
|
66
69
|
| [`@rubenpazch/textarea`](#rubenpazchtextarea) | Formularios | Textarea | Área de texto con etiqueta, ayuda, advertencia, error, contador de caracteres y crecimiento automático. |
|
|
70
|
+
| [`@rubenpazch/timeline`](#rubenpazchtimeline) | Presentación de datos | Timeline | Línea de tiempo vertical: historial de un trámite, pedido o expediente (eventos con estado, fecha y descripción). |
|
|
67
71
|
| [`@rubenpazch/toast`](#rubenpazchtoast) | Retroalimentación | ToastBanner, ToastProvider, ToastRegion, useToast | Notificaciones temporales (Toast) y avisos fijos (ToastBanner) con tipos y acciones. |
|
|
68
72
|
| [`@rubenpazch/tokens`](#rubenpazchtokens) | Base (tokens y utilidades) | cssVar, fontFamily, fontSize, fontWeight, lineHeight, letterSpacing, … | Tokens de diseño (colores, tipografía, espacios, radios, sombras) como variables CSS --lb-*, estilos base y puente para Tailwind 4. |
|
|
69
73
|
| [`@rubenpazch/tooltip`](#rubenpazchtooltip) | Presentación de datos | Tooltip | Texto de ayuda breve al pasar el mouse o enfocar con teclado (role="tooltip", aria-describedby), se cierra con Escape. |
|
|
74
|
+
| [`@rubenpazch/turnstile`](#rubenpazchturnstile) | Formularios | Turnstile, TURNSTILE_SCRIPT, cargarTurnstile | Widget de Cloudflare Turnstile (anti-robots) para formularios públicos: carga el script una sola vez, entrega el token y se reinicia tras cada envío. |
|
|
70
75
|
| [`@rubenpazch/user-card`](#rubenpazchuser-card) | Presentación de datos | UserCard, initials | Tarjeta de una persona (usuario, socio, cliente): avatar, nombre, correo u otro dato, etiquetas y acciones; las secundarias van en un menú ⋮. |
|
|
71
76
|
|
|
72
77
|
## Base (tokens y utilidades)
|
|
@@ -78,7 +83,7 @@ Utilidades (classList) y tipos comunes; la usan internamente los componentes.
|
|
|
78
83
|
- **Usar cuando:** Solo si construyes un componente nuevo dentro de la librería.
|
|
79
84
|
- **Evitar cuando:** En las apps: no hace falta importarla.
|
|
80
85
|
|
|
81
|
-
Otras exportaciones: `classList`, `normalizeSize`, `toLegacySize`, `useFieldIds`, `useEscapeKey`, `useFocusTrap`, `useLockBodyScroll`, `useClickOutside`, `mergeRefs`, `parseISODate`, `toISODate`, `isDayFirst`, `datePlaceholder`, `parseLocalDate`, `formatLocalDate`, `formatMonthYear`, `isSameDay`.
|
|
86
|
+
Otras exportaciones: `classList`, `normalizeSize`, `toLegacySize`, `useFieldIds`, `useEscapeKey`, `useFocusTrap`, `useLockBodyScroll`, `useClickOutside`, `mergeRefs`, `useMediaQuery`, `MOBILE_QUERY`, `parseISODate`, `toISODate`, `isDayFirst`, `datePlaceholder`, `parseLocalDate`, `formatLocalDate`, `formatMonthYear`, `isSameDay`.
|
|
82
87
|
|
|
83
88
|
Tipos: `Size`, `Color`, `Variant`, `ComponentSize`, `LegacySize`, `SizeProp`, `FieldProps`, `FieldIds`.
|
|
84
89
|
|
|
@@ -281,23 +286,24 @@ Campo de fecha con calendario desplegable. Se escribe en el formato del idioma
|
|
|
281
286
|
import { DateInput } from "@rubenpazch/ui";
|
|
282
287
|
```
|
|
283
288
|
|
|
284
|
-
| Prop
|
|
285
|
-
|
|
|
286
|
-
| `onChange`
|
|
287
|
-
| `value`
|
|
288
|
-
| `className`
|
|
289
|
-
| `disabled`
|
|
290
|
-
| `error`
|
|
291
|
-
| `hint`
|
|
292
|
-
| `id`
|
|
293
|
-
| `label`
|
|
294
|
-
| `labels`
|
|
295
|
-
| `locale`
|
|
296
|
-
| `maxDate`
|
|
297
|
-
| `minDate`
|
|
298
|
-
| `
|
|
299
|
-
| `
|
|
300
|
-
| `
|
|
289
|
+
| Prop | Tipo | Req. | Por defecto | Descripción |
|
|
290
|
+
| ------------------ | -------------------------- | ---- | ----------- | ---------------------------------------------------------------------------------------------------------------------------------- |
|
|
291
|
+
| `onChange` | `(date: string) => void` | sí | | Recibe la fecha en ISO `AAAA-MM-DD` (o "" al limpiar). |
|
|
292
|
+
| `value` | `string` | sí | | Fecha en formato ISO `AAAA-MM-DD`, o cadena vacía. |
|
|
293
|
+
| `className` | `string` | | `` | Clase extra para el contenedor. |
|
|
294
|
+
| `disabled` | `boolean` | | `false` | Campo deshabilitado. |
|
|
295
|
+
| `error` | `string` | | | Mensaje de error; marca el campo como inválido. |
|
|
296
|
+
| `hint` | `string` | | | Texto de ayuda. |
|
|
297
|
+
| `id` | `string` | | | id del input; si no se pasa se genera uno (la etiqueta se asocia sola). |
|
|
298
|
+
| `label` | `string` | | | Etiqueta visible. |
|
|
299
|
+
| `labels` | `Partial<DateInputLabels>` | | | Textos del calendario; por defecto en el idioma de `locale`. |
|
|
300
|
+
| `locale` | `string` | | `es` | Idioma: `es` (por defecto, día/mes) o `en` (mes/día). |
|
|
301
|
+
| `maxDate` | `string` | | | Fecha máxima seleccionable (ISO). |
|
|
302
|
+
| `minDate` | `string` | | | Fecha mínima seleccionable (ISO). |
|
|
303
|
+
| `mobileFullScreen` | `boolean` | | `true` | En pantallas pequeñas (< 640 px) el calendario se abre a pantalla completa y vuelve al campo al elegir la fecha. Por defecto true. |
|
|
304
|
+
| `name` | `string` | | | name del input (formularios nativos, react-hook-form…). |
|
|
305
|
+
| `placeholder` | `string` | | | Por defecto el formato del idioma: "DD/MM/AAAA" en español. |
|
|
306
|
+
| `required` | `boolean` | | `false` | Campo obligatorio. |
|
|
301
307
|
|
|
302
308
|
### @rubenpazch/date-picker
|
|
303
309
|
|
|
@@ -314,24 +320,128 @@ Selector de fecha con calendario (días, meses y años). Devuelve ISO `AAAA-MM-D
|
|
|
314
320
|
import { DatePicker } from "@rubenpazch/ui";
|
|
315
321
|
```
|
|
316
322
|
|
|
317
|
-
| Prop | Tipo | Req. | Por defecto | Descripción
|
|
318
|
-
| ------------------- | ------------------------ | ---- | ----------- |
|
|
319
|
-
| `onChange` | `(date: string) => void` | sí | |
|
|
320
|
-
| `value` | `string` | sí | |
|
|
321
|
-
| `className` | `string` | | `` |
|
|
322
|
-
| `disabled` | `boolean` | | `false` |
|
|
323
|
-
| `error` | `string` | | |
|
|
324
|
-
| `hint` | `string` | | |
|
|
325
|
-
| `id` | `string` | | | id del input; si no se pasa se genera uno (la etiqueta se asocia sola).
|
|
326
|
-
| `label` | `string` | | |
|
|
327
|
-
| `locale` | `string` | | `es` |
|
|
328
|
-
| `maxDate` | `string` | | |
|
|
329
|
-
| `minDate` | `string` | | |
|
|
330
|
-
| `
|
|
331
|
-
| `
|
|
332
|
-
| `
|
|
333
|
-
| `
|
|
334
|
-
| `
|
|
323
|
+
| Prop | Tipo | Req. | Por defecto | Descripción |
|
|
324
|
+
| ------------------- | ------------------------ | ---- | ----------- | ---------------------------------------------------------------------------------------------------------------------------------- |
|
|
325
|
+
| `onChange` | `(date: string) => void` | sí | | |
|
|
326
|
+
| `value` | `string` | sí | | |
|
|
327
|
+
| `className` | `string` | | `` | |
|
|
328
|
+
| `disabled` | `boolean` | | `false` | |
|
|
329
|
+
| `error` | `string` | | | |
|
|
330
|
+
| `hint` | `string` | | | |
|
|
331
|
+
| `id` | `string` | | | id del input; si no se pasa se genera uno (la etiqueta se asocia sola). |
|
|
332
|
+
| `label` | `string` | | | |
|
|
333
|
+
| `locale` | `string` | | `es` | |
|
|
334
|
+
| `maxDate` | `string` | | | |
|
|
335
|
+
| `minDate` | `string` | | | |
|
|
336
|
+
| `mobileFullScreen` | `boolean` | | `true` | En pantallas pequeñas (< 640 px) el calendario se abre a pantalla completa y vuelve al campo al elegir la fecha. Por defecto true. |
|
|
337
|
+
| `name` | `string` | | | name del input. |
|
|
338
|
+
| `openCalendarLabel` | `string` | | | Texto del botón que abre el calendario (accesibilidad). |
|
|
339
|
+
| `placeholder` | `string` | | | |
|
|
340
|
+
| `readOnly` | `boolean` | | `false` | |
|
|
341
|
+
| `required` | `boolean` | | `false` | |
|
|
342
|
+
|
|
343
|
+
### @rubenpazch/date-range-picker
|
|
344
|
+
|
|
345
|
+
Dos fechas (desde y hasta) con validación del orden y atajos (este mes, mes anterior, últimos 30 días…). Valores ISO AAAA-MM-DD.
|
|
346
|
+
|
|
347
|
+
- **Usar cuando:** Filtrar reportes, listados o libros por un periodo.
|
|
348
|
+
- **Evitar cuando:** Una sola fecha: usa DateInput. Navegar mes a mes: usa MonthNavigator.
|
|
349
|
+
|
|
350
|
+
#### DateRangePicker
|
|
351
|
+
|
|
352
|
+
Periodo desde/hasta con dos `DateInput` y atajos. Valida que "hasta" no sea anterior a "desde"
|
|
353
|
+
y limita cada calendario según la otra fecha.
|
|
354
|
+
|
|
355
|
+
```tsx
|
|
356
|
+
import { DateRangePicker } from "@rubenpazch/ui";
|
|
357
|
+
```
|
|
358
|
+
|
|
359
|
+
| Prop | Tipo | Req. | Por defecto | Descripción |
|
|
360
|
+
| ----------- | -------------------------------- | ---- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------ |
|
|
361
|
+
| `onChange` | `(range: DateRange) => void` | sí | | |
|
|
362
|
+
| `value` | `DateRange` | sí | | |
|
|
363
|
+
| `className` | `string` | | | |
|
|
364
|
+
| `disabled` | `boolean` | | `false` | |
|
|
365
|
+
| `error` | `string` | | | Error externo; si no hay, se muestra el de orden cuando corresponde. |
|
|
366
|
+
| `hint` | `string` | | | |
|
|
367
|
+
| `label` | `string` | | | Título del grupo (se usa como `<legend>`). |
|
|
368
|
+
| `labels` | `Partial<DateRangePickerLabels>` | | | |
|
|
369
|
+
| `locale` | `string` | | | |
|
|
370
|
+
| `maxDate` | `string` | | | |
|
|
371
|
+
| `minDate` | `string` | | | |
|
|
372
|
+
| `presets` | `false \| DateRangePreset[]` | | `[ { label: "Hoy", range: (h) => rango(h, h) }, { label: "Últimos 7 días", range: (h) => rango(menos(h, 6), h) }, { label: "Últimos 30 días", range: (h) => rango(menos(h, 29), h) }, { label: "Este mes", range: (h) => rango( primerDia(h.getFullYear(), h.getMonth()), ultimoDia(h.getFullYear(), h.getMonth()), ), }, { label: "Mes anterior", range: (h) => rango( primerDia(h.getFullYear(), h.getMonth() - 1), ultimoDia(h.getFullYear(), h.getMonth() - 1), ), }, { label: "Este año", range: (h) => rango(new Date(h.getFullYear(), 0, 1), new Date(h.getFullYear(), 11, 31)), }, ]` | Atajos; `false` los oculta. Por defecto: hoy, 7/30 días, este mes, mes anterior, este año. |
|
|
373
|
+
| `required` | `boolean` | | `false` | |
|
|
374
|
+
| `today` | `Date` | | | Para pruebas: fecha que se toma como "hoy" en los atajos. |
|
|
375
|
+
|
|
376
|
+
#### DEFAULT_DATE_RANGE_LABELS
|
|
377
|
+
|
|
378
|
+
```tsx
|
|
379
|
+
import { DEFAULT_DATE_RANGE_LABELS } from "@rubenpazch/ui";
|
|
380
|
+
```
|
|
381
|
+
|
|
382
|
+
_Sin props documentadas._
|
|
383
|
+
|
|
384
|
+
#### DEFAULT_DATE_RANGE_PRESETS
|
|
385
|
+
|
|
386
|
+
Atajos habituales (fechas locales, sin corrimiento de zona horaria).
|
|
387
|
+
|
|
388
|
+
```tsx
|
|
389
|
+
import { DEFAULT_DATE_RANGE_PRESETS } from "@rubenpazch/ui";
|
|
390
|
+
```
|
|
391
|
+
|
|
392
|
+
_Sin props documentadas._
|
|
393
|
+
|
|
394
|
+
Otras exportaciones: `rangoValido`.
|
|
395
|
+
|
|
396
|
+
Tipos: `DateRange`, `DateRangePickerLabels`, `DateRangePickerProps`, `DateRangePreset`.
|
|
397
|
+
|
|
398
|
+
### @rubenpazch/file-upload
|
|
399
|
+
|
|
400
|
+
Zona para subir uno o varios archivos (arrastrar y soltar o elegir), con validación de tipo, tamaño y cantidad, y lista para quitarlos.
|
|
401
|
+
|
|
402
|
+
- **Usar cuando:** Adjuntar documentos o archivos en un formulario.
|
|
403
|
+
- **Evitar cuando:** Una sola imagen con vista previa (logo, foto): usa ImageUpload.
|
|
404
|
+
|
|
405
|
+
#### FileUpload
|
|
406
|
+
|
|
407
|
+
Zona para subir uno o varios archivos: arrastrar y soltar o "Elegir archivos" (teclado).
|
|
408
|
+
Valida tipo, tamaño, cantidad y duplicados; los rechazados se informan en la zona y por `onReject`.
|
|
409
|
+
No sube nada: entrega los `File` a la app, que decide cuándo y cómo enviarlos.
|
|
410
|
+
|
|
411
|
+
```tsx
|
|
412
|
+
import { FileUpload } from "@rubenpazch/ui";
|
|
413
|
+
```
|
|
414
|
+
|
|
415
|
+
| Prop | Tipo | Req. | Por defecto | Descripción |
|
|
416
|
+
| ----------- | --------------------------------------- | ---- | ----------- | ------------------------------------------------------------------------------------- |
|
|
417
|
+
| `onChange` | `(files: File[]) => void` | sí | | Nueva lista de archivos (agregados o quitados). |
|
|
418
|
+
| `value` | `File[]` | sí | | Archivos elegidos (controlado). |
|
|
419
|
+
| `accept` | `string` | | | Tipos aceptados como en `<input accept>`: ".pdf,.docx", "image/*", "application/pdf". |
|
|
420
|
+
| `className` | `string` | | | |
|
|
421
|
+
| `disabled` | `boolean` | | `false` | |
|
|
422
|
+
| `error` | `string` | | | Error externo (validación del formulario). |
|
|
423
|
+
| `hint` | `string` | | | |
|
|
424
|
+
| `id` | `string` | | | |
|
|
425
|
+
| `label` | `string` | | | |
|
|
426
|
+
| `labels` | `Partial<FileUploadLabels>` | | | |
|
|
427
|
+
| `maxFiles` | `number` | | | Máximo de archivos (por defecto sin límite). |
|
|
428
|
+
| `maxSizeMB` | `number` | | | Tamaño máximo por archivo en MB. |
|
|
429
|
+
| `multiple` | `boolean` | | `true` | Permitir varios archivos (por defecto sí). |
|
|
430
|
+
| `name` | `string` | | | |
|
|
431
|
+
| `onReject` | `(rejections: FileRejection[]) => void` | | | Archivos que no se aceptaron y por qué (para avisar o registrar). |
|
|
432
|
+
| `required` | `boolean` | | `false` | |
|
|
433
|
+
|
|
434
|
+
#### DEFAULT_FILE_UPLOAD_LABELS
|
|
435
|
+
|
|
436
|
+
```tsx
|
|
437
|
+
import { DEFAULT_FILE_UPLOAD_LABELS } from "@rubenpazch/ui";
|
|
438
|
+
```
|
|
439
|
+
|
|
440
|
+
_Sin props documentadas._
|
|
441
|
+
|
|
442
|
+
Otras exportaciones: `aceptaArchivo`.
|
|
443
|
+
|
|
444
|
+
Tipos: `FileRejection`, `FileUploadLabels`, `FileUploadProps`.
|
|
335
445
|
|
|
336
446
|
### @rubenpazch/form-field
|
|
337
447
|
|
|
@@ -714,42 +824,45 @@ Campo de texto con etiqueta, ayuda, advertencia, error, iconos y variantes.
|
|
|
714
824
|
import { TextInput } from "@rubenpazch/ui";
|
|
715
825
|
```
|
|
716
826
|
|
|
717
|
-
| Prop | Tipo | Req. | Por defecto
|
|
718
|
-
| ------------------------ | --------------------------------------------------------------- | ---- |
|
|
719
|
-
| `onChange` | `(value: string) => void` | sí |
|
|
720
|
-
| `value` | `string` | sí |
|
|
721
|
-
| `autoComplete` | `string` | |
|
|
722
|
-
| `className` | `string` | | ``
|
|
723
|
-
| `disabled` | `boolean` | | `false`
|
|
724
|
-
| `emailInvalidMessage` | `string` | |
|
|
725
|
-
| `emailSuggestionMessage` | `string` | |
|
|
726
|
-
| `emailValidMessage` | `string` | |
|
|
727
|
-
| `error` | `string` | |
|
|
728
|
-
| `hint` | `string` | |
|
|
729
|
-
| `icon` | `ReactNode` | |
|
|
730
|
-
| `id` | `string` | |
|
|
731
|
-
| `label` | `string` | |
|
|
732
|
-
| `
|
|
733
|
-
| `
|
|
734
|
-
| `
|
|
735
|
-
| `
|
|
736
|
-
| `
|
|
737
|
-
| `
|
|
738
|
-
| `
|
|
739
|
-
| `
|
|
740
|
-
| `
|
|
741
|
-
| `
|
|
742
|
-
| `
|
|
743
|
-
| `
|
|
744
|
-
| `
|
|
745
|
-
| `
|
|
746
|
-
| `
|
|
747
|
-
| `
|
|
748
|
-
| `
|
|
749
|
-
| `
|
|
750
|
-
| `
|
|
751
|
-
| `
|
|
752
|
-
| `
|
|
827
|
+
| Prop | Tipo | Req. | Por defecto | Descripción |
|
|
828
|
+
| ------------------------ | --------------------------------------------------------------- | ---- | ----------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
829
|
+
| `onChange` | `(value: string) => void` | sí | | |
|
|
830
|
+
| `value` | `string` | sí | | |
|
|
831
|
+
| `autoComplete` | `string` | | | |
|
|
832
|
+
| `className` | `string` | | `` | |
|
|
833
|
+
| `disabled` | `boolean` | | `false` | |
|
|
834
|
+
| `emailInvalidMessage` | `string` | | | |
|
|
835
|
+
| `emailSuggestionMessage` | `string` | | | |
|
|
836
|
+
| `emailValidMessage` | `string` | | | |
|
|
837
|
+
| `error` | `string` | | | |
|
|
838
|
+
| `hint` | `string` | | | |
|
|
839
|
+
| `icon` | `ReactNode` | | | |
|
|
840
|
+
| `id` | `string` | | | id del input; si no se pasa se genera uno (la etiqueta se asocia sola). |
|
|
841
|
+
| `label` | `string` | | | |
|
|
842
|
+
| `labelAction` | `ReactNode` | | | Contenido junto a la etiqueta, a la derecha: un botón de ayuda ("?"), un enlace ("¿Olvidaste tu contraseña?")… No va dentro del `<label>`. |
|
|
843
|
+
| `max` | `number` | | | |
|
|
844
|
+
| `maxLength` | `number` | | | |
|
|
845
|
+
| `min` | `number` | | | |
|
|
846
|
+
| `minLength` | `number` | | | |
|
|
847
|
+
| `minLengthMessage` | `string` | | | Inline error shown when the value is non-empty but shorter than `minLength`. |
|
|
848
|
+
| `name` | `string` | | | name del input (formularios nativos, react-hook-form…). |
|
|
849
|
+
| `onBlur` | `() => void` | | | |
|
|
850
|
+
| `onFocus` | `() => void` | | | |
|
|
851
|
+
| `onValidityChange` | `(isValid: boolean) => void` | | | Fires whenever the field's overall validity changes (respecting `required`, `validateEmail`, `minLength`, `maxLength`, `pattern` and `error`). Lets the parent gate a submit button on the component's own validation, without duplicating the rules. |
|
|
852
|
+
| `passwordToggleLabels` | `{ show: string; hide: string; }` | | `{ show: "Mostrar contraseña", hide: "Ocultar contraseña", }` | Textos del botón de contraseña (accesibilidad). |
|
|
853
|
+
| `pattern` | `string` | | | |
|
|
854
|
+
| `placeholder` | `string` | | | |
|
|
855
|
+
| `required` | `boolean` | | `false` | |
|
|
856
|
+
| `requiredMessage` | `string` | | | |
|
|
857
|
+
| `requirementsLabels` | `Partial<PasswordRequirementsLabels>` | | | |
|
|
858
|
+
| `showPasswordStrength` | `boolean` | | `false` | |
|
|
859
|
+
| `showPasswordToggle` | `boolean` | | `true` | Con `type="password"`, botón para ver u ocultar lo escrito. Por defecto true. |
|
|
860
|
+
| `step` | `number` | | | |
|
|
861
|
+
| `strengthLabelPrefix` | `string` | | | |
|
|
862
|
+
| `strengthLabels` | `Partial<Record<PasswordStrengthKey, string>>` | | | |
|
|
863
|
+
| `type` | `"number" \| "text" \| "email" \| "tel" \| "password" \| "url"` | | `text` | |
|
|
864
|
+
| `validateEmail` | `boolean` | | `false` | |
|
|
865
|
+
| `warning` | `string` | | | |
|
|
753
866
|
|
|
754
867
|
Tipos: `TextInputProps`, `TextInputNativeProps`.
|
|
755
868
|
|
|
@@ -788,6 +901,46 @@ import { Textarea } from "@rubenpazch/ui";
|
|
|
788
901
|
|
|
789
902
|
Tipos: `TextareaProps`.
|
|
790
903
|
|
|
904
|
+
### @rubenpazch/turnstile
|
|
905
|
+
|
|
906
|
+
Widget de Cloudflare Turnstile (anti-robots) para formularios públicos: carga el script una sola vez, entrega el token y se reinicia tras cada envío.
|
|
907
|
+
|
|
908
|
+
- **Usar cuando:** Login, registro, recuperación o cualquier formulario público que la API protege con Turnstile.
|
|
909
|
+
- **Evitar cuando:** Pantallas detrás de la sesión (el usuario ya está autenticado).
|
|
910
|
+
|
|
911
|
+
#### Turnstile
|
|
912
|
+
|
|
913
|
+
Verificación anti-robots de Cloudflare Turnstile para formularios públicos.
|
|
914
|
+
Requiere que la CSP permita `https://challenges.cloudflare.com` en script-src y frame-src.
|
|
915
|
+
|
|
916
|
+
```tsx
|
|
917
|
+
import { Turnstile } from "@rubenpazch/ui";
|
|
918
|
+
```
|
|
919
|
+
|
|
920
|
+
| Prop | Tipo | Req. | Por defecto | Descripción |
|
|
921
|
+
| ----------- | ------------------------------------- | ---- | ----------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
922
|
+
| `onToken` | `(token: string) => void` | sí | | Recibe el token, o "" cuando caduca o falla (deshabilita el envío mientras sea ""). El token se valida en el servidor y sirve una sola vez. |
|
|
923
|
+
| `siteKey` | `string` | sí | | Clave pública del sitio (NEXT_PUBLIC_TURNSTILE_SITE_KEY o la que entregue la API). |
|
|
924
|
+
| `action` | `string` | | | Acción del formulario ("login", "registro"…): el servidor puede exigir que coincida. |
|
|
925
|
+
| `className` | `string` | | | |
|
|
926
|
+
| `errorText` | `string` | | `No se pudo cargar la verificación anti-robots. Revisa tu conexión o desactiva bloqueadores y recarga la página.` | Mensaje si el widget no carga (red, bloqueadores). |
|
|
927
|
+
| `language` | `string` | | `es` | |
|
|
928
|
+
| `resetKey` | `number` | | `0` | Cambia este número después de cada envío para pedir un token nuevo. |
|
|
929
|
+
| `size` | `"normal" \| "flexible" \| "compact"` | | `flexible` | |
|
|
930
|
+
| `theme` | `"auto" \| "light" \| "dark"` | | `auto` | |
|
|
931
|
+
|
|
932
|
+
#### TURNSTILE_SCRIPT
|
|
933
|
+
|
|
934
|
+
```tsx
|
|
935
|
+
import { TURNSTILE_SCRIPT } from "@rubenpazch/ui";
|
|
936
|
+
```
|
|
937
|
+
|
|
938
|
+
_Sin props documentadas._
|
|
939
|
+
|
|
940
|
+
Otras exportaciones: `cargarTurnstile`.
|
|
941
|
+
|
|
942
|
+
Tipos: `TurnstileProps`.
|
|
943
|
+
|
|
791
944
|
## Navegación
|
|
792
945
|
|
|
793
946
|
### @rubenpazch/app-shell
|
|
@@ -1205,14 +1358,14 @@ Displays a loading indicator with multiple style variants
|
|
|
1205
1358
|
import { LoadingSpinner } from "@rubenpazch/ui";
|
|
1206
1359
|
```
|
|
1207
1360
|
|
|
1208
|
-
| Prop | Tipo | Req. | Por defecto | Descripción
|
|
1209
|
-
| ----------- | ------------------------------------------ | ---- | ----------- |
|
|
1210
|
-
| `className` | `string` | | `` |
|
|
1211
|
-
| `color` | `"
|
|
1212
|
-
| `inline` | `boolean` | | `false` |
|
|
1213
|
-
| `message` | `string` | | |
|
|
1214
|
-
| `size` | `"sm" \| "md" \| "lg"` | | `md` |
|
|
1215
|
-
| `variant` | `"spinner" \| "dots" \| "pulse" \| "ring"` | | `spinner` |
|
|
1361
|
+
| Prop | Tipo | Req. | Por defecto | Descripción |
|
|
1362
|
+
| ----------- | ------------------------------------------ | ---- | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
1363
|
+
| `className` | `string` | | `` | |
|
|
1364
|
+
| `color` | `"primary" \| "gray" \| "white" \| "blue"` | | `primary` | primary (por defecto): color de la marca (--lb-color-primary). gray: neutro. white: sobre fondos de color. "blue" es el nombre antiguo de "primary" (sigue funcionando). |
|
|
1365
|
+
| `inline` | `boolean` | | `false` | |
|
|
1366
|
+
| `message` | `string` | | | |
|
|
1367
|
+
| `size` | `"sm" \| "md" \| "lg"` | | `md` | |
|
|
1368
|
+
| `variant` | `"spinner" \| "dots" \| "pulse" \| "ring"` | | `spinner` | |
|
|
1216
1369
|
|
|
1217
1370
|
### @rubenpazch/modal
|
|
1218
1371
|
|
|
@@ -1565,6 +1718,33 @@ import { Chip } from "@rubenpazch/ui";
|
|
|
1565
1718
|
|
|
1566
1719
|
Tipos: `ChipVariant`, `ChipColor`, `ChipSize`, `ChipProps`.
|
|
1567
1720
|
|
|
1721
|
+
### @rubenpazch/description-list
|
|
1722
|
+
|
|
1723
|
+
Pares etiqueta/valor en columnas: resumen de un registro (datos de un trámite, de un cliente, de un pago).
|
|
1724
|
+
|
|
1725
|
+
- **Usar cuando:** Mostrar varios datos de solo lectura de un registro, con etiquetas.
|
|
1726
|
+
- **Evitar cuando:** Datos tabulares de muchos registros: usa DataTable. Una sola fila con icono: usa InfoRow.
|
|
1727
|
+
|
|
1728
|
+
#### DescriptionList
|
|
1729
|
+
|
|
1730
|
+
Pares etiqueta/valor de solo lectura (`<dl>`): resumen de un registro.
|
|
1731
|
+
|
|
1732
|
+
```tsx
|
|
1733
|
+
import { DescriptionList } from "@rubenpazch/ui";
|
|
1734
|
+
```
|
|
1735
|
+
|
|
1736
|
+
| Prop | Tipo | Req. | Por defecto | Descripción |
|
|
1737
|
+
| ------------ | ------------------- | ---- | ------------ | ----------------------------------------------------------------- |
|
|
1738
|
+
| `items` | `DescriptionItem[]` | sí | | |
|
|
1739
|
+
| `className` | `string` | | | |
|
|
1740
|
+
| `columns` | `1 \| 2 \| 3` | | `2` | Columnas en pantallas anchas (en móvil siempre 1). Por defecto 2. |
|
|
1741
|
+
| `emptyText` | `ReactNode` | | `Sin datos.` | Texto si no hay ningún dato. |
|
|
1742
|
+
| `emptyValue` | `ReactNode` | | `—` | Qué mostrar si un valor está vacío. |
|
|
1743
|
+
| `footnote` | `ReactNode` | | | Nota al pie (fuente de los datos, aclaraciones). |
|
|
1744
|
+
| `title` | `ReactNode` | | | Título opcional sobre la lista. |
|
|
1745
|
+
|
|
1746
|
+
Tipos: `DescriptionItem`, `DescriptionListProps`.
|
|
1747
|
+
|
|
1568
1748
|
### @rubenpazch/info-row
|
|
1569
1749
|
|
|
1570
1750
|
Fila de dato con icono, etiqueta y valor (variantes de color, tamaños, acción opcional).
|
|
@@ -1595,6 +1775,34 @@ import { InfoRow } from "@rubenpazch/ui";
|
|
|
1595
1775
|
| `size` | `"xs" \| "sm" \| "md" \| "lg"` | | `md` | |
|
|
1596
1776
|
| `variant` | `"default" \| "blue" \| "yellow" \| "purple" \| "green" \| "red" \| "indigo" \| "gray"` | | `default` | |
|
|
1597
1777
|
|
|
1778
|
+
### @rubenpazch/timeline
|
|
1779
|
+
|
|
1780
|
+
Línea de tiempo vertical: historial de un trámite, pedido o expediente (eventos con estado, fecha y descripción).
|
|
1781
|
+
|
|
1782
|
+
- **Usar cuando:** Mostrar el historial o seguimiento de algo en orden cronológico.
|
|
1783
|
+
- **Evitar cuando:** Pasos de un proceso que el usuario recorre ahora: usa Stepper.
|
|
1784
|
+
|
|
1785
|
+
#### Timeline
|
|
1786
|
+
|
|
1787
|
+
Línea de tiempo vertical: historial de un trámite, pedido o expediente, en orden.
|
|
1788
|
+
Genérica: el significado de cada estado lo decide la app (p. ej. un envoltorio local que
|
|
1789
|
+
convierte los estados del trámite en `items`).
|
|
1790
|
+
|
|
1791
|
+
```tsx
|
|
1792
|
+
import { Timeline } from "@rubenpazch/ui";
|
|
1793
|
+
```
|
|
1794
|
+
|
|
1795
|
+
| Prop | Tipo | Req. | Por defecto | Descripción |
|
|
1796
|
+
| --------------- | ---------------- | ---- | ---------------------- | ------------------------------------------------------------------- |
|
|
1797
|
+
| `items` | `TimelineItem[]` | sí | | |
|
|
1798
|
+
| `aria-label` | `string` | | | Nombre accesible de la lista, p. ej. "Historial del trámite". |
|
|
1799
|
+
| `className` | `string` | | | |
|
|
1800
|
+
| `dense` | `boolean` | | `false` | Más compacto (menos espacio entre eventos). |
|
|
1801
|
+
| `emptyText` | `ReactNode` | | `Sin eventos todavía.` | Texto cuando no hay eventos. |
|
|
1802
|
+
| `highlightLast` | `boolean` | | `false` | El último evento se marca como el estado actual (anillo y negrita). |
|
|
1803
|
+
|
|
1804
|
+
Tipos: `TimelineItem`, `TimelineProps`, `TimelineStatus`.
|
|
1805
|
+
|
|
1598
1806
|
### @rubenpazch/tooltip
|
|
1599
1807
|
|
|
1600
1808
|
Texto de ayuda breve al pasar el mouse o enfocar con teclado (role="tooltip", aria-describedby), se cierra con Escape.
|