react-grid-layout 2.2.2 → 2.2.4

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-XM2M6TC6.mjs → chunk-7ZM5LVH2.mjs} +20 -12
  8. package/dist/{chunk-BJFPTW5Q.js → chunk-A5WIFECI.js} +0 -2
  9. package/dist/{chunk-QGXQSZII.js → chunk-BMN6M2VL.js} +66 -38
  10. package/dist/{chunk-XYPIYYYQ.mjs → chunk-KDANGDDL.mjs} +1 -3
  11. package/dist/{chunk-YFVX5RDK.mjs → chunk-LY5GT7Q2.mjs} +36 -8
  12. package/dist/chunk-O3KX3VYW.mjs +1 -0
  13. package/dist/{chunk-KEM2G3LX.js → chunk-QAWP6PEK.js} +87 -79
  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 +26 -18
  30. package/dist/legacy.mjs +15 -7
  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,5 +1,5 @@
1
1
  import React__default, { CSSProperties, DragEvent, ReactElement } from 'react';
2
- import { l as GridConfig, m as DragConfig, n as ResizeConfig, o as DropConfig, k as PositionStrategy, c as Compactor, f as LayoutConstraint, L as Layout, a as LayoutItem, B as Breakpoint, b as Breakpoints, R as ResponsiveLayouts } from './types-BiXsdXr7.js';
2
+ import { m as GridConfig, j as DragConfig, r as ResizeConfig, l as DropConfig, p as PositionStrategy, b as Compactor, f as LayoutConstraint, L as Layout, d as LayoutItem, E as EventCallback, B as Breakpoint, a as Breakpoints, e as ResponsiveLayouts } from './types-jd8MiKM1.mjs';
3
3
 
4
4
  /**
5
5
  * GridLayout component
@@ -7,7 +7,6 @@ import { l as GridConfig, m as DragConfig, n as ResizeConfig, o as DropConfig, k
7
7
  * A reactive, fluid grid layout with draggable, resizable components.
8
8
  */
9
9
 
10
- type EventCallback = (layout: Layout, oldItem: LayoutItem | null, newItem: LayoutItem | null, placeholder: LayoutItem | null, event: Event, element?: HTMLElement) => void;
11
10
  interface GridLayoutProps {
12
11
  /** Child elements to render in the grid */
13
12
  children: React__default.ReactNode;
@@ -130,4 +129,4 @@ interface ResponsiveGridLayoutProps<B extends Breakpoint = string> extends Omit<
130
129
  */
131
130
  declare function ResponsiveGridLayout<B extends Breakpoint = string>(props: ResponsiveGridLayoutProps<B>): ReactElement;
132
131
 
133
- export { type EventCallback as E, GridLayout as G, ResponsiveGridLayout as R, type GridLayoutProps as a, type ResponsiveGridLayoutProps as b };
132
+ export { GridLayout as G, ResponsiveGridLayout as R, type GridLayoutProps as a, type ResponsiveGridLayoutProps as b };
@@ -1,5 +1,5 @@
1
1
  import React__default, { CSSProperties, DragEvent, ReactElement } from 'react';
2
- import { l as GridConfig, m as DragConfig, n as ResizeConfig, o as DropConfig, k as PositionStrategy, c as Compactor, f as LayoutConstraint, L as Layout, a as LayoutItem, B as Breakpoint, b as Breakpoints, R as ResponsiveLayouts } from './types-BiXsdXr7.mjs';
2
+ import { m as GridConfig, j as DragConfig, r as ResizeConfig, l as DropConfig, p as PositionStrategy, b as Compactor, f as LayoutConstraint, L as Layout, d as LayoutItem, E as EventCallback, B as Breakpoint, a as Breakpoints, e as ResponsiveLayouts } from './types-jd8MiKM1.js';
3
3
 
4
4
  /**
5
5
  * GridLayout component
@@ -7,7 +7,6 @@ import { l as GridConfig, m as DragConfig, n as ResizeConfig, o as DropConfig, k
7
7
  * A reactive, fluid grid layout with draggable, resizable components.
8
8
  */
9
9
 
10
- type EventCallback = (layout: Layout, oldItem: LayoutItem | null, newItem: LayoutItem | null, placeholder: LayoutItem | null, event: Event, element?: HTMLElement) => void;
11
10
  interface GridLayoutProps {
12
11
  /** Child elements to render in the grid */
13
12
  children: React__default.ReactNode;
@@ -130,4 +129,4 @@ interface ResponsiveGridLayoutProps<B extends Breakpoint = string> extends Omit<
130
129
  */
131
130
  declare function ResponsiveGridLayout<B extends Breakpoint = string>(props: ResponsiveGridLayoutProps<B>): ReactElement;
132
131
 
133
- export { type EventCallback as E, GridLayout as G, ResponsiveGridLayout as R, type GridLayoutProps as a, type ResponsiveGridLayoutProps as b };
132
+ export { GridLayout as G, ResponsiveGridLayout as R, type GridLayoutProps as a, type ResponsiveGridLayoutProps as b };
@@ -1,4 +1,4 @@
1
- import { P as Position, d as ResizeHandleAxis } from './types-BiXsdXr7.mjs';
1
+ import { P as Position, R as ResizeHandleAxis } from './types-jd8MiKM1.mjs';
2
2
 
3
3
  /**
4
4
  * Grid calculation utilities.
@@ -193,4 +193,4 @@ interface GridCellConfig {
193
193
  */
194
194
  declare function calcGridCellDimensions(config: GridCellConfig): GridCellDimensions;
195
195
 
196
- export { type GridCellDimensions as G, type PositionParams as P, calcXY as a, calcWH as b, calcGridItemPosition as c, type GridCellConfig as d, calcGridColWidth as e, calcGridItemWHPx as f, calcXYRaw as g, calcWHRaw as h, clamp as i, calcGridCellDimensions as j };
196
+ export { type GridCellConfig as G, type PositionParams as P, calcWH as a, calcXY as b, calcGridItemPosition as c, type GridCellDimensions as d, calcGridCellDimensions as e, calcGridColWidth as f, calcGridItemWHPx as g, calcWHRaw as h, calcXYRaw as i, clamp as j };
@@ -1,4 +1,4 @@
1
- import { P as Position, d as ResizeHandleAxis } from './types-BiXsdXr7.js';
1
+ import { P as Position, R as ResizeHandleAxis } from './types-jd8MiKM1.js';
2
2
 
3
3
  /**
4
4
  * Grid calculation utilities.
@@ -193,4 +193,4 @@ interface GridCellConfig {
193
193
  */
194
194
  declare function calcGridCellDimensions(config: GridCellConfig): GridCellDimensions;
195
195
 
196
- export { type GridCellDimensions as G, type PositionParams as P, calcXY as a, calcWH as b, calcGridItemPosition as c, type GridCellConfig as d, calcGridColWidth as e, calcGridItemWHPx as f, calcXYRaw as g, calcWHRaw as h, clamp as i, calcGridCellDimensions as j };
196
+ export { type GridCellConfig as G, type PositionParams as P, calcWH as a, calcXY as b, calcGridItemPosition as c, type GridCellDimensions as d, calcGridCellDimensions as e, calcGridColWidth as f, calcGridItemWHPx as g, calcWHRaw as h, calcXYRaw as i, clamp as j };
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunkBJFPTW5Q_js = require('./chunk-BJFPTW5Q.js');
3
+ var chunkA5WIFECI_js = require('./chunk-A5WIFECI.js');
4
4
 
5
5
  // src/core/constraints.ts
6
6
  function clamp(value, min, max) {
@@ -351,13 +351,13 @@ function resolveCompactionCollision(layout, item, moveToCoord, axis, hasStatics)
351
351
  const sizeProp = axis === "x" ? "w" : "h";
352
352
  item[axis] += 1;
353
353
  const itemIndex = layout.findIndex((l) => l.i === item.i);
354
- const layoutHasStatics = hasStatics ?? chunkBJFPTW5Q_js.getStatics(layout).length > 0;
354
+ const layoutHasStatics = hasStatics ?? chunkA5WIFECI_js.getStatics(layout).length > 0;
355
355
  for (let i = itemIndex + 1; i < layout.length; i++) {
356
356
  const otherItem = layout[i];
357
357
  if (otherItem === void 0) continue;
358
358
  if (otherItem.static) continue;
359
359
  if (!layoutHasStatics && otherItem.y > item.y + item.h) break;
360
- if (chunkBJFPTW5Q_js.collides(item, otherItem)) {
360
+ if (chunkA5WIFECI_js.collides(item, otherItem)) {
361
361
  resolveCompactionCollision(
362
362
  layout,
363
363
  otherItem,
@@ -373,11 +373,11 @@ function compactItemVertical(compareWith, l, fullLayout, maxY) {
373
373
  l.x = Math.max(l.x, 0);
374
374
  l.y = Math.max(l.y, 0);
375
375
  l.y = Math.min(maxY, l.y);
376
- while (l.y > 0 && !chunkBJFPTW5Q_js.getFirstCollision(compareWith, l)) {
376
+ while (l.y > 0 && !chunkA5WIFECI_js.getFirstCollision(compareWith, l)) {
377
377
  l.y--;
378
378
  }
379
379
  let collision;
380
- while ((collision = chunkBJFPTW5Q_js.getFirstCollision(compareWith, l)) !== void 0) {
380
+ while ((collision = chunkA5WIFECI_js.getFirstCollision(compareWith, l)) !== void 0) {
381
381
  resolveCompactionCollision(fullLayout, l, collision.y + collision.h, "y");
382
382
  }
383
383
  l.y = Math.max(l.y, 0);
@@ -386,16 +386,16 @@ function compactItemVertical(compareWith, l, fullLayout, maxY) {
386
386
  function compactItemHorizontal(compareWith, l, cols, fullLayout) {
387
387
  l.x = Math.max(l.x, 0);
388
388
  l.y = Math.max(l.y, 0);
389
- while (l.x > 0 && !chunkBJFPTW5Q_js.getFirstCollision(compareWith, l)) {
389
+ while (l.x > 0 && !chunkA5WIFECI_js.getFirstCollision(compareWith, l)) {
390
390
  l.x--;
391
391
  }
392
392
  let collision;
393
- while ((collision = chunkBJFPTW5Q_js.getFirstCollision(compareWith, l)) !== void 0) {
393
+ while ((collision = chunkA5WIFECI_js.getFirstCollision(compareWith, l)) !== void 0) {
394
394
  resolveCompactionCollision(fullLayout, l, collision.x + collision.w, "x");
395
395
  if (l.x + l.w > cols) {
396
396
  l.x = cols - l.w;
397
397
  l.y++;
398
- while (l.x > 0 && !chunkBJFPTW5Q_js.getFirstCollision(compareWith, l)) {
398
+ while (l.x > 0 && !chunkA5WIFECI_js.getFirstCollision(compareWith, l)) {
399
399
  l.x--;
400
400
  }
401
401
  }
@@ -407,14 +407,14 @@ var verticalCompactor = {
407
407
  type: "vertical",
408
408
  allowOverlap: false,
409
409
  compact(layout, _cols) {
410
- const compareWith = chunkBJFPTW5Q_js.getStatics(layout);
411
- let maxY = chunkBJFPTW5Q_js.bottom(compareWith);
412
- const sorted = chunkBJFPTW5Q_js.sortLayoutItemsByRowCol(layout);
410
+ const compareWith = chunkA5WIFECI_js.getStatics(layout);
411
+ let maxY = chunkA5WIFECI_js.bottom(compareWith);
412
+ const sorted = chunkA5WIFECI_js.sortLayoutItemsByRowCol(layout);
413
413
  const out = new Array(layout.length);
414
414
  for (let i = 0; i < sorted.length; i++) {
415
415
  const sortedItem = sorted[i];
416
416
  if (sortedItem === void 0) continue;
417
- let l = chunkBJFPTW5Q_js.cloneLayoutItem(sortedItem);
417
+ let l = chunkA5WIFECI_js.cloneLayoutItem(sortedItem);
418
418
  if (!l.static) {
419
419
  l = compactItemVertical(compareWith, l, sorted, maxY);
420
420
  maxY = Math.max(maxY, l.y + l.h);
@@ -431,13 +431,13 @@ var horizontalCompactor = {
431
431
  type: "horizontal",
432
432
  allowOverlap: false,
433
433
  compact(layout, cols) {
434
- const compareWith = chunkBJFPTW5Q_js.getStatics(layout);
435
- const sorted = chunkBJFPTW5Q_js.sortLayoutItemsByColRow(layout);
434
+ const compareWith = chunkA5WIFECI_js.getStatics(layout);
435
+ const sorted = chunkA5WIFECI_js.sortLayoutItemsByColRow(layout);
436
436
  const out = new Array(layout.length);
437
437
  for (let i = 0; i < sorted.length; i++) {
438
438
  const sortedItem = sorted[i];
439
439
  if (sortedItem === void 0) continue;
440
- let l = chunkBJFPTW5Q_js.cloneLayoutItem(sortedItem);
440
+ let l = chunkA5WIFECI_js.cloneLayoutItem(sortedItem);
441
441
  if (!l.static) {
442
442
  l = compactItemHorizontal(compareWith, l, cols, sorted);
443
443
  compareWith.push(l);
@@ -453,21 +453,21 @@ var noCompactor = {
453
453
  type: null,
454
454
  allowOverlap: false,
455
455
  compact(layout, _cols) {
456
- return chunkBJFPTW5Q_js.cloneLayout(layout);
456
+ return chunkA5WIFECI_js.cloneLayout(layout);
457
457
  }
458
458
  };
459
459
  var verticalOverlapCompactor = {
460
460
  ...verticalCompactor,
461
461
  allowOverlap: true,
462
462
  compact(layout, _cols) {
463
- return chunkBJFPTW5Q_js.cloneLayout(layout);
463
+ return chunkA5WIFECI_js.cloneLayout(layout);
464
464
  }
465
465
  };
466
466
  var horizontalOverlapCompactor = {
467
467
  ...horizontalCompactor,
468
468
  allowOverlap: true,
469
469
  compact(layout, _cols) {
470
- return chunkBJFPTW5Q_js.cloneLayout(layout);
470
+ return chunkA5WIFECI_js.cloneLayout(layout);
471
471
  }
472
472
  };
473
473
  var noOverlapCompactor = {
@@ -525,7 +525,7 @@ function getColsFromBreakpoint(breakpoint, cols) {
525
525
  function findOrGenerateResponsiveLayout(layouts, breakpoints, breakpoint, lastBreakpoint, cols, compactTypeOrCompactor) {
526
526
  const existingLayout = layouts[breakpoint];
527
527
  if (existingLayout) {
528
- return chunkBJFPTW5Q_js.cloneLayout(existingLayout);
528
+ return chunkA5WIFECI_js.cloneLayout(existingLayout);
529
529
  }
530
530
  let layout = layouts[lastBreakpoint];
531
531
  const breakpointsSorted = sortBreakpoints(breakpoints);
@@ -541,8 +541,8 @@ function findOrGenerateResponsiveLayout(layouts, breakpoints, breakpoint, lastBr
541
541
  break;
542
542
  }
543
543
  }
544
- const clonedLayout = chunkBJFPTW5Q_js.cloneLayout(layout || []);
545
- const corrected = chunkBJFPTW5Q_js.correctBounds(clonedLayout, { cols });
544
+ const clonedLayout = chunkA5WIFECI_js.cloneLayout(layout || []);
545
+ const corrected = chunkA5WIFECI_js.correctBounds(clonedLayout, { cols });
546
546
  const compactor = typeof compactTypeOrCompactor === "object" && compactTypeOrCompactor !== null ? compactTypeOrCompactor : getCompactor(compactTypeOrCompactor);
547
547
  return compactor.compact(corrected, cols);
548
548
  }
@@ -604,5 +604,3 @@ exports.sortBreakpoints = sortBreakpoints;
604
604
  exports.transformStrategy = transformStrategy;
605
605
  exports.verticalCompactor = verticalCompactor;
606
606
  exports.verticalOverlapCompactor = verticalOverlapCompactor;
607
- //# sourceMappingURL=chunk-2DDROKB2.js.map
608
- //# sourceMappingURL=chunk-2DDROKB2.js.map
@@ -418,5 +418,3 @@ function validateLayout(layout, contextName = "Layout") {
418
418
  }
419
419
 
420
420
  export { bottom, calcGridCellDimensions, calcGridColWidth, calcGridItemPosition, calcGridItemWHPx, calcWH, calcWHRaw, calcXY, calcXYRaw, clamp, cloneLayout, cloneLayoutItem, collides, correctBounds, getAllCollisions, getFirstCollision, getLayoutItem, getStatics, modifyLayout, moveElement, moveElementAwayFromCollision, sortLayoutItems, sortLayoutItemsByColRow, sortLayoutItemsByRowCol, validateLayout, withLayoutItem };
421
- //# sourceMappingURL=chunk-AWM66AWF.mjs.map
422
- //# sourceMappingURL=chunk-AWM66AWF.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
  }
@@ -362,7 +362,11 @@ function GridItem(props) {
362
362
  getConstraintContext()
363
363
  );
364
364
  handler(i, newW, newH, {
365
- e: e.nativeEvent,
365
+ // react-resizable forwards react-draggable's callback event, which is
366
+ // already a native MouseEvent/TouchEvent and has no `nativeEvent`.
367
+ // Reading it unconditionally handed consumers `undefined` (#2264).
368
+ // The drag handlers above pass the raw event for the same reason.
369
+ e: e.nativeEvent ?? e,
366
370
  node,
367
371
  size: updatedSize,
368
372
  handle: resizeHandle2
@@ -468,12 +472,15 @@ function GridItem(props) {
468
472
  resizing ? resizePositionRef.current : null
469
473
  );
470
474
  const child = React2.Children.only(children);
471
- const minGridUnit = calcGridItemPosition(positionParams, 0, 0, 1, 1);
475
+ const colWidth = calcGridColWidth(positionParams);
472
476
  const minConstraints = [
473
- minGridUnit.width,
474
- minGridUnit.height
477
+ calcGridItemWHPx(minW, colWidth, margin[0]),
478
+ calcGridItemWHPx(minH, rowHeight, margin[1])
479
+ ];
480
+ const maxConstraints = [
481
+ calcGridItemWHPx(maxW, colWidth, margin[0]),
482
+ calcGridItemWHPx(maxH, rowHeight, margin[1])
475
483
  ];
476
- const maxConstraints = [Infinity, Infinity];
477
484
  const childProps = child.props;
478
485
  const childClassName = childProps["className"];
479
486
  const childStyle = childProps["style"];
@@ -1029,8 +1036,11 @@ function GridLayout(props) {
1029
1036
  );
1030
1037
  setDroppingDOMNode(/* @__PURE__ */ jsx("div", {}, finalDroppingItem.i));
1031
1038
  setDroppingPosition(newDroppingPosition);
1039
+ const baseLayout = layoutRef.current.filter(
1040
+ (l) => l.i !== finalDroppingItem.i
1041
+ );
1032
1042
  setLayout([
1033
- ...layoutRef.current,
1043
+ ...baseLayout,
1034
1044
  {
1035
1045
  ...finalDroppingItem,
1036
1046
  x: calculatedPosition.x,
@@ -1513,5 +1523,3 @@ function ResponsiveGridLayout(props) {
1513
1523
  }
1514
1524
 
1515
1525
  export { GridItem, GridLayout, ResponsiveGridLayout };
1516
- //# sourceMappingURL=chunk-XM2M6TC6.mjs.map
1517
- //# sourceMappingURL=chunk-XM2M6TC6.mjs.map
@@ -445,5 +445,3 @@ exports.sortLayoutItemsByColRow = sortLayoutItemsByColRow;
445
445
  exports.sortLayoutItemsByRowCol = sortLayoutItemsByRowCol;
446
446
  exports.validateLayout = validateLayout;
447
447
  exports.withLayoutItem = withLayoutItem;
448
- //# sourceMappingURL=chunk-BJFPTW5Q.js.map
449
- //# sourceMappingURL=chunk-BJFPTW5Q.js.map
@@ -1,10 +1,24 @@
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 react = require('react');
6
6
  var fastEquals = require('fast-equals');
7
7
 
8
+ function getContentWidth(node) {
9
+ const style = typeof globalThis.getComputedStyle === "function" ? globalThis.getComputedStyle(node) : null;
10
+ if (!style) return node.clientWidth;
11
+ const px = (value) => {
12
+ const parsed = Number.parseFloat(value);
13
+ return Number.isFinite(parsed) ? parsed : 0;
14
+ };
15
+ const computed = Number.parseFloat(style.width);
16
+ if (Number.isFinite(computed)) return Math.max(0, computed);
17
+ return Math.max(
18
+ 0,
19
+ node.clientWidth - px(style.paddingLeft) - px(style.paddingRight)
20
+ );
21
+ }
8
22
  function useContainerWidth(options = {}) {
9
23
  const { measureBeforeMount = false, initialWidth = 1280 } = options;
10
24
  const [width, setWidth] = react.useState(initialWidth);
@@ -14,8 +28,8 @@ function useContainerWidth(options = {}) {
14
28
  const measureWidth = react.useCallback(() => {
15
29
  const node = containerRef.current;
16
30
  if (node) {
17
- const newWidth = node.offsetWidth;
18
- setWidth(newWidth);
31
+ const newWidth = Math.round(getContentWidth(node));
32
+ setWidth((prev) => prev === newWidth ? prev : newWidth);
19
33
  if (!mounted) {
20
34
  setMounted(true);
21
35
  }
@@ -26,14 +40,30 @@ function useContainerWidth(options = {}) {
26
40
  if (!node) return;
27
41
  measureWidth();
28
42
  if (typeof ResizeObserver !== "undefined") {
43
+ let rafId = null;
29
44
  observerRef.current = new ResizeObserver((entries) => {
30
45
  const entry = entries[0];
31
46
  if (entry) {
32
- const newWidth = entry.contentRect.width;
33
- setWidth(newWidth);
47
+ const newWidth = Math.round(entry.contentRect.width);
48
+ if (rafId !== null) {
49
+ cancelAnimationFrame(rafId);
50
+ }
51
+ rafId = requestAnimationFrame(() => {
52
+ setWidth((prev) => prev === newWidth ? prev : newWidth);
53
+ rafId = null;
54
+ });
34
55
  }
35
56
  });
36
57
  observerRef.current.observe(node);
58
+ return () => {
59
+ if (rafId !== null) {
60
+ cancelAnimationFrame(rafId);
61
+ }
62
+ if (observerRef.current) {
63
+ observerRef.current.disconnect();
64
+ observerRef.current = null;
65
+ }
66
+ };
37
67
  }
38
68
  return () => {
39
69
  if (observerRef.current) {
@@ -55,11 +85,11 @@ function useGridLayout(options) {
55
85
  cols,
56
86
  preventCollision = false,
57
87
  onLayoutChange,
58
- compactor = chunk2DDROKB2_js.verticalCompactor
88
+ compactor = chunk55DQUWLA_js.verticalCompactor
59
89
  } = options;
60
90
  const isDraggingRef = react.useRef(false);
61
91
  const [layout, setLayoutState] = react.useState(() => {
62
- const corrected = chunkBJFPTW5Q_js.correctBounds(chunkBJFPTW5Q_js.cloneLayout(propsLayout), { cols });
92
+ const corrected = chunkA5WIFECI_js.correctBounds(chunkA5WIFECI_js.cloneLayout(propsLayout), { cols });
63
93
  return compactor.compact(corrected, cols);
64
94
  });
65
95
  const [dragState, setDragState] = react.useState({
@@ -79,7 +109,7 @@ function useGridLayout(options) {
79
109
  const prevLayoutRef = react.useRef(layout);
80
110
  const setLayout = react.useCallback(
81
111
  (newLayout) => {
82
- const corrected = chunkBJFPTW5Q_js.correctBounds(chunkBJFPTW5Q_js.cloneLayout(newLayout), { cols });
112
+ const corrected = chunkA5WIFECI_js.correctBounds(chunkA5WIFECI_js.cloneLayout(newLayout), { cols });
83
113
  const compacted = compactor.compact(corrected, cols);
84
114
  setLayoutState(compacted);
85
115
  },
@@ -99,11 +129,11 @@ function useGridLayout(options) {
99
129
  }, [layout, onLayoutChange]);
100
130
  const onDragStart = react.useCallback(
101
131
  (itemId, x, y) => {
102
- const item = chunkBJFPTW5Q_js.getLayoutItem(layout, itemId);
132
+ const item = chunkA5WIFECI_js.getLayoutItem(layout, itemId);
103
133
  if (!item) return null;
104
134
  isDraggingRef.current = true;
105
135
  const placeholder = {
106
- ...chunkBJFPTW5Q_js.cloneLayoutItem(item),
136
+ ...chunkA5WIFECI_js.cloneLayoutItem(item),
107
137
  x,
108
138
  y,
109
139
  static: false,
@@ -111,8 +141,8 @@ function useGridLayout(options) {
111
141
  };
112
142
  setDragState({
113
143
  activeDrag: placeholder,
114
- oldDragItem: chunkBJFPTW5Q_js.cloneLayoutItem(item),
115
- oldLayout: chunkBJFPTW5Q_js.cloneLayout(layout)
144
+ oldDragItem: chunkA5WIFECI_js.cloneLayoutItem(item),
145
+ oldLayout: chunkA5WIFECI_js.cloneLayout(layout)
116
146
  });
117
147
  return placeholder;
118
148
  },
@@ -120,13 +150,13 @@ function useGridLayout(options) {
120
150
  );
121
151
  const onDrag = react.useCallback(
122
152
  (itemId, x, y) => {
123
- const item = chunkBJFPTW5Q_js.getLayoutItem(layout, itemId);
153
+ const item = chunkA5WIFECI_js.getLayoutItem(layout, itemId);
124
154
  if (!item) return;
125
155
  setDragState((prev) => ({
126
156
  ...prev,
127
157
  activeDrag: prev.activeDrag ? { ...prev.activeDrag, x, y } : null
128
158
  }));
129
- const newLayout = chunkBJFPTW5Q_js.moveElement(
159
+ const newLayout = chunkA5WIFECI_js.moveElement(
130
160
  layout,
131
161
  item,
132
162
  x,
@@ -145,9 +175,9 @@ function useGridLayout(options) {
145
175
  );
146
176
  const onDragStop = react.useCallback(
147
177
  (itemId, x, y) => {
148
- const item = chunkBJFPTW5Q_js.getLayoutItem(layout, itemId);
178
+ const item = chunkA5WIFECI_js.getLayoutItem(layout, itemId);
149
179
  if (!item) return;
150
- const newLayout = chunkBJFPTW5Q_js.moveElement(
180
+ const newLayout = chunkA5WIFECI_js.moveElement(
151
181
  layout,
152
182
  item,
153
183
  x,
@@ -171,12 +201,12 @@ function useGridLayout(options) {
171
201
  );
172
202
  const onResizeStart = react.useCallback(
173
203
  (itemId) => {
174
- const item = chunkBJFPTW5Q_js.getLayoutItem(layout, itemId);
204
+ const item = chunkA5WIFECI_js.getLayoutItem(layout, itemId);
175
205
  if (!item) return null;
176
206
  setResizeState({
177
207
  resizing: true,
178
- oldResizeItem: chunkBJFPTW5Q_js.cloneLayoutItem(item),
179
- oldLayout: chunkBJFPTW5Q_js.cloneLayout(layout)
208
+ oldResizeItem: chunkA5WIFECI_js.cloneLayoutItem(item),
209
+ oldLayout: chunkA5WIFECI_js.cloneLayout(layout)
180
210
  });
181
211
  return item;
182
212
  },
@@ -197,7 +227,7 @@ function useGridLayout(options) {
197
227
  }
198
228
  return item;
199
229
  });
200
- const corrected = chunkBJFPTW5Q_js.correctBounds(newLayout, { cols });
230
+ const corrected = chunkA5WIFECI_js.correctBounds(newLayout, { cols });
201
231
  const compacted = compactor.compact(corrected, cols);
202
232
  setLayoutState(compacted);
203
233
  },
@@ -216,10 +246,10 @@ function useGridLayout(options) {
216
246
  );
217
247
  const onDropDragOver = react.useCallback(
218
248
  (droppingItem, position) => {
219
- const existingItem = chunkBJFPTW5Q_js.getLayoutItem(layout, droppingItem.i);
249
+ const existingItem = chunkA5WIFECI_js.getLayoutItem(layout, droppingItem.i);
220
250
  if (!existingItem) {
221
251
  const newLayout = [...layout, droppingItem];
222
- const corrected = chunkBJFPTW5Q_js.correctBounds(newLayout, { cols });
252
+ const corrected = chunkA5WIFECI_js.correctBounds(newLayout, { cols });
223
253
  const compacted = compactor.compact(corrected, cols);
224
254
  setLayoutState(compacted);
225
255
  }
@@ -251,7 +281,7 @@ function useGridLayout(options) {
251
281
  }
252
282
  return item;
253
283
  });
254
- const corrected = chunkBJFPTW5Q_js.correctBounds(newLayout, { cols });
284
+ const corrected = chunkA5WIFECI_js.correctBounds(newLayout, { cols });
255
285
  const compacted = compactor.compact(corrected, cols);
256
286
  setLayoutState(compacted);
257
287
  setDropState({
@@ -261,7 +291,7 @@ function useGridLayout(options) {
261
291
  },
262
292
  [layout, cols, compactor]
263
293
  );
264
- const containerHeight = react.useMemo(() => chunkBJFPTW5Q_js.bottom(layout), [layout]);
294
+ const containerHeight = react.useMemo(() => chunkA5WIFECI_js.bottom(layout), [layout]);
265
295
  const isInteracting = dragState.activeDrag !== null || resizeState.resizing || dropState.droppingPosition !== null;
266
296
  return {
267
297
  layout,
@@ -303,23 +333,23 @@ function useResponsiveLayout(options) {
303
333
  breakpoints = DEFAULT_BREAKPOINTS,
304
334
  cols: colsConfig = DEFAULT_COLS,
305
335
  layouts: propsLayouts = {},
306
- compactor = chunk2DDROKB2_js.verticalCompactor,
336
+ compactor = chunk55DQUWLA_js.verticalCompactor,
307
337
  onBreakpointChange,
308
338
  onLayoutChange,
309
339
  onWidthChange
310
340
  } = options;
311
341
  const sortedBreakpoints = react.useMemo(
312
- () => chunk2DDROKB2_js.sortBreakpoints(breakpoints),
342
+ () => chunk55DQUWLA_js.sortBreakpoints(breakpoints),
313
343
  [breakpoints]
314
344
  );
315
345
  const initialBreakpoint = react.useMemo(
316
- () => chunk2DDROKB2_js.getBreakpointFromWidth(breakpoints, width),
346
+ () => chunk55DQUWLA_js.getBreakpointFromWidth(breakpoints, width),
317
347
  // Only calculate on mount, not on width changes
318
348
  // eslint-disable-next-line react-hooks/exhaustive-deps
319
349
  []
320
350
  );
321
351
  const initialCols = react.useMemo(
322
- () => chunk2DDROKB2_js.getColsFromBreakpoint(initialBreakpoint, colsConfig),
352
+ () => chunk55DQUWLA_js.getColsFromBreakpoint(initialBreakpoint, colsConfig),
323
353
  [initialBreakpoint, colsConfig]
324
354
  );
325
355
  const [breakpoint, setBreakpoint] = react.useState(initialBreakpoint);
@@ -329,7 +359,7 @@ function useResponsiveLayout(options) {
329
359
  for (const bp of sortedBreakpoints) {
330
360
  const layout2 = propsLayouts[bp];
331
361
  if (layout2) {
332
- cloned[bp] = chunkBJFPTW5Q_js.cloneLayout(layout2);
362
+ cloned[bp] = chunkA5WIFECI_js.cloneLayout(layout2);
333
363
  }
334
364
  }
335
365
  return cloned;
@@ -339,7 +369,7 @@ function useResponsiveLayout(options) {
339
369
  const prevPropsLayoutsRef = react.useRef(propsLayouts);
340
370
  const prevLayoutsRef = react.useRef(layouts);
341
371
  const layout = react.useMemo(() => {
342
- return chunk2DDROKB2_js.findOrGenerateResponsiveLayout(
372
+ return chunk55DQUWLA_js.findOrGenerateResponsiveLayout(
343
373
  layouts,
344
374
  breakpoints,
345
375
  breakpoint,
@@ -351,7 +381,7 @@ function useResponsiveLayout(options) {
351
381
  const setLayoutForBreakpoint = react.useCallback((bp, newLayout) => {
352
382
  setLayoutsState((prev) => ({
353
383
  ...prev,
354
- [bp]: chunkBJFPTW5Q_js.cloneLayout(newLayout)
384
+ [bp]: chunkA5WIFECI_js.cloneLayout(newLayout)
355
385
  }));
356
386
  }, []);
357
387
  const setLayouts = react.useCallback((newLayouts) => {
@@ -359,7 +389,7 @@ function useResponsiveLayout(options) {
359
389
  for (const bp of Object.keys(newLayouts)) {
360
390
  const layoutForBp = newLayouts[bp];
361
391
  if (layoutForBp) {
362
- cloned[bp] = chunkBJFPTW5Q_js.cloneLayout(layoutForBp);
392
+ cloned[bp] = chunkA5WIFECI_js.cloneLayout(layoutForBp);
363
393
  }
364
394
  }
365
395
  setLayoutsState(cloned);
@@ -367,11 +397,11 @@ function useResponsiveLayout(options) {
367
397
  react.useEffect(() => {
368
398
  if (prevWidthRef.current === width) return;
369
399
  prevWidthRef.current = width;
370
- const newBreakpoint = chunk2DDROKB2_js.getBreakpointFromWidth(breakpoints, width);
371
- const newCols = chunk2DDROKB2_js.getColsFromBreakpoint(newBreakpoint, colsConfig);
400
+ const newBreakpoint = chunk55DQUWLA_js.getBreakpointFromWidth(breakpoints, width);
401
+ const newCols = chunk55DQUWLA_js.getColsFromBreakpoint(newBreakpoint, colsConfig);
372
402
  onWidthChange?.(width, [10, 10], newCols, null);
373
403
  if (newBreakpoint !== breakpoint) {
374
- const newLayout = chunk2DDROKB2_js.findOrGenerateResponsiveLayout(
404
+ const newLayout = chunk55DQUWLA_js.findOrGenerateResponsiveLayout(
375
405
  layouts,
376
406
  breakpoints,
377
407
  newBreakpoint,
@@ -427,5 +457,3 @@ exports.DEFAULT_COLS = DEFAULT_COLS;
427
457
  exports.useContainerWidth = useContainerWidth;
428
458
  exports.useGridLayout = useGridLayout;
429
459
  exports.useResponsiveLayout = useResponsiveLayout;
430
- //# sourceMappingURL=chunk-QGXQSZII.js.map
431
- //# sourceMappingURL=chunk-QGXQSZII.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