react-resizable-panels 4.16.0 → 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&#39;s tab content (<code>data-tab-panels</code>)</li>
915
915
  <li><code>tabContent</code>: the element each tab&#39;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&#39;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&#39;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&#39;s id if it has no tabs.</p>
979
+ <p>ℹ️ The element has a <code>data-drag-type</code> attribute: <code>&quot;tabset&quot;</code> while a tabset is dragged, and <code>&quot;tab&quot;</code> while a tab is.</p>
970
980
  </td>
971
981
  </tr>
972
982
  <tr>
@@ -979,6 +989,9 @@ the root tabset of an empty workspace, or a tabset with the <code>keepWhenEmpty<
979
989
  <td>renderSeparator</td>
980
990
  <td><p>Separator rendered between the children of a split.
981
991
  Should return a <code>Separator</code> (or <code>null</code> for no separator); defaults to an unstyled <code>Separator</code>.</p>
992
+ <p>ℹ️ Without separators, tabsets can still be resized by dragging their edges (like Panels in a Group without separators),
993
+ but separators are recommended: they can be resized with the keyboard,
994
+ and an edge&#39;s hit area can overlap the tabs beside it (pressing there resizes the tabset rather than dragging the tab).</p>
982
995
  </td>
983
996
  </tr>
984
997
  <tr>
@@ -1038,6 +1051,18 @@ so this is best suited to content that is cheap to mount and benefits from being
1038
1051
  this determines how a dropped tab&#39;s position is found and which arrow keys move focus between tabs.</p>
1039
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>
1040
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&#39;s selected tab is removed (closed, or dragged to another tabset):</p>
1059
+ <ul>
1060
+ <li><code>&quot;adjacent&quot;</code>: the tab after it (or before it, if it was the last tab)</li>
1061
+ <li><code>&quot;recent&quot;</code>: the tabset&#39;s most recently selected tab (like an IDE&#39;s editor groups),
1062
+ falling back to <code>&quot;adjacent&quot;</code> if none of its other tabs has been selected</li>
1063
+ </ul>
1064
+ <p>ℹ️ In <code>&quot;recent&quot;</code> mode, each tabset&#39;s recently selected tabs are saved in the model (see <code>TabsetNode.recentTabIds</code>),
1065
+ so they&#39;re restored with the rest of the layout.</p>
1041
1066
  </td>
1042
1067
  </tr>
1043
1068
  <tr>
@@ -1082,13 +1107,14 @@ Closes the tab it is rendered within; render it within the element returned by t
1082
1107
  renderTab={(tab, props) => (
1083
1108
  <div {...props}>
1084
1109
  {tab.title}
1085
- <TabCloseButton />
1110
+ <TabCloseButton>×</TabCloseButton>
1086
1111
  </div>
1087
1112
  )}
1088
1113
  ```
1089
1114
 
1090
1115
  The button renders nothing if closing is disabled (by the tab's `disableClose` flag or the Workspace's `disabled` prop).
1091
- Its default `aria-label` is "Close" followed by the tab's title (or id).
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).
1092
1118
 
1093
1119
  To keep the tab open (e.g. to confirm unsaved changes first), call `event.preventDefault()` in an `onClick` handler:
1094
1120