@rubenpazch/ui 0.16.0 → 0.18.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 +27 -4
- package/dist/index.cjs.js +48 -0
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.esm.js +2 -2
- package/docs/COMPONENTES.md +586 -545
- package/docs/catalogo.json +288 -63
- package/package.json +62 -61
package/docs/COMPONENTES.md
CHANGED
|
@@ -13,73 +13,73 @@ librería (ver AGENTS.md del repo lbyte-ui-library), no lo copies en la app.
|
|
|
13
13
|
|
|
14
14
|
## Índice
|
|
15
15
|
|
|
16
|
-
| Paquete | Categoría | Exporta
|
|
17
|
-
| ----------------------------------------------------------------------- | -------------------------- |
|
|
18
|
-
| [`@rubenpazch/alert`](#rubenpazchalert) | Retroalimentación | Alert
|
|
19
|
-
| [`@rubenpazch/app-shell`](#rubenpazchapp-shell) | Navegación | AppShell
|
|
20
|
-
| [`@rubenpazch/auth-gate`](#rubenpazchauth-gate) | Navegación | AuthGate, AuthScreen
|
|
21
|
-
| [`@rubenpazch/autocomplete`](#rubenpazchautocomplete) | Formularios | Autocomplete
|
|
22
|
-
| [`@rubenpazch/avatar`](#rubenpazchavatar) | Presentación de datos | Avatar, AvatarGroup
|
|
23
|
-
| [`@rubenpazch/badge`](#rubenpazchbadge) | Presentación de datos | Badge
|
|
24
|
-
| [`@rubenpazch/bottom-navigation`](#rubenpazchbottom-navigation) | Navegación | BottomNavigation
|
|
25
|
-
| [`@rubenpazch/button`](#rubenpazchbutton) | Acciones | Button
|
|
26
|
-
| [`@rubenpazch/card`](#rubenpazchcard) | Presentación de datos | Card, CardHeader, CardBody, CardFooter
|
|
27
|
-
| [`@rubenpazch/checkbox-input`](#rubenpazchcheckbox-input) | Formularios | CheckboxInput, CheckboxGroup
|
|
28
|
-
| [`@rubenpazch/chip`](#rubenpazchchip) | Presentación de datos | Chip
|
|
29
|
-
| [`@rubenpazch/collapsible`](#rubenpazchcollapsible) | Presentación de datos | Collapsible
|
|
30
|
-
| [`@rubenpazch/confirmation-dialog`](#rubenpazchconfirmation-dialog) | Retroalimentación | ConfirmationDialog
|
|
31
|
-
| [`@rubenpazch/data-table`](#rubenpazchdata-table) | Datos | DataTable
|
|
32
|
-
| [`@rubenpazch/date-input`](#rubenpazchdate-input) | Formularios | DateInput
|
|
33
|
-
| [`@rubenpazch/date-picker`](#rubenpazchdate-picker) | Formularios | DatePicker
|
|
34
|
-
| [`@rubenpazch/date-range-picker`](#rubenpazchdate-range-picker) | Formularios | DateRangePicker, DEFAULT_DATE_RANGE_LABELS, DEFAULT_DATE_RANGE_PRESETS, rangoValido
|
|
35
|
-
| [`@rubenpazch/description-list`](#rubenpazchdescription-list) | Presentación de datos | DescriptionList
|
|
36
|
-
| [`@rubenpazch/draggable-list`](#rubenpazchdraggable-list) | Datos | DraggableList
|
|
37
|
-
| [`@rubenpazch/drawer`](#rubenpazchdrawer) | Navegación | Drawer
|
|
38
|
-
| [`@rubenpazch/empty-state`](#rubenpazchempty-state) | Retroalimentación | EmptyState
|
|
39
|
-
| [`@rubenpazch/file-upload`](#rubenpazchfile-upload) | Formularios | FileUpload, DEFAULT_FILE_UPLOAD_LABELS, aceptaArchivo
|
|
40
|
-
| [`@rubenpazch/form-field`](#rubenpazchform-field) | Formularios | FormField, FormRow, FormActions
|
|
41
|
-
| [`@rubenpazch/icon-button`](#rubenpazchicon-button) | Acciones | IconButton
|
|
42
|
-
| [`@rubenpazch/icons`](#rubenpazchicons) | Iconos | ArrowDetailsIcon, ArchiveIcon, BrandingIcon, BusinessPlanIcon, CalendarIcon, CheckIcon, …
|
|
43
|
-
| [`@rubenpazch/identification-input`](#rubenpazchidentification-input) | Salud (pacientes y óptica) | IdentificationInput, DEFAULT_IDENTIFICATION_LABELS
|
|
44
|
-
| [`@rubenpazch/image-upload`](#rubenpazchimage-upload) | Formularios | ImageUpload, DEFAULT_IMAGE_UPLOAD_LABELS
|
|
45
|
-
| [`@rubenpazch/image-viewer`](#rubenpazchimage-viewer) | Presentación de datos | ImageViewer, DEFAULT_IMAGE_VIEWER_LABELS
|
|
46
|
-
| [`@rubenpazch/info-row`](#rubenpazchinfo-row) | Presentación de datos | InfoRow
|
|
47
|
-
| [`@rubenpazch/layout`](#rubenpazchlayout) | Maquetación (layout) | Flex, Stack, Inline, Spacer, Grid, GridItem, …
|
|
48
|
-
| [`@rubenpazch/list`](#rubenpazchlist) | Presentación de datos | List, ListItem
|
|
49
|
-
| [`@rubenpazch/loading-spinner`](#rubenpazchloading-spinner) | Retroalimentación | LoadingSpinner
|
|
50
|
-
| [`@rubenpazch/menu`](#rubenpazchmenu) | Acciones | Menu
|
|
51
|
-
| [`@rubenpazch/modal`](#rubenpazchmodal) | Retroalimentación | Modal
|
|
52
|
-
| [`@rubenpazch/money-input`](#rubenpazchmoney-input) | Formularios | MoneyInput, formatMoney
|
|
53
|
-
| [`@rubenpazch/month-navigator`](#rubenpazchmonth-navigator) | Navegación | MonthNavigator, addMonths, currentMonth
|
|
54
|
-
| [`@rubenpazch/numeric-picker`](#rubenpazchnumeric-picker) | Formularios | NumericPicker
|
|
55
|
-
| [`@rubenpazch/numeric-up-picker`](#rubenpazchnumeric-up-picker) | Formularios | NumericUpPicker
|
|
56
|
-
| [`@rubenpazch/overlay-loader`](#rubenpazchoverlay-loader) | Retroalimentación | OverlayLoader, InlineLoader
|
|
57
|
-
| [`@rubenpazch/page-header`](#rubenpazchpage-header) | Navegación | PageHeader
|
|
58
|
-
| [`@rubenpazch/pagination`](#rubenpazchpagination) | Navegación | Pagination, PaginationItem
|
|
59
|
-
| [`@rubenpazch/patient-details`](#rubenpazchpatient-details) | Salud (pacientes y óptica) | PatientDetails
|
|
60
|
-
| [`@rubenpazch/patient-search`](#rubenpazchpatient-search) | Salud (pacientes y óptica) | PatientSearch
|
|
61
|
-
| [`@rubenpazch/phone-input`](#rubenpazchphone-input) | Formularios | PhoneInput, DEFAULT_PHONE_INPUT_LABELS, PHONE_COUNTRIES, formatPhone, isValidPhone, phoneDigits | Teléfono con país: selector de prefijo (+51 por defecto) y número que se formatea al escribir con la máscara del país; valida los dígitos y muestra el número internacional. |
|
|
62
|
-
| [`@rubenpazch/pin-input`](#rubenpazchpin-input) | Formularios | PinInput
|
|
63
|
-
| [`@rubenpazch/prescription-card`](#rubenpazchprescription-card) | Salud (pacientes y óptica) | PrescriptionCard
|
|
64
|
-
| [`@rubenpazch/prescription-eye-card`](#rubenpazchprescription-eye-card) | Salud (pacientes y óptica) | PrescriptionEyeCard
|
|
65
|
-
| [`@rubenpazch/progress-bar`](#rubenpazchprogress-bar) | Retroalimentación | ProgressBar
|
|
66
|
-
| [`@rubenpazch/radio-button`](#rubenpazchradio-button) | Formularios | RadioButton, RadioGroup
|
|
67
|
-
| [`@rubenpazch/segmented-control`](#rubenpazchsegmented-control) | Formularios | SegmentedControl
|
|
68
|
-
| [`@rubenpazch/select`](#rubenpazchselect) | Formularios | Select
|
|
69
|
-
| [`@rubenpazch/shared`](#rubenpazchshared) | Base (tokens y utilidades) | classList, normalizeSize, toLegacySize, useFieldIds, useEscapeKey, useFocusTrap, …
|
|
70
|
-
| [`@rubenpazch/sidebar`](#rubenpazchsidebar) | Navegación | Sidebar
|
|
71
|
-
| [`@rubenpazch/skeleton`](#rubenpazchskeleton) | Retroalimentación | Skeleton
|
|
72
|
-
| [`@rubenpazch/stepper`](#rubenpazchstepper) | Navegación | Stepper
|
|
73
|
-
| [`@rubenpazch/switch`](#rubenpazchswitch) | Formularios | Switch
|
|
74
|
-
| [`@rubenpazch/tabs`](#rubenpazchtabs) | Navegación | Tabs
|
|
75
|
-
| [`@rubenpazch/text-input`](#rubenpazchtext-input) | Formularios | TextInput
|
|
76
|
-
| [`@rubenpazch/textarea`](#rubenpazchtextarea) | Formularios | Textarea
|
|
77
|
-
| [`@rubenpazch/timeline`](#rubenpazchtimeline) | Presentación de datos | Timeline
|
|
78
|
-
| [`@rubenpazch/toast`](#rubenpazchtoast) | Retroalimentación | ToastBanner, ToastProvider, ToastRegion, useToast
|
|
79
|
-
| [`@rubenpazch/tokens`](#rubenpazchtokens) | Base (tokens y utilidades) | cssVar, fontFamily, fontSize, fontWeight, lineHeight, letterSpacing, …
|
|
80
|
-
| [`@rubenpazch/tooltip`](#rubenpazchtooltip) | Presentación de datos | Tooltip
|
|
81
|
-
| [`@rubenpazch/turnstile`](#rubenpazchturnstile) | Formularios | Turnstile, TURNSTILE_SCRIPT, cargarTurnstile
|
|
82
|
-
| [`@rubenpazch/user-card`](#rubenpazchuser-card) | Presentación de datos | UserCard, initials
|
|
16
|
+
| Paquete | Categoría | Exporta | Qué es |
|
|
17
|
+
| ----------------------------------------------------------------------- | -------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
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
|
+
| [`@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. |
|
|
21
|
+
| [`@rubenpazch/autocomplete`](#rubenpazchautocomplete) | Formularios | Autocomplete | Selector con búsqueda sobre una lista de opciones (con descripción, carga y opción de limpiar). |
|
|
22
|
+
| [`@rubenpazch/avatar`](#rubenpazchavatar) | Presentación de datos | Avatar, AvatarGroup | Avatar de persona (imagen, iniciales o icono) y AvatarGroup para varios. |
|
|
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. |
|
|
24
|
+
| [`@rubenpazch/bottom-navigation`](#rubenpazchbottom-navigation) | Navegación | BottomNavigation | Barra fija abajo en el celular con 3 a 5 secciones principales (icono y texto); se oculta en pantallas anchas. |
|
|
25
|
+
| [`@rubenpazch/button`](#rubenpazchbutton) | Acciones | Button | Botón con variantes text/contained/outlined, colores, tamaños, estado de carga e iconos; puede renderizar un enlace (href). |
|
|
26
|
+
| [`@rubenpazch/card`](#rubenpazchcard) | Presentación de datos | Card, CardHeader, CardBody, CardFooter | Tarjeta (outlined o elevated) con CardHeader (título, subtítulo, acciones), CardBody y CardFooter; puede ser clicable. |
|
|
27
|
+
| [`@rubenpazch/checkbox-input`](#rubenpazchcheckbox-input) | Formularios | CheckboxInput, CheckboxGroup | Casilla de verificación con etiqueta, ayuda y error (CheckboxInput) y grupo de casillas con título, "Seleccionar todos" y máximo (CheckboxGroup). |
|
|
28
|
+
| [`@rubenpazch/chip`](#rubenpazchchip) | Presentación de datos | Chip | Chip/etiqueta con variantes, icono y acción de borrar. |
|
|
29
|
+
| [`@rubenpazch/collapsible`](#rubenpazchcollapsible) | Presentación de datos | Collapsible | Sección plegable con título: deja lo opcional oculto para acortar formularios y páginas. |
|
|
30
|
+
| [`@rubenpazch/confirmation-dialog`](#rubenpazchconfirmation-dialog) | Retroalimentación | ConfirmationDialog | Diálogo modal de confirmación (aceptar/cancelar). |
|
|
31
|
+
| [`@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. |
|
|
32
|
+
| [`@rubenpazch/date-input`](#rubenpazchdate-input) | Formularios | DateInput | Campo de fecha con formato local, mínimo/máximo, ayuda y error. |
|
|
33
|
+
| [`@rubenpazch/date-picker`](#rubenpazchdate-picker) | Formularios | DatePicker | Selector de fecha con calendario desplegable. |
|
|
34
|
+
| [`@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. |
|
|
35
|
+
| [`@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). |
|
|
36
|
+
| [`@rubenpazch/draggable-list`](#rubenpazchdraggable-list) | Datos | DraggableList | Lista reordenable arrastrando (también con teclado), basada en dnd-kit. |
|
|
37
|
+
| [`@rubenpazch/drawer`](#rubenpazchdrawer) | Navegación | Drawer | Panel lateral (izquierda/derecha/arriba/abajo) con animación y fondo. |
|
|
38
|
+
| [`@rubenpazch/empty-state`](#rubenpazchempty-state) | Retroalimentación | EmptyState | Estado vacío con icono, título, descripción y acciones ("No hay convocatorias · Crear"). |
|
|
39
|
+
| [`@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. |
|
|
40
|
+
| [`@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). |
|
|
41
|
+
| [`@rubenpazch/icon-button`](#rubenpazchicon-button) | Acciones | IconButton | Botón de solo icono con variantes, formas, tooltip y etiqueta accesible. |
|
|
42
|
+
| [`@rubenpazch/icons`](#rubenpazchicons) | Iconos | ArrowDetailsIcon, ArchiveIcon, BrandingIcon, BusinessPlanIcon, CalendarIcon, CheckIcon, … | Más de 60 iconos SVG como componentes React (y MaterialIcon para Material Icons). |
|
|
43
|
+
| [`@rubenpazch/identification-input`](#rubenpazchidentification-input) | Salud (pacientes y óptica) | IdentificationInput, DEFAULT_IDENTIFICATION_LABELS | Tipo y número de documento peruano (DNI, CE, pasaporte) con validación de longitud y formato. |
|
|
44
|
+
| [`@rubenpazch/image-upload`](#rubenpazchimage-upload) | Formularios | ImageUpload, DEFAULT_IMAGE_UPLOAD_LABELS | Subida de imagen o PDF con vista previa, arrastrar y soltar, validación de tipo y tamaño. |
|
|
45
|
+
| [`@rubenpazch/image-viewer`](#rubenpazchimage-viewer) | Presentación de datos | ImageViewer, DEFAULT_IMAGE_VIEWER_LABELS | Visor de imágenes a pantalla completa con zoom (botones, rueda, pellizco, doble toque), arrastre y paso entre imágenes por flechas, teclado o deslizando. |
|
|
46
|
+
| [`@rubenpazch/info-row`](#rubenpazchinfo-row) | Presentación de datos | InfoRow | Fila de dato con icono, etiqueta y valor (variantes de color, tamaños, acción opcional). |
|
|
47
|
+
| [`@rubenpazch/layout`](#rubenpazchlayout) | Maquetación (layout) | Flex, Stack, Inline, Spacer, Grid, GridItem, … | Maquetación solo con props (sin escribir CSS): Flex (fila o columna con gap, align y justify), Stack (vertical), Inline (horizontal que se ajusta), Center (centrar en uno o ambos ejes), Grid/GridItem (columnas fijas o automáticas), Container (ancho máximo de página) y Spacer. Todas las props aceptan valores por punto de quiebre: { base, sm, md, lg, xl }. |
|
|
48
|
+
| [`@rubenpazch/list`](#rubenpazchlist) | Presentación de datos | List, ListItem | Lista vertical de filas (icono, título, detalle y estado a la derecha), clicables o enlaces. |
|
|
49
|
+
| [`@rubenpazch/loading-spinner`](#rubenpazchloading-spinner) | Retroalimentación | LoadingSpinner | Indicador de carga circular con tamaños y colores. |
|
|
50
|
+
| [`@rubenpazch/menu`](#rubenpazchmenu) | Acciones | Menu | Menú de acciones (role="menu") con botón ⋮ por defecto, opciones con icono, peligrosas o deshabilitadas, teclado completo. |
|
|
51
|
+
| [`@rubenpazch/modal`](#rubenpazchmodal) | Retroalimentación | Modal | Ventana modal accesible: portal, foco retenido, Escape y clic fuera para cerrar, bloqueo del scroll, título y descripción anunciados. |
|
|
52
|
+
| [`@rubenpazch/money-input`](#rubenpazchmoney-input) | Formularios | MoneyInput, formatMoney | Campo de monto en PEN (S/) o USD (US$) que devuelve un número; acepta punto o coma decimal y muestra 1,250.50 al salir. Incluye formatMoney(). |
|
|
53
|
+
| [`@rubenpazch/month-navigator`](#rubenpazchmonth-navigator) | Navegación | MonthNavigator, addMonths, currentMonth | Navegador de periodos ‹ noviembre de 2026 › con valor "AAAA-MM", mínimo, máximo y botón Hoy; incluye addMonths() y currentMonth(). |
|
|
54
|
+
| [`@rubenpazch/numeric-picker`](#rubenpazchnumeric-picker) | Formularios | NumericPicker | Campo numérico con mínimo, máximo, paso, decimales y moneda. |
|
|
55
|
+
| [`@rubenpazch/numeric-up-picker`](#rubenpazchnumeric-up-picker) | Formularios | NumericUpPicker | Campo numérico con botones +/-, signo opcional, solo enteros, ayuda, advertencia y error. |
|
|
56
|
+
| [`@rubenpazch/overlay-loader`](#rubenpazchoverlay-loader) | Retroalimentación | OverlayLoader, InlineLoader | OverlayLoader (pantalla completa, controlado por visible) e InlineLoader (dentro de un contenedor). |
|
|
57
|
+
| [`@rubenpazch/page-header`](#rubenpazchpage-header) | Navegación | PageHeader | Cabecera de página: migas de pan, volver, título h1, subtítulo, acciones y contenido extra (filtros); acepta el Link de Next.js. |
|
|
58
|
+
| [`@rubenpazch/pagination`](#rubenpazchpagination) | Navegación | Pagination, PaginationItem | Paginación con variantes, tamaños y formas; incluye PaginationItem. |
|
|
59
|
+
| [`@rubenpazch/patient-details`](#rubenpazchpatient-details) | Salud (pacientes y óptica) | PatientDetails | OBSOLETO. Ficha de paciente: identificación, contacto, contacto de emergencia, ubicación (departamento/provincia/distrito) e historia clínica. Textos por la prop labels. |
|
|
60
|
+
| [`@rubenpazch/patient-search`](#rubenpazchpatient-search) | Salud (pacientes y óptica) | PatientSearch | OBSOLETO. Buscador de pacientes con resultados y selección. |
|
|
61
|
+
| [`@rubenpazch/phone-input`](#rubenpazchphone-input) | Formularios | PhoneInput, DEFAULT_PHONE_INPUT_LABELS, PHONE_COUNTRIES, formatPhone, isValidPhone, phoneDigits, … | Teléfono con país: selector de prefijo (+51 por defecto) y número que se formatea al escribir con la máscara del país; valida los dígitos y muestra el número internacional. |
|
|
62
|
+
| [`@rubenpazch/pin-input`](#rubenpazchpin-input) | Formularios | PinInput | PinInput: código de verificación (OTP) o PIN en casillas, con avance automático, pegar el código completo, autocompletado del SMS (one-time-code) y onComplete. |
|
|
63
|
+
| [`@rubenpazch/prescription-card`](#rubenpazchprescription-card) | Salud (pacientes y óptica) | PrescriptionCard | OBSOLETO. Tarjeta de receta óptica completa (OD/OI: esfera, cilindro, eje, adición, DNP, prisma, altura) con estado y observaciones. |
|
|
64
|
+
| [`@rubenpazch/prescription-eye-card`](#rubenpazchprescription-eye-card) | Salud (pacientes y óptica) | PrescriptionEyeCard | OBSOLETO. Datos de un ojo de la receta óptica (PrescriptionEyeCard) y campo individual (PrescriptionFieldCard). |
|
|
65
|
+
| [`@rubenpazch/progress-bar`](#rubenpazchprogress-bar) | Retroalimentación | ProgressBar | Barra de progreso (role="progressbar") con etiqueta y porcentaje, determinada o indeterminada. |
|
|
66
|
+
| [`@rubenpazch/radio-button`](#rubenpazchradio-button) | Formularios | RadioButton, RadioGroup | RadioButton y RadioGroup accesibles con variantes y validación. |
|
|
67
|
+
| [`@rubenpazch/segmented-control`](#rubenpazchsegmented-control) | Formularios | SegmentedControl | Botones unidos para elegir una opción entre pocas (radiogroup con flechas del teclado): Personal \| Empresa, Mes \| Año. |
|
|
68
|
+
| [`@rubenpazch/select`](#rubenpazchselect) | Formularios | Select | Lista desplegable simple con etiqueta, placeholder y error. |
|
|
69
|
+
| [`@rubenpazch/shared`](#rubenpazchshared) | Base (tokens y utilidades) | classList, normalizeSize, toLegacySize, useFieldIds, useEscapeKey, useFocusTrap, … | Utilidades (classList) y tipos comunes; la usan internamente los componentes. |
|
|
70
|
+
| [`@rubenpazch/sidebar`](#rubenpazchsidebar) | Navegación | Sidebar | Barra de navegación vertical: secciones, subniveles plegables, insignias y página activa (también subrutas); en escritorio se colapsa a iconos y lo recuerda (storageKey); en móvil es un cajón con foco retenido y Escape. Acepta el Link de Next.js. |
|
|
71
|
+
| [`@rubenpazch/skeleton`](#rubenpazchskeleton) | Retroalimentación | Skeleton | Marcador de carga (texto, bloque o círculo) con la forma del contenido; respeta reducir movimiento. |
|
|
72
|
+
| [`@rubenpazch/stepper`](#rubenpazchstepper) | Navegación | Stepper | Indicador de pasos numerados (opcionalmente clicables) para procesos en etapas. |
|
|
73
|
+
| [`@rubenpazch/switch`](#rubenpazchswitch) | Formularios | Switch | Interruptor encendido/apagado (role="switch") con etiqueta y descripción. |
|
|
74
|
+
| [`@rubenpazch/tabs`](#rubenpazchtabs) | Navegación | Tabs | Pestañas para alternar entre secciones de una misma vista. |
|
|
75
|
+
| [`@rubenpazch/text-input`](#rubenpazchtext-input) | Formularios | TextInput | Campo de texto con etiqueta, ayuda, advertencia, error, iconos y variantes. |
|
|
76
|
+
| [`@rubenpazch/textarea`](#rubenpazchtextarea) | Formularios | Textarea | Área de texto con etiqueta, ayuda, advertencia, error, contador de caracteres y crecimiento automático. |
|
|
77
|
+
| [`@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). |
|
|
78
|
+
| [`@rubenpazch/toast`](#rubenpazchtoast) | Retroalimentación | ToastBanner, ToastProvider, ToastRegion, useToast | Notificaciones temporales (Toast) y avisos fijos (ToastBanner) con tipos y acciones. |
|
|
79
|
+
| [`@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. |
|
|
80
|
+
| [`@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. |
|
|
81
|
+
| [`@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. |
|
|
82
|
+
| [`@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ú ⋮. |
|
|
83
83
|
|
|
84
84
|
## Base (tokens y utilidades)
|
|
85
85
|
|
|
@@ -90,9 +90,9 @@ Utilidades (classList) y tipos comunes; la usan internamente los componentes.
|
|
|
90
90
|
- **Usar cuando:** Solo si construyes un componente nuevo dentro de la librería.
|
|
91
91
|
- **Evitar cuando:** En las apps: no hace falta importarla.
|
|
92
92
|
|
|
93
|
-
Otras exportaciones: `classList`, `normalizeSize`, `toLegacySize`, `useFieldIds`, `useEscapeKey`, `useFocusTrap`, `useLockBodyScroll`, `useClickOutside`, `mergeRefs`, `useMediaQuery`, `MOBILE_QUERY`, `parseISODate`, `toISODate`, `isDayFirst`, `datePlaceholder`, `parseLocalDate`, `formatLocalDate`, `formatMonthYear`, `isSameDay`.
|
|
93
|
+
Otras exportaciones: `classList`, `normalizeSize`, `toLegacySize`, `useFieldIds`, `useEscapeKey`, `useFocusTrap`, `useLockBodyScroll`, `useClickOutside`, `mergeRefs`, `useMediaQuery`, `MOBILE_QUERY`, `parseISODate`, `toISODate`, `isDayFirst`, `datePlaceholder`, `parseLocalDate`, `formatLocalDate`, `formatMonthYear`, `shortWeekdays`, `shortMonths`, `isSameDay`, `uiMessagesEs`, `uiMessagesEn`, `UiLocaleProvider`, `useUiLocale`, `useUiMessages`, `getUiMessages`, `formatMessage`, `DEFAULT_INTL_LOCALE`, `uiLocaleOf`.
|
|
94
94
|
|
|
95
|
-
Tipos: `Size`, `Color`, `Variant`, `ComponentSize`, `LegacySize`, `SizeProp`, `FieldProps`, `FieldIds`.
|
|
95
|
+
Tipos: `Size`, `Color`, `Variant`, `ComponentSize`, `LegacySize`, `SizeProp`, `FieldProps`, `FieldIds`, `UiMessages`, `UiMessageSection`, `UiLocale`, `UiLocaleProviderProps`, `UiMessagesOverrides`.
|
|
96
96
|
|
|
97
97
|
### @rubenpazch/tokens
|
|
98
98
|
|
|
@@ -363,12 +363,13 @@ Enter y Escape; se cierra al elegir o al hacer clic fuera.
|
|
|
363
363
|
import { Menu } from "@rubenpazch/ui";
|
|
364
364
|
```
|
|
365
365
|
|
|
366
|
-
| Prop | Tipo
|
|
367
|
-
| --------- |
|
|
368
|
-
| `items` | `MenuItem[]`
|
|
369
|
-
| `align` | `"start" \| "end"`
|
|
370
|
-
| `label` | `string`
|
|
371
|
-
| `
|
|
366
|
+
| Prop | Tipo | Req. | Por defecto | Descripción |
|
|
367
|
+
| --------- | ----------------------------- | ---- | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
368
|
+
| `items` | `MenuItem[]` | sí | | Opciones del menú. |
|
|
369
|
+
| `align` | `"start" \| "end"` | | `end` | Alineación del panel respecto al botón: end (por defecto) o start. |
|
|
370
|
+
| `label` | `string` | | | Texto accesible del botón por defecto (por defecto "Más opciones"). |
|
|
371
|
+
| `labels` | `Partial<{ label: string; }>` | | | Textos de la interfaz. Por defecto, los del idioma activo (`UiLocaleProvider`); también se cambian para toda la app con su prop `messages`. |
|
|
372
|
+
| `trigger` | `ReactNode` | | | Botón que lo abre. Por defecto un botón "⋮" con el texto accesible de `label`. |
|
|
372
373
|
|
|
373
374
|
Tipos: `MenuProps`, `MenuItem`.
|
|
374
375
|
|
|
@@ -389,43 +390,43 @@ Selector con búsqueda (combobox accesible): filtra mientras se escribe, teclado
|
|
|
389
390
|
import { Autocomplete } from "@rubenpazch/ui";
|
|
390
391
|
```
|
|
391
392
|
|
|
392
|
-
| Prop | Tipo
|
|
393
|
-
| ----------------- |
|
|
394
|
-
| `onChange` | `(value: string \| number \| null, option?: AutocompleteOption \| undefined) => void`
|
|
395
|
-
| `value` | `null \| string \| number`
|
|
396
|
-
| `className` | `string`
|
|
397
|
-
| `clearable` | `boolean`
|
|
398
|
-
| `createLabel` | `string`
|
|
399
|
-
| `debounceMs` | `number`
|
|
400
|
-
| `disabled` | `boolean`
|
|
401
|
-
| `error` | `string`
|
|
402
|
-
| `freeSolo` | `boolean`
|
|
403
|
-
| `highlightMatch` | `boolean`
|
|
404
|
-
| `hint` | `string`
|
|
405
|
-
| `icon` | `ReactNode`
|
|
406
|
-
| `id` | `string`
|
|
407
|
-
| `keepListOpen` | `boolean`
|
|
408
|
-
| `label` | `string`
|
|
409
|
-
| `labelAction` | `ReactNode`
|
|
410
|
-
| `labels` | `Partial<{ clear: string; open: string; close: string; }>`
|
|
411
|
-
| `loading` | `boolean`
|
|
412
|
-
| `loadingText` | `string`
|
|
413
|
-
| `maxHeight` | `string`
|
|
414
|
-
| `minSearchLength` | `number`
|
|
415
|
-
| `name` | `string`
|
|
416
|
-
| `noResultsText` | `string`
|
|
417
|
-
| `onBlur` | `() => void`
|
|
418
|
-
| `onCreate` | `(searchTerm: string) => void`
|
|
419
|
-
| `onFocus` | `() => void`
|
|
420
|
-
| `onSearch` | `(searchTerm: string) => void`
|
|
421
|
-
| `options` | `AutocompleteOption[]`
|
|
422
|
-
| `placeholder` | `string`
|
|
423
|
-
| `position` | `"bottom" \| "top"`
|
|
424
|
-
| `readOnly` | `boolean`
|
|
425
|
-
| `renderOption` | `(option: AutocompleteOption, isSelected: boolean) => ReactNode`
|
|
426
|
-
| `required` | `boolean`
|
|
427
|
-
| `searchable` | `boolean`
|
|
428
|
-
| `warning` | `string`
|
|
393
|
+
| Prop | Tipo | Req. | Por defecto | Descripción |
|
|
394
|
+
| ----------------- | ----------------------------------------------------------------------------------------------------------------------------------- | ---- | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
395
|
+
| `onChange` | `(value: string \| number \| null, option?: AutocompleteOption \| undefined) => void` | sí | | |
|
|
396
|
+
| `value` | `null \| string \| number` | sí | | |
|
|
397
|
+
| `className` | `string` | | `` | |
|
|
398
|
+
| `clearable` | `boolean` | | `true` | |
|
|
399
|
+
| `createLabel` | `string` | | | |
|
|
400
|
+
| `debounceMs` | `number` | | `300` | |
|
|
401
|
+
| `disabled` | `boolean` | | `false` | |
|
|
402
|
+
| `error` | `string` | | | |
|
|
403
|
+
| `freeSolo` | `boolean` | | `false` | Texto libre con sugerencias: el valor es lo escrito (`onChange(texto)` en cada cambio) y las opciones solo ayudan a completarlo. Útil para un destinatario que puede ser un usuario de la lista o un nombre externo. Escape, Tab y salir del campo no borran lo escrito. |
|
|
404
|
+
| `highlightMatch` | `boolean` | | `true` | |
|
|
405
|
+
| `hint` | `string` | | | |
|
|
406
|
+
| `icon` | `ReactNode` | | | |
|
|
407
|
+
| `id` | `string` | | | id del input; si no se pasa se genera uno. |
|
|
408
|
+
| `keepListOpen` | `boolean` | | `false` | |
|
|
409
|
+
| `label` | `string` | | | |
|
|
410
|
+
| `labelAction` | `ReactNode` | | | Contenido junto a la etiqueta, a la derecha: un botón de ayuda ("?"), un enlace… No va dentro del `<label>`. |
|
|
411
|
+
| `labels` | `Partial<{ placeholder: string; create: string; noResults: string; loading: string; clear: string; open: string; close: string; }>` | | | Textos de la interfaz. Por defecto, los del idioma activo (`UiLocaleProvider`): `placeholder`, `create`, `noResults`, `loading`, `clear`, `open` y `close`. |
|
|
412
|
+
| `loading` | `boolean` | | `false` | |
|
|
413
|
+
| `loadingText` | `string` | | | |
|
|
414
|
+
| `maxHeight` | `string` | | `300px` | |
|
|
415
|
+
| `minSearchLength` | `number` | | `0` | |
|
|
416
|
+
| `name` | `string` | | | name del input. |
|
|
417
|
+
| `noResultsText` | `string` | | | |
|
|
418
|
+
| `onBlur` | `() => void` | | | |
|
|
419
|
+
| `onCreate` | `(searchTerm: string) => void` | | | |
|
|
420
|
+
| `onFocus` | `() => void` | | | |
|
|
421
|
+
| `onSearch` | `(searchTerm: string) => void` | | | |
|
|
422
|
+
| `options` | `AutocompleteOption[]` | | `[]` | |
|
|
423
|
+
| `placeholder` | `string` | | | |
|
|
424
|
+
| `position` | `"bottom" \| "top"` | | `bottom` | |
|
|
425
|
+
| `readOnly` | `boolean` | | `false` | |
|
|
426
|
+
| `renderOption` | `(option: AutocompleteOption, isSelected: boolean) => ReactNode` | | | |
|
|
427
|
+
| `required` | `boolean` | | `false` | |
|
|
428
|
+
| `searchable` | `boolean` | | `true` | |
|
|
429
|
+
| `warning` | `string` | | | |
|
|
429
430
|
|
|
430
431
|
Tipos: `AutocompleteOption`, `AutocompleteProps`.
|
|
431
432
|
|
|
@@ -483,6 +484,7 @@ import { CheckboxGroup } from "@rubenpazch/ui";
|
|
|
483
484
|
| `hideLabel` | `boolean` | | `false` | Ocultar el título visualmente (sigue disponible para lectores de pantalla). |
|
|
484
485
|
| `hint` | `string` | | | Texto de ayuda bajo el título. |
|
|
485
486
|
| `id` | `string` | | | id del fieldset; si no se pasa se genera uno. |
|
|
487
|
+
| `labels` | `Partial<{ selectAll: string; }>` | | | Textos de la interfaz. Por defecto, los del idioma activo (`UiLocaleProvider`); también se cambian para toda la app con su prop `messages`. |
|
|
486
488
|
| `maxSelected` | `number` | | | Máximo de opciones marcadas: al llegar, las demás se deshabilitan. |
|
|
487
489
|
| `name` | `string` | | | name de cada casilla (formularios nativos: se envía una vez por valor marcado). |
|
|
488
490
|
| `orientation` | `"vertical" \| "horizontal"` | | `vertical` | `vertical` (por defecto) o `horizontal` (se ajusta a la siguiente línea). |
|
|
@@ -519,8 +521,8 @@ import { DateInput } from "@rubenpazch/ui";
|
|
|
519
521
|
| `hint` | `string` | | | Texto de ayuda. |
|
|
520
522
|
| `id` | `string` | | | id del input; si no se pasa se genera uno (la etiqueta se asocia sola). |
|
|
521
523
|
| `label` | `string` | | | Etiqueta visible. |
|
|
522
|
-
| `labels` | `Partial<DateInputLabels>` | | | Textos del calendario; por defecto en el idioma de `locale
|
|
523
|
-
| `locale` | `string` | |
|
|
524
|
+
| `labels` | `Partial<DateInputLabels>` | | | Textos del calendario; por defecto en el idioma de `locale` o del proveedor. |
|
|
525
|
+
| `locale` | `string` | | | Idioma y formato: `es` (día/mes) o `en` (mes/día). Por defecto, el de `UiLocaleProvider` (sin proveedor, `es-PE`). |
|
|
524
526
|
| `maxDate` | `string` | | | Fecha máxima seleccionable (ISO). |
|
|
525
527
|
| `minDate` | `string` | | | Fecha mínima seleccionable (ISO). |
|
|
526
528
|
| `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. |
|
|
@@ -555,12 +557,13 @@ import { DatePicker } from "@rubenpazch/ui";
|
|
|
555
557
|
| `hint` | `string` | | | |
|
|
556
558
|
| `id` | `string` | | | id del input; si no se pasa se genera uno (la etiqueta se asocia sola). |
|
|
557
559
|
| `label` | `string` | | | |
|
|
558
|
-
| `
|
|
560
|
+
| `labels` | `enum` | | | Textos de la interfaz; por defecto en el idioma de `locale` o del proveedor. |
|
|
561
|
+
| `locale` | `string` | | | Idioma y formato: `es` (día/mes) o `en` (mes/día). Por defecto, el de `UiLocaleProvider` (sin proveedor, `es-PE`). |
|
|
559
562
|
| `maxDate` | `string` | | | |
|
|
560
563
|
| `minDate` | `string` | | | |
|
|
561
564
|
| `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. |
|
|
562
565
|
| `name` | `string` | | | name del input. |
|
|
563
|
-
| `openCalendarLabel` | `string` | | | Texto del botón que abre el calendario (accesibilidad).
|
|
566
|
+
| `openCalendarLabel` | `string` | | | Texto del botón que abre el calendario (accesibilidad). @deprecated Usa `labels.openCalendar`. |
|
|
564
567
|
| `placeholder` | `string` | | | |
|
|
565
568
|
| `readOnly` | `boolean` | | `false` | |
|
|
566
569
|
| `required` | `boolean` | | `false` | |
|
|
@@ -583,25 +586,27 @@ y limita cada calendario según la otra fecha.
|
|
|
583
586
|
import { DateRangePicker } from "@rubenpazch/ui";
|
|
584
587
|
```
|
|
585
588
|
|
|
586
|
-
| Prop | Tipo | Req. | Por defecto
|
|
587
|
-
| ----------- | -------------------------------- | ---- |
|
|
588
|
-
| `onChange` | `(range: DateRange) => void` | sí |
|
|
589
|
-
| `value` | `DateRange` | sí |
|
|
590
|
-
| `className` | `string` | |
|
|
591
|
-
| `disabled` | `boolean` | | `false`
|
|
592
|
-
| `error` | `string` | |
|
|
593
|
-
| `hint` | `string` | |
|
|
594
|
-
| `label` | `string` | |
|
|
595
|
-
| `labels` | `Partial<DateRangePickerLabels>` | |
|
|
596
|
-
| `locale` | `string` | |
|
|
597
|
-
| `maxDate` | `string` | |
|
|
598
|
-
| `minDate` | `string` | |
|
|
599
|
-
| `presets` | `false \| DateRangePreset[]` | | `[ {
|
|
600
|
-
| `required` | `boolean` | | `false`
|
|
601
|
-
| `today` | `Date` | |
|
|
589
|
+
| Prop | Tipo | Req. | Por defecto | Descripción |
|
|
590
|
+
| ----------- | -------------------------------- | ---- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------ |
|
|
591
|
+
| `onChange` | `(range: DateRange) => void` | sí | | |
|
|
592
|
+
| `value` | `DateRange` | sí | | |
|
|
593
|
+
| `className` | `string` | | | |
|
|
594
|
+
| `disabled` | `boolean` | | `false` | |
|
|
595
|
+
| `error` | `string` | | | Error externo; si no hay, se muestra el de orden cuando corresponde. |
|
|
596
|
+
| `hint` | `string` | | | |
|
|
597
|
+
| `label` | `string` | | | Título del grupo (se usa como `<legend>`). |
|
|
598
|
+
| `labels` | `Partial<DateRangePickerLabels>` | | | |
|
|
599
|
+
| `locale` | `string` | | | |
|
|
600
|
+
| `maxDate` | `string` | | | |
|
|
601
|
+
| `minDate` | `string` | | | |
|
|
602
|
+
| `presets` | `false \| DateRangePreset[]` | | `[ { id: "today", label: textos.today, range: (h) => rango(h, h) }, { id: "last7Days", label: textos.last7Days, range: (h) => rango(menos(h, 6), h), }, { id: "last30Days", label: textos.last30Days, range: (h) => rango(menos(h, 29), h), }, { id: "thisMonth", label: textos.thisMonth, range: (h) => rango( primerDia(h.getFullYear(), h.getMonth()), ultimoDia(h.getFullYear(), h.getMonth()), ), }, { id: "previousMonth", label: textos.previousMonth, range: (h) => rango( primerDia(h.getFullYear(), h.getMonth() - 1), ultimoDia(h.getFullYear(), h.getMonth() - 1), ), }, { id: "thisYear", label: textos.thisYear, 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. |
|
|
603
|
+
| `required` | `boolean` | | `false` | |
|
|
604
|
+
| `today` | `Date` | | | Para pruebas: fecha que se toma como "hoy" en los atajos. |
|
|
602
605
|
|
|
603
606
|
#### DEFAULT_DATE_RANGE_LABELS
|
|
604
607
|
|
|
608
|
+
Textos en castellano (los del diccionario `es`). Con `UiLocaleProvider` cambian solos.
|
|
609
|
+
|
|
605
610
|
```tsx
|
|
606
611
|
import { DEFAULT_DATE_RANGE_LABELS } from "@rubenpazch/ui";
|
|
607
612
|
```
|
|
@@ -620,7 +625,7 @@ _Sin props documentadas._
|
|
|
620
625
|
|
|
621
626
|
Otras exportaciones: `rangoValido`.
|
|
622
627
|
|
|
623
|
-
Tipos: `DateRange`, `DateRangePickerLabels`, `DateRangePickerProps`, `DateRangePreset`.
|
|
628
|
+
Tipos: `DateRange`, `DateRangePickerLabels`, `DateRangePickerProps`, `DateRangePreset`, `DateRangePresetId`.
|
|
624
629
|
|
|
625
630
|
### @rubenpazch/file-upload
|
|
626
631
|
|
|
@@ -660,6 +665,8 @@ import { FileUpload } from "@rubenpazch/ui";
|
|
|
660
665
|
|
|
661
666
|
#### DEFAULT_FILE_UPLOAD_LABELS
|
|
662
667
|
|
|
668
|
+
Textos en castellano (los del diccionario `es`). Con `UiLocaleProvider` cambian solos.
|
|
669
|
+
|
|
663
670
|
```tsx
|
|
664
671
|
import { DEFAULT_FILE_UPLOAD_LABELS } from "@rubenpazch/ui";
|
|
665
672
|
```
|
|
@@ -765,6 +772,8 @@ import { ImageUpload } from "@rubenpazch/ui";
|
|
|
765
772
|
|
|
766
773
|
#### DEFAULT_IMAGE_UPLOAD_LABELS
|
|
767
774
|
|
|
775
|
+
Textos en castellano (los del diccionario `es`). Con `UiLocaleProvider` cambian solos.
|
|
776
|
+
|
|
768
777
|
```tsx
|
|
769
778
|
import { DEFAULT_IMAGE_UPLOAD_LABELS } from "@rubenpazch/ui";
|
|
770
779
|
```
|
|
@@ -789,25 +798,26 @@ muestra "1,250.50". Devuelve siempre un número (no texto).
|
|
|
789
798
|
import { MoneyInput } from "@rubenpazch/ui";
|
|
790
799
|
```
|
|
791
800
|
|
|
792
|
-
| Prop | Tipo
|
|
793
|
-
| --------------- |
|
|
794
|
-
| `onChange` | `(value: number \| null) => void`
|
|
795
|
-
| `value` | `null \| number`
|
|
796
|
-
| `allowNegative` | `boolean`
|
|
797
|
-
| `className` | `string`
|
|
798
|
-
| `currency` | `"PEN" \| "USD"`
|
|
799
|
-
| `decimals` | `number`
|
|
800
|
-
| `disabled` | `boolean`
|
|
801
|
-
| `error` | `string`
|
|
802
|
-
| `hint` | `string`
|
|
803
|
-
| `id` | `string`
|
|
804
|
-
| `label` | `string`
|
|
805
|
-
| `
|
|
806
|
-
| `
|
|
807
|
-
| `
|
|
808
|
-
| `
|
|
809
|
-
| `
|
|
810
|
-
| `
|
|
801
|
+
| Prop | Tipo | Req. | Por defecto | Descripción |
|
|
802
|
+
| --------------- | ---------------------------------------------------- | ---- | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
803
|
+
| `onChange` | `(value: number \| null) => void` | sí | | Recibe el monto como número, o null si se borra. |
|
|
804
|
+
| `value` | `null \| number` | sí | | Monto actual como número (o null si está vacío). |
|
|
805
|
+
| `allowNegative` | `boolean` | | `false` | Permite montos negativos (por defecto no). |
|
|
806
|
+
| `className` | `string` | | | Clase extra para el contenedor (márgenes, ancho). |
|
|
807
|
+
| `currency` | `"PEN" \| "USD"` | | `PEN` | PEN (por defecto, S/) o USD (US$). |
|
|
808
|
+
| `decimals` | `number` | | `2` | Decimales (por defecto 2). |
|
|
809
|
+
| `disabled` | `boolean` | | `false` | Campo deshabilitado. |
|
|
810
|
+
| `error` | `string` | | | Mensaje de error; marca el campo como inválido. |
|
|
811
|
+
| `hint` | `string` | | | Texto de ayuda bajo el campo. |
|
|
812
|
+
| `id` | `string` | | | id del control. Si no se pasa, se genera uno. |
|
|
813
|
+
| `label` | `string` | | | Etiqueta visible del campo (se asocia al control para lectores de pantalla). |
|
|
814
|
+
| `labels` | `Partial<{ amountPEN: string; amountUSD: string; }>` | | | Textos de la interfaz. Por defecto, los del idioma activo (`UiLocaleProvider`); también se cambian para toda la app con su prop `messages`. |
|
|
815
|
+
| `max` | `number` | | | Máximo. |
|
|
816
|
+
| `min` | `number` | | `0` | Mínimo (por defecto 0). |
|
|
817
|
+
| `name` | `string` | | | name del control (formularios nativos y librerías de formularios). |
|
|
818
|
+
| `placeholder` | `string` | | `0.00` | Texto de ejemplo. |
|
|
819
|
+
| `required` | `boolean` | | `false` | Campo obligatorio: muestra * y marca el control como requerido. |
|
|
820
|
+
| `warning` | `string` | | | Advertencia (no bloquea). |
|
|
811
821
|
|
|
812
822
|
Otras exportaciones: `formatMoney`.
|
|
813
823
|
|
|
@@ -841,7 +851,7 @@ import { NumericPicker } from "@rubenpazch/ui";
|
|
|
841
851
|
| `hint` | `string` | | | Texto de ayuda. |
|
|
842
852
|
| `id` | `string` | | | id del input; si no se pasa se genera uno. |
|
|
843
853
|
| `label` | `string` | | | Etiqueta visible (se asocia al input). |
|
|
844
|
-
| `labels` | `Partial<{ increment: string; decrement: string; }>` | | | Textos
|
|
854
|
+
| `labels` | `Partial<{ increment: string; decrement: string; }>` | | | Textos (por defecto, los del idioma activo): `increment`, `decrement`. |
|
|
845
855
|
| `max` | `number` | | `999999` | Máximo permitido. |
|
|
846
856
|
| `min` | `number` | | `0` | Mínimo permitido. |
|
|
847
857
|
| `name` | `string` | | | name del input. |
|
|
@@ -866,34 +876,34 @@ Campo numérico con botones − y +, signo opcional, solo enteros, ayuda, advert
|
|
|
866
876
|
import { NumericUpPicker } from "@rubenpazch/ui";
|
|
867
877
|
```
|
|
868
878
|
|
|
869
|
-
| Prop | Tipo | Req. | Por defecto | Descripción
|
|
870
|
-
| ----------------- | ----------------------------------------------------------------- | ---- | ----------- |
|
|
871
|
-
| `onChange` | `(value: string) => void` | sí | |
|
|
872
|
-
| `value` | `string \| number` | sí | |
|
|
873
|
-
| `alwaysNegative` | `boolean` | | `false` |
|
|
874
|
-
| `className` | `string` | | `` |
|
|
875
|
-
| `clearable` | `boolean` | | `false` |
|
|
876
|
-
| `defaultToZero` | `boolean` | | `false` |
|
|
877
|
-
| `disabled` | `boolean` | | `false` |
|
|
878
|
-
| `error` | `string` | | |
|
|
879
|
-
| `hint` | `string` | | |
|
|
880
|
-
| `id` | `string` | | | id del input; si no se pasa se genera uno.
|
|
881
|
-
| `integerOnly` | `boolean` | | `false` |
|
|
882
|
-
| `label` | `string` | | |
|
|
883
|
-
| `labels` | `Partial<{
|
|
884
|
-
| `max` | `number` | | |
|
|
885
|
-
| `min` | `number` | | |
|
|
886
|
-
| `name` | `string` | | | name del input.
|
|
887
|
-
| `onBlur` | `() => void` | | |
|
|
888
|
-
| `onClear` | `() => void` | | |
|
|
889
|
-
| `onFocus` | `() => void` | | |
|
|
890
|
-
| `placeholder` | `string` | | |
|
|
891
|
-
| `required` | `boolean` | | `false` |
|
|
892
|
-
| `showSign` | `boolean` | | `false` |
|
|
893
|
-
| `size` | `"sm" \| "md" \| "lg" \| "small" \| "medium" \| "large"` | | `md` | Tamaño: sm, md (por defecto) o lg.
|
|
894
|
-
| `step` | `number` | | `0.01` |
|
|
895
|
-
| `useMinAsDefault` | `boolean` | | `false` |
|
|
896
|
-
| `warning` | `string` | | |
|
|
879
|
+
| Prop | Tipo | Req. | Por defecto | Descripción |
|
|
880
|
+
| ----------------- | ----------------------------------------------------------------- | ---- | ----------- | ----------------------------------------------------------------------------- |
|
|
881
|
+
| `onChange` | `(value: string) => void` | sí | | |
|
|
882
|
+
| `value` | `string \| number` | sí | | |
|
|
883
|
+
| `alwaysNegative` | `boolean` | | `false` | |
|
|
884
|
+
| `className` | `string` | | `` | |
|
|
885
|
+
| `clearable` | `boolean` | | `false` | |
|
|
886
|
+
| `defaultToZero` | `boolean` | | `false` | |
|
|
887
|
+
| `disabled` | `boolean` | | `false` | |
|
|
888
|
+
| `error` | `string` | | | |
|
|
889
|
+
| `hint` | `string` | | | |
|
|
890
|
+
| `id` | `string` | | | id del input; si no se pasa se genera uno. |
|
|
891
|
+
| `integerOnly` | `boolean` | | `false` | |
|
|
892
|
+
| `label` | `string` | | | |
|
|
893
|
+
| `labels` | `Partial<{ increase: string; decrease: string; clear: string; }>` | | | Textos (por defecto, los del idioma activo): `decrease`, `increase`, `clear`. |
|
|
894
|
+
| `max` | `number` | | | |
|
|
895
|
+
| `min` | `number` | | | |
|
|
896
|
+
| `name` | `string` | | | name del input. |
|
|
897
|
+
| `onBlur` | `() => void` | | | |
|
|
898
|
+
| `onClear` | `() => void` | | | |
|
|
899
|
+
| `onFocus` | `() => void` | | | |
|
|
900
|
+
| `placeholder` | `string` | | | |
|
|
901
|
+
| `required` | `boolean` | | `false` | |
|
|
902
|
+
| `showSign` | `boolean` | | `false` | |
|
|
903
|
+
| `size` | `"sm" \| "md" \| "lg" \| "small" \| "medium" \| "large"` | | `md` | Tamaño: sm, md (por defecto) o lg. |
|
|
904
|
+
| `step` | `number` | | `0.01` | |
|
|
905
|
+
| `useMinAsDefault` | `boolean` | | `false` | |
|
|
906
|
+
| `warning` | `string` | | | |
|
|
897
907
|
|
|
898
908
|
Tipos: `NumericUpPickerProps`, `NumericUpPickerSize`.
|
|
899
909
|
|
|
@@ -915,29 +925,31 @@ va arriba del número.
|
|
|
915
925
|
import { PhoneInput } from "@rubenpazch/ui";
|
|
916
926
|
```
|
|
917
927
|
|
|
918
|
-
| Prop | Tipo | Req. | Por defecto
|
|
919
|
-
| ------------------- | --------------------------- | ---- |
|
|
920
|
-
| `country` | `string` | sí |
|
|
921
|
-
| `onChange` | `(value: string) => void` | sí |
|
|
922
|
-
| `onCountryChange` | `(country: string) => void` | sí |
|
|
923
|
-
| `value` | `string` | sí |
|
|
924
|
-
| `className` | `string` | |
|
|
925
|
-
| `countries` | `PhoneCountry[]` | | `[ { code: "PE",
|
|
926
|
-
| `disabled` | `boolean` | | `false`
|
|
927
|
-
| `error` | `string` | |
|
|
928
|
-
| `hint` | `string` | |
|
|
929
|
-
| `id` | `string` | |
|
|
930
|
-
| `label` | `string` | |
|
|
931
|
-
| `labels` | `Partial<PhoneInputLabels>` | |
|
|
932
|
-
| `name` | `string` | |
|
|
933
|
-
| `onBlur` | `() => void` | |
|
|
934
|
-
| `onFocus` | `() => void` | |
|
|
935
|
-
| `required` | `boolean` | | `false`
|
|
936
|
-
| `showInternational` | `boolean` | | `true`
|
|
937
|
-
| `warning` | `string` | |
|
|
928
|
+
| Prop | Tipo | Req. | Por defecto | Descripción |
|
|
929
|
+
| ------------------- | --------------------------- | ---- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------ |
|
|
930
|
+
| `country` | `string` | sí | | Código del país elegido (`"PE"`). |
|
|
931
|
+
| `onChange` | `(value: string) => void` | sí | | Recibe el número formateado con la máscara del país. |
|
|
932
|
+
| `onCountryChange` | `(country: string) => void` | sí | | |
|
|
933
|
+
| `value` | `string` | sí | | Número nacional ya formateado (lo que devuelve `onChange`). |
|
|
934
|
+
| `className` | `string` | | | |
|
|
935
|
+
| `countries` | `PhoneCountry[]` | | `[ { code: "PE", dialCode: "+51", digits: 9, mask: "### ### ###" }, { code: "MX", dialCode: "+52", digits: 10, mask: "### ### ####", }, { code: "CO", dialCode: "+57", digits: 10, mask: "### ### ####", }, { code: "CL", dialCode: "+56", digits: 9, mask: "# #### ####", }, { code: "AR", dialCode: "+54", digits: 10, mask: "### ### ####", }, { code: "BR", dialCode: "+55", digits: 11, mask: "(##) ##### ####", }, { code: "ES", dialCode: "+34", digits: 9, mask: "### ### ###", }, { code: "US", dialCode: "+1", digits: 10, mask: "(###) ###-####", }, { code: "CA", dialCode: "+1", digits: 10, mask: "(###) ###-####", }, ]` | Países del selector; por defecto `PHONE_COUNTRIES`. |
|
|
936
|
+
| `disabled` | `boolean` | | `false` | |
|
|
937
|
+
| `error` | `string` | | | Error externo; tiene prioridad sobre el de formato. |
|
|
938
|
+
| `hint` | `string` | | | Ayuda bajo el campo; por defecto, los dígitos que pide el país. |
|
|
939
|
+
| `id` | `string` | | | |
|
|
940
|
+
| `label` | `string` | | | |
|
|
941
|
+
| `labels` | `Partial<PhoneInputLabels>` | | | Textos de la interfaz; por defecto en español. |
|
|
942
|
+
| `name` | `string` | | | `name` del campo del número (el país va en `${name}-pais`). |
|
|
943
|
+
| `onBlur` | `() => void` | | | Al salir del campo del número (para marcarlo como "tocado"). |
|
|
944
|
+
| `onFocus` | `() => void` | | | |
|
|
945
|
+
| `required` | `boolean` | | `false` | |
|
|
946
|
+
| `showInternational` | `boolean` | | `true` | Muestra el número completo con prefijo ("+51 912 345 678") cuando es válido. Por defecto `true`. |
|
|
947
|
+
| `warning` | `string` | | | Advertencia que no bloquea el envío. |
|
|
938
948
|
|
|
939
949
|
#### DEFAULT_PHONE_INPUT_LABELS
|
|
940
950
|
|
|
951
|
+
Textos en castellano (los del diccionario `es`). Con `UiLocaleProvider` cambian solos.
|
|
952
|
+
|
|
941
953
|
```tsx
|
|
942
954
|
import { DEFAULT_PHONE_INPUT_LABELS } from "@rubenpazch/ui";
|
|
943
955
|
```
|
|
@@ -954,7 +966,7 @@ import { PHONE_COUNTRIES } from "@rubenpazch/ui";
|
|
|
954
966
|
|
|
955
967
|
_Sin props documentadas._
|
|
956
968
|
|
|
957
|
-
Otras exportaciones: `formatPhone`, `isValidPhone`, `phoneDigits`.
|
|
969
|
+
Otras exportaciones: `formatPhone`, `isValidPhone`, `phoneDigits`, `countryName`.
|
|
958
970
|
|
|
959
971
|
Tipos: `PhoneInputProps`, `PhoneInputLabels`, `PhoneCountry`.
|
|
960
972
|
|
|
@@ -974,26 +986,27 @@ borrar, acepta pegar el código completo y el autocompletado del SMS en móviles
|
|
|
974
986
|
import { PinInput } from "@rubenpazch/ui";
|
|
975
987
|
```
|
|
976
988
|
|
|
977
|
-
| Prop | Tipo | Req. | Por defecto
|
|
978
|
-
| ------------ | ------------------------------------------- | ---- |
|
|
979
|
-
| `onChange` | `(value: string) => void` | sí |
|
|
980
|
-
| `value` | `string` | sí |
|
|
981
|
-
| `autoFocus` | `boolean` | | `false`
|
|
982
|
-
| `boxLabel` | `(index: number, length: number) => string` | |
|
|
983
|
-
| `className` | `string` | |
|
|
984
|
-
| `disabled` | `boolean` | | `false`
|
|
985
|
-
| `error` | `string` | |
|
|
986
|
-
| `groupSize` | `number` | |
|
|
987
|
-
| `hint` | `string` | |
|
|
988
|
-
| `id` | `string` | |
|
|
989
|
-
| `label` | `string` | |
|
|
990
|
-
| `
|
|
991
|
-
| `
|
|
992
|
-
| `
|
|
993
|
-
| `
|
|
994
|
-
| `
|
|
995
|
-
| `
|
|
996
|
-
| `
|
|
989
|
+
| Prop | Tipo | Req. | Por defecto | Descripción |
|
|
990
|
+
| ------------ | ------------------------------------------- | ---- | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
991
|
+
| `onChange` | `(value: string) => void` | sí | | Recibe el código cada vez que cambia. |
|
|
992
|
+
| `value` | `string` | sí | | Código escrito hasta ahora (sin huecos: "12" son las dos primeras casillas). |
|
|
993
|
+
| `autoFocus` | `boolean` | | `false` | Pone el foco en la primera casilla vacía al montar. |
|
|
994
|
+
| `boxLabel` | `(index: number, length: number) => string` | | | Nombre accesible de cada casilla. Por defecto "Carácter 1 de 6". |
|
|
995
|
+
| `className` | `string` | | | Clase extra del contenedor. |
|
|
996
|
+
| `disabled` | `boolean` | | `false` | Deshabilita las casillas. |
|
|
997
|
+
| `error` | `string` | | | Mensaje de error; marca las casillas en rojo. |
|
|
998
|
+
| `groupSize` | `number` | | | Separa las casillas en grupos de este tamaño (3 → `123 – 456`). |
|
|
999
|
+
| `hint` | `string` | | | Texto de ayuda ("Te lo enviamos por correo"). |
|
|
1000
|
+
| `id` | `string` | | | id de la primera casilla (la etiqueta apunta a ella). |
|
|
1001
|
+
| `label` | `string` | | | Etiqueta del grupo ("Código de verificación"). |
|
|
1002
|
+
| `labels` | `Partial<{ box: string; }>` | | | Textos de la interfaz. Por defecto, los del idioma activo (`UiLocaleProvider`); también se cambian para toda la app con su prop `messages`. |
|
|
1003
|
+
| `length` | `number` | | `6` | Número de casillas. Por defecto 6. |
|
|
1004
|
+
| `mask` | `boolean` | | `false` | Oculta lo escrito como en una contraseña (PIN). |
|
|
1005
|
+
| `name` | `string` | | | name de un input oculto con el código completo (formularios nativos). |
|
|
1006
|
+
| `onComplete` | `(value: string) => void` | | | Se llama una vez cuando se completan todas las casillas (p. ej. para enviar). |
|
|
1007
|
+
| `required` | `boolean` | | `false` | Campo obligatorio. |
|
|
1008
|
+
| `size` | `"sm" \| "md" \| "lg"` | | `md` | Tamaño de las casillas. |
|
|
1009
|
+
| `type` | `"numeric" \| "alphanumeric"` | | `numeric` | `numeric` (solo dígitos, teclado numérico) o `alphanumeric` (letras y números, en mayúsculas). |
|
|
997
1010
|
|
|
998
1011
|
Tipos: `PinInputProps`.
|
|
999
1012
|
|
|
@@ -1032,27 +1045,28 @@ import { RadioButton } from "@rubenpazch/ui";
|
|
|
1032
1045
|
import { RadioGroup } from "@rubenpazch/ui";
|
|
1033
1046
|
```
|
|
1034
1047
|
|
|
1035
|
-
| Prop | Tipo | Req. | Por defecto
|
|
1036
|
-
| ------------------- | -------------------------------------------------------------- | ---- |
|
|
1037
|
-
| `name` | `string` | sí |
|
|
1038
|
-
| `onChange` | `(value: string) => void` | sí |
|
|
1039
|
-
| `options` | `RadioOption[]` | sí |
|
|
1040
|
-
| `bordered` | `boolean` | | `false`
|
|
1041
|
-
| `borderLabel` | `string` | |
|
|
1042
|
-
| `className` | `string` | | ``
|
|
1043
|
-
| `disabled` | `boolean` | | `false`
|
|
1044
|
-
| `error` | `string` | |
|
|
1045
|
-
| `groupLabel` | `string` | |
|
|
1046
|
-
| `hint` | `string` | |
|
|
1047
|
-
| `id` | `string` | |
|
|
1048
|
-
| `label` | `string` | |
|
|
1049
|
-
| `
|
|
1050
|
-
| `
|
|
1051
|
-
| `
|
|
1052
|
-
| `
|
|
1053
|
-
| `
|
|
1054
|
-
| `
|
|
1055
|
-
| `
|
|
1048
|
+
| Prop | Tipo | Req. | Por defecto | Descripción |
|
|
1049
|
+
| ------------------- | -------------------------------------------------------------- | ---- | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
1050
|
+
| `name` | `string` | sí | | |
|
|
1051
|
+
| `onChange` | `(value: string) => void` | sí | | |
|
|
1052
|
+
| `options` | `RadioOption[]` | sí | | |
|
|
1053
|
+
| `bordered` | `boolean` | | `false` | |
|
|
1054
|
+
| `borderLabel` | `string` | | | |
|
|
1055
|
+
| `className` | `string` | | `` | |
|
|
1056
|
+
| `disabled` | `boolean` | | `false` | |
|
|
1057
|
+
| `error` | `string` | | | |
|
|
1058
|
+
| `groupLabel` | `string` | | | |
|
|
1059
|
+
| `hint` | `string` | | | Texto de ayuda bajo el grupo. |
|
|
1060
|
+
| `id` | `string` | | | |
|
|
1061
|
+
| `label` | `string` | | | Etiqueta del grupo (alias de `groupLabel`). |
|
|
1062
|
+
| `labels` | `Partial<{ selected: string; none: string; }>` | | | Textos de la interfaz. Por defecto, los del idioma activo (`UiLocaleProvider`); también se cambian para toda la app con su prop `messages`. |
|
|
1063
|
+
| `orientation` | `"vertical" \| "horizontal"` | | `vertical` | |
|
|
1064
|
+
| `required` | `boolean` | | `false` | |
|
|
1065
|
+
| `selectedLabelText` | `string` | | | |
|
|
1066
|
+
| `showSelectedLabel` | `boolean` | | `false` | |
|
|
1067
|
+
| `size` | `"sm" \| "md" \| "lg"` | | `md` | |
|
|
1068
|
+
| `value` | `string` | | | |
|
|
1069
|
+
| `variant` | `"default" \| "primary" \| "success" \| "warning" \| "danger"` | | `default` | |
|
|
1056
1070
|
|
|
1057
1071
|
Tipos: `RadioButtonProps`, `RadioSize`, `RadioVariant`, `RadioGroupProps`, `RadioOption`, `RadioGroupOrientation`.
|
|
1058
1072
|
|
|
@@ -1097,26 +1111,27 @@ Lista desplegable simple con etiqueta, placeholder y error.
|
|
|
1097
1111
|
import { Select } from "@rubenpazch/ui";
|
|
1098
1112
|
```
|
|
1099
1113
|
|
|
1100
|
-
| Prop | Tipo | Req. | Por defecto | Descripción
|
|
1101
|
-
| ------------- | --------------------------------------------------------- | ---- | ----------- |
|
|
1102
|
-
| `onChange` | `(value: string) => void` | sí | |
|
|
1103
|
-
| `options` | `SelectOption[]` | sí | |
|
|
1104
|
-
| `value` | `string` | sí | |
|
|
1105
|
-
| `className` | `string` | | |
|
|
1106
|
-
| `disabled` | `boolean` | | `false` |
|
|
1107
|
-
| `error` | `string` | | |
|
|
1108
|
-
| `hint` | `string` | | | Texto de ayuda bajo el campo.
|
|
1109
|
-
| `id` | `string` | | |
|
|
1110
|
-
| `label` | `string` | | |
|
|
1111
|
-
| `labelAction` | `ReactNode` | | | Contenido junto a la etiqueta, a la derecha: un botón de ayuda ("?"), un enlace… No va dentro del `<label>`.
|
|
1112
|
-
| `name` | `string` | | |
|
|
1113
|
-
| `onBlur` | `(event: FocusEvent<HTMLSelectElement, Element>) => void` | | |
|
|
1114
|
-
| `onFocus` | `(event: FocusEvent<HTMLSelectElement, Element>) => void` | | |
|
|
1115
|
-
| `placeholder` | `string` | | |
|
|
1116
|
-
| `required` | `boolean` | | `false` |
|
|
1117
|
-
| `
|
|
1118
|
-
|
|
1119
|
-
|
|
1114
|
+
| Prop | Tipo | Req. | Por defecto | Descripción |
|
|
1115
|
+
| ------------- | --------------------------------------------------------- | ---- | ----------- | ---------------------------------------------------------------------------------------------------------------- |
|
|
1116
|
+
| `onChange` | `(value: string) => void` | sí | | |
|
|
1117
|
+
| `options` | `SelectOption[]` | sí | | |
|
|
1118
|
+
| `value` | `string` | sí | | |
|
|
1119
|
+
| `className` | `string` | | | |
|
|
1120
|
+
| `disabled` | `boolean` | | `false` | |
|
|
1121
|
+
| `error` | `string` | | | |
|
|
1122
|
+
| `hint` | `string` | | | Texto de ayuda bajo el campo. |
|
|
1123
|
+
| `id` | `string` | | | |
|
|
1124
|
+
| `label` | `string` | | | |
|
|
1125
|
+
| `labelAction` | `ReactNode` | | | Contenido junto a la etiqueta, a la derecha: un botón de ayuda ("?"), un enlace… No va dentro del `<label>`. |
|
|
1126
|
+
| `name` | `string` | | | |
|
|
1127
|
+
| `onBlur` | `(event: FocusEvent<HTMLSelectElement, Element>) => void` | | | |
|
|
1128
|
+
| `onFocus` | `(event: FocusEvent<HTMLSelectElement, Element>) => void` | | | |
|
|
1129
|
+
| `placeholder` | `string` | | | |
|
|
1130
|
+
| `required` | `boolean` | | `false` | |
|
|
1131
|
+
| `size` | `"sm" \| "md" \| "lg" \| "small" \| "medium" \| "large"` | | | Tamaño: sm (en filas compactas, p. ej. dentro de un panel), md (por defecto) o lg; también small, medium, large. |
|
|
1132
|
+
| `warning` | `string` | | | Advertencia que no bloquea el envío; no se muestra si hay `error`. |
|
|
1133
|
+
|
|
1134
|
+
Tipos: `SelectOption`, `SelectProps`, `SelectSize`.
|
|
1120
1135
|
|
|
1121
1136
|
### @rubenpazch/switch
|
|
1122
1137
|
|
|
@@ -1160,49 +1175,50 @@ Campo de texto con etiqueta, ayuda, advertencia, error, iconos y variantes.
|
|
|
1160
1175
|
import { TextInput } from "@rubenpazch/ui";
|
|
1161
1176
|
```
|
|
1162
1177
|
|
|
1163
|
-
| Prop | Tipo
|
|
1164
|
-
| ------------------------ |
|
|
1165
|
-
| `onChange` | `(value: string) => void`
|
|
1166
|
-
| `value` | `string`
|
|
1167
|
-
| `autoComplete` | `string`
|
|
1168
|
-
| `className` | `string`
|
|
1169
|
-
| `disabled` | `boolean`
|
|
1170
|
-
| `emailInvalidMessage` | `string`
|
|
1171
|
-
| `emailSuggestionMessage` | `string`
|
|
1172
|
-
| `emailValidMessage` | `string`
|
|
1173
|
-
| `endAddon` | `ReactNode`
|
|
1174
|
-
| `error` | `string`
|
|
1175
|
-
| `hint` | `string`
|
|
1176
|
-
| `icon` | `ReactNode`
|
|
1177
|
-
| `id` | `string`
|
|
1178
|
-
| `label` | `string`
|
|
1179
|
-
| `labelAction` | `ReactNode`
|
|
1180
|
-
| `
|
|
1181
|
-
| `
|
|
1182
|
-
| `
|
|
1183
|
-
| `
|
|
1184
|
-
| `
|
|
1185
|
-
| `
|
|
1186
|
-
| `
|
|
1187
|
-
| `
|
|
1188
|
-
| `
|
|
1189
|
-
| `
|
|
1190
|
-
| `
|
|
1191
|
-
| `
|
|
1192
|
-
| `
|
|
1193
|
-
| `
|
|
1194
|
-
| `
|
|
1195
|
-
| `
|
|
1196
|
-
| `
|
|
1197
|
-
| `
|
|
1198
|
-
| `
|
|
1199
|
-
| `
|
|
1200
|
-
| `
|
|
1201
|
-
| `
|
|
1202
|
-
| `
|
|
1203
|
-
| `
|
|
1204
|
-
| `
|
|
1205
|
-
| `
|
|
1178
|
+
| Prop | Tipo | Req. | Por defecto | Descripción |
|
|
1179
|
+
| ------------------------ | -------------------------------------------------------------------------------------------------------------------------- | ---- | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
1180
|
+
| `onChange` | `(value: string) => void` | sí | | |
|
|
1181
|
+
| `value` | `string` | sí | | |
|
|
1182
|
+
| `autoComplete` | `string` | | | |
|
|
1183
|
+
| `className` | `string` | | `` | |
|
|
1184
|
+
| `disabled` | `boolean` | | `false` | |
|
|
1185
|
+
| `emailInvalidMessage` | `string` | | | |
|
|
1186
|
+
| `emailSuggestionMessage` | `string` | | | |
|
|
1187
|
+
| `emailValidMessage` | `string` | | | |
|
|
1188
|
+
| `endAddon` | `ReactNode` | | | Bloque pegado a la derecha del campo: un texto (".pe", "kg") o un botón ("Buscar"). |
|
|
1189
|
+
| `error` | `string` | | | |
|
|
1190
|
+
| `hint` | `string` | | | |
|
|
1191
|
+
| `icon` | `ReactNode` | | | |
|
|
1192
|
+
| `id` | `string` | | | id del input; si no se pasa se genera uno (la etiqueta se asocia sola). |
|
|
1193
|
+
| `label` | `string` | | | |
|
|
1194
|
+
| `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>`. |
|
|
1195
|
+
| `labels` | `Partial<{ showPassword: string; hidePassword: string; passwordRulesTitle: string; ruleMet: string; ruleUnmet: string; }>` | | | Textos de la interfaz. Por defecto, los del idioma activo (`UiLocaleProvider`): `showPassword`, `hidePassword`, `passwordRulesTitle`, `ruleMet`, `ruleUnmet`. |
|
|
1196
|
+
| `max` | `number` | | | |
|
|
1197
|
+
| `maxLength` | `number` | | | |
|
|
1198
|
+
| `min` | `number` | | | |
|
|
1199
|
+
| `minLength` | `number` | | | |
|
|
1200
|
+
| `minLengthMessage` | `string` | | | Inline error shown when the value is non-empty but shorter than `minLength`. |
|
|
1201
|
+
| `name` | `string` | | | name del input (formularios nativos, react-hook-form…). |
|
|
1202
|
+
| `onBlur` | `() => void` | | | |
|
|
1203
|
+
| `onFocus` | `() => void` | | | |
|
|
1204
|
+
| `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. |
|
|
1205
|
+
| `passwordRules` | `PasswordRule[]` | | | Con `type="password"`, las reglas de tu backend para una contraseña nueva. Se muestran como lista bajo el campo desde el inicio, cada una se marca al cumplirse y todas cuentan para `onValidityChange`. Si las pasas, reemplazan al medidor por composición (`showPasswordStrength` y `requirementsLabels` se ignoran). |
|
|
1206
|
+
| `passwordRulesLabels` | `Partial<PasswordRulesLabels>` | | | Textos de la lista de reglas: título y estado de cada regla para lectores de pantalla. |
|
|
1207
|
+
| `passwordToggleLabels` | `Partial<{ show: string; hide: string; }>` | | | Textos del botón de contraseña (accesibilidad). @deprecated Usa `labels.showPassword` y `labels.hidePassword` (se pueden pasar por separado). |
|
|
1208
|
+
| `pattern` | `string` | | | |
|
|
1209
|
+
| `placeholder` | `string` | | | |
|
|
1210
|
+
| `required` | `boolean` | | `false` | |
|
|
1211
|
+
| `requiredMessage` | `string` | | | |
|
|
1212
|
+
| `requirementsLabels` | `Partial<PasswordRequirementsLabels>` | | | |
|
|
1213
|
+
| `showPasswordStrength` | `boolean` | | `false` | |
|
|
1214
|
+
| `showPasswordToggle` | `boolean` | | `true` | Con `type="password"`, botón para ver u ocultar lo escrito. Por defecto true. |
|
|
1215
|
+
| `startAddon` | `ReactNode` | | | Bloque pegado a la izquierda del campo: un texto ("S/", "https://"), un icono o un botón. Si es texto, los lectores de pantalla lo leen como parte de la descripción del campo. |
|
|
1216
|
+
| `step` | `number` | | | |
|
|
1217
|
+
| `strengthLabelPrefix` | `string` | | | |
|
|
1218
|
+
| `strengthLabels` | `Partial<Record<PasswordStrengthKey, string>>` | | | |
|
|
1219
|
+
| `type` | `"number" \| "text" \| "email" \| "tel" \| "password" \| "url"` | | `text` | |
|
|
1220
|
+
| `validateEmail` | `boolean` | | `false` | |
|
|
1221
|
+
| `warning` | `string` | | | |
|
|
1206
1222
|
|
|
1207
1223
|
Tipos: `TextInputProps`, `TextInputNativeProps`, `PasswordRule`, `PasswordRulesLabels`.
|
|
1208
1224
|
|
|
@@ -1257,17 +1273,18 @@ Requiere que la CSP permita `https://challenges.cloudflare.com` en script-src y
|
|
|
1257
1273
|
import { Turnstile } from "@rubenpazch/ui";
|
|
1258
1274
|
```
|
|
1259
1275
|
|
|
1260
|
-
| Prop | Tipo | Req. | Por defecto
|
|
1261
|
-
| ----------- | ------------------------------------- | ---- |
|
|
1262
|
-
| `onToken` | `(token: string) => void` | sí |
|
|
1263
|
-
| `siteKey` | `string` | sí |
|
|
1264
|
-
| `action` | `string` | |
|
|
1265
|
-
| `className` | `string` | |
|
|
1266
|
-
| `errorText` | `string` | |
|
|
1267
|
-
| `
|
|
1268
|
-
| `
|
|
1269
|
-
| `
|
|
1270
|
-
| `
|
|
1276
|
+
| Prop | Tipo | Req. | Por defecto | Descripción |
|
|
1277
|
+
| ----------- | ------------------------------------- | ---- | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
1278
|
+
| `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. |
|
|
1279
|
+
| `siteKey` | `string` | sí | | Clave pública del sitio (NEXT_PUBLIC_TURNSTILE_SITE_KEY o la que entregue la API). |
|
|
1280
|
+
| `action` | `string` | | | Acción del formulario ("login", "registro"…): el servidor puede exigir que coincida. |
|
|
1281
|
+
| `className` | `string` | | | |
|
|
1282
|
+
| `errorText` | `string` | | | Mensaje si el widget no carga (red, bloqueadores). |
|
|
1283
|
+
| `labels` | `Partial<{ error: string; }>` | | | Textos de la interfaz. Por defecto, los del idioma activo (`UiLocaleProvider`); también se cambian para toda la app con su prop `messages`. |
|
|
1284
|
+
| `language` | `string` | | `es` | |
|
|
1285
|
+
| `resetKey` | `number` | | `0` | Cambia este número después de cada envío para pedir un token nuevo. |
|
|
1286
|
+
| `size` | `"normal" \| "flexible" \| "compact"` | | `flexible` | |
|
|
1287
|
+
| `theme` | `"auto" \| "light" \| "dark"` | | `auto` | |
|
|
1271
1288
|
|
|
1272
1289
|
#### TURNSTILE_SCRIPT
|
|
1273
1290
|
|
|
@@ -1299,27 +1316,28 @@ Es la base de todas las pantallas de administración.
|
|
|
1299
1316
|
import { AppShell } from "@rubenpazch/ui";
|
|
1300
1317
|
```
|
|
1301
1318
|
|
|
1302
|
-
| Prop | Tipo
|
|
1303
|
-
| ------------------- |
|
|
1304
|
-
| `children` | `ReactNode`
|
|
1305
|
-
| `sections` | `SidebarSection[]`
|
|
1306
|
-
| `bottomNav` | `{ items: BottomNavigationItem[]; moreLabel?: string \| undefined; }`
|
|
1307
|
-
| `brand` | `ReactNode`
|
|
1308
|
-
| `brandCollapsed` | `ReactNode`
|
|
1309
|
-
| `collapsed` | `boolean`
|
|
1310
|
-
| `currentPath` | `string`
|
|
1311
|
-
| `defaultCollapsed` | `boolean`
|
|
1312
|
-
| `headerActions` | `ReactNode`
|
|
1313
|
-
| `labels` | `Partial<{ openMenu: string; skipToContent: string; bottomNav: string; }>` | | | Textos
|
|
1314
|
-
| `linkComponent` | `ElementType<any, keyof IntrinsicElements>`
|
|
1315
|
-
| `loading` | `boolean`
|
|
1316
|
-
| `loadingLabel` | `string`
|
|
1317
|
-
| `maxWidth` | `"none" \| "md" \| "lg"`
|
|
1318
|
-
| `onCollapsedChange` | `(collapsed: boolean) => void`
|
|
1319
|
-
| `sidebarFooter` | `ReactNode`
|
|
1320
|
-
| `
|
|
1321
|
-
| `
|
|
1322
|
-
| `
|
|
1319
|
+
| Prop | Tipo | Req. | Por defecto | Descripción |
|
|
1320
|
+
| ------------------- | --------------------------------------------------------------------------------------------------------- | ---- | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
1321
|
+
| `children` | `ReactNode` | sí | | Contenido de la página. |
|
|
1322
|
+
| `sections` | `SidebarSection[]` | sí | | Secciones del menú. |
|
|
1323
|
+
| `bottomNav` | `{ items: BottomNavigationItem[]; moreLabel?: string \| undefined; }` | | | Barra inferior en el celular con las secciones principales (3 o 4). AppShell agrega al final "Más", que abre el menú lateral con todas las opciones; con ella la cabecera no muestra ☰. |
|
|
1324
|
+
| `brand` | `ReactNode` | | | Logo o nombre de la app arriba. |
|
|
1325
|
+
| `brandCollapsed` | `ReactNode` | | | Versión compacta del logo para el modo colapsado (por defecto se oculta `brand`). |
|
|
1326
|
+
| `collapsed` | `boolean` | | | Colapsado (controlado). |
|
|
1327
|
+
| `currentPath` | `string` | | | Ruta actual (p. ej. usePathname() de Next) para marcar la opción activa. |
|
|
1328
|
+
| `defaultCollapsed` | `boolean` | | | Colapsado inicial (no controlado). |
|
|
1329
|
+
| `headerActions` | `ReactNode` | | | Acciones a la derecha de la cabecera: notificaciones, usuario. |
|
|
1330
|
+
| `labels` | `Partial<{ openMenu: string; skipToContent: string; bottomNav: string; loading: string; more: string; }>` | | | Textos de la interfaz. Por defecto, los del idioma activo (`UiLocaleProvider`): `openMenu`, `skipToContent`, `bottomNav`, `loading` y `more`. |
|
|
1331
|
+
| `linkComponent` | `ElementType<any, keyof IntrinsicElements>` | | | Componente de enlace (Link de Next.js). Por defecto <a>. |
|
|
1332
|
+
| `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. |
|
|
1333
|
+
| `loadingLabel` | `string` | | | Texto accesible de la carga. |
|
|
1334
|
+
| `maxWidth` | `"none" \| "md" \| "lg"` | | `lg` | Ancho máximo del contenido: none, lg (72rem, por defecto) o md (56rem). |
|
|
1335
|
+
| `onCollapsedChange` | `(collapsed: boolean) => void` | | | Al colapsar o expandir. |
|
|
1336
|
+
| `sidebarFooter` | `ReactNode` | | | Contenido al pie de la barra lateral (usuario, "Cerrar sesión"). |
|
|
1337
|
+
| `sidebarLabels` | `Partial<SidebarLabels>` | | | Textos del menú lateral (contraer, expandir, cerrar, navegación). |
|
|
1338
|
+
| `storageKey` | `string` | | | Clave de localStorage para recordar si estaba colapsado. |
|
|
1339
|
+
| `title` | `ReactNode` | | | Título en la cabecera (en móvil se ve junto al botón ☰). |
|
|
1340
|
+
| `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. |
|
|
1323
1341
|
|
|
1324
1342
|
Tipos: `AppShellProps`.
|
|
1325
1343
|
|
|
@@ -1391,14 +1409,15 @@ al alcance del pulgar. En pantallas anchas se oculta (la navegación va en el me
|
|
|
1391
1409
|
import { BottomNavigation } from "@rubenpazch/ui";
|
|
1392
1410
|
```
|
|
1393
1411
|
|
|
1394
|
-
| Prop | Tipo | Req. | Por defecto
|
|
1395
|
-
| --------------- | ------------------------------------------- | ---- |
|
|
1396
|
-
| `items` | `BottomNavigationItem[]` | sí |
|
|
1397
|
-
| `aria-label` | `string` | |
|
|
1398
|
-
| `className` | `string` | |
|
|
1399
|
-
| `currentPath` | `string` | |
|
|
1400
|
-
| `hideFrom` | `"md" \| "lg" \| "never"` | | `md`
|
|
1401
|
-
| `
|
|
1412
|
+
| Prop | Tipo | Req. | Por defecto | Descripción |
|
|
1413
|
+
| --------------- | ------------------------------------------- | ---- | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
1414
|
+
| `items` | `BottomNavigationItem[]` | sí | | Opciones (3 a 5). |
|
|
1415
|
+
| `aria-label` | `string` | | | Nombre accesible de la navegación. |
|
|
1416
|
+
| `className` | `string` | | | Clase extra. |
|
|
1417
|
+
| `currentPath` | `string` | | | Ruta actual, para marcar la opción activa. |
|
|
1418
|
+
| `hideFrom` | `"md" \| "lg" \| "never"` | | `md` | Desde qué ancho se oculta: md (768 px, por defecto), lg (1024 px) o never (siempre visible). |
|
|
1419
|
+
| `labels` | `Partial<{ label: string; }>` | | | Textos de la interfaz. Por defecto, los del idioma activo (`UiLocaleProvider`); también se cambian para toda la app con su prop `messages`. |
|
|
1420
|
+
| `linkComponent` | `ElementType<any, keyof IntrinsicElements>` | | `a` | Componente de enlace (p. ej. Link de Next.js). Por defecto <a>. |
|
|
1402
1421
|
|
|
1403
1422
|
Tipos: `BottomNavigationItem`, `BottomNavigationProps`.
|
|
1404
1423
|
|
|
@@ -1415,23 +1434,25 @@ Panel lateral (izquierda/derecha/arriba/abajo) con animación y fondo.
|
|
|
1415
1434
|
import { Drawer } from "@rubenpazch/ui";
|
|
1416
1435
|
```
|
|
1417
1436
|
|
|
1418
|
-
| Prop | Tipo | Req. | Por defecto | Descripción
|
|
1419
|
-
| --------------------- | -------------------------------------------------- | ---- | --------------- |
|
|
1420
|
-
| `children` | `ReactNode` | sí | | Content to render in the drawer
|
|
1421
|
-
| `isOpen` | `boolean` | sí | | Whether the drawer is open
|
|
1422
|
-
| `onClose` | `() => void` | sí | | Function to close the drawer
|
|
1423
|
-
| `className` | `string` | | `` | Custom className for the drawer content
|
|
1424
|
-
| `closeLabel` | `string` | |
|
|
1425
|
-
| `closeOnEscape` | `boolean` | | `true` | Whether pressing Escape closes the drawer
|
|
1426
|
-
| `closeOnOverlayClick` | `boolean` | | `true` | Whether clicking overlay closes the drawer
|
|
1427
|
-
| `contentContained` | `boolean` | | `false` | Whether the content (header, body, footer) should be contained in a max-width container
|
|
1428
|
-
| `footer` | `ReactNode` | | | Footer content (typically action buttons)
|
|
1429
|
-
| `footerAlign` | `"left" \| "right" \| "center" \| "space-between"` | | `right` | Footer alignment
|
|
1430
|
-
| `headerAlign` | `"left" \| "right" \| "center" \| "space-between"` | | `space-between` | Header alignment (how to position title and close button)
|
|
1431
|
-
| `
|
|
1432
|
-
| `
|
|
1433
|
-
| `
|
|
1434
|
-
| `
|
|
1437
|
+
| Prop | Tipo | Req. | Por defecto | Descripción |
|
|
1438
|
+
| --------------------- | -------------------------------------------------- | ---- | --------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
1439
|
+
| `children` | `ReactNode` | sí | | Content to render in the drawer |
|
|
1440
|
+
| `isOpen` | `boolean` | sí | | Whether the drawer is open |
|
|
1441
|
+
| `onClose` | `() => void` | sí | | Function to close the drawer |
|
|
1442
|
+
| `className` | `string` | | `` | Custom className for the drawer content |
|
|
1443
|
+
| `closeLabel` | `string` | | | Texto accesible del botón de cerrar. @deprecated Usa `labels.close`. |
|
|
1444
|
+
| `closeOnEscape` | `boolean` | | `true` | Whether pressing Escape closes the drawer |
|
|
1445
|
+
| `closeOnOverlayClick` | `boolean` | | `true` | Whether clicking overlay closes the drawer |
|
|
1446
|
+
| `contentContained` | `boolean` | | `false` | Whether the content (header, body, footer) should be contained in a max-width container |
|
|
1447
|
+
| `footer` | `ReactNode` | | | Footer content (typically action buttons) |
|
|
1448
|
+
| `footerAlign` | `"left" \| "right" \| "center" \| "space-between"` | | `right` | Footer alignment |
|
|
1449
|
+
| `headerAlign` | `"left" \| "right" \| "center" \| "space-between"` | | `space-between` | Header alignment (how to position title and close button) |
|
|
1450
|
+
| `keepMounted` | `boolean` | | `false` | Mantiene el contenido en la página mientras está cerrado (oculto, fuera del teclado y de los lectores de pantalla): lo que el usuario escribió o eligió dentro sigue ahí al volver a abrirlo. Por defecto se quita al cerrar. |
|
|
1451
|
+
| `labels` | `Partial<{ close: string; }>` | | | Textos de la interfaz. Por defecto, los del idioma activo (`UiLocaleProvider`); también se cambian para toda la app con su prop `messages`. |
|
|
1452
|
+
| `position` | `"left" \| "right" \| "top" \| "bottom"` | | `right` | Position from which the drawer slides in |
|
|
1453
|
+
| `showOverlay` | `boolean` | | `true` | Whether to show overlay backdrop |
|
|
1454
|
+
| `size` | `"sm" \| "md" \| "lg" \| "xl" \| "full"` | | `md` | Size of the drawer |
|
|
1455
|
+
| `title` | `string` | | | Title displayed in the drawer header |
|
|
1435
1456
|
|
|
1436
1457
|
Tipos: `DrawerPosition`, `DrawerSize`, `DrawerAlign`, `DrawerProps`.
|
|
1437
1458
|
|
|
@@ -1450,16 +1471,16 @@ Navegador de periodos: ‹ noviembre de 2026 › para finanzas, contabilidad y c
|
|
|
1450
1471
|
import { MonthNavigator } from "@rubenpazch/ui";
|
|
1451
1472
|
```
|
|
1452
1473
|
|
|
1453
|
-
| Prop | Tipo
|
|
1454
|
-
| ----------- |
|
|
1455
|
-
| `onChange` | `(value: string) => void`
|
|
1456
|
-
| `value` | `string`
|
|
1457
|
-
| `className` | `string`
|
|
1458
|
-
| `labels` | `Partial<{ previous: string; next: string; today: string; }>` | | | Textos
|
|
1459
|
-
| `locale` | `string`
|
|
1460
|
-
| `max` | `string`
|
|
1461
|
-
| `min` | `string`
|
|
1462
|
-
| `showToday` | `boolean`
|
|
1474
|
+
| Prop | Tipo | Req. | Por defecto | Descripción |
|
|
1475
|
+
| ----------- | ----------------------------------------------------------------------------- | ---- | ----------- | ----------------------------------------------------------------------------------- |
|
|
1476
|
+
| `onChange` | `(value: string) => void` | sí | | Recibe el nuevo mes "AAAA-MM". |
|
|
1477
|
+
| `value` | `string` | sí | | Mes actual en formato "AAAA-MM" (p. ej. "2026-11"). |
|
|
1478
|
+
| `className` | `string` | | | Clase extra. |
|
|
1479
|
+
| `labels` | `Partial<{ period: string; previous: string; next: string; today: string; }>` | | | Textos (por defecto, los del idioma activo): `period`, `previous`, `next`, `today`. |
|
|
1480
|
+
| `locale` | `string` | | | Idioma del nombre del mes (por defecto "es"). |
|
|
1481
|
+
| `max` | `string` | | | Último mes permitido "AAAA-MM". |
|
|
1482
|
+
| `min` | `string` | | | Primer mes permitido "AAAA-MM". |
|
|
1483
|
+
| `showToday` | `boolean` | | `false` | Muestra el botón "Hoy" para volver al mes actual. |
|
|
1463
1484
|
|
|
1464
1485
|
Otras exportaciones: `addMonths`, `currentMonth`.
|
|
1465
1486
|
|
|
@@ -1480,16 +1501,17 @@ Cabecera de página: migas, volver, título h1, subtítulo y acciones.
|
|
|
1480
1501
|
import { PageHeader } from "@rubenpazch/ui";
|
|
1481
1502
|
```
|
|
1482
1503
|
|
|
1483
|
-
| Prop | Tipo | Req. | Por defecto | Descripción
|
|
1484
|
-
| --------------- | --------------------------------------------------------------------------------------------------- | ---- | ----------- |
|
|
1485
|
-
| `title` | `ReactNode` | sí | | Título de la página (se renderiza como h1).
|
|
1486
|
-
| `actions` | `ReactNode` | | | Acciones a la derecha (botones). En móvil pasan abajo.
|
|
1487
|
-
| `back` | `{ label?: string \| undefined; href?: string \| undefined; onClick?: (() => void) \| undefined; }` | | | Enlace o acción "Volver".
|
|
1488
|
-
| `breadcrumbs` | `Breadcrumb[]` | | | Migas de pan: Inicio / Convocatorias / Editar.
|
|
1489
|
-
| `children` | `ReactNode` | | | Contenido extra bajo el título (filtros, pestañas).
|
|
1490
|
-
| `className` | `string` | | | Clase extra.
|
|
1491
|
-
| `
|
|
1492
|
-
| `
|
|
1504
|
+
| Prop | Tipo | Req. | Por defecto | Descripción |
|
|
1505
|
+
| --------------- | --------------------------------------------------------------------------------------------------- | ---- | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
1506
|
+
| `title` | `ReactNode` | sí | | Título de la página (se renderiza como h1). |
|
|
1507
|
+
| `actions` | `ReactNode` | | | Acciones a la derecha (botones). En móvil pasan abajo. |
|
|
1508
|
+
| `back` | `{ label?: string \| undefined; href?: string \| undefined; onClick?: (() => void) \| undefined; }` | | | Enlace o acción "Volver". |
|
|
1509
|
+
| `breadcrumbs` | `Breadcrumb[]` | | | Migas de pan: Inicio / Convocatorias / Editar. |
|
|
1510
|
+
| `children` | `ReactNode` | | | Contenido extra bajo el título (filtros, pestañas). |
|
|
1511
|
+
| `className` | `string` | | | Clase extra. |
|
|
1512
|
+
| `labels` | `Partial<{ breadcrumbs: string; back: string; }>` | | | Textos de la interfaz. Por defecto, los del idioma activo (`UiLocaleProvider`); también se cambian para toda la app con su prop `messages`. |
|
|
1513
|
+
| `linkComponent` | `ElementType<any, keyof IntrinsicElements>` | | `a` | Componente de enlace (p. ej. Link de Next.js). Por defecto <a>. |
|
|
1514
|
+
| `subtitle` | `ReactNode` | | | Texto secundario bajo el título. |
|
|
1493
1515
|
|
|
1494
1516
|
Tipos: `PageHeaderProps`, `Breadcrumb`.
|
|
1495
1517
|
|
|
@@ -1506,30 +1528,30 @@ Paginación con variantes, tamaños y formas; incluye PaginationItem.
|
|
|
1506
1528
|
import { Pagination } from "@rubenpazch/ui";
|
|
1507
1529
|
```
|
|
1508
1530
|
|
|
1509
|
-
| Prop | Tipo | Req. | Por defecto
|
|
1510
|
-
| -------------------- | -------------------------------------------------------------- | ---- |
|
|
1511
|
-
| `aria-label` | `string` | |
|
|
1512
|
-
| `boundaryCount` | `number` | | `1`
|
|
1513
|
-
| `compactOnMobile` | `boolean` | | `false`
|
|
1514
|
-
| `count` | `number` | | `1`
|
|
1515
|
-
| `defaultPage` | `number` | | `1`
|
|
1516
|
-
| `disabled` | `boolean` | | `false`
|
|
1517
|
-
| `hideNextButton` | `boolean` | | `false`
|
|
1518
|
-
| `hidePrevButton` | `boolean` | | `false`
|
|
1519
|
-
| `hideWhenSinglePage` | `boolean` | | `false`
|
|
1520
|
-
| `labels` | `Partial<PaginationLabels>` | |
|
|
1521
|
-
| `onChange` | `(event: ChangeEvent<unknown, Element>, page: number) => void` | |
|
|
1522
|
-
| `onPageChange` | `(page: number) => void` | |
|
|
1523
|
-
| `page` | `number` | |
|
|
1524
|
-
| `pageSize` | `number` | |
|
|
1525
|
-
| `renderItem` | `(item: PaginationItemType) => ReactNode` | |
|
|
1526
|
-
| `shape` | `"rounded" \| "circular"` | | `rounded`
|
|
1527
|
-
| `showFirstButton` | `boolean` | | `false`
|
|
1528
|
-
| `showLastButton` | `boolean` | | `false`
|
|
1529
|
-
| `siblingCount` | `number` | | `1`
|
|
1530
|
-
| `size` | `"small" \| "medium" \| "large" \| "sm" \| "md" \| "lg"` | | `medium`
|
|
1531
|
-
| `totalCount` | `number` | |
|
|
1532
|
-
| `variant` | `"text" \| "outlined"` | | `text`
|
|
1531
|
+
| Prop | Tipo | Req. | Por defecto | Descripción |
|
|
1532
|
+
| -------------------- | -------------------------------------------------------------- | ---- | ----------- | -------------------------------------------------------------------------------------------------------------------------------- |
|
|
1533
|
+
| `aria-label` | `string` | | | Nombre accesible de la navegación (por defecto "Paginación"). |
|
|
1534
|
+
| `boundaryCount` | `number` | | `1` | Number of always visible pages at the beginning and end |
|
|
1535
|
+
| `compactOnMobile` | `boolean` | | `false` | En pantallas angostas (< 640 px) oculta los números y muestra solo anterior/siguiente con el indicador "3 / 10". |
|
|
1536
|
+
| `count` | `number` | | `1` | Total number of pages |
|
|
1537
|
+
| `defaultPage` | `number` | | `1` | Default page if uncontrolled |
|
|
1538
|
+
| `disabled` | `boolean` | | `false` | If true, the component is disabled |
|
|
1539
|
+
| `hideNextButton` | `boolean` | | `false` | If true, hide the next-page button |
|
|
1540
|
+
| `hidePrevButton` | `boolean` | | `false` | If true, hide the previous-page button |
|
|
1541
|
+
| `hideWhenSinglePage` | `boolean` | | `false` | No muestra nada cuando hay una sola página (o ninguna). |
|
|
1542
|
+
| `labels` | `Partial<PaginationLabels>` | | | Textos de la interfaz; por defecto en español. |
|
|
1543
|
+
| `onChange` | `(event: ChangeEvent<unknown, Element>, page: number) => void` | | | Al cambiar de página, estilo MUI: (evento, página). Se mantiene por compatibilidad. |
|
|
1544
|
+
| `onPageChange` | `(page: number) => void` | | | Al cambiar de página (recibe solo el número). Preferido sobre onChange. |
|
|
1545
|
+
| `page` | `number` | | | The current page (1-based) |
|
|
1546
|
+
| `pageSize` | `number` | | | Registros por página, para calcular el rango del resumen. |
|
|
1547
|
+
| `renderItem` | `(item: PaginationItemType) => ReactNode` | | | Custom render function for items |
|
|
1548
|
+
| `shape` | `"rounded" \| "circular"` | | `rounded` | The shape of the pagination items |
|
|
1549
|
+
| `showFirstButton` | `boolean` | | `false` | If true, show the first-page button |
|
|
1550
|
+
| `showLastButton` | `boolean` | | `false` | If true, show the last-page button |
|
|
1551
|
+
| `siblingCount` | `number` | | `1` | Number of always visible pages before and after the current page |
|
|
1552
|
+
| `size` | `"small" \| "medium" \| "large" \| "sm" \| "md" \| "lg"` | | `medium` | The size of the pagination component |
|
|
1553
|
+
| `totalCount` | `number` | | | Total de registros. Muestra un resumen junto a la paginación: "Mostrando 1–50 de 230" si se indica `pageSize`, o "230 en total". |
|
|
1554
|
+
| `variant` | `"text" \| "outlined"` | | `text` | The variant to use |
|
|
1533
1555
|
|
|
1534
1556
|
#### PaginationItem
|
|
1535
1557
|
|
|
@@ -1537,14 +1559,15 @@ import { Pagination } from "@rubenpazch/ui";
|
|
|
1537
1559
|
import { PaginationItem } from "@rubenpazch/ui";
|
|
1538
1560
|
```
|
|
1539
1561
|
|
|
1540
|
-
| Prop | Tipo
|
|
1541
|
-
| ---------- |
|
|
1542
|
-
| `page` | `number`
|
|
1543
|
-
| `type` | `"page" \| "next" \| "previous" \| "first" \| "last" \| "start-ellipsis" \| "end-ellipsis"`
|
|
1544
|
-
| `
|
|
1545
|
-
| `
|
|
1546
|
-
| `
|
|
1547
|
-
| `
|
|
1562
|
+
| Prop | Tipo | Req. | Por defecto | Descripción |
|
|
1563
|
+
| ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ---- | ----------- | ----------------------------------------------------------------------------------------- |
|
|
1564
|
+
| `page` | `number` | sí | | The page number |
|
|
1565
|
+
| `type` | `"page" \| "next" \| "previous" \| "first" \| "last" \| "start-ellipsis" \| "end-ellipsis"` | sí | | The type of pagination item |
|
|
1566
|
+
| `labels` | `Partial<{ label: string; first: string; last: string; next: string; previous: string; page: string; summaryRange: string; summaryTotal: string; mobilePage: string; }>` | | | Textos (por defecto, los del idioma activo): `first`, `last`, `next`, `previous`, `page`. |
|
|
1567
|
+
| `selected` | `boolean` | | `false` | If true, the item is selected/active |
|
|
1568
|
+
| `shape` | `"rounded" \| "circular"` | | `rounded` | The shape of the pagination items |
|
|
1569
|
+
| `size` | `"small" \| "medium" \| "large" \| "sm" \| "md" \| "lg"` | | `medium` | The size of the component |
|
|
1570
|
+
| `variant` | `"text" \| "outlined"` | | `text` | The variant to use |
|
|
1548
1571
|
|
|
1549
1572
|
Tipos: `PaginationProps`, `PaginationShape`, `PaginationSize`, `PaginationVariant`, `PaginationItemType`, `PaginationLabels`, `PaginationItemProps`.
|
|
1550
1573
|
|
|
@@ -1597,15 +1620,16 @@ Indicador de pasos numerados (opcionalmente clicables) para procesos en etapas.
|
|
|
1597
1620
|
import { Stepper } from "@rubenpazch/ui";
|
|
1598
1621
|
```
|
|
1599
1622
|
|
|
1600
|
-
| Prop | Tipo | Req. | Por defecto | Descripción
|
|
1601
|
-
| --------------- | -------------------------------------------------------- | ---- | ----------- |
|
|
1602
|
-
| `currentStep` | `number` | sí | |
|
|
1603
|
-
| `steps` | `Step[]` | sí | |
|
|
1604
|
-
| `ariaLabel` | `string` | |
|
|
1605
|
-
| `className` | `string` | | `` |
|
|
1606
|
-
| `
|
|
1607
|
-
| `
|
|
1608
|
-
| `
|
|
1623
|
+
| Prop | Tipo | Req. | Por defecto | Descripción |
|
|
1624
|
+
| --------------- | -------------------------------------------------------- | ---- | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
1625
|
+
| `currentStep` | `number` | sí | | |
|
|
1626
|
+
| `steps` | `Step[]` | sí | | |
|
|
1627
|
+
| `ariaLabel` | `string` | | | Nombre accesible de la navegación de pasos (por defecto "Progreso"). |
|
|
1628
|
+
| `className` | `string` | | `` | |
|
|
1629
|
+
| `labels` | `Partial<{ label: string; }>` | | | Textos de la interfaz. Por defecto, los del idioma activo (`UiLocaleProvider`); también se cambian para toda la app con su prop `messages`. |
|
|
1630
|
+
| `onStepChange` | `(step: number) => void` | | | |
|
|
1631
|
+
| `size` | `"small" \| "medium" \| "large" \| "sm" \| "md" \| "lg"` | | `medium` | |
|
|
1632
|
+
| `stepClickable` | `boolean` | | `false` | |
|
|
1609
1633
|
|
|
1610
1634
|
### @rubenpazch/tabs
|
|
1611
1635
|
|
|
@@ -1623,9 +1647,10 @@ import { Tabs } from "@rubenpazch/ui";
|
|
|
1623
1647
|
| Prop | Tipo | Req. | Por defecto | Descripción |
|
|
1624
1648
|
| ------------------ | ------------------------------------------ | ---- | ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
1625
1649
|
| `tabs` | `Tab[]` | sí | | |
|
|
1626
|
-
| `ariaLabel` | `string` | |
|
|
1650
|
+
| `ariaLabel` | `string` | | | Nombre accesible del grupo de pestañas (por defecto "Pestañas"). |
|
|
1627
1651
|
| `className` | `string` | | | |
|
|
1628
1652
|
| `defaultTab` | `string` | | | |
|
|
1653
|
+
| `labels` | `Partial<{ label: string; }>` | | | Textos de la interfaz. Por defecto, los del idioma activo (`UiLocaleProvider`); también se cambian para toda la app con su prop `messages`. |
|
|
1629
1654
|
| `lazy` | `boolean` | | `false` | Lazy mode - only calls onLoad when tab is first visited |
|
|
1630
1655
|
| `loading` | `boolean` | | `false` | Loading state for the active tab content |
|
|
1631
1656
|
| `loadingComponent` | `ReactNode` | | | Custom loading component |
|
|
@@ -1655,17 +1680,18 @@ Aviso dentro de la página (no flotante): información, éxito, advertencia o er
|
|
|
1655
1680
|
import { Alert } from "@rubenpazch/ui";
|
|
1656
1681
|
```
|
|
1657
1682
|
|
|
1658
|
-
| Prop | Tipo | Req. | Por defecto
|
|
1659
|
-
| ------------ | ---------------------------------------------- | ---- |
|
|
1660
|
-
| `action` | `ReactNode` | |
|
|
1661
|
-
| `children` | `ReactNode` | |
|
|
1662
|
-
| `className` | `string` | |
|
|
1663
|
-
| `closeLabel` | `string` | |
|
|
1664
|
-
| `icon` | `ReactNode` | |
|
|
1665
|
-
| `
|
|
1666
|
-
| `
|
|
1667
|
-
| `
|
|
1668
|
-
| `
|
|
1683
|
+
| Prop | Tipo | Req. | Por defecto | Descripción |
|
|
1684
|
+
| ------------ | ---------------------------------------------- | ---- | ----------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
1685
|
+
| `action` | `ReactNode` | | | Acción a la derecha o abajo (p. ej. un Button "Reintentar"). |
|
|
1686
|
+
| `children` | `ReactNode` | | | Texto del aviso. |
|
|
1687
|
+
| `className` | `string` | | | Clase extra. |
|
|
1688
|
+
| `closeLabel` | `string` | | | Texto accesible del botón ×. @deprecated Usa `labels.close`. |
|
|
1689
|
+
| `icon` | `ReactNode` | | | Icono propio; `false` para ocultarlo. Por defecto uno según el tipo. |
|
|
1690
|
+
| `labels` | `Partial<{ close: string; }>` | | | Textos de la interfaz. Por defecto, los del idioma activo (`UiLocaleProvider`); también se cambian para toda la app con su prop `messages`. |
|
|
1691
|
+
| `onClose` | `() => void` | | | Si se pasa, muestra el botón × y se llama al cerrarlo. |
|
|
1692
|
+
| `role` | `"alert" \| "status" \| "note"` | | | Rol ARIA. Por defecto `alert` (warning/danger) o `status` (info/success), que se anuncian al aparecer. Para un aviso fijo que ya está en la página al cargar, usa `"note"`. |
|
|
1693
|
+
| `title` | `ReactNode` | | | Título en negrita (opcional). |
|
|
1694
|
+
| `variant` | `"info" \| "success" \| "warning" \| "danger"` | | `info` | Tipo de mensaje: info (por defecto), success, warning o danger. |
|
|
1669
1695
|
|
|
1670
1696
|
Tipos: `AlertProps`, `AlertVariant`.
|
|
1671
1697
|
|
|
@@ -1685,18 +1711,19 @@ el foco inicial en "Cancelar", la opción segura.
|
|
|
1685
1711
|
import { ConfirmationDialog } from "@rubenpazch/ui";
|
|
1686
1712
|
```
|
|
1687
1713
|
|
|
1688
|
-
| Prop | Tipo
|
|
1689
|
-
| ------------- |
|
|
1690
|
-
| `isOpen` | `boolean`
|
|
1691
|
-
| `message` | `ReactNode`
|
|
1692
|
-
| `onCancel` | `() => void`
|
|
1693
|
-
| `onConfirm` | `() => void`
|
|
1694
|
-
| `title` | `string`
|
|
1695
|
-
| `cancelText` | `string`
|
|
1696
|
-
| `children` | `ReactNode`
|
|
1697
|
-
| `confirmText` | `string`
|
|
1698
|
-
| `isDangerous` | `boolean`
|
|
1699
|
-
| `isLoading` | `boolean`
|
|
1714
|
+
| Prop | Tipo | Req. | Por defecto | Descripción |
|
|
1715
|
+
| ------------- | ----------------------------------------------- | ---- | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
1716
|
+
| `isOpen` | `boolean` | sí | | Si el diálogo está abierto. |
|
|
1717
|
+
| `message` | `ReactNode` | sí | | Explicación de la consecuencia. |
|
|
1718
|
+
| `onCancel` | `() => void` | sí | | Al cancelar, pulsar Escape o hacer clic fuera (si no está cargando). |
|
|
1719
|
+
| `onConfirm` | `() => void` | sí | | Al confirmar. |
|
|
1720
|
+
| `title` | `string` | sí | | Pregunta o título: "¿Eliminar la convocatoria?". |
|
|
1721
|
+
| `cancelText` | `string` | | | Texto del botón de cancelar (por defecto "Cancelar"). |
|
|
1722
|
+
| `children` | `ReactNode` | | | Contenido extra bajo el mensaje (p. ej. un campo "motivo"). |
|
|
1723
|
+
| `confirmText` | `string` | | | Texto del botón de confirmar (por defecto "Confirmar"). |
|
|
1724
|
+
| `isDangerous` | `boolean` | | `false` | Acción destructiva: botón rojo. |
|
|
1725
|
+
| `isLoading` | `boolean` | | `false` | Muestra el botón de confirmar cargando y bloquea los botones. |
|
|
1726
|
+
| `labels` | `Partial<{ confirm: string; cancel: string; }>` | | | Textos de la interfaz. Por defecto, los del idioma activo (`UiLocaleProvider`); también se cambian para toda la app con su prop `messages`. |
|
|
1700
1727
|
|
|
1701
1728
|
Tipos: `ConfirmationDialogProps`.
|
|
1702
1729
|
|
|
@@ -1768,21 +1795,22 @@ página y se cierra con Escape. Para confirmar acciones usa ConfirmationDialog.
|
|
|
1768
1795
|
import { Modal } from "@rubenpazch/ui";
|
|
1769
1796
|
```
|
|
1770
1797
|
|
|
1771
|
-
| Prop | Tipo | Req. | Por defecto | Descripción
|
|
1772
|
-
| --------------------- | ---------------------------------------- | ---- | ----------- |
|
|
1773
|
-
| `onClose` | `() => void` | sí | | Se llama al pedir cierre: botón ×, Escape o clic en el fondo.
|
|
1774
|
-
| `open` | `boolean` | sí | | Si el modal está abierto.
|
|
1775
|
-
| `children` | `ReactNode` | | | Contenido del modal.
|
|
1776
|
-
| `className` | `string` | | | Clase extra para la caja del modal.
|
|
1777
|
-
| `closeLabel` | `string` | |
|
|
1778
|
-
| `closeOnEscape` | `boolean` | | `true` | Cerrar con Escape (por defecto sí).
|
|
1779
|
-
| `closeOnOverlayClick` | `boolean` | | `true` | Cerrar al hacer clic en el fondo (por defecto sí).
|
|
1780
|
-
| `description` | `ReactNode` | | | Texto bajo el título (se anuncia como descripción).
|
|
1781
|
-
| `footer` | `ReactNode` | | | Pie: normalmente los botones de acción.
|
|
1782
|
-
| `
|
|
1783
|
-
| `
|
|
1784
|
-
| `
|
|
1785
|
-
| `
|
|
1798
|
+
| Prop | Tipo | Req. | Por defecto | Descripción |
|
|
1799
|
+
| --------------------- | ---------------------------------------- | ---- | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
1800
|
+
| `onClose` | `() => void` | sí | | Se llama al pedir cierre: botón ×, Escape o clic en el fondo. |
|
|
1801
|
+
| `open` | `boolean` | sí | | Si el modal está abierto. |
|
|
1802
|
+
| `children` | `ReactNode` | | | Contenido del modal. |
|
|
1803
|
+
| `className` | `string` | | | Clase extra para la caja del modal. |
|
|
1804
|
+
| `closeLabel` | `string` | | | Texto accesible del botón ×. @deprecated Usa `labels.close`. |
|
|
1805
|
+
| `closeOnEscape` | `boolean` | | `true` | Cerrar con Escape (por defecto sí). |
|
|
1806
|
+
| `closeOnOverlayClick` | `boolean` | | `true` | Cerrar al hacer clic en el fondo (por defecto sí). |
|
|
1807
|
+
| `description` | `ReactNode` | | | Texto bajo el título (se anuncia como descripción). |
|
|
1808
|
+
| `footer` | `ReactNode` | | | Pie: normalmente los botones de acción. |
|
|
1809
|
+
| `labels` | `Partial<{ close: string; }>` | | | Textos de la interfaz. Por defecto, los del idioma activo (`UiLocaleProvider`); también se cambian para toda la app con su prop `messages`. |
|
|
1810
|
+
| `role` | `"dialog" \| "alertdialog"` | | `dialog` | Rol del diálogo: `alertdialog` para confirmaciones que exigen respuesta. |
|
|
1811
|
+
| `showCloseButton` | `boolean` | | `true` | Mostrar el botón × (por defecto sí). |
|
|
1812
|
+
| `size` | `"sm" \| "md" \| "lg" \| "xl" \| "full"` | | `md` | Ancho máximo: sm (400px), md (520px, por defecto), lg (720px), xl (960px) o full. |
|
|
1813
|
+
| `title` | `ReactNode` | | | Título (se anuncia como nombre del diálogo). |
|
|
1786
1814
|
|
|
1787
1815
|
Tipos: `ModalProps`, `ModalSize`.
|
|
1788
1816
|
|
|
@@ -1804,14 +1832,15 @@ It keeps no state and performs no side effects — the fade in/out is CSS only.
|
|
|
1804
1832
|
import { OverlayLoader } from "@rubenpazch/ui";
|
|
1805
1833
|
```
|
|
1806
1834
|
|
|
1807
|
-
| Prop | Tipo | Req. | Por defecto | Descripción
|
|
1808
|
-
| -------------- | ------------------------------------ | ---- | ----------- |
|
|
1809
|
-
| `visible` | `boolean` | sí | | Whether the overlay is shown. When false it fades out and stops capturing pointer events.
|
|
1810
|
-
| `className` | `string` | | | Extra class applied to the root overlay element.
|
|
1811
|
-
| `
|
|
1812
|
-
| `
|
|
1813
|
-
| `
|
|
1814
|
-
| `
|
|
1835
|
+
| Prop | Tipo | Req. | Por defecto | Descripción |
|
|
1836
|
+
| -------------- | ------------------------------------ | ---- | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
1837
|
+
| `visible` | `boolean` | sí | | Whether the overlay is shown. When false it fades out and stops capturing pointer events. |
|
|
1838
|
+
| `className` | `string` | | | Extra class applied to the root overlay element. |
|
|
1839
|
+
| `labels` | `Partial<{ loading: string; }>` | | | Textos de la interfaz. Por defecto, los del idioma activo (`UiLocaleProvider`); también se cambian para toda la app con su prop `messages`. |
|
|
1840
|
+
| `message` | `string` | | | Primary line describing what is happening (e.g. "Estamos cargando la aplicación"). |
|
|
1841
|
+
| `spinnerLabel` | `string` | | | Accessible label for the spinner (screen readers). Defaults to the message or "Cargando". |
|
|
1842
|
+
| `title` | `string` | | | Optional emphasized heading rendered above the message. |
|
|
1843
|
+
| `variant` | `"default" \| "success" \| "danger"` | | `default` | Tone for the spinner accent. |
|
|
1815
1844
|
|
|
1816
1845
|
#### InlineLoader
|
|
1817
1846
|
|
|
@@ -1828,6 +1857,7 @@ import { InlineLoader } from "@rubenpazch/ui";
|
|
|
1828
1857
|
| -------------- | ------------------------------------ | ---- | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
1829
1858
|
| `className` | `string` | | | Extra class applied to the root element. |
|
|
1830
1859
|
| `fill` | `boolean` | | `false` | Stretch to fill the available width and height of the parent and center its content, instead of rendering as a compact inline card. Use it when the loader owns a whole region (e.g. a route's content slot). |
|
|
1860
|
+
| `labels` | `Partial<{ loading: string; }>` | | | Textos de la interfaz. Por defecto, los del idioma activo (`UiLocaleProvider`); también se cambian para toda la app con su prop `messages`. |
|
|
1831
1861
|
| `message` | `string` | | | Optional line describing what is loading (e.g. "Cargando módulo…"). |
|
|
1832
1862
|
| `spinnerLabel` | `string` | | | Accessible label for the spinner. Defaults to the message or "Cargando". |
|
|
1833
1863
|
| `variant` | `"default" \| "success" \| "danger"` | | `default` | Tone for the spinner accent. |
|
|
@@ -1901,12 +1931,13 @@ Notificaciones temporales (Toast) y avisos fijos (ToastBanner) con tipos y accio
|
|
|
1901
1931
|
import { ToastBanner } from "@rubenpazch/ui";
|
|
1902
1932
|
```
|
|
1903
1933
|
|
|
1904
|
-
| Prop | Tipo
|
|
1905
|
-
| ---------------- |
|
|
1906
|
-
| `onClose` | `(id: string) => void`
|
|
1907
|
-
| `toasts` | `ToastItem[]`
|
|
1908
|
-
| `className` | `string`
|
|
1909
|
-
| `closeAriaLabel` | `string`
|
|
1934
|
+
| Prop | Tipo | Req. | Por defecto | Descripción |
|
|
1935
|
+
| ---------------- | ----------------------------- | ---- | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
1936
|
+
| `onClose` | `(id: string) => void` | sí | | |
|
|
1937
|
+
| `toasts` | `ToastItem[]` | sí | | |
|
|
1938
|
+
| `className` | `string` | | | |
|
|
1939
|
+
| `closeAriaLabel` | `string` | | | @deprecated Usa `labels.close` (o `UiLocaleProvider`). |
|
|
1940
|
+
| `labels` | `Partial<{ close: string; }>` | | | Textos de la interfaz. Por defecto, los del idioma activo (`UiLocaleProvider`); también se cambian para toda la app con su prop `messages`. |
|
|
1910
1941
|
|
|
1911
1942
|
#### ToastProvider
|
|
1912
1943
|
|
|
@@ -1920,11 +1951,12 @@ formulario. Por eso `useToast()` falla fuera de un proveedor.
|
|
|
1920
1951
|
import { ToastProvider } from "@rubenpazch/ui";
|
|
1921
1952
|
```
|
|
1922
1953
|
|
|
1923
|
-
| Prop | Tipo
|
|
1924
|
-
| ---------------- |
|
|
1925
|
-
| `closeAriaLabel` | `string`
|
|
1926
|
-
| `
|
|
1927
|
-
| `
|
|
1954
|
+
| Prop | Tipo | Req. | Por defecto | Descripción |
|
|
1955
|
+
| ---------------- | ----------------------------- | ---- | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
1956
|
+
| `closeAriaLabel` | `string` | | | Texto accesible del botón ×. @deprecated Usa `labels.close`. |
|
|
1957
|
+
| `labels` | `Partial<{ close: string; }>` | | | Textos de la interfaz. Por defecto, los del idioma activo (`UiLocaleProvider`); también se cambian para toda la app con su prop `messages`. |
|
|
1958
|
+
| `offsetTop` | `string` | | | Distancia desde arriba en modo `floating`. |
|
|
1959
|
+
| `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). |
|
|
1928
1960
|
|
|
1929
1961
|
#### ToastRegion
|
|
1930
1962
|
|
|
@@ -2085,21 +2117,22 @@ Chip/etiqueta con variantes, icono y acción de borrar.
|
|
|
2085
2117
|
import { Chip } from "@rubenpazch/ui";
|
|
2086
2118
|
```
|
|
2087
2119
|
|
|
2088
|
-
| Prop | Tipo | Req. | Por defecto | Descripción
|
|
2089
|
-
| ----------------- | ----------------------------------------------------------------------- | ---- | ----------- |
|
|
2090
|
-
| `avatar` | `ReactNode` | | | Avatar or custom element shown at the start
|
|
2091
|
-
| `clickable` | `boolean` | | `false` | Whether the chip behaves like a button
|
|
2092
|
-
| `color` | `"default" \| "primary" \| "success" \| "warning" \| "error" \| "info"` | | `default` | Color theme for the chip
|
|
2093
|
-
| `component` | `ElementType<any, keyof IntrinsicElements>` | | | Override root component
|
|
2094
|
-
| `deleteAriaLabel` | `string` | |
|
|
2095
|
-
| `deleteIcon` | `ReactNode` | | | Custom delete icon element
|
|
2096
|
-
| `disabled` | `boolean` | | `false` | Disabled state
|
|
2097
|
-
| `icon` | `ReactNode` | | | Leading icon rendered before the label
|
|
2098
|
-
| `label` | `ReactNode` | | | Content shown inside the chip
|
|
2099
|
-
| `
|
|
2100
|
-
| `
|
|
2101
|
-
| `
|
|
2102
|
-
| `
|
|
2120
|
+
| Prop | Tipo | Req. | Por defecto | Descripción |
|
|
2121
|
+
| ----------------- | ----------------------------------------------------------------------- | ---- | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
2122
|
+
| `avatar` | `ReactNode` | | | Avatar or custom element shown at the start |
|
|
2123
|
+
| `clickable` | `boolean` | | `false` | Whether the chip behaves like a button |
|
|
2124
|
+
| `color` | `"default" \| "primary" \| "success" \| "warning" \| "error" \| "info"` | | `default` | Color theme for the chip |
|
|
2125
|
+
| `component` | `ElementType<any, keyof IntrinsicElements>` | | | Override root component |
|
|
2126
|
+
| `deleteAriaLabel` | `string` | | | Accessible label for the delete button @deprecated Usa `labels.delete`. |
|
|
2127
|
+
| `deleteIcon` | `ReactNode` | | | Custom delete icon element |
|
|
2128
|
+
| `disabled` | `boolean` | | `false` | Disabled state |
|
|
2129
|
+
| `icon` | `ReactNode` | | | Leading icon rendered before the label |
|
|
2130
|
+
| `label` | `ReactNode` | | | Content shown inside the chip |
|
|
2131
|
+
| `labels` | `Partial<{ delete: string; }>` | | | Textos de la interfaz. Por defecto, los del idioma activo (`UiLocaleProvider`); también se cambian para toda la app con su prop `messages`. |
|
|
2132
|
+
| `onDelete` | `(event: MouseEvent<HTMLButtonElement, MouseEvent>) => void` | | | Callback fired when the delete icon is clicked |
|
|
2133
|
+
| `selected` | `boolean` | | `false` | Selected/pressed state for toggleable chips |
|
|
2134
|
+
| `size` | `"sm" \| "md"` | | `md` | Chip size |
|
|
2135
|
+
| `variant` | `"filled" \| "outlined" \| "soft"` | | `filled` | Visual style for the chip |
|
|
2103
2136
|
|
|
2104
2137
|
Tipos: `ChipVariant`, `ChipColor`, `ChipSize`, `ChipProps`.
|
|
2105
2138
|
|
|
@@ -2144,15 +2177,16 @@ Pares etiqueta/valor de solo lectura (`<dl>`): resumen de un registro.
|
|
|
2144
2177
|
import { DescriptionList } from "@rubenpazch/ui";
|
|
2145
2178
|
```
|
|
2146
2179
|
|
|
2147
|
-
| Prop | Tipo
|
|
2148
|
-
| ------------ |
|
|
2149
|
-
| `items` | `DescriptionItem[]`
|
|
2150
|
-
| `className` | `string`
|
|
2151
|
-
| `columns` | `1 \| 2 \| 3`
|
|
2152
|
-
| `emptyText` | `ReactNode`
|
|
2153
|
-
| `emptyValue` | `ReactNode`
|
|
2154
|
-
| `footnote` | `ReactNode`
|
|
2155
|
-
| `
|
|
2180
|
+
| Prop | Tipo | Req. | Por defecto | Descripción |
|
|
2181
|
+
| ------------ | ----------------------------- | ---- | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
2182
|
+
| `items` | `DescriptionItem[]` | sí | | |
|
|
2183
|
+
| `className` | `string` | | | |
|
|
2184
|
+
| `columns` | `1 \| 2 \| 3` | | `2` | Columnas en pantallas anchas (en móvil siempre 1). Por defecto 2. |
|
|
2185
|
+
| `emptyText` | `ReactNode` | | | Texto si no hay ningún dato. |
|
|
2186
|
+
| `emptyValue` | `ReactNode` | | `—` | Qué mostrar si un valor está vacío. |
|
|
2187
|
+
| `footnote` | `ReactNode` | | | Nota al pie (fuente de los datos, aclaraciones). |
|
|
2188
|
+
| `labels` | `Partial<{ empty: string; }>` | | | Textos de la interfaz. Por defecto, los del idioma activo (`UiLocaleProvider`); también se cambian para toda la app con su prop `messages`. |
|
|
2189
|
+
| `title` | `ReactNode` | | | Título opcional sobre la lista. |
|
|
2156
2190
|
|
|
2157
2191
|
Tipos: `DescriptionItem`, `DescriptionListProps`.
|
|
2158
2192
|
|
|
@@ -2188,6 +2222,8 @@ import { ImageViewer } from "@rubenpazch/ui";
|
|
|
2188
2222
|
|
|
2189
2223
|
#### DEFAULT_IMAGE_VIEWER_LABELS
|
|
2190
2224
|
|
|
2225
|
+
Textos en castellano (los del diccionario `es`). Con `UiLocaleProvider` cambian solos.
|
|
2226
|
+
|
|
2191
2227
|
```tsx
|
|
2192
2228
|
import { DEFAULT_IMAGE_VIEWER_LABELS } from "@rubenpazch/ui";
|
|
2193
2229
|
```
|
|
@@ -2291,14 +2327,15 @@ convierte los estados del trámite en `items`).
|
|
|
2291
2327
|
import { Timeline } from "@rubenpazch/ui";
|
|
2292
2328
|
```
|
|
2293
2329
|
|
|
2294
|
-
| Prop | Tipo
|
|
2295
|
-
| --------------- |
|
|
2296
|
-
| `items` | `TimelineItem[]`
|
|
2297
|
-
| `aria-label` | `string`
|
|
2298
|
-
| `className` | `string`
|
|
2299
|
-
| `dense` | `boolean`
|
|
2300
|
-
| `emptyText` | `ReactNode`
|
|
2301
|
-
| `highlightLast` | `boolean`
|
|
2330
|
+
| Prop | Tipo | Req. | Por defecto | Descripción |
|
|
2331
|
+
| --------------- | ----------------------------- | ---- | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
2332
|
+
| `items` | `TimelineItem[]` | sí | | |
|
|
2333
|
+
| `aria-label` | `string` | | | Nombre accesible de la lista, p. ej. "Historial del trámite". |
|
|
2334
|
+
| `className` | `string` | | | |
|
|
2335
|
+
| `dense` | `boolean` | | `false` | Más compacto (menos espacio entre eventos). |
|
|
2336
|
+
| `emptyText` | `ReactNode` | | | Texto cuando no hay eventos. |
|
|
2337
|
+
| `highlightLast` | `boolean` | | `false` | El último evento se marca como el estado actual (anillo y negrita). |
|
|
2338
|
+
| `labels` | `Partial<{ empty: string; }>` | | | Textos de la interfaz. Por defecto, los del idioma activo (`UiLocaleProvider`); también se cambian para toda la app con su prop `messages`. |
|
|
2302
2339
|
|
|
2303
2340
|
Tipos: `TimelineItem`, `TimelineProps`, `TimelineStatus`.
|
|
2304
2341
|
|
|
@@ -2344,19 +2381,20 @@ tarjeta no se llene de botones.
|
|
|
2344
2381
|
import { UserCard } from "@rubenpazch/ui";
|
|
2345
2382
|
```
|
|
2346
2383
|
|
|
2347
|
-
| Prop | Tipo | Req. | Por defecto | Descripción
|
|
2348
|
-
| ----------- | ---------------------------- | ---- | ----------- |
|
|
2349
|
-
| `name` | `string` | sí | | Nombre visible.
|
|
2350
|
-
| `actions` | `ReactNode` | | | Acciones principales visibles en el pie (una o dos `Button`).
|
|
2351
|
-
| `as` | `"article" \| "li" \| "div"` | | `article` |
|
|
2352
|
-
| `avatarSrc` | `string` | | | Foto. Sin ella se muestran las iniciales del nombre.
|
|
2353
|
-
| `badges` | `ReactNode` | | | Etiquetas (normalmente `Badge`): rol, estado, módulos…
|
|
2354
|
-
| `children` | `ReactNode` | | | Contenido extra entre las etiquetas y el pie.
|
|
2355
|
-
| `className` | `string` | | |
|
|
2356
|
-
| `
|
|
2357
|
-
| `
|
|
2358
|
-
| `
|
|
2359
|
-
| `
|
|
2384
|
+
| Prop | Tipo | Req. | Por defecto | Descripción |
|
|
2385
|
+
| ----------- | ---------------------------- | ---- | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
2386
|
+
| `name` | `string` | sí | | Nombre visible. |
|
|
2387
|
+
| `actions` | `ReactNode` | | | Acciones principales visibles en el pie (una o dos `Button`). |
|
|
2388
|
+
| `as` | `"article" \| "li" \| "div"` | | `article` | |
|
|
2389
|
+
| `avatarSrc` | `string` | | | Foto. Sin ella se muestran las iniciales del nombre. |
|
|
2390
|
+
| `badges` | `ReactNode` | | | Etiquetas (normalmente `Badge`): rol, estado, módulos… |
|
|
2391
|
+
| `children` | `ReactNode` | | | Contenido extra entre las etiquetas y el pie. |
|
|
2392
|
+
| `className` | `string` | | | |
|
|
2393
|
+
| `labels` | `Partial<{ menu: string; }>` | | | Textos de la interfaz. Por defecto, los del idioma activo (`UiLocaleProvider`); también se cambian para toda la app con su prop `messages`. |
|
|
2394
|
+
| `menuItems` | `MenuItem[]` | | | Acciones secundarias en el menú ⋮ (editar contraseña, eliminar…). |
|
|
2395
|
+
| `menuLabel` | `string` | | | Texto accesible del botón ⋮. Por defecto "Más acciones para <nombre>". |
|
|
2396
|
+
| `muted` | `boolean` | | `false` | Atenúa la tarjeta (p. ej. usuario inactivo). |
|
|
2397
|
+
| `subtitle` | `ReactNode` | | | Dato secundario bajo el nombre: correo, documento, cargo… |
|
|
2360
2398
|
|
|
2361
2399
|
Otras exportaciones: `initials`.
|
|
2362
2400
|
|
|
@@ -2380,24 +2418,25 @@ clicables y scroll horizontal en móvil. Pagina con Pagination debajo.
|
|
|
2380
2418
|
import { DataTable } from "@rubenpazch/ui";
|
|
2381
2419
|
```
|
|
2382
2420
|
|
|
2383
|
-
| Prop | Tipo
|
|
2384
|
-
| ------------------ |
|
|
2385
|
-
| `caption` | `string`
|
|
2386
|
-
| `columns` | `DataTableColumn<T>[]`
|
|
2387
|
-
| `getRowId` | `(row: T) => string \| number`
|
|
2388
|
-
| `rows` | `T[]`
|
|
2389
|
-
| `className` | `string`
|
|
2390
|
-
| `dense` | `boolean`
|
|
2391
|
-
| `emptyAction` | `ReactNode`
|
|
2392
|
-
| `emptyDescription` | `ReactNode`
|
|
2393
|
-
| `emptyTitle` | `ReactNode`
|
|
2394
|
-
| `
|
|
2395
|
-
| `
|
|
2396
|
-
| `
|
|
2397
|
-
| `
|
|
2398
|
-
| `
|
|
2399
|
-
| `
|
|
2400
|
-
| `
|
|
2421
|
+
| Prop | Tipo | Req. | Por defecto | Descripción |
|
|
2422
|
+
| ------------------ | ---------------------------------------------- | ---- | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
2423
|
+
| `caption` | `string` | sí | | Título accesible de la tabla (se lee al entrar). Visible si `showCaption`. |
|
|
2424
|
+
| `columns` | `DataTableColumn<T>[]` | sí | | Columnas. |
|
|
2425
|
+
| `getRowId` | `(row: T) => string \| number` | sí | | id único de cada fila. |
|
|
2426
|
+
| `rows` | `T[]` | sí | | Filas. |
|
|
2427
|
+
| `className` | `string` | | | Clase extra del contenedor. |
|
|
2428
|
+
| `dense` | `boolean` | | `false` | Filas más compactas. |
|
|
2429
|
+
| `emptyAction` | `ReactNode` | | | Acción del estado vacío (Button "Crear…"). |
|
|
2430
|
+
| `emptyDescription` | `ReactNode` | | | Explicación del estado vacío. |
|
|
2431
|
+
| `emptyTitle` | `ReactNode` | | | Texto del estado vacío. |
|
|
2432
|
+
| `labels` | `Partial<{ empty: string; loading: string; }>` | | | Textos de la interfaz. Por defecto, los del idioma activo (`UiLocaleProvider`); también se cambian para toda la app con su prop `messages`. |
|
|
2433
|
+
| `loading` | `boolean` | | `false` | Muestra filas de carga. |
|
|
2434
|
+
| `loadingRows` | `number` | | `5` | Filas de carga a mostrar (por defecto 5). |
|
|
2435
|
+
| `onRowClick` | `(row: T) => void` | | | Al hacer clic (o Enter) en una fila. |
|
|
2436
|
+
| `onSortChange` | `(sort: SortState \| null) => void` | | | Al cambiar el orden (para ordenar en el servidor). |
|
|
2437
|
+
| `showCaption` | `boolean` | | `false` | Muestra el caption encima de la tabla. |
|
|
2438
|
+
| `sort` | `null \| SortState` | | | Orden controlado. Sin él, la tabla ordena sola en el navegador. |
|
|
2439
|
+
| `stickyHeader` | `boolean` | | `false` | Encabezado fijo al hacer scroll vertical. |
|
|
2401
2440
|
|
|
2402
2441
|
Tipos: `DataTableProps`, `DataTableColumn`, `SortState`, `SortDirection`.
|
|
2403
2442
|
|
|
@@ -2475,6 +2514,8 @@ import { IdentificationInput } from "@rubenpazch/ui";
|
|
|
2475
2514
|
|
|
2476
2515
|
#### DEFAULT_IDENTIFICATION_LABELS
|
|
2477
2516
|
|
|
2517
|
+
Textos en castellano (los del diccionario `es`). Con `UiLocaleProvider` cambian solos.
|
|
2518
|
+
|
|
2478
2519
|
```tsx
|
|
2479
2520
|
import { DEFAULT_IDENTIFICATION_LABELS } from "@rubenpazch/ui";
|
|
2480
2521
|
```
|