@acvl/frontend-components 0.0.70 → 0.0.72

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/dist/index.d.ts CHANGED
@@ -392,7 +392,7 @@ interface ExportCSVButtonProps extends Pick<ExportButtonProps, "filterModel" | "
392
392
  column_key?: string;
393
393
  };
394
394
  }
395
- declare const ExportCSV: React__default.FC<ExportCSVButtonProps>;
395
+ declare const ExportCSV$1: React__default.FC<ExportCSVButtonProps>;
396
396
 
397
397
  declare const CustomNoRows: () => react_jsx_runtime.JSX.Element;
398
398
 
@@ -953,17 +953,17 @@ declare const LoadingComponent: React__default.FC<LoadingComponentProps>;
953
953
  /**
954
954
  * Muestra el logo de la empresa
955
955
  *
956
- * El archivo de marca es un JPG con fondo blanco, bola roja y letras negras: tal
957
- * cual, en modo oscuro se ve un recuadro blanco. Como no hay versión clara del
958
- * archivo, en oscuro se recolorea por CSS a blanco sobre transparente.
956
+ * El archivo de marca es un PNG con fondo transparente, bola roja y letras
957
+ * negras. En claro va tal cual; en oscuro las letras negras desaparecerían
958
+ * contra el fondo, así que se recolorea por CSS a blanco.
959
959
  **/
960
960
  interface LogoProps {
961
961
  /** Altura máxima en px. */
962
962
  maxHeight?: number;
963
963
  /**
964
- * Logo alternativo para modo oscuro. Lo suyo es un SVG o PNG blanco con fondo
965
- * transparente: en cuanto exista, pasarlo aquí sustituye el recoloreado por
966
- * el archivo de verdad sin tocar nada más.
964
+ * Logo alternativo para modo oscuro. Lo suyo es una versión blanca de la
965
+ * marca: en cuanto exista, pasarla aquí sustituye el recoloreado por el
966
+ * archivo de verdad sin tocar nada más.
967
967
  */
968
968
  darkSrc?: string;
969
969
  }
@@ -1056,6 +1056,12 @@ interface APIcontextProps {
1056
1056
  useSubirCSVMutation: any;
1057
1057
  useRemoverCSVMutation: any;
1058
1058
  useGenericCrudMutation: any;
1059
+ /** Columnas exportables de un listado, para el selector del CSV. */
1060
+ useGetColumnasDeExportacionQuery: any;
1061
+ /** Presets de columnas guardados por el usuario, por recurso y variante. */
1062
+ useGetPreferenciasDeExportacionQuery: any;
1063
+ useGuardarPreferenciaDeExportacionMutation: any;
1064
+ useBorrarPreferenciaDeExportacionMutation: any;
1059
1065
  }
1060
1066
  declare const APIContext: React.Context<APIcontextProps | null>;
1061
1067
  declare const APIProvider: ({ children, hooks, }: {
@@ -1373,6 +1379,12 @@ interface CustomFilterDef {
1373
1379
  defaultValue?: any;
1374
1380
  }
1375
1381
 
1382
+ /**
1383
+ * Where the filter panel renders. `"drawer"` (the default) docks it to the right of the rows;
1384
+ * `"popper"` floats it off the toolbar button, the way it used to.
1385
+ */
1386
+ type FiltersVariant = "drawer" | "popper";
1387
+
1376
1388
  /**
1377
1389
  * What the grid hands its RTK lazy query — the corrected `GridArgs`.
1378
1390
  *
@@ -1499,6 +1511,30 @@ interface ServerGridProps {
1499
1511
  * filter. The grid has no notion of who is looking at it.
1500
1512
  */
1501
1513
  customFilters?: CustomFilterDef[];
1514
+ /**
1515
+ * Where the filters panel goes. Defaults to `"drawer"`: docked to the right of the
1516
+ * rows, taking its own column, so a filter and what it did to the list are on screen
1517
+ * together and the panel survives being used — applying no longer dismisses it.
1518
+ *
1519
+ * `"popper"` is the old floating panel, hanging off the toolbar button.
1520
+ *
1521
+ * A grid too narrow to dock into falls back to the popper on its own, so this rarely
1522
+ * needs setting for width's sake alone — see `filtersMinGridWidth`.
1523
+ */
1524
+ filtersVariant?: FiltersVariant;
1525
+ /** Width of the docked filters panel, in px. Defaults to `340`. Ignored by the popper. */
1526
+ filtersWidth?: number;
1527
+ /**
1528
+ * How much room the rows must keep for the panel to dock at all, in px. Defaults to
1529
+ * `480`.
1530
+ *
1531
+ * The grid measures itself — not the window, since the same grid is a full page on one
1532
+ * route and a panel inside a drawer on the next — and falls back to the popper whenever
1533
+ * `filtersWidth` wouldn't leave this much behind. Raise it for grids with wide columns
1534
+ * that need more room before the trade is worth it; `0` turns the fallback off and
1535
+ * docks at any width.
1536
+ */
1537
+ filtersMinGridWidth?: number;
1502
1538
  /** Skip session persistence entirely. */
1503
1539
  dontSaveState?: boolean;
1504
1540
  /**
@@ -1581,6 +1617,35 @@ type GridLayerMap = Partial<Record<GridLayerId, GridLayerContribution>>;
1581
1617
  */
1582
1618
  declare function ServerGrid(props: ServerGridProps): react_jsx_runtime.JSX.Element;
1583
1619
 
1620
+ interface ExportCSVProps {
1621
+ handleClick: () => void;
1622
+ filterModel: MyGridFilterModel;
1623
+ sortModel: GridSortModel;
1624
+ rowSelectionModel: GridRowSelectionModel;
1625
+ /** The scoping the grid queries with. Without it an export exceeds what the grid shows. */
1626
+ queryArgs?: ServerGridArgs;
1627
+ disabledWithoutSelection?: boolean;
1628
+ /** Rows the current filters match, for the count shown in the picker. */
1629
+ rowCount?: number;
1630
+ ignore?: {
1631
+ filters?: string[];
1632
+ sort?: boolean;
1633
+ };
1634
+ slots?: {
1635
+ endpoint?: string;
1636
+ title?: string;
1637
+ variant?: string;
1638
+ column_key?: string;
1639
+ /** Opens the column picker instead of downloading straight away. Defaults to on. */
1640
+ columnPicker?: boolean;
1641
+ };
1642
+ }
1643
+ /**
1644
+ * Downloads the whole filtered result set as CSV — the server rebuilds it from the filters,
1645
+ * so this is never limited to the rows currently on screen.
1646
+ */
1647
+ declare function ExportCSV(props: ExportCSVProps): react_jsx_runtime.JSX.Element;
1648
+
1584
1649
  interface UseServerGridOptions {
1585
1650
  /** Where this grid's state is remembered. Fixed for the lifetime of the mount. */
1586
1651
  storageKey: string;
@@ -1624,6 +1689,13 @@ interface ServerGridState {
1624
1689
  /** Toolbar collapse, hoisted here so shortcuts can reopen a collapsed toolbar. */
1625
1690
  toolbarExpanded: boolean;
1626
1691
  setToolbarExpanded: Dispatch<SetStateAction<boolean>>;
1692
+ /**
1693
+ * Whether the filter panel is showing. Up here rather than in the toolbar because the
1694
+ * docked panel is a sibling of the grid, not a child of the button that opens it — and
1695
+ * because Ctrl+Shift+F has to reach it from a collapsed toolbar either way.
1696
+ */
1697
+ filtersOpen: boolean;
1698
+ setFiltersOpen: Dispatch<SetStateAction<boolean>>;
1627
1699
  /** Exactly what was last sent to the server. Also feeds the CSV export. */
1628
1700
  args: ServerGridArgs;
1629
1701
  refetch: () => void;
@@ -2169,6 +2241,27 @@ interface DetailFormProps {
2169
2241
  */
2170
2242
  declare function DetailForm({ controller, formId, storageKey, loadingHeight, responsiveTo, containerBreakpoints, slotProps, }: DetailFormProps): react_jsx_runtime.JSX.Element;
2171
2243
 
2244
+ /**
2245
+ * An action the consumer hangs off a record's chrome — cerrar, revertir, descargar el PDF —
2246
+ * next to the ones the shell provides on its own (editar, eliminar, historial).
2247
+ *
2248
+ * The same shape drives every shell that shows a record, so the buttons of a full page can be
2249
+ * handed to its drawer without rewriting them (see `resolveExtraButtons`).
2250
+ */
2251
+ interface DetailExtraButton {
2252
+ /** Mode the action belongs to. `"all"` shows it in every one. */
2253
+ pageType: PageType | "all";
2254
+ title: string;
2255
+ icon: ReactNode;
2256
+ /** Receives the loaded record — `undefined` in create mode, where there is none yet. */
2257
+ onClick: (data: any) => void;
2258
+ /**
2259
+ * Condition on top of `pageType`, checked against the loaded record. Typically one of its
2260
+ * own flags (`puede_cerrar`), so what the backend allows is what the user sees.
2261
+ */
2262
+ display?: (data: any) => boolean;
2263
+ }
2264
+
2172
2265
  interface DetailFormDrawerNavigation {
2173
2266
  /** Open the previous record of the list the drawer is walking. */
2174
2267
  onPrev: () => void;
@@ -2207,6 +2300,18 @@ interface DetailFormDrawerProps {
2207
2300
  permissionsPath?: string;
2208
2301
  /** Runs after a successful mutation, before the drawer closes. Receives the response. */
2209
2302
  onSuccess?: (response: any) => void;
2303
+ /**
2304
+ * Acciones propias del registro —cerrar, revertir, descargar su PDF—, las mismas que
2305
+ * `DetailPage_v2` recibe en `slots.extraButtons` y con la misma forma, para que un registro
2306
+ * traiga sus acciones se abra en su página o en el cajón.
2307
+ *
2308
+ * Van en un menú "⋮" de la cabecera —no como iconos sueltos— porque la cabecera del cajón
2309
+ * es angosta y ya carga Editar, Eliminar y lo que venga en `slots.headerActions`; el menú
2310
+ * además las nombra, igual que el de la página completa. Se filtran contra el modo que el
2311
+ * cajón muestra *en ese momento*: entrar a editar esconde las de `"detail"`, como en la
2312
+ * página. `display` y `onClick` reciben el registro cargado.
2313
+ */
2314
+ extraButtons?: DetailExtraButton[];
2210
2315
  /**
2211
2316
  * Footer record navigator: prev/next arrows (Alt+↑ / Alt+↓) that step through a list of
2212
2317
  * sibling records — e.g. the rows of the grid the drawer was opened from — without
@@ -2277,14 +2382,16 @@ interface DetailFormDrawerProps {
2277
2382
  * A record form inside a side drawer. Reuses the same `useDetailForm` engine and
2278
2383
  * `DetailForm` body as `DetailPage_v2`, and `MainDrawer_v2` for the chrome — so it frames
2279
2384
  * the form exactly like every other v2 drawer. What it adds on top is the per-record
2280
- * furniture: edit/delete in the header, and a footer holding the form actions and, when
2385
+ * furniture: edit/delete in the header — plus the record's own actions, when the consumer
2386
+ * hands them over in `extraButtons`, in a "⋮" menu beside them — and a footer holding the
2387
+ * form actions and, when
2281
2388
  * `navigation` is given, a prev/next record navigator (Alt+↑ / Alt+↓) plus "Guardar ↓"
2282
2389
  * (Alt+Shift+↓) — a save that steps to the next record instead of closing, so a column can be
2283
2390
  * captured down a list in one pass without the hands leaving the keyboard. Rename it with
2284
2391
  * `labels.saveAndNext`. Guardar sits outside the `<form>` and submits via the native
2285
2392
  * `form={formId}` attribute; Guardar ↓ submits by hand, so the implicit Enter stays Guardar.
2286
2393
  */
2287
- declare function DetailFormDrawer({ open, onClose, title, api, form, sections, pageType, startInEdit, recordKey, permissionsPath, onSuccess, navigation, width, anchor, variant, resizable, minWidth, maxWidth, widthStorageKey, onWidthChange, responsiveTo, containerBreakpoints, labels, slots, slotProps, }: DetailFormDrawerProps): react_jsx_runtime.JSX.Element;
2394
+ declare function DetailFormDrawer({ open, onClose, title, api, form, sections, pageType, startInEdit, recordKey, permissionsPath, onSuccess, extraButtons, navigation, width, anchor, variant, resizable, minWidth, maxWidth, widthStorageKey, onWidthChange, responsiveTo, containerBreakpoints, labels, slots, slotProps, }: DetailFormDrawerProps): react_jsx_runtime.JSX.Element;
2288
2395
 
2289
2396
  interface DrawerGridDrawerConfig {
2290
2397
  /** Shared field layout, used by every mode. Same shape as `DetailPage_v2`'s `form`/`sections`. */
@@ -2358,6 +2465,14 @@ interface DrawerGridDrawerConfig {
2358
2465
  mutation: any;
2359
2466
  };
2360
2467
  };
2468
+ /**
2469
+ * Acciones propias del registro —las mismas que su página completa recibe en
2470
+ * `DetailPage_v2`'s `slots.extraButtons`, y con la misma forma—, en un menú "⋮" de la
2471
+ * cabecera del cajón. Se filtran por modo y por `display(registro)`, así que las de la
2472
+ * página se pasan tal cual: abrir el renglón en el cajón deja de ser una versión recortada
2473
+ * de abrirlo en su página.
2474
+ */
2475
+ extraButtons?: DetailExtraButton[];
2361
2476
  /** Runs after any successful create/edit (e.g. side effects; the grid refetches via RTK tag invalidation). */
2362
2477
  onSaved?: (response: any) => void;
2363
2478
  /**
@@ -2484,6 +2599,8 @@ interface ActionsMenuProps {
2484
2599
  icon: ReactNode;
2485
2600
  onClick: () => void;
2486
2601
  }[];
2602
+ /** Tamaño del botón que abre el menú. `"small"` para las cabeceras del cajón. */
2603
+ size?: "small" | "medium";
2487
2604
  }
2488
2605
 
2489
2606
  interface DetailPageV2Props {
@@ -2508,13 +2625,14 @@ interface DetailPageV2Props {
2508
2625
  containerBreakpoints?: DetailFormProps["containerBreakpoints"];
2509
2626
  slots?: {
2510
2627
  button?: ReactNode;
2511
- extraButtons?: {
2512
- pageType: PageType | "all";
2513
- title: string;
2514
- icon: ReactNode;
2515
- onClick: (data: any) => void;
2516
- display?: (data: any) => boolean;
2517
- }[];
2628
+ /**
2629
+ * Acciones propias del registro, junto a las del armazón. En `"detail"` viven dentro
2630
+ * del menú de acciones; en alta y edición, como iconos al lado de Guardar.
2631
+ *
2632
+ * Las mismas se le pueden pasar al cajón de `DrawerGrid_v2` (`drawer.extraButtons`),
2633
+ * para que el registro traiga sus acciones se abra donde se abra.
2634
+ */
2635
+ extraButtons?: DetailExtraButton[];
2518
2636
  badge?: string;
2519
2637
  };
2520
2638
  slotProps?: {
@@ -2604,6 +2722,45 @@ interface MainLayoutPageHeaderProps extends PageHeaderProps {
2604
2722
  documentTitleSuffix?: string;
2605
2723
  }
2606
2724
 
2725
+ /**
2726
+ * Pie por defecto del sidebar: aviso de privacidad, versión del sistema y aviso
2727
+ * de copyright.
2728
+ *
2729
+ * Todo lo que se pinta depende del proyecto que consume el layout, así que llega
2730
+ * por props (la versión no se lee de `import.meta.env` aquí). Cada pieza aparece
2731
+ * sólo si le pasaron lo suyo: sin `privacyUrl` no hay enlace y sin `version` no
2732
+ * hay versión, que es como se comportaba este pie antes de crecer.
2733
+ *
2734
+ * Con `releaseNotesUrl` la versión deja de ser texto muerto y pasa a ser un
2735
+ * enlace a las novedades, con un punto encendido mientras el proyecto reporte
2736
+ * que hay algo sin leer.
2737
+ **/
2738
+ /**
2739
+ * Lo que el proyecto configura del pie por defecto. Va aparte de las props del
2740
+ * componente porque `MainLayout` lo recibe entero en su prop `footer` y se lo
2741
+ * inyecta al slot, que de Toolpad sólo recibe `mini`.
2742
+ */
2743
+ interface MainLayoutFooterConfig {
2744
+ /** Versión del sistema; sin ella no se pinta la línea. */
2745
+ version?: string;
2746
+ /** Texto de copyright. Por defecto el de ACV con el año en curso. */
2747
+ copyright?: string;
2748
+ /** Ruta del aviso de privacidad; sin ella no se pinta el enlace. */
2749
+ privacyUrl?: string;
2750
+ /** Texto del enlace de privacidad con el sidebar expandido. */
2751
+ privacyLabel?: string;
2752
+ /** Texto del enlace de privacidad con el sidebar plegado. */
2753
+ privacyLabelMini?: string;
2754
+ /** Ruta de las novedades; con ella la versión se vuelve un enlace. */
2755
+ releaseNotesUrl?: string;
2756
+ /** Tooltip del enlace de la versión. */
2757
+ releaseNotesTooltip?: string;
2758
+ /** Enciende el punto sobre la versión mientras haya novedades sin abrir. */
2759
+ hasUnreadReleaseNotes?: boolean;
2760
+ }
2761
+ interface MainLayoutSidebarFooterProps extends SidebarFooterProps, MainLayoutFooterConfig {
2762
+ }
2763
+
2607
2764
  /**
2608
2765
  * Cascarón de la aplicación construido sobre Toolpad: barra superior, menú de
2609
2766
  * navegación, alertas, tema y el `PageContainer` que renderiza el `Outlet`.
@@ -2636,11 +2793,11 @@ interface MainLayoutProps {
2636
2793
  detachedPages?: DetachedPage[];
2637
2794
  /** Sufijo del `document.title` (ej. "Embarques" => "Título | Embarques"). */
2638
2795
  documentTitleSuffix?: string;
2639
- /** Configuración del pie del sidebar por defecto. */
2640
- footer?: {
2641
- version?: string;
2642
- copyright?: string;
2643
- };
2796
+ /**
2797
+ * Configuración del pie del sidebar por defecto: versión, copyright, aviso de
2798
+ * privacidad y enlace a las novedades. Cada pieza se pinta sólo si se pasa.
2799
+ */
2800
+ footer?: MainLayoutFooterConfig;
2644
2801
  /** Ancho del sidebar expandido. */
2645
2802
  sidebarExpandedWidth?: number;
2646
2803
  /**
@@ -2759,16 +2916,6 @@ interface MainLayoutProps {
2759
2916
  declare const SIDE_PANEL_WIDTH_VAR = "--acv-side-panel-width";
2760
2917
  declare const MainLayout: (props: MainLayoutProps) => react_jsx_runtime.JSX.Element;
2761
2918
 
2762
- /**
2763
- * Pie por defecto del sidebar: versión del sistema y aviso de copyright.
2764
- * La versión y el texto de copyright se reciben por props porque dependen
2765
- * del proyecto que consume el layout (no se leen de `import.meta.env` aquí).
2766
- **/
2767
- interface MainLayoutSidebarFooterProps extends SidebarFooterProps {
2768
- version?: string;
2769
- copyright?: string;
2770
- }
2771
-
2772
2919
  /**
2773
2920
  * Contenido por defecto de cada snack dentro de `ObjectProgressStack`.
2774
2921
  * Muestra una barra de progreso (determinada si `progress` viene definido,
@@ -2778,6 +2925,180 @@ interface ProgressStatusProps {
2778
2925
  progress?: number;
2779
2926
  }
2780
2927
 
2928
+ /**
2929
+ * La lupa de la barra superior: se despliega en un campo que consulta el
2930
+ * buscador global del backend y agrupa los resultados por modelo. Elegir uno
2931
+ * navega a su ficha.
2932
+ *
2933
+ * La consulta no la hace la librería: el proyecto pasa su hook lazy de RTK Query
2934
+ * en `useSearch`, que se dispara con retardo (`debounceMs`) mientras se escribe.
2935
+ *
2936
+ * Ctrl+F abre el campo y Escape lo cierra; en pantallas chicas se despliega
2937
+ * sobre la barra en vez de empujarla.
2938
+ **/
2939
+ /** Forma de cada resultado tal como lo devuelve el buscador del backend. */
2940
+ interface GlobalSearchOption {
2941
+ /** Id del registro. */
2942
+ value: string | number;
2943
+ /** Texto que se muestra. */
2944
+ label: string;
2945
+ /** Modelo al que pertenece; es también el criterio de agrupación. */
2946
+ modelo: string;
2947
+ /** Ruta del portal a la que lleva el resultado. */
2948
+ frontend_url: string;
2949
+ /** Nombre de una paleta de `@mui/material/colors` para la pastilla del modelo. */
2950
+ color?: string;
2951
+ }
2952
+ interface GlobalSearchProps {
2953
+ /**
2954
+ * Hook lazy de RTK Query que resuelve la búsqueda, tal cual lo exporta el
2955
+ * proyecto (`useLazyGetBusquedaQuery`). Se le pasa el texto escrito y debe
2956
+ * devolver la lista de resultados.
2957
+ */
2958
+ useSearch: any;
2959
+ /** Espera antes de disparar la consulta, en ms. */
2960
+ debounceMs?: number;
2961
+ /** Ancho del campo abierto en escritorio, en px. */
2962
+ width?: number;
2963
+ placeholder?: string;
2964
+ /**
2965
+ * Renombra el modelo antes de pintarlo en la pastilla, para los casos en que
2966
+ * el nombre del backend no es el que ve el usuario.
2967
+ */
2968
+ modelLabels?: Record<string, string>;
2969
+ }
2970
+ declare const GlobalSearch: ({ useSearch, debounceMs, width, placeholder, modelLabels, }: GlobalSearchProps) => react_jsx_runtime.JSX.Element;
2971
+
2972
+ /**
2973
+ * Una notificación del panel: icono, mensaje y hace cuánto llegó. Abrirla la
2974
+ * marca como leída y navega a su registro.
2975
+ *
2976
+ * El icono depende del modelo de cada proyecto, así que se recibe por
2977
+ * `renderIcon`. Con `onOpen` un proyecto puede hacerse cargo de la apertura
2978
+ * —descargar un archivo en vez de navegar, por ejemplo— devolviendo `true`.
2979
+ *
2980
+ * Para notificaciones que necesiten estado propio (un spinner mientras se
2981
+ * descarga algo) el panel admite reemplazar la fila entera por `slots.item`;
2982
+ * lo natural entonces es envolver esta misma fila.
2983
+ **/
2984
+ interface NotificationItemProps {
2985
+ notification: any;
2986
+ /** Marca la notificación como leída. Lo enlaza el panel con la mutación del proyecto. */
2987
+ onRead: (notification: any) => void;
2988
+ /** Aviso al panel de que se abrió una notificación (en móvil lo cierra). */
2989
+ onClose: () => void;
2990
+ /** Primera de la lista: hereda el redondeo de la esquina superior. */
2991
+ first?: boolean;
2992
+ /** Última de la lista: hereda el redondeo de la esquina inferior. */
2993
+ last?: boolean;
2994
+ /** Icono de la fila. Por defecto un interrogante. */
2995
+ renderIcon?: (notification: any, iconProps: any) => ReactNode;
2996
+ /**
2997
+ * Se ejecuta al abrir, antes de navegar. Devolver `true` significa "ya me
2998
+ * encargué": la fila no navega a `notification.url`.
2999
+ */
3000
+ onOpen?: (notification: any) => boolean | void;
3001
+ }
3002
+ declare const NotificationItem: (props: NotificationItemProps) => react_jsx_runtime.JSX.Element;
3003
+
3004
+ /**
3005
+ * La campana de la barra superior y su panel de notificaciones, con las pestañas
3006
+ * de todas / no leídas, su paginación y los botones de leer y borrar todas.
3007
+ *
3008
+ * El panel va acoplado al costado (`variant="docked"`) y no flotando sobre la
3009
+ * página: encoge el contenido en vez de taparlo, así que se puede ir abriendo
3010
+ * notificaciones y seguir viendo la pantalla en la que se estaba.
3011
+ *
3012
+ * No se coloca a mano en el layout: `MainDrawer_v2` acoplado viaja por portal
3013
+ * hasta el hueco que `MainLayout` reserva al costado (ver `SidePanelHostContext`).
3014
+ * Ese hueco es uno solo y los paneles se turnan, de modo que abrir esto encoge
3015
+ * al que estuviera abierto y cerrarlo se lo devuelve.
3016
+ *
3017
+ * En pantallas chicas no cabe nada al lado, así que ahí vuelve a ser un drawer
3018
+ * flotante que se cierra al abrir una notificación.
3019
+ *
3020
+ * Los datos no los pide la librería: el proyecto pasa sus hooks de RTK Query en
3021
+ * `api` y arma los argumentos de la consulta en `buildQueryArgs`, porque el
3022
+ * endpoint de notificaciones no tiene la misma firma en todos los portales.
3023
+ **/
3024
+ interface NotificationsApi {
3025
+ /** `useGetNotificacionesQuery` — recibe lo que devuelva `buildQueryArgs`. */
3026
+ useGetNotificaciones: any;
3027
+ /** `useLeerNotificacionMutation` — marca una como leída al abrirla. */
3028
+ useLeerNotificacion: any;
3029
+ /** `useLeerTodasNotificacionesMutation`. */
3030
+ useLeerTodas: any;
3031
+ /** `useBorrarTodasNotificacionesMutation`. */
3032
+ useBorrarTodas: any;
3033
+ }
3034
+ interface NotificationsBellProps {
3035
+ /** Hooks de RTK Query del proyecto. */
3036
+ api: NotificationsApi;
3037
+ /**
3038
+ * Argumentos de `useGetNotificaciones` para cada pestaña. Devolver `skipToken`
3039
+ * mientras no haya usuario en sesión: el panel llama al hook igual, y así no
3040
+ * se pide nada hasta que hay a quién pedírselo.
3041
+ */
3042
+ buildQueryArgs: (opts: {
3043
+ page: number;
3044
+ soloNoLeidas: boolean;
3045
+ }) => unknown;
3046
+ /** Icono de cada fila, según el modelo de la notificación. */
3047
+ renderIcon?: (notification: any, iconProps: any) => ReactNode;
3048
+ /**
3049
+ * Se ejecuta al abrir una notificación, antes de navegar. Devolver `true`
3050
+ * significa "ya me encargué" y la fila no navega a `notification.url`.
3051
+ */
3052
+ onOpenNotification?: (notification: any) => boolean | void;
3053
+ /** Título del panel. */
3054
+ title?: string;
3055
+ /** Ancho del panel abierto, mientras el usuario no lo arrastre a otra cosa. */
3056
+ width?: number;
3057
+ /**
3058
+ * Clave donde se recuerda el ancho arrastrado. Conviene que sea propia de
3059
+ * este panel: compartirla con otro los deja pisándose el ancho entre sí.
3060
+ */
3061
+ widthStorageKey?: string;
3062
+ slots?: {
3063
+ /**
3064
+ * Reemplaza la fila entera. Para notificaciones que necesiten estado
3065
+ * propio —un spinner mientras se descarga un archivo—, ya que un
3066
+ * `renderIcon` no puede usar hooks. Lo natural es envolver el
3067
+ * `NotificationItem` de la librería.
3068
+ */
3069
+ item?: ElementType<NotificationItemProps>;
3070
+ };
3071
+ }
3072
+ declare const NotificationsBell: ({ api, buildQueryArgs, renderIcon, onOpenNotification, title, width, widthStorageKey, slots, }: NotificationsBellProps) => react_jsx_runtime.JSX.Element;
3073
+
3074
+ /**
3075
+ * Contenido del popover de la cuenta (slot `popoverContent` del `Account` de
3076
+ * Toolpad): la ficha del usuario, el interruptor de claro/oscuro, las filas que
3077
+ * añada el proyecto y el botón de salir.
3078
+ *
3079
+ * Con `onProfileClick` la ficha entera se vuelve clicable —se toca donde uno se
3080
+ * ve— y ahí es donde cuelga el perfil. Ojo: este menú se cierra con el mismo
3081
+ * clic (el `Popover` de Toolpad lleva su propio `onClick` que lo cierra), así
3082
+ * que lo que se abra desde aquí no puede vivir dentro del menú.
3083
+ **/
3084
+ interface AccountMenuItem {
3085
+ /** Icono a la izquierda de la fila. */
3086
+ icon?: ReactNode;
3087
+ label: string;
3088
+ onClick: () => void;
3089
+ }
3090
+ interface AccountMenuContentProps {
3091
+ /** Contenido del avatar; normalmente la inicial del usuario. */
3092
+ avatarLabel?: ReactNode;
3093
+ /** Si se pasa, la ficha del usuario es clicable (típicamente abre el perfil). */
3094
+ onProfileClick?: () => void;
3095
+ /** Filas extra entre la ficha y el interruptor de tema. */
3096
+ items?: AccountMenuItem[];
3097
+ /** Ancho mínimo del popover. */
3098
+ minWidth?: number;
3099
+ }
3100
+ declare const AccountMenuContent: ({ avatarLabel, onProfileClick, items, minWidth, }: AccountMenuContentProps) => react_jsx_runtime.JSX.Element;
3101
+
2781
3102
  interface MutationHandlerOptions {
2782
3103
  mutationFn: (data: any) => {
2783
3104
  unwrap: () => Promise<any>;
@@ -2865,5 +3186,5 @@ interface PulseDotProps {
2865
3186
  * contrario un color fijo. Se usa para indicar conexión/actividad en vivo. */
2866
3187
  declare function PulseDot({ active, inactiveColor, size, title }: PulseDotProps): react_jsx_runtime.JSX.Element;
2867
3188
 
2868
- export { APIContext, APIProvider, ActiveCell, ActiveIcon, Base, ButtonWithDrawer, COLOR_SCHEME_SELECTOR, CSVUpload, ChipCell, ConfirmDialog, ContentLayout, ControlledAddressAutocomplete, ControlledAmountWithCurrency, ControlledColor, ControlledDate$1 as ControlledDate, ControlledDate as ControlledDate_v2, ControlledDropdown, ControlledFileField$1 as ControlledFileField, ControlledFileField as ControlledFileField_v2, FileUploadBox as ControlledFileUploadBox, ControlledNumber, ControlledPhoneNumber, ControlledSelect$1 as ControlledSelect, ControlledSelect as ControlledSelect_v2, ControlledSlider as ControlledSimpleSlider, ControlledSlider$1 as ControlledSlider, ControlledSwitch, ControlledText, ControlledTimePicker, ControlledToggleButtons, CoverPage, CreateButtonBase, CreateButtonWithMenuOptions, CrudDropdown, CustomNoRows, DEFAULT_FORM_BREAKPOINTS, DEFAULT_PAGINATION, DeleteButton, DeleteConfirmationDialog, DetailFormDialog as DetailFormDialog_v2, DetailFormDrawer as DetailFormDrawer_v2, DetailForm as DetailForm_v2, DetailPage$1 as DetailPage, DetailPage as DetailPage_v2, DrawerGrid as DrawerGrid_v2, EditButton, ExportCSV, ExtraButtons, FORM_CONTAINER_NAME, HistorialDrawer, KpiCard, LAYER_ORDER, ListPage, Loadable, LoadingComponent, Logo, MainDrawer, MainDrawer$1 as MainDrawer_v2, MainLayout, MenuItemWithLoading, ModuleCard, MoreOptions, MyGridEditSingleSelect, NavigationContext, NavigationProvider, NormalOrIcon, NotAllowed, NotFound, ObjectProgressStack, PAGE_SIZE_OPTIONS, Panel, PollingCountdownChip, PulseDot, SIDE_PANEL_WIDTH_VAR, SaveCancelButton, ServerGrid as ServerGrid_v2, SidePanelHostContext, StatusBadge, StyledMenu, Tabs, Transitions, TrueFalse, UncontrolledText, changeTitle, closeProgressSnack, composeGridProps, deleteColumn$1 as deleteColumn, deleteColumn as deleteColumn_v2, editColumn, filterQuery, formContainerSx, formGridSx, formParser, _default as headerReducer, manualCacheRefresh, mergeSettings, openProgressSnack, query, renderChipCell, renderEditCellWithErrorTooltip, resolveChipOption, resolveInitialState, setErrors, _default$1 as snackProgressReducer, tags, theme, togglableFields, updateProgressSnackData, useAPI, useColorMode, useDetailForm, useHasPermission, useHasPermission_v2, useKeyboardShortcut, useMutationHandler, useNavigation, useServerGrid, useSidePanelHost, valueLabel };
2869
- export type { APIcontextProps, AddressValue, AppTheme, ChipCellProps, ChipColor, ChipOption, ColorMode, ComoOpcionesProps, ConfirmDialogProps, ControlledInput, CustomFilterDef, CustomToolbarProps, DeleteGridColumnsProps$1 as DeleteGridColumnsProps, DetachedPage, DetailFormApi, DetailFormConfig, DetailFormController, DetailFormDialogProps, DetailFormDrawerNavigation, DetailFormDrawerProps, DetailFormProps, DetailFormStatus, DetailPageV2Props, DetailRenderProps, DrawerGridDrawerConfig, DrawerGridEditConfig, DrawerGridProps, EditGridColumnsProps, EditReadOnlyFields, FieldFilter, FieldProps$1 as FieldProps, FieldValidationProps, FilterInput, FormBreakpoint, FormGridSxOptions, GridArgs, GridColDefPropsOverrides, GridLayerContribution, GridLayerId, GridLayerMap, JSONFormProps, JSONParserProps, KeyboardShortcut, KpiCardProps, MainDrawerV2Props, MainLayoutPageHeaderProps, MainLayoutProps, MainLayoutSidebarFooterProps, MyDataGridProps, MyGridFilterModel, MyTab, MyTabProps, PageType, PanelProps, PollingCountdownChipProps, ProgressStatusProps, PulseDotProps, RowsSnapshot, ServerGridArgs, ServerGridCreateApi, ServerGridDataApi, ServerGridDeleteApi, ServerGridEditApi, ServerGridEditToggleApi, ServerGridHandle, ServerGridProps, ServerGridSnapshot, ServerGridState, SidePanelHost, UseColorModeResult, UseServerGridOptions };
3189
+ export { APIContext, APIProvider, AccountMenuContent, ActiveCell, ActiveIcon, Base, ButtonWithDrawer, COLOR_SCHEME_SELECTOR, CSVUpload, ChipCell, ConfirmDialog, ContentLayout, ControlledAddressAutocomplete, ControlledAmountWithCurrency, ControlledColor, ControlledDate$1 as ControlledDate, ControlledDate as ControlledDate_v2, ControlledDropdown, ControlledFileField$1 as ControlledFileField, ControlledFileField as ControlledFileField_v2, FileUploadBox as ControlledFileUploadBox, ControlledNumber, ControlledPhoneNumber, ControlledSelect$1 as ControlledSelect, ControlledSelect as ControlledSelect_v2, ControlledSlider as ControlledSimpleSlider, ControlledSlider$1 as ControlledSlider, ControlledSwitch, ControlledText, ControlledTimePicker, ControlledToggleButtons, CoverPage, CreateButtonBase, CreateButtonWithMenuOptions, CrudDropdown, CustomNoRows, DEFAULT_FORM_BREAKPOINTS, DEFAULT_PAGINATION, DeleteButton, DeleteConfirmationDialog, DetailFormDialog as DetailFormDialog_v2, DetailFormDrawer as DetailFormDrawer_v2, DetailForm as DetailForm_v2, DetailPage$1 as DetailPage, DetailPage as DetailPage_v2, DrawerGrid as DrawerGrid_v2, EditButton, ExportCSV$1 as ExportCSV, ExportCSV as ExportCSV_v2, ExtraButtons, FORM_CONTAINER_NAME, GlobalSearch, HistorialDrawer, KpiCard, LAYER_ORDER, ListPage, Loadable, LoadingComponent, Logo, MainDrawer, MainDrawer$1 as MainDrawer_v2, MainLayout, MenuItemWithLoading, ModuleCard, MoreOptions, MyGridEditSingleSelect, NavigationContext, NavigationProvider, NormalOrIcon, NotAllowed, NotFound, NotificationItem, NotificationsBell, ObjectProgressStack, PAGE_SIZE_OPTIONS, Panel, PollingCountdownChip, PulseDot, SIDE_PANEL_WIDTH_VAR, SaveCancelButton, ServerGrid as ServerGrid_v2, SidePanelHostContext, StatusBadge, StyledMenu, Tabs, Transitions, TrueFalse, UncontrolledText, changeTitle, closeProgressSnack, composeGridProps, deleteColumn$1 as deleteColumn, deleteColumn as deleteColumn_v2, editColumn, filterQuery, formContainerSx, formGridSx, formParser, _default as headerReducer, manualCacheRefresh, mergeSettings, openProgressSnack, query, renderChipCell, renderEditCellWithErrorTooltip, resolveChipOption, resolveInitialState, setErrors, _default$1 as snackProgressReducer, tags, theme, togglableFields, updateProgressSnackData, useAPI, useColorMode, useDetailForm, useHasPermission, useHasPermission_v2, useKeyboardShortcut, useMutationHandler, useNavigation, useServerGrid, useSidePanelHost, valueLabel };
3190
+ export type { APIcontextProps, AccountMenuContentProps, AccountMenuItem, AddressValue, AppTheme, ChipCellProps, ChipColor, ChipOption, ColorMode, ComoOpcionesProps, ConfirmDialogProps, ControlledInput, CustomFilterDef, CustomToolbarProps, DeleteGridColumnsProps$1 as DeleteGridColumnsProps, DetachedPage, DetailExtraButton, DetailFormApi, DetailFormConfig, DetailFormController, DetailFormDialogProps, DetailFormDrawerNavigation, DetailFormDrawerProps, DetailFormProps, DetailFormStatus, DetailPageV2Props, DetailRenderProps, DrawerGridDrawerConfig, DrawerGridEditConfig, DrawerGridProps, EditGridColumnsProps, EditReadOnlyFields, ExportCSVProps as ExportCSVProps_v2, FieldFilter, FieldProps$1 as FieldProps, FieldValidationProps, FilterInput, FormBreakpoint, FormGridSxOptions, GlobalSearchOption, GlobalSearchProps, GridArgs, GridColDefPropsOverrides, GridLayerContribution, GridLayerId, GridLayerMap, JSONFormProps, JSONParserProps, KeyboardShortcut, KpiCardProps, MainDrawerV2Props, MainLayoutFooterConfig, MainLayoutPageHeaderProps, MainLayoutProps, MainLayoutSidebarFooterProps, MyDataGridProps, MyGridFilterModel, MyTab, MyTabProps, NotificationItemProps, NotificationsApi, NotificationsBellProps, PageType, PanelProps, PollingCountdownChipProps, ProgressStatusProps, PulseDotProps, RowsSnapshot, ServerGridArgs, ServerGridCreateApi, ServerGridDataApi, ServerGridDeleteApi, ServerGridEditApi, ServerGridEditToggleApi, ServerGridHandle, ServerGridProps, ServerGridSnapshot, ServerGridState, SidePanelHost, UseColorModeResult, UseServerGridOptions };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@acvl/frontend-components",
3
- "version": "0.0.70",
3
+ "version": "0.0.72",
4
4
  "description": "Component library for ACV frontend projects.",
5
5
  "homepage": "https://github.com/ACV-Logistics/acv-frontend-components#readme",
6
6
  "access": "public",