react-resizable-panels 2.1.7 → 2.1.8

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.
@@ -24,41 +24,19 @@ function _interopNamespace(e) {
24
24
 
25
25
  var React__namespace = /*#__PURE__*/_interopNamespace(React);
26
26
 
27
- // This module exists to work around Webpack issue https://github.com/webpack/webpack/issues/14814
28
-
29
- // eslint-disable-next-line no-restricted-imports
30
-
31
- const {
32
- createElement,
33
- createContext,
34
- createRef,
35
- forwardRef,
36
- useCallback,
37
- useContext,
38
- useEffect,
39
- useImperativeHandle,
40
- useLayoutEffect,
41
- useMemo,
42
- useRef,
43
- useState
44
- } = React__namespace;
45
-
46
- // `Math.random()` and `.slice(0, 5)` prevents bundlers from trying to `import { useId } from 'react'`
47
- const useId = React__namespace[`useId${Math.random()}`.slice(0, 5)];
48
- const useLayoutEffect_do_not_use_directly = useLayoutEffect;
49
-
50
27
  // The "contextmenu" event is not supported as a PointerEvent in all browsers yet, so MouseEvent still need to be handled
51
28
 
52
- const PanelGroupContext = createContext(null);
29
+ const PanelGroupContext = React.createContext(null);
53
30
  PanelGroupContext.displayName = "PanelGroupContext";
54
31
 
55
- const useIsomorphicLayoutEffect = useLayoutEffect_do_not_use_directly ;
32
+ const useIsomorphicLayoutEffect = React.useLayoutEffect ;
56
33
 
34
+ const useId = React__namespace["useId".toString()];
57
35
  const wrappedUseId = typeof useId === "function" ? useId : () => null;
58
36
  let counter = 0;
59
37
  function useUniqueId(idFromParams = null) {
60
38
  const idFromUseId = wrappedUseId();
61
- const idRef = useRef(idFromParams || idFromUseId || null);
39
+ const idRef = React.useRef(idFromParams || idFromUseId || null);
62
40
  if (idRef.current === null) {
63
41
  idRef.current = "" + counter++;
64
42
  }
@@ -83,7 +61,7 @@ function PanelWithForwardedRef({
83
61
  tagName: Type = "div",
84
62
  ...rest
85
63
  }) {
86
- const context = useContext(PanelGroupContext);
64
+ const context = React.useContext(PanelGroupContext);
87
65
  if (context === null) {
88
66
  throw Error(`Panel components must be rendered within a PanelGroup container`);
89
67
  }
@@ -100,7 +78,7 @@ function PanelWithForwardedRef({
100
78
  unregisterPanel
101
79
  } = context;
102
80
  const panelId = useUniqueId(idFromProps);
103
- const panelDataRef = useRef({
81
+ const panelDataRef = React.useRef({
104
82
  callbacks: {
105
83
  onCollapse,
106
84
  onExpand,
@@ -117,7 +95,7 @@ function PanelWithForwardedRef({
117
95
  idIsFromProps: idFromProps !== undefined,
118
96
  order
119
97
  });
120
- const devWarningsRef = useRef({
98
+ const devWarningsRef = React.useRef({
121
99
  didLogMissingDefaultSizeWarning: false
122
100
  });
123
101
 
@@ -159,7 +137,7 @@ function PanelWithForwardedRef({
159
137
  unregisterPanel(panelData);
160
138
  };
161
139
  }, [order, panelId, registerPanel, unregisterPanel]);
162
- useImperativeHandle(forwardedRef, () => ({
140
+ React.useImperativeHandle(forwardedRef, () => ({
163
141
  collapse: () => {
164
142
  collapsePanel(panelDataRef.current);
165
143
  },
@@ -183,11 +161,11 @@ function PanelWithForwardedRef({
183
161
  }
184
162
  }), [collapsePanel, expandPanel, getPanelSize, isPanelCollapsed, panelId, resizePanel]);
185
163
  const style = getPanelStyle(panelDataRef.current, defaultSize);
186
- return createElement(Type, {
164
+ return React.createElement(Type, {
187
165
  ...rest,
188
166
  children,
189
167
  className: classNameFromProps,
190
- id: idFromProps,
168
+ id: panelId,
191
169
  style: {
192
170
  ...style,
193
171
  ...styleFromProps
@@ -200,7 +178,7 @@ function PanelWithForwardedRef({
200
178
  "data-panel-size": parseFloat("" + style.flexGrow).toFixed(1)
201
179
  });
202
180
  }
203
- const Panel = forwardRef((props, ref) => createElement(PanelWithForwardedRef, {
181
+ const Panel = React.forwardRef((props, ref) => React.createElement(PanelWithForwardedRef, {
204
182
  ...props,
205
183
  forwardedRef: ref
206
184
  }));
@@ -672,7 +650,9 @@ function updateListeners() {
672
650
  body
673
651
  } = ownerDocument;
674
652
  body.removeEventListener("contextmenu", handlePointerUp);
675
- body.removeEventListener("pointerdown", handlePointerDown);
653
+ body.removeEventListener("pointerdown", handlePointerDown, {
654
+ capture: true
655
+ });
676
656
  body.removeEventListener("pointerleave", handlePointerMove);
677
657
  body.removeEventListener("pointermove", handlePointerMove);
678
658
  });
@@ -720,8 +700,8 @@ function updateResizeHandlerStates(action, event) {
720
700
  }
721
701
 
722
702
  function useForceUpdate() {
723
- const [_, setCount] = useState(0);
724
- return useCallback(() => setCount(prevCount => prevCount + 1), []);
703
+ const [_, setCount] = React.useState(0);
704
+ return React.useCallback(() => setCount(prevCount => prevCount + 1), []);
725
705
  }
726
706
 
727
707
  function assert(expectedCondition, message) {
@@ -1134,7 +1114,7 @@ function useWindowSplitterPanelGroupBehavior({
1134
1114
  panelGroupElement,
1135
1115
  setLayout
1136
1116
  }) {
1137
- const devWarningsRef = useRef({
1117
+ const devWarningsRef = React.useRef({
1138
1118
  didWarnAboutMissingResizeHandle: false
1139
1119
  });
1140
1120
  useIsomorphicLayoutEffect(() => {
@@ -1181,7 +1161,7 @@ function useWindowSplitterPanelGroupBehavior({
1181
1161
  });
1182
1162
  };
1183
1163
  }, [groupId, layout, panelDataArray, panelGroupElement]);
1184
- useEffect(() => {
1164
+ React.useEffect(() => {
1185
1165
  if (!panelGroupElement) {
1186
1166
  return;
1187
1167
  }
@@ -1688,14 +1668,14 @@ function PanelGroupWithForwardedRef({
1688
1668
  ...rest
1689
1669
  }) {
1690
1670
  const groupId = useUniqueId(idFromProps);
1691
- const panelGroupElementRef = useRef(null);
1692
- const [dragState, setDragState] = useState(null);
1693
- const [layout, setLayout] = useState([]);
1671
+ const panelGroupElementRef = React.useRef(null);
1672
+ const [dragState, setDragState] = React.useState(null);
1673
+ const [layout, setLayout] = React.useState([]);
1694
1674
  const forceUpdate = useForceUpdate();
1695
- const panelIdToLastNotifiedSizeMapRef = useRef({});
1696
- const panelSizeBeforeCollapseRef = useRef(new Map());
1697
- const prevDeltaRef = useRef(0);
1698
- const committedValuesRef = useRef({
1675
+ const panelIdToLastNotifiedSizeMapRef = React.useRef({});
1676
+ const panelSizeBeforeCollapseRef = React.useRef(new Map());
1677
+ const prevDeltaRef = React.useRef(0);
1678
+ const committedValuesRef = React.useRef({
1699
1679
  autoSaveId,
1700
1680
  direction,
1701
1681
  dragState,
@@ -1704,17 +1684,17 @@ function PanelGroupWithForwardedRef({
1704
1684
  onLayout,
1705
1685
  storage
1706
1686
  });
1707
- const eagerValuesRef = useRef({
1687
+ const eagerValuesRef = React.useRef({
1708
1688
  layout,
1709
1689
  panelDataArray: [],
1710
1690
  panelDataArrayChanged: false
1711
1691
  });
1712
- const devWarningsRef = useRef({
1692
+ const devWarningsRef = React.useRef({
1713
1693
  didLogIdAndOrderWarning: false,
1714
1694
  didLogPanelConstraintsWarning: false,
1715
1695
  prevPanelIds: []
1716
1696
  });
1717
- useImperativeHandle(forwardedRef, () => ({
1697
+ React.useImperativeHandle(forwardedRef, () => ({
1718
1698
  getId: () => committedValuesRef.current.id,
1719
1699
  getLayout: () => {
1720
1700
  const {
@@ -1761,7 +1741,7 @@ function PanelGroupWithForwardedRef({
1761
1741
  setLayout,
1762
1742
  panelGroupElement: panelGroupElementRef.current
1763
1743
  });
1764
- useEffect(() => {
1744
+ React.useEffect(() => {
1765
1745
  const {
1766
1746
  panelDataArray
1767
1747
  } = eagerValuesRef.current;
@@ -1788,7 +1768,7 @@ function PanelGroupWithForwardedRef({
1788
1768
  }, [autoSaveId, layout, storage]);
1789
1769
 
1790
1770
  // DEV warnings
1791
- useEffect(() => {
1771
+ React.useEffect(() => {
1792
1772
  {
1793
1773
  const {
1794
1774
  panelDataArray
@@ -1834,7 +1814,7 @@ function PanelGroupWithForwardedRef({
1834
1814
  });
1835
1815
 
1836
1816
  // External APIs are safe to memoize via committed values ref
1837
- const collapsePanel = useCallback(panelData => {
1817
+ const collapsePanel = React.useCallback(panelData => {
1838
1818
  const {
1839
1819
  onLayout
1840
1820
  } = committedValuesRef.current;
@@ -1877,7 +1857,7 @@ function PanelGroupWithForwardedRef({
1877
1857
  }, []);
1878
1858
 
1879
1859
  // External APIs are safe to memoize via committed values ref
1880
- const expandPanel = useCallback((panelData, minSizeOverride) => {
1860
+ const expandPanel = React.useCallback((panelData, minSizeOverride) => {
1881
1861
  const {
1882
1862
  onLayout
1883
1863
  } = committedValuesRef.current;
@@ -1921,7 +1901,7 @@ function PanelGroupWithForwardedRef({
1921
1901
  }, []);
1922
1902
 
1923
1903
  // External APIs are safe to memoize via committed values ref
1924
- const getPanelSize = useCallback(panelData => {
1904
+ const getPanelSize = React.useCallback(panelData => {
1925
1905
  const {
1926
1906
  layout,
1927
1907
  panelDataArray
@@ -1934,7 +1914,7 @@ function PanelGroupWithForwardedRef({
1934
1914
  }, []);
1935
1915
 
1936
1916
  // This API should never read from committedValuesRef
1937
- const getPanelStyle = useCallback((panelData, defaultSize) => {
1917
+ const getPanelStyle = React.useCallback((panelData, defaultSize) => {
1938
1918
  const {
1939
1919
  panelDataArray
1940
1920
  } = eagerValuesRef.current;
@@ -1949,7 +1929,7 @@ function PanelGroupWithForwardedRef({
1949
1929
  }, [dragState, layout]);
1950
1930
 
1951
1931
  // External APIs are safe to memoize via committed values ref
1952
- const isPanelCollapsed = useCallback(panelData => {
1932
+ const isPanelCollapsed = React.useCallback(panelData => {
1953
1933
  const {
1954
1934
  layout,
1955
1935
  panelDataArray
@@ -1964,7 +1944,7 @@ function PanelGroupWithForwardedRef({
1964
1944
  }, []);
1965
1945
 
1966
1946
  // External APIs are safe to memoize via committed values ref
1967
- const isPanelExpanded = useCallback(panelData => {
1947
+ const isPanelExpanded = React.useCallback(panelData => {
1968
1948
  const {
1969
1949
  layout,
1970
1950
  panelDataArray
@@ -1977,7 +1957,7 @@ function PanelGroupWithForwardedRef({
1977
1957
  assert(panelSize != null, `Panel size not found for panel "${panelData.id}"`);
1978
1958
  return !collapsible || fuzzyCompareNumbers(panelSize, collapsedSize) > 0;
1979
1959
  }, []);
1980
- const registerPanel = useCallback(panelData => {
1960
+ const registerPanel = React.useCallback(panelData => {
1981
1961
  const {
1982
1962
  panelDataArray
1983
1963
  } = eagerValuesRef.current;
@@ -2054,7 +2034,7 @@ function PanelGroupWithForwardedRef({
2054
2034
  eagerValues.layout = [];
2055
2035
  };
2056
2036
  }, []);
2057
- const registerResizeHandle = useCallback(dragHandleId => {
2037
+ const registerResizeHandle = React.useCallback(dragHandleId => {
2058
2038
  let isRTL = false;
2059
2039
  const panelGroupElement = panelGroupElementRef.current;
2060
2040
  if (panelGroupElement) {
@@ -2133,7 +2113,7 @@ function PanelGroupWithForwardedRef({
2133
2113
  }, []);
2134
2114
 
2135
2115
  // External APIs are safe to memoize via committed values ref
2136
- const resizePanel = useCallback((panelData, unsafePanelSize) => {
2116
+ const resizePanel = React.useCallback((panelData, unsafePanelSize) => {
2137
2117
  const {
2138
2118
  onLayout
2139
2119
  } = committedValuesRef.current;
@@ -2166,7 +2146,7 @@ function PanelGroupWithForwardedRef({
2166
2146
  callPanelCallbacks(panelDataArray, nextLayout, panelIdToLastNotifiedSizeMapRef.current);
2167
2147
  }
2168
2148
  }, []);
2169
- const reevaluatePanelConstraints = useCallback((panelData, prevConstraints) => {
2149
+ const reevaluatePanelConstraints = React.useCallback((panelData, prevConstraints) => {
2170
2150
  const {
2171
2151
  layout,
2172
2152
  panelDataArray
@@ -2200,7 +2180,7 @@ function PanelGroupWithForwardedRef({
2200
2180
  }, [resizePanel]);
2201
2181
 
2202
2182
  // TODO Multiple drag handles can be active at the same time so this API is a bit awkward now
2203
- const startDragging = useCallback((dragHandleId, event) => {
2183
+ const startDragging = React.useCallback((dragHandleId, event) => {
2204
2184
  const {
2205
2185
  direction
2206
2186
  } = committedValuesRef.current;
@@ -2220,10 +2200,10 @@ function PanelGroupWithForwardedRef({
2220
2200
  initialLayout: layout
2221
2201
  });
2222
2202
  }, []);
2223
- const stopDragging = useCallback(() => {
2203
+ const stopDragging = React.useCallback(() => {
2224
2204
  setDragState(null);
2225
2205
  }, []);
2226
- const unregisterPanel = useCallback(panelData => {
2206
+ const unregisterPanel = React.useCallback(panelData => {
2227
2207
  const {
2228
2208
  panelDataArray
2229
2209
  } = eagerValuesRef.current;
@@ -2240,7 +2220,7 @@ function PanelGroupWithForwardedRef({
2240
2220
  forceUpdate();
2241
2221
  }
2242
2222
  }, [forceUpdate]);
2243
- const context = useMemo(() => ({
2223
+ const context = React.useMemo(() => ({
2244
2224
  collapsePanel,
2245
2225
  direction,
2246
2226
  dragState,
@@ -2266,9 +2246,9 @@ function PanelGroupWithForwardedRef({
2266
2246
  overflow: "hidden",
2267
2247
  width: "100%"
2268
2248
  };
2269
- return createElement(PanelGroupContext.Provider, {
2249
+ return React.createElement(PanelGroupContext.Provider, {
2270
2250
  value: context
2271
- }, createElement(Type, {
2251
+ }, React.createElement(Type, {
2272
2252
  ...rest,
2273
2253
  children,
2274
2254
  className: classNameFromProps,
@@ -2284,7 +2264,7 @@ function PanelGroupWithForwardedRef({
2284
2264
  "data-panel-group-id": groupId
2285
2265
  }));
2286
2266
  }
2287
- const PanelGroup = forwardRef((props, ref) => createElement(PanelGroupWithForwardedRef, {
2267
+ const PanelGroup = React.forwardRef((props, ref) => React.createElement(PanelGroupWithForwardedRef, {
2288
2268
  ...props,
2289
2269
  forwardedRef: ref
2290
2270
  }));
@@ -2313,7 +2293,7 @@ function useWindowSplitterResizeHandlerBehavior({
2313
2293
  resizeHandler,
2314
2294
  panelGroupElement
2315
2295
  }) {
2316
- useEffect(() => {
2296
+ React.useEffect(() => {
2317
2297
  if (disabled || resizeHandler == null || panelGroupElement == null) {
2318
2298
  return;
2319
2299
  }
@@ -2366,24 +2346,33 @@ function PanelResizeHandle({
2366
2346
  hitAreaMargins,
2367
2347
  id: idFromProps,
2368
2348
  onBlur,
2349
+ onClick,
2369
2350
  onDragging,
2370
2351
  onFocus,
2352
+ onPointerDown,
2353
+ onPointerUp,
2371
2354
  style: styleFromProps = {},
2372
2355
  tabIndex = 0,
2373
2356
  tagName: Type = "div",
2374
2357
  ...rest
2375
2358
  }) {
2376
2359
  var _hitAreaMargins$coars, _hitAreaMargins$fine;
2377
- const elementRef = useRef(null);
2360
+ const elementRef = React.useRef(null);
2378
2361
 
2379
2362
  // Use a ref to guard against users passing inline props
2380
- const callbacksRef = useRef({
2381
- onDragging
2363
+ const callbacksRef = React.useRef({
2364
+ onClick,
2365
+ onDragging,
2366
+ onPointerDown,
2367
+ onPointerUp
2382
2368
  });
2383
- useEffect(() => {
2369
+ React.useEffect(() => {
2370
+ callbacksRef.current.onClick = onClick;
2384
2371
  callbacksRef.current.onDragging = onDragging;
2372
+ callbacksRef.current.onPointerDown = onPointerDown;
2373
+ callbacksRef.current.onPointerUp = onPointerUp;
2385
2374
  });
2386
- const panelGroupContext = useContext(PanelGroupContext);
2375
+ const panelGroupContext = React.useContext(PanelGroupContext);
2387
2376
  if (panelGroupContext === null) {
2388
2377
  throw Error(`PanelResizeHandle components must be rendered within a PanelGroup container`);
2389
2378
  }
@@ -2396,16 +2385,16 @@ function PanelResizeHandle({
2396
2385
  panelGroupElement
2397
2386
  } = panelGroupContext;
2398
2387
  const resizeHandleId = useUniqueId(idFromProps);
2399
- const [state, setState] = useState("inactive");
2400
- const [isFocused, setIsFocused] = useState(false);
2401
- const [resizeHandler, setResizeHandler] = useState(null);
2402
- const committedValuesRef = useRef({
2388
+ const [state, setState] = React.useState("inactive");
2389
+ const [isFocused, setIsFocused] = React.useState(false);
2390
+ const [resizeHandler, setResizeHandler] = React.useState(null);
2391
+ const committedValuesRef = React.useRef({
2403
2392
  state
2404
2393
  });
2405
2394
  useIsomorphicLayoutEffect(() => {
2406
2395
  committedValuesRef.current.state = state;
2407
2396
  });
2408
- useEffect(() => {
2397
+ React.useEffect(() => {
2409
2398
  if (disabled) {
2410
2399
  setResizeHandler(null);
2411
2400
  } else {
@@ -2418,26 +2407,28 @@ function PanelResizeHandle({
2418
2407
  // so that inline object values won't trigger re-renders
2419
2408
  const coarseHitAreaMargins = (_hitAreaMargins$coars = hitAreaMargins === null || hitAreaMargins === void 0 ? void 0 : hitAreaMargins.coarse) !== null && _hitAreaMargins$coars !== void 0 ? _hitAreaMargins$coars : 15;
2420
2409
  const fineHitAreaMargins = (_hitAreaMargins$fine = hitAreaMargins === null || hitAreaMargins === void 0 ? void 0 : hitAreaMargins.fine) !== null && _hitAreaMargins$fine !== void 0 ? _hitAreaMargins$fine : 5;
2421
- useEffect(() => {
2410
+ React.useEffect(() => {
2422
2411
  if (disabled || resizeHandler == null) {
2423
2412
  return;
2424
2413
  }
2425
2414
  const element = elementRef.current;
2426
2415
  assert(element, "Element ref not attached");
2416
+ let didMove = false;
2427
2417
  const setResizeHandlerState = (action, isActive, event) => {
2428
2418
  if (isActive) {
2429
2419
  switch (action) {
2430
2420
  case "down":
2431
2421
  {
2432
2422
  setState("drag");
2423
+ didMove = false;
2433
2424
  assert(event, 'Expected event to be defined for "down" action');
2434
2425
  startDragging(resizeHandleId, event);
2435
2426
  const {
2436
- onDragging
2427
+ onDragging,
2428
+ onPointerDown
2437
2429
  } = callbacksRef.current;
2438
- if (onDragging) {
2439
- onDragging(true);
2440
- }
2430
+ onDragging === null || onDragging === void 0 ? void 0 : onDragging(true);
2431
+ onPointerDown === null || onPointerDown === void 0 ? void 0 : onPointerDown();
2441
2432
  break;
2442
2433
  }
2443
2434
  case "move":
@@ -2445,6 +2436,7 @@ function PanelResizeHandle({
2445
2436
  const {
2446
2437
  state
2447
2438
  } = committedValuesRef.current;
2439
+ didMove = true;
2448
2440
  if (state !== "drag") {
2449
2441
  setState("hover");
2450
2442
  }
@@ -2457,10 +2449,14 @@ function PanelResizeHandle({
2457
2449
  setState("hover");
2458
2450
  stopDragging();
2459
2451
  const {
2460
- onDragging
2452
+ onClick,
2453
+ onDragging,
2454
+ onPointerUp
2461
2455
  } = callbacksRef.current;
2462
- if (onDragging) {
2463
- onDragging(false);
2456
+ onDragging === null || onDragging === void 0 ? void 0 : onDragging(false);
2457
+ onPointerUp === null || onPointerUp === void 0 ? void 0 : onPointerUp();
2458
+ if (!didMove) {
2459
+ onClick === null || onClick === void 0 ? void 0 : onClick();
2464
2460
  }
2465
2461
  break;
2466
2462
  }
@@ -2484,7 +2480,7 @@ function PanelResizeHandle({
2484
2480
  touchAction: "none",
2485
2481
  userSelect: "none"
2486
2482
  };
2487
- return createElement(Type, {
2483
+ return React.createElement(Type, {
2488
2484
  ...rest,
2489
2485
  children,
2490
2486
  className: classNameFromProps,
@@ -1,35 +1,14 @@
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)];
24
- const useLayoutEffect_do_not_use_directly = useLayoutEffect;
2
+ import { createContext, useLayoutEffect, useRef, forwardRef, createElement, useContext, useImperativeHandle, useState, useCallback, useEffect, useMemo } from 'react';
25
3
 
26
4
  // The "contextmenu" event is not supported as a PointerEvent in all browsers yet, so MouseEvent still need to be handled
27
5
 
28
6
  const PanelGroupContext = createContext(null);
29
7
  PanelGroupContext.displayName = "PanelGroupContext";
30
8
 
31
- const useIsomorphicLayoutEffect = useLayoutEffect_do_not_use_directly ;
9
+ const useIsomorphicLayoutEffect = useLayoutEffect ;
32
10
 
11
+ const useId = React["useId".toString()];
33
12
  const wrappedUseId = typeof useId === "function" ? useId : () => null;
34
13
  let counter = 0;
35
14
  function useUniqueId(idFromParams = null) {
@@ -163,7 +142,7 @@ function PanelWithForwardedRef({
163
142
  ...rest,
164
143
  children,
165
144
  className: classNameFromProps,
166
- id: idFromProps,
145
+ id: panelId,
167
146
  style: {
168
147
  ...style,
169
148
  ...styleFromProps
@@ -648,7 +627,9 @@ function updateListeners() {
648
627
  body
649
628
  } = ownerDocument;
650
629
  body.removeEventListener("contextmenu", handlePointerUp);
651
- body.removeEventListener("pointerdown", handlePointerDown);
630
+ body.removeEventListener("pointerdown", handlePointerDown, {
631
+ capture: true
632
+ });
652
633
  body.removeEventListener("pointerleave", handlePointerMove);
653
634
  body.removeEventListener("pointermove", handlePointerMove);
654
635
  });
@@ -2342,8 +2323,11 @@ function PanelResizeHandle({
2342
2323
  hitAreaMargins,
2343
2324
  id: idFromProps,
2344
2325
  onBlur,
2326
+ onClick,
2345
2327
  onDragging,
2346
2328
  onFocus,
2329
+ onPointerDown,
2330
+ onPointerUp,
2347
2331
  style: styleFromProps = {},
2348
2332
  tabIndex = 0,
2349
2333
  tagName: Type = "div",
@@ -2354,10 +2338,16 @@ function PanelResizeHandle({
2354
2338
 
2355
2339
  // Use a ref to guard against users passing inline props
2356
2340
  const callbacksRef = useRef({
2357
- onDragging
2341
+ onClick,
2342
+ onDragging,
2343
+ onPointerDown,
2344
+ onPointerUp
2358
2345
  });
2359
2346
  useEffect(() => {
2347
+ callbacksRef.current.onClick = onClick;
2360
2348
  callbacksRef.current.onDragging = onDragging;
2349
+ callbacksRef.current.onPointerDown = onPointerDown;
2350
+ callbacksRef.current.onPointerUp = onPointerUp;
2361
2351
  });
2362
2352
  const panelGroupContext = useContext(PanelGroupContext);
2363
2353
  if (panelGroupContext === null) {
@@ -2400,20 +2390,22 @@ function PanelResizeHandle({
2400
2390
  }
2401
2391
  const element = elementRef.current;
2402
2392
  assert(element, "Element ref not attached");
2393
+ let didMove = false;
2403
2394
  const setResizeHandlerState = (action, isActive, event) => {
2404
2395
  if (isActive) {
2405
2396
  switch (action) {
2406
2397
  case "down":
2407
2398
  {
2408
2399
  setState("drag");
2400
+ didMove = false;
2409
2401
  assert(event, 'Expected event to be defined for "down" action');
2410
2402
  startDragging(resizeHandleId, event);
2411
2403
  const {
2412
- onDragging
2404
+ onDragging,
2405
+ onPointerDown
2413
2406
  } = callbacksRef.current;
2414
- if (onDragging) {
2415
- onDragging(true);
2416
- }
2407
+ onDragging === null || onDragging === void 0 ? void 0 : onDragging(true);
2408
+ onPointerDown === null || onPointerDown === void 0 ? void 0 : onPointerDown();
2417
2409
  break;
2418
2410
  }
2419
2411
  case "move":
@@ -2421,6 +2413,7 @@ function PanelResizeHandle({
2421
2413
  const {
2422
2414
  state
2423
2415
  } = committedValuesRef.current;
2416
+ didMove = true;
2424
2417
  if (state !== "drag") {
2425
2418
  setState("hover");
2426
2419
  }
@@ -2433,10 +2426,14 @@ function PanelResizeHandle({
2433
2426
  setState("hover");
2434
2427
  stopDragging();
2435
2428
  const {
2436
- onDragging
2429
+ onClick,
2430
+ onDragging,
2431
+ onPointerUp
2437
2432
  } = callbacksRef.current;
2438
- if (onDragging) {
2439
- onDragging(false);
2433
+ onDragging === null || onDragging === void 0 ? void 0 : onDragging(false);
2434
+ onPointerUp === null || onPointerUp === void 0 ? void 0 : onPointerUp();
2435
+ if (!didMove) {
2436
+ onClick === null || onClick === void 0 ? void 0 : onClick();
2440
2437
  }
2441
2438
  break;
2442
2439
  }