react-resizable-panels 4.16.1 → 4.17.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.
package/README.md
CHANGED
|
@@ -914,9 +914,10 @@ Falls back to <code>useId</code> when not provided.</p>
|
|
|
914
914
|
<li><code>tabPanels</code>: contains a tabset's tab content (<code>data-tab-panels</code>)</li>
|
|
915
915
|
<li><code>tabContent</code>: the element each tab's content is rendered into (<code>data-tab-content</code>)</li>
|
|
916
916
|
<li><code>dropIndicator</code>: shows where a dragged tab will be dropped within a tabset's panels (<code>data-drop-indicator</code>)</li>
|
|
917
|
-
<li><code>dragPreview</code>: follows the pointer while a tab is dragged (<code>data-drag-preview</code>)</li>
|
|
917
|
+
<li><code>dragPreview</code>: follows the pointer while a tab or tabset is dragged (<code>data-drag-preview</code>)</li>
|
|
918
918
|
</ul>
|
|
919
|
-
<p>ℹ️ Elements expose their state as data attributes (e.g. <code>data-tab-selected</code>), which can be used for styling.
|
|
919
|
+
<p>ℹ️ Elements expose their state as data attributes (e.g. <code>data-tab-selected</code>, or <code>data-tabset-dragging</code> while a tabset is dragged), which can be used for styling.
|
|
920
|
+
Elements within a collapsed tabset have a <code>data-tabset-collapsed</code> attribute.
|
|
920
921
|
Elements within a tabset also have a <code>data-tab-placement</code> attribute (see <code>tabPlacement</code>).</p>
|
|
921
922
|
<p>ℹ️ Like the render props, this object is part of what tabsets re-render for;
|
|
922
923
|
in large workspaces, define it outside of the component (or memoize it) rather than inline.</p>
|
|
@@ -931,9 +932,11 @@ Selecting tabs and maximizing tabsets still work.</p>
|
|
|
931
932
|
</tr>
|
|
932
933
|
<tr>
|
|
933
934
|
<td>disableDrop</td>
|
|
934
|
-
<td><p>Prevents tabs from being dropped onto some (or all) targets.</p>
|
|
935
|
+
<td><p>Prevents tabs (and tabsets) from being dropped onto some (or all) targets.</p>
|
|
935
936
|
<p>Functions are called when the target under the pointer changes;
|
|
936
937
|
returning <code>true</code> rejects the target.</p>
|
|
938
|
+
<p>ℹ️ While a tabset is dragged, this function is called for each of its tabs (see <code>DisableDropArgs</code>),
|
|
939
|
+
so restrictions on where tabs can be dropped apply to dragged tabsets too.</p>
|
|
937
940
|
</td>
|
|
938
941
|
</tr>
|
|
939
942
|
<tr>
|
|
@@ -967,6 +970,13 @@ This method is recommended when saving models to some storage api.</p>
|
|
|
967
970
|
<td>renderDragPreview</td>
|
|
968
971
|
<td><p>Content of the element that follows the pointer while a tab is being dragged.
|
|
969
972
|
Defaults to the tab's title (or id).</p>
|
|
973
|
+
</td>
|
|
974
|
+
</tr>
|
|
975
|
+
<tr>
|
|
976
|
+
<td>renderTabsetDragPreview</td>
|
|
977
|
+
<td><p>Content of the element that follows the pointer while a whole tabset is being dragged.
|
|
978
|
+
Defaults to the preview of its selected tab (see <code>renderDragPreview</code>), or the tabset's id if it has no tabs.</p>
|
|
979
|
+
<p>ℹ️ The element has a <code>data-drag-type</code> attribute: <code>"tabset"</code> while a tabset is dragged, and <code>"tab"</code> while a tab is.</p>
|
|
970
980
|
</td>
|
|
971
981
|
</tr>
|
|
972
982
|
<tr>
|
|
@@ -1041,6 +1051,18 @@ so this is best suited to content that is cheap to mount and benefits from being
|
|
|
1041
1051
|
this determines how a dropped tab's position is found and which arrow keys move focus between tabs.</p>
|
|
1042
1052
|
<p>ℹ️ Elements within a tabset have a <code>data-tab-placement</code> attribute, which can be used for styling (e.g. rotating tabs on the left or right).</p>
|
|
1043
1053
|
<p>ℹ️ Tabsets can override this with the <code>tabPlacement</code> field of their model node.</p>
|
|
1054
|
+
</td>
|
|
1055
|
+
</tr>
|
|
1056
|
+
<tr>
|
|
1057
|
+
<td>tabRemovalSelectionBehavior</td>
|
|
1058
|
+
<td><p>Which tab is selected when a tabset's selected tab is removed (closed, or dragged to another tabset):</p>
|
|
1059
|
+
<ul>
|
|
1060
|
+
<li><code>"adjacent"</code>: the tab after it (or before it, if it was the last tab)</li>
|
|
1061
|
+
<li><code>"recent"</code>: the tabset's most recently selected tab (like an IDE's editor groups),
|
|
1062
|
+
falling back to <code>"adjacent"</code> if none of its other tabs has been selected</li>
|
|
1063
|
+
</ul>
|
|
1064
|
+
<p>ℹ️ In <code>"recent"</code> mode, each tabset's recently selected tabs are saved in the model (see <code>TabsetNode.recentTabIds</code>),
|
|
1065
|
+
so they're restored with the rest of the layout.</p>
|
|
1044
1066
|
</td>
|
|
1045
1067
|
</tr>
|
|
1046
1068
|
<tr>
|
|
@@ -1085,13 +1107,14 @@ Closes the tab it is rendered within; render it within the element returned by t
|
|
|
1085
1107
|
renderTab={(tab, props) => (
|
|
1086
1108
|
<div {...props}>
|
|
1087
1109
|
{tab.title}
|
|
1088
|
-
<TabCloseButton
|
|
1110
|
+
<TabCloseButton>×</TabCloseButton>
|
|
1089
1111
|
</div>
|
|
1090
1112
|
)}
|
|
1091
1113
|
```
|
|
1092
1114
|
|
|
1093
1115
|
The button renders nothing if closing is disabled (by the tab's `disableClose` flag or the Workspace's `disabled` prop).
|
|
1094
|
-
Its
|
|
1116
|
+
Its content defaults to "×" (e.g. it can be replaced with an icon),
|
|
1117
|
+
and its default `aria-label` is "Close" followed by the tab's title (or id).
|
|
1095
1118
|
|
|
1096
1119
|
To keep the tab open (e.g. to confirm unsaved changes first), call `event.preventDefault()` in an `onClick` handler:
|
|
1097
1120
|
|