@rubenpazch/ui 0.5.1 → 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 +47 -1
- package/dist/index.cjs.js +70 -0
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +9 -2
- package/dist/index.esm.js +9 -2
- package/dist/index.esm.js.map +1 -1
- package/docs/COMPONENTES.md +426 -99
- package/docs/catalogo.json +806 -25
- package/package.json +49 -42
package/docs/COMPONENTES.md
CHANGED
|
@@ -17,6 +17,7 @@ librería (ver AGENTS.md del repo lbyte-ui-library), no lo copies en la app.
|
|
|
17
17
|
| ----------------------------------------------------------------------- | -------------------------- | ----------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
18
18
|
| [`@rubenpazch/alert`](#rubenpazchalert) | Retroalimentación | Alert | Aviso dentro de la página (info, success, warning, danger) con título, acción y cierre opcional. |
|
|
19
19
|
| [`@rubenpazch/app-shell`](#rubenpazchapp-shell) | Navegación | AppShell | Estructura completa de un panel: Sidebar colapsable, cabecera fija con botón ☰ en móvil, título y acciones, enlace "Saltar al contenido" y área principal con ancho máximo. |
|
|
20
|
+
| [`@rubenpazch/auth-gate`](#rubenpazchauth-gate) | Navegación | AuthGate, AuthScreen | Puerta de sesión: comprueba el token, confirma con el servidor (/me) y solo entonces pinta la app; mientras, una pantalla neutra. Sin sesión, va al login sin mostrar nada. |
|
|
20
21
|
| [`@rubenpazch/autocomplete`](#rubenpazchautocomplete) | Formularios | Autocomplete | Selector con búsqueda sobre una lista de opciones (con descripción, carga y opción de limpiar). |
|
|
21
22
|
| [`@rubenpazch/avatar`](#rubenpazchavatar) | Presentación de datos | Avatar, AvatarGroup | Avatar de persona (imagen, iniciales o icono) y AvatarGroup para varios. |
|
|
22
23
|
| [`@rubenpazch/badge`](#rubenpazchbadge) | Presentación de datos | Badge | Insignia de estado o categoría (Pagado, Vencido, Borrador) con colores semánticos, variantes soft/solid/outline y punto. |
|
|
@@ -28,9 +29,12 @@ librería (ver AGENTS.md del repo lbyte-ui-library), no lo copies en la app.
|
|
|
28
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. |
|
|
29
30
|
| [`@rubenpazch/date-input`](#rubenpazchdate-input) | Formularios | DateInput | Campo de fecha con formato local, mínimo/máximo, ayuda y error. |
|
|
30
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). |
|
|
31
34
|
| [`@rubenpazch/draggable-list`](#rubenpazchdraggable-list) | Datos | DraggableList | Lista reordenable arrastrando (también con teclado), basada en dnd-kit. |
|
|
32
35
|
| [`@rubenpazch/drawer`](#rubenpazchdrawer) | Navegación | Drawer | Panel lateral (izquierda/derecha/arriba/abajo) con animación y fondo. |
|
|
33
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. |
|
|
34
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). |
|
|
35
39
|
| [`@rubenpazch/icon-button`](#rubenpazchicon-button) | Acciones | IconButton | Botón de solo icono con variantes, formas, tooltip y etiqueta accesible. |
|
|
36
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). |
|
|
@@ -63,9 +67,12 @@ librería (ver AGENTS.md del repo lbyte-ui-library), no lo copies en la app.
|
|
|
63
67
|
| [`@rubenpazch/tabs`](#rubenpazchtabs) | Navegación | Tabs | Pestañas para alternar entre secciones de una misma vista. |
|
|
64
68
|
| [`@rubenpazch/text-input`](#rubenpazchtext-input) | Formularios | TextInput | Campo de texto con etiqueta, ayuda, advertencia, error, iconos y variantes. |
|
|
65
69
|
| [`@rubenpazch/textarea`](#rubenpazchtextarea) | Formularios | Textarea | Área de texto con etiqueta, ayuda, advertencia, error, contador de caracteres y crecimiento automático. |
|
|
66
|
-
| [`@rubenpazch/
|
|
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). |
|
|
71
|
+
| [`@rubenpazch/toast`](#rubenpazchtoast) | Retroalimentación | ToastBanner, ToastProvider, ToastRegion, useToast | Notificaciones temporales (Toast) y avisos fijos (ToastBanner) con tipos y acciones. |
|
|
67
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. |
|
|
68
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. |
|
|
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ú ⋮. |
|
|
69
76
|
|
|
70
77
|
## Base (tokens y utilidades)
|
|
71
78
|
|
|
@@ -76,7 +83,7 @@ Utilidades (classList) y tipos comunes; la usan internamente los componentes.
|
|
|
76
83
|
- **Usar cuando:** Solo si construyes un componente nuevo dentro de la librería.
|
|
77
84
|
- **Evitar cuando:** En las apps: no hace falta importarla.
|
|
78
85
|
|
|
79
|
-
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`.
|
|
80
87
|
|
|
81
88
|
Tipos: `Size`, `Color`, `Variant`, `ComponentSize`, `LegacySize`, `SizeProp`, `FieldProps`, `FieldIds`.
|
|
82
89
|
|
|
@@ -279,23 +286,24 @@ Campo de fecha con calendario desplegable. Se escribe en el formato del idioma
|
|
|
279
286
|
import { DateInput } from "@rubenpazch/ui";
|
|
280
287
|
```
|
|
281
288
|
|
|
282
|
-
| Prop
|
|
283
|
-
|
|
|
284
|
-
| `onChange`
|
|
285
|
-
| `value`
|
|
286
|
-
| `className`
|
|
287
|
-
| `disabled`
|
|
288
|
-
| `error`
|
|
289
|
-
| `hint`
|
|
290
|
-
| `id`
|
|
291
|
-
| `label`
|
|
292
|
-
| `labels`
|
|
293
|
-
| `locale`
|
|
294
|
-
| `maxDate`
|
|
295
|
-
| `minDate`
|
|
296
|
-
| `
|
|
297
|
-
| `
|
|
298
|
-
| `
|
|
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. |
|
|
299
307
|
|
|
300
308
|
### @rubenpazch/date-picker
|
|
301
309
|
|
|
@@ -312,24 +320,128 @@ Selector de fecha con calendario (días, meses y años). Devuelve ISO `AAAA-MM-D
|
|
|
312
320
|
import { DatePicker } from "@rubenpazch/ui";
|
|
313
321
|
```
|
|
314
322
|
|
|
315
|
-
| Prop | Tipo | Req. | Por defecto | Descripción
|
|
316
|
-
| ------------------- | ------------------------ | ---- | ----------- |
|
|
317
|
-
| `onChange` | `(date: string) => void` | sí | |
|
|
318
|
-
| `value` | `string` | sí | |
|
|
319
|
-
| `className` | `string` | | `` |
|
|
320
|
-
| `disabled` | `boolean` | | `false` |
|
|
321
|
-
| `error` | `string` | | |
|
|
322
|
-
| `hint` | `string` | | |
|
|
323
|
-
| `id` | `string` | | | id del input; si no se pasa se genera uno (la etiqueta se asocia sola).
|
|
324
|
-
| `label` | `string` | | |
|
|
325
|
-
| `locale` | `string` | | `es` |
|
|
326
|
-
| `maxDate` | `string` | | |
|
|
327
|
-
| `minDate` | `string` | | |
|
|
328
|
-
| `
|
|
329
|
-
| `
|
|
330
|
-
| `
|
|
331
|
-
| `
|
|
332
|
-
| `
|
|
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`.
|
|
333
445
|
|
|
334
446
|
### @rubenpazch/form-field
|
|
335
447
|
|
|
@@ -712,42 +824,45 @@ Campo de texto con etiqueta, ayuda, advertencia, error, iconos y variantes.
|
|
|
712
824
|
import { TextInput } from "@rubenpazch/ui";
|
|
713
825
|
```
|
|
714
826
|
|
|
715
|
-
| Prop | Tipo | Req. | Por defecto
|
|
716
|
-
| ------------------------ | --------------------------------------------------------------- | ---- |
|
|
717
|
-
| `onChange` | `(value: string) => void` | sí |
|
|
718
|
-
| `value` | `string` | sí |
|
|
719
|
-
| `autoComplete` | `string` | |
|
|
720
|
-
| `className` | `string` | | ``
|
|
721
|
-
| `disabled` | `boolean` | | `false`
|
|
722
|
-
| `emailInvalidMessage` | `string` | |
|
|
723
|
-
| `emailSuggestionMessage` | `string` | |
|
|
724
|
-
| `emailValidMessage` | `string` | |
|
|
725
|
-
| `error` | `string` | |
|
|
726
|
-
| `hint` | `string` | |
|
|
727
|
-
| `icon` | `ReactNode` | |
|
|
728
|
-
| `id` | `string` | |
|
|
729
|
-
| `label` | `string` | |
|
|
730
|
-
| `
|
|
731
|
-
| `
|
|
732
|
-
| `
|
|
733
|
-
| `
|
|
734
|
-
| `
|
|
735
|
-
| `
|
|
736
|
-
| `
|
|
737
|
-
| `
|
|
738
|
-
| `
|
|
739
|
-
| `
|
|
740
|
-
| `
|
|
741
|
-
| `
|
|
742
|
-
| `
|
|
743
|
-
| `
|
|
744
|
-
| `
|
|
745
|
-
| `
|
|
746
|
-
| `
|
|
747
|
-
| `
|
|
748
|
-
| `
|
|
749
|
-
| `
|
|
750
|
-
| `
|
|
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` | | | |
|
|
751
866
|
|
|
752
867
|
Tipos: `TextInputProps`, `TextInputNativeProps`.
|
|
753
868
|
|
|
@@ -786,6 +901,46 @@ import { Textarea } from "@rubenpazch/ui";
|
|
|
786
901
|
|
|
787
902
|
Tipos: `TextareaProps`.
|
|
788
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
|
+
|
|
789
944
|
## Navegación
|
|
790
945
|
|
|
791
946
|
### @rubenpazch/app-shell
|
|
@@ -804,26 +959,76 @@ Es la base de todas las pantallas de administración.
|
|
|
804
959
|
import { AppShell } from "@rubenpazch/ui";
|
|
805
960
|
```
|
|
806
961
|
|
|
807
|
-
| Prop | Tipo | Req. | Por defecto | Descripción
|
|
808
|
-
| ------------------- | ------------------------------------------------------- | ---- | ----------- |
|
|
809
|
-
| `children` | `ReactNode` | sí | | Contenido de la página.
|
|
810
|
-
| `sections` | `SidebarSection[]` | sí | | Secciones del menú.
|
|
811
|
-
| `brand` | `ReactNode` | | | Logo o nombre de la app arriba.
|
|
812
|
-
| `brandCollapsed` | `ReactNode` | | | Versión compacta del logo para el modo colapsado (por defecto se oculta `brand`).
|
|
813
|
-
| `collapsed` | `boolean` | | | Colapsado (controlado).
|
|
814
|
-
| `currentPath` | `string` | | | Ruta actual (p. ej. usePathname() de Next) para marcar la opción activa.
|
|
815
|
-
| `defaultCollapsed` | `boolean` | | | Colapsado inicial (no controlado).
|
|
816
|
-
| `headerActions` | `ReactNode` | | | Acciones a la derecha de la cabecera: notificaciones, usuario.
|
|
817
|
-
| `labels` | `Partial<{ openMenu: string; skipToContent: string; }>` | | | Textos accesibles.
|
|
818
|
-
| `linkComponent` | `ElementType<any, keyof IntrinsicElements>` | | | Componente de enlace (Link de Next.js). Por defecto <a>.
|
|
819
|
-
| `
|
|
820
|
-
| `
|
|
821
|
-
| `
|
|
822
|
-
| `
|
|
823
|
-
| `
|
|
962
|
+
| Prop | Tipo | Req. | Por defecto | Descripción |
|
|
963
|
+
| ------------------- | ------------------------------------------------------- | ---- | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
964
|
+
| `children` | `ReactNode` | sí | | Contenido de la página. |
|
|
965
|
+
| `sections` | `SidebarSection[]` | sí | | Secciones del menú. |
|
|
966
|
+
| `brand` | `ReactNode` | | | Logo o nombre de la app arriba. |
|
|
967
|
+
| `brandCollapsed` | `ReactNode` | | | Versión compacta del logo para el modo colapsado (por defecto se oculta `brand`). |
|
|
968
|
+
| `collapsed` | `boolean` | | | Colapsado (controlado). |
|
|
969
|
+
| `currentPath` | `string` | | | Ruta actual (p. ej. usePathname() de Next) para marcar la opción activa. |
|
|
970
|
+
| `defaultCollapsed` | `boolean` | | | Colapsado inicial (no controlado). |
|
|
971
|
+
| `headerActions` | `ReactNode` | | | Acciones a la derecha de la cabecera: notificaciones, usuario. |
|
|
972
|
+
| `labels` | `Partial<{ openMenu: string; skipToContent: string; }>` | | | Textos accesibles. |
|
|
973
|
+
| `linkComponent` | `ElementType<any, keyof IntrinsicElements>` | | | Componente de enlace (Link de Next.js). Por defecto <a>. |
|
|
974
|
+
| `loading` | `boolean` | | `false` | Carga del contenido al cambiar de pantalla: solo el área de contenido muestra el indicador (el menú y la cabecera no cambian). Los hijos siguen montados, atenuados y sin interacción. |
|
|
975
|
+
| `loadingLabel` | `string` | | `Cargando…` | Texto accesible de la carga. |
|
|
976
|
+
| `maxWidth` | `"none" \| "md" \| "lg"` | | `lg` | Ancho máximo del contenido: none, lg (72rem, por defecto) o md (56rem). |
|
|
977
|
+
| `onCollapsedChange` | `(collapsed: boolean) => void` | | | Al colapsar o expandir. |
|
|
978
|
+
| `sidebarFooter` | `ReactNode` | | | Contenido al pie de la barra lateral (usuario, "Cerrar sesión"). |
|
|
979
|
+
| `storageKey` | `string` | | | Clave de localStorage para recordar si estaba colapsado. |
|
|
980
|
+
| `title` | `ReactNode` | | | Título en la cabecera (en móvil se ve junto al botón ☰). |
|
|
981
|
+
| `toasts` | `boolean` | | `true` | Incluye `ToastProvider`: dentro del panel, `useToast()` muestra los mensajes del servidor como toast bajo la cabecera. Pon `false` solo si la app ya tiene su propio proveedor más arriba. |
|
|
824
982
|
|
|
825
983
|
Tipos: `AppShellProps`.
|
|
826
984
|
|
|
985
|
+
### @rubenpazch/auth-gate
|
|
986
|
+
|
|
987
|
+
Puerta de sesión: comprueba el token, confirma con el servidor (/me) y solo entonces pinta la app; mientras, una pantalla neutra. Sin sesión, va al login sin mostrar nada.
|
|
988
|
+
|
|
989
|
+
- **Usar cuando:** Raíz de toda app con sesión (paneles, módulos), envolviendo AppShell.
|
|
990
|
+
- **Evitar cuando:** Pantallas públicas (login, registro, landing).
|
|
991
|
+
|
|
992
|
+
#### AuthGate
|
|
993
|
+
|
|
994
|
+
Puerta de sesión para la raíz de toda app con sesión (decisión 0006 de lbyte-contexto):
|
|
995
|
+
|
|
996
|
+
1. sin token → al login sin pintar nada de la app;
|
|
997
|
+
2. con token → pantalla neutra mientras `verify()` (/me) confirma;
|
|
998
|
+
3. confirmada → pinta la app; rechazada → al login.
|
|
999
|
+
Un 401 posterior (`logoutEvent`) oculta la app y va al login.
|
|
1000
|
+
|
|
1001
|
+
Es experiencia de usuario, no seguridad: la API sigue respondiendo 401.
|
|
1002
|
+
|
|
1003
|
+
```tsx
|
|
1004
|
+
import { AuthGate } from "@rubenpazch/ui";
|
|
1005
|
+
```
|
|
1006
|
+
|
|
1007
|
+
| Prop | Tipo | Req. | Por defecto | Descripción |
|
|
1008
|
+
| ------------------- | ------------------------- | ---- | ------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
1009
|
+
| `children` | `ReactNode` | sí | | La app; recibe lo que devolvió `verify` (usuario, permisos…). |
|
|
1010
|
+
| `hasSession` | `() => boolean` | sí | | Comprobación local inmediata (sin red): ¿hay token o cookie de sesión y no está vencido? Si devuelve false se va al login sin pintar nada de la app. |
|
|
1011
|
+
| `onUnauthenticated` | `() => void` | sí | | Ir al login (p. ej. `window.location.href = AUTH_URL`). |
|
|
1012
|
+
| `verify` | `() => Promise<T>` | sí | | Confirma la sesión con el servidor (p. ej. `GET /me`). Si rechaza, se va al login. |
|
|
1013
|
+
| `brand` | `ReactNode` | | | Marca de la organización sobre el texto (logo o nombre). |
|
|
1014
|
+
| `labels` | `Partial<AuthGateLabels>` | | | Textos; por defecto en español. |
|
|
1015
|
+
| `logoutEvent` | `string \| false` | | `auth:logout` | Evento global que indica que la sesión terminó (un 401 a mitad de uso). Al recibirlo se oculta la app tras la pantalla neutra y se va al login. Por defecto "auth:logout". |
|
|
1016
|
+
|
|
1017
|
+
#### AuthScreen
|
|
1018
|
+
|
|
1019
|
+
Pantalla neutra a pantalla completa: sin datos ni estructura de la app.
|
|
1020
|
+
|
|
1021
|
+
```tsx
|
|
1022
|
+
import { AuthScreen } from "@rubenpazch/ui";
|
|
1023
|
+
```
|
|
1024
|
+
|
|
1025
|
+
| Prop | Tipo | Req. | Por defecto | Descripción |
|
|
1026
|
+
| ------- | ----------- | ---- | ----------- | ----------- |
|
|
1027
|
+
| `label` | `string` | sí | | |
|
|
1028
|
+
| `brand` | `ReactNode` | | | |
|
|
1029
|
+
|
|
1030
|
+
Tipos: `AuthGateProps`, `AuthGateLabels`.
|
|
1031
|
+
|
|
827
1032
|
### @rubenpazch/drawer
|
|
828
1033
|
|
|
829
1034
|
Panel lateral (izquierda/derecha/arriba/abajo) con animación y fondo.
|
|
@@ -1153,14 +1358,14 @@ Displays a loading indicator with multiple style variants
|
|
|
1153
1358
|
import { LoadingSpinner } from "@rubenpazch/ui";
|
|
1154
1359
|
```
|
|
1155
1360
|
|
|
1156
|
-
| Prop | Tipo | Req. | Por defecto | Descripción
|
|
1157
|
-
| ----------- | ------------------------------------------ | ---- | ----------- |
|
|
1158
|
-
| `className` | `string` | | `` |
|
|
1159
|
-
| `color` | `"
|
|
1160
|
-
| `inline` | `boolean` | | `false` |
|
|
1161
|
-
| `message` | `string` | | |
|
|
1162
|
-
| `size` | `"sm" \| "md" \| "lg"` | | `md` |
|
|
1163
|
-
| `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` | |
|
|
1164
1369
|
|
|
1165
1370
|
### @rubenpazch/modal
|
|
1166
1371
|
|
|
@@ -1318,7 +1523,39 @@ import { ToastBanner } from "@rubenpazch/ui";
|
|
|
1318
1523
|
| `className` | `string` | | | |
|
|
1319
1524
|
| `closeAriaLabel` | `string` | | `Cerrar notificación` | |
|
|
1320
1525
|
|
|
1321
|
-
|
|
1526
|
+
#### ToastProvider
|
|
1527
|
+
|
|
1528
|
+
Mensajes del servidor dentro de la app (usuario con sesión). `AppShell` ya lo incluye y los
|
|
1529
|
+
muestra bajo su cabecera; úsalo directamente solo en un layout propio.
|
|
1530
|
+
|
|
1531
|
+
En pantallas públicas (login, registro, recuperación) NO se usa: ahí el mensaje va junto al
|
|
1532
|
+
formulario. Por eso `useToast()` falla fuera de un proveedor.
|
|
1533
|
+
|
|
1534
|
+
```tsx
|
|
1535
|
+
import { ToastProvider } from "@rubenpazch/ui";
|
|
1536
|
+
```
|
|
1537
|
+
|
|
1538
|
+
| Prop | Tipo | Req. | Por defecto | Descripción |
|
|
1539
|
+
| ---------------- | ------------------------ | ---- | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
1540
|
+
| `closeAriaLabel` | `string` | | `Cerrar mensaje` | Texto accesible del botón ×. |
|
|
1541
|
+
| `offsetTop` | `string` | | | Distancia desde arriba en modo `floating`. |
|
|
1542
|
+
| `placement` | `"floating" \| "inline"` | | `floating` | `floating` (por defecto): flotan arriba a la derecha. `inline`: no se pintan aquí; el layout pone `<ToastRegion />` en su sitio (AppShell lo hace bajo su cabecera, sin tapar el menú ni el contenido). |
|
|
1543
|
+
|
|
1544
|
+
#### ToastRegion
|
|
1545
|
+
|
|
1546
|
+
Pinta los toasts de un `ToastProvider placement="inline"` en el lugar del layout donde se ponga.
|
|
1547
|
+
|
|
1548
|
+
```tsx
|
|
1549
|
+
import { ToastRegion } from "@rubenpazch/ui";
|
|
1550
|
+
```
|
|
1551
|
+
|
|
1552
|
+
| Prop | Tipo | Req. | Por defecto | Descripción |
|
|
1553
|
+
| ----------- | -------- | ---- | ----------- | ----------- |
|
|
1554
|
+
| `className` | `string` | | | |
|
|
1555
|
+
|
|
1556
|
+
Otras exportaciones: `useToast`.
|
|
1557
|
+
|
|
1558
|
+
Tipos: `ToastAction`, `ToastBannerProps`, `ToastItem`, `ToastType`, `ToastApi`, `ToastOptions`, `ToastProviderProps`.
|
|
1322
1559
|
|
|
1323
1560
|
## Presentación de datos
|
|
1324
1561
|
|
|
@@ -1481,6 +1718,33 @@ import { Chip } from "@rubenpazch/ui";
|
|
|
1481
1718
|
|
|
1482
1719
|
Tipos: `ChipVariant`, `ChipColor`, `ChipSize`, `ChipProps`.
|
|
1483
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
|
+
|
|
1484
1748
|
### @rubenpazch/info-row
|
|
1485
1749
|
|
|
1486
1750
|
Fila de dato con icono, etiqueta y valor (variantes de color, tamaños, acción opcional).
|
|
@@ -1511,6 +1775,34 @@ import { InfoRow } from "@rubenpazch/ui";
|
|
|
1511
1775
|
| `size` | `"xs" \| "sm" \| "md" \| "lg"` | | `md` | |
|
|
1512
1776
|
| `variant` | `"default" \| "blue" \| "yellow" \| "purple" \| "green" \| "red" \| "indigo" \| "gray"` | | `default` | |
|
|
1513
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
|
+
|
|
1514
1806
|
### @rubenpazch/tooltip
|
|
1515
1807
|
|
|
1516
1808
|
Texto de ayuda breve al pasar el mouse o enfocar con teclado (role="tooltip", aria-describedby), se cierra con Escape.
|
|
@@ -1536,6 +1828,41 @@ import { Tooltip } from "@rubenpazch/ui";
|
|
|
1536
1828
|
|
|
1537
1829
|
Tipos: `TooltipProps`.
|
|
1538
1830
|
|
|
1831
|
+
### @rubenpazch/user-card
|
|
1832
|
+
|
|
1833
|
+
Tarjeta de una persona (usuario, socio, cliente): avatar, nombre, correo u otro dato, etiquetas y acciones; las secundarias van en un menú ⋮.
|
|
1834
|
+
|
|
1835
|
+
- **Usar cuando:** Listas de personas en cuadrícula: usuarios de un panel, socios, clientes, pacientes.
|
|
1836
|
+
- **Evitar cuando:** Listas largas o con muchas columnas para comparar: usa DataTable.
|
|
1837
|
+
|
|
1838
|
+
#### UserCard
|
|
1839
|
+
|
|
1840
|
+
Tarjeta de una persona: avatar, nombre, dato secundario, etiquetas y acciones.
|
|
1841
|
+
Las acciones principales se ven en el pie; las secundarias van en un menú ⋮ para que la
|
|
1842
|
+
tarjeta no se llene de botones.
|
|
1843
|
+
|
|
1844
|
+
```tsx
|
|
1845
|
+
import { UserCard } from "@rubenpazch/ui";
|
|
1846
|
+
```
|
|
1847
|
+
|
|
1848
|
+
| Prop | Tipo | Req. | Por defecto | Descripción |
|
|
1849
|
+
| ----------- | ---------------------------- | ---- | ----------- | ---------------------------------------------------------------------- |
|
|
1850
|
+
| `name` | `string` | sí | | Nombre visible. |
|
|
1851
|
+
| `actions` | `ReactNode` | | | Acciones principales visibles en el pie (una o dos `Button`). |
|
|
1852
|
+
| `as` | `"article" \| "li" \| "div"` | | `article` | |
|
|
1853
|
+
| `avatarSrc` | `string` | | | Foto. Sin ella se muestran las iniciales del nombre. |
|
|
1854
|
+
| `badges` | `ReactNode` | | | Etiquetas (normalmente `Badge`): rol, estado, módulos… |
|
|
1855
|
+
| `children` | `ReactNode` | | | Contenido extra entre las etiquetas y el pie. |
|
|
1856
|
+
| `className` | `string` | | | |
|
|
1857
|
+
| `menuItems` | `MenuItem[]` | | | Acciones secundarias en el menú ⋮ (editar contraseña, eliminar…). |
|
|
1858
|
+
| `menuLabel` | `string` | | | Texto accesible del botón ⋮. Por defecto "Más acciones para <nombre>". |
|
|
1859
|
+
| `muted` | `boolean` | | `false` | Atenúa la tarjeta (p. ej. usuario inactivo). |
|
|
1860
|
+
| `subtitle` | `ReactNode` | | | Dato secundario bajo el nombre: correo, documento, cargo… |
|
|
1861
|
+
|
|
1862
|
+
Otras exportaciones: `initials`.
|
|
1863
|
+
|
|
1864
|
+
Tipos: `UserCardProps`.
|
|
1865
|
+
|
|
1539
1866
|
## Datos
|
|
1540
1867
|
|
|
1541
1868
|
### @rubenpazch/data-table
|