react-resizable-panels 2.0.18 → 2.0.20
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/CHANGELOG.md +9 -0
- package/README.md +3 -0
- package/dist/declarations/src/Panel.d.ts +1 -1
- package/dist/declarations/src/PanelResizeHandle.d.ts +5 -3
- package/dist/declarations/src/index.d.ts +2 -1
- package/dist/react-resizable-panels.browser.cjs.js +25 -6
- package/dist/react-resizable-panels.browser.development.cjs.js +25 -6
- package/dist/react-resizable-panels.browser.development.esm.js +25 -6
- package/dist/react-resizable-panels.browser.esm.js +25 -6
- package/dist/react-resizable-panels.cjs.js +25 -6
- package/dist/react-resizable-panels.development.cjs.js +25 -6
- package/dist/react-resizable-panels.development.esm.js +25 -6
- package/dist/react-resizable-panels.development.node.cjs.js +25 -6
- package/dist/react-resizable-panels.development.node.esm.js +25 -6
- package/dist/react-resizable-panels.esm.js +25 -6
- package/dist/react-resizable-panels.node.cjs.js +25 -6
- package/dist/react-resizable-panels.node.esm.js +25 -6
- package/package.json +1 -1
- package/src/Panel.test.tsx +105 -0
- package/src/Panel.ts +3 -3
- package/src/PanelGroup.ts +54 -47
- package/src/PanelGroupContext.ts +1 -1
- package/src/PanelResizeHandle.test.tsx +42 -2
- package/src/PanelResizeHandle.ts +25 -16
- package/src/PanelResizeHandleRegistry.ts +11 -0
- package/src/index.ts +2 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 2.0.20
|
|
4
|
+
|
|
5
|
+
- Reset global cursor if an active resize handle is unmounted (#313)
|
|
6
|
+
- Resize handle supports (optional) `onFocus` or `onBlur` props (#370)
|
|
7
|
+
|
|
8
|
+
## 2.0.19
|
|
9
|
+
|
|
10
|
+
- Add optional `minSize` override param to panel `expand` imperative API
|
|
11
|
+
|
|
3
12
|
## 2.0.18
|
|
4
13
|
|
|
5
14
|
- Inline object `hitAreaMargins` will not trigger re-initialization logic unless inner values change (#342)
|
package/README.md
CHANGED
|
@@ -223,4 +223,7 @@ export function ClientComponent({
|
|
|
223
223
|
}
|
|
224
224
|
```
|
|
225
225
|
|
|
226
|
+
> [!NOTE]
|
|
227
|
+
> Be sure to specify a `defaultSize` prop for **every** `Panel` component to avoid layout flicker.
|
|
228
|
+
|
|
226
229
|
A demo of this is available [here](https://github.com/bvaughn/react-resizable-panels-demo-ssr).
|
|
@@ -1,18 +1,20 @@
|
|
|
1
|
-
import { CSSProperties, HTMLAttributes, PropsWithChildren, ReactElement } from "./vendor/react.js";
|
|
2
1
|
import { PointerHitAreaMargins } from "./PanelResizeHandleRegistry.js";
|
|
2
|
+
import { CSSProperties, HTMLAttributes, PropsWithChildren, ReactElement } from "./vendor/react.js";
|
|
3
3
|
export type PanelResizeHandleOnDragging = (isDragging: boolean) => void;
|
|
4
4
|
export type ResizeHandlerState = "drag" | "hover" | "inactive";
|
|
5
|
-
export type PanelResizeHandleProps = Omit<HTMLAttributes<keyof HTMLElementTagNameMap>, "id"> & PropsWithChildren<{
|
|
5
|
+
export type PanelResizeHandleProps = Omit<HTMLAttributes<keyof HTMLElementTagNameMap>, "id" | "onBlur" | "onFocus"> & PropsWithChildren<{
|
|
6
6
|
className?: string;
|
|
7
7
|
disabled?: boolean;
|
|
8
8
|
hitAreaMargins?: PointerHitAreaMargins;
|
|
9
9
|
id?: string | null;
|
|
10
|
+
onBlur?: () => void;
|
|
10
11
|
onDragging?: PanelResizeHandleOnDragging;
|
|
12
|
+
onFocus?: () => void;
|
|
11
13
|
style?: CSSProperties;
|
|
12
14
|
tabIndex?: number;
|
|
13
15
|
tagName?: keyof HTMLElementTagNameMap;
|
|
14
16
|
}>;
|
|
15
|
-
export declare function PanelResizeHandle({ children, className: classNameFromProps, disabled, hitAreaMargins, id: idFromProps, onDragging, style: styleFromProps, tabIndex, tagName: Type, ...rest }: PanelResizeHandleProps): ReactElement;
|
|
17
|
+
export declare function PanelResizeHandle({ children, className: classNameFromProps, disabled, hitAreaMargins, id: idFromProps, onBlur, onDragging, onFocus, style: styleFromProps, tabIndex, tagName: Type, ...rest }: PanelResizeHandleProps): ReactElement;
|
|
16
18
|
export declare namespace PanelResizeHandle {
|
|
17
19
|
var displayName: string;
|
|
18
20
|
}
|
|
@@ -14,4 +14,5 @@ import { intersects } from "./utils/rects/intersects.js";
|
|
|
14
14
|
import type { ImperativePanelHandle, PanelOnCollapse, PanelOnExpand, PanelOnResize, PanelProps } from "./Panel.js";
|
|
15
15
|
import type { ImperativePanelGroupHandle, PanelGroupOnLayout, PanelGroupProps, PanelGroupStorage } from "./PanelGroup.js";
|
|
16
16
|
import type { PanelResizeHandleOnDragging, PanelResizeHandleProps } from "./PanelResizeHandle.js";
|
|
17
|
-
|
|
17
|
+
import type { PointerHitAreaMargins } from "./PanelResizeHandleRegistry.js";
|
|
18
|
+
export { ImperativePanelGroupHandle, ImperativePanelHandle, PanelGroupOnLayout, PanelGroupProps, PanelGroupStorage, PanelOnCollapse, PanelOnExpand, PanelOnResize, PanelProps, PanelResizeHandleOnDragging, PanelResizeHandleProps, PointerHitAreaMargins, Panel, PanelGroup, PanelResizeHandle, assert, getIntersectingRectangle, intersects, getPanelElement, getPanelElementsForGroup, getPanelGroupElement, getResizeHandleElement, getResizeHandleElementIndex, getResizeHandleElementsForGroup, getResizeHandlePanelIds, };
|
|
@@ -157,8 +157,8 @@ function PanelWithForwardedRef({
|
|
|
157
157
|
collapse: () => {
|
|
158
158
|
collapsePanel(panelDataRef.current);
|
|
159
159
|
},
|
|
160
|
-
expand:
|
|
161
|
-
expandPanel(panelDataRef.current);
|
|
160
|
+
expand: minSize => {
|
|
161
|
+
expandPanel(panelDataRef.current, minSize);
|
|
162
162
|
},
|
|
163
163
|
getId() {
|
|
164
164
|
return panelId;
|
|
@@ -454,6 +454,16 @@ function registerResizeHandle(resizeHandleId, element, direction, hitAreaMargins
|
|
|
454
454
|
if (count === 1) {
|
|
455
455
|
ownerDocumentCounts.delete(ownerDocument);
|
|
456
456
|
}
|
|
457
|
+
|
|
458
|
+
// If the resize handle that is currently unmounting is intersecting with the pointer,
|
|
459
|
+
// update the global pointer to account for the change
|
|
460
|
+
if (intersectingHandles.includes(data)) {
|
|
461
|
+
const index = intersectingHandles.indexOf(data);
|
|
462
|
+
if (index >= 0) {
|
|
463
|
+
intersectingHandles.splice(index, 1);
|
|
464
|
+
}
|
|
465
|
+
updateCursor();
|
|
466
|
+
}
|
|
457
467
|
};
|
|
458
468
|
}
|
|
459
469
|
function handlePointerDown(event) {
|
|
@@ -1722,7 +1732,7 @@ function PanelGroupWithForwardedRef({
|
|
|
1722
1732
|
}, []);
|
|
1723
1733
|
|
|
1724
1734
|
// External APIs are safe to memoize via committed values ref
|
|
1725
|
-
const expandPanel = useCallback(panelData => {
|
|
1735
|
+
const expandPanel = useCallback((panelData, minSizeOverride) => {
|
|
1726
1736
|
const {
|
|
1727
1737
|
onLayout
|
|
1728
1738
|
} = committedValuesRef.current;
|
|
@@ -1735,9 +1745,10 @@ function PanelGroupWithForwardedRef({
|
|
|
1735
1745
|
const {
|
|
1736
1746
|
collapsedSize = 0,
|
|
1737
1747
|
panelSize = 0,
|
|
1738
|
-
minSize = 0,
|
|
1748
|
+
minSize: minSizeFromProps = 0,
|
|
1739
1749
|
pivotIndices
|
|
1740
1750
|
} = panelDataHelper(panelDataArray, panelData, prevLayout);
|
|
1751
|
+
const minSize = minSizeOverride !== null && minSizeOverride !== void 0 ? minSizeOverride : minSizeFromProps;
|
|
1741
1752
|
if (fuzzyNumbersEqual$1(panelSize, collapsedSize)) {
|
|
1742
1753
|
// Restore this panel to the size it was before it was collapsed, if possible.
|
|
1743
1754
|
const prevPanelSize = panelSizeBeforeCollapseRef.current.get(panelData.id);
|
|
@@ -2202,7 +2213,9 @@ function PanelResizeHandle({
|
|
|
2202
2213
|
disabled = false,
|
|
2203
2214
|
hitAreaMargins,
|
|
2204
2215
|
id: idFromProps,
|
|
2216
|
+
onBlur,
|
|
2205
2217
|
onDragging,
|
|
2218
|
+
onFocus,
|
|
2206
2219
|
style: styleFromProps = {},
|
|
2207
2220
|
tabIndex = 0,
|
|
2208
2221
|
tagName: Type = "div",
|
|
@@ -2322,8 +2335,14 @@ function PanelResizeHandle({
|
|
|
2322
2335
|
children,
|
|
2323
2336
|
className: classNameFromProps,
|
|
2324
2337
|
id: idFromProps,
|
|
2325
|
-
onBlur: () =>
|
|
2326
|
-
|
|
2338
|
+
onBlur: () => {
|
|
2339
|
+
setIsFocused(false);
|
|
2340
|
+
onBlur === null || onBlur === void 0 ? void 0 : onBlur();
|
|
2341
|
+
},
|
|
2342
|
+
onFocus: () => {
|
|
2343
|
+
setIsFocused(true);
|
|
2344
|
+
onFocus === null || onFocus === void 0 ? void 0 : onFocus();
|
|
2345
|
+
},
|
|
2327
2346
|
ref: elementRef,
|
|
2328
2347
|
role: "separator",
|
|
2329
2348
|
style: {
|
|
@@ -163,8 +163,8 @@ function PanelWithForwardedRef({
|
|
|
163
163
|
collapse: () => {
|
|
164
164
|
collapsePanel(panelDataRef.current);
|
|
165
165
|
},
|
|
166
|
-
expand:
|
|
167
|
-
expandPanel(panelDataRef.current);
|
|
166
|
+
expand: minSize => {
|
|
167
|
+
expandPanel(panelDataRef.current, minSize);
|
|
168
168
|
},
|
|
169
169
|
getId() {
|
|
170
170
|
return panelId;
|
|
@@ -460,6 +460,16 @@ function registerResizeHandle(resizeHandleId, element, direction, hitAreaMargins
|
|
|
460
460
|
if (count === 1) {
|
|
461
461
|
ownerDocumentCounts.delete(ownerDocument);
|
|
462
462
|
}
|
|
463
|
+
|
|
464
|
+
// If the resize handle that is currently unmounting is intersecting with the pointer,
|
|
465
|
+
// update the global pointer to account for the change
|
|
466
|
+
if (intersectingHandles.includes(data)) {
|
|
467
|
+
const index = intersectingHandles.indexOf(data);
|
|
468
|
+
if (index >= 0) {
|
|
469
|
+
intersectingHandles.splice(index, 1);
|
|
470
|
+
}
|
|
471
|
+
updateCursor();
|
|
472
|
+
}
|
|
463
473
|
};
|
|
464
474
|
}
|
|
465
475
|
function handlePointerDown(event) {
|
|
@@ -1828,7 +1838,7 @@ function PanelGroupWithForwardedRef({
|
|
|
1828
1838
|
}, []);
|
|
1829
1839
|
|
|
1830
1840
|
// External APIs are safe to memoize via committed values ref
|
|
1831
|
-
const expandPanel = useCallback(panelData => {
|
|
1841
|
+
const expandPanel = useCallback((panelData, minSizeOverride) => {
|
|
1832
1842
|
const {
|
|
1833
1843
|
onLayout
|
|
1834
1844
|
} = committedValuesRef.current;
|
|
@@ -1841,9 +1851,10 @@ function PanelGroupWithForwardedRef({
|
|
|
1841
1851
|
const {
|
|
1842
1852
|
collapsedSize = 0,
|
|
1843
1853
|
panelSize = 0,
|
|
1844
|
-
minSize = 0,
|
|
1854
|
+
minSize: minSizeFromProps = 0,
|
|
1845
1855
|
pivotIndices
|
|
1846
1856
|
} = panelDataHelper(panelDataArray, panelData, prevLayout);
|
|
1857
|
+
const minSize = minSizeOverride !== null && minSizeOverride !== void 0 ? minSizeOverride : minSizeFromProps;
|
|
1847
1858
|
if (fuzzyNumbersEqual$1(panelSize, collapsedSize)) {
|
|
1848
1859
|
// Restore this panel to the size it was before it was collapsed, if possible.
|
|
1849
1860
|
const prevPanelSize = panelSizeBeforeCollapseRef.current.get(panelData.id);
|
|
@@ -2308,7 +2319,9 @@ function PanelResizeHandle({
|
|
|
2308
2319
|
disabled = false,
|
|
2309
2320
|
hitAreaMargins,
|
|
2310
2321
|
id: idFromProps,
|
|
2322
|
+
onBlur,
|
|
2311
2323
|
onDragging,
|
|
2324
|
+
onFocus,
|
|
2312
2325
|
style: styleFromProps = {},
|
|
2313
2326
|
tabIndex = 0,
|
|
2314
2327
|
tagName: Type = "div",
|
|
@@ -2428,8 +2441,14 @@ function PanelResizeHandle({
|
|
|
2428
2441
|
children,
|
|
2429
2442
|
className: classNameFromProps,
|
|
2430
2443
|
id: idFromProps,
|
|
2431
|
-
onBlur: () =>
|
|
2432
|
-
|
|
2444
|
+
onBlur: () => {
|
|
2445
|
+
setIsFocused(false);
|
|
2446
|
+
onBlur === null || onBlur === void 0 ? void 0 : onBlur();
|
|
2447
|
+
},
|
|
2448
|
+
onFocus: () => {
|
|
2449
|
+
setIsFocused(true);
|
|
2450
|
+
onFocus === null || onFocus === void 0 ? void 0 : onFocus();
|
|
2451
|
+
},
|
|
2433
2452
|
ref: elementRef,
|
|
2434
2453
|
role: "separator",
|
|
2435
2454
|
style: {
|
|
@@ -139,8 +139,8 @@ function PanelWithForwardedRef({
|
|
|
139
139
|
collapse: () => {
|
|
140
140
|
collapsePanel(panelDataRef.current);
|
|
141
141
|
},
|
|
142
|
-
expand:
|
|
143
|
-
expandPanel(panelDataRef.current);
|
|
142
|
+
expand: minSize => {
|
|
143
|
+
expandPanel(panelDataRef.current, minSize);
|
|
144
144
|
},
|
|
145
145
|
getId() {
|
|
146
146
|
return panelId;
|
|
@@ -436,6 +436,16 @@ function registerResizeHandle(resizeHandleId, element, direction, hitAreaMargins
|
|
|
436
436
|
if (count === 1) {
|
|
437
437
|
ownerDocumentCounts.delete(ownerDocument);
|
|
438
438
|
}
|
|
439
|
+
|
|
440
|
+
// If the resize handle that is currently unmounting is intersecting with the pointer,
|
|
441
|
+
// update the global pointer to account for the change
|
|
442
|
+
if (intersectingHandles.includes(data)) {
|
|
443
|
+
const index = intersectingHandles.indexOf(data);
|
|
444
|
+
if (index >= 0) {
|
|
445
|
+
intersectingHandles.splice(index, 1);
|
|
446
|
+
}
|
|
447
|
+
updateCursor();
|
|
448
|
+
}
|
|
439
449
|
};
|
|
440
450
|
}
|
|
441
451
|
function handlePointerDown(event) {
|
|
@@ -1804,7 +1814,7 @@ function PanelGroupWithForwardedRef({
|
|
|
1804
1814
|
}, []);
|
|
1805
1815
|
|
|
1806
1816
|
// External APIs are safe to memoize via committed values ref
|
|
1807
|
-
const expandPanel = useCallback(panelData => {
|
|
1817
|
+
const expandPanel = useCallback((panelData, minSizeOverride) => {
|
|
1808
1818
|
const {
|
|
1809
1819
|
onLayout
|
|
1810
1820
|
} = committedValuesRef.current;
|
|
@@ -1817,9 +1827,10 @@ function PanelGroupWithForwardedRef({
|
|
|
1817
1827
|
const {
|
|
1818
1828
|
collapsedSize = 0,
|
|
1819
1829
|
panelSize = 0,
|
|
1820
|
-
minSize = 0,
|
|
1830
|
+
minSize: minSizeFromProps = 0,
|
|
1821
1831
|
pivotIndices
|
|
1822
1832
|
} = panelDataHelper(panelDataArray, panelData, prevLayout);
|
|
1833
|
+
const minSize = minSizeOverride !== null && minSizeOverride !== void 0 ? minSizeOverride : minSizeFromProps;
|
|
1823
1834
|
if (fuzzyNumbersEqual$1(panelSize, collapsedSize)) {
|
|
1824
1835
|
// Restore this panel to the size it was before it was collapsed, if possible.
|
|
1825
1836
|
const prevPanelSize = panelSizeBeforeCollapseRef.current.get(panelData.id);
|
|
@@ -2284,7 +2295,9 @@ function PanelResizeHandle({
|
|
|
2284
2295
|
disabled = false,
|
|
2285
2296
|
hitAreaMargins,
|
|
2286
2297
|
id: idFromProps,
|
|
2298
|
+
onBlur,
|
|
2287
2299
|
onDragging,
|
|
2300
|
+
onFocus,
|
|
2288
2301
|
style: styleFromProps = {},
|
|
2289
2302
|
tabIndex = 0,
|
|
2290
2303
|
tagName: Type = "div",
|
|
@@ -2404,8 +2417,14 @@ function PanelResizeHandle({
|
|
|
2404
2417
|
children,
|
|
2405
2418
|
className: classNameFromProps,
|
|
2406
2419
|
id: idFromProps,
|
|
2407
|
-
onBlur: () =>
|
|
2408
|
-
|
|
2420
|
+
onBlur: () => {
|
|
2421
|
+
setIsFocused(false);
|
|
2422
|
+
onBlur === null || onBlur === void 0 ? void 0 : onBlur();
|
|
2423
|
+
},
|
|
2424
|
+
onFocus: () => {
|
|
2425
|
+
setIsFocused(true);
|
|
2426
|
+
onFocus === null || onFocus === void 0 ? void 0 : onFocus();
|
|
2427
|
+
},
|
|
2409
2428
|
ref: elementRef,
|
|
2410
2429
|
role: "separator",
|
|
2411
2430
|
style: {
|
|
@@ -133,8 +133,8 @@ function PanelWithForwardedRef({
|
|
|
133
133
|
collapse: () => {
|
|
134
134
|
collapsePanel(panelDataRef.current);
|
|
135
135
|
},
|
|
136
|
-
expand:
|
|
137
|
-
expandPanel(panelDataRef.current);
|
|
136
|
+
expand: minSize => {
|
|
137
|
+
expandPanel(panelDataRef.current, minSize);
|
|
138
138
|
},
|
|
139
139
|
getId() {
|
|
140
140
|
return panelId;
|
|
@@ -430,6 +430,16 @@ function registerResizeHandle(resizeHandleId, element, direction, hitAreaMargins
|
|
|
430
430
|
if (count === 1) {
|
|
431
431
|
ownerDocumentCounts.delete(ownerDocument);
|
|
432
432
|
}
|
|
433
|
+
|
|
434
|
+
// If the resize handle that is currently unmounting is intersecting with the pointer,
|
|
435
|
+
// update the global pointer to account for the change
|
|
436
|
+
if (intersectingHandles.includes(data)) {
|
|
437
|
+
const index = intersectingHandles.indexOf(data);
|
|
438
|
+
if (index >= 0) {
|
|
439
|
+
intersectingHandles.splice(index, 1);
|
|
440
|
+
}
|
|
441
|
+
updateCursor();
|
|
442
|
+
}
|
|
433
443
|
};
|
|
434
444
|
}
|
|
435
445
|
function handlePointerDown(event) {
|
|
@@ -1698,7 +1708,7 @@ function PanelGroupWithForwardedRef({
|
|
|
1698
1708
|
}, []);
|
|
1699
1709
|
|
|
1700
1710
|
// External APIs are safe to memoize via committed values ref
|
|
1701
|
-
const expandPanel = useCallback(panelData => {
|
|
1711
|
+
const expandPanel = useCallback((panelData, minSizeOverride) => {
|
|
1702
1712
|
const {
|
|
1703
1713
|
onLayout
|
|
1704
1714
|
} = committedValuesRef.current;
|
|
@@ -1711,9 +1721,10 @@ function PanelGroupWithForwardedRef({
|
|
|
1711
1721
|
const {
|
|
1712
1722
|
collapsedSize = 0,
|
|
1713
1723
|
panelSize = 0,
|
|
1714
|
-
minSize = 0,
|
|
1724
|
+
minSize: minSizeFromProps = 0,
|
|
1715
1725
|
pivotIndices
|
|
1716
1726
|
} = panelDataHelper(panelDataArray, panelData, prevLayout);
|
|
1727
|
+
const minSize = minSizeOverride !== null && minSizeOverride !== void 0 ? minSizeOverride : minSizeFromProps;
|
|
1717
1728
|
if (fuzzyNumbersEqual$1(panelSize, collapsedSize)) {
|
|
1718
1729
|
// Restore this panel to the size it was before it was collapsed, if possible.
|
|
1719
1730
|
const prevPanelSize = panelSizeBeforeCollapseRef.current.get(panelData.id);
|
|
@@ -2178,7 +2189,9 @@ function PanelResizeHandle({
|
|
|
2178
2189
|
disabled = false,
|
|
2179
2190
|
hitAreaMargins,
|
|
2180
2191
|
id: idFromProps,
|
|
2192
|
+
onBlur,
|
|
2181
2193
|
onDragging,
|
|
2194
|
+
onFocus,
|
|
2182
2195
|
style: styleFromProps = {},
|
|
2183
2196
|
tabIndex = 0,
|
|
2184
2197
|
tagName: Type = "div",
|
|
@@ -2298,8 +2311,14 @@ function PanelResizeHandle({
|
|
|
2298
2311
|
children,
|
|
2299
2312
|
className: classNameFromProps,
|
|
2300
2313
|
id: idFromProps,
|
|
2301
|
-
onBlur: () =>
|
|
2302
|
-
|
|
2314
|
+
onBlur: () => {
|
|
2315
|
+
setIsFocused(false);
|
|
2316
|
+
onBlur === null || onBlur === void 0 ? void 0 : onBlur();
|
|
2317
|
+
},
|
|
2318
|
+
onFocus: () => {
|
|
2319
|
+
setIsFocused(true);
|
|
2320
|
+
onFocus === null || onFocus === void 0 ? void 0 : onFocus();
|
|
2321
|
+
},
|
|
2303
2322
|
ref: elementRef,
|
|
2304
2323
|
role: "separator",
|
|
2305
2324
|
style: {
|
|
@@ -159,8 +159,8 @@ function PanelWithForwardedRef({
|
|
|
159
159
|
collapse: () => {
|
|
160
160
|
collapsePanel(panelDataRef.current);
|
|
161
161
|
},
|
|
162
|
-
expand:
|
|
163
|
-
expandPanel(panelDataRef.current);
|
|
162
|
+
expand: minSize => {
|
|
163
|
+
expandPanel(panelDataRef.current, minSize);
|
|
164
164
|
},
|
|
165
165
|
getId() {
|
|
166
166
|
return panelId;
|
|
@@ -456,6 +456,16 @@ function registerResizeHandle(resizeHandleId, element, direction, hitAreaMargins
|
|
|
456
456
|
if (count === 1) {
|
|
457
457
|
ownerDocumentCounts.delete(ownerDocument);
|
|
458
458
|
}
|
|
459
|
+
|
|
460
|
+
// If the resize handle that is currently unmounting is intersecting with the pointer,
|
|
461
|
+
// update the global pointer to account for the change
|
|
462
|
+
if (intersectingHandles.includes(data)) {
|
|
463
|
+
const index = intersectingHandles.indexOf(data);
|
|
464
|
+
if (index >= 0) {
|
|
465
|
+
intersectingHandles.splice(index, 1);
|
|
466
|
+
}
|
|
467
|
+
updateCursor();
|
|
468
|
+
}
|
|
459
469
|
};
|
|
460
470
|
}
|
|
461
471
|
function handlePointerDown(event) {
|
|
@@ -1724,7 +1734,7 @@ function PanelGroupWithForwardedRef({
|
|
|
1724
1734
|
}, []);
|
|
1725
1735
|
|
|
1726
1736
|
// External APIs are safe to memoize via committed values ref
|
|
1727
|
-
const expandPanel = useCallback(panelData => {
|
|
1737
|
+
const expandPanel = useCallback((panelData, minSizeOverride) => {
|
|
1728
1738
|
const {
|
|
1729
1739
|
onLayout
|
|
1730
1740
|
} = committedValuesRef.current;
|
|
@@ -1737,9 +1747,10 @@ function PanelGroupWithForwardedRef({
|
|
|
1737
1747
|
const {
|
|
1738
1748
|
collapsedSize = 0,
|
|
1739
1749
|
panelSize = 0,
|
|
1740
|
-
minSize = 0,
|
|
1750
|
+
minSize: minSizeFromProps = 0,
|
|
1741
1751
|
pivotIndices
|
|
1742
1752
|
} = panelDataHelper(panelDataArray, panelData, prevLayout);
|
|
1753
|
+
const minSize = minSizeOverride !== null && minSizeOverride !== void 0 ? minSizeOverride : minSizeFromProps;
|
|
1743
1754
|
if (fuzzyNumbersEqual$1(panelSize, collapsedSize)) {
|
|
1744
1755
|
// Restore this panel to the size it was before it was collapsed, if possible.
|
|
1745
1756
|
const prevPanelSize = panelSizeBeforeCollapseRef.current.get(panelData.id);
|
|
@@ -2204,7 +2215,9 @@ function PanelResizeHandle({
|
|
|
2204
2215
|
disabled = false,
|
|
2205
2216
|
hitAreaMargins,
|
|
2206
2217
|
id: idFromProps,
|
|
2218
|
+
onBlur,
|
|
2207
2219
|
onDragging,
|
|
2220
|
+
onFocus,
|
|
2208
2221
|
style: styleFromProps = {},
|
|
2209
2222
|
tabIndex = 0,
|
|
2210
2223
|
tagName: Type = "div",
|
|
@@ -2324,8 +2337,14 @@ function PanelResizeHandle({
|
|
|
2324
2337
|
children,
|
|
2325
2338
|
className: classNameFromProps,
|
|
2326
2339
|
id: idFromProps,
|
|
2327
|
-
onBlur: () =>
|
|
2328
|
-
|
|
2340
|
+
onBlur: () => {
|
|
2341
|
+
setIsFocused(false);
|
|
2342
|
+
onBlur === null || onBlur === void 0 ? void 0 : onBlur();
|
|
2343
|
+
},
|
|
2344
|
+
onFocus: () => {
|
|
2345
|
+
setIsFocused(true);
|
|
2346
|
+
onFocus === null || onFocus === void 0 ? void 0 : onFocus();
|
|
2347
|
+
},
|
|
2329
2348
|
ref: elementRef,
|
|
2330
2349
|
role: "separator",
|
|
2331
2350
|
style: {
|
|
@@ -170,8 +170,8 @@ function PanelWithForwardedRef({
|
|
|
170
170
|
collapse: () => {
|
|
171
171
|
collapsePanel(panelDataRef.current);
|
|
172
172
|
},
|
|
173
|
-
expand:
|
|
174
|
-
expandPanel(panelDataRef.current);
|
|
173
|
+
expand: minSize => {
|
|
174
|
+
expandPanel(panelDataRef.current, minSize);
|
|
175
175
|
},
|
|
176
176
|
getId() {
|
|
177
177
|
return panelId;
|
|
@@ -467,6 +467,16 @@ function registerResizeHandle(resizeHandleId, element, direction, hitAreaMargins
|
|
|
467
467
|
if (count === 1) {
|
|
468
468
|
ownerDocumentCounts.delete(ownerDocument);
|
|
469
469
|
}
|
|
470
|
+
|
|
471
|
+
// If the resize handle that is currently unmounting is intersecting with the pointer,
|
|
472
|
+
// update the global pointer to account for the change
|
|
473
|
+
if (intersectingHandles.includes(data)) {
|
|
474
|
+
const index = intersectingHandles.indexOf(data);
|
|
475
|
+
if (index >= 0) {
|
|
476
|
+
intersectingHandles.splice(index, 1);
|
|
477
|
+
}
|
|
478
|
+
updateCursor();
|
|
479
|
+
}
|
|
470
480
|
};
|
|
471
481
|
}
|
|
472
482
|
function handlePointerDown(event) {
|
|
@@ -1835,7 +1845,7 @@ function PanelGroupWithForwardedRef({
|
|
|
1835
1845
|
}, []);
|
|
1836
1846
|
|
|
1837
1847
|
// External APIs are safe to memoize via committed values ref
|
|
1838
|
-
const expandPanel = useCallback(panelData => {
|
|
1848
|
+
const expandPanel = useCallback((panelData, minSizeOverride) => {
|
|
1839
1849
|
const {
|
|
1840
1850
|
onLayout
|
|
1841
1851
|
} = committedValuesRef.current;
|
|
@@ -1848,9 +1858,10 @@ function PanelGroupWithForwardedRef({
|
|
|
1848
1858
|
const {
|
|
1849
1859
|
collapsedSize = 0,
|
|
1850
1860
|
panelSize = 0,
|
|
1851
|
-
minSize = 0,
|
|
1861
|
+
minSize: minSizeFromProps = 0,
|
|
1852
1862
|
pivotIndices
|
|
1853
1863
|
} = panelDataHelper(panelDataArray, panelData, prevLayout);
|
|
1864
|
+
const minSize = minSizeOverride !== null && minSizeOverride !== void 0 ? minSizeOverride : minSizeFromProps;
|
|
1854
1865
|
if (fuzzyNumbersEqual$1(panelSize, collapsedSize)) {
|
|
1855
1866
|
// Restore this panel to the size it was before it was collapsed, if possible.
|
|
1856
1867
|
const prevPanelSize = panelSizeBeforeCollapseRef.current.get(panelData.id);
|
|
@@ -2315,7 +2326,9 @@ function PanelResizeHandle({
|
|
|
2315
2326
|
disabled = false,
|
|
2316
2327
|
hitAreaMargins,
|
|
2317
2328
|
id: idFromProps,
|
|
2329
|
+
onBlur,
|
|
2318
2330
|
onDragging,
|
|
2331
|
+
onFocus,
|
|
2319
2332
|
style: styleFromProps = {},
|
|
2320
2333
|
tabIndex = 0,
|
|
2321
2334
|
tagName: Type = "div",
|
|
@@ -2435,8 +2448,14 @@ function PanelResizeHandle({
|
|
|
2435
2448
|
children,
|
|
2436
2449
|
className: classNameFromProps,
|
|
2437
2450
|
id: idFromProps,
|
|
2438
|
-
onBlur: () =>
|
|
2439
|
-
|
|
2451
|
+
onBlur: () => {
|
|
2452
|
+
setIsFocused(false);
|
|
2453
|
+
onBlur === null || onBlur === void 0 ? void 0 : onBlur();
|
|
2454
|
+
},
|
|
2455
|
+
onFocus: () => {
|
|
2456
|
+
setIsFocused(true);
|
|
2457
|
+
onFocus === null || onFocus === void 0 ? void 0 : onFocus();
|
|
2458
|
+
},
|
|
2440
2459
|
ref: elementRef,
|
|
2441
2460
|
role: "separator",
|
|
2442
2461
|
style: {
|
|
@@ -146,8 +146,8 @@ function PanelWithForwardedRef({
|
|
|
146
146
|
collapse: () => {
|
|
147
147
|
collapsePanel(panelDataRef.current);
|
|
148
148
|
},
|
|
149
|
-
expand:
|
|
150
|
-
expandPanel(panelDataRef.current);
|
|
149
|
+
expand: minSize => {
|
|
150
|
+
expandPanel(panelDataRef.current, minSize);
|
|
151
151
|
},
|
|
152
152
|
getId() {
|
|
153
153
|
return panelId;
|
|
@@ -443,6 +443,16 @@ function registerResizeHandle(resizeHandleId, element, direction, hitAreaMargins
|
|
|
443
443
|
if (count === 1) {
|
|
444
444
|
ownerDocumentCounts.delete(ownerDocument);
|
|
445
445
|
}
|
|
446
|
+
|
|
447
|
+
// If the resize handle that is currently unmounting is intersecting with the pointer,
|
|
448
|
+
// update the global pointer to account for the change
|
|
449
|
+
if (intersectingHandles.includes(data)) {
|
|
450
|
+
const index = intersectingHandles.indexOf(data);
|
|
451
|
+
if (index >= 0) {
|
|
452
|
+
intersectingHandles.splice(index, 1);
|
|
453
|
+
}
|
|
454
|
+
updateCursor();
|
|
455
|
+
}
|
|
446
456
|
};
|
|
447
457
|
}
|
|
448
458
|
function handlePointerDown(event) {
|
|
@@ -1811,7 +1821,7 @@ function PanelGroupWithForwardedRef({
|
|
|
1811
1821
|
}, []);
|
|
1812
1822
|
|
|
1813
1823
|
// External APIs are safe to memoize via committed values ref
|
|
1814
|
-
const expandPanel = useCallback(panelData => {
|
|
1824
|
+
const expandPanel = useCallback((panelData, minSizeOverride) => {
|
|
1815
1825
|
const {
|
|
1816
1826
|
onLayout
|
|
1817
1827
|
} = committedValuesRef.current;
|
|
@@ -1824,9 +1834,10 @@ function PanelGroupWithForwardedRef({
|
|
|
1824
1834
|
const {
|
|
1825
1835
|
collapsedSize = 0,
|
|
1826
1836
|
panelSize = 0,
|
|
1827
|
-
minSize = 0,
|
|
1837
|
+
minSize: minSizeFromProps = 0,
|
|
1828
1838
|
pivotIndices
|
|
1829
1839
|
} = panelDataHelper(panelDataArray, panelData, prevLayout);
|
|
1840
|
+
const minSize = minSizeOverride !== null && minSizeOverride !== void 0 ? minSizeOverride : minSizeFromProps;
|
|
1830
1841
|
if (fuzzyNumbersEqual$1(panelSize, collapsedSize)) {
|
|
1831
1842
|
// Restore this panel to the size it was before it was collapsed, if possible.
|
|
1832
1843
|
const prevPanelSize = panelSizeBeforeCollapseRef.current.get(panelData.id);
|
|
@@ -2291,7 +2302,9 @@ function PanelResizeHandle({
|
|
|
2291
2302
|
disabled = false,
|
|
2292
2303
|
hitAreaMargins,
|
|
2293
2304
|
id: idFromProps,
|
|
2305
|
+
onBlur,
|
|
2294
2306
|
onDragging,
|
|
2307
|
+
onFocus,
|
|
2295
2308
|
style: styleFromProps = {},
|
|
2296
2309
|
tabIndex = 0,
|
|
2297
2310
|
tagName: Type = "div",
|
|
@@ -2411,8 +2424,14 @@ function PanelResizeHandle({
|
|
|
2411
2424
|
children,
|
|
2412
2425
|
className: classNameFromProps,
|
|
2413
2426
|
id: idFromProps,
|
|
2414
|
-
onBlur: () =>
|
|
2415
|
-
|
|
2427
|
+
onBlur: () => {
|
|
2428
|
+
setIsFocused(false);
|
|
2429
|
+
onBlur === null || onBlur === void 0 ? void 0 : onBlur();
|
|
2430
|
+
},
|
|
2431
|
+
onFocus: () => {
|
|
2432
|
+
setIsFocused(true);
|
|
2433
|
+
onFocus === null || onFocus === void 0 ? void 0 : onFocus();
|
|
2434
|
+
},
|
|
2416
2435
|
ref: elementRef,
|
|
2417
2436
|
role: "separator",
|
|
2418
2437
|
style: {
|
|
@@ -132,8 +132,8 @@ function PanelWithForwardedRef({
|
|
|
132
132
|
collapse: () => {
|
|
133
133
|
collapsePanel(panelDataRef.current);
|
|
134
134
|
},
|
|
135
|
-
expand:
|
|
136
|
-
expandPanel(panelDataRef.current);
|
|
135
|
+
expand: minSize => {
|
|
136
|
+
expandPanel(panelDataRef.current, minSize);
|
|
137
137
|
},
|
|
138
138
|
getId() {
|
|
139
139
|
return panelId;
|
|
@@ -429,6 +429,16 @@ function registerResizeHandle(resizeHandleId, element, direction, hitAreaMargins
|
|
|
429
429
|
if (count === 1) {
|
|
430
430
|
ownerDocumentCounts.delete(ownerDocument);
|
|
431
431
|
}
|
|
432
|
+
|
|
433
|
+
// If the resize handle that is currently unmounting is intersecting with the pointer,
|
|
434
|
+
// update the global pointer to account for the change
|
|
435
|
+
if (intersectingHandles.includes(data)) {
|
|
436
|
+
const index = intersectingHandles.indexOf(data);
|
|
437
|
+
if (index >= 0) {
|
|
438
|
+
intersectingHandles.splice(index, 1);
|
|
439
|
+
}
|
|
440
|
+
updateCursor();
|
|
441
|
+
}
|
|
432
442
|
};
|
|
433
443
|
}
|
|
434
444
|
function handlePointerDown(event) {
|
|
@@ -1659,7 +1669,7 @@ function PanelGroupWithForwardedRef({
|
|
|
1659
1669
|
}, []);
|
|
1660
1670
|
|
|
1661
1671
|
// External APIs are safe to memoize via committed values ref
|
|
1662
|
-
const expandPanel = useCallback(panelData => {
|
|
1672
|
+
const expandPanel = useCallback((panelData, minSizeOverride) => {
|
|
1663
1673
|
const {
|
|
1664
1674
|
onLayout
|
|
1665
1675
|
} = committedValuesRef.current;
|
|
@@ -1672,9 +1682,10 @@ function PanelGroupWithForwardedRef({
|
|
|
1672
1682
|
const {
|
|
1673
1683
|
collapsedSize = 0,
|
|
1674
1684
|
panelSize = 0,
|
|
1675
|
-
minSize = 0,
|
|
1685
|
+
minSize: minSizeFromProps = 0,
|
|
1676
1686
|
pivotIndices
|
|
1677
1687
|
} = panelDataHelper(panelDataArray, panelData, prevLayout);
|
|
1688
|
+
const minSize = minSizeOverride !== null && minSizeOverride !== void 0 ? minSizeOverride : minSizeFromProps;
|
|
1678
1689
|
if (fuzzyNumbersEqual$1(panelSize, collapsedSize)) {
|
|
1679
1690
|
// Restore this panel to the size it was before it was collapsed, if possible.
|
|
1680
1691
|
const prevPanelSize = panelSizeBeforeCollapseRef.current.get(panelData.id);
|
|
@@ -2083,7 +2094,9 @@ function PanelResizeHandle({
|
|
|
2083
2094
|
disabled = false,
|
|
2084
2095
|
hitAreaMargins,
|
|
2085
2096
|
id: idFromProps,
|
|
2097
|
+
onBlur,
|
|
2086
2098
|
onDragging,
|
|
2099
|
+
onFocus,
|
|
2087
2100
|
style: styleFromProps = {},
|
|
2088
2101
|
tabIndex = 0,
|
|
2089
2102
|
tagName: Type = "div",
|
|
@@ -2200,8 +2213,14 @@ function PanelResizeHandle({
|
|
|
2200
2213
|
children,
|
|
2201
2214
|
className: classNameFromProps,
|
|
2202
2215
|
id: idFromProps,
|
|
2203
|
-
onBlur: () =>
|
|
2204
|
-
|
|
2216
|
+
onBlur: () => {
|
|
2217
|
+
setIsFocused(false);
|
|
2218
|
+
onBlur === null || onBlur === void 0 ? void 0 : onBlur();
|
|
2219
|
+
},
|
|
2220
|
+
onFocus: () => {
|
|
2221
|
+
setIsFocused(true);
|
|
2222
|
+
onFocus === null || onFocus === void 0 ? void 0 : onFocus();
|
|
2223
|
+
},
|
|
2205
2224
|
ref: elementRef,
|
|
2206
2225
|
role: "separator",
|
|
2207
2226
|
style: {
|