react-grid-layout 1.5.3 → 2.0.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 (95) hide show
  1. package/README.md +1074 -432
  2. package/css/styles.css +6 -4
  3. package/dist/ResponsiveGridLayout-CH4s0tKj.d.ts +124 -0
  4. package/dist/ResponsiveGridLayout-D6lFRE3f.d.mts +124 -0
  5. package/dist/calculate-CwYDW8na.d.mts +168 -0
  6. package/dist/calculate-mgLpNJ5O.d.ts +168 -0
  7. package/dist/chunk-2KUHNJXF.mjs +90 -0
  8. package/dist/chunk-2KUHNJXF.mjs.map +1 -0
  9. package/dist/chunk-3WO4SAYB.js +868 -0
  10. package/dist/chunk-3WO4SAYB.js.map +1 -0
  11. package/dist/chunk-4HNUMWQK.mjs +822 -0
  12. package/dist/chunk-4HNUMWQK.mjs.map +1 -0
  13. package/dist/chunk-BFTKGAP3.js +1309 -0
  14. package/dist/chunk-BFTKGAP3.js.map +1 -0
  15. package/dist/chunk-F6NQPYKT.js +98 -0
  16. package/dist/chunk-F6NQPYKT.js.map +1 -0
  17. package/dist/chunk-H5KMDLY3.js +434 -0
  18. package/dist/chunk-H5KMDLY3.js.map +1 -0
  19. package/dist/chunk-PBQSHIID.js +4 -0
  20. package/dist/chunk-PBQSHIID.js.map +1 -0
  21. package/dist/chunk-R35HZZTA.mjs +1300 -0
  22. package/dist/chunk-R35HZZTA.mjs.map +1 -0
  23. package/dist/chunk-ZCXE6SR5.mjs +428 -0
  24. package/dist/chunk-ZCXE6SR5.mjs.map +1 -0
  25. package/dist/chunk-ZWN22PS2.mjs +3 -0
  26. package/dist/chunk-ZWN22PS2.mjs.map +1 -0
  27. package/dist/core.d.mts +33 -0
  28. package/dist/core.d.ts +33 -0
  29. package/dist/core.js +218 -0
  30. package/dist/core.js.map +1 -0
  31. package/dist/core.mjs +5 -0
  32. package/dist/core.mjs.map +1 -0
  33. package/dist/extras.d.mts +78 -0
  34. package/dist/extras.d.ts +78 -0
  35. package/dist/extras.js +91 -0
  36. package/dist/extras.js.map +1 -0
  37. package/dist/extras.mjs +89 -0
  38. package/dist/extras.mjs.map +1 -0
  39. package/dist/index.d.mts +7 -0
  40. package/dist/index.d.ts +7 -0
  41. package/dist/index.js +154 -0
  42. package/dist/index.js.map +1 -0
  43. package/dist/index.mjs +7 -0
  44. package/dist/index.mjs.map +1 -0
  45. package/dist/legacy.d.mts +163 -0
  46. package/dist/legacy.d.ts +163 -0
  47. package/dist/legacy.js +319 -0
  48. package/dist/legacy.js.map +1 -0
  49. package/dist/legacy.mjs +307 -0
  50. package/dist/legacy.mjs.map +1 -0
  51. package/dist/position-BmN1z36J.d.mts +319 -0
  52. package/dist/position-Dk2b4ZMS.d.ts +319 -0
  53. package/dist/react.d.mts +351 -0
  54. package/dist/react.d.ts +351 -0
  55. package/dist/react.js +96 -0
  56. package/dist/react.js.map +1 -0
  57. package/dist/react.mjs +7 -0
  58. package/dist/react.mjs.map +1 -0
  59. package/dist/responsive-C4L1ESlm.d.ts +145 -0
  60. package/dist/responsive-CJxefsYw.d.mts +145 -0
  61. package/dist/types-Cxf4nHNr.d.mts +375 -0
  62. package/dist/types-Cxf4nHNr.d.ts +375 -0
  63. package/index-dev.js +8 -0
  64. package/package.json +132 -40
  65. package/.babelrc.js +0 -22
  66. package/.browserslistrc +0 -3
  67. package/.eslintignore +0 -4
  68. package/.flowconfig +0 -20
  69. package/.prettierignore +0 -4
  70. package/.prettierrc +0 -17
  71. package/CHANGELOG.md +0 -985
  72. package/build/GridItem.js +0 -638
  73. package/build/ReactGridLayout.js +0 -741
  74. package/build/ReactGridLayoutPropTypes.js +0 -210
  75. package/build/ResponsiveReactGridLayout.js +0 -297
  76. package/build/calculateUtils.js +0 -165
  77. package/build/components/WidthProvider.js +0 -115
  78. package/build/fastRGLPropsEqual.js +0 -5
  79. package/build/responsiveUtils.js +0 -101
  80. package/build/utils.js +0 -842
  81. package/dist/react-grid-layout.min.js +0 -2
  82. package/dist/react-grid-layout.min.js.map +0 -1
  83. package/index.js.flow +0 -8
  84. package/ip_fetcher +0 -0
  85. package/ip_fetcher.c +0 -47
  86. package/lib/GridItem.jsx +0 -689
  87. package/lib/ReactGridLayout.jsx +0 -855
  88. package/lib/ReactGridLayoutPropTypes.js +0 -241
  89. package/lib/ResponsiveReactGridLayout.jsx +0 -349
  90. package/lib/calculateUtils.js +0 -169
  91. package/lib/components/WidthProvider.jsx +0 -110
  92. package/lib/fastRGLPropsEqual.js +0 -46
  93. package/lib/responsiveUtils.js +0 -118
  94. package/lib/utils.js +0 -995
  95. package/yarn-error.log +0 -7780
@@ -0,0 +1,351 @@
1
+ import React__default, { ReactElement, CSSProperties, RefObject } from 'react';
2
+ import { D as DroppingPosition, d as ResizeHandleAxis, G as GridDragEvent, e as GridResizeEvent, L as Layout, C as CompactType, a as LayoutItem, c as Compactor, B as Breakpoint, b as Breakpoints, R as ResponsiveLayouts } from './types-Cxf4nHNr.js';
3
+ export { P as Position } from './types-Cxf4nHNr.js';
4
+ export { E as EventCallback, G as GridLayout, a as GridLayoutProps, R as ResponsiveGridLayout, b as ResponsiveGridLayoutProps } from './ResponsiveGridLayout-CH4s0tKj.js';
5
+ export { b as bottom, c as cloneLayout, a as cloneLayoutItem, d as getCompactor, g as getLayoutItem, h as horizontalCompactor, n as noCompactor, f as setTopLeft, s as setTransform, e as verticalCompactor } from './position-Dk2b4ZMS.js';
6
+ export { c as calcGridItemPosition, b as calcWH, a as calcXY } from './calculate-mgLpNJ5O.js';
7
+
8
+ /**
9
+ * GridItem component
10
+ *
11
+ * An individual item within a grid layout. Handles dragging and resizing.
12
+ */
13
+
14
+ type GridItemCallback<Data extends GridDragEvent | GridResizeEvent> = (i: string, w: number, h: number, data: Data) => void;
15
+ type ResizeHandle = ReactElement | ((resizeHandleAxis: ResizeHandleAxis, ref: React__default.Ref<HTMLElement>) => ReactElement);
16
+ interface GridItemProps {
17
+ /** Child element to render */
18
+ children: ReactElement;
19
+ /** Number of columns in the grid */
20
+ cols: number;
21
+ /** Width of the container in pixels */
22
+ containerWidth: number;
23
+ /** Margin between items [x, y] */
24
+ margin: readonly [number, number];
25
+ /** Padding inside the container [x, y] */
26
+ containerPadding: readonly [number, number];
27
+ /** Height of each row in pixels */
28
+ rowHeight: number;
29
+ /** Maximum number of rows */
30
+ maxRows: number;
31
+ /** Whether the item can be dragged */
32
+ isDraggable: boolean;
33
+ /** Whether the item can be resized */
34
+ isResizable: boolean;
35
+ /** Whether the item is bounded within the container */
36
+ isBounded: boolean;
37
+ /** Whether the item is static (can't be moved/resized) */
38
+ static?: boolean;
39
+ /** Use CSS transforms instead of top/left */
40
+ useCSSTransforms?: boolean;
41
+ /** Use percentage widths for server rendering */
42
+ usePercentages?: boolean;
43
+ /** Scale factor for transforms */
44
+ transformScale?: number;
45
+ /** Current position of a dropping element */
46
+ droppingPosition?: DroppingPosition;
47
+ /** Additional class name */
48
+ className?: string;
49
+ /** Additional styles */
50
+ style?: CSSProperties;
51
+ /** CSS selector for draggable handle */
52
+ handle?: string;
53
+ /** CSS selector for cancel handle */
54
+ cancel?: string;
55
+ /** X position in grid units */
56
+ x: number;
57
+ /** Y position in grid units */
58
+ y: number;
59
+ /** Width in grid units */
60
+ w: number;
61
+ /** Height in grid units */
62
+ h: number;
63
+ /** Minimum width in grid units */
64
+ minW?: number;
65
+ /** Maximum width in grid units */
66
+ maxW?: number;
67
+ /** Minimum height in grid units */
68
+ minH?: number;
69
+ /** Maximum height in grid units */
70
+ maxH?: number;
71
+ /** Unique identifier */
72
+ i: string;
73
+ /** Which resize handles to show */
74
+ resizeHandles?: ResizeHandleAxis[];
75
+ /** Custom resize handle */
76
+ resizeHandle?: ResizeHandle;
77
+ /** Called when drag starts */
78
+ onDragStart?: GridItemCallback<GridDragEvent>;
79
+ /** Called during drag */
80
+ onDrag?: GridItemCallback<GridDragEvent>;
81
+ /** Called when drag stops */
82
+ onDragStop?: GridItemCallback<GridDragEvent>;
83
+ /** Called when resize starts */
84
+ onResizeStart?: GridItemCallback<GridResizeEvent>;
85
+ /** Called during resize */
86
+ onResize?: GridItemCallback<GridResizeEvent>;
87
+ /** Called when resize stops */
88
+ onResizeStop?: GridItemCallback<GridResizeEvent>;
89
+ }
90
+ /**
91
+ * GridItem - An individual item within a grid layout.
92
+ *
93
+ * Wraps a child element with drag and resize functionality.
94
+ */
95
+ declare function GridItem(props: GridItemProps): ReactElement;
96
+
97
+ /**
98
+ * useContainerWidth hook
99
+ *
100
+ * Observes container width using ResizeObserver and provides
101
+ * reactive width updates for responsive layouts.
102
+ */
103
+
104
+ interface UseContainerWidthOptions {
105
+ /**
106
+ * If true, delays initial render until width is measured.
107
+ * Useful for SSR or when you need accurate initial measurements.
108
+ */
109
+ measureBeforeMount?: boolean;
110
+ /**
111
+ * Initial width to use before measurement.
112
+ * Defaults to 1280.
113
+ */
114
+ initialWidth?: number;
115
+ }
116
+ interface UseContainerWidthResult {
117
+ /**
118
+ * Current container width in pixels.
119
+ */
120
+ width: number;
121
+ /**
122
+ * Whether the container has been measured at least once.
123
+ */
124
+ mounted: boolean;
125
+ /**
126
+ * Ref to attach to the container element.
127
+ */
128
+ containerRef: RefObject<HTMLDivElement | null>;
129
+ /**
130
+ * Manually trigger a width measurement.
131
+ * Useful when the container size might change without a resize event.
132
+ */
133
+ measureWidth: () => void;
134
+ }
135
+ /**
136
+ * Hook to observe and track container width.
137
+ *
138
+ * Replaces the WidthProvider HOC with a more composable approach.
139
+ *
140
+ * @example
141
+ * ```tsx
142
+ * function MyGrid() {
143
+ * const { width, containerRef, mounted } = useContainerWidth();
144
+ *
145
+ * return (
146
+ * <div ref={containerRef}>
147
+ * {mounted && <GridLayout width={width} {...props} />}
148
+ * </div>
149
+ * );
150
+ * }
151
+ * ```
152
+ */
153
+ declare function useContainerWidth(options?: UseContainerWidthOptions): UseContainerWidthResult;
154
+
155
+ /**
156
+ * useGridLayout hook
157
+ *
158
+ * Core hook for managing grid layout state, including drag, resize, and drop operations.
159
+ * This extracts the state management logic from ReactGridLayout into a reusable hook.
160
+ */
161
+
162
+ interface DragState {
163
+ /** Currently dragging item placeholder */
164
+ activeDrag: LayoutItem | null;
165
+ /** Original item before drag started */
166
+ oldDragItem: LayoutItem | null;
167
+ /** Layout before drag started */
168
+ oldLayout: Layout | null;
169
+ }
170
+ interface ResizeState {
171
+ /** Whether a resize is in progress */
172
+ resizing: boolean;
173
+ /** Original item before resize started */
174
+ oldResizeItem: LayoutItem | null;
175
+ /** Layout before resize started */
176
+ oldLayout: Layout | null;
177
+ }
178
+ interface DropState {
179
+ /** DOM node for the dropping placeholder */
180
+ droppingDOMNode: React.ReactElement | null;
181
+ /** Current drop position */
182
+ droppingPosition: DroppingPosition | null;
183
+ }
184
+ interface UseGridLayoutOptions {
185
+ /** Initial layout */
186
+ layout: Layout;
187
+ /** Number of columns */
188
+ cols: number;
189
+ /** Compaction type: 'vertical', 'horizontal', or null */
190
+ compactType?: CompactType;
191
+ /** Allow items to overlap */
192
+ allowOverlap?: boolean;
193
+ /** Prevent collisions when moving items */
194
+ preventCollision?: boolean;
195
+ /** Called when layout changes */
196
+ onLayoutChange?: (layout: Layout) => void;
197
+ }
198
+ interface UseGridLayoutResult {
199
+ /** Current layout */
200
+ layout: Layout;
201
+ /** Set layout directly */
202
+ setLayout: (layout: Layout) => void;
203
+ /** Drag state */
204
+ dragState: DragState;
205
+ /** Resize state */
206
+ resizeState: ResizeState;
207
+ /** Drop state */
208
+ dropState: DropState;
209
+ /** Start dragging an item */
210
+ onDragStart: (itemId: string, x: number, y: number) => LayoutItem | null;
211
+ /** Update drag position */
212
+ onDrag: (itemId: string, x: number, y: number) => void;
213
+ /** Stop dragging */
214
+ onDragStop: (itemId: string, x: number, y: number) => void;
215
+ /** Start resizing an item */
216
+ onResizeStart: (itemId: string) => LayoutItem | null;
217
+ /** Update resize dimensions */
218
+ onResize: (itemId: string, w: number, h: number, x?: number, y?: number) => void;
219
+ /** Stop resizing */
220
+ onResizeStop: (itemId: string, w: number, h: number) => void;
221
+ /** Start dropping (external drag-in) */
222
+ onDropDragOver: (droppingItem: LayoutItem, position: DroppingPosition) => void;
223
+ /** Update drop position */
224
+ onDropDragLeave: () => void;
225
+ /** Complete drop */
226
+ onDrop: (droppingItem: LayoutItem) => void;
227
+ /** Container height in rows */
228
+ containerHeight: number;
229
+ /** Whether any drag/resize is active */
230
+ isInteracting: boolean;
231
+ /** Get the compactor being used */
232
+ compactor: Compactor;
233
+ }
234
+ /**
235
+ * Hook for managing grid layout state.
236
+ *
237
+ * Handles all layout state including drag, resize, and drop operations.
238
+ * Uses immutable updates and provides callbacks for all interactions.
239
+ *
240
+ * @example
241
+ * ```tsx
242
+ * function MyGrid() {
243
+ * const {
244
+ * layout,
245
+ * onDragStart,
246
+ * onDrag,
247
+ * onDragStop,
248
+ * containerHeight
249
+ * } = useGridLayout({
250
+ * layout: initialLayout,
251
+ * cols: 12,
252
+ * compactType: 'vertical'
253
+ * });
254
+ *
255
+ * return (
256
+ * <div style={{ height: containerHeight }}>
257
+ * {layout.map(item => (
258
+ * <GridItem
259
+ * key={item.i}
260
+ * {...item}
261
+ * onDragStart={() => onDragStart(item.i, item.x, item.y)}
262
+ * />
263
+ * ))}
264
+ * </div>
265
+ * );
266
+ * }
267
+ * ```
268
+ */
269
+ declare function useGridLayout(options: UseGridLayoutOptions): UseGridLayoutResult;
270
+
271
+ /**
272
+ * useResponsiveLayout hook
273
+ *
274
+ * Manages responsive breakpoints and layout generation for different screen sizes.
275
+ * Extracts state management from ResponsiveReactGridLayout into a reusable hook.
276
+ */
277
+
278
+ /** Default breakpoint names */
279
+ type DefaultBreakpoints = "lg" | "md" | "sm" | "xs" | "xxs";
280
+ /** Default breakpoint widths */
281
+ declare const DEFAULT_BREAKPOINTS: Breakpoints<DefaultBreakpoints>;
282
+ /** Default column counts per breakpoint */
283
+ declare const DEFAULT_COLS: Breakpoints<DefaultBreakpoints>;
284
+ interface UseResponsiveLayoutOptions<B extends Breakpoint = DefaultBreakpoints> {
285
+ /** Current container width */
286
+ width: number;
287
+ /** Breakpoint definitions (name → min-width) */
288
+ breakpoints?: Breakpoints<B>;
289
+ /** Column counts per breakpoint */
290
+ cols?: Breakpoints<B>;
291
+ /** Layouts for each breakpoint */
292
+ layouts?: ResponsiveLayouts<B>;
293
+ /** Compaction type */
294
+ compactType?: CompactType;
295
+ /** Called when breakpoint changes */
296
+ onBreakpointChange?: (newBreakpoint: B, cols: number) => void;
297
+ /** Called when layout changes */
298
+ onLayoutChange?: (layout: Layout, layouts: ResponsiveLayouts<B>) => void;
299
+ /** Called when width changes */
300
+ onWidthChange?: (width: number, margin: readonly [number, number], cols: number, containerPadding: readonly [number, number] | null) => void;
301
+ }
302
+ interface UseResponsiveLayoutResult<B extends Breakpoint = DefaultBreakpoints> {
303
+ /** Current layout for the active breakpoint */
304
+ layout: Layout;
305
+ /** All layouts by breakpoint */
306
+ layouts: ResponsiveLayouts<B>;
307
+ /** Current active breakpoint */
308
+ breakpoint: B;
309
+ /** Column count for the current breakpoint */
310
+ cols: number;
311
+ /** Update layouts for a specific breakpoint */
312
+ setLayoutForBreakpoint: (breakpoint: B, layout: Layout) => void;
313
+ /** Update all layouts */
314
+ setLayouts: (layouts: ResponsiveLayouts<B>) => void;
315
+ /** Sorted array of breakpoint names (smallest to largest) */
316
+ sortedBreakpoints: B[];
317
+ }
318
+ /**
319
+ * Hook for managing responsive grid layouts.
320
+ *
321
+ * Automatically selects the appropriate layout based on container width
322
+ * and generates layouts for new breakpoints from existing ones.
323
+ *
324
+ * @example
325
+ * ```tsx
326
+ * function MyResponsiveGrid() {
327
+ * const { width, containerRef } = useContainerWidth();
328
+ * const { layout, breakpoint, cols } = useResponsiveLayout({
329
+ * width,
330
+ * layouts: {
331
+ * lg: [...],
332
+ * md: [...],
333
+ * sm: [...]
334
+ * }
335
+ * });
336
+ *
337
+ * return (
338
+ * <div ref={containerRef}>
339
+ * <GridLayout
340
+ * width={width}
341
+ * cols={cols}
342
+ * layout={layout}
343
+ * />
344
+ * </div>
345
+ * );
346
+ * }
347
+ * ```
348
+ */
349
+ declare function useResponsiveLayout<B extends Breakpoint = DefaultBreakpoints>(options: UseResponsiveLayoutOptions<B>): UseResponsiveLayoutResult<B>;
350
+
351
+ export { Breakpoint, Breakpoints, CompactType, 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 };
package/dist/react.js ADDED
@@ -0,0 +1,96 @@
1
+ 'use strict';
2
+
3
+ var chunkH5KMDLY3_js = require('./chunk-H5KMDLY3.js');
4
+ require('./chunk-PBQSHIID.js');
5
+ var chunkBFTKGAP3_js = require('./chunk-BFTKGAP3.js');
6
+ var chunk3WO4SAYB_js = require('./chunk-3WO4SAYB.js');
7
+ var chunkF6NQPYKT_js = require('./chunk-F6NQPYKT.js');
8
+
9
+
10
+
11
+ Object.defineProperty(exports, "DEFAULT_BREAKPOINTS", {
12
+ enumerable: true,
13
+ get: function () { return chunkH5KMDLY3_js.DEFAULT_BREAKPOINTS; }
14
+ });
15
+ Object.defineProperty(exports, "DEFAULT_COLS", {
16
+ enumerable: true,
17
+ get: function () { return chunkH5KMDLY3_js.DEFAULT_COLS; }
18
+ });
19
+ Object.defineProperty(exports, "useContainerWidth", {
20
+ enumerable: true,
21
+ get: function () { return chunkH5KMDLY3_js.useContainerWidth; }
22
+ });
23
+ Object.defineProperty(exports, "useGridLayout", {
24
+ enumerable: true,
25
+ get: function () { return chunkH5KMDLY3_js.useGridLayout; }
26
+ });
27
+ Object.defineProperty(exports, "useResponsiveLayout", {
28
+ enumerable: true,
29
+ get: function () { return chunkH5KMDLY3_js.useResponsiveLayout; }
30
+ });
31
+ Object.defineProperty(exports, "GridItem", {
32
+ enumerable: true,
33
+ get: function () { return chunkBFTKGAP3_js.GridItem; }
34
+ });
35
+ Object.defineProperty(exports, "GridLayout", {
36
+ enumerable: true,
37
+ get: function () { return chunkBFTKGAP3_js.GridLayout; }
38
+ });
39
+ Object.defineProperty(exports, "ResponsiveGridLayout", {
40
+ enumerable: true,
41
+ get: function () { return chunkBFTKGAP3_js.ResponsiveGridLayout; }
42
+ });
43
+ Object.defineProperty(exports, "bottom", {
44
+ enumerable: true,
45
+ get: function () { return chunk3WO4SAYB_js.bottom; }
46
+ });
47
+ Object.defineProperty(exports, "cloneLayout", {
48
+ enumerable: true,
49
+ get: function () { return chunk3WO4SAYB_js.cloneLayout; }
50
+ });
51
+ Object.defineProperty(exports, "cloneLayoutItem", {
52
+ enumerable: true,
53
+ get: function () { return chunk3WO4SAYB_js.cloneLayoutItem; }
54
+ });
55
+ Object.defineProperty(exports, "getCompactor", {
56
+ enumerable: true,
57
+ get: function () { return chunk3WO4SAYB_js.getCompactor; }
58
+ });
59
+ Object.defineProperty(exports, "getLayoutItem", {
60
+ enumerable: true,
61
+ get: function () { return chunk3WO4SAYB_js.getLayoutItem; }
62
+ });
63
+ Object.defineProperty(exports, "horizontalCompactor", {
64
+ enumerable: true,
65
+ get: function () { return chunk3WO4SAYB_js.horizontalCompactor; }
66
+ });
67
+ Object.defineProperty(exports, "noCompactor", {
68
+ enumerable: true,
69
+ get: function () { return chunk3WO4SAYB_js.noCompactor; }
70
+ });
71
+ Object.defineProperty(exports, "setTopLeft", {
72
+ enumerable: true,
73
+ get: function () { return chunk3WO4SAYB_js.setTopLeft; }
74
+ });
75
+ Object.defineProperty(exports, "setTransform", {
76
+ enumerable: true,
77
+ get: function () { return chunk3WO4SAYB_js.setTransform; }
78
+ });
79
+ Object.defineProperty(exports, "verticalCompactor", {
80
+ enumerable: true,
81
+ get: function () { return chunk3WO4SAYB_js.verticalCompactor; }
82
+ });
83
+ Object.defineProperty(exports, "calcGridItemPosition", {
84
+ enumerable: true,
85
+ get: function () { return chunkF6NQPYKT_js.calcGridItemPosition; }
86
+ });
87
+ Object.defineProperty(exports, "calcWH", {
88
+ enumerable: true,
89
+ get: function () { return chunkF6NQPYKT_js.calcWH; }
90
+ });
91
+ Object.defineProperty(exports, "calcXY", {
92
+ enumerable: true,
93
+ get: function () { return chunkF6NQPYKT_js.calcXY; }
94
+ });
95
+ //# sourceMappingURL=react.js.map
96
+ //# sourceMappingURL=react.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"react.js"}
package/dist/react.mjs ADDED
@@ -0,0 +1,7 @@
1
+ export { DEFAULT_BREAKPOINTS, DEFAULT_COLS, useContainerWidth, useGridLayout, useResponsiveLayout } from './chunk-ZCXE6SR5.mjs';
2
+ import './chunk-ZWN22PS2.mjs';
3
+ export { GridItem, GridLayout, ResponsiveGridLayout } from './chunk-R35HZZTA.mjs';
4
+ export { bottom, cloneLayout, cloneLayoutItem, getCompactor, getLayoutItem, horizontalCompactor, noCompactor, setTopLeft, setTransform, verticalCompactor } from './chunk-4HNUMWQK.mjs';
5
+ export { calcGridItemPosition, calcWH, calcXY } from './chunk-2KUHNJXF.mjs';
6
+ //# sourceMappingURL=react.mjs.map
7
+ //# sourceMappingURL=react.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"react.mjs"}
@@ -0,0 +1,145 @@
1
+ import { a as LayoutItem, L as Layout, C as CompactType, B as Breakpoint, b as Breakpoints, R as ResponsiveLayouts } from './types-Cxf4nHNr.js';
2
+
3
+ /**
4
+ * Collision detection utilities for grid layouts.
5
+ *
6
+ * These functions determine if and where layout items overlap.
7
+ */
8
+
9
+ /**
10
+ * Check if two layout items collide (overlap).
11
+ *
12
+ * Two items collide if their bounding boxes overlap and they are
13
+ * not the same item.
14
+ *
15
+ * @param l1 - First layout item
16
+ * @param l2 - Second layout item
17
+ * @returns true if the items collide
18
+ */
19
+ declare function collides(l1: LayoutItem, l2: LayoutItem): boolean;
20
+ /**
21
+ * Find the first item in the layout that collides with the given item.
22
+ *
23
+ * @param layout - Layout to search
24
+ * @param layoutItem - Item to check for collisions
25
+ * @returns The first colliding item, or undefined if none
26
+ */
27
+ declare function getFirstCollision(layout: Layout, layoutItem: LayoutItem): LayoutItem | undefined;
28
+ /**
29
+ * Find all items in the layout that collide with the given item.
30
+ *
31
+ * @param layout - Layout to search
32
+ * @param layoutItem - Item to check for collisions
33
+ * @returns Array of all colliding items (may be empty)
34
+ */
35
+ declare function getAllCollisions(layout: Layout, layoutItem: LayoutItem): LayoutItem[];
36
+
37
+ /**
38
+ * Sorting utilities for grid layouts.
39
+ *
40
+ * These functions sort layout items for compaction and iteration.
41
+ */
42
+
43
+ /**
44
+ * Sort layout items based on the compaction type.
45
+ *
46
+ * - Vertical compaction: sort by row (y) then column (x)
47
+ * - Horizontal compaction: sort by column (x) then row (y)
48
+ * - No compaction (null): return original order
49
+ *
50
+ * Does not modify the original layout.
51
+ *
52
+ * @param layout - Layout to sort
53
+ * @param compactType - Type of compaction
54
+ * @returns Sorted layout
55
+ */
56
+ declare function sortLayoutItems(layout: Layout, compactType: CompactType): LayoutItem[];
57
+ /**
58
+ * Sort layout items by row ascending, then column ascending.
59
+ *
60
+ * Items are ordered from top-left to bottom-right, row by row.
61
+ * This is the natural reading order for vertical compaction.
62
+ *
63
+ * Does not modify the original layout.
64
+ *
65
+ * @param layout - Layout to sort
66
+ * @returns Sorted array of layout items
67
+ */
68
+ declare function sortLayoutItemsByRowCol(layout: Layout): LayoutItem[];
69
+ /**
70
+ * Sort layout items by column ascending, then row ascending.
71
+ *
72
+ * Items are ordered from top-left to bottom-right, column by column.
73
+ * This is the natural order for horizontal compaction.
74
+ *
75
+ * Does not modify the original layout.
76
+ *
77
+ * @param layout - Layout to sort
78
+ * @returns Sorted array of layout items
79
+ */
80
+ declare function sortLayoutItemsByColRow(layout: Layout): LayoutItem[];
81
+
82
+ /**
83
+ * Responsive layout utilities.
84
+ *
85
+ * Functions for handling responsive breakpoints and layout generation.
86
+ */
87
+
88
+ /**
89
+ * Sort breakpoints by width (ascending).
90
+ *
91
+ * Returns an array of breakpoint names sorted from smallest to largest.
92
+ * E.g., ['xxs', 'xs', 'sm', 'md', 'lg']
93
+ *
94
+ * @param breakpoints - Map of breakpoint names to widths
95
+ * @returns Sorted array of breakpoint names
96
+ */
97
+ declare function sortBreakpoints<B extends Breakpoint>(breakpoints: Breakpoints<B>): B[];
98
+ /**
99
+ * Get the active breakpoint for a given width.
100
+ *
101
+ * Returns the highest breakpoint that is valid for the width (width > breakpoint).
102
+ *
103
+ * @param breakpoints - Map of breakpoint names to widths
104
+ * @param width - Container width in pixels
105
+ * @returns Active breakpoint name
106
+ */
107
+ declare function getBreakpointFromWidth<B extends Breakpoint>(breakpoints: Breakpoints<B>, width: number): B;
108
+ /**
109
+ * Get the column count for a breakpoint.
110
+ *
111
+ * @param breakpoint - Breakpoint name
112
+ * @param cols - Map of breakpoint names to column counts
113
+ * @returns Number of columns for the breakpoint
114
+ * @throws Error if breakpoint is not defined in cols
115
+ */
116
+ declare function getColsFromBreakpoint<B extends Breakpoint>(breakpoint: B, cols: Breakpoints<B>): number;
117
+ /**
118
+ * Find or generate a layout for a breakpoint.
119
+ *
120
+ * If a layout exists for the breakpoint, returns a clone.
121
+ * Otherwise, generates a new layout from the nearest larger breakpoint.
122
+ *
123
+ * @param layouts - Existing layouts by breakpoint
124
+ * @param breakpoints - Breakpoint definitions
125
+ * @param breakpoint - Target breakpoint
126
+ * @param lastBreakpoint - Previous breakpoint (for fallback)
127
+ * @param cols - Column count for the target breakpoint
128
+ * @param compactType - Compaction type
129
+ * @returns Layout for the breakpoint
130
+ */
131
+ declare function findOrGenerateResponsiveLayout<B extends Breakpoint>(layouts: ResponsiveLayouts<B>, breakpoints: Breakpoints<B>, breakpoint: B, lastBreakpoint: B, cols: number, compactType: CompactType): Layout;
132
+ type IndentationValue<B extends Breakpoint> = readonly [number, number] | Partial<Record<B, readonly [number, number]>>;
133
+ /**
134
+ * Get margin or padding value for a breakpoint.
135
+ *
136
+ * Supports both fixed values ([x, y]) and breakpoint-specific values
137
+ * ({ lg: [x, y], md: [x, y], ... }).
138
+ *
139
+ * @param value - Fixed value or breakpoint-specific map
140
+ * @param breakpoint - Current breakpoint
141
+ * @returns Margin/padding tuple [x, y]
142
+ */
143
+ declare function getIndentationValue<B extends Breakpoint>(value: IndentationValue<B>, breakpoint: B): readonly [number, number];
144
+
145
+ export { getAllCollisions as a, sortLayoutItemsByRowCol as b, collides as c, sortLayoutItemsByColRow as d, getBreakpointFromWidth as e, getColsFromBreakpoint as f, getFirstCollision as g, findOrGenerateResponsiveLayout as h, sortBreakpoints as i, getIndentationValue as j, sortLayoutItems as s };