react-resizable-panels 4.19.0 → 4.20.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.
|
@@ -90,7 +90,7 @@ export declare type CellProps = HTMLAttributes<HTMLDivElement> & {
|
|
|
90
90
|
* Uniquely identifies this cell within the parent grid.
|
|
91
91
|
* Falls back to `useId` when not provided.
|
|
92
92
|
*
|
|
93
|
-
* ℹ️ This value will also be assigned to the `id` and `data-testid` attributes
|
|
93
|
+
* ℹ️ This value will also be assigned to the `id` and `data-testid` attributes (an explicit `data-testid` prop will take precedence).
|
|
94
94
|
*/
|
|
95
95
|
id?: string | number | undefined;
|
|
96
96
|
/**
|
|
@@ -151,6 +151,49 @@ export declare type DragPreviewState = {
|
|
|
151
151
|
isTearOff: boolean;
|
|
152
152
|
};
|
|
153
153
|
|
|
154
|
+
/**
|
|
155
|
+
* A tabset that floats above the workspace's layout (see `WorkspaceModel.floating`), e.g. a notepad that can be moved out of the way of the content beneath it.
|
|
156
|
+
*
|
|
157
|
+
* ℹ️ Floating tabsets are positioned (and sized) in pixels, so they keep their size when the workspace is resized.
|
|
158
|
+
* They're shown with their headers within the workspace's layout (so they can always be dragged back), and the rest of them is clipped to it;
|
|
159
|
+
* their positions aren't changed to fit, though, so they're shown where they were again once that fits (e.g. when the workspace is made larger again).
|
|
160
|
+
*
|
|
161
|
+
* ℹ️ Unlike tabsets within the layout, floating tabsets can't be split or maximized, and their maximum sizes (`maxWidth` and `maxHeight`) are ignored.
|
|
162
|
+
*
|
|
163
|
+
* ℹ️ Floating tabsets can always be collapsed (with the imperative API, e.g. `useParentTabset().collapse()`), so they don't have the `collapsible` flag.
|
|
164
|
+
* A collapsed floating tabset is only as large as its header across it (e.g. as tall as its tabs, when they're placed on top), and can only be resized along it;
|
|
165
|
+
* its `width` and `height` are the size it expands to. Like tabsets in the layout, clicking a tab (or the empty space in the header) of a collapsed floating tabset expands it.
|
|
166
|
+
*/
|
|
167
|
+
export declare type FloatingTabsetNode<TabData = unknown, TabsetData = unknown> = Omit<TabsetNode<TabData, TabsetData>, "collapsible" | "size"> & FloatingTabsetRect;
|
|
168
|
+
|
|
169
|
+
export declare type FloatingTabsetNodeInput<TabData = unknown, TabsetData = unknown> = Omit<FloatingTabsetNode<TabData, TabsetData>, "id"> & {
|
|
170
|
+
id?: string | undefined;
|
|
171
|
+
};
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* Position and size of a floating tabset (see `WorkspaceModel.floating`), in pixels.
|
|
175
|
+
*
|
|
176
|
+
* ℹ️ Positions are relative to the top left corner of the workspace's layout (within the root element's padding), even in a right-to-left layout.
|
|
177
|
+
*/
|
|
178
|
+
export declare type FloatingTabsetRect = {
|
|
179
|
+
/**
|
|
180
|
+
* Distance from the left edge of the workspace's layout to the tabset's left edge.
|
|
181
|
+
*/
|
|
182
|
+
x: number;
|
|
183
|
+
/**
|
|
184
|
+
* Distance from the top edge of the workspace's layout to the tabset's top edge.
|
|
185
|
+
*/
|
|
186
|
+
y: number;
|
|
187
|
+
/**
|
|
188
|
+
* Width of the tabset (including its header).
|
|
189
|
+
*/
|
|
190
|
+
width: number;
|
|
191
|
+
/**
|
|
192
|
+
* Height of the tabset (including its header).
|
|
193
|
+
*/
|
|
194
|
+
height: number;
|
|
195
|
+
};
|
|
196
|
+
|
|
154
197
|
/**
|
|
155
198
|
* A Grid arranges resizable Cells in two dimensions.
|
|
156
199
|
* Columns can be resized horizontally and rows can be resized vertically;
|
|
@@ -186,7 +229,7 @@ declare function GridComponent({ children, className, columns, defaultLayout, di
|
|
|
186
229
|
/**
|
|
187
230
|
* Imperative Grid API.
|
|
188
231
|
*
|
|
189
|
-
* ℹ️ The `useGridRef` and `useGridCallbackRef` hooks are exported for convenience
|
|
232
|
+
* ℹ️ The `useGridRef` and `useGridCallbackRef` hooks are exported for convenience in TypeScript projects.
|
|
190
233
|
*/
|
|
191
234
|
export declare interface GridImperativeHandle {
|
|
192
235
|
/**
|
|
@@ -279,7 +322,7 @@ export declare type GridLayout = {
|
|
|
279
322
|
* ```
|
|
280
323
|
*
|
|
281
324
|
* A gridline should not be rendered alongside of a Cell that spans across its boundary
|
|
282
|
-
* (this includes disabled gridlines; an error will be logged to the console);
|
|
325
|
+
* (this includes disabled gridlines; in development builds, an error will be logged to the console);
|
|
283
326
|
* render multiple gridlines along the same boundary instead (e.g. before and after the spanning Cell).
|
|
284
327
|
*
|
|
285
328
|
* ℹ️ Once a boundary contains a gridline, it can only be resized using gridlines;
|
|
@@ -396,14 +439,14 @@ export declare type GridProps = HTMLAttributes<HTMLDivElement> & {
|
|
|
396
439
|
* - `getTrackByIndex(axis: "column" | "row", index: number): GridTrackImperativeHandle`
|
|
397
440
|
* - `setLayout(layout: Partial<GridLayout>): GridLayout`
|
|
398
441
|
*
|
|
399
|
-
* ℹ️ The `useGridRef` and `useGridCallbackRef` hooks are exported for convenience
|
|
442
|
+
* ℹ️ The `useGridRef` and `useGridCallbackRef` hooks are exported for convenience in TypeScript projects.
|
|
400
443
|
*/
|
|
401
444
|
gridRef?: Ref<GridImperativeHandle | null> | undefined;
|
|
402
445
|
/**
|
|
403
446
|
* Uniquely identifies this grid within an application.
|
|
404
447
|
* Falls back to `useId` when not provided.
|
|
405
448
|
*
|
|
406
|
-
* ℹ️ This value will also be assigned to the `id` and `data-testid` attributes
|
|
449
|
+
* ℹ️ This value will also be assigned to the `id` and `data-testid` attributes (an explicit `data-testid` prop will take precedence).
|
|
407
450
|
*/
|
|
408
451
|
id?: string | number | undefined;
|
|
409
452
|
/**
|
|
@@ -416,8 +459,8 @@ export declare type GridProps = HTMLAttributes<HTMLDivElement> & {
|
|
|
416
459
|
/**
|
|
417
460
|
* Called after the Grid's layout has been changed.
|
|
418
461
|
*
|
|
419
|
-
* ℹ️ For layout changes caused by pointer events, this
|
|
420
|
-
* This
|
|
462
|
+
* ℹ️ For layout changes caused by pointer events, this callback is not called until the pointer has been released.
|
|
463
|
+
* This callback is recommended for saving layouts to storage.
|
|
421
464
|
*/
|
|
422
465
|
onLayoutChanged?: ((layout: GridLayout, meta: LayoutChangedMeta<GridLayout>) => void) | undefined;
|
|
423
466
|
/**
|
|
@@ -537,7 +580,7 @@ declare function GroupComponent({ children, className, defaultLayout, disableCur
|
|
|
537
580
|
/**
|
|
538
581
|
* Imperative Group API.
|
|
539
582
|
*
|
|
540
|
-
* ℹ️ The `useGroupRef` and `useGroupCallbackRef` hooks are exported for convenience
|
|
583
|
+
* ℹ️ The `useGroupRef` and `useGroupCallbackRef` hooks are exported for convenience in TypeScript projects.
|
|
541
584
|
*/
|
|
542
585
|
export declare interface GroupImperativeHandle {
|
|
543
586
|
/**
|
|
@@ -595,14 +638,14 @@ export declare type GroupProps = HTMLAttributes<HTMLDivElement> & {
|
|
|
595
638
|
* - `getLayout(): Layout`
|
|
596
639
|
* - `setLayout(layout: Layout): Layout`
|
|
597
640
|
*
|
|
598
|
-
* ℹ️ The `useGroupRef` and `useGroupCallbackRef` hooks are exported for convenience
|
|
641
|
+
* ℹ️ The `useGroupRef` and `useGroupCallbackRef` hooks are exported for convenience in TypeScript projects.
|
|
599
642
|
*/
|
|
600
643
|
groupRef?: Ref<GroupImperativeHandle | null> | undefined;
|
|
601
644
|
/**
|
|
602
645
|
* Uniquely identifies this group within an application.
|
|
603
646
|
* Falls back to `useId` when not provided.
|
|
604
647
|
*
|
|
605
|
-
* ℹ️ This value will also be assigned to the `id` and `data-testid` attributes
|
|
648
|
+
* ℹ️ This value will also be assigned to the `id` and `data-testid` attributes (an explicit `data-testid` prop will take precedence).
|
|
606
649
|
*/
|
|
607
650
|
id?: string | number | undefined;
|
|
608
651
|
/**
|
|
@@ -615,8 +658,8 @@ export declare type GroupProps = HTMLAttributes<HTMLDivElement> & {
|
|
|
615
658
|
/**
|
|
616
659
|
* Called after the Group's layout has been changed.
|
|
617
660
|
*
|
|
618
|
-
* ℹ️ For layout changes caused by pointer events, this
|
|
619
|
-
* This
|
|
661
|
+
* ℹ️ For layout changes caused by pointer events, this callback is not called until the pointer has been released.
|
|
662
|
+
* This callback is recommended for saving layouts to storage.
|
|
620
663
|
*
|
|
621
664
|
* ℹ️ The second argument contains meta information about the layout change.
|
|
622
665
|
* The `isUserInteraction` attribute signals whether the resize was caused by direct user input.
|
|
@@ -723,6 +766,7 @@ export declare type LayoutStorage = Pick<Storage, "getItem" | "setItem">;
|
|
|
723
766
|
* - Scales sizes so they add up to 100 (when all siblings have percentage sizes)
|
|
724
767
|
* - Fixes selections (and recently selected tabs) of tabs that no longer exist
|
|
725
768
|
* - Expands tabsets that can't be collapsed (e.g. the only tabset in the workspace)
|
|
769
|
+
* - Removes floating tabsets that are empty, and fixes their invalid positions and sizes
|
|
726
770
|
* - Clears the maximized tabset if it no longer exists
|
|
727
771
|
* - Assigns ids to splits and tabsets that don't have them
|
|
728
772
|
*
|
|
@@ -805,7 +849,7 @@ declare type PanelConstraintProps = Pick<PanelProps, "collapsedSize" | "collapse
|
|
|
805
849
|
/**
|
|
806
850
|
* Imperative Panel API
|
|
807
851
|
*
|
|
808
|
-
* ℹ️ The `usePanelRef` and `usePanelCallbackRef` hooks are exported for convenience
|
|
852
|
+
* ℹ️ The `usePanelRef` and `usePanelCallbackRef` hooks are exported for convenience in TypeScript projects.
|
|
809
853
|
*/
|
|
810
854
|
export declare interface PanelImperativeHandle {
|
|
811
855
|
/**
|
|
@@ -930,7 +974,7 @@ export declare type PanelProps = BasePanelAttributes & {
|
|
|
930
974
|
*
|
|
931
975
|
* ℹ️ This prop is used to associate persisted group layouts with the original panel.
|
|
932
976
|
*
|
|
933
|
-
* ℹ️ This value will also be assigned to the `id` and `data-testid` attributes
|
|
977
|
+
* ℹ️ This value will also be assigned to the `id` and `data-testid` attributes (an explicit `data-testid` prop will take precedence).
|
|
934
978
|
*/
|
|
935
979
|
id?: string | number | undefined;
|
|
936
980
|
/**
|
|
@@ -971,7 +1015,7 @@ export declare type PanelProps = BasePanelAttributes & {
|
|
|
971
1015
|
* - `isCollapsed(): boolean`
|
|
972
1016
|
* - `resize(size: number | string): void`
|
|
973
1017
|
*
|
|
974
|
-
* ℹ️ The `usePanelRef` and `usePanelCallbackRef` hooks are exported for convenience
|
|
1018
|
+
* ℹ️ The `usePanelRef` and `usePanelCallbackRef` hooks are exported for convenience in TypeScript projects.
|
|
975
1019
|
*/
|
|
976
1020
|
panelRef?: Ref<PanelImperativeHandle | null> | undefined;
|
|
977
1021
|
/**
|
|
@@ -1038,6 +1082,10 @@ export declare type ParentTab = {
|
|
|
1038
1082
|
* ℹ️ This method is not restricted by `disableClose` or `disabled`.
|
|
1039
1083
|
*/
|
|
1040
1084
|
close: () => void;
|
|
1085
|
+
/**
|
|
1086
|
+
* Move the tab into a new floating tabset (see `WorkspaceImperativeHandle.floatTab`).
|
|
1087
|
+
*/
|
|
1088
|
+
float: (rect?: Partial<FloatingTabsetRect>) => void;
|
|
1041
1089
|
/**
|
|
1042
1090
|
* Id of the tabset that currently contains the tab.
|
|
1043
1091
|
*/
|
|
@@ -1088,6 +1136,10 @@ export declare type ParentTabset<TabData = unknown> = {
|
|
|
1088
1136
|
* Expand the tabset if it is collapsed (see `WorkspaceImperativeHandle.expandTabset`).
|
|
1089
1137
|
*/
|
|
1090
1138
|
expand: () => void;
|
|
1139
|
+
/**
|
|
1140
|
+
* Move the tabset out of the layout, to float above it (see `WorkspaceImperativeHandle.floatTabset`).
|
|
1141
|
+
*/
|
|
1142
|
+
float: (rect?: Partial<FloatingTabsetRect>) => void;
|
|
1091
1143
|
/**
|
|
1092
1144
|
* Id of the tabset.
|
|
1093
1145
|
*/
|
|
@@ -1099,6 +1151,10 @@ export declare type ParentTabset<TabData = unknown> = {
|
|
|
1099
1151
|
* and when it's collapsed to fit (see `TabsetNode.collapsible`); `useParentTabsetState().isCollapsed` reflects how it's shown.
|
|
1100
1152
|
*/
|
|
1101
1153
|
isCollapsed: () => boolean;
|
|
1154
|
+
/**
|
|
1155
|
+
* The tabset currently floats above the layout (see `WorkspaceModel.floating`).
|
|
1156
|
+
*/
|
|
1157
|
+
isFloating: () => boolean;
|
|
1102
1158
|
/**
|
|
1103
1159
|
* The tabset is currently maximized.
|
|
1104
1160
|
*/
|
|
@@ -1147,7 +1203,7 @@ export declare type ParentTabsetState = {
|
|
|
1147
1203
|
isCollapsedToFit: boolean;
|
|
1148
1204
|
/**
|
|
1149
1205
|
* The tabset can be collapsed (or is collapsed, and can be expanded), e.g. to show or hide a toolbar button:
|
|
1150
|
-
* it has the `collapsible` flag, isn't the only tabset in the workspace, and has a sibling that isn't collapsed.
|
|
1206
|
+
* it has the `collapsible` flag, isn't the only tabset in the workspace, and has a sibling that isn't collapsed (or it's floating; see `FloatingTabsetNode`).
|
|
1151
1207
|
*/
|
|
1152
1208
|
isCollapsible: boolean;
|
|
1153
1209
|
/**
|
|
@@ -1156,8 +1212,15 @@ export declare type ParentTabsetState = {
|
|
|
1156
1212
|
* - The Workspace has the `disabled` prop
|
|
1157
1213
|
* - It's the only tabset in the workspace (see `isRoot`), and can't be dragged to another workspace (see the Workspace's `dragGroup` prop; tabsets with the `keepWhenEmpty` flag can't be)
|
|
1158
1214
|
* - A tabset is maximized
|
|
1215
|
+
*
|
|
1216
|
+
* ℹ️ Dragging a floating tabset moves it (rather than dropping it elsewhere), so only its own `disableDrag` flag and the Workspace's `disabled` prop prevent that;
|
|
1217
|
+
* they also prevent it from being resized.
|
|
1159
1218
|
*/
|
|
1160
1219
|
isDragDisabled: boolean;
|
|
1220
|
+
/**
|
|
1221
|
+
* The tabset floats above the layout (see `WorkspaceModel.floating`).
|
|
1222
|
+
*/
|
|
1223
|
+
isFloating: boolean;
|
|
1161
1224
|
/**
|
|
1162
1225
|
* The tabset is maximized.
|
|
1163
1226
|
*/
|
|
@@ -1285,7 +1348,7 @@ export declare type SeparatorProps = BaseSeparatorAttributes & {
|
|
|
1285
1348
|
* Uniquely identifies the separator within the parent group.
|
|
1286
1349
|
* Falls back to `useId` when not provided.
|
|
1287
1350
|
*
|
|
1288
|
-
* ℹ️ This value will also be assigned to the `id` and `data-testid` attributes
|
|
1351
|
+
* ℹ️ This value will also be assigned to the `id` and `data-testid` attributes (an explicit `data-testid` prop will take precedence).
|
|
1289
1352
|
*/
|
|
1290
1353
|
id?: string | number | undefined;
|
|
1291
1354
|
/**
|
|
@@ -1395,6 +1458,7 @@ export declare type TabDropRegion = "bottom" | "center" | "left" | "right" | "to
|
|
|
1395
1458
|
* Where a dragged tab can be dropped:
|
|
1396
1459
|
* - At an `index` within a tabset's tab list (in the order of its `tabs`, which run from right to left in a right-to-left layout)
|
|
1397
1460
|
* - Within a `region` of a tabset's content area; edges split the tabset, and the center adds the tab to it
|
|
1461
|
+
* - At an `edge` of the workspace, beside all of the other tabsets (filling the workspace's height or width)
|
|
1398
1462
|
*/
|
|
1399
1463
|
export declare type TabDropTarget = {
|
|
1400
1464
|
index: number;
|
|
@@ -1402,6 +1466,8 @@ export declare type TabDropTarget = {
|
|
|
1402
1466
|
} | {
|
|
1403
1467
|
region: TabDropRegion;
|
|
1404
1468
|
tabsetId: string;
|
|
1469
|
+
} | {
|
|
1470
|
+
edge: WorkspaceDropEdge;
|
|
1405
1471
|
};
|
|
1406
1472
|
|
|
1407
1473
|
/**
|
|
@@ -1537,6 +1603,8 @@ export declare type TabsetNode<TabData = unknown, TabsetData = unknown> = {
|
|
|
1537
1603
|
*
|
|
1538
1604
|
* ⚠️ A maximum only applies if something else can take up the rest of the space, e.g. another tabset in the same split without a maximum width;
|
|
1539
1605
|
* otherwise it's ignored (e.g. if every tabset in a split has a maximum, or the tabset fills the workspace).
|
|
1606
|
+
*
|
|
1607
|
+
* ℹ️ Maximums don't apply to floating tabsets, which can be resized to any size larger than their minimums.
|
|
1540
1608
|
*/
|
|
1541
1609
|
maxWidth?: string | undefined;
|
|
1542
1610
|
/**
|
|
@@ -1549,6 +1617,8 @@ export declare type TabsetNode<TabData = unknown, TabsetData = unknown> = {
|
|
|
1549
1617
|
*
|
|
1550
1618
|
* ⚠️ A maximum only applies if something else can take up the rest of the space, e.g. another tabset in the same split without a maximum height;
|
|
1551
1619
|
* otherwise it's ignored (e.g. if every tabset in a split has a maximum, or the tabset fills the workspace).
|
|
1620
|
+
*
|
|
1621
|
+
* ℹ️ Maximums don't apply to floating tabsets, which can be resized to any size larger than their minimums.
|
|
1552
1622
|
*/
|
|
1553
1623
|
maxHeight?: string | undefined;
|
|
1554
1624
|
/**
|
|
@@ -1593,6 +1663,8 @@ export declare type TabsetNode<TabData = unknown, TabsetData = unknown> = {
|
|
|
1593
1663
|
*
|
|
1594
1664
|
* ℹ️ A collapsed tabset's header runs along its split (e.g. tabs placed on top are shown on the left while a tabset in a horizontal split is collapsed);
|
|
1595
1665
|
* this doesn't change its `tabPlacement`.
|
|
1666
|
+
*
|
|
1667
|
+
* ℹ️ A floating tabset can be collapsed too (without the `collapsible` flag, which doesn't apply to it; see `FloatingTabsetNode`).
|
|
1596
1668
|
*/
|
|
1597
1669
|
collapsed?: boolean | undefined;
|
|
1598
1670
|
/**
|
|
@@ -1917,6 +1989,9 @@ export declare type WorkspaceChangedMeta = {
|
|
|
1917
1989
|
* ℹ️ A tab (or tabset) dragged to another workspace (see the `dragGroup` prop) is reported as `"transfer"` by both workspaces:
|
|
1918
1990
|
* the one it was dropped into (which added it) and the one it was dragged from (which removed it).
|
|
1919
1991
|
*
|
|
1992
|
+
* ℹ️ Floating tabsets (see `WorkspaceModel.floating`) are reported as `"float"` when they're created, `"move"` and `"resize"` when they're dragged by their headers and edges,
|
|
1993
|
+
* and `"raise"` when they're brought to the front (e.g. by pressing one that's behind another).
|
|
1994
|
+
*
|
|
1920
1995
|
* ⚠️ New reasons may be added in later versions, so code that switches on this value should handle unrecognized values.
|
|
1921
1996
|
*/
|
|
1922
1997
|
reason: WorkspaceChangeReason;
|
|
@@ -1927,7 +2002,7 @@ export declare type WorkspaceChangedMeta = {
|
|
|
1927
2002
|
*
|
|
1928
2003
|
* ⚠️ New reasons may be added in later versions.
|
|
1929
2004
|
*/
|
|
1930
|
-
export declare type WorkspaceChangeReason = "add" | "close" | "collapse" | "expand" | "maximize" | "move" | "resize" | "restore" | "select" | "set-model" | "tear-off" | "transfer" | "update";
|
|
2005
|
+
export declare type WorkspaceChangeReason = "add" | "close" | "collapse" | "expand" | "float" | "maximize" | "move" | "raise" | "resize" | "restore" | "select" | "set-model" | "tear-off" | "transfer" | "update";
|
|
1931
2006
|
|
|
1932
2007
|
/**
|
|
1933
2008
|
* CSS class names for the elements a Workspace renders (see the Workspace's `classNames` prop).
|
|
@@ -1935,6 +2010,17 @@ export declare type WorkspaceChangeReason = "add" | "close" | "collapse" | "expa
|
|
|
1935
2010
|
export declare type WorkspaceClassNames = {
|
|
1936
2011
|
dragPreview?: string | undefined;
|
|
1937
2012
|
dropIndicator?: string | undefined;
|
|
2013
|
+
/**
|
|
2014
|
+
* The element that positions each floating tabset (with a `data-floating-tabset` attribute, and a `data-tabset-collapsed` attribute while its tabset is collapsed), around the tabset itself, e.g. for a shadow.
|
|
2015
|
+
*/
|
|
2016
|
+
floatingTabset?: string | undefined;
|
|
2017
|
+
/**
|
|
2018
|
+
* Each of the handles along the edges (and at the corners) of a floating tabset that resize it,
|
|
2019
|
+
* with a `data-floating-resize-handle` attribute naming its edge (e.g. "bottom" or "bottom-right").
|
|
2020
|
+
*
|
|
2021
|
+
* ℹ️ The handles are positioned (and given resize cursors) by the workspace, but they're transparent.
|
|
2022
|
+
*/
|
|
2023
|
+
floatingResizeHandle?: string | undefined;
|
|
1938
2024
|
header?: string | undefined;
|
|
1939
2025
|
/**
|
|
1940
2026
|
* Each split (a Group with `data-split` and `data-split-id` attributes); for example, its `gap` adds space between tabsets.
|
|
@@ -1952,6 +2038,13 @@ export declare type WorkspaceClassNames = {
|
|
|
1952
2038
|
|
|
1953
2039
|
declare function WorkspaceComponent<TabData = unknown, TabsetData = unknown>({ className, classNames, defaultModel, disabled, disableDragBetweenApps, disableDrop, dragGroup, elementRef: elementRefProp, hiddenTabBehavior, id: idProp, onModelChanged, onTearOff, renderDragPreview, renderEmptyTabset, renderSeparator, renderTab, renderTabContent, renderTabsetDragPreview, renderTabsetToolbar, resizePreviewMode, serverRenderTabContent, style, styles, tabPlacement, tabRemovalSelectionBehavior, tabsetMinHeight, tabsetMinWidth, workspaceRef, ...rest }: WorkspaceProps<TabData, TabsetData>): JSX.Element;
|
|
1954
2040
|
|
|
2041
|
+
/**
|
|
2042
|
+
* Edge of the workspace.
|
|
2043
|
+
*
|
|
2044
|
+
* ℹ️ Edges are sides of the screen, so in a right-to-left layout (e.g. within `dir="rtl"`), "left" is at the end of the root split's `children`.
|
|
2045
|
+
*/
|
|
2046
|
+
export declare type WorkspaceDropEdge = "bottom" | "left" | "right" | "top";
|
|
2047
|
+
|
|
1955
2048
|
/**
|
|
1956
2049
|
* Imperative Workspace API.
|
|
1957
2050
|
*
|
|
@@ -1990,7 +2083,7 @@ export declare interface WorkspaceImperativeHandle<TabData = unknown, TabsetData
|
|
|
1990
2083
|
/**
|
|
1991
2084
|
* Collapse a tabset to just its header.
|
|
1992
2085
|
*
|
|
1993
|
-
* ℹ️ This has no effect unless the tabset has the `collapsible` flag;
|
|
2086
|
+
* ℹ️ This has no effect unless the tabset has the `collapsible` flag (or is floating; see `FloatingTabsetNode`);
|
|
1994
2087
|
* the only tabset in a workspace, and tabsets whose siblings are all collapsed, can't be collapsed.
|
|
1995
2088
|
*/
|
|
1996
2089
|
collapseTabset: (tabsetId: string) => void;
|
|
@@ -2002,6 +2095,25 @@ export declare interface WorkspaceImperativeHandle<TabData = unknown, TabsetData
|
|
|
2002
2095
|
* ℹ️ This has no effect on a tabset that's only collapsed to fit, which is expanded once it fits (see `TabsetNode.collapsible`).
|
|
2003
2096
|
*/
|
|
2004
2097
|
expandTabset: (tabsetId: string) => void;
|
|
2098
|
+
/**
|
|
2099
|
+
* Move a tab into a new floating tabset (see `WorkspaceModel.floating`), on top of any other floating tabsets.
|
|
2100
|
+
*
|
|
2101
|
+
* ℹ️ Parts of the position and size that aren't specified default to those of the tab's tabset, offset slightly down and to the right
|
|
2102
|
+
* (and moved, if needed, to fit within the workspace).
|
|
2103
|
+
*
|
|
2104
|
+
* ℹ️ This has no effect on the only tab of a floating tabset (unless the tabset has the `keepWhenEmpty` flag).
|
|
2105
|
+
*/
|
|
2106
|
+
floatTab: (tabId: string, rect?: Partial<FloatingTabsetRect>) => void;
|
|
2107
|
+
/**
|
|
2108
|
+
* Move a tabset out of the layout, to float above it (see `WorkspaceModel.floating`), on top of any other floating tabsets.
|
|
2109
|
+
*
|
|
2110
|
+
* ℹ️ Parts of the position and size that aren't specified default to those of the tabset, offset slightly down and to the right
|
|
2111
|
+
* (and moved, if needed, to fit within the workspace).
|
|
2112
|
+
*
|
|
2113
|
+
* ℹ️ This has no effect on the root tabset (which fills the workspace) or a tabset that's already floating.
|
|
2114
|
+
* A maximized tabset is restored first.
|
|
2115
|
+
*/
|
|
2116
|
+
floatTabset: (tabsetId: string, rect?: Partial<FloatingTabsetRect>) => void;
|
|
2005
2117
|
/**
|
|
2006
2118
|
* Id of the tabset the user most recently interacted with (by pointer or focus).
|
|
2007
2119
|
*/
|
|
@@ -2030,22 +2142,29 @@ export declare interface WorkspaceImperativeHandle<TabData = unknown, TabsetData
|
|
|
2030
2142
|
/**
|
|
2031
2143
|
* Maximize a tabset, so that it covers the rest of the workspace.
|
|
2032
2144
|
*
|
|
2033
|
-
* ℹ️ This has no effect on the only tabset in a workspace (the root), which already fills it.
|
|
2145
|
+
* ℹ️ This has no effect on the only tabset in a workspace (the root), which already fills it, or on a floating tabset.
|
|
2034
2146
|
* A maximized tabset is restored if it becomes the only one (e.g. after the other tabsets are closed).
|
|
2035
2147
|
*/
|
|
2036
2148
|
maximizeTabset: (tabsetId: string) => void;
|
|
2037
2149
|
/**
|
|
2038
|
-
* Move a tab to a position within a tabset's tab list,
|
|
2150
|
+
* Move a tab to a position within a tabset's tab list, to a region of a tabset's content area,
|
|
2151
|
+
* or to an `edge` of the workspace (in a new tabset beside all of the other tabsets).
|
|
2152
|
+
*
|
|
2153
|
+
* ℹ️ The `"left"` and `"right"` regions (and edges) are sides of the screen (so they're mirrored in right-to-left layouts).
|
|
2039
2154
|
*
|
|
2040
|
-
* ℹ️
|
|
2155
|
+
* ℹ️ Floating tabsets can't be split, so a tab moved to an edge region of one is added to it instead (like the `"center"` region).
|
|
2041
2156
|
*/
|
|
2042
2157
|
moveTab: (tabId: string, target: TabDropTarget) => void;
|
|
2043
2158
|
/**
|
|
2044
2159
|
* Move a tabset beside another tabset (by dropping it onto a region at the edge of that tabset's content area),
|
|
2160
|
+
* or beside all of the other tabsets (at an `edge` of the workspace),
|
|
2045
2161
|
* or move its tabs into another tabset (at an `index` within its tab list, or onto the `"center"` of its content area).
|
|
2046
|
-
* The `"left"` and `"right"` regions are sides of the screen (so they're mirrored in right-to-left layouts).
|
|
2162
|
+
* The `"left"` and `"right"` regions (and edges) are sides of the screen (so they're mirrored in right-to-left layouts).
|
|
2047
2163
|
*
|
|
2048
2164
|
* ℹ️ When its tabs are moved, the emptied tabset is removed (unless it has the `keepWhenEmpty` flag).
|
|
2165
|
+
*
|
|
2166
|
+
* ℹ️ A floating tabset moved beside another tabset (or to an edge of the workspace) is docked: it's moved into the layout, and stops floating.
|
|
2167
|
+
* Floating tabsets can't be split, so a tabset moved to an edge region of one has its tabs moved into it instead (like the `"center"` region).
|
|
2049
2168
|
*/
|
|
2050
2169
|
moveTabset: (tabsetId: string, target: TabDropTarget) => void;
|
|
2051
2170
|
/**
|
|
@@ -2092,17 +2211,24 @@ export declare interface WorkspaceImperativeHandle<TabData = unknown, TabsetData
|
|
|
2092
2211
|
*
|
|
2093
2212
|
* ℹ️ Setting `minHeight`, `minWidth`, or `tabPlacement` to `undefined` removes the tabset's override,
|
|
2094
2213
|
* so the corresponding Workspace prop is used; setting `maxHeight` or `maxWidth` to `undefined` removes the maximum.
|
|
2214
|
+
*
|
|
2215
|
+
* ℹ️ The position and size (`x`, `y`, `width`, and `height`) of a floating tabset can be changed too (and are ignored for other tabsets),
|
|
2216
|
+
* as can be its `collapsible` flag (which is ignored for floating tabsets).
|
|
2095
2217
|
*/
|
|
2096
2218
|
updateTabset: (tabsetId: string, changes: {
|
|
2097
2219
|
collapsible?: boolean | undefined;
|
|
2098
2220
|
data?: TabsetData;
|
|
2099
2221
|
disableDrag?: boolean | undefined;
|
|
2222
|
+
height?: number | undefined;
|
|
2100
2223
|
keepWhenEmpty?: boolean | undefined;
|
|
2101
2224
|
maxHeight?: string | undefined;
|
|
2102
2225
|
maxWidth?: string | undefined;
|
|
2103
2226
|
minHeight?: string | undefined;
|
|
2104
2227
|
minWidth?: string | undefined;
|
|
2105
2228
|
tabPlacement?: TabsetNode["tabPlacement"];
|
|
2229
|
+
width?: number | undefined;
|
|
2230
|
+
x?: number | undefined;
|
|
2231
|
+
y?: number | undefined;
|
|
2106
2232
|
}) => void;
|
|
2107
2233
|
}
|
|
2108
2234
|
|
|
@@ -2120,8 +2246,20 @@ export declare type WorkspaceModel<TabData = unknown, TabsetData = unknown> = {
|
|
|
2120
2246
|
* ℹ️ An empty workspace is a tabset with no tabs.
|
|
2121
2247
|
*/
|
|
2122
2248
|
root: WorkspaceNode<TabData, TabsetData>;
|
|
2249
|
+
/**
|
|
2250
|
+
* Tabsets that float above the layout, in stacking order (the last one is on top).
|
|
2251
|
+
*
|
|
2252
|
+
* ℹ️ Floating tabsets are created with the `floatTab` and `floatTabset` methods.
|
|
2253
|
+
* Dragging a floating tabset's header (or its `TabsetDragHandle`) moves it, its edges resize it, and pressing it brings it to the front.
|
|
2254
|
+
* Its tabs can be dragged into the layout (and other tabs can be dropped into it), and an emptied floating tabset is removed (unless it has the `keepWhenEmpty` flag).
|
|
2255
|
+
*
|
|
2256
|
+
* ℹ️ Tabset (and tab) ids are unique across the layout and its floating tabsets.
|
|
2257
|
+
*/
|
|
2258
|
+
floating?: FloatingTabsetNode<TabData, TabsetData>[] | undefined;
|
|
2123
2259
|
/**
|
|
2124
2260
|
* Id of the tabset that is maximized, if any.
|
|
2261
|
+
*
|
|
2262
|
+
* ℹ️ Floating tabsets can't be maximized; they're shown above the maximized tabset, and still accept dropped tabs.
|
|
2125
2263
|
*/
|
|
2126
2264
|
maximizedTabsetId?: string | undefined;
|
|
2127
2265
|
};
|
|
@@ -2129,7 +2267,8 @@ export declare type WorkspaceModel<TabData = unknown, TabsetData = unknown> = {
|
|
|
2129
2267
|
/**
|
|
2130
2268
|
* A `WorkspaceModel` whose splits and tabsets may omit their ids; accepted by the `defaultModel` prop and the `setModel` method.
|
|
2131
2269
|
*/
|
|
2132
|
-
export declare type WorkspaceModelInput<TabData = unknown, TabsetData = unknown> = Omit<WorkspaceModel<TabData, TabsetData>, "root"> & {
|
|
2270
|
+
export declare type WorkspaceModelInput<TabData = unknown, TabsetData = unknown> = Omit<WorkspaceModel<TabData, TabsetData>, "floating" | "root"> & {
|
|
2271
|
+
floating?: FloatingTabsetNodeInput<TabData, TabsetData>[] | undefined;
|
|
2133
2272
|
root: WorkspaceNodeInput<TabData, TabsetData>;
|
|
2134
2273
|
};
|
|
2135
2274
|
|
|
@@ -2154,7 +2293,7 @@ export declare type WorkspaceProps<TabData = unknown, TabsetData = unknown> = Om
|
|
|
2154
2293
|
* - `toolbar`: contains the content returned by `renderTabsetToolbar` (`data-tabset-toolbar`)
|
|
2155
2294
|
* - `tabPanels`: contains a tabset's tab content (`data-tab-panels`)
|
|
2156
2295
|
* - `tabContent`: the element each tab's content is rendered into (`data-tab-content`)
|
|
2157
|
-
* - `dropIndicator`: shows where a dragged tab will be dropped within a tabset's panels (`data-drop-indicator`)
|
|
2296
|
+
* - `dropIndicator`: shows where a dragged tab will be dropped within a tabset's panels, or at an edge of the workspace (`data-drop-indicator`)
|
|
2158
2297
|
* - `dragPreview`: follows the pointer while a tab or tabset is dragged (`data-drag-preview`)
|
|
2159
2298
|
*
|
|
2160
2299
|
* ℹ️ Elements expose their state as data attributes (e.g. `data-tab-selected`, or `data-tabset-dragging` while a tabset is dragged), which can be used for styling.
|
|
@@ -2163,7 +2302,8 @@ export declare type WorkspaceProps<TabData = unknown, TabsetData = unknown> = Om
|
|
|
2163
2302
|
*
|
|
2164
2303
|
* ℹ️ The drop indicator is the same element for the whole drag (rendered within the workspace's root element),
|
|
2165
2304
|
* so it can be animated between regions and tabsets (e.g. `transition: inset 250ms`).
|
|
2166
|
-
* Its `data-region` attribute is the region
|
|
2305
|
+
* Its `data-region` attribute is the region of a tabset's panels it covers, or its `data-edge` attribute is the edge of the workspace it's at;
|
|
2306
|
+
* while a tab isn't over either, it has neither and isn't shown (`opacity: 0`).
|
|
2167
2307
|
*
|
|
2168
2308
|
* ℹ️ Like the render props, this object is part of what tabsets re-render for;
|
|
2169
2309
|
* in large workspaces, define it outside of the component (or memoize it) rather than inline.
|
|
@@ -2200,6 +2340,10 @@ export declare type WorkspaceProps<TabData = unknown, TabsetData = unknown> = Om
|
|
|
2200
2340
|
*
|
|
2201
2341
|
* ℹ️ While a tabset is dragged, this function is called for each of its tabs (see `DisableDropArgs`),
|
|
2202
2342
|
* so restrictions on where tabs can be dropped apply to dragged tabsets too.
|
|
2343
|
+
*
|
|
2344
|
+
* ℹ️ Tabs can also be dropped at the edges of the workspace (beside all of the other tabsets), within a few pixels of the edges of its layout
|
|
2345
|
+
* (except over tabset headers, where the tab lists are) or within its root element's padding.
|
|
2346
|
+
* These targets have an `edge` rather than a `tabsetId`; `disableDrop={({ target }) => "edge" in target}` turns them off.
|
|
2203
2347
|
*/
|
|
2204
2348
|
disableDrop?: boolean | ((args: DisableDropArgs<TabData, TabsetData>) => boolean) | undefined;
|
|
2205
2349
|
/**
|
|
@@ -2247,14 +2391,14 @@ export declare type WorkspaceProps<TabData = unknown, TabsetData = unknown> = Om
|
|
|
2247
2391
|
* Uniquely identifies this workspace within an application.
|
|
2248
2392
|
* Falls back to `useId` when not provided.
|
|
2249
2393
|
*
|
|
2250
|
-
* ℹ️ This value will also be assigned to the `id` and `data-testid` attributes
|
|
2394
|
+
* ℹ️ This value will also be assigned to the `id` and `data-testid` attributes (an explicit `data-testid` prop will take precedence).
|
|
2251
2395
|
*/
|
|
2252
2396
|
id?: string | number | undefined;
|
|
2253
2397
|
/**
|
|
2254
2398
|
* Called after the model has changed (e.g. a tab was moved, selected, or closed, or a tabset was resized).
|
|
2255
2399
|
*
|
|
2256
|
-
* ℹ️ For changes caused by pointer events, this
|
|
2257
|
-
* This
|
|
2400
|
+
* ℹ️ For changes caused by pointer events, this callback is not called until the pointer has been released.
|
|
2401
|
+
* This callback is recommended for saving models to storage.
|
|
2258
2402
|
*/
|
|
2259
2403
|
onModelChanged?: (model: WorkspaceModel<TabData, TabsetData>, meta: WorkspaceChangedMeta) => void;
|
|
2260
2404
|
/**
|
|
@@ -2425,7 +2569,7 @@ export declare type WorkspaceProps<TabData = unknown, TabsetData = unknown> = Om
|
|
|
2425
2569
|
/**
|
|
2426
2570
|
* Exposes the imperative API (see `WorkspaceImperativeHandle`).
|
|
2427
2571
|
*
|
|
2428
|
-
* ℹ️ The `useWorkspaceRef` and `useWorkspaceCallbackRef` hooks are exported for convenience
|
|
2572
|
+
* ℹ️ The `useWorkspaceRef` and `useWorkspaceCallbackRef` hooks are exported for convenience in TypeScript projects.
|
|
2429
2573
|
*/
|
|
2430
2574
|
workspaceRef?: Ref<WorkspaceImperativeHandle<TabData, TabsetData> | null> | undefined;
|
|
2431
2575
|
};
|