react-grid-layout 2.2.3 → 2.3.0

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 (40) hide show
  1. package/README.md +5 -0
  2. package/dist/{ResponsiveGridLayout-BjVraYMQ.d.mts → ResponsiveGridLayout-BSYEMZ9d.d.ts} +4 -4
  3. package/dist/{ResponsiveGridLayout-BrhkSyZk.d.ts → ResponsiveGridLayout-RNuyRTPe.d.mts} +4 -4
  4. package/dist/{calculate-DH4EVtn1.d.mts → calculate-BXoe3Mfz.d.mts} +1 -1
  5. package/dist/{calculate-rP3DHexe.d.ts → calculate-Tc1WkIxl.d.ts} +1 -1
  6. package/dist/{chunk-BPZQUJ7Y.js → chunk-CUP5Y2ZG.js} +500 -155
  7. package/dist/{chunk-55DQUWLA.js → chunk-QAIA5KAO.js} +33 -22
  8. package/dist/{chunk-7MZZ6T4J.js → chunk-SL4EZ2NU.js} +67 -38
  9. package/dist/{chunk-PZLKKWSX.mjs → chunk-TW4BCTKD.mjs} +37 -8
  10. package/dist/{chunk-KDANGDDL.mjs → chunk-VBU6B7II.mjs} +13 -2
  11. package/dist/{chunk-A5WIFECI.js → chunk-VJJIA3HC.js} +7 -3
  12. package/dist/{chunk-WGL5FSZH.mjs → chunk-Z6CWRR74.mjs} +431 -86
  13. package/dist/{chunk-76RTO6EO.mjs → chunk-ZYNFVPDS.mjs} +7 -3
  14. package/dist/core.d.mts +5 -5
  15. package/dist/core.d.ts +5 -5
  16. package/dist/core.js +67 -67
  17. package/dist/core.mjs +2 -2
  18. package/dist/extras.d.mts +2 -2
  19. package/dist/extras.d.ts +2 -2
  20. package/dist/extras.js +8 -8
  21. package/dist/extras.mjs +1 -1
  22. package/dist/index.d.mts +5 -5
  23. package/dist/index.d.ts +5 -5
  24. package/dist/index.js +39 -39
  25. package/dist/index.mjs +4 -4
  26. package/dist/legacy.d.mts +18 -9
  27. package/dist/legacy.d.ts +18 -9
  28. package/dist/legacy.js +35 -25
  29. package/dist/legacy.mjs +18 -9
  30. package/dist/{position-CSgQSjwQ.d.ts → position-VdYnMJql.d.ts} +1 -1
  31. package/dist/{position-BV-g3Ezg.d.mts → position-iPly-ecb.d.mts} +1 -1
  32. package/dist/react.d.mts +24 -6
  33. package/dist/react.d.ts +24 -6
  34. package/dist/react.js +25 -25
  35. package/dist/react.mjs +4 -4
  36. package/dist/{responsive-BrTV_0tK.d.mts → responsive-BVtXrrTF.d.mts} +1 -1
  37. package/dist/{responsive-C_YtBQYq.d.ts → responsive-C6s9JAJU.d.ts} +1 -1
  38. package/dist/{types-jd8MiKM1.d.mts → types-DlzNckle.d.mts} +22 -0
  39. package/dist/{types-jd8MiKM1.d.ts → types-DlzNckle.d.ts} +22 -0
  40. package/package.json +3 -2
package/dist/react.d.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  import React__default, { ReactElement, CSSProperties, RefObject } from 'react';
2
- import { p as PositionStrategy, D as DroppingPosition, R as ResizeHandleAxis, f as LayoutConstraint, d as LayoutItem, L as Layout, G as GridDragEvent, c as GridResizeEvent, b as Compactor, a as Breakpoints, B as Breakpoint, e as ResponsiveLayouts } from './types-jd8MiKM1.js';
3
- export { C as CompactType, E as EventCallback, P as Position } from './types-jd8MiKM1.js';
4
- export { G as GridLayout, a as GridLayoutProps, R as ResponsiveGridLayout, b as ResponsiveGridLayoutProps } from './ResponsiveGridLayout-BrhkSyZk.js';
5
- export { b as bottom, c as cloneLayout, a as cloneLayoutItem, g as getCompactor, d as getLayoutItem, h as horizontalCompactor, n as noCompactor, s as setTopLeft, e as setTransform, f as verticalCompactor } from './position-CSgQSjwQ.js';
6
- export { c as calcGridItemPosition, a as calcWH, b as calcXY } from './calculate-rP3DHexe.js';
2
+ import { p as PositionStrategy, D as DroppingPosition, R as ResizeHandleAxis, f as LayoutConstraint, d as LayoutItem, L as Layout, G as GridDragEvent, c as GridResizeEvent, b as Compactor, a as Breakpoints, B as Breakpoint, e as ResponsiveLayouts } from './types-DlzNckle.js';
3
+ export { C as CompactType, E as EventCallback, P as Position } from './types-DlzNckle.js';
4
+ export { G as GridLayout, a as GridLayoutProps, R as ResponsiveGridLayout, b as ResponsiveGridLayoutProps } from './ResponsiveGridLayout-BSYEMZ9d.js';
5
+ export { b as bottom, c as cloneLayout, a as cloneLayoutItem, g as getCompactor, d as getLayoutItem, h as horizontalCompactor, n as noCompactor, s as setTopLeft, e as setTransform, f as verticalCompactor } from './position-VdYnMJql.js';
6
+ export { c as calcGridItemPosition, a as calcWH, b as calcXY } from './calculate-Tc1WkIxl.js';
7
7
 
8
8
  /**
9
9
  * GridItem component
@@ -34,6 +34,8 @@ interface GridItemProps {
34
34
  isResizable: boolean;
35
35
  /** Whether the item is bounded within the container */
36
36
  isBounded: boolean;
37
+ /** Allow native touch scroll while dragging (react-draggable allowMobileScroll) */
38
+ allowMobileScroll?: boolean;
37
39
  /** Whether the item is static (can't be moved/resized) */
38
40
  static?: boolean;
39
41
  /** Use CSS transforms instead of top/left */
@@ -102,7 +104,15 @@ interface GridItemProps {
102
104
  *
103
105
  * Wraps a child element with drag and resize functionality.
104
106
  */
105
- declare function GridItem(props: GridItemProps): ReactElement;
107
+ declare function GridItemInner(props: GridItemProps): ReactElement;
108
+ /**
109
+ * Memoized GridItem (#2240). v1 had shouldComponentUpdate gating on
110
+ * position/size; v2's function component re-rendered every item on every
111
+ * drag/resize move. A shallow compare on the geometry and grid-config props
112
+ * skips unchanged items. Children are memoized by the consumer (the
113
+ * documented perf contract), so identity-compare them here.
114
+ */
115
+ declare const GridItem: React__default.MemoExoticComponent<typeof GridItemInner>;
106
116
 
107
117
  /**
108
118
  * useContainerWidth hook
@@ -122,6 +132,14 @@ interface UseContainerWidthOptions {
122
132
  * Defaults to 1280.
123
133
  */
124
134
  initialWidth?: number;
135
+ /**
136
+ * Trailing debounce in milliseconds for width updates from the
137
+ * ResizeObserver (#2254). While the container is resizing, the rendered
138
+ * width freezes; once it holds steady for this long, the latest measured
139
+ * width commits, exactly once per burst of notifications. Absent or 0
140
+ * keeps immediate updates on every notification.
141
+ */
142
+ debounceTimeout?: number;
125
143
  }
126
144
  interface UseContainerWidthResult {
127
145
  /**
package/dist/react.js CHANGED
@@ -1,94 +1,94 @@
1
1
  'use strict';
2
2
 
3
- var chunk7MZZ6T4J_js = require('./chunk-7MZZ6T4J.js');
3
+ var chunkSL4EZ2NU_js = require('./chunk-SL4EZ2NU.js');
4
4
  require('./chunk-ZJHF4QM5.js');
5
- var chunkBPZQUJ7Y_js = require('./chunk-BPZQUJ7Y.js');
6
- var chunk55DQUWLA_js = require('./chunk-55DQUWLA.js');
7
- var chunkA5WIFECI_js = require('./chunk-A5WIFECI.js');
5
+ var chunkCUP5Y2ZG_js = require('./chunk-CUP5Y2ZG.js');
6
+ var chunkQAIA5KAO_js = require('./chunk-QAIA5KAO.js');
7
+ var chunkVJJIA3HC_js = require('./chunk-VJJIA3HC.js');
8
8
 
9
9
 
10
10
 
11
11
  Object.defineProperty(exports, "DEFAULT_BREAKPOINTS", {
12
12
  enumerable: true,
13
- get: function () { return chunk7MZZ6T4J_js.DEFAULT_BREAKPOINTS; }
13
+ get: function () { return chunkSL4EZ2NU_js.DEFAULT_BREAKPOINTS; }
14
14
  });
15
15
  Object.defineProperty(exports, "DEFAULT_COLS", {
16
16
  enumerable: true,
17
- get: function () { return chunk7MZZ6T4J_js.DEFAULT_COLS; }
17
+ get: function () { return chunkSL4EZ2NU_js.DEFAULT_COLS; }
18
18
  });
19
19
  Object.defineProperty(exports, "useContainerWidth", {
20
20
  enumerable: true,
21
- get: function () { return chunk7MZZ6T4J_js.useContainerWidth; }
21
+ get: function () { return chunkSL4EZ2NU_js.useContainerWidth; }
22
22
  });
23
23
  Object.defineProperty(exports, "useGridLayout", {
24
24
  enumerable: true,
25
- get: function () { return chunk7MZZ6T4J_js.useGridLayout; }
25
+ get: function () { return chunkSL4EZ2NU_js.useGridLayout; }
26
26
  });
27
27
  Object.defineProperty(exports, "useResponsiveLayout", {
28
28
  enumerable: true,
29
- get: function () { return chunk7MZZ6T4J_js.useResponsiveLayout; }
29
+ get: function () { return chunkSL4EZ2NU_js.useResponsiveLayout; }
30
30
  });
31
31
  Object.defineProperty(exports, "GridItem", {
32
32
  enumerable: true,
33
- get: function () { return chunkBPZQUJ7Y_js.GridItem; }
33
+ get: function () { return chunkCUP5Y2ZG_js.GridItem; }
34
34
  });
35
35
  Object.defineProperty(exports, "GridLayout", {
36
36
  enumerable: true,
37
- get: function () { return chunkBPZQUJ7Y_js.GridLayout; }
37
+ get: function () { return chunkCUP5Y2ZG_js.GridLayout; }
38
38
  });
39
39
  Object.defineProperty(exports, "ResponsiveGridLayout", {
40
40
  enumerable: true,
41
- get: function () { return chunkBPZQUJ7Y_js.ResponsiveGridLayout; }
41
+ get: function () { return chunkCUP5Y2ZG_js.ResponsiveGridLayoutWithRef; }
42
42
  });
43
43
  Object.defineProperty(exports, "getCompactor", {
44
44
  enumerable: true,
45
- get: function () { return chunk55DQUWLA_js.getCompactor; }
45
+ get: function () { return chunkQAIA5KAO_js.getCompactor; }
46
46
  });
47
47
  Object.defineProperty(exports, "horizontalCompactor", {
48
48
  enumerable: true,
49
- get: function () { return chunk55DQUWLA_js.horizontalCompactor; }
49
+ get: function () { return chunkQAIA5KAO_js.horizontalCompactor; }
50
50
  });
51
51
  Object.defineProperty(exports, "noCompactor", {
52
52
  enumerable: true,
53
- get: function () { return chunk55DQUWLA_js.noCompactor; }
53
+ get: function () { return chunkQAIA5KAO_js.noCompactor; }
54
54
  });
55
55
  Object.defineProperty(exports, "setTopLeft", {
56
56
  enumerable: true,
57
- get: function () { return chunk55DQUWLA_js.setTopLeft; }
57
+ get: function () { return chunkQAIA5KAO_js.setTopLeft; }
58
58
  });
59
59
  Object.defineProperty(exports, "setTransform", {
60
60
  enumerable: true,
61
- get: function () { return chunk55DQUWLA_js.setTransform; }
61
+ get: function () { return chunkQAIA5KAO_js.setTransform; }
62
62
  });
63
63
  Object.defineProperty(exports, "verticalCompactor", {
64
64
  enumerable: true,
65
- get: function () { return chunk55DQUWLA_js.verticalCompactor; }
65
+ get: function () { return chunkQAIA5KAO_js.verticalCompactor; }
66
66
  });
67
67
  Object.defineProperty(exports, "bottom", {
68
68
  enumerable: true,
69
- get: function () { return chunkA5WIFECI_js.bottom; }
69
+ get: function () { return chunkVJJIA3HC_js.bottom; }
70
70
  });
71
71
  Object.defineProperty(exports, "calcGridItemPosition", {
72
72
  enumerable: true,
73
- get: function () { return chunkA5WIFECI_js.calcGridItemPosition; }
73
+ get: function () { return chunkVJJIA3HC_js.calcGridItemPosition; }
74
74
  });
75
75
  Object.defineProperty(exports, "calcWH", {
76
76
  enumerable: true,
77
- get: function () { return chunkA5WIFECI_js.calcWH; }
77
+ get: function () { return chunkVJJIA3HC_js.calcWH; }
78
78
  });
79
79
  Object.defineProperty(exports, "calcXY", {
80
80
  enumerable: true,
81
- get: function () { return chunkA5WIFECI_js.calcXY; }
81
+ get: function () { return chunkVJJIA3HC_js.calcXY; }
82
82
  });
83
83
  Object.defineProperty(exports, "cloneLayout", {
84
84
  enumerable: true,
85
- get: function () { return chunkA5WIFECI_js.cloneLayout; }
85
+ get: function () { return chunkVJJIA3HC_js.cloneLayout; }
86
86
  });
87
87
  Object.defineProperty(exports, "cloneLayoutItem", {
88
88
  enumerable: true,
89
- get: function () { return chunkA5WIFECI_js.cloneLayoutItem; }
89
+ get: function () { return chunkVJJIA3HC_js.cloneLayoutItem; }
90
90
  });
91
91
  Object.defineProperty(exports, "getLayoutItem", {
92
92
  enumerable: true,
93
- get: function () { return chunkA5WIFECI_js.getLayoutItem; }
93
+ get: function () { return chunkVJJIA3HC_js.getLayoutItem; }
94
94
  });
package/dist/react.mjs CHANGED
@@ -1,5 +1,5 @@
1
- export { DEFAULT_BREAKPOINTS, DEFAULT_COLS, useContainerWidth, useGridLayout, useResponsiveLayout } from './chunk-PZLKKWSX.mjs';
1
+ export { DEFAULT_BREAKPOINTS, DEFAULT_COLS, useContainerWidth, useGridLayout, useResponsiveLayout } from './chunk-TW4BCTKD.mjs';
2
2
  import './chunk-O3KX3VYW.mjs';
3
- export { GridItem, GridLayout, ResponsiveGridLayout } from './chunk-WGL5FSZH.mjs';
4
- export { getCompactor, horizontalCompactor, noCompactor, setTopLeft, setTransform, verticalCompactor } from './chunk-KDANGDDL.mjs';
5
- export { bottom, calcGridItemPosition, calcWH, calcXY, cloneLayout, cloneLayoutItem, getLayoutItem } from './chunk-76RTO6EO.mjs';
3
+ export { GridItem, GridLayout, ResponsiveGridLayoutWithRef as ResponsiveGridLayout } from './chunk-Z6CWRR74.mjs';
4
+ export { getCompactor, horizontalCompactor, noCompactor, setTopLeft, setTransform, verticalCompactor } from './chunk-VBU6B7II.mjs';
5
+ export { bottom, calcGridItemPosition, calcWH, calcXY, cloneLayout, cloneLayoutItem, getLayoutItem } from './chunk-ZYNFVPDS.mjs';
@@ -1,4 +1,4 @@
1
- import { d as LayoutItem, L as Layout, C as CompactType, B as Breakpoint, e as ResponsiveLayouts, a as Breakpoints, b as Compactor } from './types-jd8MiKM1.mjs';
1
+ import { d as LayoutItem, L as Layout, C as CompactType, B as Breakpoint, e as ResponsiveLayouts, a as Breakpoints, b as Compactor } from './types-DlzNckle.mjs';
2
2
 
3
3
  /**
4
4
  * Collision detection utilities for grid layouts.
@@ -1,4 +1,4 @@
1
- import { d as LayoutItem, L as Layout, C as CompactType, B as Breakpoint, e as ResponsiveLayouts, a as Breakpoints, b as Compactor } from './types-jd8MiKM1.js';
1
+ import { d as LayoutItem, L as Layout, C as CompactType, B as Breakpoint, e as ResponsiveLayouts, a as Breakpoints, b as Compactor } from './types-DlzNckle.js';
2
2
 
3
3
  /**
4
4
  * Collision detection utilities for grid layouts.
@@ -369,6 +369,14 @@ interface DragConfig {
369
369
  * @default 3
370
370
  */
371
371
  threshold: number;
372
+ /**
373
+ * Allow the browser's native scroll on touch devices while dragging.
374
+ * react-draggable calls preventDefault() on touchstart unless this is set,
375
+ * which suppresses child onClick and touch scroll. Set true when grid items
376
+ * contain interactive children or the page must scroll on touch.
377
+ * @default false
378
+ */
379
+ allowMobileScroll?: boolean;
372
380
  }
373
381
  /** Default drag configuration */
374
382
  declare const defaultDragConfig: DragConfig;
@@ -412,6 +420,20 @@ interface DropConfig {
412
420
  dragOffsetX?: number;
413
421
  dragOffsetY?: number;
414
422
  } | false | void;
423
+ /**
424
+ * Enable touch-to-drop for external drag sources on mobile.
425
+ * Touch events never fire HTML5 dragover/drop, so the grid translates
426
+ * touchmove/touchend into the drop pipeline when this is on.
427
+ * Only elements matching `touchDragSource` are captured (default: true).
428
+ */
429
+ touchEnabled?: boolean;
430
+ /**
431
+ * CSS selector for elements that can be touch-dragged onto the grid.
432
+ * The adapter only listens for touchstart on matching elements, so an
433
+ * explicit marker prevents surprise scroll-hijacking.
434
+ * Defaults to `[data-rgl-draggable]` - add that attribute to your source.
435
+ */
436
+ touchDragSource?: string;
415
437
  }
416
438
  /** Default drop configuration */
417
439
  declare const defaultDropConfig: DropConfig;
@@ -369,6 +369,14 @@ interface DragConfig {
369
369
  * @default 3
370
370
  */
371
371
  threshold: number;
372
+ /**
373
+ * Allow the browser's native scroll on touch devices while dragging.
374
+ * react-draggable calls preventDefault() on touchstart unless this is set,
375
+ * which suppresses child onClick and touch scroll. Set true when grid items
376
+ * contain interactive children or the page must scroll on touch.
377
+ * @default false
378
+ */
379
+ allowMobileScroll?: boolean;
372
380
  }
373
381
  /** Default drag configuration */
374
382
  declare const defaultDragConfig: DragConfig;
@@ -412,6 +420,20 @@ interface DropConfig {
412
420
  dragOffsetX?: number;
413
421
  dragOffsetY?: number;
414
422
  } | false | void;
423
+ /**
424
+ * Enable touch-to-drop for external drag sources on mobile.
425
+ * Touch events never fire HTML5 dragover/drop, so the grid translates
426
+ * touchmove/touchend into the drop pipeline when this is on.
427
+ * Only elements matching `touchDragSource` are captured (default: true).
428
+ */
429
+ touchEnabled?: boolean;
430
+ /**
431
+ * CSS selector for elements that can be touch-dragged onto the grid.
432
+ * The adapter only listens for touchstart on matching elements, so an
433
+ * explicit marker prevents surprise scroll-hijacking.
434
+ * Defaults to `[data-rgl-draggable]` - add that attribute to your source.
435
+ */
436
+ touchDragSource?: string;
415
437
  }
416
438
  /** Default drop configuration */
417
439
  declare const defaultDropConfig: DropConfig;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-grid-layout",
3
- "version": "2.2.3",
3
+ "version": "2.3.0",
4
4
  "description": "A draggable and resizable grid layout with responsive breakpoints, for React.",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -109,7 +109,7 @@
109
109
  "fast-equals": "^4.0.3",
110
110
  "prop-types": "^15.8.1",
111
111
  "react-draggable": "^4.4.6",
112
- "react-resizable": "^3.1.3",
112
+ "react-resizable": "^3.2.0",
113
113
  "resize-observer-polyfill": "^1.5.1"
114
114
  },
115
115
  "_dependencyNotes": {
@@ -126,6 +126,7 @@
126
126
  "@babel/register": "^7.28.6",
127
127
  "@eslint/compat": "^2.0.2",
128
128
  "@eslint/js": "^9.39.2",
129
+ "@playwright/test": "^1.62.0",
129
130
  "@testing-library/dom": "^10.4.0",
130
131
  "@testing-library/jest-dom": "^6.6.3",
131
132
  "@testing-library/react": "^16.3.2",