@acvl/frontend-components 0.0.66 → 0.0.67

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
@@ -1,14 +1,14 @@
1
1
  import * as _mui_material from '@mui/material';
2
2
  import { ButtonProps, ButtonGroupProps, IconButtonProps, MenuItemProps, AlertProps, BoxProps, AutocompleteProps, SliderProps, SwitchProps, GridProps, DrawerProps, SxProps, Theme, StackProps, TypographyProps, MenuProps, PaletteColorOptions, TextFieldProps as TextFieldProps$1, InputBaseProps, DialogProps, DialogContentProps } from '@mui/material';
3
3
  import * as React from 'react';
4
- import React__default, { ReactNode, Dispatch, SetStateAction, JSX, RefObject, FC, BaseSyntheticEvent, JSXElementConstructor, ElementType } from 'react';
4
+ import React__default, { ReactNode, Dispatch, SetStateAction, JSX, RefObject, ReactElement, FC, BaseSyntheticEvent, JSXElementConstructor, ElementType } from 'react';
5
5
  import * as react_jsx_runtime from 'react/jsx-runtime';
6
6
  import { GridRowId, GridRowSelectionModel, GridSortModel, GridFilterModel, GridRowModesModel, GridRenderEditCellParams, GridToolbarProps, DataGridProps as DataGridProps$1, GridApi, GridPaginationModel, GridColumnVisibilityModel, useGridApiRef, GridColDef } from '@mui/x-data-grid';
7
7
  import { DataGridProps, GridBaseColDef } from '@mui/x-data-grid/internals';
8
8
  import { NavigateOptions } from 'react-router-dom';
9
9
  import * as zod_v4_core from 'zod/v4/core';
10
10
  import * as zod from 'zod';
11
- import { coerce } from 'zod';
11
+ import { coerce, z } from 'zod';
12
12
  import { NumericFormatProps } from 'react-number-format';
13
13
  import { TextFieldProps } from '@mui/material/TextField';
14
14
  export { default as dayjs } from 'dayjs';
@@ -16,11 +16,11 @@ import * as redux from 'redux';
16
16
  import * as _reduxjs_toolkit from '@reduxjs/toolkit';
17
17
  import * as _emotion_styled from '@emotion/styled';
18
18
  import * as _mui_system from '@mui/system';
19
+ import { Theme as Theme$1, CssVarsTheme, CSSObject } from '@mui/material/styles';
19
20
  import { DebouncedFunc } from 'lodash';
20
21
  import { UseFormReturn } from 'react-hook-form';
21
22
  import { Breadcrumb, PageHeaderProps, Navigation, Branding, Session, Authentication, DashboardHeaderProps } from '@toolpad/core';
22
23
  import { SidebarFooterProps } from '@toolpad/core/DashboardLayout';
23
- import { Theme as Theme$1, CSSObject } from '@mui/material/styles';
24
24
 
25
25
  interface NormalOrIconProps {
26
26
  buttonProps: ButtonProps;
@@ -396,6 +396,14 @@ declare const ExportCSV: React__default.FC<ExportCSVButtonProps>;
396
396
 
397
397
  declare const CustomNoRows: () => react_jsx_runtime.JSX.Element;
398
398
 
399
+ interface BaseControlledFieldProps {
400
+ name: string;
401
+ label?: string;
402
+ control: any;
403
+ }
404
+
405
+ declare const TrueFalse: React__default.FC<BaseControlledFieldProps>;
406
+
399
407
  interface ExtraActions {
400
408
  label: string;
401
409
  onClick: (rowSelectionModel: GridRowSelectionModel) => void;
@@ -445,12 +453,6 @@ interface ActiveIconProps {
445
453
  }
446
454
  declare const ActiveIcon: React__default.FC<ActiveIconProps>;
447
455
 
448
- interface BaseControlledFieldProps {
449
- name: string;
450
- label?: string;
451
- control: any;
452
- }
453
-
454
456
  interface ControlledDateProps extends BaseControlledFieldProps {
455
457
  fieldProps?: any;
456
458
  extraProps: {
@@ -626,6 +628,11 @@ interface FieldProps$1 {
626
628
  detail_name?: string;
627
629
  label: string;
628
630
  type: any;
631
+ /**
632
+ * Sus breakpoints resuelven contra el viewport. La v1 solo se renderiza a página completa,
633
+ * así que alcanza; si algún día gana un shell angosto, ver
634
+ * `@v2/layout/pages/DetailPage/formLayout` para resolverlos contra el contenedor.
635
+ */
629
636
  gridProps?: GridProps;
630
637
  fieldProps?: object;
631
638
  extraProps?: any;
@@ -696,7 +703,7 @@ interface MainDrawerV2Props {
696
703
  hideCloseButton?: boolean;
697
704
  /** Quita el padding interno del panel de contenido, para contenido a sangre. */
698
705
  disableGutters?: boolean;
699
- /** Color de fondo del panel de contenido. Por defecto `#f7f7f7`. */
706
+ /** Color de fondo del panel de contenido. Por defecto el fondo del tema. */
700
707
  pageBackgroundColor?: string;
701
708
  /** Color del contorno: encabezado, pie y el marco alrededor del contenido. */
702
709
  chromeBackgroundColor?: string;
@@ -763,6 +770,14 @@ interface ArrayFieldProps {
763
770
  pageType?: PageType;
764
771
  parser?: JSONParserProps;
765
772
  fields: FieldProps$1[];
773
+ /**
774
+ * What the edit panel's fields resolve their `size` breakpoints against. Defaults to
775
+ * `"container"`: that panel is a drawer, narrow by construction. It needs its own setting
776
+ * because `MainDrawer_v2` portals to `document.body`, so the panel is not a DOM descendant
777
+ * of the surrounding form and cannot inherit its container.
778
+ * @see DetailFormProps.responsiveTo
779
+ */
780
+ responsiveTo?: "viewport" | "container";
766
781
  slotProps?: {
767
782
  /**
768
783
  * Se aplica sobre el panel de edición. `open` y `onClose` los gobierna este
@@ -868,8 +883,22 @@ declare const LoadingComponent: React__default.FC<LoadingComponentProps>;
868
883
 
869
884
  /**
870
885
  * Muestra el logo de la empresa
886
+ *
887
+ * El archivo de marca es un JPG con fondo blanco, bola roja y letras negras: tal
888
+ * cual, en modo oscuro se ve un recuadro blanco. Como no hay versión clara del
889
+ * archivo, en oscuro se recolorea por CSS a blanco sobre transparente.
871
890
  **/
872
- declare const Logo: () => react_jsx_runtime.JSX.Element;
891
+ interface LogoProps {
892
+ /** Altura máxima en px. */
893
+ maxHeight?: number;
894
+ /**
895
+ * Logo alternativo para modo oscuro. Lo suyo es un SVG o PNG blanco con fondo
896
+ * transparente: en cuanto exista, pasarlo aquí sustituye el recoloreado por
897
+ * el archivo de verdad sin tocar nada más.
898
+ */
899
+ darkSrc?: string;
900
+ }
901
+ declare const Logo: ({ maxHeight, darkSrc }?: LogoProps) => react_jsx_runtime.JSX.Element;
873
902
 
874
903
  interface MyTab {
875
904
  value: string;
@@ -1115,6 +1144,10 @@ declare const HistorialDrawer: React__default.FC<HistorialDrawerProps>;
1115
1144
  /**
1116
1145
  * Personaliza la temática de la página
1117
1146
  * Declara colores, tipo de letra, etc
1147
+ *
1148
+ * El tema publica dos esquemas de color (claro y oscuro) como variables CSS, así
1149
+ * que cambiar de modo no reconstruye el tema: solo cambia el atributo del `<html>`
1150
+ * y el navegador resuelve las variables. Ver `useColorMode` para el interruptor.
1118
1151
  **/
1119
1152
  declare module '@mui/material/styles' {
1120
1153
  interface PaletteColor {
@@ -1150,7 +1183,24 @@ declare module '@mui/material/styles' {
1150
1183
  largeAvatar?: any;
1151
1184
  }
1152
1185
  }
1153
- declare const theme: () => _mui_material.Theme;
1186
+ /**
1187
+ * Atributo que MUI escribe en `<html>` con el esquema activo (`light`/`dark`).
1188
+ *
1189
+ * Hace falta declararlo: con dos esquemas y sin selector, MUI usa `media`, es
1190
+ * decir el tema sigue a la preferencia del sistema operativo y el interruptor no
1191
+ * puede cambiarlo. Con un atributo manda el usuario.
1192
+ */
1193
+ declare const COLOR_SCHEME_SELECTOR = "data-color-scheme";
1194
+ /**
1195
+ * El tema de la librería, con lo que aporta trabajar por variables CSS: `vars`
1196
+ * (los colores como `var(--mui-…)`, que siguen al esquema activo) y
1197
+ * `colorSchemes`.
1198
+ *
1199
+ * Hace falta nombrarlo porque `responsiveFontSizes` declara devolver `Theme` a
1200
+ * secas: el objeto que sale sí trae las dos cosas, pero la firma las esconde.
1201
+ */
1202
+ type AppTheme = Theme$1 & CssVarsTheme;
1203
+ declare const theme: () => AppTheme;
1154
1204
 
1155
1205
  interface KpiCardProps {
1156
1206
  icon: ReactNode;
@@ -1198,6 +1248,42 @@ interface PollingCountdownChipProps {
1198
1248
  * fetch reinicia el conteo; opcionalmente refresca al hacer clic. */
1199
1249
  declare function PollingCountdownChip({ pollingInterval, isFetching, onRefresh, }: PollingCountdownChipProps): react_jsx_runtime.JSX.Element;
1200
1250
 
1251
+ interface FilterInput {
1252
+ /** The column this input filters on — used only as a React key. */
1253
+ field: string;
1254
+ /**
1255
+ * The query keys this input writes. Usually one, but a range input owns two
1256
+ * (`_min`/`_max`, `_after`/`_before`), which is why this isn't just `field`.
1257
+ */
1258
+ keys: string[];
1259
+ label: string;
1260
+ type: string;
1261
+ element: ReactElement;
1262
+ }
1263
+ /**
1264
+ * A filter the page adds itself, for something no column represents — a scope toggle, a flag
1265
+ * the backend computes, anything whose value isn't a column's value.
1266
+ *
1267
+ * The element is read fresh on every render rather than captured with the schema, so an input
1268
+ * that closes over page state stays current.
1269
+ */
1270
+ interface CustomFilterDef {
1271
+ /**
1272
+ * The query key sent to the backend, and the form field name the element must bind to.
1273
+ *
1274
+ * Wins over a column that would generate the same key: the column's input is dropped from
1275
+ * the panel, so one key never gets two inputs writing to it.
1276
+ */
1277
+ field: string;
1278
+ label: string;
1279
+ /** Any controlled input. The panel clones `control` in, exactly as it does for columns. */
1280
+ element: ReactElement;
1281
+ /** Defaults to `z.any().optional()` — enough for a value the backend validates anyway. */
1282
+ schema?: z.ZodType<any, any>;
1283
+ /** What the panel resets to, and what "Limpiar" restores. Defaults to `""`. */
1284
+ defaultValue?: any;
1285
+ }
1286
+
1201
1287
  /**
1202
1288
  * What the grid hands its RTK lazy query — the corrected `GridArgs`.
1203
1289
  *
@@ -1314,6 +1400,16 @@ interface ServerGridProps {
1314
1400
  tab?: string;
1315
1401
  /** Scopes the filter panel's option lookups to the current detail record. */
1316
1402
  columnsFilter?: string;
1403
+ /**
1404
+ * Filters the page adds to the panel itself, for things no column represents — a
1405
+ * scope toggle, a flag the backend computes. They render above the column-derived
1406
+ * inputs and behave like any other filter from there on: counted by the badge,
1407
+ * cleared by "Limpiar", persisted, and sent as query args.
1408
+ *
1409
+ * Gate them at the call site — build the array only for the users who should see the
1410
+ * filter. The grid has no notion of who is looking at it.
1411
+ */
1412
+ customFilters?: CustomFilterDef[];
1317
1413
  /** Skip session persistence entirely. */
1318
1414
  dontSaveState?: boolean;
1319
1415
  /**
@@ -1825,6 +1921,207 @@ interface DetailFormController {
1825
1921
  */
1826
1922
  declare function useDetailForm(config: DetailFormConfig): DetailFormController;
1827
1923
 
1924
+ /**
1925
+ * Layout de campos relativo al **contenedor** en vez de al viewport.
1926
+ *
1927
+ * MUI resuelve los breakpoints de `size` contra media queries del viewport. Eso es correcto en
1928
+ * una página completa, pero el mismo formulario también se renderiza dentro de un drawer de
1929
+ * 460px o de un diálogo `maxWidth="sm"`: ahí la pantalla es ancha, gana el valor de `lg` y los
1930
+ * campos quedan apretados.
1931
+ *
1932
+ * Estas utilidades traducen el mismo objeto `size` a reglas `@container`, de modo que una sola
1933
+ * definición de secciones sirve para página, diálogo y drawer — y se re-acomoda en vivo al
1934
+ * arrastrar el borde del drawer, sin re-render.
1935
+ */
1936
+ type FormBreakpoint = "xs" | "sm" | "md" | "lg" | "xl";
1937
+ /**
1938
+ * `container-name` que declara todo formulario en modo contenedor. Es público a propósito: un
1939
+ * consumidor puede apuntarle desde su propio `sx` con la sintaxis corta de MUI —
1940
+ * `sx={{ p: { "@700/acvform": 3 } }}`. Usar siempre la forma **numérica**: `@md/acvform`
1941
+ * resolvería contra `theme.breakpoints.values` (900), no contra esta escalera (700).
1942
+ */
1943
+ declare const FORM_CONTAINER_NAME = "acvform";
1944
+ /**
1945
+ * Ancho del *formulario* (px) a partir del cual aplica cada clave. Escalera pensada para
1946
+ * paneles, no una copia de `theme.breakpoints.values`: esos son umbrales de viewport y un
1947
+ * formulario de 552px (un drawer de 600) caería en `xs`, o sea un campo por renglón — peor que
1948
+ * el problema que esto resuelve. Derivada de una columna útil de ~190–230px con gutter de 16px.
1949
+ */
1950
+ declare const DEFAULT_FORM_BREAKPOINTS: Record<FormBreakpoint, number>;
1951
+ interface FormGridSxOptions {
1952
+ /** @default FORM_CONTAINER_NAME */
1953
+ containerName?: string;
1954
+ /** Se mezcla encima de {@link DEFAULT_FORM_BREAKPOINTS}. */
1955
+ breakpoints?: Partial<Record<FormBreakpoint, number>>;
1956
+ }
1957
+ /**
1958
+ * Traduce el `size`/`offset` de un Grid a reglas `@container` que reproducen, contra el ancho
1959
+ * del formulario, exactamente lo que MUI deriva de ellos contra el viewport.
1960
+ *
1961
+ * **Todos** los escalones se emiten como container query —`xs` incluido, en `min-width:0px`—;
1962
+ * nunca hay regla base. Por eso un campo renderizado fuera de un contenedor de formulario no
1963
+ * empata con ninguna de estas reglas y conserva intacto el comportamiento por viewport de MUI:
1964
+ * ahí está toda la compatibilidad hacia atrás.
1965
+ *
1966
+ * El resultado va en `sx`, que se serializa *después* de los estilos propios del Grid y con la
1967
+ * misma especificidad, así que gana donde aplica.
1968
+ */
1969
+ declare const formGridSx: (size: GridProps["size"], offset?: GridProps["offset"], options?: FormGridSxOptions) => CSSObject | undefined;
1970
+ /**
1971
+ * Convierte un elemento en el contenedor contra el que resuelven los campos que contiene.
1972
+ *
1973
+ * `inline-size`, nunca `size`: el `Collapse` de `Subsection` anima midiendo `clientHeight`, y
1974
+ * contener el eje de bloque lo rompería.
1975
+ */
1976
+ declare const formContainerSx: (containerName?: string) => CSSObject;
1977
+
1978
+ interface DetailFormProps {
1979
+ /** Result of `useDetailForm`. */
1980
+ controller: DetailFormController;
1981
+ /**
1982
+ * `id` of the `<form>` element. External submit buttons (e.g. inside a dialog footer,
1983
+ * which live outside the form tree) submit via `<button form={formId} type="submit">`.
1984
+ * Defaults to `"formulario"` for parity with `SaveCancelButton`.
1985
+ */
1986
+ formId?: string;
1987
+ /** Persist-tab key for multi-section forms. Defaults to `formId`. */
1988
+ storageKey?: string;
1989
+ /** Height factor passed to the loading spinner. Defaults to `0.7`. */
1990
+ loadingHeight?: number;
1991
+ /**
1992
+ * What each field's `size` breakpoints resolve against.
1993
+ *
1994
+ * `"viewport"` is MUI's own behaviour. `"container"` resolves them against the width of
1995
+ * *this form*, so one section definition serves a full page, a `maxWidth="sm"` dialog and a
1996
+ * 460px drawer without a hand-picked size per shell — and re-flows live as the drawer is
1997
+ * dragged. Note that it makes the `<form>` a CSS containment context, so a `slotProps.form`
1998
+ * that overrides `width` with a content-dependent value would no longer resolve.
1999
+ * @default "viewport"
2000
+ */
2001
+ responsiveTo?: "viewport" | "container";
2002
+ /**
2003
+ * Form widths (px) at which each breakpoint key starts applying. Shallow-merged over
2004
+ * {@link DEFAULT_FORM_BREAKPOINTS}; only read in `"container"` mode.
2005
+ */
2006
+ containerBreakpoints?: Partial<Record<FormBreakpoint, number>>;
2007
+ slotProps?: {
2008
+ form?: Partial<BoxProps>;
2009
+ };
2010
+ }
2011
+ /**
2012
+ * Presentational, chrome-less body of a record form: the `FormProvider`, the `<form>`
2013
+ * element and the section/tab render tree — no page layout, no header buttons. Compose it
2014
+ * inside a page, dialog or drawer shell that supplies the surrounding chrome.
2015
+ */
2016
+ declare function DetailForm({ controller, formId, storageKey, loadingHeight, responsiveTo, containerBreakpoints, slotProps, }: DetailFormProps): react_jsx_runtime.JSX.Element;
2017
+
2018
+ interface DetailFormDrawerNavigation {
2019
+ /** Open the previous record of the list the drawer is walking. */
2020
+ onPrev: () => void;
2021
+ onNext: () => void;
2022
+ /** Whether a previous/next record exists. The arrows are disabled when it doesn't. */
2023
+ hasPrev: boolean;
2024
+ hasNext: boolean;
2025
+ /** 1-based position of the current record, shown between the arrows. */
2026
+ position?: number;
2027
+ /** Size of the list; shown as `position / count`. */
2028
+ count?: number;
2029
+ /** Blocks both arrows for a caller-side reason (e.g. while the next batch loads). */
2030
+ disabled?: boolean;
2031
+ }
2032
+ interface DetailFormDrawerProps {
2033
+ open: boolean;
2034
+ /** Close the drawer. Also invoked after a successful save and on cancel. */
2035
+ onClose: () => void;
2036
+ title?: ReactNode;
2037
+ api: DetailFormApi;
2038
+ form: DetailFormConfig["form"];
2039
+ sections: DetailFormConfig["sections"];
2040
+ /** Defaults to `"create"`. */
2041
+ pageType?: PageType;
2042
+ /**
2043
+ * Open a `"detail"` drawer straight in edit mode, as if the user had hit the Editar
2044
+ * button. Ignored for the other page types, and for records the user may not edit.
2045
+ */
2046
+ startInEdit?: boolean;
2047
+ /**
2048
+ * Identity of the record on show. Swapping it (as the navigator does, without remounting
2049
+ * the drawer) re-derives the per-record chrome — the in-place edit toggle drops back to
2050
+ * read-only and `startInEdit` is re-applied against the new record's own permissions.
2051
+ */
2052
+ recordKey?: string | number;
2053
+ permissionsPath?: string;
2054
+ /** Runs after a successful mutation, before the drawer closes. Receives the response. */
2055
+ onSuccess?: (response: any) => void;
2056
+ /**
2057
+ * Footer record navigator: prev/next arrows (Alt+↑ / Alt+↓) that step through a list of
2058
+ * sibling records — e.g. the rows of the grid the drawer was opened from — without
2059
+ * closing the drawer. Omit it and no navigator renders.
2060
+ */
2061
+ navigation?: DetailFormDrawerNavigation;
2062
+ /** Panel width. Defaults to `600`. */
2063
+ width?: number | string;
2064
+ /** Side the drawer slides in from. Defaults to `"right"`. */
2065
+ anchor?: DrawerProps["anchor"];
2066
+ /**
2067
+ * Let the user drag the drawer's inner edge to resize it. Forwarded to `MainDrawer_v2`
2068
+ * along with the four props below — see it for the full behaviour.
2069
+ */
2070
+ resizable?: boolean;
2071
+ /** Smallest width the drag allows, in px. Defaults to `320`. */
2072
+ minWidth?: number;
2073
+ /** Largest width the drag allows, in px. Defaults to the viewport minus a margin. */
2074
+ maxWidth?: number;
2075
+ /**
2076
+ * Remember the dragged width under this `localStorage` key. Worth setting whenever the
2077
+ * drawer is remounted per record — a fresh mount otherwise forgets the drag.
2078
+ */
2079
+ widthStorageKey?: string;
2080
+ /** Fires with the final dragged width in px, or `null` when a double click resets it. */
2081
+ onWidthChange?: (width: number | null) => void;
2082
+ /**
2083
+ * What each field's `size` breakpoints resolve against. Defaults to `"container"`: a drawer
2084
+ * is narrow by construction, so viewport breakpoints would pick the wide-screen value and
2085
+ * cram the fields — and they would not react to a drag either.
2086
+ * @see DetailFormProps.responsiveTo
2087
+ */
2088
+ responsiveTo?: DetailFormProps["responsiveTo"];
2089
+ /** @see DetailFormProps.containerBreakpoints */
2090
+ containerBreakpoints?: DetailFormProps["containerBreakpoints"];
2091
+ labels?: {
2092
+ save?: string;
2093
+ cancel?: string;
2094
+ /**
2095
+ * Rótulo del guardar-y-seguir. Por defecto `"Guardar ↓"`, corto porque va junto al
2096
+ * Guardar de siempre y el tooltip ya dice qué hace; pásale un texto propio donde el
2097
+ * paso al siguiente registro merezca nombrarse ("Guardar y siguiente bulto").
2098
+ */
2099
+ saveAndNext?: string;
2100
+ };
2101
+ slots?: {
2102
+ /** Extra actions rendered in the header, left of the close button (e.g. "open full page"). */
2103
+ headerActions?: ReactNode;
2104
+ };
2105
+ slotProps?: {
2106
+ drawer?: Partial<DrawerProps>;
2107
+ saveButton?: Partial<ButtonProps>;
2108
+ cancelButton?: Partial<ButtonProps>;
2109
+ saveAndNextButton?: Partial<ButtonProps>;
2110
+ };
2111
+ }
2112
+ /**
2113
+ * A record form inside a side drawer. Reuses the same `useDetailForm` engine and
2114
+ * `DetailForm` body as `DetailPage_v2`, and `MainDrawer_v2` for the chrome — so it frames
2115
+ * the form exactly like every other v2 drawer. What it adds on top is the per-record
2116
+ * furniture: edit/delete in the header, and a footer holding the form actions and, when
2117
+ * `navigation` is given, a prev/next record navigator (Alt+↑ / Alt+↓) plus "Guardar ↓"
2118
+ * (Alt+Shift+↓) — a save that steps to the next record instead of closing, so a column can be
2119
+ * captured down a list in one pass without the hands leaving the keyboard. Rename it with
2120
+ * `labels.saveAndNext`. Guardar sits outside the `<form>` and submits via the native
2121
+ * `form={formId}` attribute; Guardar ↓ submits by hand, so the implicit Enter stays Guardar.
2122
+ */
2123
+ declare function DetailFormDrawer({ open, onClose, title, api, form, sections, pageType, startInEdit, recordKey, permissionsPath, onSuccess, navigation, width, anchor, resizable, minWidth, maxWidth, widthStorageKey, onWidthChange, responsiveTo, containerBreakpoints, labels, slots, slotProps, }: DetailFormDrawerProps): react_jsx_runtime.JSX.Element;
2124
+
1828
2125
  interface DrawerGridDrawerConfig {
1829
2126
  /** Shared field layout, used by every mode. Same shape as `DetailPage_v2`'s `form`/`sections`. */
1830
2127
  form: DetailFormConfig["form"];
@@ -1844,6 +2141,14 @@ interface DrawerGridDrawerConfig {
1844
2141
  maxWidth?: number;
1845
2142
  /** Where the dragged width is remembered. Defaults to the grid's storage key + `_DW`. */
1846
2143
  widthStorageKey?: string;
2144
+ /**
2145
+ * What the fields' `size` breakpoints resolve against. Defaults to `"container"` — the
2146
+ * width of the panel, not of the screen.
2147
+ * @see DetailFormDrawerProps.responsiveTo
2148
+ */
2149
+ responsiveTo?: DetailFormDrawerProps["responsiveTo"];
2150
+ /** @see DetailFormDrawerProps.containerBreakpoints */
2151
+ containerBreakpoints?: DetailFormDrawerProps["containerBreakpoints"];
1847
2152
  title?: {
1848
2153
  create?: ReactNode;
1849
2154
  record?: ReactNode | ((id: GridRowId) => ReactNode);
@@ -2014,30 +2319,6 @@ interface DetailPageV2Props {
2014
2319
  }
2015
2320
  declare function DetailPage(props: DetailPageV2Props): react_jsx_runtime.JSX.Element;
2016
2321
 
2017
- interface DetailFormProps {
2018
- /** Result of `useDetailForm`. */
2019
- controller: DetailFormController;
2020
- /**
2021
- * `id` of the `<form>` element. External submit buttons (e.g. inside a dialog footer,
2022
- * which live outside the form tree) submit via `<button form={formId} type="submit">`.
2023
- * Defaults to `"formulario"` for parity with `SaveCancelButton`.
2024
- */
2025
- formId?: string;
2026
- /** Persist-tab key for multi-section forms. Defaults to `formId`. */
2027
- storageKey?: string;
2028
- /** Height factor passed to the loading spinner. Defaults to `0.7`. */
2029
- loadingHeight?: number;
2030
- slotProps?: {
2031
- form?: Partial<BoxProps>;
2032
- };
2033
- }
2034
- /**
2035
- * Presentational, chrome-less body of a record form: the `FormProvider`, the `<form>`
2036
- * element and the section/tab render tree — no page layout, no header buttons. Compose it
2037
- * inside a page, dialog or drawer shell that supplies the surrounding chrome.
2038
- */
2039
- declare function DetailForm({ controller, formId, storageKey, loadingHeight, slotProps, }: DetailFormProps): react_jsx_runtime.JSX.Element;
2040
-
2041
2322
  interface DetailFormDialogProps {
2042
2323
  open: boolean;
2043
2324
  /** Close the dialog. Also invoked after a successful save and on cancel. */
@@ -2051,6 +2332,15 @@ interface DetailFormDialogProps {
2051
2332
  permissionsPath?: string;
2052
2333
  /** Runs after a successful mutation, before the dialog closes. Receives the response. */
2053
2334
  onSuccess?: (response: any) => void;
2335
+ /**
2336
+ * What each field's `size` breakpoints resolve against. Defaults to `"container"`: a
2337
+ * `maxWidth="sm"` dialog is narrow by construction, so viewport breakpoints would pick the
2338
+ * wide-screen value and cram the fields.
2339
+ * @see DetailFormProps.responsiveTo
2340
+ */
2341
+ responsiveTo?: DetailFormProps["responsiveTo"];
2342
+ /** @see DetailFormProps.containerBreakpoints */
2343
+ containerBreakpoints?: DetailFormProps["containerBreakpoints"];
2054
2344
  labels?: {
2055
2345
  save?: string;
2056
2346
  cancel?: string;
@@ -2068,105 +2358,7 @@ interface DetailFormDialogProps {
2068
2358
  * becomes a `DialogTitle` and the buttons move into `DialogActions`. The save button lives
2069
2359
  * outside the `<form>` tree, so it submits via the native `form={formId}` attribute.
2070
2360
  */
2071
- declare function DetailFormDialog({ open, onClose, title, api, form, sections, pageType, permissionsPath, onSuccess, labels, slotProps, }: DetailFormDialogProps): react_jsx_runtime.JSX.Element;
2072
-
2073
- interface DetailFormDrawerNavigation {
2074
- /** Open the previous record of the list the drawer is walking. */
2075
- onPrev: () => void;
2076
- onNext: () => void;
2077
- /** Whether a previous/next record exists. The arrows are disabled when it doesn't. */
2078
- hasPrev: boolean;
2079
- hasNext: boolean;
2080
- /** 1-based position of the current record, shown between the arrows. */
2081
- position?: number;
2082
- /** Size of the list; shown as `position / count`. */
2083
- count?: number;
2084
- /** Blocks both arrows for a caller-side reason (e.g. while the next batch loads). */
2085
- disabled?: boolean;
2086
- }
2087
- interface DetailFormDrawerProps {
2088
- open: boolean;
2089
- /** Close the drawer. Also invoked after a successful save and on cancel. */
2090
- onClose: () => void;
2091
- title?: ReactNode;
2092
- api: DetailFormApi;
2093
- form: DetailFormConfig["form"];
2094
- sections: DetailFormConfig["sections"];
2095
- /** Defaults to `"create"`. */
2096
- pageType?: PageType;
2097
- /**
2098
- * Open a `"detail"` drawer straight in edit mode, as if the user had hit the Editar
2099
- * button. Ignored for the other page types, and for records the user may not edit.
2100
- */
2101
- startInEdit?: boolean;
2102
- /**
2103
- * Identity of the record on show. Swapping it (as the navigator does, without remounting
2104
- * the drawer) re-derives the per-record chrome — the in-place edit toggle drops back to
2105
- * read-only and `startInEdit` is re-applied against the new record's own permissions.
2106
- */
2107
- recordKey?: string | number;
2108
- permissionsPath?: string;
2109
- /** Runs after a successful mutation, before the drawer closes. Receives the response. */
2110
- onSuccess?: (response: any) => void;
2111
- /**
2112
- * Footer record navigator: prev/next arrows (Alt+↑ / Alt+↓) that step through a list of
2113
- * sibling records — e.g. the rows of the grid the drawer was opened from — without
2114
- * closing the drawer. Omit it and no navigator renders.
2115
- */
2116
- navigation?: DetailFormDrawerNavigation;
2117
- /** Panel width. Defaults to `600`. */
2118
- width?: number | string;
2119
- /** Side the drawer slides in from. Defaults to `"right"`. */
2120
- anchor?: DrawerProps["anchor"];
2121
- /**
2122
- * Let the user drag the drawer's inner edge to resize it. Forwarded to `MainDrawer_v2`
2123
- * along with the four props below — see it for the full behaviour.
2124
- */
2125
- resizable?: boolean;
2126
- /** Smallest width the drag allows, in px. Defaults to `320`. */
2127
- minWidth?: number;
2128
- /** Largest width the drag allows, in px. Defaults to the viewport minus a margin. */
2129
- maxWidth?: number;
2130
- /**
2131
- * Remember the dragged width under this `localStorage` key. Worth setting whenever the
2132
- * drawer is remounted per record — a fresh mount otherwise forgets the drag.
2133
- */
2134
- widthStorageKey?: string;
2135
- /** Fires with the final dragged width in px, or `null` when a double click resets it. */
2136
- onWidthChange?: (width: number | null) => void;
2137
- labels?: {
2138
- save?: string;
2139
- cancel?: string;
2140
- /**
2141
- * Rótulo del guardar-y-seguir. Por defecto `"Guardar ↓"`, corto porque va junto al
2142
- * Guardar de siempre y el tooltip ya dice qué hace; pásale un texto propio donde el
2143
- * paso al siguiente registro merezca nombrarse ("Guardar y siguiente bulto").
2144
- */
2145
- saveAndNext?: string;
2146
- };
2147
- slots?: {
2148
- /** Extra actions rendered in the header, left of the close button (e.g. "open full page"). */
2149
- headerActions?: ReactNode;
2150
- };
2151
- slotProps?: {
2152
- drawer?: Partial<DrawerProps>;
2153
- saveButton?: Partial<ButtonProps>;
2154
- cancelButton?: Partial<ButtonProps>;
2155
- saveAndNextButton?: Partial<ButtonProps>;
2156
- };
2157
- }
2158
- /**
2159
- * A record form inside a side drawer. Reuses the same `useDetailForm` engine and
2160
- * `DetailForm` body as `DetailPage_v2`, and `MainDrawer_v2` for the chrome — so it frames
2161
- * the form exactly like every other v2 drawer. What it adds on top is the per-record
2162
- * furniture: edit/delete in the header, and a footer holding the form actions and, when
2163
- * `navigation` is given, a prev/next record navigator (Alt+↑ / Alt+↓) plus "Guardar ↓"
2164
- * (Alt+Shift+↓) — a save that steps to the next record instead of closing, so a column can be
2165
- * captured down a list in one pass without the hands leaving the keyboard. Rename it with
2166
- * `labels.saveAndNext`. Guardar sits outside the `<form>` and submits via the native
2167
- * `form={formId}` attribute; Guardar ↓ submits by hand, so the implicit Enter stays Guardar.
2168
- */
2169
- declare function DetailFormDrawer({ open, onClose, title, api, form, sections, pageType, startInEdit, recordKey, permissionsPath, onSuccess, navigation, width, anchor, resizable, minWidth, maxWidth, widthStorageKey, onWidthChange, labels, slots, slotProps, }: DetailFormDrawerProps): react_jsx_runtime.JSX.Element;
2361
+ declare function DetailFormDialog({ open, onClose, title, api, form, sections, pageType, permissionsPath, onSuccess, responsiveTo, containerBreakpoints, labels, slotProps, }: DetailFormDialogProps): react_jsx_runtime.JSX.Element;
2170
2362
 
2171
2363
  /**
2172
2364
  * Encabezado por defecto del `PageContainer`: resuelve título y breadcrumbs a
@@ -2250,11 +2442,15 @@ interface MainLayoutProps {
2250
2442
  * Color de fondo del área de contenido. Se aplica al scroll container
2251
2443
  * (`<main>`) para que cubra toda la altura scrolleable y no se corte cuando
2252
2444
  * la página es más larga que el viewport.
2445
+ *
2446
+ * Por defecto el fondo del tema, escrito como variable CSS para que siga al
2447
+ * esquema de color activo; un valor fijo lo deja igual en claro y en oscuro.
2253
2448
  */
2254
2449
  pageBackgroundColor?: string;
2255
2450
  /**
2256
2451
  * Color del contorno: el marco continuo que forman el header y el sidebar
2257
- * alrededor del panel de contenido.
2452
+ * alrededor del panel de contenido. Por defecto el color de superficie del
2453
+ * tema, con la misma salvedad que `pageBackgroundColor`.
2258
2454
  */
2259
2455
  chromeBackgroundColor?: string;
2260
2456
  /**
@@ -2291,6 +2487,13 @@ interface MainLayoutProps {
2291
2487
  slots?: {
2292
2488
  /** Barra superior del dashboard. Por defecto la de Toolpad. */
2293
2489
  header?: JSXElementConstructor<DashboardHeaderProps>;
2490
+ /**
2491
+ * Acciones de la derecha de la barra superior. Por defecto Toolpad pinta
2492
+ * ahí el interruptor de claro/oscuro y el menú de cuenta; reemplazarlo es
2493
+ * la forma de mover ese interruptor (`useColorMode`) a otro sitio, o de
2494
+ * añadir acciones propias, sin rehacer el header entero.
2495
+ */
2496
+ toolbarActions?: JSXElementConstructor<{}>;
2294
2497
  /** Pie del sidebar. Por defecto muestra versión y copyright. */
2295
2498
  sidebarFooter?: ElementType<SidebarFooterProps>;
2296
2499
  /** Encabezado de página. Por defecto resuelve título/breadcrumbs. */
@@ -2345,6 +2548,56 @@ declare const useMutationHandler: ({ mutationFn, form, onSuccess, onValidationEr
2345
2548
 
2346
2549
  declare const useHasPermission_v2: (path?: string) => boolean;
2347
2550
 
2551
+ /**
2552
+ * Lee y cambia el esquema de color de la aplicación.
2553
+ *
2554
+ * Es la pieza que la librería expone para que cada proyecto ponga el interruptor
2555
+ * donde quiera (cabecera, menú de usuario, ajustes…): la librería no dibuja
2556
+ * ningún control, solo da el estado y las acciones.
2557
+ *
2558
+ * Funciona dentro del proveedor de tema que monta `MainLayout`, y el modo
2559
+ * elegido se guarda en `localStorage`, así que sobrevive a recargas sin que el
2560
+ * proyecto tenga que persistir nada.
2561
+ *
2562
+ * @example
2563
+ * const { isDark, toggle } = useColorMode();
2564
+ * <IconButton onClick={toggle}>{isDark ? <LightModeIcon /> : <DarkModeIcon />}</IconButton>
2565
+ *
2566
+ * @example
2567
+ * // Con las tres opciones, incluida "seguir al sistema"
2568
+ * const { mode, setMode } = useColorMode();
2569
+ * <ToggleButtonGroup value={mode} exclusive onChange={(_, v) => v && setMode(v)}>
2570
+ * <ToggleButton value={"light"}>Claro</ToggleButton>
2571
+ * <ToggleButton value={"dark"}>Oscuro</ToggleButton>
2572
+ * <ToggleButton value={"system"}>Sistema</ToggleButton>
2573
+ * </ToggleButtonGroup>
2574
+ */
2575
+ /** Preferencia del usuario. `system` sigue a la configuración del dispositivo. */
2576
+ type ColorMode = "light" | "dark" | "system";
2577
+ interface UseColorModeResult {
2578
+ /**
2579
+ * Preferencia elegida, incluida `system`. Es el valor que debe marcar un
2580
+ * selector de tres posiciones. En el primer render puede ser `undefined`,
2581
+ * antes de que se lea lo guardado.
2582
+ */
2583
+ mode: ColorMode | undefined;
2584
+ /** Esquema realmente aplicado, con `system` ya resuelto. */
2585
+ resolvedMode: "light" | "dark";
2586
+ /** Atajo de `resolvedMode === "dark"`, para elegir icono o texto. */
2587
+ isDark: boolean;
2588
+ /** Fija la preferencia y la guarda. */
2589
+ setMode: (mode: ColorMode) => void;
2590
+ /** Alterna entre claro y oscuro partiendo del esquema aplicado. */
2591
+ toggle: () => void;
2592
+ /**
2593
+ * `false` si el tema en uso solo declara un esquema — un proyecto que pasa a
2594
+ * `MainLayout` un tema propio construido sin `colorSchemes`. Sirve para
2595
+ * esconder el interruptor en vez de dejar uno que no hace nada.
2596
+ */
2597
+ isSupported: boolean;
2598
+ }
2599
+ declare function useColorMode(): UseColorModeResult;
2600
+
2348
2601
  interface PulseDotProps {
2349
2602
  /** Cuando es `true`, el punto es verde y parpadea; si no, usa `inactiveColor`. */
2350
2603
  active: boolean;
@@ -2359,5 +2612,5 @@ interface PulseDotProps {
2359
2612
  * contrario un color fijo. Se usa para indicar conexión/actividad en vivo. */
2360
2613
  declare function PulseDot({ active, inactiveColor, size, title }: PulseDotProps): react_jsx_runtime.JSX.Element;
2361
2614
 
2362
- export { APIContext, APIProvider, ActiveCell, ActiveIcon, Base, ButtonWithDrawer, CSVUpload, ConfirmDialog, ContentLayout, ControlledAddressAutocomplete, ControlledAmountWithCurrency, 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_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, 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, SaveCancelButton, ServerGrid as ServerGrid_v2, StatusBadge, StyledMenu, Tabs, Transitions, UncontrolledText, changeTitle, closeProgressSnack, composeGridProps, deleteColumn$1 as deleteColumn, deleteColumn as deleteColumn_v2, editColumn, filterQuery, formParser, _default as headerReducer, manualCacheRefresh, mergeSettings, openProgressSnack, query, renderEditCellWithErrorTooltip, resolveInitialState, setErrors, _default$1 as snackProgressReducer, tags, theme, togglableFields, updateProgressSnackData, useAPI, useDetailForm, useHasPermission, useHasPermission_v2, useKeyboardShortcut, useMutationHandler, useNavigation, useServerGrid, valueLabel };
2363
- export type { APIcontextProps, AddressValue, ComoOpcionesProps, ConfirmDialogProps, ControlledInput, 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, 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, UseServerGridOptions };
2615
+ export { APIContext, APIProvider, ActiveCell, ActiveIcon, Base, ButtonWithDrawer, COLOR_SCHEME_SELECTOR, CSVUpload, ConfirmDialog, ContentLayout, ControlledAddressAutocomplete, ControlledAmountWithCurrency, 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, SaveCancelButton, ServerGrid as ServerGrid_v2, 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, renderEditCellWithErrorTooltip, resolveInitialState, setErrors, _default$1 as snackProgressReducer, tags, theme, togglableFields, updateProgressSnackData, useAPI, useColorMode, useDetailForm, useHasPermission, useHasPermission_v2, useKeyboardShortcut, useMutationHandler, useNavigation, useServerGrid, valueLabel };
2616
+ export type { APIcontextProps, AddressValue, AppTheme, 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, UseColorModeResult, UseServerGridOptions };