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.
package/README.md
CHANGED
|
@@ -913,7 +913,7 @@ Falls back to <code>useId</code> when not provided.</p>
|
|
|
913
913
|
<li><code>toolbar</code>: contains the content returned by <code>renderTabsetToolbar</code> (<code>data-tabset-toolbar</code>)</li>
|
|
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
|
-
<li><code>dropIndicator</code>: shows where a dragged tab will be dropped within a tabset's panels (<code>data-drop-indicator</code>)</li>
|
|
916
|
+
<li><code>dropIndicator</code>: shows where a dragged tab will be dropped within a tabset's panels, or at an edge of the workspace (<code>data-drop-indicator</code>)</li>
|
|
917
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
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.
|
|
@@ -921,7 +921,8 @@ Elements within a collapsed tabset have a <code>data-tabset-collapsed</code> att
|
|
|
921
921
|
Elements within a tabset also have a <code>data-tab-placement</code> attribute (see <code>tabPlacement</code>).</p>
|
|
922
922
|
<p>ℹ️ The drop indicator is the same element for the whole drag (rendered within the workspace's root element),
|
|
923
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
|
|
924
|
+
Its <code>data-region</code> attribute is the region of a tabset's panels it covers, or its <code>data-edge</code> attribute is the edge of the workspace it's at;
|
|
925
|
+
while a tab isn't over either, it has neither and isn't shown (<code>opacity: 0</code>).</p>
|
|
925
926
|
<p>ℹ️ Like the render props, this object is part of what tabsets re-render for;
|
|
926
927
|
in large workspaces, define it outside of the component (or memoize it) rather than inline.</p>
|
|
927
928
|
</td>
|
|
@@ -948,6 +949,9 @@ Workspaces in popout windows rendered by this copy of the application (with port
|
|
|
948
949
|
returning <code>true</code> rejects the target.</p>
|
|
949
950
|
<p>ℹ️ While a tabset is dragged, this function is called for each of its tabs (see <code>DisableDropArgs</code>),
|
|
950
951
|
so restrictions on where tabs can be dropped apply to dragged tabsets too.</p>
|
|
952
|
+
<p>ℹ️ 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
|
|
953
|
+
(except over tabset headers, where the tab lists are) or within its root element's padding.
|
|
954
|
+
These targets have an <code>edge</code> rather than a <code>tabsetId</code>; <code>disableDrop={({ target }) => "edge" in target}</code> turns them off.</p>
|
|
951
955
|
</td>
|
|
952
956
|
</tr>
|
|
953
957
|
<tr>
|
|
@@ -1163,6 +1167,12 @@ The button renders nothing if closing is disabled (by the tab's `disableClose` f
|
|
|
1163
1167
|
Its content defaults to "×" (e.g. it can be replaced with an icon),
|
|
1164
1168
|
and its default `aria-label` is "Close" followed by the tab's title (or id).
|
|
1165
1169
|
|
|
1170
|
+
Its `children`, `className`, `style`, and `title` can also be functions of its state (see `TabCloseButtonState`):
|
|
1171
|
+
|
|
1172
|
+
```tsx
|
|
1173
|
+
<TabCloseButton title={({ tabTitle }) => `Close ${tabTitle}`} />
|
|
1174
|
+
```
|
|
1175
|
+
|
|
1166
1176
|
To keep the tab open (e.g. to confirm unsaved changes first), call `event.preventDefault()` in an `onClick` handler:
|
|
1167
1177
|
|
|
1168
1178
|
```tsx
|
|
@@ -1188,5 +1198,36 @@ None
|
|
|
1188
1198
|
#### Optional props
|
|
1189
1199
|
|
|
1190
1200
|
<!-- TabCloseButton:optional-props:begin -->
|
|
1191
|
-
|
|
1201
|
+
|
|
1202
|
+
<table>
|
|
1203
|
+
<thead>
|
|
1204
|
+
<tr>
|
|
1205
|
+
<th>Name</th>
|
|
1206
|
+
<th>Description</th>
|
|
1207
|
+
</tr>
|
|
1208
|
+
</thead>
|
|
1209
|
+
<tbody>
|
|
1210
|
+
<tr>
|
|
1211
|
+
<td>children</td>
|
|
1212
|
+
<td><p>Content of the element, or a function that returns it (given the component's state).</p>
|
|
1213
|
+
</td>
|
|
1214
|
+
</tr>
|
|
1215
|
+
<tr>
|
|
1216
|
+
<td>className</td>
|
|
1217
|
+
<td><p>Class name of the element, or a function that returns it (given the component's state).</p>
|
|
1218
|
+
</td>
|
|
1219
|
+
</tr>
|
|
1220
|
+
<tr>
|
|
1221
|
+
<td>style</td>
|
|
1222
|
+
<td><p>Inline styles of the element, or a function that returns them (given the component's state).</p>
|
|
1223
|
+
</td>
|
|
1224
|
+
</tr>
|
|
1225
|
+
<tr>
|
|
1226
|
+
<td>title</td>
|
|
1227
|
+
<td><p>Tooltip of the element, or a function that returns it (given the component's state).</p>
|
|
1228
|
+
</td>
|
|
1229
|
+
</tr>
|
|
1230
|
+
</tbody>
|
|
1231
|
+
</table>
|
|
1232
|
+
|
|
1192
1233
|
<!-- TabCloseButton:optional-props:end -->
|