@snapgridjs/react 0.1.0 → 0.2.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 +45 -9
- package/dist/index.cjs +560 -377
- package/dist/index.d.cts +156 -95
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +156 -95
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +559 -379
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,8 +1,80 @@
|
|
|
1
|
-
import { useDraggable, useDroppable } from "@dnd-kit/react";
|
|
2
|
-
import { BreakpointCols, BreakpointCols as BreakpointCols$1, Breakpoints, Breakpoints as Breakpoints$1, CompactType, Compactor, Compactor as Compactor$1, GridConfig, GridConfig as GridConfig$1, Layout, Layout as Layout$1, LayoutItem, LayoutItem as LayoutItem$1, PositionParams, ResizeHandleAxis, ResizeHandleAxis as ResizeHandleAxis$1, ResponsiveLayouts, ResponsiveLayouts as ResponsiveLayouts$1, getCompactor, horizontalCompactor, noCompactor, verticalCompactor } from "@snapgridjs/core";
|
|
1
|
+
import { DragOverlay, useDraggable, useDroppable } from "@dnd-kit/react";
|
|
2
|
+
import { BreakpointCols, BreakpointCols as BreakpointCols$1, Breakpoints, Breakpoints as Breakpoints$1, CompactType, Compactor, Compactor as Compactor$1, DragSession, GridConfig, GridConfig as GridConfig$1, Layout, Layout as Layout$1, LayoutItem, LayoutItem as LayoutItem$1, PositionParams, PositionParams as PositionParams$1, ResizeHandleAxis, ResizeHandleAxis as ResizeHandleAxis$1, ResponsiveLayouts, ResponsiveLayouts as ResponsiveLayouts$1, getCompactor, horizontalCompactor, noCompactor, verticalCompactor } from "@snapgridjs/core";
|
|
3
3
|
import { CSSProperties, ReactNode } from "react";
|
|
4
|
-
import {
|
|
4
|
+
import { Modifiers, Sensors } from "@dnd-kit/abstract";
|
|
5
|
+
import { DragDropManager, Feedback, Feedback as Feedback$1, KeyboardSensor, PointerSensor } from "@dnd-kit/dom";
|
|
5
6
|
|
|
7
|
+
//#region src/controller/GridController.d.ts
|
|
8
|
+
/**
|
|
9
|
+
* Per-grid configuration the container host writes to the controller each render
|
|
10
|
+
* (during render, so items that resolve this controller by `group` read fresh
|
|
11
|
+
* config on the same pass). Replaces the fields the old GridContext exposed.
|
|
12
|
+
*/
|
|
13
|
+
interface GridControllerConfig {
|
|
14
|
+
positionParams: PositionParams$1;
|
|
15
|
+
gridConfig: GridConfig$1;
|
|
16
|
+
width: number;
|
|
17
|
+
autoSize: boolean;
|
|
18
|
+
itemSensors: Sensors;
|
|
19
|
+
itemModifiers: Modifiers;
|
|
20
|
+
isItemDraggable: (id: string) => boolean;
|
|
21
|
+
isItemResizable: (id: string) => boolean;
|
|
22
|
+
resizeHandlesFor: (id: string) => readonly ResizeHandleAxis$1[];
|
|
23
|
+
/** Report the container element (used to map a pointer to a cell on receive). */
|
|
24
|
+
setContainerElement: (element: Element | null) => void;
|
|
25
|
+
}
|
|
26
|
+
interface ItemSnapshot {
|
|
27
|
+
item: LayoutItem$1 | undefined;
|
|
28
|
+
isDragging: boolean;
|
|
29
|
+
hidden: boolean;
|
|
30
|
+
}
|
|
31
|
+
interface ResizeSnapshot {
|
|
32
|
+
isResizing: boolean;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Live per-grid drag/resize state as a plain observable: the provider writes
|
|
36
|
+
* (`setSession`/`setKeyboard`/`setCommitted`), hooks subscribe to just their own
|
|
37
|
+
* slice via `useSyncExternalStore`. Value-cached snapshots mean a drag re-renders
|
|
38
|
+
* only the tiles whose slice changed, not the whole subtree (the old
|
|
39
|
+
* context-value model re-rendered every tile every frame).
|
|
40
|
+
*/
|
|
41
|
+
declare class GridController {
|
|
42
|
+
#private;
|
|
43
|
+
id: string;
|
|
44
|
+
config: GridControllerConfig | null;
|
|
45
|
+
/** The dnd-kit manager this grid is registered with (set by useInstance). */
|
|
46
|
+
manager: DragDropManager | undefined;
|
|
47
|
+
constructor(id: string, committed?: Layout$1, manager?: DragDropManager);
|
|
48
|
+
/** Replace the per-grid config (called by the container host during render). */
|
|
49
|
+
setConfig(config: GridControllerConfig): void;
|
|
50
|
+
/**
|
|
51
|
+
* Re-point this grid's id. The container host syncs it (during render, before
|
|
52
|
+
* the droppable/group read it) when the controlled `id` prop changes, so the
|
|
53
|
+
* returned `group`, the droppable id, and the registry key never drift apart.
|
|
54
|
+
*/
|
|
55
|
+
setId(id: string): void;
|
|
56
|
+
register: () => void;
|
|
57
|
+
subscribe: (listener: () => void) => (() => void);
|
|
58
|
+
/**
|
|
59
|
+
* Sync the committed layout from the controlled `layout` prop. Called during
|
|
60
|
+
* the provider's render, so it must NOT notify — emitting here would update
|
|
61
|
+
* subscribed GridItems mid-render (a React "setState while rendering" error).
|
|
62
|
+
* No notify is needed: a `layout` prop change already re-renders the whole
|
|
63
|
+
* provider subtree, so every GridItem re-reads its snapshot on that pass.
|
|
64
|
+
*/
|
|
65
|
+
setCommitted(layout: Layout$1): void;
|
|
66
|
+
setSession(next: DragSession | null): void;
|
|
67
|
+
getSession(): DragSession | null;
|
|
68
|
+
/** Record whether the active drag is keyboard-driven (drives `hidden`). */
|
|
69
|
+
setKeyboard(value: boolean): void;
|
|
70
|
+
itemSnapshot: (id: string) => ItemSnapshot;
|
|
71
|
+
placeholderSnapshot: () => LayoutItem$1 | null;
|
|
72
|
+
resizeSnapshot: (itemId: string) => ResizeSnapshot;
|
|
73
|
+
renderedSnapshot: () => Layout$1;
|
|
74
|
+
/** A stable index for `id` (see {@link GridController.#indexById}). */
|
|
75
|
+
itemIndex(id: string): number;
|
|
76
|
+
}
|
|
77
|
+
//#endregion
|
|
6
78
|
//#region src/types.d.ts
|
|
7
79
|
/**
|
|
8
80
|
* Drag behaviour configuration (mirrors react-grid-layout v2's `dragConfig`).
|
|
@@ -76,60 +148,32 @@ interface GridDropData {
|
|
|
76
148
|
*/
|
|
77
149
|
type GridEventCallback = (layout: Layout$1, oldItem: LayoutItem$1 | null, newItem: LayoutItem$1 | null, placeholder: LayoutItem$1 | null, event: Event | null, node: HTMLElement | null) => void;
|
|
78
150
|
//#endregion
|
|
79
|
-
//#region src/
|
|
80
|
-
|
|
81
|
-
|
|
151
|
+
//#region src/hooks/useGridController.d.ts
|
|
152
|
+
/** Options the grid host ({@link useGridContainer}) feeds the controller. */
|
|
153
|
+
interface UseGridControllerOptions {
|
|
154
|
+
/** Stable id for the grid's droppable surface (auto-generated if omitted). */
|
|
155
|
+
id?: string;
|
|
82
156
|
/** Container width in pixels (e.g. from {@link useContainerWidth}). */
|
|
83
157
|
width: number;
|
|
84
158
|
/** Controlled layout. Never mutated. */
|
|
85
159
|
layout: Layout$1;
|
|
86
|
-
/** Called with the next layout after a drag/resize commits (incl. cross-grid add/remove). */
|
|
87
160
|
onLayoutChange?: (layout: Layout$1) => void;
|
|
88
161
|
gridConfig?: Partial<GridConfig$1>;
|
|
89
162
|
dragConfig?: DragConfig;
|
|
90
163
|
resizeConfig?: ResizeConfig;
|
|
91
|
-
/** Accept external (non-grid) dnd-kit draggables dropped into this grid. */
|
|
92
164
|
dropConfig?: DropConfig;
|
|
93
165
|
compactor?: Compactor$1;
|
|
94
|
-
/** Grid-level draggable toggle (item-level `isDraggable`/`static` override). @default true */
|
|
95
166
|
isDraggable?: boolean;
|
|
96
|
-
/** Grid-level resizable toggle (item-level `isResizable`/`static` override). @default true */
|
|
97
167
|
isResizable?: boolean;
|
|
98
|
-
/** Grow container height to fit content. @default true */
|
|
99
168
|
autoSize?: boolean;
|
|
100
|
-
/** Stable id for the grid's droppable surface (auto-generated if omitted). */
|
|
101
|
-
id?: string;
|
|
102
169
|
onDragStart?: GridEventCallback;
|
|
103
170
|
onDrag?: GridEventCallback;
|
|
104
171
|
onDragStop?: GridEventCallback;
|
|
105
172
|
onResizeStart?: GridEventCallback;
|
|
106
173
|
onResize?: GridEventCallback;
|
|
107
174
|
onResizeStop?: GridEventCallback;
|
|
108
|
-
/** Called when an external draggable is dropped into the grid: the next layout, the new item, and the event. */
|
|
109
175
|
onDrop?: (layout: Layout$1, item: LayoutItem$1, event: Event | null) => void;
|
|
110
176
|
}
|
|
111
|
-
/**
|
|
112
|
-
* Headless provider for a grid. Standalone grids get their own isolated dnd-kit
|
|
113
|
-
* provider; grids inside a {@link SnapGridGroup} share that group's provider and
|
|
114
|
-
* registry so tiles can be dragged between them. Owns this grid's drag/resize
|
|
115
|
-
* session; the consumer owns all markup/styling.
|
|
116
|
-
*/
|
|
117
|
-
declare function SnapGridProvider(props: SnapGridProviderProps): React.JSX.Element;
|
|
118
|
-
//#endregion
|
|
119
|
-
//#region src/SnapGridGroup.d.ts
|
|
120
|
-
interface SnapGridGroupProps {
|
|
121
|
-
children: ReactNode;
|
|
122
|
-
}
|
|
123
|
-
/**
|
|
124
|
-
* Wrap multiple grids to let tiles be dragged **between** them. Provides one
|
|
125
|
-
* shared dnd-kit `DragDropProvider` and a registry so each grid can tell which
|
|
126
|
-
* grid the pointer is over.
|
|
127
|
-
*
|
|
128
|
-
* Item ids must be unique across all grids in a group (they share one manager).
|
|
129
|
-
*/
|
|
130
|
-
declare function SnapGridGroup({
|
|
131
|
-
children
|
|
132
|
-
}: SnapGridGroupProps): React.JSX.Element;
|
|
133
177
|
//#endregion
|
|
134
178
|
//#region src/hooks/useGridContainer.d.ts
|
|
135
179
|
interface GridContainerProps {
|
|
@@ -145,19 +189,30 @@ interface UseGridContainerResult {
|
|
|
145
189
|
containerProps: GridContainerProps;
|
|
146
190
|
/** True while a compatible draggable is over the grid. */
|
|
147
191
|
isDropTarget: boolean;
|
|
192
|
+
/** This grid's id — pass as the `group` to {@link useGridItem} for its tiles. */
|
|
193
|
+
group: string;
|
|
194
|
+
/** The grid's controller (for advanced/headless composition). */
|
|
195
|
+
controller: GridController;
|
|
148
196
|
}
|
|
149
197
|
/**
|
|
150
|
-
*
|
|
151
|
-
*
|
|
152
|
-
* onto your own container element.
|
|
198
|
+
* The grid host: creates this grid's controller + drag monitor (see
|
|
199
|
+
* {@link useGridController}), registers the droppable surface, and returns props
|
|
200
|
+
* to spread onto your own container element. Render `useGridItem` tiles inside,
|
|
201
|
+
* passing `group` (this grid's id) so they resolve this controller.
|
|
153
202
|
*/
|
|
154
|
-
declare function useGridContainer(): UseGridContainerResult;
|
|
203
|
+
declare function useGridContainer(opts: UseGridControllerOptions): UseGridContainerResult;
|
|
155
204
|
//#endregion
|
|
156
205
|
//#region src/hooks/useGridItem.d.ts
|
|
157
206
|
interface UseGridItemResult {
|
|
158
207
|
/** Attach to the element that represents this grid item. */
|
|
159
208
|
ref: (element: Element | null) => void;
|
|
160
|
-
/**
|
|
209
|
+
/**
|
|
210
|
+
* Optional drag handle (dnd-kit's native handle). Attach to a child element to
|
|
211
|
+
* restrict **pointer** drag activation to it; leave it unattached and the whole
|
|
212
|
+
* tile drags. Keyboard pickup (Enter/Space on a focused tile) is unaffected.
|
|
213
|
+
*/
|
|
214
|
+
handleRef: (element: Element | null) => void;
|
|
215
|
+
/** Positioning style to spread onto your element. */
|
|
161
216
|
style: CSSProperties;
|
|
162
217
|
/** True while this item is the active drag source. */
|
|
163
218
|
isDragging: boolean;
|
|
@@ -165,11 +220,21 @@ interface UseGridItemResult {
|
|
|
165
220
|
item: LayoutItem$1 | undefined;
|
|
166
221
|
}
|
|
167
222
|
/**
|
|
168
|
-
* Headless hook for a single grid
|
|
169
|
-
*
|
|
170
|
-
*
|
|
223
|
+
* Headless hook for a single grid tile. The tile is a real `useSortable` (a
|
|
224
|
+
* draggable + droppable carrying `group`/`index`/`type`/`accept`), so it
|
|
225
|
+
* interoperates with the dnd-kit sortable ecosystem, yet it is positioned by RGL
|
|
226
|
+
* via the {@link GridController}. `group` is the owning grid's id (from its
|
|
227
|
+
* {@link useGridContainer}), mirroring `useSortable`'s `group`. Spread the returned
|
|
228
|
+
* `ref`, optional `handleRef`, positioning `style`, and drag state onto whatever
|
|
229
|
+
* element you render — you own the tag, className, content, and cosmetic styling.
|
|
230
|
+
*
|
|
231
|
+
* The dragged tile floats itself via dnd-kit's default feedback (no `<DragOverlay>`):
|
|
232
|
+
* the active tile renders at its committed origin so the float offset composes, and
|
|
233
|
+
* reflow is animated on the compositor via the Web Animations API — both so it stays
|
|
234
|
+
* smooth in Safari, where the float's popover top-layer repaint would jank a
|
|
235
|
+
* CSS-transition reflow.
|
|
171
236
|
*/
|
|
172
|
-
declare function useGridItem(id: string): UseGridItemResult;
|
|
237
|
+
declare function useGridItem(id: string, group: string): UseGridItemResult;
|
|
173
238
|
//#endregion
|
|
174
239
|
//#region src/hooks/useGridPlaceholder.d.ts
|
|
175
240
|
interface GridPlaceholderInfo {
|
|
@@ -180,9 +245,10 @@ interface GridPlaceholderInfo {
|
|
|
180
245
|
}
|
|
181
246
|
/**
|
|
182
247
|
* Headless hook returning where the drag placeholder should be rendered, or
|
|
183
|
-
* `null` when no drag is in progress.
|
|
248
|
+
* `null` when no drag is in progress. `group` is the owning grid's id (from its
|
|
249
|
+
* {@link useGridContainer}). You render the element however you like.
|
|
184
250
|
*/
|
|
185
|
-
declare function useGridPlaceholder(): GridPlaceholderInfo | null;
|
|
251
|
+
declare function useGridPlaceholder(group: string): GridPlaceholderInfo | null;
|
|
186
252
|
//#endregion
|
|
187
253
|
//#region src/hooks/dndShared.d.ts
|
|
188
254
|
/** Marker attribute placed on resize-handle elements. */
|
|
@@ -201,25 +267,11 @@ interface UseGridResizeHandleResult {
|
|
|
201
267
|
}
|
|
202
268
|
/**
|
|
203
269
|
* Headless hook for a single resize handle. Model a handle as its own draggable;
|
|
204
|
-
* dragging it resizes the item from the given edge/corner.
|
|
205
|
-
*
|
|
270
|
+
* dragging it resizes the item from the given edge/corner. `group` is the owning
|
|
271
|
+
* grid's id (from its {@link useGridContainer}). Spread `ref` and `handleProps`
|
|
272
|
+
* onto the handle element you position/style.
|
|
206
273
|
*/
|
|
207
|
-
declare function useGridResizeHandle(itemId: string, handle: ResizeHandleAxis$1): UseGridResizeHandleResult;
|
|
208
|
-
//#endregion
|
|
209
|
-
//#region src/hooks/useGridDragOverlay.d.ts
|
|
210
|
-
interface GridDragOverlay$1 {
|
|
211
|
-
/** The item being dragged from this grid. */
|
|
212
|
-
item: LayoutItem$1;
|
|
213
|
-
/** Fixed-position style for the floating preview; render it in a body portal. */
|
|
214
|
-
style: CSSProperties;
|
|
215
|
-
}
|
|
216
|
-
/**
|
|
217
|
-
* Headless hook for the floating drag preview. Returns `null` unless this grid
|
|
218
|
-
* is the source of an in-progress drag. Render the returned `item` with `style`
|
|
219
|
-
* in a portal at `document.body` so it can float across grids unclipped (see
|
|
220
|
-
* {@link GridDragOverlay} for the convenience component).
|
|
221
|
-
*/
|
|
222
|
-
declare function useGridDragOverlay(): GridDragOverlay$1 | null;
|
|
274
|
+
declare function useGridResizeHandle(itemId: string, handle: ResizeHandleAxis$1, group: string): UseGridResizeHandleResult;
|
|
223
275
|
//#endregion
|
|
224
276
|
//#region src/hooks/useResponsiveLayout.d.ts
|
|
225
277
|
/** react-grid-layout's default breakpoints (px) and column counts. */
|
|
@@ -258,8 +310,9 @@ interface UseResponsiveLayoutResult {
|
|
|
258
310
|
*/
|
|
259
311
|
declare function useResponsiveLayout(options: UseResponsiveLayoutOptions): UseResponsiveLayoutResult;
|
|
260
312
|
//#endregion
|
|
261
|
-
//#region src/GridLayout.d.ts
|
|
262
|
-
interface GridLayoutProps extends
|
|
313
|
+
//#region src/components/GridLayout.d.ts
|
|
314
|
+
interface GridLayoutProps extends UseGridControllerOptions {
|
|
315
|
+
children: ReactNode;
|
|
263
316
|
/** Appended to the default `snapgrid` class on the surface. */
|
|
264
317
|
className?: string;
|
|
265
318
|
/** Merged over (and able to override) the surface's positioning style. */
|
|
@@ -267,13 +320,28 @@ interface GridLayoutProps extends SnapGridProviderProps {
|
|
|
267
320
|
}
|
|
268
321
|
/**
|
|
269
322
|
* Drop-in grid component: a controlled, react-grid-layout v2-compatible layout
|
|
270
|
-
* backed by dnd-kit. A thin shell over {@link
|
|
323
|
+
* backed by dnd-kit. A thin shell over {@link useGridContainer} and the headless
|
|
271
324
|
* hooks — children are keyed by their layout item's `i`. For full control over
|
|
272
|
-
* markup/styling, use the
|
|
325
|
+
* markup/styling, use the hooks directly.
|
|
326
|
+
*
|
|
327
|
+
* Supplies the dnd-kit `DragDropProvider` for the turnkey case so consumers
|
|
328
|
+
* don't manage one. Nest multiple `GridLayout`s and they share one provider
|
|
329
|
+
* (the seam for cross-grid drags); a consumer's own provider is also honored.
|
|
273
330
|
*/
|
|
274
331
|
declare function GridLayout(props: GridLayoutProps): React.JSX.Element;
|
|
332
|
+
/**
|
|
333
|
+
* Share one dnd-kit `DragDropProvider` across several sibling grids so tiles can
|
|
334
|
+
* be dragged between them. (Nested `GridLayout`s already share a provider; this
|
|
335
|
+
* is for siblings.) A thin wrapper over `DragDropProvider` — the cross-grid seam
|
|
336
|
+
* is the shared manager + collision target.
|
|
337
|
+
*/
|
|
338
|
+
declare function SnapGridGroup({
|
|
339
|
+
children
|
|
340
|
+
}: {
|
|
341
|
+
children: ReactNode;
|
|
342
|
+
}): React.JSX.Element;
|
|
275
343
|
//#endregion
|
|
276
|
-
//#region src/ResponsiveGridLayout.d.ts
|
|
344
|
+
//#region src/components/ResponsiveGridLayout.d.ts
|
|
277
345
|
interface ResponsiveGridLayoutProps {
|
|
278
346
|
/** Container width in pixels (e.g. from {@link useContainerWidth}). */
|
|
279
347
|
width: number;
|
|
@@ -308,10 +376,12 @@ interface ResponsiveGridLayoutProps {
|
|
|
308
376
|
*/
|
|
309
377
|
declare function ResponsiveGridLayout(props: ResponsiveGridLayoutProps): React.JSX.Element;
|
|
310
378
|
//#endregion
|
|
311
|
-
//#region src/GridItem.d.ts
|
|
379
|
+
//#region src/components/GridItem.d.ts
|
|
312
380
|
interface GridItemProps {
|
|
313
381
|
/** Matches the layout item's `i`. */
|
|
314
382
|
id: string;
|
|
383
|
+
/** The owning grid's id (from its useGridContainer). */
|
|
384
|
+
group: string;
|
|
315
385
|
children: ReactNode;
|
|
316
386
|
/** Appended to the default `snapgrid-item` class. */
|
|
317
387
|
className?: string;
|
|
@@ -321,17 +391,27 @@ interface GridItemProps {
|
|
|
321
391
|
/**
|
|
322
392
|
* Convenience wrapper over {@link useGridItem}: an absolutely-positioned `<div>`
|
|
323
393
|
* with stable hooks (`.snapgrid-item`, `data-grid-id`, `data-dragging`) and the
|
|
324
|
-
* configured resize handles. For full control,
|
|
394
|
+
* configured resize handles. `group` is the owning grid's id. For full control,
|
|
395
|
+
* use the hooks directly.
|
|
396
|
+
*
|
|
397
|
+
* Memoized so re-rendering the surface (e.g. its auto-height tracking the drag)
|
|
398
|
+
* doesn't re-render every tile — a tile re-renders only when its own slice
|
|
399
|
+
* changes (via useGridItem's subscription). Keeps a drag's React work scoped to
|
|
400
|
+
* the moved tile (see renderScope.test).
|
|
325
401
|
*/
|
|
326
|
-
declare function
|
|
402
|
+
declare function GridItemImpl({
|
|
327
403
|
id,
|
|
404
|
+
group,
|
|
328
405
|
children,
|
|
329
406
|
className,
|
|
330
407
|
style
|
|
331
408
|
}: GridItemProps): import("react/jsx-runtime").JSX.Element;
|
|
409
|
+
declare const GridItem: import("react").MemoExoticComponent<typeof GridItemImpl>;
|
|
332
410
|
//#endregion
|
|
333
|
-
//#region src/GridPlaceholder.d.ts
|
|
411
|
+
//#region src/components/GridPlaceholder.d.ts
|
|
334
412
|
interface GridPlaceholderProps {
|
|
413
|
+
/** The owning grid's id (from its useGridContainer). */
|
|
414
|
+
group: string;
|
|
335
415
|
/** Appended to the default `snapgrid-placeholder` class. */
|
|
336
416
|
className?: string;
|
|
337
417
|
/** Merged over (and able to override) the default look. */
|
|
@@ -343,30 +423,11 @@ interface GridPlaceholderProps {
|
|
|
343
423
|
* directly and render your own element with the returned `style`.
|
|
344
424
|
*/
|
|
345
425
|
declare function GridPlaceholder({
|
|
426
|
+
group,
|
|
346
427
|
className,
|
|
347
428
|
style
|
|
348
429
|
}: GridPlaceholderProps): import("react/jsx-runtime").JSX.Element | null;
|
|
349
430
|
//#endregion
|
|
350
|
-
//#region src/GridDragOverlay.d.ts
|
|
351
|
-
interface GridDragOverlayProps {
|
|
352
|
-
/** Render the floating preview for the dragged item. */
|
|
353
|
-
children: (item: LayoutItem$1) => ReactNode;
|
|
354
|
-
/** Appended to the default `snapgrid-overlay` class on the portal element. */
|
|
355
|
-
className?: string;
|
|
356
|
-
/** Merged over the positioning style. */
|
|
357
|
-
style?: CSSProperties;
|
|
358
|
-
}
|
|
359
|
-
/**
|
|
360
|
-
* Renders the floating drag preview in a portal at `document.body` — so it
|
|
361
|
-
* follows the pointer across grids without being clipped by any container.
|
|
362
|
-
* Renders nothing when this grid isn't the drag source.
|
|
363
|
-
*/
|
|
364
|
-
declare function GridDragOverlay({
|
|
365
|
-
children,
|
|
366
|
-
className,
|
|
367
|
-
style
|
|
368
|
-
}: GridDragOverlayProps): import("react").ReactPortal | null;
|
|
369
|
-
//#endregion
|
|
370
431
|
//#region src/hooks/useContainerWidth.d.ts
|
|
371
432
|
interface UseContainerWidthOptions {
|
|
372
433
|
/** Width to use until the element has been measured. @default 1280 */
|
|
@@ -386,5 +447,5 @@ interface UseContainerWidthResult {
|
|
|
386
447
|
*/
|
|
387
448
|
declare function useContainerWidth(options?: UseContainerWidthOptions): UseContainerWidthResult;
|
|
388
449
|
//#endregion
|
|
389
|
-
export { type BreakpointCols, type Breakpoints, type CompactType, type Compactor, DEFAULT_BREAKPOINTS, DEFAULT_BREAKPOINT_COLS, type DragConfig, type DragSourceInfo, type DropConfig, Feedback, type GridConfig, type GridContainerProps,
|
|
450
|
+
export { type BreakpointCols, type Breakpoints, type CompactType, type Compactor, DEFAULT_BREAKPOINTS, DEFAULT_BREAKPOINT_COLS, type DragConfig, DragOverlay, type DragSourceInfo, type DropConfig, Feedback, type GridConfig, type GridContainerProps, type GridDropData, type GridEventCallback, GridItem, type GridItemProps, GridLayout, type GridLayoutProps, GridPlaceholder, type GridPlaceholderInfo, type GridPlaceholderProps, KeyboardSensor, type Layout, type LayoutItem, PointerSensor, type PositionParams, type ResizeConfig, type ResizeHandleAxis, ResponsiveGridLayout, type ResponsiveGridLayoutProps, type ResponsiveLayouts, SnapGridGroup, type UseContainerWidthOptions, type UseContainerWidthResult, type UseGridContainerResult, type UseGridControllerOptions, type UseGridItemResult, type UseGridResizeHandleResult, type UseResponsiveLayoutOptions, type UseResponsiveLayoutResult, getCompactor, horizontalCompactor, noCompactor, useContainerWidth, useDraggable, useDroppable, useGridContainer, useGridItem, useGridPlaceholder, useGridResizeHandle, useResponsiveLayout, verticalCompactor };
|
|
390
451
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/controller/GridController.ts","../src/types.ts","../src/hooks/useGridController.ts","../src/hooks/useGridContainer.ts","../src/hooks/useGridItem.ts","../src/hooks/useGridPlaceholder.ts","../src/hooks/dndShared.ts","../src/hooks/useGridResizeHandle.ts","../src/hooks/useResponsiveLayout.ts","../src/components/GridLayout.tsx","../src/components/ResponsiveGridLayout.tsx","../src/components/GridItem.tsx","../src/components/GridPlaceholder.tsx","../src/hooks/useContainerWidth.ts"],"mappings":";;;;;;;;;;;AAgBA;UAAiB,oBAAA;EACf,cAAA,EAAgB,gBAAA;EAChB,UAAA,EAAY,YAAA;EACZ,KAAA;EACA,QAAA;EACA,WAAA,EAAa,OAAA;EACb,aAAA,EAAe,SAAA;EACf,eAAA,GAAkB,EAAA;EAClB,eAAA,GAAkB,EAAA;EAClB,gBAAA,GAAmB,EAAA,sBAAwB,kBAAA;EAR3C;EAUA,mBAAA,GAAsB,OAAA,EAAS,OAAA;AAAA;AAAA,UAGhB,YAAA;EACf,IAAA,EAAM,YAAU;EAChB,UAAA;EAKA,MAAA;AAAA;AAAA,UAGe,cAAA;EACf,UAAU;AAAA;;;;;;;;cAoBC,cAAA;EAAA;EACX,EAAA;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