react-resizable-panels 4.19.1 → 4.21.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.
@@ -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;
@@ -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
  *
@@ -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
  */
@@ -1345,6 +1408,30 @@ export declare type SplitNodeInput<TabData = unknown, TabsetData = unknown> = Om
1345
1408
  id?: string | undefined;
1346
1409
  };
1347
1410
 
1411
+ declare type StatefulButtonProps<State> = Omit<ButtonHTMLAttributes<HTMLButtonElement>, keyof StatefulProps<State>> & StatefulProps<State>;
1412
+
1413
+ /**
1414
+ * Props of the Workspace's buttons and handles (see `TabCloseButton`) whose values can depend on the component's state.
1415
+ */
1416
+ export declare type StatefulProps<State> = {
1417
+ /**
1418
+ * Content of the element, or a function that returns it (given the component's state).
1419
+ */
1420
+ children?: ValueOrFunction<ReactNode, State>;
1421
+ /**
1422
+ * Class name of the element, or a function that returns it (given the component's state).
1423
+ */
1424
+ className?: ValueOrFunction<string | undefined, State>;
1425
+ /**
1426
+ * Inline styles of the element, or a function that returns them (given the component's state).
1427
+ */
1428
+ style?: ValueOrFunction<CSSProperties | undefined, State>;
1429
+ /**
1430
+ * Tooltip of the element, or a function that returns it (given the component's state).
1431
+ */
1432
+ title?: ValueOrFunction<string | undefined, State>;
1433
+ };
1434
+
1348
1435
  /**
1349
1436
  * Closes the tab it is rendered within; render it within the element returned by the Workspace's `renderTab` prop:
1350
1437
  *
@@ -1361,6 +1448,12 @@ export declare type SplitNodeInput<TabData = unknown, TabsetData = unknown> = Om
1361
1448
  * Its content defaults to "×" (e.g. it can be replaced with an icon),
1362
1449
  * and its default `aria-label` is "Close" followed by the tab's title (or id).
1363
1450
  *
1451
+ * Its `children`, `className`, `style`, and `title` can also be functions of its state (see `TabCloseButtonState`):
1452
+ *
1453
+ * ```tsx
1454
+ * <TabCloseButton title={({ tabTitle }) => `Close ${tabTitle}`} />
1455
+ * ```
1456
+ *
1364
1457
  * To keep the tab open (e.g. to confirm unsaved changes first), call `event.preventDefault()` in an `onClick` handler:
1365
1458
  *
1366
1459
  * ```tsx
@@ -1380,9 +1473,19 @@ export declare const TabCloseButton: typeof TabCloseButtonComponent & {
1380
1473
  displayName: string;
1381
1474
  };
1382
1475
 
1383
- declare function TabCloseButtonComponent({ "aria-label": ariaLabel, children, onClick, ...rest }: TabCloseButtonProps): JSX.Element | null;
1476
+ declare function TabCloseButtonComponent({ "aria-label": ariaLabel, children, className, onClick, style, title, ...rest }: TabCloseButtonProps): JSX.Element | null;
1384
1477
 
1385
- export declare type TabCloseButtonProps = ButtonHTMLAttributes<HTMLButtonElement>;
1478
+ export declare type TabCloseButtonProps = StatefulButtonProps<TabCloseButtonState>;
1479
+
1480
+ /**
1481
+ * State of a `TabCloseButton`, passed to its function props (see `StatefulProps`).
1482
+ */
1483
+ export declare type TabCloseButtonState = {
1484
+ /**
1485
+ * The title of the tab the button closes (or its id, if it doesn't have one).
1486
+ */
1487
+ tabTitle: string;
1488
+ };
1386
1489
 
1387
1490
  /**
1388
1491
  * Edge (or center) of a tabset's content area.
@@ -1395,6 +1498,7 @@ export declare type TabDropRegion = "bottom" | "center" | "left" | "right" | "to
1395
1498
  * Where a dragged tab can be dropped:
1396
1499
  * - 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
1500
  * - Within a `region` of a tabset's content area; edges split the tabset, and the center adds the tab to it
1501
+ * - At an `edge` of the workspace, beside all of the other tabsets (filling the workspace's height or width)
1398
1502
  */
1399
1503
  export declare type TabDropTarget = {
1400
1504
  index: number;
@@ -1402,6 +1506,8 @@ export declare type TabDropTarget = {
1402
1506
  } | {
1403
1507
  region: TabDropRegion;
1404
1508
  tabsetId: string;
1509
+ } | {
1510
+ edge: WorkspaceDropEdge;
1405
1511
  };
1406
1512
 
1407
1513
  /**
@@ -1455,6 +1561,51 @@ export declare type TabRenderProps = Pick<HTMLAttributes<HTMLElement>, "aria-con
1455
1561
  [dataAttribute: `data-${string}`]: string | boolean | undefined;
1456
1562
  };
1457
1563
 
1564
+ /**
1565
+ * Collapses (or expands) the tabset it is rendered within; render it within the content returned by the Workspace's `renderTabsetToolbar` prop.
1566
+ * Its `children`, `className`, `style`, and `title` can be functions of its state (see `TabsetCollapseButtonState`), e.g. to show a different icon while the tabset is collapsed:
1567
+ *
1568
+ * ```tsx
1569
+ * renderTabsetToolbar={() => (
1570
+ * <TabsetCollapseButton title={({ isCollapsed }) => (isCollapsed ? "Expand" : "Collapse")}>
1571
+ * {({ isCollapsed }) => (isCollapsed ? "▸" : "▾")}
1572
+ * </TabsetCollapseButton>
1573
+ * )}
1574
+ * ```
1575
+ *
1576
+ * The button renders nothing if the tabset can't be collapsed (see `ParentTabsetState.isCollapsible`), or while it's maximized.
1577
+ * While the tabset is collapsed only because it doesn't fit (see `ParentTabsetState.isCollapsedToFit`), it can't be expanded, so the button has `aria-disabled="true"`.
1578
+ *
1579
+ * Its `aria-expanded` attribute reflects whether the tabset is expanded, and its `aria-controls` attribute refers to the selected tab's panel;
1580
+ * its default `aria-label` ("Collapse tabset") doesn't change, since `aria-expanded` describes the state.
1581
+ *
1582
+ * To keep the tabset as it is, call `event.preventDefault()` in an `onClick` handler.
1583
+ *
1584
+ * ℹ️ Clicking a tab of a collapsed tabset also expands it.
1585
+ */
1586
+ export declare const TabsetCollapseButton: typeof TabsetCollapseButtonComponent & {
1587
+ displayName: string;
1588
+ };
1589
+
1590
+ declare function TabsetCollapseButtonComponent({ "aria-label": ariaLabel, children, className, onClick, style, title, ...rest }: TabsetCollapseButtonProps): JSX.Element | null;
1591
+
1592
+ export declare type TabsetCollapseButtonProps = StatefulButtonProps<TabsetCollapseButtonState>;
1593
+
1594
+ /**
1595
+ * State of a `TabsetCollapseButton`, passed to its function props (see `StatefulProps`).
1596
+ */
1597
+ export declare type TabsetCollapseButtonState = {
1598
+ /**
1599
+ * The tabset is collapsed to just its header (see `ParentTabsetState.isCollapsed`).
1600
+ */
1601
+ isCollapsed: boolean;
1602
+ /**
1603
+ * The tabset is collapsed only because it doesn't fit, so it can't be expanded until it does (see `ParentTabsetState.isCollapsedToFit`);
1604
+ * the button is disabled (with `aria-disabled`) until then.
1605
+ */
1606
+ isCollapsedToFit: boolean;
1607
+ };
1608
+
1458
1609
  /**
1459
1610
  * Drags the tabset it is rendered within; render it within the content returned by the Workspace's `renderTabsetToolbar` prop:
1460
1611
  *
@@ -1470,14 +1621,68 @@ export declare type TabRenderProps = Pick<HTMLAttributes<HTMLElement>, "aria-con
1470
1621
  * this component also sets `touch-action: none`, so that it can be dragged by touch.
1471
1622
  *
1472
1623
  * The handle has a `data-disabled` attribute when the tabset can't be dragged (see `useParentTabsetState`), e.g. to hide it.
1624
+ * Its `children`, `className`, `style`, and `title` can also be functions of its state (see `TabsetDragHandleState`):
1625
+ *
1626
+ * ```tsx
1627
+ * <TabsetDragHandle title={({ isDisabled }) => (isDisabled ? undefined : "Drag tabset")}>
1628
+ * ⠿
1629
+ * </TabsetDragHandle>
1630
+ * ```
1473
1631
  */
1474
1632
  export declare const TabsetDragHandle: typeof TabsetDragHandleComponent & {
1475
1633
  displayName: string;
1476
1634
  };
1477
1635
 
1478
- declare function TabsetDragHandleComponent({ style, ...rest }: TabsetDragHandleProps): JSX.Element;
1636
+ declare function TabsetDragHandleComponent({ children, className, style, title, ...rest }: TabsetDragHandleProps): JSX.Element;
1479
1637
 
1480
- export declare type TabsetDragHandleProps = HTMLAttributes<HTMLDivElement>;
1638
+ export declare type TabsetDragHandleProps = Omit<HTMLAttributes<HTMLDivElement>, keyof StatefulProps<TabsetDragHandleState>> & StatefulProps<TabsetDragHandleState>;
1639
+
1640
+ /**
1641
+ * State of a `TabsetDragHandle`, passed to its function props (see `StatefulProps`).
1642
+ */
1643
+ export declare type TabsetDragHandleState = {
1644
+ /**
1645
+ * The tabset can't be dragged (see `ParentTabsetState.isDragDisabled`).
1646
+ */
1647
+ isDisabled: boolean;
1648
+ };
1649
+
1650
+ /**
1651
+ * Maximizes (or restores) the tabset it is rendered within; render it within the content returned by the Workspace's `renderTabsetToolbar` prop.
1652
+ * Its `children`, `className`, `style`, and `title` can be functions of its state (see `TabsetMaximizeButtonState`), e.g. to show a different icon while the tabset is maximized:
1653
+ *
1654
+ * ```tsx
1655
+ * renderTabsetToolbar={() => (
1656
+ * <TabsetMaximizeButton title={({ isMaximized }) => (isMaximized ? "Restore" : "Maximize")}>
1657
+ * {({ isMaximized }) => (isMaximized ? "Restore" : "Maximize")}
1658
+ * </TabsetMaximizeButton>
1659
+ * )}
1660
+ * ```
1661
+ *
1662
+ * The button renders nothing for the only tabset in a workspace (see `ParentTabsetState.isRoot`) and for floating tabsets, which can't be maximized.
1663
+ *
1664
+ * Its `aria-pressed` attribute reflects whether the tabset is maximized;
1665
+ * its default `aria-label` ("Maximize tabset") doesn't change, since `aria-pressed` describes the state.
1666
+ *
1667
+ * To keep the tabset as it is, call `event.preventDefault()` in an `onClick` handler.
1668
+ */
1669
+ export declare const TabsetMaximizeButton: typeof TabsetMaximizeButtonComponent & {
1670
+ displayName: string;
1671
+ };
1672
+
1673
+ declare function TabsetMaximizeButtonComponent({ "aria-label": ariaLabel, children, className, onClick, style, title, ...rest }: TabsetMaximizeButtonProps): JSX.Element | null;
1674
+
1675
+ export declare type TabsetMaximizeButtonProps = StatefulButtonProps<TabsetMaximizeButtonState>;
1676
+
1677
+ /**
1678
+ * State of a `TabsetMaximizeButton`, passed to its function props (see `StatefulProps`).
1679
+ */
1680
+ export declare type TabsetMaximizeButtonState = {
1681
+ /**
1682
+ * The tabset is maximized (see `ParentTabsetState.isMaximized`).
1683
+ */
1684
+ isMaximized: boolean;
1685
+ };
1481
1686
 
1482
1687
  /**
1483
1688
  * A set of tabs, only one of which is shown at a time.
@@ -1537,6 +1742,8 @@ export declare type TabsetNode<TabData = unknown, TabsetData = unknown> = {
1537
1742
  *
1538
1743
  * ⚠️ 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
1744
  * otherwise it's ignored (e.g. if every tabset in a split has a maximum, or the tabset fills the workspace).
1745
+ *
1746
+ * ℹ️ Maximums don't apply to floating tabsets, which can be resized to any size larger than their minimums.
1540
1747
  */
1541
1748
  maxWidth?: string | undefined;
1542
1749
  /**
@@ -1549,6 +1756,8 @@ export declare type TabsetNode<TabData = unknown, TabsetData = unknown> = {
1549
1756
  *
1550
1757
  * ⚠️ 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
1758
  * otherwise it's ignored (e.g. if every tabset in a split has a maximum, or the tabset fills the workspace).
1759
+ *
1760
+ * ℹ️ Maximums don't apply to floating tabsets, which can be resized to any size larger than their minimums.
1552
1761
  */
1553
1762
  maxHeight?: string | undefined;
1554
1763
  /**
@@ -1593,6 +1802,8 @@ export declare type TabsetNode<TabData = unknown, TabsetData = unknown> = {
1593
1802
  *
1594
1803
  * ℹ️ 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
1804
  * this doesn't change its `tabPlacement`.
1805
+ *
1806
+ * ℹ️ A floating tabset can be collapsed too (without the `collapsible` flag, which doesn't apply to it; see `FloatingTabsetNode`).
1596
1807
  */
1597
1808
  collapsed?: boolean | undefined;
1598
1809
  /**
@@ -1875,6 +2086,11 @@ export declare function useWorkspaceCallbackRef<TabData = unknown, TabsetData =
1875
2086
  */
1876
2087
  export declare function useWorkspaceRef<TabData = unknown, TabsetData = unknown>(): RefObject<WorkspaceImperativeHandle<TabData, TabsetData> | null>;
1877
2088
 
2089
+ /**
2090
+ * A prop that's either a value or a function that returns one, given the state of the component (e.g. whether a tabset is collapsed).
2091
+ */
2092
+ export declare type ValueOrFunction<Value, State> = Value | ((state: State) => Value);
2093
+
1878
2094
  /**
1879
2095
  * A Workspace arranges tabsets that users can rearrange by dragging tabs:
1880
2096
  * between tabsets, within a tabset's list of tabs, or onto the edge of a tabset to split it.
@@ -1917,6 +2133,9 @@ export declare type WorkspaceChangedMeta = {
1917
2133
  * ℹ️ A tab (or tabset) dragged to another workspace (see the `dragGroup` prop) is reported as `"transfer"` by both workspaces:
1918
2134
  * the one it was dropped into (which added it) and the one it was dragged from (which removed it).
1919
2135
  *
2136
+ * ℹ️ 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,
2137
+ * and `"raise"` when they're brought to the front (e.g. by pressing one that's behind another).
2138
+ *
1920
2139
  * ⚠️ New reasons may be added in later versions, so code that switches on this value should handle unrecognized values.
1921
2140
  */
1922
2141
  reason: WorkspaceChangeReason;
@@ -1927,7 +2146,7 @@ export declare type WorkspaceChangedMeta = {
1927
2146
  *
1928
2147
  * ⚠️ New reasons may be added in later versions.
1929
2148
  */
1930
- export declare type WorkspaceChangeReason = "add" | "close" | "collapse" | "expand" | "maximize" | "move" | "resize" | "restore" | "select" | "set-model" | "tear-off" | "transfer" | "update";
2149
+ export declare type WorkspaceChangeReason = "add" | "close" | "collapse" | "expand" | "float" | "maximize" | "move" | "raise" | "resize" | "restore" | "select" | "set-model" | "tear-off" | "transfer" | "update";
1931
2150
 
1932
2151
  /**
1933
2152
  * CSS class names for the elements a Workspace renders (see the Workspace's `classNames` prop).
@@ -1935,6 +2154,17 @@ export declare type WorkspaceChangeReason = "add" | "close" | "collapse" | "expa
1935
2154
  export declare type WorkspaceClassNames = {
1936
2155
  dragPreview?: string | undefined;
1937
2156
  dropIndicator?: string | undefined;
2157
+ /**
2158
+ * 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.
2159
+ */
2160
+ floatingTabset?: string | undefined;
2161
+ /**
2162
+ * Each of the handles along the edges (and at the corners) of a floating tabset that resize it,
2163
+ * with a `data-floating-resize-handle` attribute naming its edge (e.g. "bottom" or "bottom-right").
2164
+ *
2165
+ * ℹ️ The handles are positioned (and given resize cursors) by the workspace, but they're transparent.
2166
+ */
2167
+ floatingResizeHandle?: string | undefined;
1938
2168
  header?: string | undefined;
1939
2169
  /**
1940
2170
  * Each split (a Group with `data-split` and `data-split-id` attributes); for example, its `gap` adds space between tabsets.
@@ -1952,6 +2182,13 @@ export declare type WorkspaceClassNames = {
1952
2182
 
1953
2183
  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
2184
 
2185
+ /**
2186
+ * Edge of the workspace.
2187
+ *
2188
+ * ℹ️ 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`.
2189
+ */
2190
+ export declare type WorkspaceDropEdge = "bottom" | "left" | "right" | "top";
2191
+
1955
2192
  /**
1956
2193
  * Imperative Workspace API.
1957
2194
  *
@@ -1990,7 +2227,7 @@ export declare interface WorkspaceImperativeHandle<TabData = unknown, TabsetData
1990
2227
  /**
1991
2228
  * Collapse a tabset to just its header.
1992
2229
  *
1993
- * ℹ️ This has no effect unless the tabset has the `collapsible` flag;
2230
+ * ℹ️ This has no effect unless the tabset has the `collapsible` flag (or is floating; see `FloatingTabsetNode`);
1994
2231
  * the only tabset in a workspace, and tabsets whose siblings are all collapsed, can't be collapsed.
1995
2232
  */
1996
2233
  collapseTabset: (tabsetId: string) => void;
@@ -2002,6 +2239,25 @@ export declare interface WorkspaceImperativeHandle<TabData = unknown, TabsetData
2002
2239
  * ℹ️ This has no effect on a tabset that's only collapsed to fit, which is expanded once it fits (see `TabsetNode.collapsible`).
2003
2240
  */
2004
2241
  expandTabset: (tabsetId: string) => void;
2242
+ /**
2243
+ * Move a tab into a new floating tabset (see `WorkspaceModel.floating`), on top of any other floating tabsets.
2244
+ *
2245
+ * ℹ️ 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
2246
+ * (and moved, if needed, to fit within the workspace).
2247
+ *
2248
+ * ℹ️ This has no effect on the only tab of a floating tabset (unless the tabset has the `keepWhenEmpty` flag).
2249
+ */
2250
+ floatTab: (tabId: string, rect?: Partial<FloatingTabsetRect>) => void;
2251
+ /**
2252
+ * Move a tabset out of the layout, to float above it (see `WorkspaceModel.floating`), on top of any other floating tabsets.
2253
+ *
2254
+ * ℹ️ Parts of the position and size that aren't specified default to those of the tabset, offset slightly down and to the right
2255
+ * (and moved, if needed, to fit within the workspace).
2256
+ *
2257
+ * ℹ️ This has no effect on the root tabset (which fills the workspace) or a tabset that's already floating.
2258
+ * A maximized tabset is restored first.
2259
+ */
2260
+ floatTabset: (tabsetId: string, rect?: Partial<FloatingTabsetRect>) => void;
2005
2261
  /**
2006
2262
  * Id of the tabset the user most recently interacted with (by pointer or focus).
2007
2263
  */
@@ -2030,22 +2286,29 @@ export declare interface WorkspaceImperativeHandle<TabData = unknown, TabsetData
2030
2286
  /**
2031
2287
  * Maximize a tabset, so that it covers the rest of the workspace.
2032
2288
  *
2033
- * ℹ️ This has no effect on the only tabset in a workspace (the root), which already fills it.
2289
+ * ℹ️ This has no effect on the only tabset in a workspace (the root), which already fills it, or on a floating tabset.
2034
2290
  * A maximized tabset is restored if it becomes the only one (e.g. after the other tabsets are closed).
2035
2291
  */
2036
2292
  maximizeTabset: (tabsetId: string) => void;
2037
2293
  /**
2038
- * Move a tab to a position within a tabset's tab list, or to a region of a tabset's content area.
2294
+ * Move a tab to a position within a tabset's tab list, to a region of a tabset's content area,
2295
+ * or to an `edge` of the workspace (in a new tabset beside all of the other tabsets).
2039
2296
  *
2040
- * ℹ️ The `"left"` and `"right"` regions are sides of the screen (so they're mirrored in right-to-left layouts).
2297
+ * ℹ️ The `"left"` and `"right"` regions (and edges) are sides of the screen (so they're mirrored in right-to-left layouts).
2298
+ *
2299
+ * ℹ️ 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
2300
  */
2042
2301
  moveTab: (tabId: string, target: TabDropTarget) => void;
2043
2302
  /**
2044
2303
  * Move a tabset beside another tabset (by dropping it onto a region at the edge of that tabset's content area),
2304
+ * or beside all of the other tabsets (at an `edge` of the workspace),
2045
2305
  * 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).
2306
+ * The `"left"` and `"right"` regions (and edges) are sides of the screen (so they're mirrored in right-to-left layouts).
2047
2307
  *
2048
2308
  * ℹ️ When its tabs are moved, the emptied tabset is removed (unless it has the `keepWhenEmpty` flag).
2309
+ *
2310
+ * ℹ️ 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.
2311
+ * 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
2312
  */
2050
2313
  moveTabset: (tabsetId: string, target: TabDropTarget) => void;
2051
2314
  /**
@@ -2092,17 +2355,24 @@ export declare interface WorkspaceImperativeHandle<TabData = unknown, TabsetData
2092
2355
  *
2093
2356
  * ℹ️ Setting `minHeight`, `minWidth`, or `tabPlacement` to `undefined` removes the tabset's override,
2094
2357
  * so the corresponding Workspace prop is used; setting `maxHeight` or `maxWidth` to `undefined` removes the maximum.
2358
+ *
2359
+ * ℹ️ The position and size (`x`, `y`, `width`, and `height`) of a floating tabset can be changed too (and are ignored for other tabsets),
2360
+ * as can be its `collapsible` flag (which is ignored for floating tabsets).
2095
2361
  */
2096
2362
  updateTabset: (tabsetId: string, changes: {
2097
2363
  collapsible?: boolean | undefined;
2098
2364
  data?: TabsetData;
2099
2365
  disableDrag?: boolean | undefined;
2366
+ height?: number | undefined;
2100
2367
  keepWhenEmpty?: boolean | undefined;
2101
2368
  maxHeight?: string | undefined;
2102
2369
  maxWidth?: string | undefined;
2103
2370
  minHeight?: string | undefined;
2104
2371
  minWidth?: string | undefined;
2105
2372
  tabPlacement?: TabsetNode["tabPlacement"];
2373
+ width?: number | undefined;
2374
+ x?: number | undefined;
2375
+ y?: number | undefined;
2106
2376
  }) => void;
2107
2377
  }
2108
2378
 
@@ -2120,8 +2390,20 @@ export declare type WorkspaceModel<TabData = unknown, TabsetData = unknown> = {
2120
2390
  * ℹ️ An empty workspace is a tabset with no tabs.
2121
2391
  */
2122
2392
  root: WorkspaceNode<TabData, TabsetData>;
2393
+ /**
2394
+ * Tabsets that float above the layout, in stacking order (the last one is on top).
2395
+ *
2396
+ * ℹ️ Floating tabsets are created with the `floatTab` and `floatTabset` methods.
2397
+ * Dragging a floating tabset's header (or its `TabsetDragHandle`) moves it, its edges resize it, and pressing it brings it to the front.
2398
+ * 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).
2399
+ *
2400
+ * ℹ️ Tabset (and tab) ids are unique across the layout and its floating tabsets.
2401
+ */
2402
+ floating?: FloatingTabsetNode<TabData, TabsetData>[] | undefined;
2123
2403
  /**
2124
2404
  * Id of the tabset that is maximized, if any.
2405
+ *
2406
+ * ℹ️ Floating tabsets can't be maximized; they're shown above the maximized tabset, and still accept dropped tabs.
2125
2407
  */
2126
2408
  maximizedTabsetId?: string | undefined;
2127
2409
  };
@@ -2129,7 +2411,8 @@ export declare type WorkspaceModel<TabData = unknown, TabsetData = unknown> = {
2129
2411
  /**
2130
2412
  * A `WorkspaceModel` whose splits and tabsets may omit their ids; accepted by the `defaultModel` prop and the `setModel` method.
2131
2413
  */
2132
- export declare type WorkspaceModelInput<TabData = unknown, TabsetData = unknown> = Omit<WorkspaceModel<TabData, TabsetData>, "root"> & {
2414
+ export declare type WorkspaceModelInput<TabData = unknown, TabsetData = unknown> = Omit<WorkspaceModel<TabData, TabsetData>, "floating" | "root"> & {
2415
+ floating?: FloatingTabsetNodeInput<TabData, TabsetData>[] | undefined;
2133
2416
  root: WorkspaceNodeInput<TabData, TabsetData>;
2134
2417
  };
2135
2418
 
@@ -2154,7 +2437,7 @@ export declare type WorkspaceProps<TabData = unknown, TabsetData = unknown> = Om
2154
2437
  * - `toolbar`: contains the content returned by `renderTabsetToolbar` (`data-tabset-toolbar`)
2155
2438
  * - `tabPanels`: contains a tabset's tab content (`data-tab-panels`)
2156
2439
  * - `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`)
2440
+ * - `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
2441
  * - `dragPreview`: follows the pointer while a tab or tabset is dragged (`data-drag-preview`)
2159
2442
  *
2160
2443
  * ℹ️ 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 +2446,8 @@ export declare type WorkspaceProps<TabData = unknown, TabsetData = unknown> = Om
2163
2446
  *
2164
2447
  * ℹ️ The drop indicator is the same element for the whole drag (rendered within the workspace's root element),
2165
2448
  * so it can be animated between regions and tabsets (e.g. `transition: inset 250ms`).
2166
- * Its `data-region` attribute is the region it covers; while a tab isn't over any tabset's panels, it has none and isn't shown (`opacity: 0`).
2449
+ * 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;
2450
+ * while a tab isn't over either, it has neither and isn't shown (`opacity: 0`).
2167
2451
  *
2168
2452
  * ℹ️ Like the render props, this object is part of what tabsets re-render for;
2169
2453
  * in large workspaces, define it outside of the component (or memoize it) rather than inline.
@@ -2200,6 +2484,10 @@ export declare type WorkspaceProps<TabData = unknown, TabsetData = unknown> = Om
2200
2484
  *
2201
2485
  * ℹ️ While a tabset is dragged, this function is called for each of its tabs (see `DisableDropArgs`),
2202
2486
  * so restrictions on where tabs can be dropped apply to dragged tabsets too.
2487
+ *
2488
+ * ℹ️ 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
2489
+ * (except over tabset headers, where the tab lists are) or within its root element's padding.
2490
+ * These targets have an `edge` rather than a `tabsetId`; `disableDrop={({ target }) => "edge" in target}` turns them off.
2203
2491
  */
2204
2492
  disableDrop?: boolean | ((args: DisableDropArgs<TabData, TabsetData>) => boolean) | undefined;
2205
2493
  /**