react-resizable-panels 4.18.1 → 4.19.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
|
@@ -919,6 +919,9 @@ Falls back to <code>useId</code> when not provided.</p>
|
|
|
919
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
920
|
Elements within a collapsed tabset have a <code>data-tabset-collapsed</code> attribute.
|
|
921
921
|
Elements within a tabset also have a <code>data-tab-placement</code> attribute (see <code>tabPlacement</code>).</p>
|
|
922
|
+
<p>ℹ️ The drop indicator is the same element for the whole drag (rendered within the workspace's root element),
|
|
923
|
+
so it can be animated between regions and tabsets (e.g. <code>transition: inset 250ms</code>).
|
|
924
|
+
Its <code>data-region</code> attribute is the region it covers; while a tab isn't over any tabset's panels, it has none and isn't shown (<code>opacity: 0</code>).</p>
|
|
922
925
|
<p>ℹ️ Like the render props, this object is part of what tabsets re-render for;
|
|
923
926
|
in large workspaces, define it outside of the component (or memoize it) rather than inline.</p>
|
|
924
927
|
</td>
|
|
@@ -928,6 +931,14 @@ in large workspaces, define it outside of the component (or memoize it) rather t
|
|
|
928
931
|
<td><p>Locks the arrangement: tabs cannot be resized, dragged, dropped, or closed by the user.
|
|
929
932
|
Selecting tabs and maximizing tabsets still work.</p>
|
|
930
933
|
<p>ℹ️ This prop overrides the <code>disableClose</code> and <code>disableDrag</code> flags of individual tabs.</p>
|
|
934
|
+
</td>
|
|
935
|
+
</tr>
|
|
936
|
+
<tr>
|
|
937
|
+
<td>disableDragBetweenApps</td>
|
|
938
|
+
<td><p>Keeps drags between workspaces (see <code>dragGroup</code>) within this copy of the application:
|
|
939
|
+
tabs dragged from this workspace can't be dropped into other copies of the application (e.g. the application loaded in another browser window or tab), and tabs dragged from other copies can't be dropped into this workspace.
|
|
940
|
+
Workspaces in popout windows rendered by this copy of the application (with portals) are still part of the group.</p>
|
|
941
|
+
<p>Defaults to <code>false</code>, so that workspaces with the same <code>dragGroup</code> in other copies of the application from the same origin can exchange tabs.</p>
|
|
931
942
|
</td>
|
|
932
943
|
</tr>
|
|
933
944
|
<tr>
|
|
@@ -937,6 +948,23 @@ Selecting tabs and maximizing tabsets still work.</p>
|
|
|
937
948
|
returning <code>true</code> rejects the target.</p>
|
|
938
949
|
<p>ℹ️ While a tabset is dragged, this function is called for each of its tabs (see <code>DisableDropArgs</code>),
|
|
939
950
|
so restrictions on where tabs can be dropped apply to dragged tabsets too.</p>
|
|
951
|
+
</td>
|
|
952
|
+
</tr>
|
|
953
|
+
<tr>
|
|
954
|
+
<td>dragGroup</td>
|
|
955
|
+
<td><p>Lets tabs (and tabsets) be dragged between workspaces with the same <code>dragGroup</code>,
|
|
956
|
+
including workspaces in popout windows (opened by the application and rendered into with a portal)
|
|
957
|
+
and in other copies of the application from the same origin, e.g. the application loaded in another browser window or tab (see <code>disableDragBetweenApps</code>).
|
|
958
|
+
Dropping one into another workspace moves it there, keeping its id and data;
|
|
959
|
+
both workspaces report the change to <code>onModelChanged</code> with the <code>"transfer"</code> reason.</p>
|
|
960
|
+
<p>Mouse drags use the browser's drag and drop when this prop is set, since pointer events can't follow the pointer into another window.
|
|
961
|
+
Touch drags still use pointer events, so they can't leave the window.</p>
|
|
962
|
+
<p>ℹ️ Tab ids must be unique within the group; a tab can't be dropped into a workspace that already has a tab with its id (and a tabset with the <code>keepWhenEmpty</code> flag can't be dragged to another workspace).
|
|
963
|
+
A tab dragged to another workspace is rendered by that workspace, so its content is mounted again.</p>
|
|
964
|
+
<p>⚠️ A tab dragged to another copy of the application is sent there with the structured clone algorithm (like <code>postMessage</code>), so its data must be cloneable (e.g. no functions);
|
|
965
|
+
tabs whose data can't be cloned (and tabsets containing them) can only be dragged within their copy of the application.
|
|
966
|
+
Copies loaded at different times may be running different versions of the application, so the other copy may need to handle tab data it doesn't recognize.</p>
|
|
967
|
+
<p>⚠️ Tabs (and tabsets) can still be torn off (see <code>onTearOff</code>), but some browsers (e.g. Safari) block popup windows opened at the end of a drag that uses the browser's drag and drop.</p>
|
|
940
968
|
</td>
|
|
941
969
|
</tr>
|
|
942
970
|
<tr>
|
|
@@ -964,19 +992,35 @@ iframes are reloaded, playing media is paused, and focused elements are blurred.
|
|
|
964
992
|
<td><p>Called after the model has changed (e.g. a tab was moved, selected, or closed, or a tabset was resized).</p>
|
|
965
993
|
<p>ℹ️ For changes caused by pointer events, this method is not called until the pointer has been released.
|
|
966
994
|
This method is recommended when saving models to some storage api.</p>
|
|
995
|
+
</td>
|
|
996
|
+
</tr>
|
|
997
|
+
<tr>
|
|
998
|
+
<td>onTearOff</td>
|
|
999
|
+
<td><p>Called when a tab (or a whole tabset) is dropped outside of the window, e.g. to open it in a popup window.
|
|
1000
|
+
Return <code>true</code> to accept it, which removes it from this workspace (reported to <code>onModelChanged</code> with the <code>"tear-off"</code> reason);
|
|
1001
|
+
otherwise nothing changes.</p>
|
|
1002
|
+
<p>Tabs and tabsets can only be torn off if they could be dragged, and tabsets with the <code>keepWhenEmpty</code> flag can't be torn off.
|
|
1003
|
+
Without this prop, dropping a tab outside of the window does nothing.</p>
|
|
1004
|
+
<p>⚠️ The Workspace can't tell whether the application showed the tab, so check whether <code>window.open</code> returned <code>null</code> (because the popup was blocked)
|
|
1005
|
+
and return <code>false</code> then to keep the tab; returning <code>true</code> removes it even if nothing shows it.</p>
|
|
1006
|
+
<p>ℹ️ This is called while the release of the pointer is being handled (which browsers treat as user input), so a popup can be opened from it.
|
|
1007
|
+
With the <code>dragGroup</code> prop, a tab is torn off when it's dropped outside of every window in the group; the end of those drags isn't treated as user input,
|
|
1008
|
+
so browsers block popups opened then unless the drag started a few seconds earlier at most (and Safari blocks them always).</p>
|
|
967
1009
|
</td>
|
|
968
1010
|
</tr>
|
|
969
1011
|
<tr>
|
|
970
1012
|
<td>renderDragPreview</td>
|
|
971
1013
|
<td><p>Content of the element that follows the pointer while a tab is being dragged.
|
|
972
1014
|
Defaults to the tab's title (or id).</p>
|
|
1015
|
+
<p>ℹ️ The element has a <code>data-tear-off</code> attribute while releasing the pointer would tear off the tab (see <code>onTearOff</code>).</p>
|
|
973
1016
|
</td>
|
|
974
1017
|
</tr>
|
|
975
1018
|
<tr>
|
|
976
1019
|
<td>renderTabsetDragPreview</td>
|
|
977
1020
|
<td><p>Content of the element that follows the pointer while a whole tabset is being dragged.
|
|
978
1021
|
Defaults to the title (or id) of its selected tab followed by the number of other tabs being dragged (e.g. "One (+2)"), or the selected tab's <code>renderDragPreview</code> when that prop is set, 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
|
|
1022
|
+
<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.
|
|
1023
|
+
It also has a <code>data-tear-off</code> attribute while releasing the pointer would tear off the tabset (see <code>onTearOff</code>).</p>
|
|
980
1024
|
</td>
|
|
981
1025
|
</tr>
|
|
982
1026
|
<tr>
|