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.
@@ -1,37 +1,16 @@
1
1
  import * as React from 'react';
2
+ import { createContext, useLayoutEffect, useRef, forwardRef, createElement, useContext, useImperativeHandle, useState, useCallback, useEffect, useMemo } from 'react';
2
3
 
3
4
  const isBrowser = typeof window !== "undefined";
4
5
 
5
- // This module exists to work around Webpack issue https://github.com/webpack/webpack/issues/14814
6
-
7
- // eslint-disable-next-line no-restricted-imports
8
-
9
- const {
10
- createElement,
11
- createContext,
12
- createRef,
13
- forwardRef,
14
- useCallback,
15
- useContext,
16
- useEffect,
17
- useImperativeHandle,
18
- useLayoutEffect,
19
- useMemo,
20
- useRef,
21
- useState
22
- } = React;
23
-
24
- // `Math.random()` and `.slice(0, 5)` prevents bundlers from trying to `import { useId } from 'react'`
25
- const useId = React[`useId${Math.random()}`.slice(0, 5)];
26
- const useLayoutEffect_do_not_use_directly = useLayoutEffect;
27
-
28
6
  // The "contextmenu" event is not supported as a PointerEvent in all browsers yet, so MouseEvent still need to be handled
29
7
 
30
8
  const PanelGroupContext = createContext(null);
31
9
  PanelGroupContext.displayName = "PanelGroupContext";
32
10
 
33
- const useIsomorphicLayoutEffect = isBrowser ? useLayoutEffect_do_not_use_directly : () => {};
11
+ const useIsomorphicLayoutEffect = isBrowser ? useLayoutEffect : () => {};
34
12
 
13
+ const useId = React["useId".toString()];
35
14
  const wrappedUseId = typeof useId === "function" ? useId : () => null;
36
15
  let counter = 0;
37
16
  function useUniqueId(idFromParams = null) {
@@ -159,7 +138,7 @@ function PanelWithForwardedRef({
159
138
  ...rest,
160
139
  children,
161
140
  className: classNameFromProps,
162
- id: idFromProps,
141
+ id: panelId,
163
142
  style: {
164
143
  ...style,
165
144
  ...styleFromProps
@@ -644,7 +623,9 @@ function updateListeners() {
644
623
  body
645
624
  } = ownerDocument;
646
625
  body.removeEventListener("contextmenu", handlePointerUp);
647
- body.removeEventListener("pointerdown", handlePointerDown);
626
+ body.removeEventListener("pointerdown", handlePointerDown, {
627
+ capture: true
628
+ });
648
629
  body.removeEventListener("pointerleave", handlePointerMove);
649
630
  body.removeEventListener("pointermove", handlePointerMove);
650
631
  });
@@ -2238,8 +2219,11 @@ function PanelResizeHandle({
2238
2219
  hitAreaMargins,
2239
2220
  id: idFromProps,
2240
2221
  onBlur,
2222
+ onClick,
2241
2223
  onDragging,
2242
2224
  onFocus,
2225
+ onPointerDown,
2226
+ onPointerUp,
2243
2227
  style: styleFromProps = {},
2244
2228
  tabIndex = 0,
2245
2229
  tagName: Type = "div",
@@ -2250,10 +2234,16 @@ function PanelResizeHandle({
2250
2234
 
2251
2235
  // Use a ref to guard against users passing inline props
2252
2236
  const callbacksRef = useRef({
2253
- onDragging
2237
+ onClick,
2238
+ onDragging,
2239
+ onPointerDown,
2240
+ onPointerUp
2254
2241
  });
2255
2242
  useEffect(() => {
2243
+ callbacksRef.current.onClick = onClick;
2256
2244
  callbacksRef.current.onDragging = onDragging;
2245
+ callbacksRef.current.onPointerDown = onPointerDown;
2246
+ callbacksRef.current.onPointerUp = onPointerUp;
2257
2247
  });
2258
2248
  const panelGroupContext = useContext(PanelGroupContext);
2259
2249
  if (panelGroupContext === null) {
@@ -2296,20 +2286,22 @@ function PanelResizeHandle({
2296
2286
  }
2297
2287
  const element = elementRef.current;
2298
2288
  assert(element, "Element ref not attached");
2289
+ let didMove = false;
2299
2290
  const setResizeHandlerState = (action, isActive, event) => {
2300
2291
  if (isActive) {
2301
2292
  switch (action) {
2302
2293
  case "down":
2303
2294
  {
2304
2295
  setState("drag");
2296
+ didMove = false;
2305
2297
  assert(event, 'Expected event to be defined for "down" action');
2306
2298
  startDragging(resizeHandleId, event);
2307
2299
  const {
2308
- onDragging
2300
+ onDragging,
2301
+ onPointerDown
2309
2302
  } = callbacksRef.current;
2310
- if (onDragging) {
2311
- onDragging(true);
2312
- }
2303
+ onDragging === null || onDragging === void 0 ? void 0 : onDragging(true);
2304
+ onPointerDown === null || onPointerDown === void 0 ? void 0 : onPointerDown();
2313
2305
  break;
2314
2306
  }
2315
2307
  case "move":
@@ -2317,6 +2309,7 @@ function PanelResizeHandle({
2317
2309
  const {
2318
2310
  state
2319
2311
  } = committedValuesRef.current;
2312
+ didMove = true;
2320
2313
  if (state !== "drag") {
2321
2314
  setState("hover");
2322
2315
  }
@@ -2329,10 +2322,14 @@ function PanelResizeHandle({
2329
2322
  setState("hover");
2330
2323
  stopDragging();
2331
2324
  const {
2332
- onDragging
2325
+ onClick,
2326
+ onDragging,
2327
+ onPointerUp
2333
2328
  } = callbacksRef.current;
2334
- if (onDragging) {
2335
- onDragging(false);
2329
+ onDragging === null || onDragging === void 0 ? void 0 : onDragging(false);
2330
+ onPointerUp === null || onPointerUp === void 0 ? void 0 : onPointerUp();
2331
+ if (!didMove) {
2332
+ onClick === null || onClick === void 0 ? void 0 : onClick();
2336
2333
  }
2337
2334
  break;
2338
2335
  }
@@ -24,38 +24,17 @@ 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
-
49
27
  // The "contextmenu" event is not supported as a PointerEvent in all browsers yet, so MouseEvent still need to be handled
50
28
 
51
- const PanelGroupContext = createContext(null);
29
+ const PanelGroupContext = React.createContext(null);
52
30
  PanelGroupContext.displayName = "PanelGroupContext";
53
31
 
32
+ const useId = React__namespace["useId".toString()];
54
33
  const wrappedUseId = typeof useId === "function" ? useId : () => null;
55
34
  let counter = 0;
56
35
  function useUniqueId(idFromParams = null) {
57
36
  const idFromUseId = wrappedUseId();
58
- const idRef = useRef(idFromParams || idFromUseId || null);
37
+ const idRef = React.useRef(idFromParams || idFromUseId || null);
59
38
  if (idRef.current === null) {
60
39
  idRef.current = "" + counter++;
61
40
  }
@@ -80,7 +59,7 @@ function PanelWithForwardedRef({
80
59
  tagName: Type = "div",
81
60
  ...rest
82
61
  }) {
83
- const context = useContext(PanelGroupContext);
62
+ const context = React.useContext(PanelGroupContext);
84
63
  if (context === null) {
85
64
  throw Error(`Panel components must be rendered within a PanelGroup container`);
86
65
  }
@@ -97,7 +76,7 @@ function PanelWithForwardedRef({
97
76
  unregisterPanel
98
77
  } = context;
99
78
  const panelId = useUniqueId(idFromProps);
100
- const panelDataRef = useRef({
79
+ const panelDataRef = React.useRef({
101
80
  callbacks: {
102
81
  onCollapse,
103
82
  onExpand,
@@ -114,10 +93,10 @@ function PanelWithForwardedRef({
114
93
  idIsFromProps: idFromProps !== undefined,
115
94
  order
116
95
  });
117
- useRef({
96
+ React.useRef({
118
97
  didLogMissingDefaultSizeWarning: false
119
98
  });
120
- useImperativeHandle(forwardedRef, () => ({
99
+ React.useImperativeHandle(forwardedRef, () => ({
121
100
  collapse: () => {
122
101
  collapsePanel(panelDataRef.current);
123
102
  },
@@ -141,11 +120,11 @@ function PanelWithForwardedRef({
141
120
  }
142
121
  }), [collapsePanel, expandPanel, getPanelSize, isPanelCollapsed, panelId, resizePanel]);
143
122
  const style = getPanelStyle(panelDataRef.current, defaultSize);
144
- return createElement(Type, {
123
+ return React.createElement(Type, {
145
124
  ...rest,
146
125
  children,
147
126
  className: classNameFromProps,
148
- id: idFromProps,
127
+ id: panelId,
149
128
  style: {
150
129
  ...style,
151
130
  ...styleFromProps
@@ -158,7 +137,7 @@ function PanelWithForwardedRef({
158
137
  "data-panel-size": parseFloat("" + style.flexGrow).toFixed(1)
159
138
  });
160
139
  }
161
- const Panel = forwardRef((props, ref) => createElement(PanelWithForwardedRef, {
140
+ const Panel = React.forwardRef((props, ref) => React.createElement(PanelWithForwardedRef, {
162
141
  ...props,
163
142
  forwardedRef: ref
164
143
  }));
@@ -630,7 +609,9 @@ function updateListeners() {
630
609
  body
631
610
  } = ownerDocument;
632
611
  body.removeEventListener("contextmenu", handlePointerUp);
633
- body.removeEventListener("pointerdown", handlePointerDown);
612
+ body.removeEventListener("pointerdown", handlePointerDown, {
613
+ capture: true
614
+ });
634
615
  body.removeEventListener("pointerleave", handlePointerMove);
635
616
  body.removeEventListener("pointermove", handlePointerMove);
636
617
  });
@@ -678,8 +659,8 @@ function updateResizeHandlerStates(action, event) {
678
659
  }
679
660
 
680
661
  function useForceUpdate() {
681
- const [_, setCount] = useState(0);
682
- return useCallback(() => setCount(prevCount => prevCount + 1), []);
662
+ const [_, setCount] = React.useState(0);
663
+ return React.useCallback(() => setCount(prevCount => prevCount + 1), []);
683
664
  }
684
665
 
685
666
  function assert(expectedCondition, message) {
@@ -1053,10 +1034,10 @@ function useWindowSplitterPanelGroupBehavior({
1053
1034
  panelGroupElement,
1054
1035
  setLayout
1055
1036
  }) {
1056
- useRef({
1037
+ React.useRef({
1057
1038
  didWarnAboutMissingResizeHandle: false
1058
1039
  });
1059
- useEffect(() => {
1040
+ React.useEffect(() => {
1060
1041
  if (!panelGroupElement) {
1061
1042
  return;
1062
1043
  }
@@ -1468,14 +1449,14 @@ function PanelGroupWithForwardedRef({
1468
1449
  ...rest
1469
1450
  }) {
1470
1451
  const groupId = useUniqueId(idFromProps);
1471
- const panelGroupElementRef = useRef(null);
1472
- const [dragState, setDragState] = useState(null);
1473
- const [layout, setLayout] = useState([]);
1452
+ const panelGroupElementRef = React.useRef(null);
1453
+ const [dragState, setDragState] = React.useState(null);
1454
+ const [layout, setLayout] = React.useState([]);
1474
1455
  const forceUpdate = useForceUpdate();
1475
- const panelIdToLastNotifiedSizeMapRef = useRef({});
1476
- const panelSizeBeforeCollapseRef = useRef(new Map());
1477
- const prevDeltaRef = useRef(0);
1478
- const committedValuesRef = useRef({
1456
+ const panelIdToLastNotifiedSizeMapRef = React.useRef({});
1457
+ const panelSizeBeforeCollapseRef = React.useRef(new Map());
1458
+ const prevDeltaRef = React.useRef(0);
1459
+ const committedValuesRef = React.useRef({
1479
1460
  autoSaveId,
1480
1461
  direction,
1481
1462
  dragState,
@@ -1484,17 +1465,17 @@ function PanelGroupWithForwardedRef({
1484
1465
  onLayout,
1485
1466
  storage
1486
1467
  });
1487
- const eagerValuesRef = useRef({
1468
+ const eagerValuesRef = React.useRef({
1488
1469
  layout,
1489
1470
  panelDataArray: [],
1490
1471
  panelDataArrayChanged: false
1491
1472
  });
1492
- useRef({
1473
+ React.useRef({
1493
1474
  didLogIdAndOrderWarning: false,
1494
1475
  didLogPanelConstraintsWarning: false,
1495
1476
  prevPanelIds: []
1496
1477
  });
1497
- useImperativeHandle(forwardedRef, () => ({
1478
+ React.useImperativeHandle(forwardedRef, () => ({
1498
1479
  getId: () => committedValuesRef.current.id,
1499
1480
  getLayout: () => {
1500
1481
  const {
@@ -1533,7 +1514,7 @@ function PanelGroupWithForwardedRef({
1533
1514
  setLayout,
1534
1515
  panelGroupElement: panelGroupElementRef.current
1535
1516
  });
1536
- useEffect(() => {
1517
+ React.useEffect(() => {
1537
1518
  const {
1538
1519
  panelDataArray
1539
1520
  } = eagerValuesRef.current;
@@ -1560,11 +1541,11 @@ function PanelGroupWithForwardedRef({
1560
1541
  }, [autoSaveId, layout, storage]);
1561
1542
 
1562
1543
  // DEV warnings
1563
- useEffect(() => {
1544
+ React.useEffect(() => {
1564
1545
  });
1565
1546
 
1566
1547
  // External APIs are safe to memoize via committed values ref
1567
- const collapsePanel = useCallback(panelData => {
1548
+ const collapsePanel = React.useCallback(panelData => {
1568
1549
  const {
1569
1550
  onLayout
1570
1551
  } = committedValuesRef.current;
@@ -1607,7 +1588,7 @@ function PanelGroupWithForwardedRef({
1607
1588
  }, []);
1608
1589
 
1609
1590
  // External APIs are safe to memoize via committed values ref
1610
- const expandPanel = useCallback((panelData, minSizeOverride) => {
1591
+ const expandPanel = React.useCallback((panelData, minSizeOverride) => {
1611
1592
  const {
1612
1593
  onLayout
1613
1594
  } = committedValuesRef.current;
@@ -1651,7 +1632,7 @@ function PanelGroupWithForwardedRef({
1651
1632
  }, []);
1652
1633
 
1653
1634
  // External APIs are safe to memoize via committed values ref
1654
- const getPanelSize = useCallback(panelData => {
1635
+ const getPanelSize = React.useCallback(panelData => {
1655
1636
  const {
1656
1637
  layout,
1657
1638
  panelDataArray
@@ -1664,7 +1645,7 @@ function PanelGroupWithForwardedRef({
1664
1645
  }, []);
1665
1646
 
1666
1647
  // This API should never read from committedValuesRef
1667
- const getPanelStyle = useCallback((panelData, defaultSize) => {
1648
+ const getPanelStyle = React.useCallback((panelData, defaultSize) => {
1668
1649
  const {
1669
1650
  panelDataArray
1670
1651
  } = eagerValuesRef.current;
@@ -1679,7 +1660,7 @@ function PanelGroupWithForwardedRef({
1679
1660
  }, [dragState, layout]);
1680
1661
 
1681
1662
  // External APIs are safe to memoize via committed values ref
1682
- const isPanelCollapsed = useCallback(panelData => {
1663
+ const isPanelCollapsed = React.useCallback(panelData => {
1683
1664
  const {
1684
1665
  layout,
1685
1666
  panelDataArray
@@ -1694,7 +1675,7 @@ function PanelGroupWithForwardedRef({
1694
1675
  }, []);
1695
1676
 
1696
1677
  // External APIs are safe to memoize via committed values ref
1697
- const isPanelExpanded = useCallback(panelData => {
1678
+ const isPanelExpanded = React.useCallback(panelData => {
1698
1679
  const {
1699
1680
  layout,
1700
1681
  panelDataArray
@@ -1707,7 +1688,7 @@ function PanelGroupWithForwardedRef({
1707
1688
  assert(panelSize != null, `Panel size not found for panel "${panelData.id}"`);
1708
1689
  return !collapsible || fuzzyCompareNumbers(panelSize, collapsedSize) > 0;
1709
1690
  }, []);
1710
- const registerPanel = useCallback(panelData => {
1691
+ const registerPanel = React.useCallback(panelData => {
1711
1692
  const {
1712
1693
  panelDataArray
1713
1694
  } = eagerValuesRef.current;
@@ -1728,7 +1709,7 @@ function PanelGroupWithForwardedRef({
1728
1709
  eagerValuesRef.current.panelDataArrayChanged = true;
1729
1710
  forceUpdate();
1730
1711
  }, [forceUpdate]);
1731
- const registerResizeHandle = useCallback(dragHandleId => {
1712
+ const registerResizeHandle = React.useCallback(dragHandleId => {
1732
1713
  let isRTL = false;
1733
1714
  const panelGroupElement = panelGroupElementRef.current;
1734
1715
  if (panelGroupElement) {
@@ -1807,7 +1788,7 @@ function PanelGroupWithForwardedRef({
1807
1788
  }, []);
1808
1789
 
1809
1790
  // External APIs are safe to memoize via committed values ref
1810
- const resizePanel = useCallback((panelData, unsafePanelSize) => {
1791
+ const resizePanel = React.useCallback((panelData, unsafePanelSize) => {
1811
1792
  const {
1812
1793
  onLayout
1813
1794
  } = committedValuesRef.current;
@@ -1840,7 +1821,7 @@ function PanelGroupWithForwardedRef({
1840
1821
  callPanelCallbacks(panelDataArray, nextLayout, panelIdToLastNotifiedSizeMapRef.current);
1841
1822
  }
1842
1823
  }, []);
1843
- const reevaluatePanelConstraints = useCallback((panelData, prevConstraints) => {
1824
+ const reevaluatePanelConstraints = React.useCallback((panelData, prevConstraints) => {
1844
1825
  const {
1845
1826
  layout,
1846
1827
  panelDataArray
@@ -1874,7 +1855,7 @@ function PanelGroupWithForwardedRef({
1874
1855
  }, [resizePanel]);
1875
1856
 
1876
1857
  // TODO Multiple drag handles can be active at the same time so this API is a bit awkward now
1877
- const startDragging = useCallback((dragHandleId, event) => {
1858
+ const startDragging = React.useCallback((dragHandleId, event) => {
1878
1859
  const {
1879
1860
  direction
1880
1861
  } = committedValuesRef.current;
@@ -1894,10 +1875,10 @@ function PanelGroupWithForwardedRef({
1894
1875
  initialLayout: layout
1895
1876
  });
1896
1877
  }, []);
1897
- const stopDragging = useCallback(() => {
1878
+ const stopDragging = React.useCallback(() => {
1898
1879
  setDragState(null);
1899
1880
  }, []);
1900
- const unregisterPanel = useCallback(panelData => {
1881
+ const unregisterPanel = React.useCallback(panelData => {
1901
1882
  const {
1902
1883
  panelDataArray
1903
1884
  } = eagerValuesRef.current;
@@ -1914,7 +1895,7 @@ function PanelGroupWithForwardedRef({
1914
1895
  forceUpdate();
1915
1896
  }
1916
1897
  }, [forceUpdate]);
1917
- const context = useMemo(() => ({
1898
+ const context = React.useMemo(() => ({
1918
1899
  collapsePanel,
1919
1900
  direction,
1920
1901
  dragState,
@@ -1940,9 +1921,9 @@ function PanelGroupWithForwardedRef({
1940
1921
  overflow: "hidden",
1941
1922
  width: "100%"
1942
1923
  };
1943
- return createElement(PanelGroupContext.Provider, {
1924
+ return React.createElement(PanelGroupContext.Provider, {
1944
1925
  value: context
1945
- }, createElement(Type, {
1926
+ }, React.createElement(Type, {
1946
1927
  ...rest,
1947
1928
  children,
1948
1929
  className: classNameFromProps,
@@ -1958,7 +1939,7 @@ function PanelGroupWithForwardedRef({
1958
1939
  "data-panel-group-id": groupId
1959
1940
  }));
1960
1941
  }
1961
- const PanelGroup = forwardRef((props, ref) => createElement(PanelGroupWithForwardedRef, {
1942
+ const PanelGroup = React.forwardRef((props, ref) => React.createElement(PanelGroupWithForwardedRef, {
1962
1943
  ...props,
1963
1944
  forwardedRef: ref
1964
1945
  }));
@@ -1987,7 +1968,7 @@ function useWindowSplitterResizeHandlerBehavior({
1987
1968
  resizeHandler,
1988
1969
  panelGroupElement
1989
1970
  }) {
1990
- useEffect(() => {
1971
+ React.useEffect(() => {
1991
1972
  if (disabled || resizeHandler == null || panelGroupElement == null) {
1992
1973
  return;
1993
1974
  }
@@ -2040,24 +2021,33 @@ function PanelResizeHandle({
2040
2021
  hitAreaMargins,
2041
2022
  id: idFromProps,
2042
2023
  onBlur,
2024
+ onClick,
2043
2025
  onDragging,
2044
2026
  onFocus,
2027
+ onPointerDown,
2028
+ onPointerUp,
2045
2029
  style: styleFromProps = {},
2046
2030
  tabIndex = 0,
2047
2031
  tagName: Type = "div",
2048
2032
  ...rest
2049
2033
  }) {
2050
2034
  var _hitAreaMargins$coars, _hitAreaMargins$fine;
2051
- const elementRef = useRef(null);
2035
+ const elementRef = React.useRef(null);
2052
2036
 
2053
2037
  // Use a ref to guard against users passing inline props
2054
- const callbacksRef = useRef({
2055
- onDragging
2038
+ const callbacksRef = React.useRef({
2039
+ onClick,
2040
+ onDragging,
2041
+ onPointerDown,
2042
+ onPointerUp
2056
2043
  });
2057
- useEffect(() => {
2044
+ React.useEffect(() => {
2045
+ callbacksRef.current.onClick = onClick;
2058
2046
  callbacksRef.current.onDragging = onDragging;
2047
+ callbacksRef.current.onPointerDown = onPointerDown;
2048
+ callbacksRef.current.onPointerUp = onPointerUp;
2059
2049
  });
2060
- const panelGroupContext = useContext(PanelGroupContext);
2050
+ const panelGroupContext = React.useContext(PanelGroupContext);
2061
2051
  if (panelGroupContext === null) {
2062
2052
  throw Error(`PanelResizeHandle components must be rendered within a PanelGroup container`);
2063
2053
  }
@@ -2070,13 +2060,13 @@ function PanelResizeHandle({
2070
2060
  panelGroupElement
2071
2061
  } = panelGroupContext;
2072
2062
  const resizeHandleId = useUniqueId(idFromProps);
2073
- const [state, setState] = useState("inactive");
2074
- const [isFocused, setIsFocused] = useState(false);
2075
- const [resizeHandler, setResizeHandler] = useState(null);
2076
- const committedValuesRef = useRef({
2063
+ const [state, setState] = React.useState("inactive");
2064
+ const [isFocused, setIsFocused] = React.useState(false);
2065
+ const [resizeHandler, setResizeHandler] = React.useState(null);
2066
+ const committedValuesRef = React.useRef({
2077
2067
  state
2078
2068
  });
2079
- useEffect(() => {
2069
+ React.useEffect(() => {
2080
2070
  if (disabled) {
2081
2071
  setResizeHandler(null);
2082
2072
  } else {
@@ -2089,26 +2079,28 @@ function PanelResizeHandle({
2089
2079
  // so that inline object values won't trigger re-renders
2090
2080
  const coarseHitAreaMargins = (_hitAreaMargins$coars = hitAreaMargins === null || hitAreaMargins === void 0 ? void 0 : hitAreaMargins.coarse) !== null && _hitAreaMargins$coars !== void 0 ? _hitAreaMargins$coars : 15;
2091
2081
  const fineHitAreaMargins = (_hitAreaMargins$fine = hitAreaMargins === null || hitAreaMargins === void 0 ? void 0 : hitAreaMargins.fine) !== null && _hitAreaMargins$fine !== void 0 ? _hitAreaMargins$fine : 5;
2092
- useEffect(() => {
2082
+ React.useEffect(() => {
2093
2083
  if (disabled || resizeHandler == null) {
2094
2084
  return;
2095
2085
  }
2096
2086
  const element = elementRef.current;
2097
2087
  assert(element, "Element ref not attached");
2088
+ let didMove = false;
2098
2089
  const setResizeHandlerState = (action, isActive, event) => {
2099
2090
  if (isActive) {
2100
2091
  switch (action) {
2101
2092
  case "down":
2102
2093
  {
2103
2094
  setState("drag");
2095
+ didMove = false;
2104
2096
  assert(event, 'Expected event to be defined for "down" action');
2105
2097
  startDragging(resizeHandleId, event);
2106
2098
  const {
2107
- onDragging
2099
+ onDragging,
2100
+ onPointerDown
2108
2101
  } = callbacksRef.current;
2109
- if (onDragging) {
2110
- onDragging(true);
2111
- }
2102
+ onDragging === null || onDragging === void 0 ? void 0 : onDragging(true);
2103
+ onPointerDown === null || onPointerDown === void 0 ? void 0 : onPointerDown();
2112
2104
  break;
2113
2105
  }
2114
2106
  case "move":
@@ -2116,6 +2108,7 @@ function PanelResizeHandle({
2116
2108
  const {
2117
2109
  state
2118
2110
  } = committedValuesRef.current;
2111
+ didMove = true;
2119
2112
  if (state !== "drag") {
2120
2113
  setState("hover");
2121
2114
  }
@@ -2128,10 +2121,14 @@ function PanelResizeHandle({
2128
2121
  setState("hover");
2129
2122
  stopDragging();
2130
2123
  const {
2131
- onDragging
2124
+ onClick,
2125
+ onDragging,
2126
+ onPointerUp
2132
2127
  } = callbacksRef.current;
2133
- if (onDragging) {
2134
- onDragging(false);
2128
+ onDragging === null || onDragging === void 0 ? void 0 : onDragging(false);
2129
+ onPointerUp === null || onPointerUp === void 0 ? void 0 : onPointerUp();
2130
+ if (!didMove) {
2131
+ onClick === null || onClick === void 0 ? void 0 : onClick();
2135
2132
  }
2136
2133
  break;
2137
2134
  }
@@ -2155,7 +2152,7 @@ function PanelResizeHandle({
2155
2152
  touchAction: "none",
2156
2153
  userSelect: "none"
2157
2154
  };
2158
- return createElement(Type, {
2155
+ return React.createElement(Type, {
2159
2156
  ...rest,
2160
2157
  children,
2161
2158
  className: classNameFromProps,