react-resizable-panels 4.13.2 → 4.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -7,10 +7,465 @@ import { Ref } from 'react';
7
7
  import { RefObject } from 'react';
8
8
  import { SetStateAction } from 'react';
9
9
 
10
+ declare type BaseGridlineProps = {
11
+ /**
12
+ * Gridline contents (e.g. a drag handle icon).
13
+ */
14
+ children?: ReactNode | undefined;
15
+ /**
16
+ * CSS class name.
17
+ *
18
+ * ℹ️ Use the `data-separator` attribute for custom _hover_ and _active_ styles
19
+ */
20
+ className?: string | undefined;
21
+ /**
22
+ * When disabled, the gridline cannot be used to resize its neighboring tracks.
23
+ *
24
+ * ℹ️ The tracks may still be resized indirectly (e.g. by an intersecting gridline or another boundary).
25
+ * To prevent a track from being resized at all, it needs to also be disabled.
26
+ */
27
+ disabled?: boolean | undefined;
28
+ /**
29
+ * Ref attached to the root `HTMLDivElement`.
30
+ */
31
+ elementRef?: Ref<HTMLDivElement> | undefined;
32
+ /**
33
+ * CSS properties.
34
+ *
35
+ * ⚠️ Grid placement properties are managed by the gridline and cannot be overridden.
36
+ */
37
+ style?: CSSProperties | undefined;
38
+ };
39
+
10
40
  declare type BasePanelAttributes = Omit<HTMLAttributes<HTMLDivElement>, "onResize">;
11
41
 
12
42
  declare type BaseSeparatorAttributes = Omit<HTMLAttributes<HTMLDivElement>, "role" | "tabIndex">;
13
43
 
44
+ /**
45
+ * A Cell occupies one or more tracks (columns and rows) within a Grid.
46
+ * Cells are resized along with the tracks they occupy.
47
+ *
48
+ * Cell elements always include the following attributes:
49
+ *
50
+ * ```html
51
+ * <div data-cell data-testid="cell-id-prop" id="cell-id-prop">
52
+ * ```
53
+ *
54
+ * ℹ️ [Test id](https://testing-library.com/docs/queries/bytestid/) can be used to narrow selection when unit testing.
55
+ *
56
+ * ⚠️ Cell elements must be direct DOM children of their parent Grid elements.
57
+ */
58
+ export declare function Cell({ children, className, column, columnSpan, elementRef: elementRefProp, id: idProp, row, rowSpan, style, ...rest }: CellProps): JSX.Element;
59
+
60
+ export declare namespace Cell {
61
+ var displayName: string;
62
+ }
63
+
64
+ export declare type CellProps = HTMLAttributes<HTMLDivElement> & {
65
+ /**
66
+ * Cell contents.
67
+ */
68
+ children?: ReactNode | undefined;
69
+ /**
70
+ * CSS class name.
71
+ */
72
+ className?: string | undefined;
73
+ /**
74
+ * Index of the (first) column this cell occupies.
75
+ */
76
+ column: number;
77
+ /**
78
+ * Number of columns this cell spans; defaults to 1.
79
+ */
80
+ columnSpan?: number | undefined;
81
+ /**
82
+ * Ref attached to the root `HTMLDivElement`.
83
+ */
84
+ elementRef?: Ref<HTMLDivElement | null> | undefined;
85
+ /**
86
+ * Uniquely identifies this cell within the parent grid.
87
+ * Falls back to `useId` when not provided.
88
+ *
89
+ * ℹ️ This value will also be assigned to the `id` and `data-testid` attributes.
90
+ */
91
+ id?: string | number | undefined;
92
+ /**
93
+ * Index of the (first) row this cell occupies.
94
+ */
95
+ row: number;
96
+ /**
97
+ * Number of rows this cell spans; defaults to 1.
98
+ */
99
+ rowSpan?: number | undefined;
100
+ /**
101
+ * CSS properties.
102
+ *
103
+ * ⚠️ Grid placement properties are managed by the Cell and cannot be overridden.
104
+ */
105
+ style?: CSSProperties | undefined;
106
+ };
107
+
108
+ /**
109
+ * A Grid arranges resizable Cells in two dimensions.
110
+ * Columns can be resized horizontally and rows can be resized vertically;
111
+ * dragging the point where a column boundary and a row boundary intersect resizes both.
112
+ *
113
+ * Size constraints (e.g. min/max size, collapsible) are specified per track (column or row),
114
+ * using the same format as Panel props.
115
+ *
116
+ * Cells can span multiple columns and/or rows.
117
+ * Track boundaries cannot be resized alongside of a cell that spans across them.
118
+ *
119
+ * Grid elements always include the following attributes:
120
+ *
121
+ * ```html
122
+ * <div data-grid data-testid="grid-id-prop" id="grid-id-prop">
123
+ * ```
124
+ *
125
+ * ℹ️ [Test id](https://testing-library.com/docs/queries/bytestid/) can be used to narrow selection when unit testing.
126
+ */
127
+ export declare function Grid({ children, className, columns, defaultLayout, disableCursor, disabled, elementRef: elementRefProp, gridRef, id: idProp, onLayoutChange: onLayoutChangeUnstable, onLayoutChanged: onLayoutChangedUnstable, resizeTargetMinimumSize, rows, style, ...rest }: GridProps): JSX.Element;
128
+
129
+ export declare namespace Grid {
130
+ var displayName: string;
131
+ }
132
+
133
+ /**
134
+ * A Grid has two independently resizable axes:
135
+ * - "column" tracks are resized horizontally
136
+ * - "row" tracks are resized vertically
137
+ */
138
+ export declare type GridAxis = "column" | "row";
139
+
140
+ /**
141
+ * Imperative Grid API.
142
+ *
143
+ * ℹ️ The `useGridRef` and `useGridCallbackRef` hooks are exported for convenience use in TypeScript projects.
144
+ */
145
+ export declare interface GridImperativeHandle {
146
+ /**
147
+ * Get the Grid's current layout: maps of column and row ids to percentages (0..100)
148
+ *
149
+ * @return Map of column ids to percentages and map of row ids to percentages (specified as numbers ranging between 0..100)
150
+ */
151
+ getLayout: () => {
152
+ columns: {
153
+ [columnId: string]: number;
154
+ };
155
+ rows: {
156
+ [rowId: string]: number;
157
+ };
158
+ };
159
+ /**
160
+ * Imperative API for the column or row with the specified id (see `GridTrackImperativeHandle`).
161
+ *
162
+ * ℹ️ Tracks without an explicit `id` use their index (e.g. `"0"`) as their id.
163
+ *
164
+ * ⚠️ An error will be thrown if the Grid does not contain a matching track.
165
+ *
166
+ * @param axis "column" or "row"
167
+ * @param id Track id
168
+ */
169
+ getTrackById: (axis: "column" | "row", id: string | number) => GridTrackImperativeHandle;
170
+ /**
171
+ * Imperative API for the column or row at the specified index (see `GridTrackImperativeHandle`).
172
+ *
173
+ * ℹ️ The index is resolved to a track id when this method is called; the returned API continues to refer to that id.
174
+ * Tracks without an explicit `id` use their index as their id,
175
+ * so specify ids if the API needs to refer to the same track after tracks are added or removed before it.
176
+ *
177
+ * ⚠️ An error will be thrown if the index is out of range.
178
+ *
179
+ * @param axis "column" or "row"
180
+ * @param index Track index (starting at 0)
181
+ */
182
+ getTrackByIndex: (axis: "column" | "row", index: number) => GridTrackImperativeHandle;
183
+ /**
184
+ * Set a new layout for one or both of the Grid's axes.
185
+ *
186
+ * @param layout Map of column and/or row ids to percentages (numbers between 0..100)
187
+ * @return Applied layout (after validation)
188
+ */
189
+ setLayout: (layout: {
190
+ columns?: {
191
+ [columnId: string]: number;
192
+ } | undefined;
193
+ rows?: {
194
+ [rowId: string]: number;
195
+ } | undefined;
196
+ }) => {
197
+ columns: {
198
+ [columnId: string]: number;
199
+ };
200
+ rows: {
201
+ [rowId: string]: number;
202
+ };
203
+ };
204
+ }
205
+
206
+ /**
207
+ * Grid layouts are a pair of (1-dimensional) layouts, one per axis.
208
+ * Each is a map of track id to percentage (0..100) of the space available to that axis.
209
+ */
210
+ export declare type GridLayout = {
211
+ columns: Layout;
212
+ rows: Layout;
213
+ };
214
+
215
+ /**
216
+ * Resizes the columns (or rows) of a Grid.
217
+ *
218
+ * For example:
219
+ *
220
+ * ```tsx
221
+ * // Rendered between columns 0 and 1 and spans all rows
222
+ * <Gridline type="column" column={1} />
223
+ * ```
224
+ *
225
+ * ```tsx
226
+ * // Rendered between rows 0 and 1 and spans all columns
227
+ * <Gridline type="row" row={1} />
228
+ * ```
229
+ *
230
+ * ```tsx
231
+ * // Rendered between columns 0 and 1 alongside of row 2 only
232
+ * <Gridline type="column" column={1} row={2} rowSpan={1} />
233
+ * ```
234
+ *
235
+ * A gridline should not be rendered alongside of a Cell that spans across its boundary
236
+ * (this includes disabled gridlines; an error will be logged to the console);
237
+ * render multiple gridlines along the same boundary instead (e.g. before and after the spanning Cell).
238
+ *
239
+ * ℹ️ Once a boundary contains a gridline, it can only be resized using gridlines;
240
+ * the parts of the boundary that aren't alongside of a gridline can't be dragged.
241
+ *
242
+ * Where column and row gridlines intersect, dragging resizes both axes.
243
+ *
244
+ * Gridlines are not _required_ but they are _recommended_ as they improve keyboard accessibility.
245
+ *
246
+ * Gridline elements always include the following attributes:
247
+ *
248
+ * ```html
249
+ * <div aria-orientation="vertical" data-separator role="separator">
250
+ * ```
251
+ *
252
+ * ℹ️ Column gridlines are vertical (`aria-orientation="vertical"`) and row gridlines are horizontal (`aria-orientation="horizontal"`).
253
+ *
254
+ * ℹ️ In addition to the attributes shown above, gridlines also render all required [WAI-ARIA properties](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Reference/Roles/separator_role#associated_wai-aria_roles_states_and_properties).
255
+ *
256
+ * ⚠️ Gridline elements must be direct DOM children of their parent Grid elements.
257
+ *
258
+ * ℹ️ Gridlines rendered by another component (rather than directly within the Grid) aren't detected until they mount, so server-rendered layouts may shift slightly during hydration.
259
+ */
260
+ export declare function Gridline(props: GridlineProps): JSX.Element;
261
+
262
+ export declare namespace Gridline {
263
+ var displayName: string;
264
+ }
265
+
266
+ export declare type GridlineProps = BaseGridlineProps & ({
267
+ /**
268
+ * Column gridlines are vertical; they resize the columns on either side of them.
269
+ * Row gridlines are horizontal; they resize the rows on either side of them.
270
+ */
271
+ type: "column";
272
+ /**
273
+ * When `type` is "column", the gridline is rendered along the leading (left) edge of this column
274
+ * (between it and the previous column); must be greater than 0 and less than the number of columns.
275
+ */
276
+ column: number;
277
+ /**
278
+ * When `type` is "column", index of the first row the gridline is rendered alongside of; defaults to 0.
279
+ */
280
+ row?: number | undefined;
281
+ /**
282
+ * Number of rows a column gridline spans; defaults to all rows (starting from `row`).
283
+ *
284
+ * ℹ️ Gridlines can span a subset of rows in order to avoid cells that span across the boundary they sit on;
285
+ * multiple gridlines can be rendered along the same boundary (e.g. above and below a spanning cell).
286
+ */
287
+ rowSpan?: number | undefined;
288
+ } | {
289
+ /**
290
+ * Column gridlines are vertical; they resize the columns on either side of them.
291
+ * Row gridlines are horizontal; they resize the rows on either side of them.
292
+ */
293
+ type: "row";
294
+ /**
295
+ * When `type` is "row", index of the first column the gridline is rendered alongside of; defaults to 0.
296
+ */
297
+ column?: number | undefined;
298
+ /**
299
+ * Number of columns a row gridline spans; defaults to all columns (starting from `column`).
300
+ *
301
+ * ℹ️ Gridlines can span a subset of columns in order to avoid cells that span across the boundary they sit on;
302
+ * multiple gridlines can be rendered along the same boundary (e.g. before and after a spanning cell).
303
+ */
304
+ columnSpan?: number | undefined;
305
+ /**
306
+ * When `type` is "row", the gridline is rendered along the leading (top) edge of this row
307
+ * (between it and the previous row); must be greater than 0 and less than the number of rows.
308
+ */
309
+ row: number;
310
+ });
311
+
312
+ export declare type GridProps = HTMLAttributes<HTMLDivElement> & {
313
+ /**
314
+ * Cell and Gridline components that comprise this grid.
315
+ *
316
+ * ⚠️ Cell and Gridline elements must be direct DOM children of their parent Grid element.
317
+ */
318
+ children?: ReactNode | undefined;
319
+ /**
320
+ * CSS class name.
321
+ */
322
+ className?: string | undefined;
323
+ /**
324
+ * Grid columns; either the number of columns or an array of size constraints (one per column).
325
+ */
326
+ columns: number | GridTrackProps[];
327
+ /**
328
+ * Default layout for either or both of the Grid's axes.
329
+ *
330
+ * ℹ️ This value allows layouts to be remembered between page reloads.
331
+ */
332
+ defaultLayout?: Partial<GridLayout> | undefined;
333
+ /**
334
+ * This library sets custom mouse cursor styles to indicate drag state.
335
+ * Use this prop to disable that behavior for this grid.
336
+ */
337
+ disableCursor?: boolean | undefined;
338
+ /**
339
+ * Disable resize functionality.
340
+ */
341
+ disabled?: boolean | undefined;
342
+ /**
343
+ * Ref attached to the root `HTMLDivElement`.
344
+ */
345
+ elementRef?: Ref<HTMLDivElement | null> | undefined;
346
+ /**
347
+ * Exposes the following imperative API:
348
+ * - `getLayout(): GridLayout`
349
+ * - `getTrackById(axis: "column" | "row", id: string | number): GridTrackImperativeHandle`
350
+ * - `getTrackByIndex(axis: "column" | "row", index: number): GridTrackImperativeHandle`
351
+ * - `setLayout(layout: Partial<GridLayout>): GridLayout`
352
+ *
353
+ * ℹ️ The `useGridRef` and `useGridCallbackRef` hooks are exported for convenience use in TypeScript projects.
354
+ */
355
+ gridRef?: Ref<GridImperativeHandle | null> | undefined;
356
+ /**
357
+ * Uniquely identifies this grid within an application.
358
+ * Falls back to `useId` when not provided.
359
+ *
360
+ * ℹ️ This value will also be assigned to the `id` and `data-testid` attributes.
361
+ */
362
+ id?: string | number | undefined;
363
+ /**
364
+ * Called when the Grid's layout is changing.
365
+ *
366
+ * ⚠️ For layout changes caused by pointer events, this method is called each time the pointer is moved.
367
+ * For most cases, it is recommended to use the `onLayoutChanged` callback instead.
368
+ */
369
+ onLayoutChange?: ((layout: GridLayout) => void) | undefined;
370
+ /**
371
+ * Called after the Grid's layout has been changed.
372
+ *
373
+ * ℹ️ For layout changes caused by pointer events, this method is not called until the pointer has been released.
374
+ * This method is recommended when saving layouts to some storage api.
375
+ */
376
+ onLayoutChanged?: ((layout: GridLayout, meta: LayoutChangedMeta) => void) | undefined;
377
+ /**
378
+ * Minimum size of the resizable hit target area (either a `Gridline` or a `Cell` edge)
379
+ * This threshold ensures targets are large enough to avoid mis-clicks.
380
+ *
381
+ * ℹ️ Refer to the `Group` prop of the same name for more information.
382
+ */
383
+ resizeTargetMinimumSize?: {
384
+ coarse: number;
385
+ fine: number;
386
+ };
387
+ /**
388
+ * Grid rows; either the number of rows or an array of size constraints (one per row).
389
+ */
390
+ rows: number | GridTrackProps[];
391
+ /**
392
+ * CSS properties.
393
+ *
394
+ * ⚠️ Grid template and display properties are managed by the Grid and cannot be overridden.
395
+ */
396
+ style?: CSSProperties | undefined;
397
+ };
398
+
399
+ /**
400
+ * Imperative API for an individual Grid track (column or row); returned by `GridImperativeHandle.getTrackById` and `GridImperativeHandle.getTrackByIndex`.
401
+ *
402
+ * ℹ️ Sizes are relative to the space available to the track's axis
403
+ * (e.g. the width of the Grid, minus gaps and gridlines, for a column).
404
+ */
405
+ export declare interface GridTrackImperativeHandle {
406
+ /**
407
+ * Collapse the track to its `collapsedSize`.
408
+ *
409
+ * ⚠️ This method will do nothing if the track is not `collapsible` or if it is already collapsed.
410
+ */
411
+ collapse: () => void;
412
+ /**
413
+ * Expand a collapsed track to its most recent size.
414
+ *
415
+ * ⚠️ This method will do nothing if the track is not currently collapsed.
416
+ */
417
+ expand: () => void;
418
+ /**
419
+ * Get the current size of the track in pixels as well as a percentage of its axis (0..100).
420
+ *
421
+ * @return Track size (in pixels and as a percentage of its axis)
422
+ */
423
+ getSize: () => {
424
+ asPercentage: number;
425
+ inPixels: number;
426
+ };
427
+ /**
428
+ * The track is currently collapsed.
429
+ */
430
+ isCollapsed: () => boolean;
431
+ /**
432
+ * Update the track's size.
433
+ *
434
+ * Size can be in the following formats:
435
+ * - Percentage of the axis (0..100)
436
+ * - Pixels
437
+ * - Relative font units (em, rem)
438
+ * - Viewport relative units (vh, vw)
439
+ *
440
+ * ℹ️ Numeric values are assumed to be pixels.
441
+ * Strings without explicit units are assumed to be percentages (0%..100%).
442
+ * Percentages may also be specified as strings ending with "%" (e.g. "33%")
443
+ * Pixels may also be specified as strings ending with the unit "px".
444
+ * Other units should be specified as strings ending with their CSS property units (e.g. 1rem, 50vh)
445
+ *
446
+ * @param size New track size
447
+ */
448
+ resize: (size: number | string) => void;
449
+ }
450
+
451
+ /**
452
+ * Size constraints for a Grid track (a column or a row).
453
+ *
454
+ * Tracks support the same constraints as Panels,
455
+ * using the same [interpretation rules](https://react-resizable-panels.vercel.app/examples/size-constraints):
456
+ * - Numbers are interpreted as pixels (e.g. `minSize={200}` is 200 pixels)
457
+ * - Strings without explicit units are interpreted as percentage (e.g. `minSize="50"` is 50 percent)
458
+ * - Use explicit units (e.g. "px", "%", "em", "rem", "vh", or "vw") to change interpretation
459
+ */
460
+ export declare type GridTrackProps = PanelConstraintProps & {
461
+ /**
462
+ * Uniquely identifies this track within its axis; defaults to the track's index.
463
+ *
464
+ * ℹ️ This value is used as the key for this track in the Grid's layout.
465
+ */
466
+ id?: string | number | undefined;
467
+ };
468
+
14
469
  /**
15
470
  * A Group wraps a set of resizable Panel components.
16
471
  * Group content can be resized _horizontally_ or _vertically_.
@@ -97,7 +552,7 @@ export declare type GroupProps = HTMLAttributes<HTMLDivElement> & {
97
552
  * Uniquely identifies this group within an application.
98
553
  * Falls back to `useId` when not provided.
99
554
  *
100
- * ℹ️ This value will also be assigned to the `data-group` attribute.
555
+ * ℹ️ This value will also be assigned to the `id` and `data-testid` attributes.
101
556
  */
102
557
  id?: string | number | undefined;
103
558
  /**
@@ -161,7 +616,7 @@ export declare type GroupProps = HTMLAttributes<HTMLDivElement> & {
161
616
  export declare function isCoarsePointer(): boolean;
162
617
 
163
618
  /**
164
- * Map of Panel id to flexGrow value;
619
+ * Map of item (e.g. Panel) id to size (a percentage between 0..100)
165
620
  */
166
621
  export declare type Layout = {
167
622
  [id: string]: number;
@@ -190,8 +645,17 @@ export declare type OnGroupLayoutChange = GroupProps["onLayoutChange"];
190
645
  export declare type OnPanelResize = PanelProps["onResize"];
191
646
 
192
647
  /**
193
- * Panel group orientation loosely relates to the `aria-orientation` attribute.
194
- * It determines how panels are are laid out within the group group and the direction they can be resized in.
648
+ * Types shared by the resize machinery (layout math, pointer and keyboard interactions, cursors, etc.)
649
+ * which is used by both the Group and Grid components.
650
+ *
651
+ * - A "resize axis" is a set of items that can be resized along one orientation;
652
+ * e.g. a Group (whose items are Panels) or one axis of a Grid (whose items are columns or rows).
653
+ * - A "resize item" is one of those items (e.g. a Panel or a Grid track).
654
+ * - A separator (e.g. a Separator or a Gridline) resizes the items on either side of it.
655
+ */
656
+ /**
657
+ * Orientation loosely relates to the `aria-orientation` attribute.
658
+ * It determines how items are laid out and the direction they can be resized in.
195
659
  */
196
660
  export declare type Orientation = "horizontal" | "vertical";
197
661
 
@@ -226,6 +690,23 @@ export declare namespace Panel {
226
690
  var displayName: string;
227
691
  }
228
692
 
693
+ /**
694
+ * Size constraints may be specified in a variety of ways:
695
+ * - Percentage of the parent Group (0..100)
696
+ * - Pixels
697
+ * - Relative font units (em, rem)
698
+ * - Viewport relative units (vh, vw)
699
+ *
700
+ * Numeric values are assumed to be pixels.
701
+ * Strings without explicit units are assumed to be percentages (0%..100%).
702
+ *
703
+ * Percentages may also be specified as strings ending with "%" (e.g. "33%")
704
+ * Pixels may also be specified as strings ending with the unit "px".
705
+ *
706
+ * Other units should be specified as strings ending with their CSS property units (e.g. 1rem, 50vh)
707
+ */
708
+ declare type PanelConstraintProps = Pick<PanelProps, "collapsedSize" | "collapsedThreshold" | "collapsible" | "defaultSize" | "disabled" | "groupResizeBehavior" | "maxSize" | "minSize">;
709
+
229
710
  /**
230
711
  * Imperative Panel API
231
712
  *
@@ -347,7 +828,7 @@ export declare type PanelProps = BasePanelAttributes & {
347
828
  *
348
829
  * ℹ️ This prop is used to associate persisted group layouts with the original panel.
349
830
  *
350
- * ℹ️ This value will also be assigned to the `data-panel` attribute.
831
+ * ℹ️ This value will also be assigned to the `id` and `data-testid` attributes.
351
832
  */
352
833
  id?: string | number | undefined;
353
834
  /**
@@ -417,7 +898,7 @@ declare type ResizePreviewMode = "panel" | "separator";
417
898
  *
418
899
  * ℹ️ In addition to the attributes shown above, separator also renders all required [WAI-ARIA properties](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Reference/Roles/separator_role#associated_wai-aria_roles_states_and_properties).
419
900
  */
420
- export declare function Separator({ children, className, disabled, disableDoubleClick, elementRef: elementRefProp, id: idProp, preview, style, ...rest }: SeparatorProps): JSX.Element;
901
+ export declare function Separator({ children, className, disabled, disableDoubleClick, elementRef, id: idProp, preview, style, ...rest }: SeparatorProps): JSX.Element;
421
902
 
422
903
  export declare namespace Separator {
423
904
  var displayName: string;
@@ -468,7 +949,7 @@ export declare type SeparatorProps = BaseSeparatorAttributes & {
468
949
  * Uniquely identifies the separator within the parent group.
469
950
  * Falls back to `useId` when not provided.
470
951
  *
471
- * ℹ️ This value will also be assigned to the `data-separator` attribute.
952
+ * ℹ️ This value will also be assigned to the `id` and `data-testid` attributes.
472
953
  */
473
954
  id?: string | number | undefined;
474
955
  /**
@@ -487,6 +968,36 @@ export declare type SeparatorProps = BaseSeparatorAttributes & {
487
968
 
488
969
  export declare type SizeUnit = "px" | "%" | "em" | "rem" | "vh" | "vw";
489
970
 
971
+ /**
972
+ * Saves and restores Grid layouts between page loads.
973
+ * It can be configured to store values using `localStorage`, `sessionStorage`, cookies, or any other persistence layer that makes sense for your application.
974
+ */
975
+ export declare function useDefaultGridLayout({ id, onlySaveAfterUserInteractions, storage }: {
976
+ /**
977
+ * Uniquely identifies a specific grid/layout.
978
+ */
979
+ id: string;
980
+ /**
981
+ * Only auto-save layouts that were directly caused by user input (e.g. keyboard or mouse events).
982
+ * Ignore layout changes resulting from imperative API calls or window resize events.
983
+ */
984
+ onlySaveAfterUserInteractions?: boolean;
985
+ /**
986
+ * Storage implementation; supports localStorage, sessionStorage, and custom implementations
987
+ * Refer to documentation site for example integrations.
988
+ */
989
+ storage?: LayoutStorage;
990
+ }): {
991
+ /**
992
+ * Pass this value to `Grid` as the `defaultLayout` prop.
993
+ */
994
+ defaultLayout: Partial<GridLayout> | undefined;
995
+ /**
996
+ * Attach this callback on the `Grid` as the `onLayoutChanged` prop.
997
+ */
998
+ onLayoutChanged: (layout: GridLayout, meta: LayoutChangedMeta) => void;
999
+ };
1000
+
490
1001
  /**
491
1002
  * Saves and restores group layouts between page loads.
492
1003
  * It can be configured to store values using `localStorage`, `sessionStorage`, cookies, or any other persistence layer that makes sense for your application.
@@ -545,6 +1056,18 @@ export declare function useDefaultLayout({ debounceSaveMs, onlySaveAfterUserInte
545
1056
  onLayoutChanged: (layout: Layout, meta: LayoutChangedMeta) => void;
546
1057
  };
547
1058
 
1059
+ /**
1060
+ * Convenience hook to return a properly typed ref callback for the Grid component.
1061
+ *
1062
+ * Use this hook when you need to share the ref with another component or hook.
1063
+ */
1064
+ export declare function useGridCallbackRef(): [GridImperativeHandle | null, Dispatch<SetStateAction<GridImperativeHandle | null>>];
1065
+
1066
+ /**
1067
+ * Convenience hook to return a properly typed ref for the Grid component.
1068
+ */
1069
+ export declare function useGridRef(): RefObject<GridImperativeHandle | null>;
1070
+
548
1071
  /**
549
1072
  * Convenience hook to return a properly typed ref callback for the Group component.
550
1073
  *