react-resizable-panels 2.1.7 → 2.1.9
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/LICENSE +21 -0
- package/README.md +4 -0
- package/dist/declarations/src/Panel.d.ts +1 -1
- package/dist/declarations/src/PanelGroup.d.ts +1 -1
- package/dist/declarations/src/PanelResizeHandle.d.ts +6 -3
- package/dist/declarations/src/constants.d.ts +15 -0
- package/dist/declarations/src/index.d.ts +3 -2
- package/dist/react-resizable-panels.browser.cjs.js +202 -176
- package/dist/react-resizable-panels.browser.cjs.mjs +1 -0
- package/dist/react-resizable-panels.browser.development.cjs.js +202 -176
- package/dist/react-resizable-panels.browser.development.cjs.mjs +1 -0
- package/dist/react-resizable-panels.browser.development.esm.js +150 -124
- package/dist/react-resizable-panels.browser.esm.js +150 -124
- package/dist/react-resizable-panels.cjs.js +202 -176
- package/dist/react-resizable-panels.cjs.mjs +1 -0
- package/dist/react-resizable-panels.development.cjs.js +202 -176
- package/dist/react-resizable-panels.development.cjs.mjs +1 -0
- package/dist/react-resizable-panels.development.esm.js +150 -124
- package/dist/react-resizable-panels.development.node.cjs.js +201 -174
- package/dist/react-resizable-panels.development.node.cjs.mjs +1 -0
- package/dist/react-resizable-panels.development.node.esm.js +149 -122
- package/dist/react-resizable-panels.esm.js +150 -124
- package/dist/react-resizable-panels.node.cjs.js +201 -174
- package/dist/react-resizable-panels.node.cjs.mjs +1 -0
- package/dist/react-resizable-panels.node.esm.js +149 -122
- package/package.json +12 -13
- package/dist/declarations/src/vendor/react.d.ts +0 -7
|
@@ -1,32 +1,28 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
|
|
3
|
-
// This module exists to work around Webpack issue https://github.com/webpack/webpack/issues/14814
|
|
4
|
-
|
|
5
|
-
// eslint-disable-next-line no-restricted-imports
|
|
6
|
-
|
|
7
|
-
const {
|
|
8
|
-
createElement,
|
|
9
|
-
createContext,
|
|
10
|
-
createRef,
|
|
11
|
-
forwardRef,
|
|
12
|
-
useCallback,
|
|
13
|
-
useContext,
|
|
14
|
-
useEffect,
|
|
15
|
-
useImperativeHandle,
|
|
16
|
-
useLayoutEffect,
|
|
17
|
-
useMemo,
|
|
18
|
-
useRef,
|
|
19
|
-
useState
|
|
20
|
-
} = React;
|
|
21
|
-
|
|
22
|
-
// `Math.random()` and `.slice(0, 5)` prevents bundlers from trying to `import { useId } from 'react'`
|
|
23
|
-
const useId = React[`useId${Math.random()}`.slice(0, 5)];
|
|
2
|
+
import { createContext, useRef, forwardRef, createElement, useContext, useImperativeHandle, useState, useCallback, useEffect, useMemo } from 'react';
|
|
24
3
|
|
|
25
4
|
// The "contextmenu" event is not supported as a PointerEvent in all browsers yet, so MouseEvent still need to be handled
|
|
26
5
|
|
|
27
6
|
const PanelGroupContext = createContext(null);
|
|
28
7
|
PanelGroupContext.displayName = "PanelGroupContext";
|
|
29
8
|
|
|
9
|
+
const DATA_ATTRIBUTES = {
|
|
10
|
+
group: "data-panel-group",
|
|
11
|
+
groupDirection: "data-panel-group-direction",
|
|
12
|
+
groupId: "data-panel-group-id",
|
|
13
|
+
panel: "data-panel",
|
|
14
|
+
panelCollapsible: "data-panel-collapsible",
|
|
15
|
+
panelId: "data-panel-id",
|
|
16
|
+
panelSize: "data-panel-size",
|
|
17
|
+
resizeHandle: "data-resize-handle",
|
|
18
|
+
resizeHandleActive: "data-resize-handle-active",
|
|
19
|
+
resizeHandleEnabled: "data-panel-resize-handle-enabled",
|
|
20
|
+
resizeHandleId: "data-panel-resize-handle-id",
|
|
21
|
+
resizeHandleState: "data-resize-handle-state"
|
|
22
|
+
};
|
|
23
|
+
const PRECISION = 10;
|
|
24
|
+
|
|
25
|
+
const useId = React["useId".toString()];
|
|
30
26
|
const wrappedUseId = typeof useId === "function" ? useId : () => null;
|
|
31
27
|
let counter = 0;
|
|
32
28
|
function useUniqueId(idFromParams = null) {
|
|
@@ -121,17 +117,17 @@ function PanelWithForwardedRef({
|
|
|
121
117
|
...rest,
|
|
122
118
|
children,
|
|
123
119
|
className: classNameFromProps,
|
|
124
|
-
id:
|
|
120
|
+
id: panelId,
|
|
125
121
|
style: {
|
|
126
122
|
...style,
|
|
127
123
|
...styleFromProps
|
|
128
124
|
},
|
|
129
125
|
// CSS selectors
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
126
|
+
[DATA_ATTRIBUTES.groupId]: groupId,
|
|
127
|
+
[DATA_ATTRIBUTES.panel]: "",
|
|
128
|
+
[DATA_ATTRIBUTES.panelCollapsible]: collapsible || undefined,
|
|
129
|
+
[DATA_ATTRIBUTES.panelId]: panelId,
|
|
130
|
+
[DATA_ATTRIBUTES.panelSize]: parseFloat("" + style.flexGrow).toFixed(1)
|
|
135
131
|
});
|
|
136
132
|
}
|
|
137
133
|
const Panel = forwardRef((props, ref) => createElement(PanelWithForwardedRef, {
|
|
@@ -151,6 +147,7 @@ function setNonce(value) {
|
|
|
151
147
|
|
|
152
148
|
let currentCursorStyle = null;
|
|
153
149
|
let enabled = true;
|
|
150
|
+
let prevRuleIndex = -1;
|
|
154
151
|
let styleElement = null;
|
|
155
152
|
function disableGlobalCursorStyles() {
|
|
156
153
|
enabled = false;
|
|
@@ -200,9 +197,11 @@ function resetGlobalCursorStyle() {
|
|
|
200
197
|
document.head.removeChild(styleElement);
|
|
201
198
|
currentCursorStyle = null;
|
|
202
199
|
styleElement = null;
|
|
200
|
+
prevRuleIndex = -1;
|
|
203
201
|
}
|
|
204
202
|
}
|
|
205
203
|
function setGlobalCursorStyle(state, constraintFlags) {
|
|
204
|
+
var _styleElement$sheet$i, _styleElement$sheet2;
|
|
206
205
|
if (!enabled) {
|
|
207
206
|
return;
|
|
208
207
|
}
|
|
@@ -219,7 +218,11 @@ function setGlobalCursorStyle(state, constraintFlags) {
|
|
|
219
218
|
}
|
|
220
219
|
document.head.appendChild(styleElement);
|
|
221
220
|
}
|
|
222
|
-
|
|
221
|
+
if (prevRuleIndex >= 0) {
|
|
222
|
+
var _styleElement$sheet;
|
|
223
|
+
(_styleElement$sheet = styleElement.sheet) === null || _styleElement$sheet === void 0 ? void 0 : _styleElement$sheet.removeRule(prevRuleIndex);
|
|
224
|
+
}
|
|
225
|
+
prevRuleIndex = (_styleElement$sheet$i = (_styleElement$sheet2 = styleElement.sheet) === null || _styleElement$sheet2 === void 0 ? void 0 : _styleElement$sheet2.insertRule(`*{cursor: ${style} !important;}`)) !== null && _styleElement$sheet$i !== void 0 ? _styleElement$sheet$i : -1;
|
|
223
226
|
}
|
|
224
227
|
|
|
225
228
|
function isKeyDown(event) {
|
|
@@ -450,7 +453,9 @@ function handlePointerDown(event) {
|
|
|
450
453
|
if (intersectingHandles.length > 0) {
|
|
451
454
|
updateResizeHandlerStates("down", event);
|
|
452
455
|
event.preventDefault();
|
|
453
|
-
|
|
456
|
+
if (!isWithinResizeHandle(target)) {
|
|
457
|
+
event.stopImmediatePropagation();
|
|
458
|
+
}
|
|
454
459
|
}
|
|
455
460
|
}
|
|
456
461
|
function handlePointerMove(event) {
|
|
@@ -499,6 +504,9 @@ function handlePointerUp(event) {
|
|
|
499
504
|
isPointerDown = false;
|
|
500
505
|
if (intersectingHandles.length > 0) {
|
|
501
506
|
event.preventDefault();
|
|
507
|
+
if (!isWithinResizeHandle(target)) {
|
|
508
|
+
event.stopImmediatePropagation();
|
|
509
|
+
}
|
|
502
510
|
}
|
|
503
511
|
updateResizeHandlerStates("up", event);
|
|
504
512
|
recalculateIntersectingHandles({
|
|
@@ -509,6 +517,16 @@ function handlePointerUp(event) {
|
|
|
509
517
|
updateCursor();
|
|
510
518
|
updateListeners();
|
|
511
519
|
}
|
|
520
|
+
function isWithinResizeHandle(element) {
|
|
521
|
+
let currentElement = element;
|
|
522
|
+
while (currentElement) {
|
|
523
|
+
if (currentElement.hasAttribute(DATA_ATTRIBUTES.resizeHandle)) {
|
|
524
|
+
return true;
|
|
525
|
+
}
|
|
526
|
+
currentElement = currentElement.parentElement;
|
|
527
|
+
}
|
|
528
|
+
return false;
|
|
529
|
+
}
|
|
512
530
|
function recalculateIntersectingHandles({
|
|
513
531
|
target,
|
|
514
532
|
x,
|
|
@@ -600,47 +618,42 @@ function updateCursor() {
|
|
|
600
618
|
resetGlobalCursorStyle();
|
|
601
619
|
}
|
|
602
620
|
}
|
|
621
|
+
let listenersAbortController = new AbortController();
|
|
603
622
|
function updateListeners() {
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
}
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
if (registeredResizeHandlers.size > 0) {
|
|
616
|
-
if (isPointerDown) {
|
|
617
|
-
if (intersectingHandles.length > 0) {
|
|
618
|
-
ownerDocumentCounts.forEach((count, ownerDocument) => {
|
|
619
|
-
const {
|
|
620
|
-
body
|
|
621
|
-
} = ownerDocument;
|
|
622
|
-
if (count > 0) {
|
|
623
|
-
body.addEventListener("contextmenu", handlePointerUp);
|
|
624
|
-
body.addEventListener("pointerleave", handlePointerMove);
|
|
625
|
-
body.addEventListener("pointermove", handlePointerMove);
|
|
626
|
-
}
|
|
627
|
-
});
|
|
628
|
-
}
|
|
629
|
-
window.addEventListener("pointerup", handlePointerUp);
|
|
630
|
-
window.addEventListener("pointercancel", handlePointerUp);
|
|
631
|
-
} else {
|
|
623
|
+
listenersAbortController.abort();
|
|
624
|
+
listenersAbortController = new AbortController();
|
|
625
|
+
const options = {
|
|
626
|
+
capture: true,
|
|
627
|
+
signal: listenersAbortController.signal
|
|
628
|
+
};
|
|
629
|
+
if (!registeredResizeHandlers.size) {
|
|
630
|
+
return;
|
|
631
|
+
}
|
|
632
|
+
if (isPointerDown) {
|
|
633
|
+
if (intersectingHandles.length > 0) {
|
|
632
634
|
ownerDocumentCounts.forEach((count, ownerDocument) => {
|
|
633
635
|
const {
|
|
634
636
|
body
|
|
635
637
|
} = ownerDocument;
|
|
636
638
|
if (count > 0) {
|
|
637
|
-
body.addEventListener("
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
body.addEventListener("pointermove", handlePointerMove);
|
|
639
|
+
body.addEventListener("contextmenu", handlePointerUp, options);
|
|
640
|
+
body.addEventListener("pointerleave", handlePointerMove, options);
|
|
641
|
+
body.addEventListener("pointermove", handlePointerMove, options);
|
|
641
642
|
}
|
|
642
643
|
});
|
|
643
644
|
}
|
|
645
|
+
window.addEventListener("pointerup", handlePointerUp, options);
|
|
646
|
+
window.addEventListener("pointercancel", handlePointerUp, options);
|
|
647
|
+
} else {
|
|
648
|
+
ownerDocumentCounts.forEach((count, ownerDocument) => {
|
|
649
|
+
const {
|
|
650
|
+
body
|
|
651
|
+
} = ownerDocument;
|
|
652
|
+
if (count > 0) {
|
|
653
|
+
body.addEventListener("pointerdown", handlePointerDown, options);
|
|
654
|
+
body.addEventListener("pointermove", handlePointerMove, options);
|
|
655
|
+
}
|
|
656
|
+
});
|
|
644
657
|
}
|
|
645
658
|
}
|
|
646
659
|
function updateResizeHandlerStates(action, event) {
|
|
@@ -665,8 +678,6 @@ function assert(expectedCondition, message) {
|
|
|
665
678
|
}
|
|
666
679
|
}
|
|
667
680
|
|
|
668
|
-
const PRECISION = 10;
|
|
669
|
-
|
|
670
681
|
function fuzzyCompareNumbers(actual, expected, fractionDigits = PRECISION) {
|
|
671
682
|
if (actual.toFixed(fractionDigits) === expected.toFixed(fractionDigits)) {
|
|
672
683
|
return 0;
|
|
@@ -971,12 +982,12 @@ function adjustLayoutByDelta({
|
|
|
971
982
|
}
|
|
972
983
|
|
|
973
984
|
function getResizeHandleElementsForGroup(groupId, scope = document) {
|
|
974
|
-
return Array.from(scope.querySelectorAll(`[
|
|
985
|
+
return Array.from(scope.querySelectorAll(`[${DATA_ATTRIBUTES.resizeHandleId}][data-panel-group-id="${groupId}"]`));
|
|
975
986
|
}
|
|
976
987
|
|
|
977
988
|
function getResizeHandleElementIndex(groupId, id, scope = document) {
|
|
978
989
|
const handles = getResizeHandleElementsForGroup(groupId, scope);
|
|
979
|
-
const index = handles.findIndex(handle => handle.getAttribute(
|
|
990
|
+
const index = handles.findIndex(handle => handle.getAttribute(DATA_ATTRIBUTES.resizeHandleId) === id);
|
|
980
991
|
return index !== null && index !== void 0 ? index : null;
|
|
981
992
|
}
|
|
982
993
|
|
|
@@ -1001,7 +1012,7 @@ function getPanelGroupElement(id, rootElement = document) {
|
|
|
1001
1012
|
}
|
|
1002
1013
|
|
|
1003
1014
|
function getResizeHandleElement(id, scope = document) {
|
|
1004
|
-
const element = scope.querySelector(`[
|
|
1015
|
+
const element = scope.querySelector(`[${DATA_ATTRIBUTES.resizeHandleId}="${id}"]`);
|
|
1005
1016
|
if (element) {
|
|
1006
1017
|
return element;
|
|
1007
1018
|
}
|
|
@@ -1046,7 +1057,7 @@ function useWindowSplitterPanelGroupBehavior({
|
|
|
1046
1057
|
const handles = getResizeHandleElementsForGroup(groupId, panelGroupElement);
|
|
1047
1058
|
assert(handles, `No resize handles found for group id "${groupId}"`);
|
|
1048
1059
|
const cleanupFunctions = handles.map(handle => {
|
|
1049
|
-
const handleId = handle.getAttribute(
|
|
1060
|
+
const handleId = handle.getAttribute(DATA_ATTRIBUTES.resizeHandleId);
|
|
1050
1061
|
assert(handleId, `Resize handle element has no handle id attribute`);
|
|
1051
1062
|
const [idBefore, idAfter] = getResizeHandlePanelIds(groupId, handleId, panelDataArray, panelGroupElement);
|
|
1052
1063
|
if (idBefore == null || idAfter == null) {
|
|
@@ -1124,7 +1135,7 @@ function calculateDragOffsetPercentage(event, dragHandleId, direction, initialDr
|
|
|
1124
1135
|
const isHorizontal = direction === "horizontal";
|
|
1125
1136
|
const handleElement = getResizeHandleElement(dragHandleId, panelGroupElement);
|
|
1126
1137
|
assert(handleElement, `No resize handle element found for id "${dragHandleId}"`);
|
|
1127
|
-
const groupId = handleElement.getAttribute(
|
|
1138
|
+
const groupId = handleElement.getAttribute(DATA_ATTRIBUTES.groupId);
|
|
1128
1139
|
assert(groupId, `Resize handle element has no group id attribute`);
|
|
1129
1140
|
let {
|
|
1130
1141
|
initialCursorPosition
|
|
@@ -1929,9 +1940,9 @@ function PanelGroupWithForwardedRef({
|
|
|
1929
1940
|
...styleFromProps
|
|
1930
1941
|
},
|
|
1931
1942
|
// CSS selectors
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1943
|
+
[DATA_ATTRIBUTES.group]: "",
|
|
1944
|
+
[DATA_ATTRIBUTES.groupDirection]: direction,
|
|
1945
|
+
[DATA_ATTRIBUTES.groupId]: groupId
|
|
1935
1946
|
}));
|
|
1936
1947
|
}
|
|
1937
1948
|
const PanelGroup = forwardRef((props, ref) => createElement(PanelGroupWithForwardedRef, {
|
|
@@ -1990,7 +2001,7 @@ function useWindowSplitterResizeHandlerBehavior({
|
|
|
1990
2001
|
case "F6":
|
|
1991
2002
|
{
|
|
1992
2003
|
event.preventDefault();
|
|
1993
|
-
const groupId = handleElement.getAttribute(
|
|
2004
|
+
const groupId = handleElement.getAttribute(DATA_ATTRIBUTES.groupId);
|
|
1994
2005
|
assert(groupId, `No group element found for id "${groupId}"`);
|
|
1995
2006
|
const handles = getResizeHandleElementsForGroup(groupId, panelGroupElement);
|
|
1996
2007
|
const index = getResizeHandleElementIndex(groupId, handleId, panelGroupElement);
|
|
@@ -2016,8 +2027,11 @@ function PanelResizeHandle({
|
|
|
2016
2027
|
hitAreaMargins,
|
|
2017
2028
|
id: idFromProps,
|
|
2018
2029
|
onBlur,
|
|
2030
|
+
onClick,
|
|
2019
2031
|
onDragging,
|
|
2020
2032
|
onFocus,
|
|
2033
|
+
onPointerDown,
|
|
2034
|
+
onPointerUp,
|
|
2021
2035
|
style: styleFromProps = {},
|
|
2022
2036
|
tabIndex = 0,
|
|
2023
2037
|
tagName: Type = "div",
|
|
@@ -2028,10 +2042,16 @@ function PanelResizeHandle({
|
|
|
2028
2042
|
|
|
2029
2043
|
// Use a ref to guard against users passing inline props
|
|
2030
2044
|
const callbacksRef = useRef({
|
|
2031
|
-
|
|
2045
|
+
onClick,
|
|
2046
|
+
onDragging,
|
|
2047
|
+
onPointerDown,
|
|
2048
|
+
onPointerUp
|
|
2032
2049
|
});
|
|
2033
2050
|
useEffect(() => {
|
|
2051
|
+
callbacksRef.current.onClick = onClick;
|
|
2034
2052
|
callbacksRef.current.onDragging = onDragging;
|
|
2053
|
+
callbacksRef.current.onPointerDown = onPointerDown;
|
|
2054
|
+
callbacksRef.current.onPointerUp = onPointerUp;
|
|
2035
2055
|
});
|
|
2036
2056
|
const panelGroupContext = useContext(PanelGroupContext);
|
|
2037
2057
|
if (panelGroupContext === null) {
|
|
@@ -2071,49 +2091,56 @@ function PanelResizeHandle({
|
|
|
2071
2091
|
}
|
|
2072
2092
|
const element = elementRef.current;
|
|
2073
2093
|
assert(element, "Element ref not attached");
|
|
2094
|
+
let didMove = false;
|
|
2074
2095
|
const setResizeHandlerState = (action, isActive, event) => {
|
|
2075
|
-
if (isActive) {
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
}
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
}
|
|
2102
|
-
case "up":
|
|
2103
|
-
{
|
|
2096
|
+
if (!isActive) {
|
|
2097
|
+
setState("inactive");
|
|
2098
|
+
return;
|
|
2099
|
+
}
|
|
2100
|
+
switch (action) {
|
|
2101
|
+
case "down":
|
|
2102
|
+
{
|
|
2103
|
+
setState("drag");
|
|
2104
|
+
didMove = false;
|
|
2105
|
+
assert(event, 'Expected event to be defined for "down" action');
|
|
2106
|
+
startDragging(resizeHandleId, event);
|
|
2107
|
+
const {
|
|
2108
|
+
onDragging,
|
|
2109
|
+
onPointerDown
|
|
2110
|
+
} = callbacksRef.current;
|
|
2111
|
+
onDragging === null || onDragging === void 0 ? void 0 : onDragging(true);
|
|
2112
|
+
onPointerDown === null || onPointerDown === void 0 ? void 0 : onPointerDown();
|
|
2113
|
+
break;
|
|
2114
|
+
}
|
|
2115
|
+
case "move":
|
|
2116
|
+
{
|
|
2117
|
+
const {
|
|
2118
|
+
state
|
|
2119
|
+
} = committedValuesRef.current;
|
|
2120
|
+
didMove = true;
|
|
2121
|
+
if (state !== "drag") {
|
|
2104
2122
|
setState("hover");
|
|
2105
|
-
stopDragging();
|
|
2106
|
-
const {
|
|
2107
|
-
onDragging
|
|
2108
|
-
} = callbacksRef.current;
|
|
2109
|
-
if (onDragging) {
|
|
2110
|
-
onDragging(false);
|
|
2111
|
-
}
|
|
2112
|
-
break;
|
|
2113
2123
|
}
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2124
|
+
assert(event, 'Expected event to be defined for "move" action');
|
|
2125
|
+
resizeHandler(event);
|
|
2126
|
+
break;
|
|
2127
|
+
}
|
|
2128
|
+
case "up":
|
|
2129
|
+
{
|
|
2130
|
+
setState("hover");
|
|
2131
|
+
stopDragging();
|
|
2132
|
+
const {
|
|
2133
|
+
onClick,
|
|
2134
|
+
onDragging,
|
|
2135
|
+
onPointerUp
|
|
2136
|
+
} = callbacksRef.current;
|
|
2137
|
+
onDragging === null || onDragging === void 0 ? void 0 : onDragging(false);
|
|
2138
|
+
onPointerUp === null || onPointerUp === void 0 ? void 0 : onPointerUp();
|
|
2139
|
+
if (!didMove) {
|
|
2140
|
+
onClick === null || onClick === void 0 ? void 0 : onClick();
|
|
2141
|
+
}
|
|
2142
|
+
break;
|
|
2143
|
+
}
|
|
2117
2144
|
}
|
|
2118
2145
|
};
|
|
2119
2146
|
return registerResizeHandle(resizeHandleId, element, direction, {
|
|
@@ -2152,13 +2179,13 @@ function PanelResizeHandle({
|
|
|
2152
2179
|
},
|
|
2153
2180
|
tabIndex,
|
|
2154
2181
|
// CSS selectors
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2182
|
+
[DATA_ATTRIBUTES.groupDirection]: direction,
|
|
2183
|
+
[DATA_ATTRIBUTES.groupId]: groupId,
|
|
2184
|
+
[DATA_ATTRIBUTES.resizeHandle]: "",
|
|
2185
|
+
[DATA_ATTRIBUTES.resizeHandleActive]: state === "drag" ? "pointer" : isFocused ? "keyboard" : undefined,
|
|
2186
|
+
[DATA_ATTRIBUTES.resizeHandleEnabled]: !disabled,
|
|
2187
|
+
[DATA_ATTRIBUTES.resizeHandleId]: resizeHandleId,
|
|
2188
|
+
[DATA_ATTRIBUTES.resizeHandleState]: state
|
|
2162
2189
|
});
|
|
2163
2190
|
}
|
|
2164
2191
|
PanelResizeHandle.displayName = "PanelResizeHandle";
|
|
@@ -2192,4 +2219,4 @@ function getIntersectingRectangle(rectOne, rectTwo, strict) {
|
|
|
2192
2219
|
};
|
|
2193
2220
|
}
|
|
2194
2221
|
|
|
2195
|
-
export { Panel, PanelGroup, PanelResizeHandle, assert, disableGlobalCursorStyles, enableGlobalCursorStyles, getIntersectingRectangle, getPanelElement, getPanelElementsForGroup, getPanelGroupElement, getResizeHandleElement, getResizeHandleElementIndex, getResizeHandleElementsForGroup, getResizeHandlePanelIds, intersects, setNonce };
|
|
2222
|
+
export { DATA_ATTRIBUTES, Panel, PanelGroup, PanelResizeHandle, assert, disableGlobalCursorStyles, enableGlobalCursorStyles, getIntersectingRectangle, getPanelElement, getPanelElementsForGroup, getPanelGroupElement, getResizeHandleElement, getResizeHandleElementIndex, getResizeHandleElementsForGroup, getResizeHandlePanelIds, intersects, setNonce };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-resizable-panels",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.9",
|
|
4
4
|
"description": "React components for resizable panel groups/layouts",
|
|
5
5
|
"author": "Brian Vaughn <brian.david.vaughn@gmail.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -66,20 +66,10 @@
|
|
|
66
66
|
}
|
|
67
67
|
},
|
|
68
68
|
"types": "dist/react-resizable-panels.cjs.d.ts",
|
|
69
|
-
"scripts": {
|
|
70
|
-
"clear": "pnpm run clear:builds & pnpm run clear:node_modules",
|
|
71
|
-
"clear:builds": "rm -rf ./packages/*/dist",
|
|
72
|
-
"clear:node_modules": "rm -rf ./node_modules",
|
|
73
|
-
"lint": "eslint \"src/**/*.{ts,tsx}\"",
|
|
74
|
-
"test": "jest --config=jest.config.js",
|
|
75
|
-
"test:watch": "jest --config=jest.config.js --watch",
|
|
76
|
-
"watch": "parcel watch --port=2345"
|
|
77
|
-
},
|
|
78
69
|
"devDependencies": {
|
|
79
70
|
"@babel/plugin-proposal-nullish-coalescing-operator": "7.18.6",
|
|
80
71
|
"@babel/plugin-proposal-optional-chaining": "7.21.0",
|
|
81
72
|
"eslint": "^8.37.0",
|
|
82
|
-
"eslint-plugin-no-restricted-imports": "^0.0.0",
|
|
83
73
|
"eslint-plugin-react-hooks": "^4.6.0",
|
|
84
74
|
"jest": "^29.7.0",
|
|
85
75
|
"jest-environment-jsdom": "^29.7.0",
|
|
@@ -92,5 +82,14 @@
|
|
|
92
82
|
},
|
|
93
83
|
"browserslist": [
|
|
94
84
|
"Chrome 79"
|
|
95
|
-
]
|
|
96
|
-
|
|
85
|
+
],
|
|
86
|
+
"scripts": {
|
|
87
|
+
"clear": "pnpm run clear:builds & pnpm run clear:node_modules",
|
|
88
|
+
"clear:builds": "rm -rf ./packages/*/dist",
|
|
89
|
+
"clear:node_modules": "rm -rf ./node_modules",
|
|
90
|
+
"lint": "eslint \"src/**/*.{ts,tsx}\"",
|
|
91
|
+
"test": "jest --config=jest.config.js",
|
|
92
|
+
"test:watch": "jest --config=jest.config.js --watch",
|
|
93
|
+
"watch": "parcel watch --port=2345"
|
|
94
|
+
}
|
|
95
|
+
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import type { CSSProperties, ElementType, ForwardedRef, HTMLAttributes, MouseEvent, PropsWithChildren, ReactElement, ReactNode, RefObject, TouchEvent } from "react";
|
|
3
|
-
declare const createElement: typeof React.createElement, createContext: typeof React.createContext, createRef: typeof React.createRef, forwardRef: typeof React.forwardRef, useCallback: typeof React.useCallback, useContext: typeof React.useContext, useEffect: typeof React.useEffect, useImperativeHandle: typeof React.useImperativeHandle, useMemo: typeof React.useMemo, useRef: typeof React.useRef, useState: typeof React.useState;
|
|
4
|
-
declare const useId: () => string;
|
|
5
|
-
declare const useLayoutEffect_do_not_use_directly: typeof React.useLayoutEffect;
|
|
6
|
-
export { createElement, createContext, createRef, forwardRef, useCallback, useContext, useEffect, useId, useImperativeHandle, useLayoutEffect_do_not_use_directly, useMemo, useRef, useState, };
|
|
7
|
-
export type { CSSProperties, ElementType, ForwardedRef, HTMLAttributes, MouseEvent, PropsWithChildren, ReactElement, ReactNode, RefObject, TouchEvent, };
|