@scmlatam/web-ui 0.2.6 → 0.2.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/dist/images/clock.svg +8 -0
  2. package/dist/src/rb-components/feedback/system-alert/SystemAlert.d.ts +6 -0
  3. package/dist/src/rb-components/feedback/system-alert/index.d.ts +3 -0
  4. package/dist/src/rb-components/feedback/system-alert/systemAlertStore.d.ts +13 -0
  5. package/dist/src/rb-components/feedback/system-alert/useSystemAlert.d.ts +7 -0
  6. package/dist/src/rb-components/form/FormShell.d.ts +15 -0
  7. package/dist/src/rb-components/form/index.d.ts +2 -0
  8. package/dist/src/rb-components/index.d.ts +4 -0
  9. package/dist/src/rb-components/navigation/PillsTabs.d.ts +47 -0
  10. package/dist/src/rb-components/navigation/index.d.ts +3 -0
  11. package/dist/src/rb-components/table/RbTable.d.ts +8 -0
  12. package/dist/src/rb-components/table/RbTableToolbar.d.ts +26 -0
  13. package/dist/src/rb-components/table/index.d.ts +8 -0
  14. package/dist/src/rb-components/table/table.helpers.d.ts +36 -0
  15. package/dist/src/rb-components/table/toolbar/RbToolbarActionButton.d.ts +17 -0
  16. package/dist/src/rb-components/table/toolbar/RbToolbarDateRangeField.d.ts +23 -0
  17. package/dist/src/rb-components/table/toolbar/RbToolbarMultiSelectField.d.ts +30 -0
  18. package/dist/src/rb-components/table/toolbar/RbToolbarSearchField.d.ts +18 -0
  19. package/dist/src/rb-components/table/toolbar/RbToolbarSelectField.d.ts +36 -0
  20. package/dist/src/rb-components/table/toolbar/index.d.ts +10 -0
  21. package/dist/src/rb-components/table/types.d.ts +282 -0
  22. package/dist/src/rb-components/ui/index.d.ts +6 -0
  23. package/dist/src/rb-components/ui/primitives/AutoCustomCompleteField.d.ts +20 -0
  24. package/dist/src/rb-components/ui/primitives/RbInlineChipField.d.ts +42 -0
  25. package/dist/src/rb-components/ui/primitives/date-fields/CustomDatePicker.d.ts +12 -0
  26. package/dist/src/rb-components/ui/primitives/date-fields/CustomDateRangeCalendar.d.ts +11 -0
  27. package/dist/src/rb-components/ui/primitives/date-fields/CustomDateRangePicker.d.ts +18 -0
  28. package/dist/src/rb-components/ui/primitives/date-fields/CustomDateRangefield.d.ts +9 -0
  29. package/dist/src/rb-components/ui/primitives/date-fields/CustomDatefield.d.ts +12 -0
  30. package/dist/src/rb-components/ui/primitives/date-fields/CustomTimefield.d.ts +12 -0
  31. package/dist/src/rb-components/ui/primitives/date-fields/DateFieldTrigger.d.ts +16 -0
  32. package/dist/src/rb-components/ui/primitives/date-fields/DateShortcuts.d.ts +25 -0
  33. package/dist/src/rb-components/ui/primitives/date-fields/TimePickerPanel.d.ts +7 -0
  34. package/dist/src/rb-components/ui/primitives/date-fields/dateUtils.d.ts +18 -0
  35. package/dist/src/rb-components/ui/primitives/date-fields/index.d.ts +12 -0
  36. package/dist/src/rb-components/ui/primitives/date-fields/useDatePopover.d.ts +25 -0
  37. package/dist/src/themes/GoodRabbitDarkTheme.d.ts +13 -0
  38. package/dist/src/themes/GoodRabbitTooltips.d.ts +14 -0
  39. package/dist/web-ui.js +6936 -2622
  40. package/dist/web-ui.umd.cjs +61 -19
  41. package/package.json +1 -1
@@ -0,0 +1,8 @@
1
+ <svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <mask id="mask0_585_3487" style="mask-type:alpha" maskUnits="userSpaceOnUse" x="0" y="0" width="32" height="32">
3
+ <rect width="32" height="32" fill="#D9D9D9"/>
4
+ </mask>
5
+ <g mask="url(#mask0_585_3487)">
6
+ <path d="M17.3333 15.4667V10.6667C17.3333 10.289 17.2055 9.9723 16.95 9.71675C16.6944 9.46119 16.3777 9.33341 16 9.33341C15.6222 9.33341 15.3055 9.46119 15.05 9.71675C14.7944 9.9723 14.6666 10.289 14.6666 10.6667V15.9667C14.6666 16.1445 14.7 16.3167 14.7666 16.4834C14.8333 16.6501 14.9333 16.8001 15.0666 16.9334L19.4666 21.3334C19.7111 21.5779 20.0222 21.7001 20.4 21.7001C20.7777 21.7001 21.0888 21.5779 21.3333 21.3334C21.5777 21.089 21.7 20.7779 21.7 20.4001C21.7 20.0223 21.5777 19.7112 21.3333 19.4667L17.3333 15.4667ZM16 29.3334C14.1555 29.3334 12.4222 28.9834 10.8 28.2834C9.17774 27.5834 7.76663 26.6334 6.56663 25.4334C5.36663 24.2334 4.41663 22.8223 3.71663 21.2001C3.01663 19.5779 2.66663 17.8445 2.66663 16.0001C2.66663 14.1556 3.01663 12.4223 3.71663 10.8001C4.41663 9.17786 5.36663 7.76675 6.56663 6.56675C7.76663 5.36675 9.17774 4.41675 10.8 3.71675C12.4222 3.01675 14.1555 2.66675 16 2.66675C17.8444 2.66675 19.5777 3.01675 21.2 3.71675C22.8222 4.41675 24.2333 5.36675 25.4333 6.56675C26.6333 7.76675 27.5833 9.17786 28.2833 10.8001C28.9833 12.4223 29.3333 14.1556 29.3333 16.0001C29.3333 17.8445 28.9833 19.5779 28.2833 21.2001C27.5833 22.8223 26.6333 24.2334 25.4333 25.4334C24.2333 26.6334 22.8222 27.5834 21.2 28.2834C19.5777 28.9834 17.8444 29.3334 16 29.3334ZM16 26.6667C18.9555 26.6667 21.4722 25.6279 23.55 23.5501C25.6277 21.4723 26.6666 18.9556 26.6666 16.0001C26.6666 13.0445 25.6277 10.5279 23.55 8.45008C21.4722 6.3723 18.9555 5.33341 16 5.33341C13.0444 5.33341 10.5277 6.3723 8.44996 8.45008C6.37218 10.5279 5.33329 13.0445 5.33329 16.0001C5.33329 18.9556 6.37218 21.4723 8.44996 23.5501C10.5277 25.6279 13.0444 26.6667 16 26.6667Z" fill="#1C1B1F"/>
7
+ </g>
8
+ </svg>
@@ -0,0 +1,6 @@
1
+ import { default as React } from 'react';
2
+ interface SystemAlertProps {
3
+ }
4
+ declare const SystemAlert: ({}: SystemAlertProps) => React.ReactPortal | null;
5
+ export { SystemAlert };
6
+ export type { SystemAlertProps };
@@ -0,0 +1,3 @@
1
+ export { SystemAlert } from './SystemAlert';
2
+ export { useSystemAlert } from './useSystemAlert';
3
+ export type { SystemAlertKey, SystemAlertSeverity, } from './systemAlertStore';
@@ -0,0 +1,13 @@
1
+ export type SystemAlertSeverity = "error" | "info" | "success" | "warning" | "default";
2
+ export type SystemAlertKey = string;
3
+ export interface SystemAlertItem {
4
+ id: SystemAlertKey;
5
+ severity: SystemAlertSeverity;
6
+ message: string;
7
+ duration?: number;
8
+ }
9
+ type Listener = (items: SystemAlertItem[]) => void;
10
+ export declare function subscribeSystemAlerts(listener: Listener): () => void;
11
+ export declare function addSystemAlert(alert: SystemAlertItem): void;
12
+ export declare function removeSystemAlert(id: SystemAlertKey): void;
13
+ export {};
@@ -0,0 +1,7 @@
1
+ import { SystemAlertKey, SystemAlertSeverity } from './systemAlertStore';
2
+ declare const useSystemAlert: () => {
3
+ showAlert: (severity: SystemAlertSeverity, message: string) => SystemAlertKey;
4
+ closeAlert: (key: SystemAlertKey) => void;
5
+ };
6
+ export { useSystemAlert };
7
+ export type { SystemAlertSeverity, SystemAlertKey };
@@ -0,0 +1,15 @@
1
+ import { ReactNode } from 'react';
2
+ type FormShellSize = "s" | "m" | "l";
3
+ export interface FormShellProps {
4
+ open: boolean;
5
+ title?: ReactNode;
6
+ alert?: ReactNode;
7
+ children?: ReactNode;
8
+ footer?: ReactNode;
9
+ onClose?: () => void;
10
+ loading?: boolean;
11
+ closeLabel?: string;
12
+ size?: FormShellSize;
13
+ }
14
+ export declare function FormShell({ open, title, alert, children, footer, onClose, loading, closeLabel, size, }: FormShellProps): import("react/jsx-runtime").JSX.Element | null;
15
+ export default FormShell;
@@ -0,0 +1,2 @@
1
+ export { default as FormShell } from './FormShell';
2
+ export type { FormShellProps } from './FormShell';
@@ -1,3 +1,7 @@
1
1
  export * from './shell';
2
2
  export * from './sidebar';
3
3
  export * from './topbar';
4
+ export * from './form';
5
+ export * from './ui';
6
+ export * from './table';
7
+ export * from './navigation';
@@ -0,0 +1,47 @@
1
+ import { default as React } from 'react';
2
+ /**
3
+ * ----------------------------------------------------------------------------
4
+ * PILLS TABS / SEGMENTED SWITCH
5
+ * ----------------------------------------------------------------------------
6
+ *
7
+ * Componente simple para separar contenido por pestañas usando un switch visual.
8
+ *
9
+ * Objetivo:
10
+ * - No depende de MUI.
11
+ * - No maneja permisos.
12
+ * - No decide qué contenido renderizar.
13
+ * - Solo renderiza opciones y notifica el tab activo con onChange.
14
+ *
15
+ * Estilo:
16
+ * - Contenedor blanco tipo segmented control.
17
+ * - Activo: cápsula base-dark + texto blanco.
18
+ * - Inactivo: transparente + texto base-dark.
19
+ * - Pensado para 2 o más tabs.
20
+ *
21
+ * Uso:
22
+ *
23
+ * const [tab, setTab] = useState("legacy");
24
+ *
25
+ * <PillsTabs
26
+ * value={tab}
27
+ * onChange={setTab}
28
+ * items={[
29
+ * { value: "legacy", label: "Legacy" },
30
+ * { value: "rb", label: "RB Components" },
31
+ * ]}
32
+ * />
33
+ */
34
+ export type PillsTabItem<Value extends string = string> = {
35
+ value: Value;
36
+ label: React.ReactNode;
37
+ disabled?: boolean;
38
+ };
39
+ export type PillsTabsProps<Value extends string = string> = {
40
+ value: Value;
41
+ items: PillsTabItem<Value>[];
42
+ onChange: (value: Value) => void;
43
+ className?: string;
44
+ ariaLabel?: string;
45
+ };
46
+ export declare function PillsTabs<Value extends string = string>({ value, items, onChange, className, ariaLabel, }: PillsTabsProps<Value>): import("react/jsx-runtime").JSX.Element;
47
+ export default PillsTabs;
@@ -0,0 +1,3 @@
1
+ export { PillsTabs } from './PillsTabs';
2
+ export { PillsTabs as RbPillsTabs } from './PillsTabs';
3
+ export type { PillsTabItem, PillsTabsProps } from './PillsTabs';
@@ -0,0 +1,8 @@
1
+ import { RbTableProps } from './types';
2
+ /**
3
+ * ----------------------------------------------------------------------------
4
+ * RB TABLE
5
+ * ----------------------------------------------------------------------------
6
+ */
7
+ export declare function RbTable<Row = any>({ columns, rows, loading, getRowKey, title, description, toolbarLeft, toolbarRight, showToolbar, toolbarClassName, emptyText, emptyState, className, rootClassName, bodyClassName, size, fill, density, onRowClick, rowClassName, getCellClassName, getRowClassName, checkboxSelection, rowSelectionModel, setRowSelectionModel, onRowSelectionModelChange, isRowSelectable, disableRowSelectionOnClick, pinnedColumns, initialState, paginate, defaultRowsPerPage, rowsPerPageOptions, resultsLabel, viewAllLabel, prevAriaLabel, nextAriaLabel, footer, footerActions, hideFooter, }: RbTableProps<Row>): import("react/jsx-runtime").JSX.Element;
8
+ export default RbTable;
@@ -0,0 +1,26 @@
1
+ import { default as React } from 'react';
2
+ /**
3
+ * ----------------------------------------------------------------------------
4
+ * RB TABLE TOOLBAR
5
+ * ----------------------------------------------------------------------------
6
+ *
7
+ * Toolbar base para RbTable.
8
+ *
9
+ * Reglas:
10
+ * - El consumo debe ser simple.
11
+ * - toolbarLeft puede ser cualquier nodo.
12
+ * - toolbarRight puede tener filtros, botones o acciones.
13
+ * - Se mantiene en una fila lo más posible.
14
+ * - Los campos se achican antes de saltar.
15
+ * - Cuando ya no caben, recién pasan a más filas.
16
+ * - La responsividad depende del ancho real de la toolbar, no del viewport.
17
+ */
18
+ export type RbTableToolbarProps = {
19
+ title?: React.ReactNode;
20
+ description?: React.ReactNode;
21
+ left?: React.ReactNode;
22
+ right?: React.ReactNode;
23
+ className?: string;
24
+ };
25
+ export declare function RbTableToolbar({ title, description, left, right, className, }: RbTableToolbarProps): import("react/jsx-runtime").JSX.Element | null;
26
+ export default RbTableToolbar;
@@ -0,0 +1,8 @@
1
+ export { RbTable } from './RbTable';
2
+ export { RbTable as Table } from './RbTable';
3
+ export { default } from './RbTable';
4
+ export { RbTableToolbar } from './RbTableToolbar';
5
+ export type { RbTableToolbarProps } from './RbTableToolbar';
6
+ export * from './toolbar';
7
+ export type { RbAnyTableColumn, RbLegacyGridColumn, RbRowSelectionModel, RbRowsPerPageOption, RbTableAlign, RbTableCellParams, RbTableColumn, RbTableDensity, RbTableInitialState, RbTablePinnedColumns, RbTableProps, RbTableRowId, RbTableRowParams, RbTableSize, } from './types';
8
+ export { cx, getAlignClass, getCellValue, getCssGridWidth, getDefaultRowId, getSelectionArray, getStickyWidth, isLegacyGridColumn, isSelected, normalizeTableColumns, resolvePinnedColumns, toggleSelection, } from './table.helpers';
@@ -0,0 +1,36 @@
1
+ import { RbAnyTableColumn, RbLegacyGridColumn, RbRowSelectionModel, RbTableColumn, RbTablePinnedColumns, RbTableRowId } from './types';
2
+ /**
3
+ * ----------------------------------------------------------------------------
4
+ * RB TABLE - HELPERS
5
+ * ----------------------------------------------------------------------------
6
+ *
7
+ * Estos helpers existen para que la tabla pueda recibir columnas nuevas RB o
8
+ * columnas antiguas tipo DataGrid/GridColDef.
9
+ *
10
+ * La idea es que la migración sea progresiva:
11
+ *
12
+ * - Proyectos nuevos: usar estructura RB.
13
+ * - Proyectos antiguos: pueden partir reutilizando sus columnas legacy.
14
+ */
15
+ export declare function cx(...classes: Array<string | false | null | undefined>): string;
16
+ export declare function isLegacyGridColumn<Row = any>(column: RbAnyTableColumn<Row>): column is RbLegacyGridColumn<Row>;
17
+ export declare function normalizeTableColumns<Row = any>(columns?: RbAnyTableColumn<Row>[]): RbTableColumn<Row>[];
18
+ export declare function getLegacyColumnWidth<Row = any>(column: RbLegacyGridColumn<Row>): string | number;
19
+ export declare function getDefaultRowId<Row = any>(row: Row, index: number): RbTableRowId;
20
+ export declare function getCellValue<Row = any>(row: Row, key: string): any;
21
+ export declare function getSelectionArray(model?: RbRowSelectionModel): RbTableRowId[];
22
+ export declare function isSelected(id: RbTableRowId, model?: RbRowSelectionModel): boolean;
23
+ export declare function toggleSelection(id: RbTableRowId, model?: RbRowSelectionModel): RbTableRowId[];
24
+ export declare function resolvePinnedColumns(pinnedColumns?: RbTablePinnedColumns, initialStatePinnedColumns?: RbTablePinnedColumns): RbTablePinnedColumns;
25
+ export declare function getCssGridWidth(width?: number | string): string;
26
+ /**
27
+ * Para sticky columns necesitamos offsets en px.
28
+ *
29
+ * Si una columna sticky usa "1fr", no existe un ancho real calculable desde JS
30
+ * sin medir el DOM. Para esta primera versión usamos un fallback razonable.
31
+ *
32
+ * Recomendación:
33
+ * - pinned columns importantes deberían tener width numérico o px.
34
+ */
35
+ export declare function getStickyWidth(width?: number | string): number;
36
+ export declare function getAlignClass(align?: string): "text-center justify-center" | "text-right justify-end" | "text-left justify-start";
@@ -0,0 +1,17 @@
1
+ import { default as React } from 'react';
2
+ /**
3
+ * ----------------------------------------------------------------------------
4
+ * RB TOOLBAR ACTION BUTTON
5
+ * ----------------------------------------------------------------------------
6
+ *
7
+ * - variant="secondaryPrimary": botón con texto.
8
+ * - variant="icon": acción solo ícono.
9
+ */
10
+ export type RbToolbarActionButtonVariant = "secondaryPrimary" | "icon";
11
+ export type RbToolbarActionButtonProps = React.ButtonHTMLAttributes<HTMLButtonElement> & {
12
+ variant?: RbToolbarActionButtonVariant;
13
+ icon?: React.ReactNode;
14
+ loading?: boolean;
15
+ };
16
+ export declare function RbToolbarActionButton({ children, icon, loading, disabled, variant, className, type, ...props }: RbToolbarActionButtonProps): import("react/jsx-runtime").JSX.Element;
17
+ export default RbToolbarActionButton;
@@ -0,0 +1,23 @@
1
+ import { Dayjs } from 'dayjs';
2
+ /**
3
+ * ----------------------------------------------------------------------------
4
+ * RB TOOLBAR DATE RANGE FIELD
5
+ * ----------------------------------------------------------------------------
6
+ *
7
+ * Wrapper para date range dentro de toolbar.
8
+ *
9
+ * El ancho lo controla RbTableToolbar, para que el consumo sea simple
10
+ * y no haya que ajustar cada pantalla a mano.
11
+ */
12
+ export type RbToolbarDateRangeValue = [Dayjs | null, Dayjs | null];
13
+ export type RbToolbarDateRangeFieldProps = {
14
+ label?: string;
15
+ value: RbToolbarDateRangeValue;
16
+ onChange: (value: RbToolbarDateRangeValue) => void;
17
+ initialValue?: RbToolbarDateRangeValue;
18
+ calendars?: 1 | 2 | 3;
19
+ disabled?: boolean;
20
+ className?: string;
21
+ };
22
+ export declare function RbToolbarDateRangeField({ label, value, onChange, initialValue, calendars, disabled, className, }: RbToolbarDateRangeFieldProps): import("react/jsx-runtime").JSX.Element;
23
+ export default RbToolbarDateRangeField;
@@ -0,0 +1,30 @@
1
+ import { default as React } from 'react';
2
+ import { RbToolbarSelectOption } from './RbToolbarSelectField';
3
+ /**
4
+ * ----------------------------------------------------------------------------
5
+ * RB TOOLBAR MULTI SELECT FIELD
6
+ * ----------------------------------------------------------------------------
7
+ *
8
+ * Multi select dark para toolbars de tabla.
9
+ *
10
+ * Responsive:
11
+ * - Se achica hasta un mínimo razonable.
12
+ * - Si ya no cabe, permite que la toolbar lo mande a otra fila.
13
+ * - Mantiene overflow visible para labels y dropdown.
14
+ */
15
+ export type RbToolbarMultiSelectFieldProps = {
16
+ label?: React.ReactNode;
17
+ value: string[];
18
+ onChange: (value: string[]) => void;
19
+ options?: RbToolbarSelectOption[];
20
+ placeholder?: string;
21
+ className?: string;
22
+ disabled?: boolean;
23
+ search?: {
24
+ value: string;
25
+ onChange: (value: string) => void;
26
+ placeholder?: string;
27
+ };
28
+ };
29
+ export declare function RbToolbarMultiSelectField({ label, value, onChange, options, placeholder, className, disabled, search, }: RbToolbarMultiSelectFieldProps): import("react/jsx-runtime").JSX.Element;
30
+ export default RbToolbarMultiSelectField;
@@ -0,0 +1,18 @@
1
+ import { default as React } from 'react';
2
+ /**
3
+ * ----------------------------------------------------------------------------
4
+ * RB TOOLBAR SEARCH FIELD
5
+ * ----------------------------------------------------------------------------
6
+ *
7
+ * Input dark para toolbars de tabla.
8
+ */
9
+ export type RbToolbarSearchFieldProps = {
10
+ label?: React.ReactNode;
11
+ value: string;
12
+ onChange: (value: string) => void;
13
+ placeholder?: string;
14
+ className?: string;
15
+ disabled?: boolean;
16
+ };
17
+ export declare function RbToolbarSearchField({ label, value, onChange, placeholder, className, disabled, }: RbToolbarSearchFieldProps): import("react/jsx-runtime").JSX.Element;
18
+ export default RbToolbarSearchField;
@@ -0,0 +1,36 @@
1
+ import { default as React } from 'react';
2
+ /**
3
+ * ----------------------------------------------------------------------------
4
+ * RB TOOLBAR SELECT FIELD
5
+ * ----------------------------------------------------------------------------
6
+ *
7
+ * Select dark para toolbars de tabla.
8
+ *
9
+ * Responsive:
10
+ * - Se achica hasta un mínimo razonable.
11
+ * - Si ya no cabe, permite que la toolbar lo mande a otra fila.
12
+ * - Mantiene overflow visible para labels y dropdown.
13
+ */
14
+ export type RbToolbarSelectOption = {
15
+ value: string;
16
+ label: React.ReactNode;
17
+ sublabel?: React.ReactNode;
18
+ icon?: React.ReactNode;
19
+ disabled?: boolean;
20
+ };
21
+ export type RbToolbarSelectFieldProps = {
22
+ label?: React.ReactNode;
23
+ value: string;
24
+ onChange: (value: string) => void;
25
+ options?: RbToolbarSelectOption[];
26
+ placeholder?: string;
27
+ className?: string;
28
+ disabled?: boolean;
29
+ search?: {
30
+ value: string;
31
+ onChange: (value: string) => void;
32
+ placeholder?: string;
33
+ };
34
+ };
35
+ export declare function RbToolbarSelectField({ label, value, onChange, options, placeholder, className, disabled, search, }: RbToolbarSelectFieldProps): import("react/jsx-runtime").JSX.Element;
36
+ export default RbToolbarSelectField;
@@ -0,0 +1,10 @@
1
+ export { RbToolbarActionButton } from './RbToolbarActionButton';
2
+ export { RbToolbarDateRangeField } from './RbToolbarDateRangeField';
3
+ export { RbToolbarMultiSelectField } from './RbToolbarMultiSelectField';
4
+ export { RbToolbarSearchField } from './RbToolbarSearchField';
5
+ export { RbToolbarSelectField } from './RbToolbarSelectField';
6
+ export type { RbToolbarActionButtonProps, RbToolbarActionButtonVariant, } from './RbToolbarActionButton';
7
+ export type { RbToolbarDateRangeFieldProps, RbToolbarDateRangeValue, } from './RbToolbarDateRangeField';
8
+ export type { RbToolbarMultiSelectFieldProps } from './RbToolbarMultiSelectField';
9
+ export type { RbToolbarSearchFieldProps } from './RbToolbarSearchField';
10
+ export type { RbToolbarSelectFieldProps, RbToolbarSelectOption, } from './RbToolbarSelectField';
@@ -0,0 +1,282 @@
1
+ import { default as React } from 'react';
2
+ /**
3
+ * ----------------------------------------------------------------------------
4
+ * RB TABLE - TYPES
5
+ * ----------------------------------------------------------------------------
6
+ *
7
+ * Esta tabla nace para reemplazar progresivamente la tabla antigua basada en
8
+ * MUI/DataGridPro, pero sin romper de golpe la forma en que los proyectos ya
9
+ * construyen sus columnas.
10
+ *
11
+ * Por eso soportamos dos formas de columnas:
12
+ *
13
+ * 1. Columna RB nueva:
14
+ *
15
+ * {
16
+ * key: "fullname",
17
+ * header: "Nombre",
18
+ * width: "1fr",
19
+ * render: (row) => row.fullname
20
+ * }
21
+ *
22
+ * 2. Columna tipo DataGrid/GridColDef:
23
+ *
24
+ * {
25
+ * field: "fullname",
26
+ * headerName: "Nombre",
27
+ * flex: 1,
28
+ * renderCell: ({ row }) => row.fullname
29
+ * }
30
+ *
31
+ * La tabla normaliza internamente ambas estructuras.
32
+ */
33
+ export type RbTableRowId = string | number;
34
+ export type RbTableDensity = "compact" | "comfortable";
35
+ export type RbTableSize = "s" | "m" | "l";
36
+ export type RbTableAlign = "left" | "center" | "right";
37
+ export type RbTablePinnedColumns = {
38
+ left?: string[];
39
+ right?: string[];
40
+ };
41
+ export type RbTableInitialState = {
42
+ pinnedColumns?: RbTablePinnedColumns;
43
+ };
44
+ /**
45
+ * Estructura recomendada para columnas nuevas.
46
+ */
47
+ export type RbTableColumn<Row = any> = {
48
+ /**
49
+ * Identificador de la columna.
50
+ * En columnas nuevas usamos `key`.
51
+ */
52
+ key: string;
53
+ /**
54
+ * Contenido del header.
55
+ */
56
+ header?: React.ReactNode;
57
+ /**
58
+ * Ancho de columna.
59
+ *
60
+ * Soporta:
61
+ * - number => px
62
+ * - "120px"
63
+ * - "1fr"
64
+ * - "minmax(120px, 1fr)"
65
+ *
66
+ * Nota sobre pinned columns:
67
+ * Para columnas fijas/sticky se recomienda usar ancho numérico o px.
68
+ */
69
+ width?: number | string;
70
+ /**
71
+ * Alineación horizontal.
72
+ *
73
+ * Nota:
74
+ * En la primera versión visual de RbTable se fuerza izquierda para textos.
75
+ * El checkbox se mantiene centrado.
76
+ */
77
+ align?: RbTableAlign;
78
+ /**
79
+ * Render custom de celda.
80
+ */
81
+ render?: (row: Row, index: number) => React.ReactNode;
82
+ /**
83
+ * Render custom de header.
84
+ */
85
+ renderHeader?: () => React.ReactNode;
86
+ /**
87
+ * Si es false, permite salto de línea.
88
+ * Por defecto se trunca en una línea.
89
+ */
90
+ truncate?: boolean;
91
+ /**
92
+ * Clases extra para header.
93
+ */
94
+ headerClassName?: string;
95
+ /**
96
+ * Clases extra para celda.
97
+ */
98
+ cellClassName?: string | ((row: Row, index: number) => string | undefined);
99
+ /**
100
+ * Props aceptadas para compatibilidad/documentación.
101
+ * No todas tienen comportamiento avanzado todavía.
102
+ */
103
+ sortable?: boolean;
104
+ filterable?: boolean;
105
+ disabled?: boolean;
106
+ };
107
+ /**
108
+ * Estructura parecida a GridColDef para facilitar migración.
109
+ * No importamos tipos de MUI para no arrastrar dependencia.
110
+ */
111
+ export type RbLegacyGridColumn<Row = any> = {
112
+ field: string;
113
+ headerName?: React.ReactNode;
114
+ header?: React.ReactNode;
115
+ width?: number;
116
+ minWidth?: number;
117
+ maxWidth?: number;
118
+ flex?: number;
119
+ align?: RbTableAlign;
120
+ headerAlign?: RbTableAlign;
121
+ sortable?: boolean;
122
+ filterable?: boolean;
123
+ headerClassName?: string;
124
+ cellClassName?: string | ((params: RbTableCellParams<Row>) => string | undefined);
125
+ renderCell?: (params: RbTableCellParams<Row>) => React.ReactNode;
126
+ valueGetter?: (params: RbTableCellParams<Row>) => React.ReactNode;
127
+ };
128
+ export type RbAnyTableColumn<Row = any> = RbTableColumn<Row> | RbLegacyGridColumn<Row>;
129
+ export type RbTableCellParams<Row = any> = {
130
+ row: Row;
131
+ id: RbTableRowId;
132
+ field: string;
133
+ value: any;
134
+ index: number;
135
+ };
136
+ export type RbTableRowParams<Row = any> = {
137
+ row: Row;
138
+ id: RbTableRowId;
139
+ index: number;
140
+ };
141
+ export type RbRowSelectionModel = RbTableRowId[] | Set<RbTableRowId>
142
+ /**
143
+ * Compatibilidad con versiones nuevas de MUI donde el selection model puede
144
+ * venir como objeto con ids.
145
+ */
146
+ | {
147
+ ids?: Set<RbTableRowId> | RbTableRowId[];
148
+ type?: "include" | "exclude";
149
+ };
150
+ export type RbRowsPerPageOption = number | {
151
+ value: number;
152
+ label: string;
153
+ };
154
+ export type RbTableProps<Row = any> = {
155
+ /**
156
+ * Columnas. Puede recibir columnas RB nuevas o columnas legacy tipo GridColDef.
157
+ */
158
+ columns?: RbAnyTableColumn<Row>[];
159
+ /**
160
+ * Data de la tabla.
161
+ */
162
+ rows?: Row[];
163
+ /**
164
+ * Estado loading.
165
+ */
166
+ loading?: boolean;
167
+ /**
168
+ * Permite definir la key de cada fila.
169
+ * Si no se pasa, intenta usar row.id y si no existe usa el índice.
170
+ */
171
+ getRowKey?: (row: Row, index: number) => RbTableRowId;
172
+ /**
173
+ * Header/toolbar nuevo.
174
+ *
175
+ * Por defecto, si existe title/description/toolbarLeft/toolbarRight,
176
+ * se muestra una toolbar oscura arriba de la tabla.
177
+ *
178
+ * Si no quieres mostrar esa franja, usa:
179
+ *
180
+ * showToolbar={false}
181
+ */
182
+ title?: React.ReactNode;
183
+ description?: React.ReactNode;
184
+ toolbarLeft?: React.ReactNode;
185
+ toolbarRight?: React.ReactNode;
186
+ showToolbar?: boolean;
187
+ toolbarClassName?: string;
188
+ /**
189
+ * Empty state.
190
+ */
191
+ emptyText?: React.ReactNode;
192
+ emptyState?: React.ReactNode;
193
+ /**
194
+ * Estilos generales.
195
+ */
196
+ className?: string;
197
+ rootClassName?: string;
198
+ bodyClassName?: string;
199
+ /**
200
+ * Tamaño visual.
201
+ */
202
+ size?: RbTableSize;
203
+ /**
204
+ * Si true, ocupa todo el alto disponible del padre.
205
+ */
206
+ fill?: boolean;
207
+ /**
208
+ * Densidad visual.
209
+ */
210
+ density?: RbTableDensity;
211
+ /**
212
+ * Click en fila.
213
+ */
214
+ onRowClick?: (row: Row, index: number) => void;
215
+ /**
216
+ * Clase custom para fila.
217
+ */
218
+ rowClassName?: string | ((params: RbTableRowParams<Row>) => string | undefined);
219
+ /**
220
+ * Clase custom para celda, compatible con la prop actual usada en DataGrid.
221
+ */
222
+ getCellClassName?: (params: RbTableCellParams<Row>) => string | undefined;
223
+ /**
224
+ * Clase custom para fila, equivalente a getRowClassName de DataGrid.
225
+ */
226
+ getRowClassName?: (params: RbTableRowParams<Row>) => string | undefined;
227
+ /**
228
+ * Selección.
229
+ */
230
+ checkboxSelection?: boolean;
231
+ rowSelectionModel?: RbRowSelectionModel;
232
+ setRowSelectionModel?: (value: RbTableRowId[]) => void;
233
+ onRowSelectionModelChange?: (value: RbTableRowId[]) => void;
234
+ /**
235
+ * Controla si una fila puede seleccionarse.
236
+ */
237
+ isRowSelectable?: (params: RbTableRowParams<Row>) => boolean;
238
+ /**
239
+ * Evita que el click en fila seleccione.
240
+ * Se deja por compatibilidad con DataGrid.
241
+ */
242
+ disableRowSelectionOnClick?: boolean;
243
+ /**
244
+ * Pinned columns.
245
+ *
246
+ * Se soporta:
247
+ * - pinnedColumns={{ left: ["__check__", "fullname"], right: ["actions"] }}
248
+ * - initialState={{ pinnedColumns: { left: ["__check__"] } }}
249
+ */
250
+ pinnedColumns?: RbTablePinnedColumns;
251
+ initialState?: RbTableInitialState;
252
+ /**
253
+ * Paginación interna simple.
254
+ */
255
+ paginate?: boolean;
256
+ defaultRowsPerPage?: number;
257
+ rowsPerPageOptions?: RbRowsPerPageOption[];
258
+ resultsLabel?: string;
259
+ viewAllLabel?: string;
260
+ prevAriaLabel?: string;
261
+ nextAriaLabel?: string;
262
+ /**
263
+ * Footer custom.
264
+ */
265
+ footer?: React.ReactNode;
266
+ footerActions?: React.ReactNode;
267
+ /**
268
+ * Props legacy aceptadas para que la migración no explote.
269
+ * En esta tabla nueva no todas tienen efecto todavía.
270
+ */
271
+ apiRef?: unknown;
272
+ headerFilters?: boolean;
273
+ hideFooter?: boolean;
274
+ disableColumnMenu?: boolean;
275
+ slotProps?: Record<string, any>;
276
+ contextMenu?: any;
277
+ setContextMenu?: (value: any) => void;
278
+ options?: any[];
279
+ optionGroup?: any;
280
+ paginationModel?: any;
281
+ setPaginationModel?: (value: any) => void;
282
+ };
@@ -17,6 +17,12 @@
17
17
  export { cn } from './utils/cn';
18
18
  export { Button } from './primitives/Button';
19
19
  export type { ButtonProps } from './primitives/Button';
20
+ export { AutoCustomCompleteField } from './primitives/AutoCustomCompleteField';
21
+ export type { AutoValueItem, CustomAutoCompleteFieldProps, } from './primitives/AutoCustomCompleteField';
22
+ export { CustomDatefield, CustomDatePicker, CustomTimefield, CustomDateRangefield, CustomDateRangePicker, CustomDateRangeCalendar, } from './primitives/date-fields';
23
+ export type { CustomDatefieldProps, CustomDatePickerProps, CustomTimefieldProps, CustomDateRangefieldProps, CustomDateRangePickerProps, CustomDateRangeCalendarProps, } from './primitives/date-fields';
24
+ export { RbInlineChipField, CalendarChipIcon, ClockChipIcon, } from './primitives/RbInlineChipField';
25
+ export type { RbInlineChipFieldProps, RbInlineChipFieldAction, } from './primitives/RbInlineChipField';
20
26
  export { Card, CardHeader, CardTitle, CardContent, CardFooter, } from './primitives/Card';
21
27
  export type { CardProps } from './primitives/Card';
22
28
  export { IconButton } from './primitives/IconButton';