react-grid-layout 1.5.3 → 2.1.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.
- package/README.md +1156 -442
- package/css/styles.css +5 -4
- package/dist/ResponsiveGridLayout-BkHF9YHa.d.mts +133 -0
- package/dist/ResponsiveGridLayout-CLn16-X3.d.ts +133 -0
- package/dist/calculate-DsVTldEE.d.ts +196 -0
- package/dist/calculate-DwbL1D06.d.mts +196 -0
- package/dist/chunk-2O3ZME4Q.mjs +703 -0
- package/dist/chunk-2O3ZME4Q.mjs.map +1 -0
- package/dist/chunk-526JND3R.mjs +3 -0
- package/dist/chunk-526JND3R.mjs.map +1 -0
- package/dist/chunk-7ELO5FRW.js +4 -0
- package/dist/chunk-7ELO5FRW.js.map +1 -0
- package/dist/chunk-AWM66AWF.mjs +422 -0
- package/dist/chunk-AWM66AWF.mjs.map +1 -0
- package/dist/chunk-BJFPTW5Q.js +449 -0
- package/dist/chunk-BJFPTW5Q.js.map +1 -0
- package/dist/chunk-FN6MIZ24.js +744 -0
- package/dist/chunk-FN6MIZ24.js.map +1 -0
- package/dist/chunk-GPZBANOK.js +435 -0
- package/dist/chunk-GPZBANOK.js.map +1 -0
- package/dist/chunk-LWF5EYMO.mjs +429 -0
- package/dist/chunk-LWF5EYMO.mjs.map +1 -0
- package/dist/chunk-MXXN7GUE.mjs +1408 -0
- package/dist/chunk-MXXN7GUE.mjs.map +1 -0
- package/dist/chunk-QRW3ND4U.js +1417 -0
- package/dist/chunk-QRW3ND4U.js.map +1 -0
- package/dist/core.d.mts +186 -0
- package/dist/core.d.ts +186 -0
- package/dist/core.js +274 -0
- package/dist/core.js.map +1 -0
- package/dist/core.mjs +5 -0
- package/dist/core.mjs.map +1 -0
- package/dist/extras.d.mts +208 -0
- package/dist/extras.d.ts +208 -0
- package/dist/extras.js +462 -0
- package/dist/extras.js.map +1 -0
- package/dist/extras.mjs +454 -0
- package/dist/extras.mjs.map +1 -0
- package/dist/index.d.mts +7 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +154 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +7 -0
- package/dist/index.mjs.map +1 -0
- package/dist/legacy.d.mts +163 -0
- package/dist/legacy.d.ts +163 -0
- package/dist/legacy.js +320 -0
- package/dist/legacy.js.map +1 -0
- package/dist/legacy.mjs +308 -0
- package/dist/legacy.mjs.map +1 -0
- package/dist/position-C8a5g6bb.d.mts +324 -0
- package/dist/position-H8tBL91b.d.ts +324 -0
- package/dist/react.d.mts +357 -0
- package/dist/react.d.ts +357 -0
- package/dist/react.js +96 -0
- package/dist/react.js.map +1 -0
- package/dist/react.mjs +7 -0
- package/dist/react.mjs.map +1 -0
- package/dist/responsive-BB5d98xz.d.mts +145 -0
- package/dist/responsive-BXI-GCXG.d.ts +145 -0
- package/dist/types-CokovIMH.d.mts +469 -0
- package/dist/types-CokovIMH.d.ts +469 -0
- package/index-dev.js +24 -0
- package/package.json +133 -40
- package/.babelrc.js +0 -22
- package/.browserslistrc +0 -3
- package/.eslintignore +0 -4
- package/.flowconfig +0 -20
- package/.prettierignore +0 -4
- package/.prettierrc +0 -17
- package/CHANGELOG.md +0 -985
- package/build/GridItem.js +0 -638
- package/build/ReactGridLayout.js +0 -741
- package/build/ReactGridLayoutPropTypes.js +0 -210
- package/build/ResponsiveReactGridLayout.js +0 -297
- package/build/calculateUtils.js +0 -165
- package/build/components/WidthProvider.js +0 -115
- package/build/fastRGLPropsEqual.js +0 -5
- package/build/responsiveUtils.js +0 -101
- package/build/utils.js +0 -842
- package/dist/react-grid-layout.min.js +0 -2
- package/dist/react-grid-layout.min.js.map +0 -1
- package/index.js.flow +0 -8
- package/ip_fetcher +0 -0
- package/ip_fetcher.c +0 -47
- package/lib/GridItem.jsx +0 -689
- package/lib/ReactGridLayout.jsx +0 -855
- package/lib/ReactGridLayoutPropTypes.js +0 -241
- package/lib/ResponsiveReactGridLayout.jsx +0 -349
- package/lib/calculateUtils.js +0 -169
- package/lib/components/WidthProvider.jsx +0 -110
- package/lib/fastRGLPropsEqual.js +0 -46
- package/lib/responsiveUtils.js +0 -118
- package/lib/utils.js +0 -995
- package/yarn-error.log +0 -7780
package/dist/react.d.ts
ADDED
|
@@ -0,0 +1,357 @@
|
|
|
1
|
+
import React__default, { ReactElement, CSSProperties, RefObject } from 'react';
|
|
2
|
+
import { D as DroppingPosition, d as ResizeHandleAxis, f as LayoutConstraint, a as LayoutItem, L as Layout, G as GridDragEvent, e as GridResizeEvent, C as CompactType, c as Compactor, B as Breakpoint, b as Breakpoints, R as ResponsiveLayouts } from './types-CokovIMH.js';
|
|
3
|
+
export { P as Position } from './types-CokovIMH.js';
|
|
4
|
+
export { E as EventCallback, G as GridLayout, a as GridLayoutProps, R as ResponsiveGridLayout, b as ResponsiveGridLayoutProps } from './ResponsiveGridLayout-CLn16-X3.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-H8tBL91b.js';
|
|
6
|
+
export { c as calcGridItemPosition, b as calcWH, a as calcXY } from './calculate-DsVTldEE.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
|
+
/** Layout constraints for position/size limiting */
|
|
78
|
+
constraints?: LayoutConstraint[];
|
|
79
|
+
/** The layout item data (for per-item constraints) */
|
|
80
|
+
layoutItem?: LayoutItem;
|
|
81
|
+
/** Current layout (for constraint context) */
|
|
82
|
+
layout?: Layout;
|
|
83
|
+
/** Called when drag starts */
|
|
84
|
+
onDragStart?: GridItemCallback<GridDragEvent>;
|
|
85
|
+
/** Called during drag */
|
|
86
|
+
onDrag?: GridItemCallback<GridDragEvent>;
|
|
87
|
+
/** Called when drag stops */
|
|
88
|
+
onDragStop?: GridItemCallback<GridDragEvent>;
|
|
89
|
+
/** Called when resize starts */
|
|
90
|
+
onResizeStart?: GridItemCallback<GridResizeEvent>;
|
|
91
|
+
/** Called during resize */
|
|
92
|
+
onResize?: GridItemCallback<GridResizeEvent>;
|
|
93
|
+
/** Called when resize stops */
|
|
94
|
+
onResizeStop?: GridItemCallback<GridResizeEvent>;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* GridItem - An individual item within a grid layout.
|
|
98
|
+
*
|
|
99
|
+
* Wraps a child element with drag and resize functionality.
|
|
100
|
+
*/
|
|
101
|
+
declare function GridItem(props: GridItemProps): ReactElement;
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* useContainerWidth hook
|
|
105
|
+
*
|
|
106
|
+
* Observes container width using ResizeObserver and provides
|
|
107
|
+
* reactive width updates for responsive layouts.
|
|
108
|
+
*/
|
|
109
|
+
|
|
110
|
+
interface UseContainerWidthOptions {
|
|
111
|
+
/**
|
|
112
|
+
* If true, delays initial render until width is measured.
|
|
113
|
+
* Useful for SSR or when you need accurate initial measurements.
|
|
114
|
+
*/
|
|
115
|
+
measureBeforeMount?: boolean;
|
|
116
|
+
/**
|
|
117
|
+
* Initial width to use before measurement.
|
|
118
|
+
* Defaults to 1280.
|
|
119
|
+
*/
|
|
120
|
+
initialWidth?: number;
|
|
121
|
+
}
|
|
122
|
+
interface UseContainerWidthResult {
|
|
123
|
+
/**
|
|
124
|
+
* Current container width in pixels.
|
|
125
|
+
*/
|
|
126
|
+
width: number;
|
|
127
|
+
/**
|
|
128
|
+
* Whether the container has been measured at least once.
|
|
129
|
+
*/
|
|
130
|
+
mounted: boolean;
|
|
131
|
+
/**
|
|
132
|
+
* Ref to attach to the container element.
|
|
133
|
+
*/
|
|
134
|
+
containerRef: RefObject<HTMLDivElement | null>;
|
|
135
|
+
/**
|
|
136
|
+
* Manually trigger a width measurement.
|
|
137
|
+
* Useful when the container size might change without a resize event.
|
|
138
|
+
*/
|
|
139
|
+
measureWidth: () => void;
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Hook to observe and track container width.
|
|
143
|
+
*
|
|
144
|
+
* Replaces the WidthProvider HOC with a more composable approach.
|
|
145
|
+
*
|
|
146
|
+
* @example
|
|
147
|
+
* ```tsx
|
|
148
|
+
* function MyGrid() {
|
|
149
|
+
* const { width, containerRef, mounted } = useContainerWidth();
|
|
150
|
+
*
|
|
151
|
+
* return (
|
|
152
|
+
* <div ref={containerRef}>
|
|
153
|
+
* {mounted && <GridLayout width={width} {...props} />}
|
|
154
|
+
* </div>
|
|
155
|
+
* );
|
|
156
|
+
* }
|
|
157
|
+
* ```
|
|
158
|
+
*/
|
|
159
|
+
declare function useContainerWidth(options?: UseContainerWidthOptions): UseContainerWidthResult;
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* useGridLayout hook
|
|
163
|
+
*
|
|
164
|
+
* Core hook for managing grid layout state, including drag, resize, and drop operations.
|
|
165
|
+
* This extracts the state management logic from ReactGridLayout into a reusable hook.
|
|
166
|
+
*/
|
|
167
|
+
|
|
168
|
+
interface DragState {
|
|
169
|
+
/** Currently dragging item placeholder */
|
|
170
|
+
activeDrag: LayoutItem | null;
|
|
171
|
+
/** Original item before drag started */
|
|
172
|
+
oldDragItem: LayoutItem | null;
|
|
173
|
+
/** Layout before drag started */
|
|
174
|
+
oldLayout: Layout | null;
|
|
175
|
+
}
|
|
176
|
+
interface ResizeState {
|
|
177
|
+
/** Whether a resize is in progress */
|
|
178
|
+
resizing: boolean;
|
|
179
|
+
/** Original item before resize started */
|
|
180
|
+
oldResizeItem: LayoutItem | null;
|
|
181
|
+
/** Layout before resize started */
|
|
182
|
+
oldLayout: Layout | null;
|
|
183
|
+
}
|
|
184
|
+
interface DropState {
|
|
185
|
+
/** DOM node for the dropping placeholder */
|
|
186
|
+
droppingDOMNode: React.ReactElement | null;
|
|
187
|
+
/** Current drop position */
|
|
188
|
+
droppingPosition: DroppingPosition | null;
|
|
189
|
+
}
|
|
190
|
+
interface UseGridLayoutOptions {
|
|
191
|
+
/** Initial layout */
|
|
192
|
+
layout: Layout;
|
|
193
|
+
/** Number of columns */
|
|
194
|
+
cols: number;
|
|
195
|
+
/** Compaction type: 'vertical', 'horizontal', or null */
|
|
196
|
+
compactType?: CompactType;
|
|
197
|
+
/** Allow items to overlap */
|
|
198
|
+
allowOverlap?: boolean;
|
|
199
|
+
/** Prevent collisions when moving items */
|
|
200
|
+
preventCollision?: boolean;
|
|
201
|
+
/** Called when layout changes */
|
|
202
|
+
onLayoutChange?: (layout: Layout) => void;
|
|
203
|
+
}
|
|
204
|
+
interface UseGridLayoutResult {
|
|
205
|
+
/** Current layout */
|
|
206
|
+
layout: Layout;
|
|
207
|
+
/** Set layout directly */
|
|
208
|
+
setLayout: (layout: Layout) => void;
|
|
209
|
+
/** Drag state */
|
|
210
|
+
dragState: DragState;
|
|
211
|
+
/** Resize state */
|
|
212
|
+
resizeState: ResizeState;
|
|
213
|
+
/** Drop state */
|
|
214
|
+
dropState: DropState;
|
|
215
|
+
/** Start dragging an item */
|
|
216
|
+
onDragStart: (itemId: string, x: number, y: number) => LayoutItem | null;
|
|
217
|
+
/** Update drag position */
|
|
218
|
+
onDrag: (itemId: string, x: number, y: number) => void;
|
|
219
|
+
/** Stop dragging */
|
|
220
|
+
onDragStop: (itemId: string, x: number, y: number) => void;
|
|
221
|
+
/** Start resizing an item */
|
|
222
|
+
onResizeStart: (itemId: string) => LayoutItem | null;
|
|
223
|
+
/** Update resize dimensions */
|
|
224
|
+
onResize: (itemId: string, w: number, h: number, x?: number, y?: number) => void;
|
|
225
|
+
/** Stop resizing */
|
|
226
|
+
onResizeStop: (itemId: string, w: number, h: number) => void;
|
|
227
|
+
/** Start dropping (external drag-in) */
|
|
228
|
+
onDropDragOver: (droppingItem: LayoutItem, position: DroppingPosition) => void;
|
|
229
|
+
/** Update drop position */
|
|
230
|
+
onDropDragLeave: () => void;
|
|
231
|
+
/** Complete drop */
|
|
232
|
+
onDrop: (droppingItem: LayoutItem) => void;
|
|
233
|
+
/** Container height in rows */
|
|
234
|
+
containerHeight: number;
|
|
235
|
+
/** Whether any drag/resize is active */
|
|
236
|
+
isInteracting: boolean;
|
|
237
|
+
/** Get the compactor being used */
|
|
238
|
+
compactor: Compactor;
|
|
239
|
+
}
|
|
240
|
+
/**
|
|
241
|
+
* Hook for managing grid layout state.
|
|
242
|
+
*
|
|
243
|
+
* Handles all layout state including drag, resize, and drop operations.
|
|
244
|
+
* Uses immutable updates and provides callbacks for all interactions.
|
|
245
|
+
*
|
|
246
|
+
* @example
|
|
247
|
+
* ```tsx
|
|
248
|
+
* function MyGrid() {
|
|
249
|
+
* const {
|
|
250
|
+
* layout,
|
|
251
|
+
* onDragStart,
|
|
252
|
+
* onDrag,
|
|
253
|
+
* onDragStop,
|
|
254
|
+
* containerHeight
|
|
255
|
+
* } = useGridLayout({
|
|
256
|
+
* layout: initialLayout,
|
|
257
|
+
* cols: 12,
|
|
258
|
+
* compactType: 'vertical'
|
|
259
|
+
* });
|
|
260
|
+
*
|
|
261
|
+
* return (
|
|
262
|
+
* <div style={{ height: containerHeight }}>
|
|
263
|
+
* {layout.map(item => (
|
|
264
|
+
* <GridItem
|
|
265
|
+
* key={item.i}
|
|
266
|
+
* {...item}
|
|
267
|
+
* onDragStart={() => onDragStart(item.i, item.x, item.y)}
|
|
268
|
+
* />
|
|
269
|
+
* ))}
|
|
270
|
+
* </div>
|
|
271
|
+
* );
|
|
272
|
+
* }
|
|
273
|
+
* ```
|
|
274
|
+
*/
|
|
275
|
+
declare function useGridLayout(options: UseGridLayoutOptions): UseGridLayoutResult;
|
|
276
|
+
|
|
277
|
+
/**
|
|
278
|
+
* useResponsiveLayout hook
|
|
279
|
+
*
|
|
280
|
+
* Manages responsive breakpoints and layout generation for different screen sizes.
|
|
281
|
+
* Extracts state management from ResponsiveReactGridLayout into a reusable hook.
|
|
282
|
+
*/
|
|
283
|
+
|
|
284
|
+
/** Default breakpoint names */
|
|
285
|
+
type DefaultBreakpoints = "lg" | "md" | "sm" | "xs" | "xxs";
|
|
286
|
+
/** Default breakpoint widths */
|
|
287
|
+
declare const DEFAULT_BREAKPOINTS: Breakpoints<DefaultBreakpoints>;
|
|
288
|
+
/** Default column counts per breakpoint */
|
|
289
|
+
declare const DEFAULT_COLS: Breakpoints<DefaultBreakpoints>;
|
|
290
|
+
interface UseResponsiveLayoutOptions<B extends Breakpoint = DefaultBreakpoints> {
|
|
291
|
+
/** Current container width */
|
|
292
|
+
width: number;
|
|
293
|
+
/** Breakpoint definitions (name → min-width) */
|
|
294
|
+
breakpoints?: Breakpoints<B>;
|
|
295
|
+
/** Column counts per breakpoint */
|
|
296
|
+
cols?: Breakpoints<B>;
|
|
297
|
+
/** Layouts for each breakpoint */
|
|
298
|
+
layouts?: ResponsiveLayouts<B>;
|
|
299
|
+
/** Compaction type */
|
|
300
|
+
compactType?: CompactType;
|
|
301
|
+
/** Called when breakpoint changes */
|
|
302
|
+
onBreakpointChange?: (newBreakpoint: B, cols: number) => void;
|
|
303
|
+
/** Called when layout changes */
|
|
304
|
+
onLayoutChange?: (layout: Layout, layouts: ResponsiveLayouts<B>) => void;
|
|
305
|
+
/** Called when width changes */
|
|
306
|
+
onWidthChange?: (width: number, margin: readonly [number, number], cols: number, containerPadding: readonly [number, number] | null) => void;
|
|
307
|
+
}
|
|
308
|
+
interface UseResponsiveLayoutResult<B extends Breakpoint = DefaultBreakpoints> {
|
|
309
|
+
/** Current layout for the active breakpoint */
|
|
310
|
+
layout: Layout;
|
|
311
|
+
/** All layouts by breakpoint */
|
|
312
|
+
layouts: ResponsiveLayouts<B>;
|
|
313
|
+
/** Current active breakpoint */
|
|
314
|
+
breakpoint: B;
|
|
315
|
+
/** Column count for the current breakpoint */
|
|
316
|
+
cols: number;
|
|
317
|
+
/** Update layouts for a specific breakpoint */
|
|
318
|
+
setLayoutForBreakpoint: (breakpoint: B, layout: Layout) => void;
|
|
319
|
+
/** Update all layouts */
|
|
320
|
+
setLayouts: (layouts: ResponsiveLayouts<B>) => void;
|
|
321
|
+
/** Sorted array of breakpoint names (smallest to largest) */
|
|
322
|
+
sortedBreakpoints: B[];
|
|
323
|
+
}
|
|
324
|
+
/**
|
|
325
|
+
* Hook for managing responsive grid layouts.
|
|
326
|
+
*
|
|
327
|
+
* Automatically selects the appropriate layout based on container width
|
|
328
|
+
* and generates layouts for new breakpoints from existing ones.
|
|
329
|
+
*
|
|
330
|
+
* @example
|
|
331
|
+
* ```tsx
|
|
332
|
+
* function MyResponsiveGrid() {
|
|
333
|
+
* const { width, containerRef } = useContainerWidth();
|
|
334
|
+
* const { layout, breakpoint, cols } = useResponsiveLayout({
|
|
335
|
+
* width,
|
|
336
|
+
* layouts: {
|
|
337
|
+
* lg: [...],
|
|
338
|
+
* md: [...],
|
|
339
|
+
* sm: [...]
|
|
340
|
+
* }
|
|
341
|
+
* });
|
|
342
|
+
*
|
|
343
|
+
* return (
|
|
344
|
+
* <div ref={containerRef}>
|
|
345
|
+
* <GridLayout
|
|
346
|
+
* width={width}
|
|
347
|
+
* cols={cols}
|
|
348
|
+
* layout={layout}
|
|
349
|
+
* />
|
|
350
|
+
* </div>
|
|
351
|
+
* );
|
|
352
|
+
* }
|
|
353
|
+
* ```
|
|
354
|
+
*/
|
|
355
|
+
declare function useResponsiveLayout<B extends Breakpoint = DefaultBreakpoints>(options: UseResponsiveLayoutOptions<B>): UseResponsiveLayoutResult<B>;
|
|
356
|
+
|
|
357
|
+
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 chunkGPZBANOK_js = require('./chunk-GPZBANOK.js');
|
|
4
|
+
require('./chunk-7ELO5FRW.js');
|
|
5
|
+
var chunkQRW3ND4U_js = require('./chunk-QRW3ND4U.js');
|
|
6
|
+
var chunkFN6MIZ24_js = require('./chunk-FN6MIZ24.js');
|
|
7
|
+
var chunkBJFPTW5Q_js = require('./chunk-BJFPTW5Q.js');
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
Object.defineProperty(exports, "DEFAULT_BREAKPOINTS", {
|
|
12
|
+
enumerable: true,
|
|
13
|
+
get: function () { return chunkGPZBANOK_js.DEFAULT_BREAKPOINTS; }
|
|
14
|
+
});
|
|
15
|
+
Object.defineProperty(exports, "DEFAULT_COLS", {
|
|
16
|
+
enumerable: true,
|
|
17
|
+
get: function () { return chunkGPZBANOK_js.DEFAULT_COLS; }
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports, "useContainerWidth", {
|
|
20
|
+
enumerable: true,
|
|
21
|
+
get: function () { return chunkGPZBANOK_js.useContainerWidth; }
|
|
22
|
+
});
|
|
23
|
+
Object.defineProperty(exports, "useGridLayout", {
|
|
24
|
+
enumerable: true,
|
|
25
|
+
get: function () { return chunkGPZBANOK_js.useGridLayout; }
|
|
26
|
+
});
|
|
27
|
+
Object.defineProperty(exports, "useResponsiveLayout", {
|
|
28
|
+
enumerable: true,
|
|
29
|
+
get: function () { return chunkGPZBANOK_js.useResponsiveLayout; }
|
|
30
|
+
});
|
|
31
|
+
Object.defineProperty(exports, "GridItem", {
|
|
32
|
+
enumerable: true,
|
|
33
|
+
get: function () { return chunkQRW3ND4U_js.GridItem; }
|
|
34
|
+
});
|
|
35
|
+
Object.defineProperty(exports, "GridLayout", {
|
|
36
|
+
enumerable: true,
|
|
37
|
+
get: function () { return chunkQRW3ND4U_js.GridLayout; }
|
|
38
|
+
});
|
|
39
|
+
Object.defineProperty(exports, "ResponsiveGridLayout", {
|
|
40
|
+
enumerable: true,
|
|
41
|
+
get: function () { return chunkQRW3ND4U_js.ResponsiveGridLayout; }
|
|
42
|
+
});
|
|
43
|
+
Object.defineProperty(exports, "getCompactor", {
|
|
44
|
+
enumerable: true,
|
|
45
|
+
get: function () { return chunkFN6MIZ24_js.getCompactor; }
|
|
46
|
+
});
|
|
47
|
+
Object.defineProperty(exports, "horizontalCompactor", {
|
|
48
|
+
enumerable: true,
|
|
49
|
+
get: function () { return chunkFN6MIZ24_js.horizontalCompactor; }
|
|
50
|
+
});
|
|
51
|
+
Object.defineProperty(exports, "noCompactor", {
|
|
52
|
+
enumerable: true,
|
|
53
|
+
get: function () { return chunkFN6MIZ24_js.noCompactor; }
|
|
54
|
+
});
|
|
55
|
+
Object.defineProperty(exports, "setTopLeft", {
|
|
56
|
+
enumerable: true,
|
|
57
|
+
get: function () { return chunkFN6MIZ24_js.setTopLeft; }
|
|
58
|
+
});
|
|
59
|
+
Object.defineProperty(exports, "setTransform", {
|
|
60
|
+
enumerable: true,
|
|
61
|
+
get: function () { return chunkFN6MIZ24_js.setTransform; }
|
|
62
|
+
});
|
|
63
|
+
Object.defineProperty(exports, "verticalCompactor", {
|
|
64
|
+
enumerable: true,
|
|
65
|
+
get: function () { return chunkFN6MIZ24_js.verticalCompactor; }
|
|
66
|
+
});
|
|
67
|
+
Object.defineProperty(exports, "bottom", {
|
|
68
|
+
enumerable: true,
|
|
69
|
+
get: function () { return chunkBJFPTW5Q_js.bottom; }
|
|
70
|
+
});
|
|
71
|
+
Object.defineProperty(exports, "calcGridItemPosition", {
|
|
72
|
+
enumerable: true,
|
|
73
|
+
get: function () { return chunkBJFPTW5Q_js.calcGridItemPosition; }
|
|
74
|
+
});
|
|
75
|
+
Object.defineProperty(exports, "calcWH", {
|
|
76
|
+
enumerable: true,
|
|
77
|
+
get: function () { return chunkBJFPTW5Q_js.calcWH; }
|
|
78
|
+
});
|
|
79
|
+
Object.defineProperty(exports, "calcXY", {
|
|
80
|
+
enumerable: true,
|
|
81
|
+
get: function () { return chunkBJFPTW5Q_js.calcXY; }
|
|
82
|
+
});
|
|
83
|
+
Object.defineProperty(exports, "cloneLayout", {
|
|
84
|
+
enumerable: true,
|
|
85
|
+
get: function () { return chunkBJFPTW5Q_js.cloneLayout; }
|
|
86
|
+
});
|
|
87
|
+
Object.defineProperty(exports, "cloneLayoutItem", {
|
|
88
|
+
enumerable: true,
|
|
89
|
+
get: function () { return chunkBJFPTW5Q_js.cloneLayoutItem; }
|
|
90
|
+
});
|
|
91
|
+
Object.defineProperty(exports, "getLayoutItem", {
|
|
92
|
+
enumerable: true,
|
|
93
|
+
get: function () { return chunkBJFPTW5Q_js.getLayoutItem; }
|
|
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-LWF5EYMO.mjs';
|
|
2
|
+
import './chunk-526JND3R.mjs';
|
|
3
|
+
export { GridItem, GridLayout, ResponsiveGridLayout } from './chunk-MXXN7GUE.mjs';
|
|
4
|
+
export { getCompactor, horizontalCompactor, noCompactor, setTopLeft, setTransform, verticalCompactor } from './chunk-2O3ZME4Q.mjs';
|
|
5
|
+
export { bottom, calcGridItemPosition, calcWH, calcXY, cloneLayout, cloneLayoutItem, getLayoutItem } from './chunk-AWM66AWF.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-CokovIMH.mjs';
|
|
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 };
|