@sguisse/react-grid-layout 2.2.3-sguisse.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 (46) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +125 -0
  3. package/css/styles.css +120 -0
  4. package/dist/ResponsiveGridLayout-B_6TXsWM.d.ts +80 -0
  5. package/dist/ResponsiveGridLayout-Bin5MBC3.d.mts +80 -0
  6. package/dist/calculate-CoBSgofg.d.mts +196 -0
  7. package/dist/calculate-K0IBpu53.d.ts +196 -0
  8. package/dist/chunk-7BT7XXIT.js +74 -0
  9. package/dist/chunk-G3PAJYGP.mjs +72 -0
  10. package/dist/chunk-ITLZ7N2R.mjs +456 -0
  11. package/dist/chunk-J4LTYI7L.js +485 -0
  12. package/dist/chunk-KKV4ZCG4.mjs +583 -0
  13. package/dist/chunk-LQOPWRJR.js +623 -0
  14. package/dist/chunk-O3KX3VYW.mjs +1 -0
  15. package/dist/chunk-STBCV65G.js +3159 -0
  16. package/dist/chunk-UZL6BMXQ.mjs +3146 -0
  17. package/dist/chunk-ZJHF4QM5.js +2 -0
  18. package/dist/core.d.mts +160 -0
  19. package/dist/core.d.ts +160 -0
  20. package/dist/core.js +268 -0
  21. package/dist/core.mjs +3 -0
  22. package/dist/extras.d.mts +208 -0
  23. package/dist/extras.d.ts +208 -0
  24. package/dist/extras.js +388 -0
  25. package/dist/extras.mjs +380 -0
  26. package/dist/index.d.mts +7 -0
  27. package/dist/index.d.ts +7 -0
  28. package/dist/index.js +152 -0
  29. package/dist/index.mjs +5 -0
  30. package/dist/legacy.d.mts +163 -0
  31. package/dist/legacy.d.ts +163 -0
  32. package/dist/legacy.js +331 -0
  33. package/dist/legacy.mjs +319 -0
  34. package/dist/position-BeP60S5h.d.ts +316 -0
  35. package/dist/position-CeG3Nr4z.d.mts +316 -0
  36. package/dist/react.d.mts +214 -0
  37. package/dist/react.d.ts +214 -0
  38. package/dist/react.js +94 -0
  39. package/dist/react.mjs +5 -0
  40. package/dist/responsive-D4zBXLkH.d.ts +145 -0
  41. package/dist/responsive-DQi_9rBi.d.mts +145 -0
  42. package/dist/types-Dbg8jAWj.d.mts +458 -0
  43. package/dist/types-Dbg8jAWj.d.ts +458 -0
  44. package/index-dev.js +23 -0
  45. package/index.js +8 -0
  46. package/package.json +238 -0
@@ -0,0 +1,319 @@
1
+ import { GridLayout, ResponsiveGridLayout } from './chunk-UZL6BMXQ.mjs';
2
+ import { createScaledStrategy, getCompactor, defaultConstraints, containerBounds, absoluteStrategy, transformStrategy } from './chunk-KKV4ZCG4.mjs';
3
+ import './chunk-ITLZ7N2R.mjs';
4
+ import { useState, useRef, useEffect } from 'react';
5
+ import { jsx } from 'react/jsx-runtime';
6
+ import clsx from 'clsx';
7
+
8
+ function ReactGridLayout(props) {
9
+ const {
10
+ // Required
11
+ children,
12
+ width,
13
+ // Grid measurement
14
+ cols = 12,
15
+ rowHeight = 150,
16
+ maxRows = Infinity,
17
+ margin = [10, 10],
18
+ containerPadding = null,
19
+ // Layout data
20
+ layout,
21
+ droppingItem,
22
+ // Compaction
23
+ compactType: compactTypeProp,
24
+ preventCollision = false,
25
+ allowOverlap = false,
26
+ verticalCompact,
27
+ // Drag behavior
28
+ isDraggable = true,
29
+ isBounded = false,
30
+ draggableHandle,
31
+ draggableCancel,
32
+ // Resize behavior
33
+ isResizable = true,
34
+ resizeHandles = ["se"],
35
+ resizeHandle,
36
+ // Drop behavior
37
+ isDroppable = false,
38
+ // Position
39
+ useCSSTransforms = true,
40
+ transformScale = 1,
41
+ // Container props
42
+ autoSize,
43
+ className,
44
+ style,
45
+ innerRef,
46
+ // Callbacks
47
+ onLayoutChange,
48
+ onDragStart,
49
+ onDrag,
50
+ onDragStop,
51
+ onResizeStart,
52
+ onResize,
53
+ onResizeStop,
54
+ onDrop,
55
+ onDropDragOver
56
+ } = props;
57
+ let compactType = compactTypeProp === void 0 ? "vertical" : compactTypeProp;
58
+ if (verticalCompact === false) {
59
+ if (process.env["NODE_ENV"] !== "production") {
60
+ console.warn(
61
+ '`verticalCompact` on <ReactGridLayout> is deprecated and will be removed soon. Use `compactType`: "horizontal" | "vertical" | null.'
62
+ );
63
+ }
64
+ compactType = null;
65
+ }
66
+ const gridConfig = {
67
+ cols,
68
+ rowHeight,
69
+ maxRows,
70
+ margin,
71
+ containerPadding
72
+ };
73
+ const dragConfig = {
74
+ enabled: isDraggable,
75
+ bounded: isBounded,
76
+ handle: draggableHandle,
77
+ cancel: draggableCancel,
78
+ // Set threshold to 0 for backwards compatibility with v1 API
79
+ // v2 API defaults to 3px threshold (fixes #1341, #1401)
80
+ threshold: 0
81
+ };
82
+ const resizeConfig = {
83
+ enabled: isResizable,
84
+ handles: resizeHandles,
85
+ handleComponent: resizeHandle
86
+ };
87
+ const dropConfig = {
88
+ enabled: isDroppable
89
+ };
90
+ let positionStrategy;
91
+ if (!useCSSTransforms) {
92
+ positionStrategy = absoluteStrategy;
93
+ } else if (transformScale !== 1) {
94
+ positionStrategy = createScaledStrategy(transformScale);
95
+ } else {
96
+ positionStrategy = transformStrategy;
97
+ }
98
+ const compactor = getCompactor(compactType, allowOverlap, preventCollision);
99
+ const constraints = isBounded ? [...defaultConstraints, containerBounds] : defaultConstraints;
100
+ return /* @__PURE__ */ jsx(
101
+ GridLayout,
102
+ {
103
+ width,
104
+ gridConfig,
105
+ dragConfig,
106
+ resizeConfig,
107
+ dropConfig,
108
+ positionStrategy,
109
+ compactor,
110
+ constraints,
111
+ layout,
112
+ droppingItem,
113
+ autoSize,
114
+ className,
115
+ style,
116
+ innerRef,
117
+ onLayoutChange,
118
+ onDragStart,
119
+ onDrag,
120
+ onDragStop,
121
+ onResizeStart,
122
+ onResize,
123
+ onResizeStop,
124
+ onDrop,
125
+ onDropDragOver,
126
+ children
127
+ }
128
+ );
129
+ }
130
+ ReactGridLayout.displayName = "ReactGridLayout";
131
+ var ReactGridLayout_default = ReactGridLayout;
132
+ function ResponsiveReactGridLayout(props) {
133
+ const {
134
+ // Required
135
+ children,
136
+ width,
137
+ // Responsive-specific
138
+ breakpoint,
139
+ breakpoints,
140
+ cols,
141
+ layouts,
142
+ onBreakpointChange,
143
+ onLayoutChange,
144
+ onWidthChange,
145
+ // Grid measurement
146
+ rowHeight,
147
+ maxRows,
148
+ margin,
149
+ containerPadding,
150
+ // Layout data
151
+ droppingItem,
152
+ // Compaction
153
+ compactType: compactTypeProp,
154
+ preventCollision = false,
155
+ allowOverlap = false,
156
+ verticalCompact,
157
+ // Drag behavior
158
+ isDraggable = true,
159
+ isBounded = false,
160
+ draggableHandle,
161
+ draggableCancel,
162
+ // Resize behavior
163
+ isResizable = true,
164
+ resizeHandles = ["se"],
165
+ resizeHandle,
166
+ // Drop behavior
167
+ isDroppable = false,
168
+ // Position
169
+ useCSSTransforms = true,
170
+ transformScale = 1,
171
+ // Container props
172
+ autoSize,
173
+ className,
174
+ style,
175
+ innerRef,
176
+ // Callbacks
177
+ onDragStart,
178
+ onDrag,
179
+ onDragStop,
180
+ onResizeStart,
181
+ onResize,
182
+ onResizeStop,
183
+ onDrop,
184
+ onDropDragOver
185
+ } = props;
186
+ let compactType = compactTypeProp === void 0 ? "vertical" : compactTypeProp;
187
+ if (verticalCompact === false) {
188
+ if (process.env["NODE_ENV"] !== "production") {
189
+ console.warn(
190
+ '`verticalCompact` on <ResponsiveReactGridLayout> is deprecated and will be removed soon. Use `compactType`: "horizontal" | "vertical" | null.'
191
+ );
192
+ }
193
+ compactType = null;
194
+ }
195
+ const dragConfig = {
196
+ enabled: isDraggable,
197
+ bounded: isBounded,
198
+ handle: draggableHandle,
199
+ cancel: draggableCancel
200
+ };
201
+ const resizeConfig = {
202
+ enabled: isResizable,
203
+ handles: resizeHandles,
204
+ handleComponent: resizeHandle
205
+ };
206
+ const dropConfig = {
207
+ enabled: isDroppable
208
+ };
209
+ let positionStrategy;
210
+ if (!useCSSTransforms) {
211
+ positionStrategy = absoluteStrategy;
212
+ } else if (transformScale !== 1) {
213
+ positionStrategy = createScaledStrategy(transformScale);
214
+ } else {
215
+ positionStrategy = transformStrategy;
216
+ }
217
+ const compactor = getCompactor(compactType, allowOverlap, preventCollision);
218
+ return /* @__PURE__ */ jsx(
219
+ ResponsiveGridLayout,
220
+ {
221
+ width,
222
+ breakpoint,
223
+ breakpoints,
224
+ cols,
225
+ layouts,
226
+ rowHeight,
227
+ maxRows,
228
+ margin,
229
+ containerPadding,
230
+ compactor,
231
+ dragConfig,
232
+ resizeConfig,
233
+ dropConfig,
234
+ positionStrategy,
235
+ droppingItem,
236
+ autoSize,
237
+ className,
238
+ style,
239
+ innerRef,
240
+ onBreakpointChange,
241
+ onLayoutChange,
242
+ onWidthChange,
243
+ onDragStart,
244
+ onDrag,
245
+ onDragStop,
246
+ onResizeStart,
247
+ onResize,
248
+ onResizeStop,
249
+ onDrop,
250
+ onDropDragOver,
251
+ children
252
+ }
253
+ );
254
+ }
255
+ ResponsiveReactGridLayout.displayName = "ResponsiveReactGridLayout";
256
+ var ResponsiveReactGridLayout_default = ResponsiveReactGridLayout;
257
+ var layoutClassName = "react-grid-layout";
258
+ function WidthProvider(ComposedComponent) {
259
+ function WidthProviderWrapper(props) {
260
+ const { measureBeforeMount = false, className, style, ...rest } = props;
261
+ const [width, setWidth] = useState(1280);
262
+ const [mounted, setMounted] = useState(false);
263
+ const elementRef = useRef(null);
264
+ const resizeObserverRef = useRef(null);
265
+ useEffect(() => {
266
+ setMounted(true);
267
+ }, []);
268
+ useEffect(() => {
269
+ const node = elementRef.current;
270
+ if (!(node instanceof HTMLElement)) return;
271
+ let rafId = null;
272
+ const observer = new ResizeObserver((entries) => {
273
+ if (entries[0]) {
274
+ const newWidth = entries[0].contentRect.width;
275
+ if (rafId !== null) {
276
+ cancelAnimationFrame(rafId);
277
+ }
278
+ rafId = requestAnimationFrame(() => {
279
+ setWidth(newWidth);
280
+ rafId = null;
281
+ });
282
+ }
283
+ });
284
+ observer.observe(node);
285
+ resizeObserverRef.current = observer;
286
+ return () => {
287
+ if (rafId !== null) {
288
+ cancelAnimationFrame(rafId);
289
+ }
290
+ observer.unobserve(node);
291
+ observer.disconnect();
292
+ };
293
+ }, [mounted]);
294
+ if (measureBeforeMount && !mounted) {
295
+ return /* @__PURE__ */ jsx(
296
+ "div",
297
+ {
298
+ className: clsx(className, layoutClassName),
299
+ style,
300
+ ref: elementRef
301
+ }
302
+ );
303
+ }
304
+ return /* @__PURE__ */ jsx(
305
+ ComposedComponent,
306
+ {
307
+ innerRef: elementRef,
308
+ className,
309
+ style,
310
+ ...rest,
311
+ width
312
+ }
313
+ );
314
+ }
315
+ WidthProviderWrapper.displayName = `WidthProvider(${ComposedComponent.displayName || ComposedComponent.name || "Component"})`;
316
+ return WidthProviderWrapper;
317
+ }
318
+
319
+ export { ReactGridLayout, ResponsiveReactGridLayout_default as Responsive, ResponsiveReactGridLayout, WidthProvider, ReactGridLayout_default as default };
@@ -0,0 +1,316 @@
1
+ import { L as Layout, d as LayoutItem, C as CompactType, M as Mutable, b as Compactor, P as Position, p as PositionStrategy, R as ResizeHandleAxis } from './types-Dbg8jAWj.js';
2
+
3
+ /**
4
+ * Core layout manipulation utilities.
5
+ *
6
+ * These functions create, modify, and query grid layouts.
7
+ * All functions treat layouts as immutable - they return new arrays/objects.
8
+ */
9
+
10
+ /**
11
+ * Get the bottom-most Y coordinate of the layout.
12
+ *
13
+ * This is the Y position plus height of the lowest item.
14
+ *
15
+ * @param layout - Layout to measure
16
+ * @returns The bottom Y coordinate (0 if layout is empty)
17
+ */
18
+ declare function bottom(layout: Layout): number;
19
+ /**
20
+ * Get a layout item by its ID.
21
+ *
22
+ * @param layout - Layout to search
23
+ * @param id - Item ID to find
24
+ * @returns The layout item, or undefined if not found
25
+ */
26
+ declare function getLayoutItem(layout: Layout, id: string): LayoutItem | undefined;
27
+ /**
28
+ * Get all static items from the layout.
29
+ *
30
+ * Static items cannot be moved or resized by the user.
31
+ *
32
+ * @param layout - Layout to filter
33
+ * @returns Array of static layout items
34
+ */
35
+ declare function getStatics(layout: Layout): LayoutItem[];
36
+ /**
37
+ * Clone a layout item.
38
+ *
39
+ * Creates a shallow copy with all properties preserved.
40
+ * Boolean properties are normalized (undefined becomes false).
41
+ *
42
+ * @param layoutItem - Item to clone
43
+ * @returns A new layout item with the same properties
44
+ */
45
+ declare function cloneLayoutItem(layoutItem: LayoutItem): LayoutItem;
46
+ /**
47
+ * Clone an entire layout.
48
+ *
49
+ * Creates a new array with cloned items.
50
+ *
51
+ * @param layout - Layout to clone
52
+ * @returns A new layout with cloned items
53
+ */
54
+ declare function cloneLayout(layout: Layout): LayoutItem[];
55
+ /**
56
+ * Replace a layout item in a layout.
57
+ *
58
+ * Returns a new layout with the item replaced. Other items are not cloned.
59
+ *
60
+ * @param layout - Layout to modify
61
+ * @param layoutItem - New item (matched by `i` property)
62
+ * @returns New layout with the item replaced
63
+ */
64
+ declare function modifyLayout(layout: Layout, layoutItem: LayoutItem): LayoutItem[];
65
+ /**
66
+ * Apply a transformation to a layout item.
67
+ *
68
+ * Finds the item by key, clones it, applies the callback, and returns
69
+ * a new layout with the modified item.
70
+ *
71
+ * @param layout - Layout to modify
72
+ * @param itemKey - Key of the item to modify
73
+ * @param cb - Callback that receives the cloned item and returns the modified item
74
+ * @returns Tuple of [new layout, modified item or null if not found]
75
+ */
76
+ declare function withLayoutItem(layout: Layout, itemKey: string, cb: (item: LayoutItem) => LayoutItem): [LayoutItem[], LayoutItem | null];
77
+ /**
78
+ * Ensure all layout items fit within the grid bounds.
79
+ *
80
+ * - Items overflowing right are moved left
81
+ * - Items overflowing left are moved to x=0 and clamped to grid width
82
+ * - Static items that collide with other statics are moved down
83
+ *
84
+ * **IMPORTANT**: This function mutates the layout items in place for performance.
85
+ * The type signature uses `Mutable<LayoutItem>[]` to make this explicit.
86
+ * Clone the layout first (e.g., with `cloneLayout()`) if you need immutability.
87
+ *
88
+ * @param layout - Layout to correct (items WILL be mutated)
89
+ * @param bounds - Grid bounds
90
+ * @returns The same layout array (for chaining)
91
+ */
92
+ declare function correctBounds(layout: Mutable<LayoutItem>[], bounds: {
93
+ cols: number;
94
+ }): LayoutItem[];
95
+ /**
96
+ * Move a layout element to a new position.
97
+ *
98
+ * Handles collision detection and cascading movements.
99
+ * Does not compact the layout - call `compact()` separately.
100
+ *
101
+ * **Note**: This function mutates the `l` parameter directly for performance.
102
+ * The item's x, y, and moved properties will be modified. Callers should
103
+ * ideally pass a cloned item if they need to preserve the original.
104
+ *
105
+ * @param layout - Full layout
106
+ * @param l - Item to move (will be mutated)
107
+ * @param x - New X position (or undefined to keep current)
108
+ * @param y - New Y position (or undefined to keep current)
109
+ * @param isUserAction - True if this is a direct user action (affects collision resolution)
110
+ * @param preventCollision - True to block movement into occupied space (item snaps back). No effect if allowOverlap is true.
111
+ * @param compactType - Compaction type for collision resolution
112
+ * @param cols - Number of columns in the grid
113
+ * @param allowOverlap - True to allow items to stack on top of each other
114
+ * @returns The updated layout
115
+ */
116
+ declare function moveElement(layout: Layout, l: LayoutItem, x: number | undefined, y: number | undefined, isUserAction: boolean | undefined, preventCollision: boolean | undefined, compactType: CompactType, cols: number, allowOverlap?: boolean): LayoutItem[];
117
+ /**
118
+ * Move an item away from a collision.
119
+ *
120
+ * Attempts to move the item up/left first if there's room,
121
+ * otherwise moves it down/right.
122
+ *
123
+ * @param layout - Full layout
124
+ * @param collidesWith - The item being collided with
125
+ * @param itemToMove - The item to move away
126
+ * @param isUserAction - True if this is a direct user action
127
+ * @param compactType - Compaction type
128
+ * @param cols - Number of columns
129
+ * @returns Updated layout
130
+ */
131
+ declare function moveElementAwayFromCollision(layout: Layout, collidesWith: LayoutItem, itemToMove: LayoutItem, isUserAction: boolean | undefined, compactType: CompactType, cols: number): LayoutItem[];
132
+ /**
133
+ * Validate that a layout has the required properties.
134
+ *
135
+ * @param layout - Layout to validate
136
+ * @param contextName - Name for error messages
137
+ * @throws Error if layout is invalid
138
+ */
139
+ declare function validateLayout(layout: Layout, contextName?: string): void;
140
+
141
+ /**
142
+ * Compactor implementations.
143
+ *
144
+ * Compactors are pluggable strategies for removing gaps between grid items.
145
+ * Use the Compactor interface to create custom compaction algorithms.
146
+ */
147
+
148
+ declare function resolveCompactionCollision(layout: Layout, item: LayoutItem, moveToCoord: number, axis: "x" | "y", hasStatics?: boolean): void;
149
+ /**
150
+ * Compact a single item vertically (move up).
151
+ *
152
+ * Moves the item as far up as possible without colliding.
153
+ * Useful for implementing custom vertical compactors.
154
+ *
155
+ * @param compareWith - Items to check for collisions
156
+ * @param l - Item to compact (will be mutated)
157
+ * @param fullLayout - Full layout for collision resolution
158
+ * @param maxY - Maximum Y to start from
159
+ * @returns The compacted item
160
+ */
161
+ declare function compactItemVertical(compareWith: Layout, l: LayoutItem, fullLayout: Layout, maxY: number): LayoutItem;
162
+ /**
163
+ * Compact a single item horizontally (move left).
164
+ *
165
+ * Moves the item as far left as possible without colliding.
166
+ * Wraps to the next row if it overflows.
167
+ * Useful for implementing custom horizontal compactors.
168
+ *
169
+ * @param compareWith - Items to check for collisions
170
+ * @param l - Item to compact (will be mutated)
171
+ * @param cols - Number of columns in the grid
172
+ * @param fullLayout - Full layout for collision resolution
173
+ * @returns The compacted item
174
+ */
175
+ declare function compactItemHorizontal(compareWith: Layout, l: LayoutItem, cols: number, fullLayout: Layout): LayoutItem;
176
+ /**
177
+ * Vertical compactor - moves items up to fill gaps.
178
+ *
179
+ * Items are sorted by row then column, and each item is moved
180
+ * as far up as possible without overlapping other items.
181
+ *
182
+ * This is the default compaction mode for react-grid-layout.
183
+ */
184
+ declare const verticalCompactor: Compactor;
185
+ /**
186
+ * Horizontal compactor - moves items left to fill gaps.
187
+ *
188
+ * Items are sorted by column then row, and each item is moved
189
+ * as far left as possible without overlapping other items.
190
+ */
191
+ declare const horizontalCompactor: Compactor;
192
+ /**
193
+ * No compaction - items stay where placed.
194
+ *
195
+ * Use this for free-form layouts where items can be placed anywhere.
196
+ * Items will not automatically move to fill gaps.
197
+ */
198
+ declare const noCompactor: Compactor;
199
+ /**
200
+ * Vertical compactor that allows overlapping items.
201
+ *
202
+ * Items compact upward but are allowed to overlap each other.
203
+ * Useful for layered layouts or when collision detection is handled externally.
204
+ */
205
+ declare const verticalOverlapCompactor: Compactor;
206
+ /**
207
+ * Horizontal compactor that allows overlapping items.
208
+ */
209
+ declare const horizontalOverlapCompactor: Compactor;
210
+ /**
211
+ * No compaction, with overlapping allowed.
212
+ *
213
+ * Items stay where placed and can overlap each other.
214
+ */
215
+ declare const noOverlapCompactor: Compactor;
216
+ /**
217
+ * Get a compactor by type.
218
+ *
219
+ * This is a convenience function for backwards compatibility with the
220
+ * string-based compactType API.
221
+ *
222
+ * Note: For 'wrap' mode, import `wrapCompactor` from 'react-grid-layout/extras'
223
+ * and pass it directly to the `compactor` prop. This function returns
224
+ * `noCompactor` for 'wrap' type since the wrap compactor is tree-shakeable.
225
+ *
226
+ * @param compactType - 'vertical', 'horizontal', 'wrap', or null
227
+ * @param allowOverlap - Whether to allow overlapping items
228
+ * @returns The appropriate Compactor
229
+ */
230
+ declare function getCompactor(compactType: CompactType, allowOverlap?: boolean, preventCollision?: boolean): Compactor;
231
+
232
+ /**
233
+ * Position calculation utilities.
234
+ *
235
+ * These functions convert between grid units and pixel positions,
236
+ * and generate CSS styles for grid items.
237
+ */
238
+
239
+ /**
240
+ * Generate CSS transform-based positioning styles.
241
+ *
242
+ * Using transforms is more performant than top/left positioning
243
+ * because it doesn't trigger layout recalculations.
244
+ *
245
+ * @param position - Position in pixels
246
+ * @returns CSS style object
247
+ */
248
+ declare function setTransform({ top, left, width, height }: Position): Record<string, string>;
249
+ /**
250
+ * Generate CSS top/left positioning styles.
251
+ *
252
+ * Use this when transforms are not suitable (e.g., for printing
253
+ * or when transform causes issues with child elements).
254
+ *
255
+ * @param position - Position in pixels
256
+ * @returns CSS style object
257
+ */
258
+ declare function setTopLeft({ top, left, width, height }: Position): Record<string, string>;
259
+ /**
260
+ * Convert a number to a percentage string.
261
+ *
262
+ * @param num - Number to convert (0-1 range typically)
263
+ * @returns Percentage string (e.g., "50%")
264
+ */
265
+ declare function perc(num: number): string;
266
+ /**
267
+ * Resize an item in a specific direction, clamping to container bounds.
268
+ *
269
+ * This handles the complex logic of resizing from different edges/corners,
270
+ * ensuring the item doesn't overflow the container.
271
+ *
272
+ * @param direction - Which edge/corner is being dragged
273
+ * @param currentSize - Current position and size
274
+ * @param newSize - Requested new position and size
275
+ * @param containerWidth - Width of the container
276
+ * @returns Constrained position and size
277
+ */
278
+ declare function resizeItemInDirection(direction: ResizeHandleAxis, currentSize: Position, newSize: Position, containerWidth: number): Position;
279
+ /**
280
+ * CSS transform-based positioning strategy.
281
+ *
282
+ * Uses CSS transforms for positioning, which is more performant
283
+ * as it doesn't trigger layout recalculations.
284
+ *
285
+ * This is the default strategy.
286
+ */
287
+ declare const transformStrategy: PositionStrategy;
288
+ /**
289
+ * Absolute (top/left) positioning strategy.
290
+ *
291
+ * Uses CSS top/left for positioning. Use this when CSS transforms
292
+ * cause issues (e.g., printing, certain child element positioning).
293
+ */
294
+ declare const absoluteStrategy: PositionStrategy;
295
+ /**
296
+ * Create a scaled transform strategy.
297
+ *
298
+ * Use this when the grid container is inside a scaled element
299
+ * (e.g., `transform: scale(0.5)`). The scale factor adjusts
300
+ * drag/resize calculations to account for the parent transform.
301
+ *
302
+ * @param scale - Scale factor (e.g., 0.5 for half size)
303
+ * @returns Position strategy with scaled calculations
304
+ *
305
+ * @example
306
+ * ```tsx
307
+ * <div style={{ transform: 'scale(0.5)' }}>
308
+ * <GridLayout positionStrategy={createScaledStrategy(0.5)} />
309
+ * </div>
310
+ * ```
311
+ */
312
+ declare function createScaledStrategy(scale: number): PositionStrategy;
313
+ /** Default position strategy (transform-based) */
314
+ declare const defaultPositionStrategy: PositionStrategy;
315
+
316
+ export { transformStrategy as A, verticalOverlapCompactor as B, withLayoutItem as C, cloneLayoutItem as a, bottom as b, cloneLayout as c, getLayoutItem as d, setTransform as e, verticalCompactor as f, getCompactor as g, horizontalCompactor as h, absoluteStrategy as i, compactItemHorizontal as j, compactItemVertical as k, correctBounds as l, moveElement as m, noCompactor as n, createScaledStrategy as o, defaultPositionStrategy as p, getStatics as q, horizontalOverlapCompactor as r, setTopLeft as s, modifyLayout as t, moveElementAwayFromCollision as u, validateLayout as v, noOverlapCompactor as w, perc as x, resizeItemInDirection as y, resolveCompactionCollision as z };