react-grid-layout 2.2.2 → 2.2.3

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.
Files changed (63) hide show
  1. package/dist/{ResponsiveGridLayout-MbDNfJ8M.d.ts → ResponsiveGridLayout-BjVraYMQ.d.mts} +2 -3
  2. package/dist/{ResponsiveGridLayout-DqK__izz.d.mts → ResponsiveGridLayout-BrhkSyZk.d.ts} +2 -3
  3. package/dist/{calculate-FbCWy8x1.d.mts → calculate-DH4EVtn1.d.mts} +2 -2
  4. package/dist/{calculate-9RxGrt-U.d.ts → calculate-rP3DHexe.d.ts} +2 -2
  5. package/dist/{chunk-2DDROKB2.js → chunk-55DQUWLA.js} +21 -23
  6. package/dist/{chunk-AWM66AWF.mjs → chunk-76RTO6EO.mjs} +0 -2
  7. package/dist/{chunk-QGXQSZII.js → chunk-7MZZ6T4J.js} +49 -35
  8. package/dist/{chunk-BJFPTW5Q.js → chunk-A5WIFECI.js} +0 -2
  9. package/dist/{chunk-KEM2G3LX.js → chunk-BPZQUJ7Y.js} +82 -78
  10. package/dist/{chunk-XYPIYYYQ.mjs → chunk-KDANGDDL.mjs} +1 -3
  11. package/dist/chunk-O3KX3VYW.mjs +1 -0
  12. package/dist/{chunk-YFVX5RDK.mjs → chunk-PZLKKWSX.mjs} +19 -5
  13. package/dist/{chunk-XM2M6TC6.mjs → chunk-WGL5FSZH.mjs} +15 -11
  14. package/dist/chunk-ZJHF4QM5.js +2 -0
  15. package/dist/core.d.mts +5 -5
  16. package/dist/core.d.ts +5 -5
  17. package/dist/core.js +68 -70
  18. package/dist/core.mjs +3 -5
  19. package/dist/extras.d.mts +2 -2
  20. package/dist/extras.d.ts +2 -2
  21. package/dist/extras.js +8 -10
  22. package/dist/extras.mjs +1 -3
  23. package/dist/index.d.mts +5 -5
  24. package/dist/index.d.ts +5 -5
  25. package/dist/index.js +40 -42
  26. package/dist/index.mjs +5 -7
  27. package/dist/legacy.d.mts +2 -2
  28. package/dist/legacy.d.ts +2 -2
  29. package/dist/legacy.js +25 -17
  30. package/dist/legacy.mjs +14 -6
  31. package/dist/{position-CetgOHhD.d.mts → position-BV-g3Ezg.d.mts} +2 -2
  32. package/dist/{position-DhZqWO1-.d.ts → position-CSgQSjwQ.d.ts} +2 -2
  33. package/dist/react.d.mts +5 -5
  34. package/dist/react.d.ts +5 -5
  35. package/dist/react.js +26 -28
  36. package/dist/react.mjs +5 -7
  37. package/dist/{responsive-T0N0GmBB.d.mts → responsive-BrTV_0tK.d.mts} +2 -2
  38. package/dist/{responsive-DLRtE8v8.d.ts → responsive-C_YtBQYq.d.ts} +2 -2
  39. package/dist/{types-BiXsdXr7.d.mts → types-jd8MiKM1.d.mts} +1 -1
  40. package/dist/{types-BiXsdXr7.d.ts → types-jd8MiKM1.d.ts} +1 -1
  41. package/package.json +22 -22
  42. package/dist/chunk-2DDROKB2.js.map +0 -1
  43. package/dist/chunk-AWM66AWF.mjs.map +0 -1
  44. package/dist/chunk-BJFPTW5Q.js.map +0 -1
  45. package/dist/chunk-KEM2G3LX.js.map +0 -1
  46. package/dist/chunk-PBQSHIID.js +0 -4
  47. package/dist/chunk-PBQSHIID.js.map +0 -1
  48. package/dist/chunk-QGXQSZII.js.map +0 -1
  49. package/dist/chunk-XM2M6TC6.mjs.map +0 -1
  50. package/dist/chunk-XYPIYYYQ.mjs.map +0 -1
  51. package/dist/chunk-YFVX5RDK.mjs.map +0 -1
  52. package/dist/chunk-ZWN22PS2.mjs +0 -3
  53. package/dist/chunk-ZWN22PS2.mjs.map +0 -1
  54. package/dist/core.js.map +0 -1
  55. package/dist/core.mjs.map +0 -1
  56. package/dist/extras.js.map +0 -1
  57. package/dist/extras.mjs.map +0 -1
  58. package/dist/index.js.map +0 -1
  59. package/dist/index.mjs.map +0 -1
  60. package/dist/legacy.js.map +0 -1
  61. package/dist/legacy.mjs.map +0 -1
  62. package/dist/react.js.map +0 -1
  63. package/dist/react.mjs.map +0 -1
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- var chunk2DDROKB2_js = require('./chunk-2DDROKB2.js');
4
- var chunkBJFPTW5Q_js = require('./chunk-BJFPTW5Q.js');
3
+ var chunk55DQUWLA_js = require('./chunk-55DQUWLA.js');
4
+ var chunkA5WIFECI_js = require('./chunk-A5WIFECI.js');
5
5
  var React2 = require('react');
6
6
  var reactDraggable = require('react-draggable');
7
7
  var reactResizable = require('react-resizable');
@@ -48,7 +48,7 @@ function GridItem(props) {
48
48
  i,
49
49
  resizeHandles,
50
50
  resizeHandle,
51
- constraints = chunk2DDROKB2_js.defaultConstraints,
51
+ constraints = chunk55DQUWLA_js.defaultConstraints,
52
52
  layoutItem,
53
53
  layout = [],
54
54
  onDragStart: onDragStartProp,
@@ -131,14 +131,14 @@ function GridItem(props) {
131
131
  return positionStrategy.calcStyle(pos2);
132
132
  }
133
133
  if (useCSSTransforms) {
134
- return chunk2DDROKB2_js.setTransform(pos2);
134
+ return chunk55DQUWLA_js.setTransform(pos2);
135
135
  }
136
- const styleObj = chunk2DDROKB2_js.setTopLeft(pos2);
136
+ const styleObj = chunk55DQUWLA_js.setTopLeft(pos2);
137
137
  if (usePercentages) {
138
138
  return {
139
139
  ...styleObj,
140
- left: chunk2DDROKB2_js.perc(pos2.left / containerWidth),
141
- width: chunk2DDROKB2_js.perc(pos2.width / containerWidth)
140
+ left: chunk55DQUWLA_js.perc(pos2.left / containerWidth),
141
+ width: chunk55DQUWLA_js.perc(pos2.width / containerWidth)
142
142
  };
143
143
  }
144
144
  return styleObj;
@@ -184,12 +184,12 @@ function GridItem(props) {
184
184
  return;
185
185
  }
186
186
  setDragging(true);
187
- const rawPos = chunkBJFPTW5Q_js.calcXYRaw(
187
+ const rawPos = chunkA5WIFECI_js.calcXYRaw(
188
188
  positionParams,
189
189
  newPosition.top,
190
190
  newPosition.left
191
191
  );
192
- const { x: newX, y: newY } = chunk2DDROKB2_js.applyPositionConstraints(
192
+ const { x: newX, y: newY } = chunk55DQUWLA_js.applyPositionConstraints(
193
193
  constraints,
194
194
  effectiveLayoutItem,
195
195
  rawPos.x,
@@ -228,12 +228,12 @@ function GridItem(props) {
228
228
  thresholdExceededRef.current = true;
229
229
  dragPendingRef.current = false;
230
230
  if (onDragStartProp) {
231
- const rawPos2 = chunkBJFPTW5Q_js.calcXYRaw(
231
+ const rawPos2 = chunkA5WIFECI_js.calcXYRaw(
232
232
  positionParams,
233
233
  dragPositionRef.current.top,
234
234
  dragPositionRef.current.left
235
235
  );
236
- const { x: startX, y: startY } = chunk2DDROKB2_js.applyPositionConstraints(
236
+ const { x: startX, y: startY } = chunk55DQUWLA_js.applyPositionConstraints(
237
237
  constraints,
238
238
  effectiveLayoutItem,
239
239
  rawPos2.x,
@@ -252,17 +252,17 @@ function GridItem(props) {
252
252
  if (isBounded) {
253
253
  const { offsetParent } = node;
254
254
  if (offsetParent) {
255
- const bottomBoundary = offsetParent.clientHeight - chunkBJFPTW5Q_js.calcGridItemWHPx(h, rowHeight, margin[1]);
256
- top = chunkBJFPTW5Q_js.clamp(top, 0, bottomBoundary);
257
- const colWidth = chunkBJFPTW5Q_js.calcGridColWidth(positionParams);
258
- const rightBoundary = containerWidth - chunkBJFPTW5Q_js.calcGridItemWHPx(w, colWidth, margin[0]);
259
- left = chunkBJFPTW5Q_js.clamp(left, 0, rightBoundary);
255
+ const bottomBoundary = offsetParent.clientHeight - chunkA5WIFECI_js.calcGridItemWHPx(h, rowHeight, margin[1]);
256
+ top = chunkA5WIFECI_js.clamp(top, 0, bottomBoundary);
257
+ const colWidth2 = chunkA5WIFECI_js.calcGridColWidth(positionParams);
258
+ const rightBoundary = containerWidth - chunkA5WIFECI_js.calcGridItemWHPx(w, colWidth2, margin[0]);
259
+ left = chunkA5WIFECI_js.clamp(left, 0, rightBoundary);
260
260
  }
261
261
  }
262
262
  const newPosition = { top, left };
263
263
  dragPositionRef.current = newPosition;
264
- const rawPos = chunkBJFPTW5Q_js.calcXYRaw(positionParams, top, left);
265
- const { x: newX, y: newY } = chunk2DDROKB2_js.applyPositionConstraints(
264
+ const rawPos = chunkA5WIFECI_js.calcXYRaw(positionParams, top, left);
265
+ const { x: newX, y: newY } = chunk55DQUWLA_js.applyPositionConstraints(
266
266
  constraints,
267
267
  effectiveLayoutItem,
268
268
  rawPos.x,
@@ -309,8 +309,8 @@ function GridItem(props) {
309
309
  const newPosition = { top, left };
310
310
  setDragging(false);
311
311
  dragPositionRef.current = { left: 0, top: 0 };
312
- const rawPos = chunkBJFPTW5Q_js.calcXYRaw(positionParams, top, left);
313
- const { x: newX, y: newY } = chunk2DDROKB2_js.applyPositionConstraints(
312
+ const rawPos = chunkA5WIFECI_js.calcXYRaw(positionParams, top, left);
313
+ const { x: newX, y: newY } = chunk55DQUWLA_js.applyPositionConstraints(
314
314
  constraints,
315
315
  effectiveLayoutItem,
316
316
  rawPos.x,
@@ -341,7 +341,7 @@ function GridItem(props) {
341
341
  if (!handler) return;
342
342
  let updatedSize;
343
343
  if (node) {
344
- updatedSize = chunk2DDROKB2_js.resizeItemInDirection(
344
+ updatedSize = chunk55DQUWLA_js.resizeItemInDirection(
345
345
  resizeHandle2,
346
346
  position,
347
347
  size,
@@ -355,12 +355,12 @@ function GridItem(props) {
355
355
  };
356
356
  }
357
357
  resizePositionRef.current = updatedSize;
358
- const rawSize = chunkBJFPTW5Q_js.calcWHRaw(
358
+ const rawSize = chunkA5WIFECI_js.calcWHRaw(
359
359
  positionParams,
360
360
  updatedSize.width,
361
361
  updatedSize.height
362
362
  );
363
- const { w: newW, h: newH } = chunk2DDROKB2_js.applySizeConstraints(
363
+ const { w: newW, h: newH } = chunk55DQUWLA_js.applySizeConstraints(
364
364
  constraints,
365
365
  effectiveLayoutItem,
366
366
  rawSize.w,
@@ -390,7 +390,7 @@ function GridItem(props) {
390
390
  const handleResizeStart = React2.useCallback(
391
391
  (e, data) => {
392
392
  setResizing(true);
393
- const pos2 = chunkBJFPTW5Q_js.calcGridItemPosition(positionParams, x, y, w, h);
393
+ const pos2 = chunkA5WIFECI_js.calcGridItemPosition(positionParams, x, y, w, h);
394
394
  const typedData = {
395
395
  ...data,
396
396
  handle: data.handle
@@ -401,7 +401,7 @@ function GridItem(props) {
401
401
  );
402
402
  const handleResize = React2.useCallback(
403
403
  (e, data) => {
404
- const pos2 = chunkBJFPTW5Q_js.calcGridItemPosition(positionParams, x, y, w, h);
404
+ const pos2 = chunkA5WIFECI_js.calcGridItemPosition(positionParams, x, y, w, h);
405
405
  const typedData = {
406
406
  ...data,
407
407
  handle: data.handle
@@ -414,7 +414,7 @@ function GridItem(props) {
414
414
  (e, data) => {
415
415
  setResizing(false);
416
416
  resizePositionRef.current = { top: 0, left: 0, width: 0, height: 0 };
417
- const pos2 = chunkBJFPTW5Q_js.calcGridItemPosition(positionParams, x, y, w, h);
417
+ const pos2 = chunkA5WIFECI_js.calcGridItemPosition(positionParams, x, y, w, h);
418
418
  const typedData = {
419
419
  ...data,
420
420
  handle: data.handle
@@ -465,7 +465,7 @@ function GridItem(props) {
465
465
  }
466
466
  prevDroppingPositionRef.current = droppingPosition;
467
467
  }, [droppingPosition, dragging, i]);
468
- const pos = chunkBJFPTW5Q_js.calcGridItemPosition(
468
+ const pos = chunkA5WIFECI_js.calcGridItemPosition(
469
469
  positionParams,
470
470
  x,
471
471
  y,
@@ -475,12 +475,15 @@ function GridItem(props) {
475
475
  resizing ? resizePositionRef.current : null
476
476
  );
477
477
  const child = React2__default.default.Children.only(children);
478
- const minGridUnit = chunkBJFPTW5Q_js.calcGridItemPosition(positionParams, 0, 0, 1, 1);
478
+ const colWidth = chunkA5WIFECI_js.calcGridColWidth(positionParams);
479
479
  const minConstraints = [
480
- minGridUnit.width,
481
- minGridUnit.height
480
+ chunkA5WIFECI_js.calcGridItemWHPx(minW, colWidth, margin[0]),
481
+ chunkA5WIFECI_js.calcGridItemWHPx(minH, rowHeight, margin[1])
482
+ ];
483
+ const maxConstraints = [
484
+ chunkA5WIFECI_js.calcGridItemWHPx(maxW, colWidth, margin[0]),
485
+ chunkA5WIFECI_js.calcGridItemWHPx(maxH, rowHeight, margin[1])
482
486
  ];
483
- const maxConstraints = [Infinity, Infinity];
484
487
  const childProps = child.props;
485
488
  const childClassName = childProps["className"];
486
489
  const childStyle = childProps["style"];
@@ -563,7 +566,7 @@ function synchronizeLayoutWithChildren(initialLayout, children, cols, compactor)
563
566
  childKeys.add(key);
564
567
  const existingItem = initialLayout.find((l) => l.i === key);
565
568
  if (existingItem) {
566
- layout.push(chunkBJFPTW5Q_js.cloneLayoutItem(existingItem));
569
+ layout.push(chunkA5WIFECI_js.cloneLayoutItem(existingItem));
567
570
  } else {
568
571
  const childProps = child.props;
569
572
  const dataGrid = childProps["data-grid"];
@@ -588,14 +591,14 @@ function synchronizeLayoutWithChildren(initialLayout, children, cols, compactor)
588
591
  layout.push({
589
592
  i: key,
590
593
  x: 0,
591
- y: chunkBJFPTW5Q_js.bottom(layout),
594
+ y: chunkA5WIFECI_js.bottom(layout),
592
595
  w: 1,
593
596
  h: 1
594
597
  });
595
598
  }
596
599
  }
597
600
  });
598
- const corrected = chunkBJFPTW5Q_js.correctBounds(layout, { cols });
601
+ const corrected = chunkA5WIFECI_js.correctBounds(layout, { cols });
599
602
  return compactor.compact(corrected, cols);
600
603
  }
601
604
  function GridLayout(props) {
@@ -608,9 +611,9 @@ function GridLayout(props) {
608
611
  dragConfig: dragConfigProp,
609
612
  resizeConfig: resizeConfigProp,
610
613
  dropConfig: dropConfigProp,
611
- positionStrategy = chunk2DDROKB2_js.defaultPositionStrategy,
614
+ positionStrategy = chunk55DQUWLA_js.defaultPositionStrategy,
612
615
  compactor: compactorProp,
613
- constraints = chunk2DDROKB2_js.defaultConstraints,
616
+ constraints = chunk55DQUWLA_js.defaultConstraints,
614
617
  // Layout data
615
618
  layout: propsLayout = [],
616
619
  droppingItem: droppingItemProp,
@@ -631,19 +634,19 @@ function GridLayout(props) {
631
634
  onDropDragOver: onDropDragOverProp = noop
632
635
  } = props;
633
636
  const gridConfig = React2.useMemo(
634
- () => ({ ...chunk2DDROKB2_js.defaultGridConfig, ...gridConfigProp }),
637
+ () => ({ ...chunk55DQUWLA_js.defaultGridConfig, ...gridConfigProp }),
635
638
  [gridConfigProp]
636
639
  );
637
640
  const dragConfig = React2.useMemo(
638
- () => ({ ...chunk2DDROKB2_js.defaultDragConfig, ...dragConfigProp }),
641
+ () => ({ ...chunk55DQUWLA_js.defaultDragConfig, ...dragConfigProp }),
639
642
  [dragConfigProp]
640
643
  );
641
644
  const resizeConfig = React2.useMemo(
642
- () => ({ ...chunk2DDROKB2_js.defaultResizeConfig, ...resizeConfigProp }),
645
+ () => ({ ...chunk55DQUWLA_js.defaultResizeConfig, ...resizeConfigProp }),
643
646
  [resizeConfigProp]
644
647
  );
645
648
  const dropConfig = React2.useMemo(
646
- () => ({ ...chunk2DDROKB2_js.defaultDropConfig, ...dropConfigProp }),
649
+ () => ({ ...chunk55DQUWLA_js.defaultDropConfig, ...dropConfigProp }),
647
650
  [dropConfigProp]
648
651
  );
649
652
  const { cols, rowHeight, maxRows, margin, containerPadding } = gridConfig;
@@ -664,7 +667,7 @@ function GridLayout(props) {
664
667
  defaultItem: defaultDropItem,
665
668
  onDragOver: dropConfigOnDragOver
666
669
  } = dropConfig;
667
- const compactor = compactorProp ?? chunk2DDROKB2_js.getCompactor("vertical");
670
+ const compactor = compactorProp ?? chunk55DQUWLA_js.getCompactor("vertical");
668
671
  const compactType = compactor.type;
669
672
  const allowOverlap = compactor.allowOverlap;
670
673
  const preventCollision = compactor.preventCollision ?? false;
@@ -744,14 +747,14 @@ function GridLayout(props) {
744
747
  }, [layout, activeDrag, onLayoutChange, droppingItem.i]);
745
748
  const containerHeight = React2.useMemo(() => {
746
749
  if (!autoSize) return void 0;
747
- const nbRow = chunkBJFPTW5Q_js.bottom(layout);
750
+ const nbRow = chunkA5WIFECI_js.bottom(layout);
748
751
  const containerPaddingY = effectiveContainerPadding[1];
749
752
  return nbRow * rowHeight + (nbRow - 1) * margin[1] + containerPaddingY * 2 + "px";
750
753
  }, [autoSize, layout, rowHeight, margin, effectiveContainerPadding]);
751
754
  const onDragStart = React2.useCallback(
752
755
  (i, _x, _y, data) => {
753
756
  const currentLayout = layoutRef.current;
754
- const l = chunkBJFPTW5Q_js.getLayoutItem(currentLayout, i);
757
+ const l = chunkA5WIFECI_js.getLayoutItem(currentLayout, i);
755
758
  if (!l) return;
756
759
  const placeholder = {
757
760
  w: l.w,
@@ -760,7 +763,7 @@ function GridLayout(props) {
760
763
  y: l.y,
761
764
  i
762
765
  };
763
- oldDragItemRef.current = chunkBJFPTW5Q_js.cloneLayoutItem(l);
766
+ oldDragItemRef.current = chunkA5WIFECI_js.cloneLayoutItem(l);
764
767
  oldLayoutRef.current = currentLayout;
765
768
  setActiveDrag(placeholder);
766
769
  onDragStartProp(currentLayout, l, l, null, data.e, data.node);
@@ -771,7 +774,7 @@ function GridLayout(props) {
771
774
  (i, x, y, data) => {
772
775
  const currentLayout = layoutRef.current;
773
776
  const oldDragItem = oldDragItemRef.current;
774
- const l = chunkBJFPTW5Q_js.getLayoutItem(currentLayout, i);
777
+ const l = chunkA5WIFECI_js.getLayoutItem(currentLayout, i);
775
778
  if (!l) return;
776
779
  const placeholder = {
777
780
  w: l.w,
@@ -780,7 +783,7 @@ function GridLayout(props) {
780
783
  y: l.y,
781
784
  i
782
785
  };
783
- const newLayout = chunkBJFPTW5Q_js.moveElement(
786
+ const newLayout = chunkA5WIFECI_js.moveElement(
784
787
  currentLayout,
785
788
  l,
786
789
  x,
@@ -802,9 +805,9 @@ function GridLayout(props) {
802
805
  if (!activeDrag) return;
803
806
  const currentLayout = layoutRef.current;
804
807
  const oldDragItem = oldDragItemRef.current;
805
- const l = chunkBJFPTW5Q_js.getLayoutItem(currentLayout, i);
808
+ const l = chunkA5WIFECI_js.getLayoutItem(currentLayout, i);
806
809
  if (!l) return;
807
- const newLayout = chunkBJFPTW5Q_js.moveElement(
810
+ const newLayout = chunkA5WIFECI_js.moveElement(
808
811
  currentLayout,
809
812
  l,
810
813
  x,
@@ -840,9 +843,9 @@ function GridLayout(props) {
840
843
  const onResizeStart = React2.useCallback(
841
844
  (i, _w, _h, data) => {
842
845
  const currentLayout = layoutRef.current;
843
- const l = chunkBJFPTW5Q_js.getLayoutItem(currentLayout, i);
846
+ const l = chunkA5WIFECI_js.getLayoutItem(currentLayout, i);
844
847
  if (!l) return;
845
- oldResizeItemRef.current = chunkBJFPTW5Q_js.cloneLayoutItem(l);
848
+ oldResizeItemRef.current = chunkA5WIFECI_js.cloneLayoutItem(l);
846
849
  oldLayoutRef.current = currentLayout;
847
850
  setResizing(true);
848
851
  onResizeStartProp(currentLayout, l, l, null, data.e, data.node);
@@ -857,7 +860,7 @@ function GridLayout(props) {
857
860
  let shouldMoveItem = false;
858
861
  let newX;
859
862
  let newY;
860
- const [newLayout, l] = chunkBJFPTW5Q_js.withLayoutItem(currentLayout, i, (item) => {
863
+ const [newLayout, l] = chunkA5WIFECI_js.withLayoutItem(currentLayout, i, (item) => {
861
864
  newX = item.x;
862
865
  newY = item.y;
863
866
  if (["sw", "w", "nw", "n", "ne"].includes(handle)) {
@@ -874,7 +877,7 @@ function GridLayout(props) {
874
877
  shouldMoveItem = true;
875
878
  }
876
879
  if (preventCollision && !allowOverlap) {
877
- const collisions = chunkBJFPTW5Q_js.getAllCollisions(currentLayout, {
880
+ const collisions = chunkA5WIFECI_js.getAllCollisions(currentLayout, {
878
881
  ...item,
879
882
  w,
880
883
  h,
@@ -896,7 +899,7 @@ function GridLayout(props) {
896
899
  if (!l) return;
897
900
  let finalLayout = newLayout;
898
901
  if (shouldMoveItem && newX !== void 0 && newY !== void 0) {
899
- finalLayout = chunkBJFPTW5Q_js.moveElement(
902
+ finalLayout = chunkA5WIFECI_js.moveElement(
900
903
  newLayout,
901
904
  l,
902
905
  newX,
@@ -933,7 +936,7 @@ function GridLayout(props) {
933
936
  (i, _w, _h, data) => {
934
937
  const currentLayout = layoutRef.current;
935
938
  const oldResizeItem = oldResizeItemRef.current;
936
- const l = chunkBJFPTW5Q_js.getLayoutItem(currentLayout, i);
939
+ const l = chunkA5WIFECI_js.getLayoutItem(currentLayout, i);
937
940
  const finalLayout = compactor.compact(currentLayout, cols);
938
941
  onResizeStopProp(
939
942
  finalLayout,
@@ -1004,13 +1007,13 @@ function GridLayout(props) {
1004
1007
  containerWidth: width,
1005
1008
  containerPadding: effectiveContainerPadding
1006
1009
  };
1007
- const actualColWidth = chunkBJFPTW5Q_js.calcGridColWidth(positionParams);
1008
- const itemPixelWidth = chunkBJFPTW5Q_js.calcGridItemWHPx(
1010
+ const actualColWidth = chunkA5WIFECI_js.calcGridColWidth(positionParams);
1011
+ const itemPixelWidth = chunkA5WIFECI_js.calcGridItemWHPx(
1009
1012
  finalDroppingItem.w,
1010
1013
  actualColWidth,
1011
1014
  margin[0]
1012
1015
  );
1013
- const itemPixelHeight = chunkBJFPTW5Q_js.calcGridItemWHPx(
1016
+ const itemPixelHeight = chunkA5WIFECI_js.calcGridItemWHPx(
1014
1017
  finalDroppingItem.h,
1015
1018
  rowHeight,
1016
1019
  margin[1]
@@ -1027,7 +1030,7 @@ function GridLayout(props) {
1027
1030
  e: e.nativeEvent
1028
1031
  };
1029
1032
  if (!droppingDOMNode) {
1030
- const calculatedPosition = chunkBJFPTW5Q_js.calcXY(
1033
+ const calculatedPosition = chunkA5WIFECI_js.calcXY(
1031
1034
  positionParams,
1032
1035
  clampedGridY,
1033
1036
  clampedGridX,
@@ -1036,8 +1039,11 @@ function GridLayout(props) {
1036
1039
  );
1037
1040
  setDroppingDOMNode(/* @__PURE__ */ jsxRuntime.jsx("div", {}, finalDroppingItem.i));
1038
1041
  setDroppingPosition(newDroppingPosition);
1042
+ const baseLayout = layoutRef.current.filter(
1043
+ (l) => l.i !== finalDroppingItem.i
1044
+ );
1039
1045
  setLayout([
1040
- ...layoutRef.current,
1046
+ ...baseLayout,
1041
1047
  {
1042
1048
  ...finalDroppingItem,
1043
1049
  x: calculatedPosition.x,
@@ -1103,7 +1109,7 @@ function GridLayout(props) {
1103
1109
  const processGridItem = React2.useCallback(
1104
1110
  (child, isDroppingItem) => {
1105
1111
  if (!child || !child.key) return null;
1106
- const l = chunkBJFPTW5Q_js.getLayoutItem(layout, String(child.key));
1112
+ const l = chunkA5WIFECI_js.getLayoutItem(layout, String(child.key));
1107
1113
  if (!l) return null;
1108
1114
  const draggable = typeof l.isDraggable === "boolean" ? l.isDraggable : !l.static && isDraggable;
1109
1115
  const resizable = typeof l.isResizable === "boolean" ? l.isResizable : !l.static && isResizable;
@@ -1291,14 +1297,14 @@ function synchronizeLayoutWithChildren2(initialLayout, children, cols, compactor
1291
1297
  layout.push({
1292
1298
  i: key,
1293
1299
  x: 0,
1294
- y: chunkBJFPTW5Q_js.bottom(layout),
1300
+ y: chunkA5WIFECI_js.bottom(layout),
1295
1301
  w: 1,
1296
1302
  h: 1
1297
1303
  });
1298
1304
  }
1299
1305
  }
1300
1306
  });
1301
- const corrected = chunkBJFPTW5Q_js.correctBounds(layout, { cols });
1307
+ const corrected = chunkA5WIFECI_js.correctBounds(layout, { cols });
1302
1308
  return compactor.compact(corrected, cols);
1303
1309
  }
1304
1310
  function ResponsiveGridLayout(props) {
@@ -1319,17 +1325,17 @@ function ResponsiveGridLayout(props) {
1319
1325
  onWidthChange = noop2,
1320
1326
  ...restProps
1321
1327
  } = props;
1322
- const compactor = compactorProp ?? chunk2DDROKB2_js.getCompactor("vertical");
1328
+ const compactor = compactorProp ?? chunk55DQUWLA_js.getCompactor("vertical");
1323
1329
  const compactType = compactor.type;
1324
1330
  const allowOverlap = compactor.allowOverlap;
1325
1331
  const initialBreakpoint = React2.useMemo(() => {
1326
- return propBreakpoint ?? chunk2DDROKB2_js.getBreakpointFromWidth(breakpoints, width);
1332
+ return propBreakpoint ?? chunk55DQUWLA_js.getBreakpointFromWidth(breakpoints, width);
1327
1333
  }, []);
1328
1334
  const initialCols = React2.useMemo(() => {
1329
- return chunk2DDROKB2_js.getColsFromBreakpoint(initialBreakpoint, colsConfig);
1335
+ return chunk55DQUWLA_js.getColsFromBreakpoint(initialBreakpoint, colsConfig);
1330
1336
  }, [initialBreakpoint, colsConfig]);
1331
1337
  const initialLayout = React2.useMemo(() => {
1332
- return chunk2DDROKB2_js.findOrGenerateResponsiveLayout(
1338
+ return chunk55DQUWLA_js.findOrGenerateResponsiveLayout(
1333
1339
  propsLayouts,
1334
1340
  breakpoints,
1335
1341
  initialBreakpoint,
@@ -1354,7 +1360,7 @@ function ResponsiveGridLayout(props) {
1354
1360
  }, [layouts]);
1355
1361
  const derivedLayout = React2.useMemo(() => {
1356
1362
  if (!fastEquals.deepEqual(propsLayouts, prevLayoutsRef.current)) {
1357
- return chunk2DDROKB2_js.findOrGenerateResponsiveLayout(
1363
+ return chunk55DQUWLA_js.findOrGenerateResponsiveLayout(
1358
1364
  propsLayouts,
1359
1365
  breakpoints,
1360
1366
  breakpoint,
@@ -1376,7 +1382,7 @@ function ResponsiveGridLayout(props) {
1376
1382
  }, [derivedLayout, propsLayouts]);
1377
1383
  React2.useEffect(() => {
1378
1384
  if (compactType !== prevCompactTypeRef.current) {
1379
- const newLayout = compactor.compact(chunkBJFPTW5Q_js.cloneLayout(effectiveLayout), cols);
1385
+ const newLayout = compactor.compact(chunkA5WIFECI_js.cloneLayout(effectiveLayout), cols);
1380
1386
  const newLayouts = {
1381
1387
  ...layoutsRef.current,
1382
1388
  [breakpoint]: newLayout
@@ -1405,15 +1411,15 @@ function ResponsiveGridLayout(props) {
1405
1411
  );
1406
1412
  const colsChanged = !fastEquals.deepEqual(colsConfig, prevColsRef.current);
1407
1413
  if (widthChanged || breakpointPropChanged || breakpointsChanged || colsChanged) {
1408
- const newBreakpoint = propBreakpoint ?? chunk2DDROKB2_js.getBreakpointFromWidth(breakpoints, width);
1409
- const newCols = chunk2DDROKB2_js.getColsFromBreakpoint(newBreakpoint, colsConfig);
1414
+ const newBreakpoint = propBreakpoint ?? chunk55DQUWLA_js.getBreakpointFromWidth(breakpoints, width);
1415
+ const newCols = chunk55DQUWLA_js.getColsFromBreakpoint(newBreakpoint, colsConfig);
1410
1416
  const lastBreakpoint = breakpoint;
1411
1417
  if (lastBreakpoint !== newBreakpoint || breakpointsChanged || colsChanged) {
1412
1418
  const newLayouts = { ...layoutsRef.current };
1413
1419
  if (!newLayouts[lastBreakpoint]) {
1414
- newLayouts[lastBreakpoint] = chunkBJFPTW5Q_js.cloneLayout(layout);
1420
+ newLayouts[lastBreakpoint] = chunkA5WIFECI_js.cloneLayout(layout);
1415
1421
  }
1416
- let newLayout = chunk2DDROKB2_js.findOrGenerateResponsiveLayout(
1422
+ let newLayout = chunk55DQUWLA_js.findOrGenerateResponsiveLayout(
1417
1423
  newLayouts,
1418
1424
  breakpoints,
1419
1425
  newBreakpoint,
@@ -1436,11 +1442,11 @@ function ResponsiveGridLayout(props) {
1436
1442
  onBreakpointChange(newBreakpoint, newCols);
1437
1443
  onLayoutChange(newLayout, newLayouts);
1438
1444
  }
1439
- const currentMargin2 = chunk2DDROKB2_js.getIndentationValue(
1445
+ const currentMargin2 = chunk55DQUWLA_js.getIndentationValue(
1440
1446
  propMargin,
1441
1447
  newBreakpoint
1442
1448
  );
1443
- const currentPadding = propContainerPadding ? chunk2DDROKB2_js.getIndentationValue(
1449
+ const currentPadding = propContainerPadding ? chunk55DQUWLA_js.getIndentationValue(
1444
1450
  propContainerPadding,
1445
1451
  newBreakpoint
1446
1452
  ) : null;
@@ -1483,14 +1489,14 @@ function ResponsiveGridLayout(props) {
1483
1489
  [breakpoint, onLayoutChange]
1484
1490
  );
1485
1491
  const currentMargin = React2.useMemo(() => {
1486
- return chunk2DDROKB2_js.getIndentationValue(
1492
+ return chunk55DQUWLA_js.getIndentationValue(
1487
1493
  propMargin,
1488
1494
  breakpoint
1489
1495
  );
1490
1496
  }, [propMargin, breakpoint]);
1491
1497
  const currentContainerPadding = React2.useMemo(() => {
1492
1498
  if (propContainerPadding === null) return null;
1493
- return chunk2DDROKB2_js.getIndentationValue(
1499
+ return chunk55DQUWLA_js.getIndentationValue(
1494
1500
  propContainerPadding,
1495
1501
  breakpoint
1496
1502
  );
@@ -1522,5 +1528,3 @@ function ResponsiveGridLayout(props) {
1522
1528
  exports.GridItem = GridItem;
1523
1529
  exports.GridLayout = GridLayout;
1524
1530
  exports.ResponsiveGridLayout = ResponsiveGridLayout;
1525
- //# sourceMappingURL=chunk-KEM2G3LX.js.map
1526
- //# sourceMappingURL=chunk-KEM2G3LX.js.map
@@ -1,4 +1,4 @@
1
- import { getStatics, collides, getFirstCollision, bottom, sortLayoutItemsByRowCol, cloneLayoutItem, sortLayoutItemsByColRow, cloneLayout, correctBounds } from './chunk-AWM66AWF.mjs';
1
+ import { getStatics, collides, getFirstCollision, bottom, sortLayoutItemsByRowCol, cloneLayoutItem, sortLayoutItemsByColRow, cloneLayout, correctBounds } from './chunk-76RTO6EO.mjs';
2
2
 
3
3
  // src/core/constraints.ts
4
4
  function clamp(value, min, max) {
@@ -564,5 +564,3 @@ function getIndentationValue(value, breakpoint) {
564
564
  }
565
565
 
566
566
  export { absoluteStrategy, applyPositionConstraints, applySizeConstraints, aspectRatio, boundedX, boundedY, compactItemHorizontal, compactItemVertical, containerBounds, createScaledStrategy, defaultConstraints, defaultDragConfig, defaultDropConfig, defaultGridConfig, defaultPositionStrategy, defaultResizeConfig, findOrGenerateResponsiveLayout, getBreakpointFromWidth, getColsFromBreakpoint, getCompactor, getIndentationValue, gridBounds, horizontalCompactor, horizontalOverlapCompactor, maxSize, minMaxSize, minSize, noCompactor, noOverlapCompactor, perc, resizeItemInDirection, resolveCompactionCollision, setTopLeft, setTransform, snapToGrid, sortBreakpoints, transformStrategy, verticalCompactor, verticalOverlapCompactor };
567
- //# sourceMappingURL=chunk-XYPIYYYQ.mjs.map
568
- //# sourceMappingURL=chunk-XYPIYYYQ.mjs.map
@@ -0,0 +1 @@
1
+
@@ -1,5 +1,5 @@
1
- import { verticalCompactor, sortBreakpoints, getBreakpointFromWidth, getColsFromBreakpoint, findOrGenerateResponsiveLayout } from './chunk-XYPIYYYQ.mjs';
2
- import { correctBounds, cloneLayout, getLayoutItem, cloneLayoutItem, moveElement, bottom } from './chunk-AWM66AWF.mjs';
1
+ import { verticalCompactor, sortBreakpoints, getBreakpointFromWidth, getColsFromBreakpoint, findOrGenerateResponsiveLayout } from './chunk-KDANGDDL.mjs';
2
+ import { correctBounds, cloneLayout, getLayoutItem, cloneLayoutItem, moveElement, bottom } from './chunk-76RTO6EO.mjs';
3
3
  import { useState, useRef, useCallback, useEffect, useMemo } from 'react';
4
4
  import { deepEqual } from 'fast-equals';
5
5
 
@@ -24,14 +24,30 @@ function useContainerWidth(options = {}) {
24
24
  if (!node) return;
25
25
  measureWidth();
26
26
  if (typeof ResizeObserver !== "undefined") {
27
+ let rafId = null;
27
28
  observerRef.current = new ResizeObserver((entries) => {
28
29
  const entry = entries[0];
29
30
  if (entry) {
30
31
  const newWidth = entry.contentRect.width;
31
- setWidth(newWidth);
32
+ if (rafId !== null) {
33
+ cancelAnimationFrame(rafId);
34
+ }
35
+ rafId = requestAnimationFrame(() => {
36
+ setWidth(newWidth);
37
+ rafId = null;
38
+ });
32
39
  }
33
40
  });
34
41
  observerRef.current.observe(node);
42
+ return () => {
43
+ if (rafId !== null) {
44
+ cancelAnimationFrame(rafId);
45
+ }
46
+ if (observerRef.current) {
47
+ observerRef.current.disconnect();
48
+ observerRef.current = null;
49
+ }
50
+ };
35
51
  }
36
52
  return () => {
37
53
  if (observerRef.current) {
@@ -421,5 +437,3 @@ function useResponsiveLayout(options) {
421
437
  }
422
438
 
423
439
  export { DEFAULT_BREAKPOINTS, DEFAULT_COLS, useContainerWidth, useGridLayout, useResponsiveLayout };
424
- //# sourceMappingURL=chunk-YFVX5RDK.mjs.map
425
- //# sourceMappingURL=chunk-YFVX5RDK.mjs.map
@@ -1,5 +1,5 @@
1
- import { defaultConstraints, setTransform, setTopLeft, perc, applyPositionConstraints, resizeItemInDirection, applySizeConstraints, defaultPositionStrategy, defaultGridConfig, defaultDragConfig, defaultResizeConfig, defaultDropConfig, getCompactor, getBreakpointFromWidth, getColsFromBreakpoint, findOrGenerateResponsiveLayout, getIndentationValue } from './chunk-XYPIYYYQ.mjs';
2
- import { calcXYRaw, calcGridItemWHPx, clamp, calcGridColWidth, calcWHRaw, calcGridItemPosition, bottom, getLayoutItem, cloneLayoutItem, moveElement, withLayoutItem, getAllCollisions, calcXY, cloneLayout, correctBounds } from './chunk-AWM66AWF.mjs';
1
+ import { defaultConstraints, setTransform, setTopLeft, perc, applyPositionConstraints, resizeItemInDirection, applySizeConstraints, defaultPositionStrategy, defaultGridConfig, defaultDragConfig, defaultResizeConfig, defaultDropConfig, getCompactor, getBreakpointFromWidth, getColsFromBreakpoint, findOrGenerateResponsiveLayout, getIndentationValue } from './chunk-KDANGDDL.mjs';
2
+ import { calcXYRaw, calcGridItemWHPx, clamp, calcGridColWidth, calcWHRaw, calcGridItemPosition, bottom, getLayoutItem, cloneLayoutItem, moveElement, withLayoutItem, getAllCollisions, calcXY, cloneLayout, correctBounds } from './chunk-76RTO6EO.mjs';
3
3
  import React2, { useState, useRef, useMemo, useCallback, useEffect } from 'react';
4
4
  import { DraggableCore } from 'react-draggable';
5
5
  import { Resizable } from 'react-resizable';
@@ -247,8 +247,8 @@ function GridItem(props) {
247
247
  if (offsetParent) {
248
248
  const bottomBoundary = offsetParent.clientHeight - calcGridItemWHPx(h, rowHeight, margin[1]);
249
249
  top = clamp(top, 0, bottomBoundary);
250
- const colWidth = calcGridColWidth(positionParams);
251
- const rightBoundary = containerWidth - calcGridItemWHPx(w, colWidth, margin[0]);
250
+ const colWidth2 = calcGridColWidth(positionParams);
251
+ const rightBoundary = containerWidth - calcGridItemWHPx(w, colWidth2, margin[0]);
252
252
  left = clamp(left, 0, rightBoundary);
253
253
  }
254
254
  }
@@ -468,12 +468,15 @@ function GridItem(props) {
468
468
  resizing ? resizePositionRef.current : null
469
469
  );
470
470
  const child = React2.Children.only(children);
471
- const minGridUnit = calcGridItemPosition(positionParams, 0, 0, 1, 1);
471
+ const colWidth = calcGridColWidth(positionParams);
472
472
  const minConstraints = [
473
- minGridUnit.width,
474
- minGridUnit.height
473
+ calcGridItemWHPx(minW, colWidth, margin[0]),
474
+ calcGridItemWHPx(minH, rowHeight, margin[1])
475
+ ];
476
+ const maxConstraints = [
477
+ calcGridItemWHPx(maxW, colWidth, margin[0]),
478
+ calcGridItemWHPx(maxH, rowHeight, margin[1])
475
479
  ];
476
- const maxConstraints = [Infinity, Infinity];
477
480
  const childProps = child.props;
478
481
  const childClassName = childProps["className"];
479
482
  const childStyle = childProps["style"];
@@ -1029,8 +1032,11 @@ function GridLayout(props) {
1029
1032
  );
1030
1033
  setDroppingDOMNode(/* @__PURE__ */ jsx("div", {}, finalDroppingItem.i));
1031
1034
  setDroppingPosition(newDroppingPosition);
1035
+ const baseLayout = layoutRef.current.filter(
1036
+ (l) => l.i !== finalDroppingItem.i
1037
+ );
1032
1038
  setLayout([
1033
- ...layoutRef.current,
1039
+ ...baseLayout,
1034
1040
  {
1035
1041
  ...finalDroppingItem,
1036
1042
  x: calculatedPosition.x,
@@ -1513,5 +1519,3 @@ function ResponsiveGridLayout(props) {
1513
1519
  }
1514
1520
 
1515
1521
  export { GridItem, GridLayout, ResponsiveGridLayout };
1516
- //# sourceMappingURL=chunk-XM2M6TC6.mjs.map
1517
- //# sourceMappingURL=chunk-XM2M6TC6.mjs.map
@@ -0,0 +1,2 @@
1
+ 'use strict';
2
+
package/dist/core.d.mts CHANGED
@@ -1,8 +1,8 @@
1
- import { f as LayoutConstraint, a as LayoutItem, g as ConstraintContext, d as ResizeHandleAxis } from './types-BiXsdXr7.mjs';
2
- export { A as ArrayElement, B as Breakpoint, p as BreakpointCols, b as Breakpoints, C as CompactType, c as Compactor, r as DeepPartial, m as DragConfig, j as DragOverEvent, o as DropConfig, D as DroppingPosition, E as EventCallback, l as GridConfig, G as GridDragEvent, e as GridResizeEvent, L as Layout, M as Mutable, q as OnBreakpointChangeCallback, O as OnLayoutChangeCallback, h as PartialPosition, P as Position, k as PositionStrategy, i as ReactDraggableCallbackData, n as ResizeConfig, R as ResponsiveLayouts, S as Size, t as defaultDragConfig, v as defaultDropConfig, s as defaultGridConfig, u as defaultResizeConfig } from './types-BiXsdXr7.mjs';
3
- export { c as collides, h as findOrGenerateResponsiveLayout, a as getAllCollisions, e as getBreakpointFromWidth, f as getColsFromBreakpoint, g as getFirstCollision, j as getIndentationValue, i as sortBreakpoints, s as sortLayoutItems, d as sortLayoutItemsByColRow, b as sortLayoutItemsByRowCol } from './responsive-T0N0GmBB.mjs';
4
- export { A as absoluteStrategy, b as bottom, c as cloneLayout, a as cloneLayoutItem, u as compactItemHorizontal, t as compactItemVertical, k as correctBounds, B as createScaledStrategy, C as defaultPositionStrategy, d as getCompactor, g as getLayoutItem, i as getStatics, h as horizontalCompactor, p as horizontalOverlapCompactor, j as modifyLayout, m as moveElement, l as moveElementAwayFromCollision, n as noCompactor, q as noOverlapCompactor, x as perc, y as resizeItemInDirection, r as resolveCompactionCollision, f as setTopLeft, s as setTransform, z as transformStrategy, v as validateLayout, e as verticalCompactor, o as verticalOverlapCompactor, w as withLayoutItem } from './position-CetgOHhD.mjs';
5
- export { d as GridCellConfig, G as GridCellDimensions, P as PositionParams, j as calcGridCellDimensions, e as calcGridColWidth, c as calcGridItemPosition, f as calcGridItemWHPx, b as calcWH, h as calcWHRaw, a as calcXY, g as calcXYRaw, i as clamp } from './calculate-FbCWy8x1.mjs';
1
+ import { f as LayoutConstraint, d as LayoutItem, g as ConstraintContext, R as ResizeHandleAxis } from './types-jd8MiKM1.mjs';
2
+ export { A as ArrayElement, B as Breakpoint, h as BreakpointCols, a as Breakpoints, C as CompactType, b as Compactor, i as DeepPartial, j as DragConfig, k as DragOverEvent, l as DropConfig, D as DroppingPosition, E as EventCallback, m as GridConfig, G as GridDragEvent, c as GridResizeEvent, L as Layout, M as Mutable, O as OnBreakpointChangeCallback, n as OnLayoutChangeCallback, o as PartialPosition, P as Position, p as PositionStrategy, q as ReactDraggableCallbackData, r as ResizeConfig, e as ResponsiveLayouts, S as Size, s as defaultDragConfig, t as defaultDropConfig, u as defaultGridConfig, v as defaultResizeConfig } from './types-jd8MiKM1.mjs';
3
+ export { c as collides, f as findOrGenerateResponsiveLayout, g as getAllCollisions, a as getBreakpointFromWidth, b as getColsFromBreakpoint, d as getFirstCollision, i as getIndentationValue, j as sortBreakpoints, s as sortLayoutItems, e as sortLayoutItemsByColRow, h as sortLayoutItemsByRowCol } from './responsive-BrTV_0tK.mjs';
4
+ export { i as absoluteStrategy, b as bottom, c as cloneLayout, a as cloneLayoutItem, j as compactItemHorizontal, k as compactItemVertical, l as correctBounds, o as createScaledStrategy, p as defaultPositionStrategy, g as getCompactor, d as getLayoutItem, q as getStatics, h as horizontalCompactor, r as horizontalOverlapCompactor, t as modifyLayout, m as moveElement, u as moveElementAwayFromCollision, n as noCompactor, w as noOverlapCompactor, x as perc, y as resizeItemInDirection, z as resolveCompactionCollision, s as setTopLeft, e as setTransform, A as transformStrategy, v as validateLayout, f as verticalCompactor, B as verticalOverlapCompactor, C as withLayoutItem } from './position-BV-g3Ezg.mjs';
5
+ export { G as GridCellConfig, d as GridCellDimensions, P as PositionParams, e as calcGridCellDimensions, f as calcGridColWidth, c as calcGridItemPosition, g as calcGridItemWHPx, a as calcWH, h as calcWHRaw, b as calcXY, i as calcXYRaw, j as clamp } from './calculate-DH4EVtn1.mjs';
6
6
 
7
7
  /**
8
8
  * Pluggable layout constraints for react-grid-layout v2