react-resizable-panels 0.0.32 → 0.0.34

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.
@@ -139,9 +139,9 @@ function $6ff1a22b27cc039d$var$getSerializationKey(panels) {
139
139
  return order ? `${order}:${minSize}` : `${minSize}`;
140
140
  }).sort((a, b)=>a.localeCompare(b)).join(",");
141
141
  }
142
- function $6ff1a22b27cc039d$var$loadSerializedPanelGroupState(autoSaveId) {
142
+ function $6ff1a22b27cc039d$var$loadSerializedPanelGroupState(autoSaveId, storage) {
143
143
  try {
144
- const serialized = localStorage.getItem(`PanelGroup:sizes:${autoSaveId}`);
144
+ const serialized = storage.getItem(`PanelGroup:sizes:${autoSaveId}`);
145
145
  if (serialized) {
146
146
  const parsed = JSON.parse(serialized);
147
147
  if (typeof parsed === "object" && parsed != null) return parsed;
@@ -149,20 +149,20 @@ function $6ff1a22b27cc039d$var$loadSerializedPanelGroupState(autoSaveId) {
149
149
  } catch (error) {}
150
150
  return null;
151
151
  }
152
- function $6ff1a22b27cc039d$export$9c80c6617f0386da(autoSaveId, panels) {
153
- const state = $6ff1a22b27cc039d$var$loadSerializedPanelGroupState(autoSaveId);
152
+ function $6ff1a22b27cc039d$export$9c80c6617f0386da(autoSaveId, panels, storage) {
153
+ const state = $6ff1a22b27cc039d$var$loadSerializedPanelGroupState(autoSaveId, storage);
154
154
  if (state) {
155
155
  const key = $6ff1a22b27cc039d$var$getSerializationKey(panels);
156
156
  return state[key] || null;
157
157
  }
158
158
  return null;
159
159
  }
160
- function $6ff1a22b27cc039d$export$af183b313c61be4f(autoSaveId, panels, sizes) {
160
+ function $6ff1a22b27cc039d$export$af183b313c61be4f(autoSaveId, panels, sizes, storage) {
161
161
  const key = $6ff1a22b27cc039d$var$getSerializationKey(panels);
162
- const state = $6ff1a22b27cc039d$var$loadSerializedPanelGroupState(autoSaveId) || {};
162
+ const state = $6ff1a22b27cc039d$var$loadSerializedPanelGroupState(autoSaveId, storage) || {};
163
163
  state[key] = sizes;
164
164
  try {
165
- localStorage.setItem(`PanelGroup:sizes:${autoSaveId}`, JSON.stringify(state));
165
+ storage.setItem(`PanelGroup:sizes:${autoSaveId}`, JSON.stringify(state));
166
166
  } catch (error) {
167
167
  console.error(error);
168
168
  }
@@ -173,10 +173,14 @@ const $fc25b75732bfda27$export$d6d3992f3becc879 = 10;
173
173
 
174
174
 
175
175
 
176
- function $f30c804b5fe6cc1a$export$f50bae335f53943c(panels, idBefore, idAfter, delta, prevSizes, panelSizeBeforeCollapse) {
177
- if (delta === 0) return prevSizes;
176
+ function $f30c804b5fe6cc1a$export$f50bae335f53943c(event, panels, idBefore, idAfter, delta, prevSizes, panelSizeBeforeCollapse, initialDragState) {
177
+ const { sizes: initialSizes } = initialDragState || {};
178
+ // If we're resizing by mouse or touch, use the initial sizes as a base.
179
+ // This has the benefit of causing force-collapsed panels to spring back open if drag is reversed.
180
+ const baseSizes = initialSizes || prevSizes;
181
+ if (delta === 0) return baseSizes;
178
182
  const panelsArray = $f30c804b5fe6cc1a$export$a861c0ad45885494(panels);
179
- const nextSizes = prevSizes.concat();
183
+ const nextSizes = baseSizes.concat();
180
184
  let deltaApplied = 0;
181
185
  // A resizing panel affects the panels before or after it.
182
186
  //
@@ -190,25 +194,29 @@ function $f30c804b5fe6cc1a$export$f50bae335f53943c(panels, idBefore, idAfter, de
190
194
  const pivotId = delta < 0 ? idAfter : idBefore;
191
195
  const index = panelsArray.findIndex((panel)=>panel.id === pivotId);
192
196
  const panel = panelsArray[index];
193
- const prevSize = prevSizes[index];
194
- const nextSize = $f30c804b5fe6cc1a$var$safeResizePanel(panel, Math.abs(delta), prevSize);
195
- if (prevSize === nextSize) return prevSizes;
197
+ const baseSize = baseSizes[index];
198
+ const nextSize = $f30c804b5fe6cc1a$var$safeResizePanel(panel, Math.abs(delta), baseSize, event);
199
+ if (baseSize === nextSize) // If there's no room for the pivot panel to grow, we can ignore this drag update.
200
+ return baseSizes;
196
201
  else {
197
- if (nextSize === 0 && prevSize > 0) panelSizeBeforeCollapse.set(pivotId, prevSize);
198
- delta = delta < 0 ? prevSize - nextSize : nextSize - prevSize;
202
+ if (nextSize === 0 && baseSize > 0) panelSizeBeforeCollapse.set(pivotId, baseSize);
203
+ delta = delta < 0 ? baseSize - nextSize : nextSize - baseSize;
199
204
  }
200
205
  }
201
206
  let pivotId1 = delta < 0 ? idBefore : idAfter;
202
207
  let index1 = panelsArray.findIndex((panel)=>panel.id === pivotId1);
203
208
  while(true){
204
209
  const panel1 = panelsArray[index1];
205
- const prevSize1 = prevSizes[index1];
206
- const nextSize1 = $f30c804b5fe6cc1a$var$safeResizePanel(panel1, 0 - Math.abs(delta), prevSize1);
207
- if (prevSize1 !== nextSize1) {
208
- if (nextSize1 === 0 && prevSize1 > 0) panelSizeBeforeCollapse.set(panel1.id, prevSize1);
209
- deltaApplied += prevSize1 - nextSize1;
210
+ const baseSize1 = baseSizes[index1];
211
+ const deltaRemaining = Math.abs(delta) - Math.abs(deltaApplied);
212
+ const nextSize1 = $f30c804b5fe6cc1a$var$safeResizePanel(panel1, 0 - deltaRemaining, baseSize1, event);
213
+ if (baseSize1 !== nextSize1) {
214
+ if (nextSize1 === 0 && baseSize1 > 0) panelSizeBeforeCollapse.set(panel1.id, baseSize1);
215
+ deltaApplied += baseSize1 - nextSize1;
210
216
  nextSizes[index1] = nextSize1;
211
- if (deltaApplied.toPrecision((0, $fc25b75732bfda27$export$d6d3992f3becc879)) >= delta.toPrecision((0, $fc25b75732bfda27$export$d6d3992f3becc879))) break;
217
+ if (deltaApplied.toPrecision((0, $fc25b75732bfda27$export$d6d3992f3becc879)).localeCompare(Math.abs(delta).toPrecision((0, $fc25b75732bfda27$export$d6d3992f3becc879)), undefined, {
218
+ numeric: true
219
+ }) >= 0) break;
212
220
  }
213
221
  if (delta < 0) {
214
222
  if (--index1 < 0) break;
@@ -218,22 +226,24 @@ function $f30c804b5fe6cc1a$export$f50bae335f53943c(panels, idBefore, idAfter, de
218
226
  }
219
227
  // If we were unable to resize any of the panels panels, return the previous state.
220
228
  // This will essentially bailout and ignore the "mousemove" event.
221
- if (deltaApplied === 0) return prevSizes;
229
+ if (deltaApplied === 0) return baseSizes;
222
230
  // Adjust the pivot panel before, but only by the amount that surrounding panels were able to shrink/contract.
223
231
  pivotId1 = delta < 0 ? idAfter : idBefore;
224
232
  index1 = panelsArray.findIndex((panel)=>panel.id === pivotId1);
225
- nextSizes[index1] = prevSizes[index1] + deltaApplied;
233
+ nextSizes[index1] = baseSizes[index1] + deltaApplied;
226
234
  return nextSizes;
227
235
  }
228
236
  function $f30c804b5fe6cc1a$export$b8e48269e4faa934(panelsArray, prevSizes, nextSizes) {
229
237
  nextSizes.forEach((nextSize, index)=>{
230
238
  const prevSize = prevSizes[index];
231
239
  if (prevSize !== nextSize) {
232
- const { callbacksRef: callbacksRef } = panelsArray[index];
240
+ const { callbacksRef: callbacksRef , collapsible: collapsible } = panelsArray[index];
233
241
  const { onCollapse: onCollapse , onResize: onResize } = callbacksRef.current;
234
242
  if (onResize) onResize(nextSize);
235
- if (onCollapse) {
236
- if (prevSize === 0 && nextSize !== 0) onCollapse(false);
243
+ if (collapsible && onCollapse) {
244
+ // Falsy check handles both previous size of 0
245
+ // and initial size of undefined (when mounting)
246
+ if (!prevSize && nextSize !== 0) onCollapse(false);
237
247
  else if (prevSize !== 0 && nextSize === 0) onCollapse(true);
238
248
  }
239
249
  }
@@ -305,13 +315,19 @@ function $f30c804b5fe6cc1a$export$68d3a33c21dfbe27(groupId, handleId, panelsArra
305
315
  function $f30c804b5fe6cc1a$export$a861c0ad45885494(panels) {
306
316
  return Array.from(panels.values()).sort((a, b)=>a.order - b.order);
307
317
  }
308
- function $f30c804b5fe6cc1a$var$safeResizePanel(panel, delta, prevSize) {
318
+ function $f30c804b5fe6cc1a$var$safeResizePanel(panel, delta, prevSize, event) {
309
319
  const nextSizeUnsafe = prevSize + delta;
310
320
  if (panel.collapsible) {
311
321
  if (prevSize > 0) {
312
322
  if (nextSizeUnsafe <= 0) return 0;
313
323
  } else {
314
- if (nextSizeUnsafe < panel.minSize) return 0;
324
+ const isKeyboardEvent = event?.type?.startsWith("key");
325
+ if (!isKeyboardEvent) {
326
+ // Keyboard events should expand a collapsed panel to the min size,
327
+ // but mouse events should wait until the panel has reached its min size
328
+ // to avoid a visual flickering when dragging between collapsed and min size.
329
+ if (nextSizeUnsafe < panel.minSize) return 0;
330
+ }
315
331
  }
316
332
  }
317
333
  const nextSize = Math.min(panel.maxSize, Math.max(panel.minSize, nextSizeUnsafe));
@@ -319,7 +335,7 @@ function $f30c804b5fe6cc1a$var$safeResizePanel(panel, delta, prevSize) {
319
335
  }
320
336
 
321
337
 
322
- function $96f6397ae645d178$export$ec391ce65b083ed4(event, handleId, direction, initialOffset = 0) {
338
+ function $96f6397ae645d178$export$ec391ce65b083ed4(event, handleId, direction, initialOffset = 0, initialHandleElementRect = null) {
323
339
  const isHorizontal = direction === "horizontal";
324
340
  let pointerOffset = 0;
325
341
  if ($96f6397ae645d178$export$764db16956f554f8(event)) pointerOffset = isHorizontal ? event.clientX : event.clientY;
@@ -328,11 +344,15 @@ function $96f6397ae645d178$export$ec391ce65b083ed4(event, handleId, direction, i
328
344
  pointerOffset = isHorizontal ? firstTouch.screenX : firstTouch.screenY;
329
345
  } else return 0;
330
346
  const handleElement = (0, $f30c804b5fe6cc1a$export$2e27d3a347680388)(handleId);
331
- const rect = handleElement.getBoundingClientRect();
347
+ const rect = initialHandleElementRect || handleElement.getBoundingClientRect();
332
348
  const elementOffset = isHorizontal ? rect.left : rect.top;
333
349
  return pointerOffset - elementOffset - initialOffset;
334
350
  }
335
- function $96f6397ae645d178$export$354b17c0684607ed(event, groupId, handleId, panelsArray, direction, sizes, initialOffset) {
351
+ function $96f6397ae645d178$export$354b17c0684607ed(event, groupId, handleId, panelsArray, direction, prevSizes, initialDragState) {
352
+ const { dragOffset: dragOffset = 0 , dragHandleRect: dragHandleRect , sizes: initialSizes } = initialDragState || {};
353
+ // If we're resizing by mouse or touch, use the initial sizes as a base.
354
+ // This has the benefit of causing force-collapsed panels to spring back open if drag is reversed.
355
+ const baseSizes = initialSizes || prevSizes;
336
356
  if ($96f6397ae645d178$export$e7bf60a870f429b0(event)) {
337
357
  const isHorizontal = direction === "horizontal";
338
358
  const groupElement = (0, $f30c804b5fe6cc1a$export$5e67632cf3550a9c)(groupId);
@@ -370,11 +390,11 @@ function $96f6397ae645d178$export$354b17c0684607ed(event, groupId, handleId, pan
370
390
  const targetPanelIndex = panelsArray.findIndex((panel)=>panel.id === targetPanelId);
371
391
  const targetPanel = panelsArray[targetPanelIndex];
372
392
  if (targetPanel.collapsible) {
373
- const prevSize = sizes[targetPanelIndex];
374
- if (prevSize === 0 || prevSize.toPrecision((0, $fc25b75732bfda27$export$d6d3992f3becc879)) === targetPanel.minSize.toPrecision((0, $fc25b75732bfda27$export$d6d3992f3becc879))) movement = movement < 0 ? -targetPanel.minSize * groupSizeInPixels : targetPanel.minSize * groupSizeInPixels;
393
+ const baseSize = baseSizes[targetPanelIndex];
394
+ if (baseSize === 0 || baseSize.toPrecision((0, $fc25b75732bfda27$export$d6d3992f3becc879)) === targetPanel.minSize.toPrecision((0, $fc25b75732bfda27$export$d6d3992f3becc879))) movement = movement < 0 ? -targetPanel.minSize * groupSizeInPixels : targetPanel.minSize * groupSizeInPixels;
375
395
  }
376
396
  return movement;
377
- } else return $96f6397ae645d178$export$ec391ce65b083ed4(event, handleId, direction, initialOffset);
397
+ } else return $96f6397ae645d178$export$ec391ce65b083ed4(event, handleId, direction, dragOffset, dragHandleRect);
378
398
  }
379
399
  function $96f6397ae645d178$export$e7bf60a870f429b0(event) {
380
400
  return event.type === "keydown";
@@ -436,7 +456,7 @@ function $99ad02c951ec80d0$export$d9fcbe062527d159({ committedValuesRef: committ
436
456
  let delta = 0;
437
457
  if (size.toPrecision((0, $fc25b75732bfda27$export$d6d3992f3becc879)) <= panelData.minSize.toPrecision((0, $fc25b75732bfda27$export$d6d3992f3becc879))) delta = direction === "horizontal" ? width : height;
438
458
  else delta = -(direction === "horizontal" ? width : height);
439
- const nextSizes = (0, $f30c804b5fe6cc1a$export$f50bae335f53943c)(panels, idBefore, idAfter, delta, sizes, panelSizeBeforeCollapse.current);
459
+ const nextSizes = (0, $f30c804b5fe6cc1a$export$f50bae335f53943c)(event, panels, idBefore, idAfter, delta, sizes, panelSizeBeforeCollapse.current, null);
440
460
  if (sizes !== nextSizes) setSizes(nextSizes);
441
461
  }
442
462
  }
@@ -551,12 +571,32 @@ function $480430d8582e6616$export$2e2bcd8739ae039(callback, durationMs = 10) {
551
571
  }
552
572
 
553
573
 
574
+ function $f5f5dfb280167863$export$b141efd0b0fb9174(arrayA, arrayB) {
575
+ if (arrayA.length !== arrayB.length) return false;
576
+ for(let index = 0; index < arrayA.length; index++){
577
+ if (arrayA[index] !== arrayB[index]) return false;
578
+ }
579
+ return true;
580
+ }
581
+
582
+
554
583
  // Limit the frequency of localStorage updates.
555
584
  const $eb1c4d3cf38334c2$var$savePanelGroupLayoutDebounced = (0, $480430d8582e6616$export$2e2bcd8739ae039)((0, $6ff1a22b27cc039d$export$af183b313c61be4f), 100);
556
- function $eb1c4d3cf38334c2$export$1d05749f6f573bb({ autoSaveId: autoSaveId , children: children = null , className: classNameFromProps = "" , direction: direction , id: idFromProps = null , onLayout: onLayout = null , style: styleFromProps = {} , tagName: Type = "div" }) {
585
+ function $eb1c4d3cf38334c2$var$throwServerError() {
586
+ throw new Error('PanelGroup "storage" prop required for server rendering.');
587
+ }
588
+ const $eb1c4d3cf38334c2$var$defaultStorage = {
589
+ getItem: typeof localStorage !== "undefined" ? (name)=>localStorage.getItem(name) : $eb1c4d3cf38334c2$var$throwServerError,
590
+ setItem: typeof localStorage !== "undefined" ? (name, value)=>localStorage.setItem(name, value) : $eb1c4d3cf38334c2$var$throwServerError
591
+ };
592
+ function $eb1c4d3cf38334c2$export$1d05749f6f573bb({ autoSaveId: autoSaveId , children: children = null , className: classNameFromProps = "" , direction: direction , id: idFromProps = null , onLayout: onLayout = null , storage: storage = $eb1c4d3cf38334c2$var$defaultStorage , style: styleFromProps = {} , tagName: Type = "div" }) {
557
593
  const groupId = (0, $968185313205dcfa$export$2e2bcd8739ae039)(idFromProps);
558
594
  const [activeHandleId, setActiveHandleId] = (0, $fpI56$useState)(null);
559
595
  const [panels, setPanels] = (0, $fpI56$useState)(new Map());
596
+ // When resizing is done via mouse/touch event–
597
+ // We store the initial Panel sizes in this ref, and apply move deltas to them instead of to the current sizes.
598
+ // This has the benefit of causing force-collapsed panels to spring back open if drag is reversed.
599
+ const initialDragStateRef = (0, $fpI56$useRef)(null);
560
600
  // Use a ref to guard against users passing inline props
561
601
  const callbacksRef = (0, $fpI56$useRef)({
562
602
  onLayout: onLayout
@@ -566,11 +606,9 @@ function $eb1c4d3cf38334c2$export$1d05749f6f573bb({ autoSaveId: autoSaveId , chi
566
606
  });
567
607
  // 0-1 values representing the relative size of each panel.
568
608
  const [sizes, setSizes] = (0, $fpI56$useState)([]);
569
- // Resize is calculated by the distance between the current pointer event and the resize handle being "dragged"
570
- // This value accounts for the initial offset when the touch/click starts, so the handle doesn't appear to "jump"
571
- const dragOffsetRef = (0, $fpI56$useRef)(0);
572
609
  // Used to support imperative collapse/expand API.
573
610
  const panelSizeBeforeCollapse = (0, $fpI56$useRef)(new Map());
611
+ const prevDeltaRef = (0, $fpI56$useRef)(0);
574
612
  // Store committed values to avoid unnecessarily re-running memoization/effects functions.
575
613
  const committedValuesRef = (0, $fpI56$useRef)({
576
614
  direction: direction,
@@ -627,7 +665,7 @@ function $eb1c4d3cf38334c2$export$1d05749f6f573bb({ autoSaveId: autoSaveId , chi
627
665
  let defaultSizes = undefined;
628
666
  if (autoSaveId) {
629
667
  const panelsArray = (0, $f30c804b5fe6cc1a$export$a861c0ad45885494)(panels);
630
- defaultSizes = (0, $6ff1a22b27cc039d$export$9c80c6617f0386da)(autoSaveId, panelsArray);
668
+ defaultSizes = (0, $6ff1a22b27cc039d$export$9c80c6617f0386da)(autoSaveId, panelsArray, storage);
631
669
  }
632
670
  if (defaultSizes != null) setSizes(defaultSizes);
633
671
  else {
@@ -660,7 +698,7 @@ function $eb1c4d3cf38334c2$export$1d05749f6f573bb({ autoSaveId: autoSaveId , chi
660
698
  if (autoSaveId) {
661
699
  if (sizes.length === 0 || sizes.length !== panels.size) return;
662
700
  const panelsArray = (0, $f30c804b5fe6cc1a$export$a861c0ad45885494)(panels);
663
- $eb1c4d3cf38334c2$var$savePanelGroupLayoutDebounced(autoSaveId, panelsArray, sizes);
701
+ $eb1c4d3cf38334c2$var$savePanelGroupLayoutDebounced(autoSaveId, panelsArray, sizes, storage);
664
702
  }
665
703
  }, [
666
704
  autoSaveId,
@@ -710,27 +748,37 @@ function $eb1c4d3cf38334c2$export$1d05749f6f573bb({ autoSaveId: autoSaveId , chi
710
748
  const panelsArray = (0, $f30c804b5fe6cc1a$export$a861c0ad45885494)(panels);
711
749
  const [idBefore, idAfter] = (0, $f30c804b5fe6cc1a$export$68d3a33c21dfbe27)(groupId, handleId, panelsArray);
712
750
  if (idBefore == null || idAfter == null) return;
713
- const movement = (0, $96f6397ae645d178$export$354b17c0684607ed)(event, groupId, handleId, panelsArray, direction, prevSizes, dragOffsetRef.current);
751
+ const movement = (0, $96f6397ae645d178$export$354b17c0684607ed)(event, groupId, handleId, panelsArray, direction, prevSizes, initialDragStateRef.current);
714
752
  if (movement === 0) return;
715
753
  const groupElement = (0, $f30c804b5fe6cc1a$export$5e67632cf3550a9c)(groupId);
716
754
  const rect = groupElement.getBoundingClientRect();
717
755
  const isHorizontal = direction === "horizontal";
718
756
  const size = isHorizontal ? rect.width : rect.height;
719
757
  const delta = movement / size * 100;
720
- const nextSizes = (0, $f30c804b5fe6cc1a$export$f50bae335f53943c)(panels, idBefore, idAfter, delta, prevSizes, panelSizeBeforeCollapse.current);
721
- if (prevSizes === nextSizes) {
722
- // If the pointer has moved too far to resize the panel any further,
723
- // update the cursor style for a visual clue.
724
- // This mimics VS Code behavior.
725
- if (isHorizontal) (0, $60180881129f5dc3$export$d395b5dfd066a659)(movement < 0 ? "horizontal-min" : "horizontal-max");
726
- else (0, $60180881129f5dc3$export$d395b5dfd066a659)(movement < 0 ? "vertical-min" : "vertical-max");
727
- } else {
728
- // Reset the cursor style to the the normal resize cursor.
729
- (0, $60180881129f5dc3$export$d395b5dfd066a659)(isHorizontal ? "horizontal" : "vertical");
758
+ const nextSizes = (0, $f30c804b5fe6cc1a$export$f50bae335f53943c)(event, panels, idBefore, idAfter, delta, prevSizes, panelSizeBeforeCollapse.current, initialDragStateRef.current);
759
+ const sizesChanged = !(0, $f5f5dfb280167863$export$b141efd0b0fb9174)(prevSizes, nextSizes);
760
+ // Don't update cursor for resizes triggered by keyboard interactions.
761
+ if ((0, $96f6397ae645d178$export$764db16956f554f8)(event) || (0, $96f6397ae645d178$export$c4dfce035d43d1e0)(event)) // Watch for multiple subsequent deltas; this might occur for tiny cursor movements.
762
+ // In this case, Panel sizes might not change–
763
+ // but updating cursor in this scenario would cause a flicker.
764
+ {
765
+ if (prevDeltaRef.current != delta) {
766
+ if (!sizesChanged) {
767
+ // If the pointer has moved too far to resize the panel any further,
768
+ // update the cursor style for a visual clue.
769
+ // This mimics VS Code behavior.
770
+ if (isHorizontal) (0, $60180881129f5dc3$export$d395b5dfd066a659)(movement < 0 ? "horizontal-min" : "horizontal-max");
771
+ else (0, $60180881129f5dc3$export$d395b5dfd066a659)(movement < 0 ? "vertical-min" : "vertical-max");
772
+ } else // Reset the cursor style to the the normal resize cursor.
773
+ (0, $60180881129f5dc3$export$d395b5dfd066a659)(isHorizontal ? "horizontal" : "vertical");
774
+ }
775
+ }
776
+ if (sizesChanged) {
730
777
  // If resize change handlers have been declared, this is the time to call them.
731
778
  (0, $f30c804b5fe6cc1a$export$b8e48269e4faa934)(panelsArray, prevSizes, nextSizes);
732
779
  setSizes(nextSizes);
733
780
  }
781
+ prevDeltaRef.current = delta;
734
782
  };
735
783
  return resizeHandler;
736
784
  }, [
@@ -759,7 +807,7 @@ function $eb1c4d3cf38334c2$export$1d05749f6f573bb({ autoSaveId: autoSaveId , chi
759
807
  if (idBefore == null || idAfter == null) return;
760
808
  const isLastPanel = index === panelsArray.length - 1;
761
809
  const delta = isLastPanel ? currentSize : 0 - currentSize;
762
- const nextSizes = (0, $f30c804b5fe6cc1a$export$f50bae335f53943c)(panels, idBefore, idAfter, delta, prevSizes, panelSizeBeforeCollapse.current);
810
+ const nextSizes = (0, $f30c804b5fe6cc1a$export$f50bae335f53943c)(null, panels, idBefore, idAfter, delta, prevSizes, panelSizeBeforeCollapse.current, null);
763
811
  if (prevSizes !== nextSizes) {
764
812
  // If resize change handlers have been declared, this is the time to call them.
765
813
  (0, $f30c804b5fe6cc1a$export$b8e48269e4faa934)(panelsArray, prevSizes, nextSizes);
@@ -782,7 +830,7 @@ function $eb1c4d3cf38334c2$export$1d05749f6f573bb({ autoSaveId: autoSaveId , chi
782
830
  if (idBefore == null || idAfter == null) return;
783
831
  const isLastPanel = index === panelsArray.length - 1;
784
832
  const delta = isLastPanel ? 0 - sizeBeforeCollapse : sizeBeforeCollapse;
785
- const nextSizes = (0, $f30c804b5fe6cc1a$export$f50bae335f53943c)(panels, idBefore, idAfter, delta, prevSizes, panelSizeBeforeCollapse.current);
833
+ const nextSizes = (0, $f30c804b5fe6cc1a$export$f50bae335f53943c)(null, panels, idBefore, idAfter, delta, prevSizes, panelSizeBeforeCollapse.current, null);
786
834
  if (prevSizes !== nextSizes) {
787
835
  // If resize change handlers have been declared, this is the time to call them.
788
836
  (0, $f30c804b5fe6cc1a$export$b8e48269e4faa934)(panelsArray, prevSizes, nextSizes);
@@ -798,11 +846,13 @@ function $eb1c4d3cf38334c2$export$1d05749f6f573bb({ autoSaveId: autoSaveId , chi
798
846
  if (index < 0) return;
799
847
  const currentSize = prevSizes[index];
800
848
  if (currentSize === nextSize) return;
849
+ if (panel.collapsible && nextSize === 0) ;
850
+ else nextSize = Math.min(panel.maxSize, Math.max(panel.minSize, nextSize));
801
851
  const [idBefore, idAfter] = (0, $f30c804b5fe6cc1a$export$5a5b0c1d38c23c3b)(id, panelsArray);
802
852
  if (idBefore == null || idAfter == null) return;
803
853
  const isLastPanel = index === panelsArray.length - 1;
804
854
  const delta = isLastPanel ? currentSize - nextSize : nextSize - currentSize;
805
- const nextSizes = (0, $f30c804b5fe6cc1a$export$f50bae335f53943c)(panels, idBefore, idAfter, delta, prevSizes, panelSizeBeforeCollapse.current);
855
+ const nextSizes = (0, $f30c804b5fe6cc1a$export$f50bae335f53943c)(null, panels, idBefore, idAfter, delta, prevSizes, panelSizeBeforeCollapse.current, null);
806
856
  if (prevSizes !== nextSizes) {
807
857
  // If resize change handlers have been declared, this is the time to call them.
808
858
  (0, $f30c804b5fe6cc1a$export$b8e48269e4faa934)(panelsArray, prevSizes, nextSizes);
@@ -821,11 +871,19 @@ function $eb1c4d3cf38334c2$export$1d05749f6f573bb({ autoSaveId: autoSaveId , chi
821
871
  resizePanel: resizePanel,
822
872
  startDragging: (id, event)=>{
823
873
  setActiveHandleId(id);
824
- dragOffsetRef.current = (0, $96f6397ae645d178$export$ec391ce65b083ed4)(event, id, direction);
874
+ if ((0, $96f6397ae645d178$export$764db16956f554f8)(event) || (0, $96f6397ae645d178$export$c4dfce035d43d1e0)(event)) {
875
+ const handleElement = (0, $f30c804b5fe6cc1a$export$2e27d3a347680388)(id);
876
+ initialDragStateRef.current = {
877
+ dragHandleRect: handleElement.getBoundingClientRect(),
878
+ dragOffset: (0, $96f6397ae645d178$export$ec391ce65b083ed4)(event, id, direction),
879
+ sizes: committedValuesRef.current.sizes
880
+ };
881
+ }
825
882
  },
826
883
  stopDragging: ()=>{
827
884
  (0, $60180881129f5dc3$export$b61932ee18f96e08)();
828
885
  setActiveHandleId(null);
886
+ initialDragStateRef.current = null;
829
887
  },
830
888
  unregisterPanel: unregisterPanel
831
889
  }), [
@@ -851,6 +909,7 @@ function $eb1c4d3cf38334c2$export$1d05749f6f573bb({ autoSaveId: autoSaveId , chi
851
909
  children: (0, $fpI56$createElement)(Type, {
852
910
  children: children,
853
911
  className: classNameFromProps,
912
+ "data-panel-group": "",
854
913
  "data-panel-group-direction": direction,
855
914
  "data-panel-group-id": groupId,
856
915
  style: {