@acvl/frontend-components 0.0.65 → 0.0.66

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
@@ -665,6 +665,31 @@ interface MainDrawerV2Props {
665
665
  width?: number | string;
666
666
  /** Lado desde el que entra el panel. Por defecto `"right"`. */
667
667
  anchor?: DrawerProps["anchor"];
668
+ /**
669
+ * Añade un tirador en el borde interior del panel para arrastrar su tamaño. Mientras el
670
+ * usuario no lo arrastre, `width` manda; en cuanto lo hace, el tamaño arrastrado la pisa
671
+ * y sobrevive a cerrar y reabrir el panel (mientras el componente siga montado). Doble
672
+ * clic en el tirador vuelve a `width`.
673
+ */
674
+ resizable?: boolean;
675
+ /** Tamaño mínimo en px al que se puede arrastrar. Por defecto `320`. */
676
+ minWidth?: number;
677
+ /** Tamaño máximo en px. Por defecto, el viewport menos un margen para el backdrop. */
678
+ maxWidth?: number;
679
+ /**
680
+ * Recuerda el tamaño arrastrado bajo esta clave en `localStorage`, de modo que sobreviva a
681
+ * desmontar el panel —el caso de `DrawerGrid_v2`, que lo remonta en cada apertura— y a
682
+ * recargar la página. Sin clave, el tamaño dura lo que dure el componente montado.
683
+ *
684
+ * La clave debe ser única por panel: dos que la compartan se pisan el ancho entre sí.
685
+ */
686
+ widthStorageKey?: string;
687
+ /**
688
+ * Se invoca al soltar el arrastre (y en cada paso del teclado) con el tamaño en px, o
689
+ * `null` cuando el doble clic lo devuelve a `width`. Para reaccionar al cambio o guardarlo
690
+ * en otro sitio; `widthStorageKey` no lo necesita.
691
+ */
692
+ onWidthChange?: (width: number | null) => void;
668
693
  /** Impide que un clic en el backdrop cierre el panel (formularios con cambios sin guardar). */
669
694
  disableBackdropClose?: boolean;
670
695
  /** Oculta el botón de cerrar integrado, para reemplazarlo desde `slots.headerActions`. */
@@ -696,6 +721,8 @@ interface MainDrawerV2Props {
696
721
  footer?: Partial<BoxProps>;
697
722
  title?: Partial<TypographyProps>;
698
723
  closeButton?: Partial<IconButtonProps>;
724
+ /** Tirador de arrastre; sólo se renderiza con `resizable`. */
725
+ resizeHandle?: Partial<BoxProps>;
699
726
  };
700
727
  }
701
728
  /**
@@ -712,8 +739,12 @@ interface MainDrawerV2Props {
712
739
  * `theme.shape.borderRadius` y sigue al `anchor`; y el `sx` que llega por `slotProps` se
713
740
  * concatena en vez de reemplazar el propio. No depende de `@toolpad/core`, así que sirve
714
741
  * fuera de un layout de Toolpad.
742
+ *
743
+ * Con `resizable`, el borde interior lleva un tirador: se arrastra con el puntero, se ajusta
744
+ * con las flechas cuando tiene el foco y vuelve a `width` con doble clic. Con
745
+ * `widthStorageKey`, además, el tamaño se recuerda entre visitas.
715
746
  */
716
- declare function MainDrawer$1({ open, onClose, title, subtitle, children, width, anchor, disableBackdropClose, hideCloseButton, disableGutters, pageBackgroundColor, chromeBackgroundColor, contentGap, contentBorderRadius, slots, slotProps, }: MainDrawerV2Props): react_jsx_runtime.JSX.Element;
747
+ declare function MainDrawer$1({ open, onClose, title, subtitle, children, width, anchor, resizable, minWidth, maxWidth, widthStorageKey, onWidthChange, disableBackdropClose, hideCloseButton, disableGutters, pageBackgroundColor, chromeBackgroundColor, contentGap, contentBorderRadius, slots, slotProps, }: MainDrawerV2Props): react_jsx_runtime.JSX.Element;
717
748
 
718
749
  declare module "@mui/x-data-grid" {
719
750
  interface ToolbarPropsOverrides {
@@ -851,6 +882,25 @@ interface MyTabProps {
851
882
  initialValue?: string;
852
883
  storageKey?: string;
853
884
  type?: PageType;
885
+ /**
886
+ * Alto que se ajusta al contenido, con `ALTO` de tope, en vez del alto fijo de siempre.
887
+ *
888
+ * El default arma la cadena de altos con porcentajes: el contenedor mide `ALTO`, el de
889
+ * los paneles 93.5% de él y cada panel 100% del anterior. Eso sólo funciona con un alto
890
+ * definido arriba — si el contenedor midiera `100%` de un padre sin alto, toda la cadena
891
+ * resuelve a `auto` y lo de adentro (un DataGrid, por ejemplo) crece con su contenido y
892
+ * se desborda.
893
+ *
894
+ * Con `fitContent` la cadena es flex: el contenedor no fija alto, sólo `maxHeight`, y
895
+ * cada eslabón va con `flex: 1 1 auto` + `minHeight: 0` para poder encoger. Las pestañas
896
+ * miden entonces lo que mida su contenido y, al pasarse del tope, es el contenido el que
897
+ * encoge y scrollea por dentro. El contenido tiene que seguir la cadena: cualquier
898
+ * envoltura propia entre el panel y el grid necesita también `flex: 1 1 auto` y
899
+ * `minHeight: 0`, en lugar de `height: 1`.
900
+ *
901
+ * @default false
902
+ */
903
+ fitContent?: boolean;
854
904
  slotProps?: {
855
905
  mainContainer?: BoxProps;
856
906
  contentContainer?: BoxProps;
@@ -1201,6 +1251,17 @@ interface ServerGridEditApi {
1201
1251
  interface ServerGridEditToggleApi {
1202
1252
  /** Hides the button and its shortcuts without touching permissions. */
1203
1253
  disabled?: boolean;
1254
+ /**
1255
+ * Drives edit mode from outside instead of leaving it to the toolbar toggle — e.g. a grid
1256
+ * embedded in a detail form that should follow the form's own edit state.
1257
+ *
1258
+ * Leave it `undefined` and the layer owns the mode, as always. Pass a boolean and the
1259
+ * caller owns it: the toolbar button and its shortcuts disappear, because two edit
1260
+ * affordances for one grid only raises the question of which one won, and the checkbox
1261
+ * column is left alone — whoever drives the mode also decides what it looks like. Still
1262
+ * fail-closed — `true` without the model's change permission stays off.
1263
+ */
1264
+ active?: boolean;
1204
1265
  /** Notified whenever the toggle flips. */
1205
1266
  onEditModeChange?: (edit: boolean) => void;
1206
1267
  }
@@ -1769,8 +1830,20 @@ interface DrawerGridDrawerConfig {
1769
1830
  form: DetailFormConfig["form"];
1770
1831
  sections: DetailFormConfig["sections"];
1771
1832
  permissionsPath?: string;
1772
- /** Panel width. Defaults to the drawer's own default (480). */
1833
+ /** Panel width. Defaults to the drawer's own default (600). */
1773
1834
  width?: number | string;
1835
+ /**
1836
+ * Let the user drag the drawer's inner edge to resize it. The dragged width is remembered
1837
+ * across openings under a key derived from the grid's own storage key — override it with
1838
+ * `widthStorageKey`, or turn the memory off by passing an empty string.
1839
+ */
1840
+ resizable?: boolean;
1841
+ /** Smallest width the drag allows, in px. Defaults to `320`. */
1842
+ minWidth?: number;
1843
+ /** Largest width the drag allows, in px. Defaults to the viewport minus a margin. */
1844
+ maxWidth?: number;
1845
+ /** Where the dragged width is remembered. Defaults to the grid's storage key + `_DW`. */
1846
+ widthStorageKey?: string;
1774
1847
  title?: {
1775
1848
  create?: ReactNode;
1776
1849
  record?: ReactNode | ((id: GridRowId) => ReactNode);
@@ -1814,16 +1887,28 @@ interface DrawerGridDrawerConfig {
1814
1887
  /**
1815
1888
  * Show the footer navigator that walks the grid's rows — prev/next arrows plus the
1816
1889
  * record's position — in the record drawer. Defaults to `true`.
1890
+ *
1891
+ * It also gates "Guardar ↓", the save that steps to the next row instead of closing:
1892
+ * without a list to walk there is nothing to continue to.
1817
1893
  */
1818
1894
  showNavigator?: boolean;
1895
+ /** Rótulos del pie del cajón. `saveAndNext` por defecto es `"Guardar ↓"`. */
1819
1896
  labels?: {
1820
1897
  save?: string;
1821
1898
  cancel?: string;
1899
+ saveAndNext?: string;
1822
1900
  };
1823
1901
  }
1824
1902
  interface DrawerGridEditConfig {
1825
1903
  /** Hides the toggle (and its shortcuts) without touching permissions. */
1826
1904
  disabled?: boolean;
1905
+ /**
1906
+ * Drives edit mode from outside instead of leaving it to the toolbar toggle — pass the
1907
+ * edit state of the form this grid is embedded in and a row click follows it, opening the
1908
+ * drawer already editing without the user flipping a second switch. The toolbar button
1909
+ * disappears while it's set, and it stays fail-closed against the model's permission.
1910
+ */
1911
+ active?: boolean;
1827
1912
  }
1828
1913
  interface DrawerGridProps {
1829
1914
  /**
@@ -1855,10 +1940,18 @@ interface DrawerGridProps {
1855
1940
  * the current filters — not just the ones on screen. Turn it off with
1856
1941
  * `drawer.showNavigator: false`.
1857
1942
  *
1943
+ * Editing a list that way gets a third footer button, "Guardar ↓" / Alt+Shift+↓ (rename it
1944
+ * with `drawer.labels.saveAndNext`): it saves and steps to the next row instead of closing,
1945
+ * carrying the edit mode over, so capturing a column across many rows is one pass rather than
1946
+ * open-edit-save-reopen per row — and with the shortcut, without leaving the keyboard. It
1947
+ * rides on the navigator — no navigator, or last row, and there is just Guardar.
1948
+ *
1858
1949
  * Edit mode is opt-in with `api.edit: {}` and adds nothing to the grid but a toolbar toggle —
1859
1950
  * no mutation, no actions column, no in-grid editing. While it's on, a row click opens the
1860
1951
  * record drawer already editing, provided the record allows it; the drawer form is the only
1861
- * thing that writes.
1952
+ * thing that writes. A grid embedded in a detail form can hand the mode over instead, with
1953
+ * `api.edit: { active: pageType === "edit" }`, so it follows the form rather than asking for
1954
+ * a second switch.
1862
1955
  *
1863
1956
  * The full grid config goes under `grid` (`{ pathname, api, dataGridProps, slotProps }`),
1864
1957
  * alongside `drawer`.
@@ -2021,13 +2114,35 @@ interface DetailFormDrawerProps {
2021
2114
  * closing the drawer. Omit it and no navigator renders.
2022
2115
  */
2023
2116
  navigation?: DetailFormDrawerNavigation;
2024
- /** Panel width. Defaults to `480`. */
2117
+ /** Panel width. Defaults to `600`. */
2025
2118
  width?: number | string;
2026
2119
  /** Side the drawer slides in from. Defaults to `"right"`. */
2027
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;
2028
2137
  labels?: {
2029
2138
  save?: string;
2030
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;
2031
2146
  };
2032
2147
  slots?: {
2033
2148
  /** Extra actions rendered in the header, left of the close button (e.g. "open full page"). */
@@ -2037,6 +2152,7 @@ interface DetailFormDrawerProps {
2037
2152
  drawer?: Partial<DrawerProps>;
2038
2153
  saveButton?: Partial<ButtonProps>;
2039
2154
  cancelButton?: Partial<ButtonProps>;
2155
+ saveAndNextButton?: Partial<ButtonProps>;
2040
2156
  };
2041
2157
  }
2042
2158
  /**
@@ -2044,10 +2160,13 @@ interface DetailFormDrawerProps {
2044
2160
  * `DetailForm` body as `DetailPage_v2`, and `MainDrawer_v2` for the chrome — so it frames
2045
2161
  * the form exactly like every other v2 drawer. What it adds on top is the per-record
2046
2162
  * furniture: edit/delete in the header, and a footer holding the form actions and, when
2047
- * `navigation` is given, a prev/next record navigator. The save button sits outside the
2048
- * `<form>`, so it submits via the native `form={formId}` attribute.
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.
2049
2168
  */
2050
- declare function DetailFormDrawer({ open, onClose, title, api, form, sections, pageType, startInEdit, recordKey, permissionsPath, onSuccess, navigation, width, anchor, labels, slots, slotProps, }: DetailFormDrawerProps): react_jsx_runtime.JSX.Element;
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;
2051
2170
 
2052
2171
  /**
2053
2172
  * Encabezado por defecto del `PageContainer`: resuelve título y breadcrumbs a
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@acvl/frontend-components",
3
- "version": "0.0.65",
3
+ "version": "0.0.66",
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",