@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,208 @@
1
+ import * as React from 'react';
2
+ import { G as GridCellConfig } from './calculate-CoBSgofg.mjs';
3
+ import { b as Compactor } from './types-Dbg8jAWj.mjs';
4
+
5
+ /**
6
+ * GridBackground component
7
+ *
8
+ * Renders an SVG grid background that aligns with GridLayout cells.
9
+ * Use this to visualize the grid structure behind your layout.
10
+ */
11
+
12
+ interface GridBackgroundProps extends GridCellConfig {
13
+ /**
14
+ * Number of rows to display. If "auto", calculates based on height.
15
+ * @default 10
16
+ */
17
+ rows?: number | "auto";
18
+ /**
19
+ * Height of the background in pixels. Used when rows="auto".
20
+ */
21
+ height?: number;
22
+ /**
23
+ * Color of the grid cell backgrounds.
24
+ * @default "#e0e0e0"
25
+ */
26
+ color?: string;
27
+ /**
28
+ * Border radius of grid cells in pixels.
29
+ * @default 4
30
+ */
31
+ borderRadius?: number;
32
+ /**
33
+ * Additional CSS class name.
34
+ */
35
+ className?: string;
36
+ /**
37
+ * Additional inline styles.
38
+ */
39
+ style?: React.CSSProperties;
40
+ }
41
+ /**
42
+ * SVG grid background component.
43
+ *
44
+ * Renders a visual grid that aligns with GridLayout cells. Position this
45
+ * behind your GridLayout using CSS positioning.
46
+ *
47
+ * @example
48
+ * ```tsx
49
+ * import { GridBackground } from 'react-grid-layout/extras';
50
+ *
51
+ * function MyGrid() {
52
+ * const { width, containerRef, mounted } = useContainerWidth();
53
+ *
54
+ * return (
55
+ * <div ref={containerRef} style={{ position: 'relative' }}>
56
+ * {mounted && (
57
+ * <>
58
+ * <GridBackground
59
+ * width={width}
60
+ * cols={12}
61
+ * rowHeight={30}
62
+ * margin={[10, 10]}
63
+ * rows={10}
64
+ * color="#f0f0f0"
65
+ * />
66
+ * <GridLayout width={width} gridConfig={{ cols: 12, rowHeight: 30 }}>
67
+ * {children}
68
+ * </GridLayout>
69
+ * </>
70
+ * )}
71
+ * </div>
72
+ * );
73
+ * }
74
+ * ```
75
+ */
76
+ declare function GridBackground({ width, cols, rowHeight, margin, containerPadding, rows, height, color, borderRadius, className, style }: GridBackgroundProps): React.ReactElement;
77
+
78
+ /**
79
+ * Fast Vertical Compactor
80
+ *
81
+ * An optimized vertical compaction algorithm using a "rising tide" approach.
82
+ * This algorithm has O(n log n) complexity (dominated by sorting) compared to
83
+ * the default vertical compactor which can have O(n²) complexity due to
84
+ * recursive collision resolution.
85
+ *
86
+ * Best suited for large layouts (200+ items) where compaction performance
87
+ * is critical. For smaller layouts, the difference is negligible.
88
+ *
89
+ * Based on the algorithm from PR #2152 by Morris Brodersen (@morris).
90
+ *
91
+ * @example
92
+ * ```tsx
93
+ * import { fastVerticalCompactor } from 'react-grid-layout/extras';
94
+ *
95
+ * <GridLayout
96
+ * compactor={fastVerticalCompactor}
97
+ * layout={layout}
98
+ * // ...
99
+ * />
100
+ * ```
101
+ */
102
+
103
+ /**
104
+ * Fast vertical compactor - optimized for large layouts.
105
+ *
106
+ * Uses a "rising tide" algorithm that achieves O(n log n) complexity
107
+ * instead of the potentially O(n²) recursive collision resolution.
108
+ *
109
+ * Best suited for layouts with 200+ items where compaction performance
110
+ * becomes noticeable. For smaller layouts, the standard verticalCompactor
111
+ * works equally well.
112
+ */
113
+ declare const fastVerticalCompactor: Compactor;
114
+ /**
115
+ * Fast vertical compactor that allows overlapping items.
116
+ *
117
+ * Compacts items upward but allows them to overlap each other.
118
+ */
119
+ declare const fastVerticalOverlapCompactor: Compactor;
120
+
121
+ /**
122
+ * Fast Horizontal Compactor
123
+ *
124
+ * An optimized horizontal compaction algorithm using a "sweeping tide" approach.
125
+ * This algorithm has O(n log n) complexity (dominated by sorting) compared to
126
+ * the default horizontal compactor which can have O(n²) complexity due to
127
+ * recursive collision resolution.
128
+ *
129
+ * Best suited for large layouts (200+ items) where compaction performance
130
+ * is critical. For smaller layouts, the difference is negligible.
131
+ *
132
+ * Adapted from the vertical fast compactor algorithm from PR #2152 by Morris Brodersen (@morris).
133
+ *
134
+ * @example
135
+ * ```tsx
136
+ * import { fastHorizontalCompactor } from 'react-grid-layout/extras';
137
+ *
138
+ * <GridLayout
139
+ * compactor={fastHorizontalCompactor}
140
+ * layout={layout}
141
+ * // ...
142
+ * />
143
+ * ```
144
+ */
145
+
146
+ /**
147
+ * Fast horizontal compactor - optimized for large layouts.
148
+ *
149
+ * Uses a "sweeping tide" algorithm that achieves O(n log n) complexity
150
+ * instead of the potentially O(n²) recursive collision resolution.
151
+ *
152
+ * Best suited for layouts with 200+ items where compaction performance
153
+ * becomes noticeable. For smaller layouts, the standard horizontalCompactor
154
+ * works equally well.
155
+ */
156
+ declare const fastHorizontalCompactor: Compactor;
157
+ /**
158
+ * Fast horizontal compactor that allows overlapping items.
159
+ *
160
+ * Compacts items leftward but allows them to overlap each other.
161
+ */
162
+ declare const fastHorizontalOverlapCompactor: Compactor;
163
+
164
+ /**
165
+ * Wrap Compactor
166
+ *
167
+ * A compaction algorithm that treats grid items like words in a paragraph.
168
+ * Items flow left-to-right, wrapping to the next row when they reach
169
+ * the grid edge.
170
+ *
171
+ * When dragging:
172
+ * - Moving an item earlier in the sequence shifts other items down/right
173
+ * - Moving an item later in the sequence shifts other items up/left
174
+ *
175
+ * This creates a natural reordering behavior similar to drag-and-drop
176
+ * in file managers or card layouts.
177
+ *
178
+ * Based on the algorithm from PR #1773 by John Thomson (@JohnThomson).
179
+ *
180
+ * @example
181
+ * ```tsx
182
+ * import { wrapCompactor } from 'react-grid-layout/extras';
183
+ *
184
+ * <GridLayout
185
+ * compactor={wrapCompactor}
186
+ * layout={layout}
187
+ * // ...
188
+ * />
189
+ * ```
190
+ */
191
+
192
+ /**
193
+ * Wrap compactor - arranges items like words in a paragraph.
194
+ *
195
+ * Items flow left-to-right and wrap to the next row when they
196
+ * reach the grid edge. Dragging an item reorders the sequence,
197
+ * with other items shifting to maintain the flow.
198
+ *
199
+ * Works best with uniformly-sized items (especially 1x1), but
200
+ * handles larger items by ensuring they fit within row bounds.
201
+ */
202
+ declare const wrapCompactor: Compactor;
203
+ /**
204
+ * Wrap compactor that allows overlapping items.
205
+ */
206
+ declare const wrapOverlapCompactor: Compactor;
207
+
208
+ export { GridBackground, type GridBackgroundProps, fastHorizontalCompactor, fastHorizontalOverlapCompactor, fastVerticalCompactor, fastVerticalOverlapCompactor, wrapCompactor, wrapOverlapCompactor };
@@ -0,0 +1,208 @@
1
+ import * as React from 'react';
2
+ import { G as GridCellConfig } from './calculate-K0IBpu53.js';
3
+ import { b as Compactor } from './types-Dbg8jAWj.js';
4
+
5
+ /**
6
+ * GridBackground component
7
+ *
8
+ * Renders an SVG grid background that aligns with GridLayout cells.
9
+ * Use this to visualize the grid structure behind your layout.
10
+ */
11
+
12
+ interface GridBackgroundProps extends GridCellConfig {
13
+ /**
14
+ * Number of rows to display. If "auto", calculates based on height.
15
+ * @default 10
16
+ */
17
+ rows?: number | "auto";
18
+ /**
19
+ * Height of the background in pixels. Used when rows="auto".
20
+ */
21
+ height?: number;
22
+ /**
23
+ * Color of the grid cell backgrounds.
24
+ * @default "#e0e0e0"
25
+ */
26
+ color?: string;
27
+ /**
28
+ * Border radius of grid cells in pixels.
29
+ * @default 4
30
+ */
31
+ borderRadius?: number;
32
+ /**
33
+ * Additional CSS class name.
34
+ */
35
+ className?: string;
36
+ /**
37
+ * Additional inline styles.
38
+ */
39
+ style?: React.CSSProperties;
40
+ }
41
+ /**
42
+ * SVG grid background component.
43
+ *
44
+ * Renders a visual grid that aligns with GridLayout cells. Position this
45
+ * behind your GridLayout using CSS positioning.
46
+ *
47
+ * @example
48
+ * ```tsx
49
+ * import { GridBackground } from 'react-grid-layout/extras';
50
+ *
51
+ * function MyGrid() {
52
+ * const { width, containerRef, mounted } = useContainerWidth();
53
+ *
54
+ * return (
55
+ * <div ref={containerRef} style={{ position: 'relative' }}>
56
+ * {mounted && (
57
+ * <>
58
+ * <GridBackground
59
+ * width={width}
60
+ * cols={12}
61
+ * rowHeight={30}
62
+ * margin={[10, 10]}
63
+ * rows={10}
64
+ * color="#f0f0f0"
65
+ * />
66
+ * <GridLayout width={width} gridConfig={{ cols: 12, rowHeight: 30 }}>
67
+ * {children}
68
+ * </GridLayout>
69
+ * </>
70
+ * )}
71
+ * </div>
72
+ * );
73
+ * }
74
+ * ```
75
+ */
76
+ declare function GridBackground({ width, cols, rowHeight, margin, containerPadding, rows, height, color, borderRadius, className, style }: GridBackgroundProps): React.ReactElement;
77
+
78
+ /**
79
+ * Fast Vertical Compactor
80
+ *
81
+ * An optimized vertical compaction algorithm using a "rising tide" approach.
82
+ * This algorithm has O(n log n) complexity (dominated by sorting) compared to
83
+ * the default vertical compactor which can have O(n²) complexity due to
84
+ * recursive collision resolution.
85
+ *
86
+ * Best suited for large layouts (200+ items) where compaction performance
87
+ * is critical. For smaller layouts, the difference is negligible.
88
+ *
89
+ * Based on the algorithm from PR #2152 by Morris Brodersen (@morris).
90
+ *
91
+ * @example
92
+ * ```tsx
93
+ * import { fastVerticalCompactor } from 'react-grid-layout/extras';
94
+ *
95
+ * <GridLayout
96
+ * compactor={fastVerticalCompactor}
97
+ * layout={layout}
98
+ * // ...
99
+ * />
100
+ * ```
101
+ */
102
+
103
+ /**
104
+ * Fast vertical compactor - optimized for large layouts.
105
+ *
106
+ * Uses a "rising tide" algorithm that achieves O(n log n) complexity
107
+ * instead of the potentially O(n²) recursive collision resolution.
108
+ *
109
+ * Best suited for layouts with 200+ items where compaction performance
110
+ * becomes noticeable. For smaller layouts, the standard verticalCompactor
111
+ * works equally well.
112
+ */
113
+ declare const fastVerticalCompactor: Compactor;
114
+ /**
115
+ * Fast vertical compactor that allows overlapping items.
116
+ *
117
+ * Compacts items upward but allows them to overlap each other.
118
+ */
119
+ declare const fastVerticalOverlapCompactor: Compactor;
120
+
121
+ /**
122
+ * Fast Horizontal Compactor
123
+ *
124
+ * An optimized horizontal compaction algorithm using a "sweeping tide" approach.
125
+ * This algorithm has O(n log n) complexity (dominated by sorting) compared to
126
+ * the default horizontal compactor which can have O(n²) complexity due to
127
+ * recursive collision resolution.
128
+ *
129
+ * Best suited for large layouts (200+ items) where compaction performance
130
+ * is critical. For smaller layouts, the difference is negligible.
131
+ *
132
+ * Adapted from the vertical fast compactor algorithm from PR #2152 by Morris Brodersen (@morris).
133
+ *
134
+ * @example
135
+ * ```tsx
136
+ * import { fastHorizontalCompactor } from 'react-grid-layout/extras';
137
+ *
138
+ * <GridLayout
139
+ * compactor={fastHorizontalCompactor}
140
+ * layout={layout}
141
+ * // ...
142
+ * />
143
+ * ```
144
+ */
145
+
146
+ /**
147
+ * Fast horizontal compactor - optimized for large layouts.
148
+ *
149
+ * Uses a "sweeping tide" algorithm that achieves O(n log n) complexity
150
+ * instead of the potentially O(n²) recursive collision resolution.
151
+ *
152
+ * Best suited for layouts with 200+ items where compaction performance
153
+ * becomes noticeable. For smaller layouts, the standard horizontalCompactor
154
+ * works equally well.
155
+ */
156
+ declare const fastHorizontalCompactor: Compactor;
157
+ /**
158
+ * Fast horizontal compactor that allows overlapping items.
159
+ *
160
+ * Compacts items leftward but allows them to overlap each other.
161
+ */
162
+ declare const fastHorizontalOverlapCompactor: Compactor;
163
+
164
+ /**
165
+ * Wrap Compactor
166
+ *
167
+ * A compaction algorithm that treats grid items like words in a paragraph.
168
+ * Items flow left-to-right, wrapping to the next row when they reach
169
+ * the grid edge.
170
+ *
171
+ * When dragging:
172
+ * - Moving an item earlier in the sequence shifts other items down/right
173
+ * - Moving an item later in the sequence shifts other items up/left
174
+ *
175
+ * This creates a natural reordering behavior similar to drag-and-drop
176
+ * in file managers or card layouts.
177
+ *
178
+ * Based on the algorithm from PR #1773 by John Thomson (@JohnThomson).
179
+ *
180
+ * @example
181
+ * ```tsx
182
+ * import { wrapCompactor } from 'react-grid-layout/extras';
183
+ *
184
+ * <GridLayout
185
+ * compactor={wrapCompactor}
186
+ * layout={layout}
187
+ * // ...
188
+ * />
189
+ * ```
190
+ */
191
+
192
+ /**
193
+ * Wrap compactor - arranges items like words in a paragraph.
194
+ *
195
+ * Items flow left-to-right and wrap to the next row when they
196
+ * reach the grid edge. Dragging an item reorders the sequence,
197
+ * with other items shifting to maintain the flow.
198
+ *
199
+ * Works best with uniformly-sized items (especially 1x1), but
200
+ * handles larger items by ensuring they fit within row bounds.
201
+ */
202
+ declare const wrapCompactor: Compactor;
203
+ /**
204
+ * Wrap compactor that allows overlapping items.
205
+ */
206
+ declare const wrapOverlapCompactor: Compactor;
207
+
208
+ export { GridBackground, type GridBackgroundProps, fastHorizontalCompactor, fastHorizontalOverlapCompactor, fastVerticalCompactor, fastVerticalOverlapCompactor, wrapCompactor, wrapOverlapCompactor };