@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,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.mjs';
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 };
@@ -0,0 +1,214 @@
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-Dbg8jAWj.mjs';
3
+ export { C as CompactType, E as EventCallback, P as Position } from './types-Dbg8jAWj.mjs';
4
+ export { G as GridLayout, a as GridLayoutProps, R as ResponsiveGridLayout, b as ResponsiveGridLayoutProps } from './ResponsiveGridLayout-Bin5MBC3.mjs';
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-CeG3Nr4z.mjs';
6
+ export { c as calcGridItemPosition, a as calcWH, b as calcXY } from './calculate-CoBSgofg.mjs';
7
+
8
+ /**
9
+ * GridItem component
10
+ *
11
+ * Workspace migration version: removes direct react-draggable/react-resizable
12
+ * coupling and preserves the existing grid math/callback contracts with native
13
+ * pointer-driven drag and resize interactions.
14
+ */
15
+
16
+ type GridItemCallback<Data extends GridDragEvent | GridResizeEvent> = (i: string, w: number, h: number, data: Data) => void;
17
+ type ResizeHandle = ReactElement | ((resizeHandleAxis: ResizeHandleAxis, ref: React__default.Ref<HTMLElement>) => ReactElement);
18
+ interface GridItemProps {
19
+ children: ReactElement;
20
+ cols: number;
21
+ containerWidth: number;
22
+ margin: readonly [number, number];
23
+ containerPadding: readonly [number, number];
24
+ rowHeight: number;
25
+ maxRows: number;
26
+ isDraggable: boolean;
27
+ isResizable: boolean;
28
+ isBounded: boolean;
29
+ static?: boolean;
30
+ useCSSTransforms?: boolean;
31
+ usePercentages?: boolean;
32
+ transformScale?: number;
33
+ positionStrategy?: PositionStrategy;
34
+ dragThreshold?: number;
35
+ droppingPosition?: DroppingPosition;
36
+ enableSortable?: boolean;
37
+ className?: string;
38
+ style?: CSSProperties;
39
+ handle?: string;
40
+ cancel?: string;
41
+ x: number;
42
+ y: number;
43
+ w: number;
44
+ h: number;
45
+ minW?: number;
46
+ maxW?: number;
47
+ minH?: number;
48
+ maxH?: number;
49
+ i: string;
50
+ resizeHandles?: ResizeHandleAxis[];
51
+ resizeHandle?: ResizeHandle;
52
+ constraints?: LayoutConstraint[];
53
+ layoutItem?: LayoutItem;
54
+ layout?: Layout;
55
+ onDragStart?: GridItemCallback<GridDragEvent>;
56
+ onDrag?: GridItemCallback<GridDragEvent>;
57
+ onDragStop?: GridItemCallback<GridDragEvent>;
58
+ onResizeStart?: GridItemCallback<GridResizeEvent>;
59
+ onResize?: GridItemCallback<GridResizeEvent>;
60
+ onResizeStop?: GridItemCallback<GridResizeEvent>;
61
+ onResizeCancel?: (itemId: string) => void;
62
+ /**
63
+ * When true, this item is currently the dnd-kit drag source (tracked by our
64
+ * own React state via dragOverlayId). We use this — not dnd-kit's own
65
+ * `isSortableDragSource` — to apply `visibility:hidden`, because dnd-kit's
66
+ * reset is asynchronous and may lag behind our state update, leaving the
67
+ * element invisible and un-clickable after the drag completes.
68
+ */
69
+ isDndKitDragSource?: boolean;
70
+ }
71
+ declare function GridItem(props: GridItemProps): ReactElement;
72
+
73
+ /**
74
+ * useContainerWidth hook
75
+ *
76
+ * Observes container width using ResizeObserver and provides
77
+ * reactive width updates for responsive layouts.
78
+ */
79
+
80
+ interface UseContainerWidthOptions {
81
+ /**
82
+ * If true, delays initial render until width is measured.
83
+ * Useful for SSR or when you need accurate initial measurements.
84
+ */
85
+ measureBeforeMount?: boolean;
86
+ /**
87
+ * Initial width to use before measurement.
88
+ * Defaults to 1280.
89
+ */
90
+ initialWidth?: number;
91
+ }
92
+ interface UseContainerWidthResult {
93
+ /**
94
+ * Current container width in pixels.
95
+ */
96
+ width: number;
97
+ /**
98
+ * Whether the container has been measured at least once.
99
+ */
100
+ mounted: boolean;
101
+ /**
102
+ * Ref to attach to the container element.
103
+ */
104
+ containerRef: RefObject<HTMLDivElement | null>;
105
+ /**
106
+ * Manually trigger a width measurement.
107
+ * Useful when the container size might change without a resize event.
108
+ */
109
+ measureWidth: () => void;
110
+ }
111
+ /**
112
+ * Hook to observe and track container width.
113
+ *
114
+ * Replaces the WidthProvider HOC with a more composable approach.
115
+ *
116
+ * @example
117
+ * ```tsx
118
+ * function MyGrid() {
119
+ * const { width, containerRef, mounted } = useContainerWidth();
120
+ *
121
+ * return (
122
+ * <div ref={containerRef}>
123
+ * {mounted && <GridLayout width={width} {...props} />}
124
+ * </div>
125
+ * );
126
+ * }
127
+ * ```
128
+ */ declare function useContainerWidth(options?: UseContainerWidthOptions): UseContainerWidthResult;
129
+
130
+ /**
131
+ * useGridLayout hook
132
+ *
133
+ * Core hook for managing grid layout state, including drag, resize, and drop operations.
134
+ * This extracts the state management logic from ReactGridLayout into a reusable hook.
135
+ */
136
+
137
+ interface DragState {
138
+ activeDrag: LayoutItem | null;
139
+ oldDragItem: LayoutItem | null;
140
+ oldLayout: Layout | null;
141
+ }
142
+ interface ResizeState {
143
+ resizing: boolean;
144
+ oldResizeItem: LayoutItem | null;
145
+ oldLayout: Layout | null;
146
+ }
147
+ interface DropState {
148
+ droppingDOMNode: React.ReactElement | null;
149
+ droppingPosition: DroppingPosition | null;
150
+ }
151
+ interface UseGridLayoutOptions {
152
+ layout: Layout;
153
+ cols: number;
154
+ preventCollision?: boolean;
155
+ onLayoutChange?: (layout: Layout) => void;
156
+ compactor?: Compactor;
157
+ droppingItemId?: string;
158
+ }
159
+ interface UseGridLayoutResult {
160
+ layout: Layout;
161
+ setLayout: (layout: Layout) => void;
162
+ dragState: DragState;
163
+ resizeState: ResizeState;
164
+ dropState: DropState;
165
+ onDragStart: (itemId: string, x: number, y: number) => LayoutItem | null;
166
+ onDrag: (itemId: string, x: number, y: number) => void;
167
+ onDragStop: (itemId: string, x: number, y: number) => void;
168
+ cancelDrag: () => void;
169
+ onResizeStart: (itemId: string) => LayoutItem | null;
170
+ onResize: (itemId: string, w: number, h: number, x?: number, y?: number) => void;
171
+ onResizeStop: (itemId: string, w: number, h: number, x?: number, y?: number) => void;
172
+ cancelResize: () => void;
173
+ onDropDragOver: (droppingItem: LayoutItem, position: DroppingPosition) => void;
174
+ onDropDragLeave: () => void;
175
+ onDrop: (droppingItem: LayoutItem) => void;
176
+ containerHeight: number;
177
+ isInteracting: boolean;
178
+ compactor: Compactor;
179
+ }
180
+ declare function useGridLayout(options: UseGridLayoutOptions): UseGridLayoutResult;
181
+
182
+ /**
183
+ * useResponsiveLayout hook
184
+ *
185
+ * Manages responsive breakpoints and layout generation for different screen sizes.
186
+ * Extracts state management from ResponsiveReactGridLayout into a reusable hook.
187
+ */
188
+
189
+ type DefaultBreakpoints = "lg" | "md" | "sm" | "xs" | "xxs";
190
+ declare const DEFAULT_BREAKPOINTS: Breakpoints<DefaultBreakpoints>;
191
+ declare const DEFAULT_COLS: Breakpoints<DefaultBreakpoints>;
192
+ interface UseResponsiveLayoutOptions<B extends Breakpoint = DefaultBreakpoints> {
193
+ width: number;
194
+ breakpoint?: B;
195
+ breakpoints?: Breakpoints<B>;
196
+ cols?: Breakpoints<B>;
197
+ layouts?: ResponsiveLayouts<B>;
198
+ compactor?: Compactor;
199
+ onBreakpointChange?: (newBreakpoint: B, cols: number) => void;
200
+ onLayoutChange?: (layout: Layout, layouts: ResponsiveLayouts<B>) => void;
201
+ onWidthChange?: (width: number, margin: readonly [number, number], cols: number, containerPadding: readonly [number, number] | null) => void;
202
+ }
203
+ interface UseResponsiveLayoutResult<B extends Breakpoint = DefaultBreakpoints> {
204
+ layout: Layout;
205
+ layouts: ResponsiveLayouts<B>;
206
+ breakpoint: B;
207
+ cols: number;
208
+ setLayoutForBreakpoint: (breakpoint: B, layout: Layout) => void;
209
+ setLayouts: (layouts: ResponsiveLayouts<B>) => void;
210
+ sortedBreakpoints: B[];
211
+ }
212
+ declare function useResponsiveLayout<B extends Breakpoint = DefaultBreakpoints>(options: UseResponsiveLayoutOptions<B>): UseResponsiveLayoutResult<B>;
213
+
214
+ export { Breakpoint, Breakpoints, Compactor, DEFAULT_BREAKPOINTS, DEFAULT_COLS, type DefaultBreakpoints, type DragState, type DropState, DroppingPosition, GridDragEvent, GridItem, type GridItemCallback, type GridItemProps, GridResizeEvent, Layout, LayoutItem, type ResizeHandle, ResizeHandleAxis, type ResizeState, ResponsiveLayouts, type UseContainerWidthOptions, type UseContainerWidthResult, type UseGridLayoutOptions, type UseGridLayoutResult, type UseResponsiveLayoutOptions, type UseResponsiveLayoutResult, useContainerWidth, useGridLayout, useResponsiveLayout };