tailwind-grid-layout 0.0.1-beta.20250620111548

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 (36) hide show
  1. package/LICENSE +21 -0
  2. package/README.ko.md +411 -0
  3. package/README.md +411 -0
  4. package/dist/components/DroppableGridContainer.d.ts +7 -0
  5. package/dist/components/DroppableGridContainer.d.ts.map +1 -0
  6. package/dist/components/GridContainer.d.ts +4 -0
  7. package/dist/components/GridContainer.d.ts.map +1 -0
  8. package/dist/components/GridItem.d.ts +23 -0
  9. package/dist/components/GridItem.d.ts.map +1 -0
  10. package/dist/components/ResizeHandle.d.ts +10 -0
  11. package/dist/components/ResizeHandle.d.ts.map +1 -0
  12. package/dist/components/ResponsiveGridContainer.d.ts +18 -0
  13. package/dist/components/ResponsiveGridContainer.d.ts.map +1 -0
  14. package/dist/components/WidthProvider.d.ts +8 -0
  15. package/dist/components/WidthProvider.d.ts.map +1 -0
  16. package/dist/components/ui/card.d.ts +9 -0
  17. package/dist/components/ui/card.d.ts.map +1 -0
  18. package/dist/index.cjs +2 -0
  19. package/dist/index.cjs.map +1 -0
  20. package/dist/index.d.ts +14 -0
  21. package/dist/index.d.ts.map +1 -0
  22. package/dist/index.js +3442 -0
  23. package/dist/index.js.map +1 -0
  24. package/dist/lib/utils.d.ts +3 -0
  25. package/dist/lib/utils.d.ts.map +1 -0
  26. package/dist/test/setup.d.ts +1 -0
  27. package/dist/test/setup.d.ts.map +1 -0
  28. package/dist/types/index.d.ts +109 -0
  29. package/dist/types/index.d.ts.map +1 -0
  30. package/dist/utils/cn.d.ts +3 -0
  31. package/dist/utils/cn.d.ts.map +1 -0
  32. package/dist/utils/grid.d.ts +17 -0
  33. package/dist/utils/grid.d.ts.map +1 -0
  34. package/dist/utils/layouts.d.ts +15 -0
  35. package/dist/utils/layouts.d.ts.map +1 -0
  36. package/package.json +127 -0
package/README.md ADDED
@@ -0,0 +1,411 @@
1
+ # Tailwind Grid Layout
2
+
3
+ A modern, lightweight grid layout system for React built with Tailwind CSS. A powerful alternative to react-grid-layout with full feature parity and a smaller bundle size.
4
+
5
+ [![npm version](https://img.shields.io/npm/v/tailwind-grid-layout.svg)](https://www.npmjs.com/package/tailwind-grid-layout)
6
+ [![license](https://img.shields.io/npm/l/tailwind-grid-layout.svg)](https://github.com/Seungwoo321/tailwind-grid-layout/blob/main/LICENSE)
7
+ [![bundle size](https://img.shields.io/bundlephobia/minzip/tailwind-grid-layout)](https://bundlephobia.com/package/tailwind-grid-layout)
8
+
9
+ > English | [한국어](./README.ko.md)
10
+
11
+ ## Features
12
+
13
+ - 🎯 **Full Feature Parity** with react-grid-layout
14
+ - 🪶 **Lightweight** - Smaller bundle size using Tailwind CSS
15
+ - 🎨 **Tailwind Native** - Built with Tailwind CSS utilities
16
+ - 📱 **Responsive** - Works on all screen sizes
17
+ - 🔧 **TypeScript** - Full TypeScript support
18
+ - ⚡ **Performance** - Optimized rendering and animations
19
+ - 🧪 **Well Tested** - 100% test coverage
20
+
21
+ ## Installation
22
+
23
+ ```bash
24
+ npm install tailwind-grid-layout
25
+ # or
26
+ yarn add tailwind-grid-layout
27
+ # or
28
+ pnpm add tailwind-grid-layout
29
+ ```
30
+
31
+ ### Prerequisites
32
+
33
+ - React 19.1.0
34
+ - Tailwind CSS 4.1.8+ (v4 only - CSS-first configuration)
35
+ - Node.js 20.0.0+
36
+ - pnpm 10.11.0+
37
+
38
+ ## Tailwind CSS v4 Setup
39
+
40
+ This library requires Tailwind CSS v4 with its new CSS-first configuration approach. No JavaScript configuration file is needed.
41
+
42
+ ```css
43
+ /* In your main CSS file */
44
+ @import "tailwindcss";
45
+
46
+ /* Optional: Add custom theme configuration */
47
+ @theme {
48
+ --color-grid-placeholder: oklch(0.7 0.15 210);
49
+ --color-grid-handle: oklch(0.3 0.05 210);
50
+ }
51
+ ```
52
+
53
+ ## Quick Start
54
+
55
+ ```tsx
56
+ import { GridContainer } from 'tailwind-grid-layout'
57
+
58
+ const items = [
59
+ { id: '1', x: 0, y: 0, w: 2, h: 2 },
60
+ { id: '2', x: 2, y: 0, w: 2, h: 2 },
61
+ { id: '3', x: 0, y: 2, w: 4, h: 2 }
62
+ ]
63
+
64
+ function App() {
65
+ return (
66
+ <GridContainer
67
+ items={items}
68
+ cols={12}
69
+ rowHeight={60}
70
+ onLayoutChange={(newLayout) => console.log(newLayout)}
71
+ >
72
+ {(item) => (
73
+ <div className="bg-blue-500 text-white p-4 rounded">
74
+ Item {item.id}
75
+ </div>
76
+ )}
77
+ </GridContainer>
78
+ )
79
+ }
80
+ ```
81
+
82
+ ## Props Reference
83
+
84
+ ### GridContainer Props
85
+
86
+ | Prop | Type | Default | Description |
87
+ |------|------|---------|-------------|
88
+ | **items** | `GridItem[]` | required | Array of grid items with position and size |
89
+ | **children** | `(item: GridItem) => ReactNode` | required | Render function for grid items |
90
+ | **cols** | `number` | `12` | Number of columns in the grid |
91
+ | **rowHeight** | `number` | `60` | Height of each row in pixels |
92
+ | **gap** | `number` | `16` | Gap between grid items in pixels |
93
+ | **margin** | `[number, number]` | `[gap, gap]` | Margin between items [horizontal, vertical] |
94
+ | **containerPadding** | `[number, number]` | `[16, 16]` | Padding inside the grid container [horizontal, vertical] |
95
+ | **maxRows** | `number` | - | Maximum number of rows |
96
+ | **isDraggable** | `boolean` | `true` | Enable/disable dragging |
97
+ | **isResizable** | `boolean` | `true` | Enable/disable resizing |
98
+ | **preventCollision** | `boolean` | `false` | Prevent items from colliding |
99
+ | **allowOverlap** | `boolean` | `false` | Allow items to overlap |
100
+ | **isBounded** | `boolean` | `true` | Keep items within container bounds |
101
+ | **compactType** | `'vertical' \| 'horizontal' \| null` | `'vertical'` | Compaction type |
102
+ | **resizeHandles** | `Array<'s' \| 'w' \| 'e' \| 'n' \| 'sw' \| 'nw' \| 'se' \| 'ne'>` | `['se']` | Resize handle positions |
103
+ | **draggableCancel** | `string` | - | CSS selector for elements that should not trigger drag |
104
+ | **draggableHandle** | `string` | - | CSS selector for drag handle |
105
+ | **autoSize** | `boolean` | `true` | Container height adjusts to fit all items |
106
+ | **verticalCompact** | `boolean` | `true` | DEPRECATED: Use compactType |
107
+ | **transformScale** | `number` | `1` | Scale factor for drag/resize when zoomed |
108
+ | **droppingItem** | `Partial<GridItem>` | - | Preview item while dragging from outside |
109
+ | **className** | `string` | - | Additional CSS classes for the container |
110
+ | **style** | `React.CSSProperties` | - | Inline styles for the container |
111
+ | **onLayoutChange** | `(layout: GridItem[]) => void` | - | Callback when layout changes |
112
+ | **onDragStart** | `(layout, oldItem, newItem, placeholder, e, element) => void` | - | Drag start callback |
113
+ | **onDrag** | `(layout, oldItem, newItem, placeholder, e, element) => void` | - | Drag callback |
114
+ | **onDragStop** | `(layout, oldItem, newItem, placeholder, e, element) => void` | - | Drag stop callback |
115
+ | **onResizeStart** | `(layout, oldItem, newItem, placeholder, e, element) => void` | - | Resize start callback |
116
+ | **onResize** | `(layout, oldItem, newItem, placeholder, e, element) => void` | - | Resize callback |
117
+ | **onResizeStop** | `(layout, oldItem, newItem, placeholder, e, element) => void` | - | Resize stop callback |
118
+
119
+ ### GridItem Properties
120
+
121
+ | Property | Type | Required | Description |
122
+ |----------|------|----------|-------------|
123
+ | **id** | `string` | ✓ | Unique identifier for the item |
124
+ | **x** | `number` | ✓ | X position in grid units |
125
+ | **y** | `number` | ✓ | Y position in grid units |
126
+ | **w** | `number` | ✓ | Width in grid units |
127
+ | **h** | `number` | ✓ | Height in grid units |
128
+ | **minW** | `number` | - | Minimum width |
129
+ | **minH** | `number` | - | Minimum height |
130
+ | **maxW** | `number` | - | Maximum width |
131
+ | **maxH** | `number` | - | Maximum height |
132
+ | **isDraggable** | `boolean` | - | Override container's isDraggable |
133
+ | **isResizable** | `boolean` | - | Override container's isResizable |
134
+ | **static** | `boolean` | - | Make item static (unmovable/unresizable) |
135
+ | **className** | `string` | - | Additional CSS classes for the item |
136
+
137
+ ## Comparison with react-grid-layout
138
+
139
+ | Feature | react-grid-layout | tailwind-grid-layout | Notes |
140
+ |---------|-------------------|---------------------|--------|
141
+ | **Core Features** |
142
+ | Drag & Drop | ✅ | ✅ | Full support |
143
+ | Resize | ✅ | ✅ | 8-direction resize |
144
+ | Collision Detection | ✅ | ✅ | 50% overlap rule |
145
+ | Auto-compaction | ✅ | ✅ | Vertical, horizontal, or none |
146
+ | Static Items | ✅ | ✅ | Full support |
147
+ | Bounded Movement | ✅ | ✅ | Keep items in bounds |
148
+ | **Layout Options** |
149
+ | Responsive Breakpoints | ✅ | ✅ | Full support with ResponsiveGridContainer |
150
+ | Persist Layout | ✅ | ✅ | Via onLayoutChange |
151
+ | Min/Max Dimensions | ✅ | ✅ | Full support |
152
+ | Prevent Collision | ✅ | ✅ | Full support |
153
+ | Allow Overlap | ✅ | ✅ | Full support |
154
+ | **Events** |
155
+ | Layout Change | ✅ | ✅ | Full support |
156
+ | Drag Events | ✅ | ✅ | Start, move, stop |
157
+ | Resize Events | ✅ | ✅ | Start, resize, stop |
158
+ | Drop from Outside | ✅ | ✅ | Full support with DroppableGridContainer |
159
+ | **Styling** |
160
+ | CSS-in-JS | ✅ | ❌ | Uses Tailwind |
161
+ | Custom Classes | ✅ | ✅ | Full support |
162
+ | Animations | ✅ | ✅ | Tailwind transitions |
163
+ | **Performance** |
164
+ | Bundle Size | ~30KB | ~15KB | 50% smaller |
165
+ | Dependencies | React only | React + Tailwind | |
166
+ | Tree-shaking | ✅ | ✅ | Full support |
167
+
168
+ ## Advanced Examples
169
+
170
+ ### With Custom Drag Handle
171
+
172
+ ```tsx
173
+ <GridContainer items={items}>
174
+ {(item) => (
175
+ <div className="bg-white rounded-lg shadow p-4">
176
+ <div className="grid-drag-handle cursor-move p-2 bg-gray-100 rounded">
177
+ <GripIcon className="w-4 h-4" />
178
+ </div>
179
+ <div className="p-4">
180
+ Content for {item.id}
181
+ </div>
182
+ </div>
183
+ )}
184
+ </GridContainer>
185
+ ```
186
+
187
+ ### Static Items
188
+
189
+ ```tsx
190
+ const items = [
191
+ { id: '1', x: 0, y: 0, w: 4, h: 2, static: true }, // This item cannot be moved
192
+ { id: '2', x: 4, y: 0, w: 4, h: 2 },
193
+ ]
194
+ ```
195
+
196
+ ### Responsive Breakpoints
197
+
198
+ ```tsx
199
+ import { ResponsiveGridContainer } from 'tailwind-grid-layout'
200
+
201
+ const layouts = {
202
+ lg: [{ id: '1', x: 0, y: 0, w: 3, h: 2 }],
203
+ md: [{ id: '1', x: 0, y: 0, w: 6, h: 2 }],
204
+ sm: [{ id: '1', x: 0, y: 0, w: 12, h: 2 }],
205
+ }
206
+
207
+ <ResponsiveGridContainer
208
+ layouts={layouts}
209
+ breakpoints={{ lg: 1200, md: 768, sm: 480 }}
210
+ cols={{ lg: 12, md: 8, sm: 4 }}
211
+ >
212
+ {(item) => <div>Responsive Item {item.id}</div>}
213
+ </ResponsiveGridContainer>
214
+ ```
215
+
216
+ ### Drag and Drop from Outside
217
+
218
+ ```tsx
219
+ import { DroppableGridContainer } from 'tailwind-grid-layout'
220
+
221
+ <DroppableGridContainer
222
+ items={items}
223
+ onDrop={(newItem) => setItems([...items, newItem])}
224
+ droppingItem={{ w: 2, h: 2 }} // Default size for dropped items
225
+ >
226
+ {(item) => <div>Dropped Item {item.id}</div>}
227
+ </DroppableGridContainer>
228
+ ```
229
+
230
+ ### Custom Resize Handles
231
+
232
+ ```tsx
233
+ <GridContainer
234
+ items={items}
235
+ resizeHandles={['se', 'sw', 'ne', 'nw']} // Enable corner handles only
236
+ >
237
+ {(item) => <div>Item {item.id}</div>}
238
+ </GridContainer>
239
+ ```
240
+
241
+ ### Prevent Collision
242
+
243
+ ```tsx
244
+ <GridContainer
245
+ items={items}
246
+ preventCollision={true} // Items cannot overlap
247
+ allowOverlap={false}
248
+ >
249
+ {(item) => <div>Item {item.id}</div>}
250
+ </GridContainer>
251
+ ```
252
+
253
+ ### Bounded Grid with Max Rows
254
+
255
+ ```tsx
256
+ <GridContainer
257
+ items={items}
258
+ isBounded={true}
259
+ maxRows={10}
260
+ >
261
+ {(item) => <div>Item {item.id}</div>}
262
+ </GridContainer>
263
+ ```
264
+
265
+ ### AutoSize Container
266
+
267
+ ```tsx
268
+ <GridContainer
269
+ items={items}
270
+ autoSize={true} // Container height adjusts automatically
271
+ >
272
+ {(item) => <div>Item {item.id}</div>}
273
+ </GridContainer>
274
+
275
+ // With fixed height
276
+ <div style={{ height: 400, overflow: 'auto' }}>
277
+ <GridContainer
278
+ items={items}
279
+ autoSize={false}
280
+ style={{ height: '100%' }}
281
+ >
282
+ {(item) => <div>Item {item.id}</div>}
283
+ </GridContainer>
284
+ </div>
285
+ ```
286
+
287
+ ### Dropping Item Preview
288
+
289
+ ```tsx
290
+ <DroppableGridContainer
291
+ items={items}
292
+ droppingItem={{ w: 4, h: 2 }} // Shows preview while dragging
293
+ onDrop={(newItem) => setItems([...items, newItem])}
294
+ >
295
+ {(item) => <div>Item {item.id}</div>}
296
+ </DroppableGridContainer>
297
+ ```
298
+
299
+ ## Layout Utilities
300
+
301
+ ### generateLayouts
302
+
303
+ Generate identical layouts for all breakpoints from a single layout definition.
304
+
305
+ ```tsx
306
+ import { generateLayouts } from 'tailwind-grid-layout'
307
+
308
+ const items = [
309
+ { id: '1', x: 0, y: 0, w: 4, h: 2 },
310
+ { id: '2', x: 4, y: 0, w: 4, h: 2 }
311
+ ]
312
+
313
+ // Creates layouts for lg, md, sm, xs, xxs with identical positioning
314
+ const layouts = generateLayouts(items)
315
+ ```
316
+
317
+ ### generateResponsiveLayouts
318
+
319
+ Automatically adjust layouts to fit different column counts per breakpoint.
320
+
321
+ ```tsx
322
+ import { generateResponsiveLayouts } from 'tailwind-grid-layout'
323
+
324
+ const items = [
325
+ { id: '1', x: 0, y: 0, w: 12, h: 2 },
326
+ { id: '2', x: 0, y: 2, w: 6, h: 2 }
327
+ ]
328
+
329
+ // Adjusts item widths and positions to fit column constraints
330
+ const layouts = generateResponsiveLayouts(items, {
331
+ lg: 12,
332
+ md: 10,
333
+ sm: 6,
334
+ xs: 4,
335
+ xxs: 2
336
+ })
337
+ ```
338
+
339
+ ### WidthProvider HOC
340
+
341
+ Automatically provides container width to ResponsiveGridContainer.
342
+
343
+ ```tsx
344
+ import { ResponsiveGridContainer, WidthProvider } from 'tailwind-grid-layout'
345
+
346
+ const ResponsiveGridWithWidth = WidthProvider(ResponsiveGridContainer)
347
+
348
+ // No need to manually track container width
349
+ <ResponsiveGridWithWidth
350
+ layouts={layouts}
351
+ measureBeforeMount={true} // Optional: prevent layout shift
352
+ >
353
+ {(item) => <div>Item {item.id}</div>}
354
+ </ResponsiveGridWithWidth>
355
+ ```
356
+
357
+
358
+ ## Styling Guide
359
+
360
+ ### Using with Tailwind CSS
361
+
362
+ The library is built to work seamlessly with Tailwind CSS:
363
+
364
+ ```tsx
365
+ <GridContainer items={items} className="bg-gray-50 rounded-lg">
366
+ {(item) => (
367
+ <div className="bg-white rounded-lg shadow-md hover:shadow-lg transition-shadow">
368
+ <div className="p-4">
369
+ <h3 className="text-lg font-semibold">Item {item.id}</h3>
370
+ </div>
371
+ </div>
372
+ )}
373
+ </GridContainer>
374
+ ```
375
+
376
+ ### Custom Placeholders
377
+
378
+ The drag and resize placeholders can be styled via CSS:
379
+
380
+ ```css
381
+ /* Drag placeholder */
382
+ .tailwind-grid-layout .drag-placeholder {
383
+ background: rgba(59, 130, 246, 0.15);
384
+ border: 2px dashed rgb(59, 130, 246);
385
+ }
386
+
387
+ /* Resize placeholder */
388
+ .tailwind-grid-layout .resize-placeholder {
389
+ background: rgba(59, 130, 246, 0.1);
390
+ border: 2px dashed rgb(59, 130, 246);
391
+ }
392
+ ```
393
+
394
+ ## Browser Support
395
+
396
+ - Chrome (latest)
397
+ - Firefox (latest)
398
+ - Safari (latest)
399
+ - Edge (latest)
400
+
401
+ ## Contributing
402
+
403
+ We welcome contributions! Please see our [Contributing Guide](CONTRIBUTING.md) for details.
404
+
405
+ ## License
406
+
407
+ MIT © [Seungwoo, Lee](./LICENSE)
408
+
409
+ ## Acknowledgments
410
+
411
+ This library is inspired by [react-grid-layout](https://github.com/react-grid-layout/react-grid-layout) and aims to provide a modern, Tailwind-first alternative.
@@ -0,0 +1,7 @@
1
+ import { GridItem, GridContainerProps } from '../types';
2
+ export interface DroppableGridContainerProps extends Omit<GridContainerProps, 'onDrop'> {
3
+ onDrop?: (item: GridItem) => void;
4
+ droppingItem?: Partial<GridItem>;
5
+ }
6
+ export declare function DroppableGridContainer({ onDrop, droppingItem, className, ...props }: DroppableGridContainerProps): import("react/jsx-runtime").JSX.Element;
7
+ //# sourceMappingURL=DroppableGridContainer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DroppableGridContainer.d.ts","sourceRoot":"","sources":["../../src/components/DroppableGridContainer.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAA;AAG5D,MAAM,WAAW,2BAA4B,SAAQ,IAAI,CAAC,kBAAkB,EAAE,QAAQ,CAAC;IACrF,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,QAAQ,KAAK,IAAI,CAAA;IACjC,YAAY,CAAC,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAA;CACjC;AAED,wBAAgB,sBAAsB,CAAC,EACrC,MAAM,EACN,YAA6B,EAC7B,SAAS,EACT,GAAG,KAAK,EACT,EAAE,2BAA2B,2CAwF7B"}
@@ -0,0 +1,4 @@
1
+ import { default as React } from 'react';
2
+ import { GridContainerProps } from '../types';
3
+ export declare const GridContainer: React.FC<GridContainerProps>;
4
+ //# sourceMappingURL=GridContainer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GridContainer.d.ts","sourceRoot":"","sources":["../../src/components/GridContainer.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAmD,MAAM,OAAO,CAAA;AAEvE,OAAO,EAAoC,kBAAkB,EAAE,MAAM,UAAU,CAAA;AAI/E,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CAgjBtD,CAAA"}
@@ -0,0 +1,23 @@
1
+ import { default as React } from 'react';
2
+ import { GridItem, ResizeState } from '../types';
3
+ interface GridItemComponentProps {
4
+ item: GridItem;
5
+ position: {
6
+ left: number;
7
+ top: number;
8
+ width: number;
9
+ height: number;
10
+ };
11
+ isDragging: boolean;
12
+ isResizing: boolean;
13
+ isDraggable: boolean;
14
+ isResizable: boolean;
15
+ resizeHandles?: Array<'s' | 'w' | 'e' | 'n' | 'sw' | 'nw' | 'se' | 'ne'>;
16
+ draggableCancel?: string;
17
+ onDragStart: (itemId: string, e: React.MouseEvent) => void;
18
+ onResizeStart: (itemId: string, handle: ResizeState['resizeHandle'], e: React.MouseEvent) => void;
19
+ children: React.ReactNode;
20
+ }
21
+ export declare const GridItemComponent: React.FC<GridItemComponentProps>;
22
+ export {};
23
+ //# sourceMappingURL=GridItem.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GridItem.d.ts","sourceRoot":"","sources":["../../src/components/GridItem.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AAGhD,UAAU,sBAAsB;IAC9B,IAAI,EAAE,QAAQ,CAAA;IACd,QAAQ,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAA;IACtE,UAAU,EAAE,OAAO,CAAA;IACnB,UAAU,EAAE,OAAO,CAAA;IACnB,WAAW,EAAE,OAAO,CAAA;IACpB,WAAW,EAAE,OAAO,CAAA;IACpB,aAAa,CAAC,EAAE,KAAK,CAAC,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC,CAAA;IACxE,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,WAAW,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,EAAE,KAAK,CAAC,UAAU,KAAK,IAAI,CAAA;IAC1D,aAAa,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,CAAC,cAAc,CAAC,EAAE,CAAC,EAAE,KAAK,CAAC,UAAU,KAAK,IAAI,CAAA;IACjG,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAC1B;AAED,eAAO,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAAC,sBAAsB,CAsE9D,CAAA"}
@@ -0,0 +1,10 @@
1
+ import { default as React } from 'react';
2
+ interface ResizeHandleProps {
3
+ position: 'se' | 'sw' | 'ne' | 'nw' | 'n' | 's' | 'e' | 'w';
4
+ onMouseDown: (e: React.MouseEvent) => void;
5
+ isActive?: boolean;
6
+ isVisible?: boolean;
7
+ }
8
+ export declare const ResizeHandle: React.FC<ResizeHandleProps>;
9
+ export {};
10
+ //# sourceMappingURL=ResizeHandle.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ResizeHandle.d.ts","sourceRoot":"","sources":["../../src/components/ResizeHandle.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAA;AAGzB,UAAU,iBAAiB;IACzB,QAAQ,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,CAAA;IAC3D,WAAW,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,KAAK,IAAI,CAAA;IAC1C,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,SAAS,CAAC,EAAE,OAAO,CAAA;CACpB;AAED,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CAuEpD,CAAA"}
@@ -0,0 +1,18 @@
1
+ import { GridItem, GridContainerProps } from '../types';
2
+ export interface BreakpointLayouts {
3
+ [breakpoint: string]: GridItem[];
4
+ }
5
+ export interface ResponsiveGridContainerProps extends Omit<GridContainerProps, 'items' | 'cols' | 'onLayoutChange'> {
6
+ layouts: BreakpointLayouts;
7
+ breakpoints?: {
8
+ [breakpoint: string]: number;
9
+ };
10
+ cols?: {
11
+ [breakpoint: string]: number;
12
+ };
13
+ onLayoutChange?: (layout: GridItem[], layouts: BreakpointLayouts) => void;
14
+ onBreakpointChange?: (newBreakpoint: string, cols: number) => void;
15
+ width?: number;
16
+ }
17
+ export declare function ResponsiveGridContainer({ layouts, breakpoints, cols, onLayoutChange, onBreakpointChange, width, ...props }: ResponsiveGridContainerProps): import("react/jsx-runtime").JSX.Element;
18
+ //# sourceMappingURL=ResponsiveGridContainer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ResponsiveGridContainer.d.ts","sourceRoot":"","sources":["../../src/components/ResponsiveGridContainer.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAA;AAE5D,MAAM,WAAW,iBAAiB;IAChC,CAAC,UAAU,EAAE,MAAM,GAAG,QAAQ,EAAE,CAAA;CACjC;AAED,MAAM,WAAW,4BAA6B,SAAQ,IAAI,CAAC,kBAAkB,EAAE,OAAO,GAAG,MAAM,GAAG,gBAAgB,CAAC;IACjH,OAAO,EAAE,iBAAiB,CAAA;IAC1B,WAAW,CAAC,EAAE;QAAE,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAA;IAC9C,IAAI,CAAC,EAAE;QAAE,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAA;IACvC,cAAc,CAAC,EAAE,CAAC,MAAM,EAAE,QAAQ,EAAE,EAAE,OAAO,EAAE,iBAAiB,KAAK,IAAI,CAAA;IACzE,kBAAkB,CAAC,EAAE,CAAC,aAAa,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;IAClE,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAkBD,wBAAgB,uBAAuB,CAAC,EACtC,OAAO,EACP,WAAgC,EAChC,IAAkB,EAClB,cAAc,EACd,kBAAkB,EAClB,KAAK,EACL,GAAG,KAAK,EACT,EAAE,4BAA4B,2CAiH9B"}
@@ -0,0 +1,8 @@
1
+ import { ComponentType } from 'react';
2
+ export interface WidthProviderProps {
3
+ measureBeforeMount?: boolean;
4
+ }
5
+ export declare function WidthProvider<P extends {
6
+ width?: number;
7
+ }>(Component: ComponentType<P>): ComponentType<Omit<P, 'width'> & WidthProviderProps>;
8
+ //# sourceMappingURL=WidthProvider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WidthProvider.d.ts","sourceRoot":"","sources":["../../src/components/WidthProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA+B,aAAa,EAAE,MAAM,OAAO,CAAA;AAElE,MAAM,WAAW,kBAAkB;IACjC,kBAAkB,CAAC,EAAE,OAAO,CAAA;CAC7B;AAED,wBAAgB,aAAa,CAAC,CAAC,SAAS;IAAE,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,EACxD,SAAS,EAAE,aAAa,CAAC,CAAC,CAAC,GAC1B,aAAa,CAAC,IAAI,CAAC,CAAC,EAAE,OAAO,CAAC,GAAG,kBAAkB,CAAC,CAyDtD"}
@@ -0,0 +1,9 @@
1
+ import * as React from "react";
2
+ declare const Card: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
3
+ declare const CardHeader: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
4
+ declare const CardTitle: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
5
+ declare const CardDescription: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
6
+ declare const CardContent: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
7
+ declare const CardFooter: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
8
+ export { Card, CardHeader, CardFooter, CardTitle, CardDescription, CardContent };
9
+ //# sourceMappingURL=card.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"card.d.ts","sourceRoot":"","sources":["../../../src/components/ui/card.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAG9B,QAAA,MAAM,IAAI,6GAYR,CAAA;AAGF,QAAA,MAAM,UAAU,6GASd,CAAA;AAGF,QAAA,MAAM,SAAS,6GAYb,CAAA;AAGF,QAAA,MAAM,eAAe,6GASnB,CAAA;AAGF,QAAA,MAAM,WAAW,6GAKf,CAAA;AAGF,QAAA,MAAM,UAAU,6GASd,CAAA;AAGF,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,eAAe,EAAE,WAAW,EAAE,CAAA"}
package/dist/index.cjs ADDED
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),t=require("react");function r(e){var t,o,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e)){var s=e.length;for(t=0;t<s;t++)e[t]&&(o=r(e[t]))&&(n&&(n+=" "),n+=o)}else for(o in e)e[o]&&(n&&(n+=" "),n+=o);return n}const o=e=>{const t=a(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:o}=e;return{getClassGroupId:e=>{const r=e.split("-");return""===r[0]&&1!==r.length&&r.shift(),n(r,t)||i(e)},getConflictingClassGroupIds:(e,t)=>{const n=r[e]||[];return t&&o[e]?[...n,...o[e]]:n}}},n=(e,t)=>{var r;if(0===e.length)return t.classGroupId;const o=e[0],s=t.nextPart.get(o),i=s?n(e.slice(1),s):void 0;if(i)return i;if(0===t.validators.length)return;const a=e.join("-");return null==(r=t.validators.find((({validator:e})=>e(a))))?void 0:r.classGroupId},s=/^\[(.+)\]$/,i=e=>{if(s.test(e)){const t=s.exec(e)[1],r=null==t?void 0:t.substring(0,t.indexOf(":"));if(r)return"arbitrary.."+r}},a=e=>{const{theme:t,prefix:r}=e,o={nextPart:new Map,validators:[]};return u(Object.entries(e.classGroups),r).forEach((([e,r])=>{l(r,o,e,t)})),o},l=(e,t,r,o)=>{e.forEach((e=>{if("string"!=typeof e){if("function"==typeof e)return c(e)?void l(e(o),t,r,o):void t.validators.push({validator:e,classGroupId:r});Object.entries(e).forEach((([e,n])=>{l(n,d(t,e),r,o)}))}else{(""===e?t:d(t,e)).classGroupId=r}}))},d=(e,t)=>{let r=e;return t.split("-").forEach((e=>{r.nextPart.has(e)||r.nextPart.set(e,{nextPart:new Map,validators:[]}),r=r.nextPart.get(e)})),r},c=e=>e.isThemeGetter,u=(e,t)=>t?e.map((([e,r])=>[e,r.map((e=>"string"==typeof e?t+e:"object"==typeof e?Object.fromEntries(Object.entries(e).map((([e,r])=>[t+e,r]))):e))])):e,p=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,r=new Map,o=new Map;const n=(n,s)=>{r.set(n,s),t++,t>e&&(t=0,o=r,r=new Map)};return{get(e){let t=r.get(e);return void 0!==t?t:void 0!==(t=o.get(e))?(n(e,t),t):void 0},set(e,t){r.has(e)?r.set(e,t):n(e,t)}}},g=e=>{const{separator:t,experimentalParseClassName:r}=e,o=1===t.length,n=t[0],s=t.length,i=e=>{const r=[];let i,a=0,l=0;for(let u=0;u<e.length;u++){let d=e[u];if(0===a){if(d===n&&(o||e.slice(u,u+s)===t)){r.push(e.slice(l,u)),l=u+s;continue}if("/"===d){i=u;continue}}"["===d?a++:"]"===d&&a--}const d=0===r.length?e:e.substring(l),c=d.startsWith("!");return{modifiers:r,hasImportantModifier:c,baseClassName:c?d.substring(1):d,maybePostfixModifierPosition:i&&i>l?i-l:void 0}};return r?e=>r({className:e,parseClassName:i}):i},m=e=>{if(e.length<=1)return e;const t=[];let r=[];return e.forEach((e=>{"["===e[0]?(t.push(...r.sort(),e),r=[]):r.push(e)})),t.push(...r.sort()),t},b=/\s+/;function f(){let e,t,r=0,o="";for(;r<arguments.length;)(e=arguments[r++])&&(t=h(e))&&(o&&(o+=" "),o+=t);return o}const h=e=>{if("string"==typeof e)return e;let t,r="";for(let o=0;o<e.length;o++)e[o]&&(t=h(e[o]))&&(r&&(r+=" "),r+=t);return r};function x(e,...t){let r,n,s,i=function(l){const d=t.reduce(((e,t)=>t(e)),e());return r=(e=>({cache:p(e.cacheSize),parseClassName:g(e),...o(e)}))(d),n=r.cache.get,s=r.cache.set,i=a,a(l)};function a(e){const t=n(e);if(t)return t;const o=((e,t)=>{const{parseClassName:r,getClassGroupId:o,getConflictingClassGroupIds:n}=t,s=[],i=e.trim().split(b);let a="";for(let l=i.length-1;l>=0;l-=1){const e=i[l],{modifiers:t,hasImportantModifier:d,baseClassName:c,maybePostfixModifierPosition:u}=r(e);let p=Boolean(u),g=o(p?c.substring(0,u):c);if(!g){if(!p){a=e+(a.length>0?" "+a:a);continue}if(g=o(c),!g){a=e+(a.length>0?" "+a:a);continue}p=!1}const b=m(t).join(":"),f=d?b+"!":b,h=f+g;if(s.includes(h))continue;s.push(h);const x=n(g,p);for(let r=0;r<x.length;++r){const e=x[r];s.push(f+e)}a=e+(a.length>0?" "+a:a)}return a})(e,r);return s(e,o),o}return function(){return i(f.apply(null,arguments))}}const y=e=>{const t=t=>t[e]||[];return t.isThemeGetter=!0,t},w=/^\[(?:([a-z-]+):)?(.+)\]$/i,v=/^\d+\/\d+$/,z=new Set(["px","full","screen"]),k=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,I=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,S=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,M=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,C=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,P=e=>D(e)||z.has(e)||v.test(e),j=e=>Z(e,"length",$),D=e=>Boolean(e)&&!Number.isNaN(Number(e)),R=e=>Z(e,"number",D),N=e=>Boolean(e)&&Number.isInteger(Number(e)),E=e=>e.endsWith("%")&&D(e.slice(0,-1)),L=e=>w.test(e),G=e=>k.test(e),A=new Set(["length","size","percentage"]),T=e=>Z(e,A,X),H=e=>Z(e,"position",X),O=new Set(["image","url"]),W=e=>Z(e,O,V),B=e=>Z(e,"",F),Y=()=>!0,Z=(e,t,r)=>{const o=w.exec(e);return!!o&&(o[1]?"string"==typeof t?o[1]===t:t.has(o[1]):r(o[2]))},$=e=>I.test(e)&&!S.test(e),X=()=>!1,F=e=>M.test(e),V=e=>C.test(e),J=x((()=>{const e=y("colors"),t=y("spacing"),r=y("blur"),o=y("brightness"),n=y("borderColor"),s=y("borderRadius"),i=y("borderSpacing"),a=y("borderWidth"),l=y("contrast"),d=y("grayscale"),c=y("hueRotate"),u=y("invert"),p=y("gap"),g=y("gradientColorStops"),m=y("gradientColorStopPositions"),b=y("inset"),f=y("margin"),h=y("opacity"),x=y("padding"),w=y("saturate"),v=y("scale"),z=y("sepia"),k=y("skew"),I=y("space"),S=y("translate"),M=()=>["auto",L,t],C=()=>[L,t],A=()=>["",P,j],O=()=>["auto",D,L],Z=()=>["","0",L],$=()=>[D,L];return{cacheSize:500,separator:":",theme:{colors:[Y],spacing:[P,j],blur:["none","",G,L],brightness:$(),borderColor:[e],borderRadius:["none","","full",G,L],borderSpacing:C(),borderWidth:A(),contrast:$(),grayscale:Z(),hueRotate:$(),invert:Z(),gap:C(),gradientColorStops:[e],gradientColorStopPositions:[E,j],inset:M(),margin:M(),opacity:$(),padding:C(),saturate:$(),scale:$(),sepia:Z(),skew:$(),space:C(),translate:C()},classGroups:{aspect:[{aspect:["auto","square","video",L]}],container:["container"],columns:[{columns:[G]}],"break-after":[{"break-after":["auto","avoid","all","avoid-page","page","left","right","column"]}],"break-before":[{"break-before":["auto","avoid","all","avoid-page","page","left","right","column"]}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top",L]}],overflow:[{overflow:["auto","hidden","clip","visible","scroll"]}],"overflow-x":[{"overflow-x":["auto","hidden","clip","visible","scroll"]}],"overflow-y":[{"overflow-y":["auto","hidden","clip","visible","scroll"]}],overscroll:[{overscroll:["auto","contain","none"]}],"overscroll-x":[{"overscroll-x":["auto","contain","none"]}],"overscroll-y":[{"overscroll-y":["auto","contain","none"]}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[b]}],"inset-x":[{"inset-x":[b]}],"inset-y":[{"inset-y":[b]}],start:[{start:[b]}],end:[{end:[b]}],top:[{top:[b]}],right:[{right:[b]}],bottom:[{bottom:[b]}],left:[{left:[b]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",N,L]}],basis:[{basis:M()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",L]}],grow:[{grow:Z()}],shrink:[{shrink:Z()}],order:[{order:["first","last","none",N,L]}],"grid-cols":[{"grid-cols":[Y]}],"col-start-end":[{col:["auto",{span:["full",N,L]},L]}],"col-start":[{"col-start":O()}],"col-end":[{"col-end":O()}],"grid-rows":[{"grid-rows":[Y]}],"row-start-end":[{row:["auto",{span:[N,L]},L]}],"row-start":[{"row-start":O()}],"row-end":[{"row-end":O()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",L]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",L]}],gap:[{gap:[p]}],"gap-x":[{"gap-x":[p]}],"gap-y":[{"gap-y":[p]}],"justify-content":[{justify:["normal","start","end","center","between","around","evenly","stretch"]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal","start","end","center","between","around","evenly","stretch","baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":["start","end","center","between","around","evenly","stretch","baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[x]}],px:[{px:[x]}],py:[{py:[x]}],ps:[{ps:[x]}],pe:[{pe:[x]}],pt:[{pt:[x]}],pr:[{pr:[x]}],pb:[{pb:[x]}],pl:[{pl:[x]}],m:[{m:[f]}],mx:[{mx:[f]}],my:[{my:[f]}],ms:[{ms:[f]}],me:[{me:[f]}],mt:[{mt:[f]}],mr:[{mr:[f]}],mb:[{mb:[f]}],ml:[{ml:[f]}],"space-x":[{"space-x":[I]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[I]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",L,t]}],"min-w":[{"min-w":[L,t,"min","max","fit"]}],"max-w":[{"max-w":[L,t,"none","full","min","max","fit","prose",{screen:[G]},G]}],h:[{h:[L,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[L,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[L,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[L,t,"auto","min","max","fit"]}],"font-size":[{text:["base",G,j]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",R]}],"font-family":[{font:[Y]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",L]}],"line-clamp":[{"line-clamp":["none",D,R]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",P,L]}],"list-image":[{"list-image":["none",L]}],"list-style-type":[{list:["none","disc","decimal",L]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[h]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[h]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:["solid","dashed","dotted","double","none","wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",P,j]}],"underline-offset":[{"underline-offset":["auto",P,L]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:C()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",L]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",L]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[h]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top",H]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",T]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},W]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[m]}],"gradient-via-pos":[{via:[m]}],"gradient-to-pos":[{to:[m]}],"gradient-from":[{from:[g]}],"gradient-via":[{via:[g]}],"gradient-to":[{to:[g]}],rounded:[{rounded:[s]}],"rounded-s":[{"rounded-s":[s]}],"rounded-e":[{"rounded-e":[s]}],"rounded-t":[{"rounded-t":[s]}],"rounded-r":[{"rounded-r":[s]}],"rounded-b":[{"rounded-b":[s]}],"rounded-l":[{"rounded-l":[s]}],"rounded-ss":[{"rounded-ss":[s]}],"rounded-se":[{"rounded-se":[s]}],"rounded-ee":[{"rounded-ee":[s]}],"rounded-es":[{"rounded-es":[s]}],"rounded-tl":[{"rounded-tl":[s]}],"rounded-tr":[{"rounded-tr":[s]}],"rounded-br":[{"rounded-br":[s]}],"rounded-bl":[{"rounded-bl":[s]}],"border-w":[{border:[a]}],"border-w-x":[{"border-x":[a]}],"border-w-y":[{"border-y":[a]}],"border-w-s":[{"border-s":[a]}],"border-w-e":[{"border-e":[a]}],"border-w-t":[{"border-t":[a]}],"border-w-r":[{"border-r":[a]}],"border-w-b":[{"border-b":[a]}],"border-w-l":[{"border-l":[a]}],"border-opacity":[{"border-opacity":[h]}],"border-style":[{border:["solid","dashed","dotted","double","none","hidden"]}],"divide-x":[{"divide-x":[a]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[a]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[h]}],"divide-style":[{divide:["solid","dashed","dotted","double","none"]}],"border-color":[{border:[n]}],"border-color-x":[{"border-x":[n]}],"border-color-y":[{"border-y":[n]}],"border-color-s":[{"border-s":[n]}],"border-color-e":[{"border-e":[n]}],"border-color-t":[{"border-t":[n]}],"border-color-r":[{"border-r":[n]}],"border-color-b":[{"border-b":[n]}],"border-color-l":[{"border-l":[n]}],"divide-color":[{divide:[n]}],"outline-style":[{outline:["","solid","dashed","dotted","double","none"]}],"outline-offset":[{"outline-offset":[P,L]}],"outline-w":[{outline:[P,j]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:A()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[h]}],"ring-offset-w":[{"ring-offset":[P,j]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",G,B]}],"shadow-color":[{shadow:[Y]}],opacity:[{opacity:[h]}],"mix-blend":[{"mix-blend":["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity","plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"]}],filter:[{filter:["","none"]}],blur:[{blur:[r]}],brightness:[{brightness:[o]}],contrast:[{contrast:[l]}],"drop-shadow":[{"drop-shadow":["","none",G,L]}],grayscale:[{grayscale:[d]}],"hue-rotate":[{"hue-rotate":[c]}],invert:[{invert:[u]}],saturate:[{saturate:[w]}],sepia:[{sepia:[z]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[r]}],"backdrop-brightness":[{"backdrop-brightness":[o]}],"backdrop-contrast":[{"backdrop-contrast":[l]}],"backdrop-grayscale":[{"backdrop-grayscale":[d]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[c]}],"backdrop-invert":[{"backdrop-invert":[u]}],"backdrop-opacity":[{"backdrop-opacity":[h]}],"backdrop-saturate":[{"backdrop-saturate":[w]}],"backdrop-sepia":[{"backdrop-sepia":[z]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[i]}],"border-spacing-x":[{"border-spacing-x":[i]}],"border-spacing-y":[{"border-spacing-y":[i]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",L]}],duration:[{duration:$()}],ease:[{ease:["linear","in","out","in-out",L]}],delay:[{delay:$()}],animate:[{animate:["none","spin","ping","pulse","bounce",L]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[v]}],"scale-x":[{"scale-x":[v]}],"scale-y":[{"scale-y":[v]}],rotate:[{rotate:[N,L]}],"translate-x":[{"translate-x":[S]}],"translate-y":[{"translate-y":[S]}],"skew-x":[{"skew-x":[k]}],"skew-y":[{"skew-y":[k]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",L]}],accent:[{accent:["auto",e]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",L]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":C()}],"scroll-mx":[{"scroll-mx":C()}],"scroll-my":[{"scroll-my":C()}],"scroll-ms":[{"scroll-ms":C()}],"scroll-me":[{"scroll-me":C()}],"scroll-mt":[{"scroll-mt":C()}],"scroll-mr":[{"scroll-mr":C()}],"scroll-mb":[{"scroll-mb":C()}],"scroll-ml":[{"scroll-ml":C()}],"scroll-p":[{"scroll-p":C()}],"scroll-px":[{"scroll-px":C()}],"scroll-py":[{"scroll-py":C()}],"scroll-ps":[{"scroll-ps":C()}],"scroll-pe":[{"scroll-pe":C()}],"scroll-pt":[{"scroll-pt":C()}],"scroll-pr":[{"scroll-pr":C()}],"scroll-pb":[{"scroll-pb":C()}],"scroll-pl":[{"scroll-pl":C()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",L]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[P,j,R]}],stroke:[{stroke:[e,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}}));function q(...e){return J(function(){for(var e,t,o=0,n="",s=arguments.length;o<s;o++)(e=arguments[o])&&(t=r(e))&&(n&&(n+=" "),n+=t);return n}(e))}function Q(e,t,r,o,n,s,i){const a=i?i[0]:n,l=i?i[1]:n,d=(s-a*(r-1))/r,c=Math.round(e/(d+a)),u=Math.round(t/(o+l));return{col:Math.max(0,c),row:Math.max(0,u)}}function U(e,t,r,o,n,s){const i=s?s[0]:o,a=s?s[1]:o,l=(n-i*(t-1))/t;return{left:e.x*(l+i),top:e.y*(r+a),width:e.w*l+(e.w-1)*i,height:e.h*r+(e.h-1)*a}}function _(e,t){return!(e.x+e.w<=t.x||t.x+t.w<=e.x||e.y+e.h<=t.y||t.y+t.h<=e.y)}function K(e,t,r="vertical"){if(!r)return e;const o=e.filter((e=>e.static)),n=[...e.filter((e=>!e.static))].sort(((e,t)=>"horizontal"===r?e.x===t.x?e.y-t.y:e.x-t.x:e.y===t.y?e.x-t.x:e.y-t.y)),s=[...o];return n.forEach((e=>{if("vertical"===r){let t=0,r=!1;for(let o=0;!r;o++){const n={...e,y:o,x:e.x};s.some((e=>_(n,e)))||(t=o,r=!0)}s.push({...e,y:t})}else if("horizontal"===r){let r=0,o=!1;for(let n=0;n<=t-e.w&&!o;n++){const t={...e,x:n,y:e.y};s.some((e=>_(t,e)))||(r=n,o=!0)}s.push({...e,x:r})}})),s}function ee(e,t,r,o){const n={...t},s=[...e],i=s.findIndex((e=>e.id===t.id));-1!==i&&(s[i]=n);const a=e=>s.filter((t=>t.id!==e.id&&!t.static&&_(e,t))),l=new Set,d=[n];for(;d.length>0;){const e=d.shift();if(l.has(e.id))continue;l.add(e.id);const t=a(e);for(const r of t){if(l.has(r.id))continue;const t=e.y+e.h,o={...r,y:t},n=s.findIndex((e=>e.id===r.id));-1!==n&&(s[n]=o,d.push(o))}}return s}function te(e,t){return e.filter((e=>e.id!==t.id&&_(e,t)))}const re=({position:t,onMouseDown:r,isActive:o=!0,isVisible:n=!0})=>{const s={se:{className:"bottom-0 right-0",cursor:"cursor-se-resize",backgroundPosition:"bottom right",transform:void 0},sw:{className:"bottom-0 left-0",cursor:"cursor-sw-resize",backgroundPosition:"bottom left",transform:"scaleX(-1)"},ne:{className:"top-0 right-0",cursor:"cursor-ne-resize",backgroundPosition:"top right",transform:"scaleY(-1)"},nw:{className:"top-0 left-0",cursor:"cursor-nw-resize",backgroundPosition:"top left",transform:"scale(-1, -1)"}};if(s[t]&&n){const n=s[t];return e.jsx("span",{className:q("react-grid-layout__resize-handle","absolute w-5 h-5",o?n.cursor:"cursor-not-allowed opacity-50","z-20"),onMouseDown:o?r:void 0,style:{..."se"===t&&{bottom:"0px",right:"0px"},..."sw"===t&&{bottom:"0px",left:"0px"},..."ne"===t&&{top:"0px",right:"0px"},..."nw"===t&&{top:"0px",left:"0px"},backgroundImage:'url("data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBzdGFuZGFsb25lPSJubyI/Pg08IS0tIEdlbmVyYXRvcjogQWRvYmUgRmlyZXdvcmtzIENTNiwgRXhwb3J0IFNWRyBFeHRlbnNpb24gYnkgQWFyb24gQmVhbGwgKGh0dHA6Ly9maXJld29ya3MuYWJlYWxsLmNvbSkgLiBWZXJzaW9uOiAwLjYuMSAgLS0+DTwhRE9DVFlQRSBzdmcgUFVCTElDICItLy9XM0MvL0RURCBTVkcgMS4xLy9FTiIgImh0dHA6Ly93d3cudzMub3JnL0dyYXBoaWNzL1NWRy8xLjEvRFREL3N2ZzExLmR0ZCI+DTxzdmcgaWQ9IlVudGl0bGVkLVBhZ2UlMjAxIiB2aWV3Qm94PSIwIDAgNiA2IiBzdHlsZT0iYmFja2dyb3VuZC1jb2xvcjojZmZmZmZmMDAiIHZlcnNpb249IjEuMSINCXhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHhtbDpzcGFjZT0icHJlc2VydmUiDQl4PSIwcHgiIHk9IjBweCIgd2lkdGg9IjZweCIgaGVpZ2h0PSI2cHgiDT4NCTxnIG9wYWNpdHk9IjAuMzAyIj4NCQk8cGF0aCBkPSJNIDYgNiBMIDAgNiBMIDAgNC4yIEwgNCA0LjIgTCA0LjIgNC4yIEwgNC4yIDAgTCA2IDAgTCA2IDYgTCA2IDYgWiIgZmlsbD0iIzAwMDAwMCIvPg0JPC9nPg08L3N2Zz4=")',backgroundPosition:"bottom right",backgroundRepeat:"no-repeat",backgroundOrigin:"content-box",boxSizing:"border-box",transform:n.transform,padding:"3px"}})}const i={sw:"bottom-0 left-0 cursor-sw-resize",ne:"top-0 right-0 cursor-ne-resize",nw:"top-0 left-0 cursor-nw-resize",n:"top-0 left-1/2 -translate-x-1/2 w-10 h-2 cursor-n-resize",s:"bottom-0 left-1/2 -translate-x-1/2 w-10 h-2 cursor-s-resize",e:"right-0 top-1/2 -translate-y-1/2 w-2 h-10 cursor-e-resize",w:"left-0 top-1/2 -translate-y-1/2 w-2 h-10 cursor-w-resize"};return!n&&i[t]?e.jsx("div",{className:q("absolute",i[t],!o&&"pointer-events-none",["n","s","e","w"].includes(t)?"":"w-5 h-5","z-20"),onMouseDown:o?r:void 0}):null},oe=({item:t,position:r,isDragging:o,isResizing:n,isDraggable:s,isResizable:i,resizeHandles:a=["se"],draggableCancel:l,onDragStart:d,onResizeStart:c,children:u})=>e.jsxs("div",{"data-grid-id":t.id,className:q("absolute",!o&&"transition-all duration-200",o&&"opacity-80 z-50 cursor-grabbing shadow-2xl",n&&"z-40",!o&&!n&&"hover:z-30",t.static&&"cursor-not-allowed",t.className),style:{left:`${r.left}px`,top:`${r.top}px`,width:`${r.width}px`,height:`${r.height}px`,transform:o?"scale(1.02)":"scale(1)",cursor:s?"grab":"default"},onMouseDown:e=>{if(t.static)return;const r=e.target,o=r.closest(".grid-drag-handle"),n=r.closest(".grid-actions, button, a"),i=l&&r.closest(l);!s||e.defaultPrevented||!o&&r.closest(".grid-drag-handle")||n||i||d(t.id,e)},children:[u,i&&e.jsx(e.Fragment,{children:a.map((r=>e.jsx(re,{position:r,onMouseDown:e=>c(t.id,r,e),isActive:!0,isVisible:["se","sw","ne","nw"].includes(r)},r)))})]}),ne=({cols:r=12,rowHeight:o=60,gap:n=16,margin:s,containerPadding:i=[16,16],maxRows:a,isDraggable:l=!0,isResizable:d=!0,preventCollision:c=!1,allowOverlap:u=!1,isBounded:p=!0,compactType:g="vertical",resizeHandles:m=["se"],draggableCancel:b,autoSize:f=!0,verticalCompact:h=!0,transformScale:x=1,droppingItem:y,onLayoutChange:w,onDragStart:v,onDrag:z,onDragStop:k,onResizeStart:I,onResize:S,onResizeStop:M,onDrop:C,items:P,children:j,className:D,style:R})=>{const N=t.useRef(null),[E,L]=t.useState(0),[G,A]=t.useState(P);t.useEffect((()=>{A((e=>{const t=new Set(e.map((e=>e.id))),o=new Set(P.map((e=>e.id))),n=P.some((e=>!t.has(e.id))),s=e.some((e=>!o.has(e.id)));if(n||s){const t=new Map(e.map((e=>[e.id,e])));return K(P.map((e=>{const r=t.get(e.id);return r?{...e,x:r.x,y:r.y,w:r.w,h:r.h}:e})),r,g)}return P}))}),[P,r,g]),t.useEffect((()=>{const e=()=>{if(N.current){const e=N.current.offsetWidth-2*i[0];L(e)}};if(e(),"undefined"!=typeof ResizeObserver&&N.current){const t=new ResizeObserver(e);return t.observe(N.current),()=>t.disconnect()}return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)}),[i]);const[T,H]=t.useState({isDragging:!1,draggedItem:null,dragOffset:{x:0,y:0},placeholder:null,originalPosition:null,currentMousePos:void 0}),[O,W]=t.useState({isResizing:!1,resizedItem:null,resizeHandle:null,startSize:{w:0,h:0},startPos:{x:0,y:0}});t.useEffect((()=>{const e=()=>{N.current&&L(N.current.offsetWidth-2*i[0])};return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)}),[i]);const B=t.useCallback((e=>{const t=K(e,r,g);A(t),null==w||w(t)}),[r,g,w]),Y=t.useCallback(((e,t)=>{const r=G.find((t=>t.id===e)),o=t.currentTarget.getBoundingClientRect(),n={isDragging:!0,draggedItem:e,dragOffset:{x:t.clientX-o.left,y:t.clientY-o.top},placeholder:{...r},originalPosition:{...r},currentMousePos:{x:t.clientX,y:t.clientY}};if(H(n),v){const e=t.currentTarget;v(G,r,r,{...r},t.nativeEvent,e)}t.preventDefault()}),[G,v]),Z=t.useCallback((e=>{var t;if(!N.current)return;const l=N.current.getBoundingClientRect(),d=e.clientX-l.left-T.dragOffset.x-i[0],m=e.clientY-l.top-T.dragOffset.y-i[1],{col:b,row:f}=Q(d,m,r,o,n,E,s),h=G.find((e=>e.id===T.draggedItem));if(!h||h.static)return;const x={x:Math.max(0,Math.min(r-h.w,b)),y:Math.max(0,f),w:h.w,h:h.h};a&&x.y+x.h>a&&(x.y=Math.max(0,a-x.h)),p&&(x.x=Math.max(0,Math.min(r-x.w,x.x)),x.y=Math.max(0,x.y));const y=G.map((e=>e.id===T.draggedItem?{...e,...x}:e));if(c&&!u){if(te(y,{...h,...x}).filter((e=>e.static)).length>0)return}let w=y;if(!c&&!u){const e={...h,...x};T.originalPosition;w=ee(y,e)}const v=K(w,r,g);if(A(v),H((t=>({...t,placeholder:x,currentMousePos:{x:e.clientX,y:e.clientY}}))),z&&T.originalPosition){const r=null==(t=N.current)?void 0:t.querySelector(`[data-grid-id="${T.draggedItem}"]`);r&&z(v,{...h,...T.originalPosition},{...h,...x},{...h,...x},e,r)}}),[T,G,r,o,n,E,i,c,u,p,g,s,a,z]),$=t.useCallback((e=>{var t;const r=G.find((e=>e.id===T.draggedItem));if(r&&k&&T.originalPosition){const o=null==(t=N.current)?void 0:t.querySelector(`[data-grid-id="${T.draggedItem}"]`);o&&k(G,{...r,...T.originalPosition},r,{...r,...T.placeholder},e,o)}B(G),H({isDragging:!1,draggedItem:null,dragOffset:{x:0,y:0},placeholder:null,originalPosition:null,currentMousePos:void 0})}),[T,G,B,k]),X=t.useCallback(((e,t,r)=>{const o=G.find((t=>t.id===e));if(W({isResizing:!0,resizedItem:e,resizeHandle:t,startSize:{w:o.w,h:o.h},startPos:{x:r.clientX,y:r.clientY},originalPos:{x:o.x,y:o.y}}),I){const e=r.currentTarget;I(G,o,o,{...o},r.nativeEvent,e)}r.preventDefault(),r.stopPropagation()}),[G,I]),F=t.useCallback((e=>{var t,i,a;const l=G.find((e=>e.id===O.resizedItem));if(!l)return;const d=s?s[0]:n,c=s?s[1]:n,u=(E-d*(r-1))/r,p=.3,g=(e.clientX-O.startPos.x)/(u+d),m=(e.clientY-O.startPos.y)/(o+c),b=Math.round(g+(g>0?-.3:p)),f=Math.round(m+(m>0?-.3:p));let h=O.startSize.w,x=O.startSize.h,y=l.x,w=l.y;const v=(null==(t=O.originalPos)?void 0:t.x)||l.x,z=(null==(i=O.originalPos)?void 0:i.y)||l.y;switch(O.resizeHandle){case"se":h=O.startSize.w+b,x=O.startSize.h+f;break;case"sw":h=O.startSize.w-b,x=O.startSize.h+f,y=v+b;break;case"ne":h=O.startSize.w+b,x=O.startSize.h-f,w=z+f;break;case"nw":h=O.startSize.w-b,x=O.startSize.h-f,y=v+b,w=z+f;break;case"e":h=O.startSize.w+b;break;case"w":h=O.startSize.w-b,y=v+b;break;case"s":x=O.startSize.h+f;break;case"n":x=O.startSize.h-f,w=z+f}h=Math.max(l.minW||1,h),x=Math.max(l.minH||1,x),l.maxW&&(h=Math.min(h,l.maxW)),l.maxH&&(x=Math.min(x,l.maxH)),y=Math.max(0,y),w=Math.max(0,w),h=Math.min(h,r-y);const k=G.map((e=>e.id===O.resizedItem?{...e,x:y,y:w,w:h,h:x}:e));if(A(k),S&&O.originalPos){const t=null==(a=N.current)?void 0:a.querySelector(`[data-grid-id="${O.resizedItem}"]`);if(t){const r={...l,x:O.originalPos.x,y:O.originalPos.y,w:O.startSize.w,h:O.startSize.h},o={...l,x:y,y:w,w:h,h:x};S(k,r,o,o,e,t)}}}),[O,G,E,r,o,n,s,S]),V=t.useCallback((e=>{var t;const r=G.find((e=>e.id===O.resizedItem));if(r&&M&&O.originalPos){const o=null==(t=N.current)?void 0:t.querySelector(`[data-grid-id="${O.resizedItem}"]`);if(o){const t={...r,x:O.originalPos.x,y:O.originalPos.y,w:O.startSize.w,h:O.startSize.h};M(G,t,r,r,e,o)}}B(G),W({isResizing:!1,resizedItem:null,resizeHandle:null,startSize:{w:0,h:0},startPos:{x:0,y:0}})}),[O,G,B,M]);t.useEffect((()=>{if(T.isDragging)return document.addEventListener("mousemove",Z),document.addEventListener("mouseup",$),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",Z),document.removeEventListener("mouseup",$),document.body.style.cursor="",document.body.style.userSelect=""}}),[T.isDragging,Z,$]),t.useEffect((()=>{if(O.isResizing)return document.addEventListener("mousemove",F),document.addEventListener("mouseup",V),document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",F),document.removeEventListener("mouseup",V),document.body.style.userSelect=""}}),[O.isResizing,F,V]);const J=s?s[1]:n,_=G.map((e=>(e.y+e.h)*(o+J))),re=_.length>0?Math.max(..._):0,ne=f?re:void 0;return e.jsxs("div",{ref:N,className:q("relative w-full overflow-auto",T.isDragging&&"select-none",D),style:{...void 0!==ne&&{minHeight:ne+2*i[1]},padding:`${i[1]}px ${i[0]}px`,...R},children:[G.map((t=>{const a=T.draggedItem===t.id;let c=U(t,r,o,n,E,s);if(a&&T.currentMousePos&&N.current){const e=N.current.getBoundingClientRect();c={...c,left:T.currentMousePos.x-e.left-T.dragOffset.x-i[0],top:T.currentMousePos.y-e.top-T.dragOffset.y-i[1]}}return e.jsx(oe,{item:t,position:c,isDragging:a,isResizing:O.resizedItem===t.id,isDraggable:l&&!1!==t.isDraggable,isResizable:d&&!1!==t.isResizable,resizeHandles:m,draggableCancel:b,onDragStart:Y,onResizeStart:X,children:j(t)},t.id)})),T.isDragging&&T.placeholder&&e.jsx("div",{className:"absolute rounded-lg transition-all duration-300 pointer-events-none",style:{...U(T.placeholder,r,o,n,E,s),zIndex:9,background:"rgba(59, 130, 246, 0.15)",border:"2px dashed rgb(59, 130, 246)",boxSizing:"border-box"}}),O.isResizing&&O.resizedItem&&(()=>{const t=G.find((e=>e.id===O.resizedItem));return t?e.jsx("div",{className:"absolute rounded-lg transition-all duration-200 pointer-events-none",style:{...U(t,r,o,n,E,s),zIndex:8,background:"rgba(59, 130, 246, 0.1)",border:"2px dashed rgb(59, 130, 246)",boxSizing:"border-box"}}):null})(),y&&!T.isDragging&&e.jsx("div",{className:"absolute bg-gray-200 border-2 border-dashed border-gray-400 rounded opacity-75 pointer-events-none flex items-center justify-center",style:{width:(y.w||1)*E/r-n,height:(y.h||1)*o-n,left:i[0],top:i[1]},children:e.jsx("span",{className:"text-gray-600 font-medium",children:"Drop here"})})]})},se={lg:1200,md:996,sm:768,xs:480,xxs:0},ie={lg:12,md:10,sm:6,xs:4,xxs:2};exports.DroppableGridContainer=function({onDrop:r,droppingItem:o={w:2,h:2},className:n,...s}){const[i,a]=t.useState(!1),l=t.useRef(null);return e.jsxs("div",{ref:l,className:q("relative",i&&"ring-2 ring-blue-500 ring-offset-2 rounded-lg",n),onDragOver:e=>{e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect="copy"),a(!0)},onDragLeave:e=>{var t;const r=null==(t=l.current)?void 0:t.getBoundingClientRect();if(r){const{clientX:t,clientY:o}=e;(t<r.left||t>r.right||o<r.top||o>r.bottom)&&a(!1)}},onDrop:e=>{var t;e.preventDefault(),a(!1);const n=e.dataTransfer.getData("application/json");if(n)try{const i=JSON.parse(n),a=null==(t=l.current)?void 0:t.getBoundingClientRect();if(!a)return;const d=e.clientX-a.left,c=e.clientY-a.top,u=s.cols||12,p=s.rowHeight||60,g=s.gap||16,m=a.width/u,b=p+g,f=Math.floor(d/m),h=Math.floor(c/b),x={id:i.id||`dropped-${Date.now()}`,x:Math.max(0,Math.min(f,u-(o.w||2))),y:Math.max(0,h),w:o.w||2,h:o.h||2,...i};null==r||r(x)}catch(i){console.error("Failed to parse dropped data:",i)}},children:[e.jsx(ne,{...s,droppingItem:i?o:void 0}),i&&e.jsx("div",{className:"absolute inset-0 bg-blue-500/10 rounded-lg pointer-events-none"})]})},exports.GridContainer=ne,exports.GridItemComponent=oe,exports.ResizeHandle=re,exports.ResponsiveGridContainer=function({layouts:r,breakpoints:o=se,cols:n=ie,onLayoutChange:s,onBreakpointChange:i,width:a,...l}){const[d,c]=t.useState((()=>{var e;const t=a??window.innerWidth,r=Object.entries(o).sort(((e,t)=>t[1]-e[1]));for(const[o,n]of r)if(t>=n)return o;return(null==(e=r[r.length-1])?void 0:e[0])||"lg"})),[u,p]=t.useState((()=>("object"==typeof n?n[d]:void 0)||ie[d]||12)),g=t.useMemo((()=>Object.entries(o).sort(((e,t)=>t[1]-e[1]))),[o]),m=t.useMemo((()=>e=>{if(0===g.length)return"lg";let t=g[g.length-1][0];for(const[r,o]of g)if(e>=o){t=r;break}return t}),[g]),b=t.useRef(null);t.useEffect((()=>{const e=()=>{const e=a??window.innerWidth,t=m(e);if(t!==d){c(t);const e="object"==typeof n&&n[t]||ie[t]||12;p(e),null==i||i(t,e)}},t=()=>{b.current&&clearTimeout(b.current),b.current=setTimeout(e,150)};if(e(),void 0===a)return window.addEventListener("resize",t),()=>{window.removeEventListener("resize",t),b.current&&clearTimeout(b.current)};e()}),[d,n,g,i,a,m]),t.useEffect((()=>{i&&i(d,u)}),[]);const f=r[d]||[];return e.jsx(ne,{...l,items:f,cols:u,onLayoutChange:e=>{const t={...r,[d]:e};null==s||s(e,t)}})},exports.WidthProvider=function(r){return function(o){const{measureBeforeMount:n=!1,...s}=o,[i,a]=t.useState(n?void 0:1280),l=t.useRef(null),d=t.useRef(!1);return t.useEffect((()=>{d.current=!0;const e=()=>{const e=l.current;if(!e)return;const t=e.offsetWidth;a(t)};n||e();let t=null;return l.current&&"ResizeObserver"in window?(t=new ResizeObserver(e),t.observe(l.current)):window.addEventListener("resize",e),()=>{d.current=!1,t?t.disconnect():window.removeEventListener("resize",e)}}),[n]),n&&void 0===i?e.jsx("div",{ref:l,style:{width:"100%"}}):e.jsx("div",{ref:l,style:{width:"100%"},children:e.jsx(r,{...s,width:i})})}},exports.calculateGridPosition=Q,exports.checkCollision=_,exports.cn=q,exports.compactLayout=K,exports.findFreeSpace=function(e,t,r,o){const n=o?e.filter((e=>e.id!==o)):e;if(!n.some((e=>_(t,e))))return t;let s=t.y;for(;;){for(let e=0;e<=r-t.w;e++){const r={...t,x:e,y:s};if(!n.some((e=>_(r,e))))return r}s++}},exports.generateLayouts=function(e,t=["lg","md","sm","xs","xxs"]){return t.reduce(((t,r)=>(t[r]=e.map((e=>({...e}))),t)),{})},exports.generateResponsiveLayouts=function(e,t={lg:12,md:10,sm:6,xs:4,xxs:2}){const r={};return Object.entries(t).forEach((([t,o])=>{r[t]=e.map((e=>{const t=Math.min(e.w,o),r=e.x+t>o?o-t:e.x;return{...e,w:t,x:r}}))})),r},exports.getAllCollisions=te,exports.getPixelPosition=U,exports.moveItems=ee;
2
+ //# sourceMappingURL=index.cjs.map