react-grid-layout 1.5.3 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (95) hide show
  1. package/README.md +1074 -432
  2. package/css/styles.css +6 -4
  3. package/dist/ResponsiveGridLayout-CH4s0tKj.d.ts +124 -0
  4. package/dist/ResponsiveGridLayout-D6lFRE3f.d.mts +124 -0
  5. package/dist/calculate-CwYDW8na.d.mts +168 -0
  6. package/dist/calculate-mgLpNJ5O.d.ts +168 -0
  7. package/dist/chunk-2KUHNJXF.mjs +90 -0
  8. package/dist/chunk-2KUHNJXF.mjs.map +1 -0
  9. package/dist/chunk-3WO4SAYB.js +868 -0
  10. package/dist/chunk-3WO4SAYB.js.map +1 -0
  11. package/dist/chunk-4HNUMWQK.mjs +822 -0
  12. package/dist/chunk-4HNUMWQK.mjs.map +1 -0
  13. package/dist/chunk-BFTKGAP3.js +1309 -0
  14. package/dist/chunk-BFTKGAP3.js.map +1 -0
  15. package/dist/chunk-F6NQPYKT.js +98 -0
  16. package/dist/chunk-F6NQPYKT.js.map +1 -0
  17. package/dist/chunk-H5KMDLY3.js +434 -0
  18. package/dist/chunk-H5KMDLY3.js.map +1 -0
  19. package/dist/chunk-PBQSHIID.js +4 -0
  20. package/dist/chunk-PBQSHIID.js.map +1 -0
  21. package/dist/chunk-R35HZZTA.mjs +1300 -0
  22. package/dist/chunk-R35HZZTA.mjs.map +1 -0
  23. package/dist/chunk-ZCXE6SR5.mjs +428 -0
  24. package/dist/chunk-ZCXE6SR5.mjs.map +1 -0
  25. package/dist/chunk-ZWN22PS2.mjs +3 -0
  26. package/dist/chunk-ZWN22PS2.mjs.map +1 -0
  27. package/dist/core.d.mts +33 -0
  28. package/dist/core.d.ts +33 -0
  29. package/dist/core.js +218 -0
  30. package/dist/core.js.map +1 -0
  31. package/dist/core.mjs +5 -0
  32. package/dist/core.mjs.map +1 -0
  33. package/dist/extras.d.mts +78 -0
  34. package/dist/extras.d.ts +78 -0
  35. package/dist/extras.js +91 -0
  36. package/dist/extras.js.map +1 -0
  37. package/dist/extras.mjs +89 -0
  38. package/dist/extras.mjs.map +1 -0
  39. package/dist/index.d.mts +7 -0
  40. package/dist/index.d.ts +7 -0
  41. package/dist/index.js +154 -0
  42. package/dist/index.js.map +1 -0
  43. package/dist/index.mjs +7 -0
  44. package/dist/index.mjs.map +1 -0
  45. package/dist/legacy.d.mts +163 -0
  46. package/dist/legacy.d.ts +163 -0
  47. package/dist/legacy.js +319 -0
  48. package/dist/legacy.js.map +1 -0
  49. package/dist/legacy.mjs +307 -0
  50. package/dist/legacy.mjs.map +1 -0
  51. package/dist/position-BmN1z36J.d.mts +319 -0
  52. package/dist/position-Dk2b4ZMS.d.ts +319 -0
  53. package/dist/react.d.mts +351 -0
  54. package/dist/react.d.ts +351 -0
  55. package/dist/react.js +96 -0
  56. package/dist/react.js.map +1 -0
  57. package/dist/react.mjs +7 -0
  58. package/dist/react.mjs.map +1 -0
  59. package/dist/responsive-C4L1ESlm.d.ts +145 -0
  60. package/dist/responsive-CJxefsYw.d.mts +145 -0
  61. package/dist/types-Cxf4nHNr.d.mts +375 -0
  62. package/dist/types-Cxf4nHNr.d.ts +375 -0
  63. package/index-dev.js +8 -0
  64. package/package.json +132 -40
  65. package/.babelrc.js +0 -22
  66. package/.browserslistrc +0 -3
  67. package/.eslintignore +0 -4
  68. package/.flowconfig +0 -20
  69. package/.prettierignore +0 -4
  70. package/.prettierrc +0 -17
  71. package/CHANGELOG.md +0 -985
  72. package/build/GridItem.js +0 -638
  73. package/build/ReactGridLayout.js +0 -741
  74. package/build/ReactGridLayoutPropTypes.js +0 -210
  75. package/build/ResponsiveReactGridLayout.js +0 -297
  76. package/build/calculateUtils.js +0 -165
  77. package/build/components/WidthProvider.js +0 -115
  78. package/build/fastRGLPropsEqual.js +0 -5
  79. package/build/responsiveUtils.js +0 -101
  80. package/build/utils.js +0 -842
  81. package/dist/react-grid-layout.min.js +0 -2
  82. package/dist/react-grid-layout.min.js.map +0 -1
  83. package/index.js.flow +0 -8
  84. package/ip_fetcher +0 -0
  85. package/ip_fetcher.c +0 -47
  86. package/lib/GridItem.jsx +0 -689
  87. package/lib/ReactGridLayout.jsx +0 -855
  88. package/lib/ReactGridLayoutPropTypes.js +0 -241
  89. package/lib/ResponsiveReactGridLayout.jsx +0 -349
  90. package/lib/calculateUtils.js +0 -169
  91. package/lib/components/WidthProvider.jsx +0 -110
  92. package/lib/fastRGLPropsEqual.js +0 -46
  93. package/lib/responsiveUtils.js +0 -118
  94. package/lib/utils.js +0 -995
  95. package/yarn-error.log +0 -7780
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/legacy/ReactGridLayout.tsx","../src/legacy/ResponsiveReactGridLayout.tsx","../src/react/components/WidthProvider.tsx"],"names":["jsx","node"],"mappings":";;;;;;;AAkHA,SAAS,gBAAgB,KAAA,EAAmC;AAC1D,EAAA,MAAM;AAAA;AAAA,IAEJ,QAAA;AAAA,IACA,KAAA;AAAA;AAAA,IAGA,IAAA,GAAO,EAAA;AAAA,IACP,SAAA,GAAY,GAAA;AAAA,IACZ,OAAA,GAAU,QAAA;AAAA,IACV,MAAA,GAAS,CAAC,EAAA,EAAI,EAAE,CAAA;AAAA,IAChB,gBAAA,GAAmB,IAAA;AAAA;AAAA,IAGnB,MAAA;AAAA,IACA,YAAA;AAAA;AAAA,IAGA,WAAA,EAAa,eAAA;AAAA,IACb,gBAAA,GAAmB,KAAA;AAAA,IACnB,YAAA,GAAe,KAAA;AAAA,IACf,eAAA;AAAA;AAAA,IAGA,WAAA,GAAc,IAAA;AAAA,IACd,SAAA,GAAY,KAAA;AAAA,IACZ,eAAA;AAAA,IACA,eAAA;AAAA;AAAA,IAGA,WAAA,GAAc,IAAA;AAAA,IACd,aAAA,GAAgB,CAAC,IAAI,CAAA;AAAA,IACrB,YAAA;AAAA;AAAA,IAGA,WAAA,GAAc,KAAA;AAAA;AAAA,IAGd,gBAAA,GAAmB,IAAA;AAAA,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A,QACA,KAAA;AAAA,QACC,GAAI,IAAA;AAAA,QACL;AAAA;AAAA,KACF;AAAA,EAEJ;AAEA,EAAA,oBAAA,CAAqB,cAAc,CAAA,cAAA,EAAiB,iBAAA,CAAkB,WAAA,IAAe,iBAAA,CAAkB,QAAQ,WAAW,CAAA,CAAA,CAAA;AAE1H,EAAA,OAAO,oBAAA;AACT","file":"legacy.mjs","sourcesContent":["/**\n * Legacy ReactGridLayout wrapper\n *\n * This component wraps the new TypeScript GridLayout to provide\n * backwards compatibility with the v1 API by converting flat props\n * to the new composable interface format.\n */\n\nimport React from \"react\";\nimport {\n GridLayout,\n type GridLayoutProps\n} from \"../react/components/GridLayout.js\";\nimport type {\n Layout,\n LayoutItem,\n CompactType,\n ResizeHandleAxis,\n GridConfig,\n DragConfig,\n ResizeConfig,\n DropConfig,\n PositionStrategy\n} from \"../core/types.js\";\nimport { getCompactor } from \"../core/compactors.js\";\nimport {\n transformStrategy,\n absoluteStrategy,\n createScaledStrategy\n} from \"../core/position.js\";\n\n// ============================================================================\n// Legacy Props Interface\n// ============================================================================\n\n/**\n * Legacy props interface for backwards compatibility with v1 API.\n * These flat props are converted to composable interfaces internally.\n */\nexport interface LegacyReactGridLayoutProps {\n // Required\n children: React.ReactNode;\n width: number;\n\n // Grid measurement (→ gridConfig)\n cols?: number;\n rowHeight?: number;\n maxRows?: number;\n margin?: readonly [number, number];\n containerPadding?: readonly [number, number] | null;\n\n // Layout data\n layout?: Layout;\n droppingItem?: LayoutItem;\n\n // Compaction (→ compactor)\n compactType?: CompactType;\n preventCollision?: boolean;\n allowOverlap?: boolean;\n /** @deprecated Use compactType instead */\n verticalCompact?: boolean;\n\n // Drag behavior (→ dragConfig)\n isDraggable?: boolean;\n isBounded?: boolean;\n draggableHandle?: string;\n draggableCancel?: string;\n\n // Resize behavior (→ resizeConfig)\n isResizable?: boolean;\n resizeHandles?: ResizeHandleAxis[];\n resizeHandle?:\n | React.ReactElement\n | ((\n axis: ResizeHandleAxis,\n ref: React.Ref<HTMLElement>\n ) => React.ReactElement);\n\n // Drop behavior (→ dropConfig)\n isDroppable?: boolean;\n\n // Position (→ positionStrategy)\n useCSSTransforms?: boolean;\n transformScale?: number;\n\n // Container props (passed through)\n autoSize?: boolean;\n className?: string;\n style?: React.CSSProperties;\n innerRef?: React.Ref<HTMLDivElement>;\n\n // Callbacks (passed through)\n onLayoutChange?: (layout: Layout) => void;\n onDragStart?: GridLayoutProps[\"onDragStart\"];\n onDrag?: GridLayoutProps[\"onDrag\"];\n onDragStop?: GridLayoutProps[\"onDragStop\"];\n onResizeStart?: GridLayoutProps[\"onResizeStart\"];\n onResize?: GridLayoutProps[\"onResize\"];\n onResizeStop?: GridLayoutProps[\"onResizeStop\"];\n onDrop?: (layout: Layout, item: LayoutItem | undefined, e: Event) => void;\n onDropDragOver?: (\n e: React.DragEvent\n ) => { w?: number; h?: number } | false | void;\n}\n\n// ============================================================================\n// Component\n// ============================================================================\n\n/**\n * ReactGridLayout - Legacy wrapper component\n *\n * Converts v1 flat props to v2 composable interfaces for backwards compatibility.\n */\nfunction ReactGridLayout(props: LegacyReactGridLayoutProps) {\n const {\n // Required\n children,\n width,\n\n // Grid measurement\n cols = 12,\n rowHeight = 150,\n maxRows = Infinity,\n margin = [10, 10],\n containerPadding = null,\n\n // Layout data\n layout,\n droppingItem,\n\n // Compaction\n compactType: compactTypeProp,\n preventCollision = false,\n allowOverlap = false,\n verticalCompact,\n\n // Drag behavior\n isDraggable = true,\n isBounded = false,\n draggableHandle,\n draggableCancel,\n\n // Resize behavior\n isResizable = true,\n resizeHandles = [\"se\"],\n resizeHandle,\n\n // Drop behavior\n isDroppable = false,\n\n // Position\n useCSSTransforms = true,\n transformScale = 1,\n\n // Container props\n autoSize,\n className,\n style,\n innerRef,\n\n // Callbacks\n onLayoutChange,\n onDragStart,\n onDrag,\n onDragStop,\n onResizeStart,\n onResize,\n onResizeStop,\n onDrop,\n onDropDragOver\n } = props;\n\n // Handle deprecated verticalCompact prop\n let compactType: CompactType =\n compactTypeProp === undefined ? \"vertical\" : compactTypeProp;\n if (verticalCompact === false) {\n if (process.env[\"NODE_ENV\"] !== \"production\") {\n console.warn(\n \"`verticalCompact` on <ReactGridLayout> is deprecated and will be removed soon. \" +\n 'Use `compactType`: \"horizontal\" | \"vertical\" | null.'\n );\n }\n compactType = null;\n }\n\n // Convert flat props to composable interfaces\n\n const gridConfig: Partial<GridConfig> = {\n cols,\n rowHeight,\n maxRows,\n margin,\n containerPadding\n };\n\n const dragConfig: Partial<DragConfig> = {\n enabled: isDraggable,\n bounded: isBounded,\n handle: draggableHandle,\n cancel: draggableCancel\n };\n\n const resizeConfig: Partial<ResizeConfig> = {\n enabled: isResizable,\n handles: resizeHandles,\n handleComponent: resizeHandle\n };\n\n const dropConfig: Partial<DropConfig> = {\n enabled: isDroppable\n };\n\n // Build position strategy\n let positionStrategy: PositionStrategy;\n if (!useCSSTransforms) {\n positionStrategy = absoluteStrategy;\n } else if (transformScale !== 1) {\n positionStrategy = createScaledStrategy(transformScale);\n } else {\n positionStrategy = transformStrategy;\n }\n\n // Get compactor from type and options\n const compactor = getCompactor(compactType, allowOverlap, preventCollision);\n\n return (\n <GridLayout\n width={width}\n gridConfig={gridConfig}\n dragConfig={dragConfig}\n resizeConfig={resizeConfig}\n dropConfig={dropConfig}\n positionStrategy={positionStrategy}\n compactor={compactor}\n layout={layout}\n droppingItem={droppingItem}\n autoSize={autoSize}\n className={className}\n style={style}\n innerRef={innerRef}\n onLayoutChange={onLayoutChange}\n onDragStart={onDragStart}\n onDrag={onDrag}\n onDragStop={onDragStop}\n onResizeStart={onResizeStart}\n onResize={onResize}\n onResizeStop={onResizeStop}\n onDrop={onDrop}\n onDropDragOver={onDropDragOver}\n >\n {children}\n </GridLayout>\n );\n}\n\n// Static properties for backwards compatibility\nReactGridLayout.displayName = \"ReactGridLayout\";\n\nexport default ReactGridLayout;\nexport { ReactGridLayout };\n","/**\n * Legacy ResponsiveReactGridLayout wrapper\n *\n * This component wraps the new TypeScript ResponsiveGridLayout to provide\n * backwards compatibility with the v1 API by converting flat props\n * to the new composable interface format.\n */\n\nimport React from \"react\";\nimport {\n ResponsiveGridLayout,\n type ResponsiveGridLayoutProps\n} from \"../react/components/ResponsiveGridLayout.js\";\nimport type {\n Layout,\n LayoutItem,\n CompactType,\n Breakpoint,\n Breakpoints,\n ResponsiveLayouts,\n ResizeHandleAxis,\n DragConfig,\n ResizeConfig,\n DropConfig,\n PositionStrategy\n} from \"../core/types.js\";\nimport { getCompactor } from \"../core/compactors.js\";\nimport {\n transformStrategy,\n absoluteStrategy,\n createScaledStrategy\n} from \"../core/position.js\";\n\n// ============================================================================\n// Legacy Props Interface\n// ============================================================================\n\n/**\n * Legacy props interface for backwards compatibility with v1 API.\n * These flat props are converted to composable interfaces internally.\n */\nexport interface LegacyResponsiveReactGridLayoutProps<\n B extends Breakpoint = string\n> {\n // Required\n children: React.ReactNode;\n width: number;\n\n // Responsive-specific\n breakpoint?: B;\n breakpoints?: Breakpoints<B>;\n cols?: Breakpoints<B>;\n layouts?: ResponsiveLayouts<B>;\n onBreakpointChange?: (newBreakpoint: B, cols: number) => void;\n onLayoutChange?: (layout: Layout, layouts: ResponsiveLayouts<B>) => void;\n onWidthChange?: (\n containerWidth: number,\n margin: readonly [number, number],\n cols: number,\n containerPadding: readonly [number, number] | null\n ) => void;\n\n // Grid measurement\n rowHeight?: number;\n maxRows?: number;\n margin?:\n | readonly [number, number]\n | Partial<Record<B, readonly [number, number]>>;\n containerPadding?:\n | readonly [number, number]\n | Partial<Record<B, readonly [number, number] | null>>\n | null;\n\n // Layout data\n droppingItem?: LayoutItem;\n\n // Compaction (→ compactor)\n compactType?: CompactType;\n preventCollision?: boolean;\n allowOverlap?: boolean;\n /** @deprecated Use compactType instead */\n verticalCompact?: boolean;\n\n // Drag behavior (→ dragConfig)\n isDraggable?: boolean;\n isBounded?: boolean;\n draggableHandle?: string;\n draggableCancel?: string;\n\n // Resize behavior (→ resizeConfig)\n isResizable?: boolean;\n resizeHandles?: ResizeHandleAxis[];\n resizeHandle?:\n | React.ReactElement\n | ((\n axis: ResizeHandleAxis,\n ref: React.Ref<HTMLElement>\n ) => React.ReactElement);\n\n // Drop behavior (→ dropConfig)\n isDroppable?: boolean;\n\n // Position (→ positionStrategy)\n useCSSTransforms?: boolean;\n transformScale?: number;\n\n // Container props (passed through)\n autoSize?: boolean;\n className?: string;\n style?: React.CSSProperties;\n innerRef?: React.Ref<HTMLDivElement>;\n\n // Callbacks (passed through)\n onDragStart?: ResponsiveGridLayoutProps<B>[\"onDragStart\"];\n onDrag?: ResponsiveGridLayoutProps<B>[\"onDrag\"];\n onDragStop?: ResponsiveGridLayoutProps<B>[\"onDragStop\"];\n onResizeStart?: ResponsiveGridLayoutProps<B>[\"onResizeStart\"];\n onResize?: ResponsiveGridLayoutProps<B>[\"onResize\"];\n onResizeStop?: ResponsiveGridLayoutProps<B>[\"onResizeStop\"];\n onDrop?: (layout: Layout, item: LayoutItem | undefined, e: Event) => void;\n onDropDragOver?: (\n e: React.DragEvent\n ) => { w?: number; h?: number } | false | void;\n}\n\n// ============================================================================\n// Component\n// ============================================================================\n\n/**\n * ResponsiveReactGridLayout - Legacy wrapper component\n *\n * Converts v1 flat props to v2 composable interfaces for backwards compatibility.\n */\nfunction ResponsiveReactGridLayout<B extends Breakpoint = string>(\n props: LegacyResponsiveReactGridLayoutProps<B>\n) {\n const {\n // Required\n children,\n width,\n\n // Responsive-specific\n breakpoint,\n breakpoints,\n cols,\n layouts,\n onBreakpointChange,\n onLayoutChange,\n onWidthChange,\n\n // Grid measurement\n rowHeight,\n maxRows,\n margin,\n containerPadding,\n\n // Layout data\n droppingItem,\n\n // Compaction\n compactType: compactTypeProp,\n preventCollision = false,\n allowOverlap = false,\n verticalCompact,\n\n // Drag behavior\n isDraggable = true,\n isBounded = false,\n draggableHandle,\n draggableCancel,\n\n // Resize behavior\n isResizable = true,\n resizeHandles = [\"se\"],\n resizeHandle,\n\n // Drop behavior\n isDroppable = false,\n\n // Position\n useCSSTransforms = true,\n transformScale = 1,\n\n // Container props\n autoSize,\n className,\n style,\n innerRef,\n\n // Callbacks\n onDragStart,\n onDrag,\n onDragStop,\n onResizeStart,\n onResize,\n onResizeStop,\n onDrop,\n onDropDragOver\n } = props;\n\n // Handle deprecated verticalCompact prop\n let compactType: CompactType =\n compactTypeProp === undefined ? \"vertical\" : compactTypeProp;\n if (verticalCompact === false) {\n if (process.env[\"NODE_ENV\"] !== \"production\") {\n console.warn(\n \"`verticalCompact` on <ResponsiveReactGridLayout> is deprecated and will be removed soon. \" +\n 'Use `compactType`: \"horizontal\" | \"vertical\" | null.'\n );\n }\n compactType = null;\n }\n\n // Convert flat props to composable interfaces\n\n const dragConfig: Partial<DragConfig> = {\n enabled: isDraggable,\n bounded: isBounded,\n handle: draggableHandle,\n cancel: draggableCancel\n };\n\n const resizeConfig: Partial<ResizeConfig> = {\n enabled: isResizable,\n handles: resizeHandles,\n handleComponent: resizeHandle\n };\n\n const dropConfig: Partial<DropConfig> = {\n enabled: isDroppable\n };\n\n // Build position strategy\n let positionStrategy: PositionStrategy;\n if (!useCSSTransforms) {\n positionStrategy = absoluteStrategy;\n } else if (transformScale !== 1) {\n positionStrategy = createScaledStrategy(transformScale);\n } else {\n positionStrategy = transformStrategy;\n }\n\n // Get compactor from type and options\n const compactor = getCompactor(compactType, allowOverlap, preventCollision);\n\n return (\n <ResponsiveGridLayout<B>\n width={width}\n breakpoint={breakpoint}\n breakpoints={breakpoints}\n cols={cols}\n layouts={layouts}\n rowHeight={rowHeight}\n maxRows={maxRows}\n margin={margin}\n containerPadding={containerPadding}\n compactor={compactor}\n dragConfig={dragConfig}\n resizeConfig={resizeConfig}\n dropConfig={dropConfig}\n positionStrategy={positionStrategy}\n droppingItem={droppingItem}\n autoSize={autoSize}\n className={className}\n style={style}\n innerRef={innerRef}\n onBreakpointChange={onBreakpointChange}\n onLayoutChange={onLayoutChange}\n onWidthChange={onWidthChange}\n onDragStart={onDragStart}\n onDrag={onDrag}\n onDragStop={onDragStop}\n onResizeStart={onResizeStart}\n onResize={onResize}\n onResizeStop={onResizeStop}\n onDrop={onDrop}\n onDropDragOver={onDropDragOver}\n >\n {children}\n </ResponsiveGridLayout>\n );\n}\n\n// Static properties for backwards compatibility\nResponsiveReactGridLayout.displayName = \"ResponsiveReactGridLayout\";\n\nexport default ResponsiveReactGridLayout;\nexport { ResponsiveReactGridLayout, ResponsiveReactGridLayout as Responsive };\n","/**\n * WidthProvider HOC\n *\n * A Higher-Order Component that provides width measurement to grid layouts.\n * This wraps any component and provides the container width as a prop.\n */\n\nimport React, { useState, useRef, useEffect, type ComponentType } from \"react\";\nimport clsx from \"clsx\";\n\n// ============================================================================\n// Types\n// ============================================================================\n\nexport interface WidthProviderProps {\n /** If true, will not render children until mounted */\n measureBeforeMount?: boolean;\n /** Additional class name */\n className?: string;\n /** Additional styles */\n style?: React.CSSProperties;\n}\n\ntype WithWidthProps<P> = Omit<P, \"width\"> & WidthProviderProps;\n\n// ============================================================================\n// Constants\n// ============================================================================\n\nconst layoutClassName = \"react-grid-layout\";\n\n// ============================================================================\n// WidthProvider HOC\n// ============================================================================\n\n/**\n * WidthProvider - HOC that provides container width\n *\n * A simple HOC that provides facility for listening to container resizes.\n * Wraps the provided component and passes down a `width` prop.\n *\n * @example\n * ```tsx\n * import { GridLayout, WidthProvider } from 'react-grid-layout';\n *\n * const GridLayoutWithWidth = WidthProvider(GridLayout);\n *\n * function MyGrid() {\n * return (\n * <GridLayoutWithWidth cols={12} rowHeight={30}>\n * <div key=\"a\">a</div>\n * </GridLayoutWithWidth>\n * );\n * }\n * ```\n */\nexport function WidthProvider<P extends { width: number }>(\n ComposedComponent: ComponentType<P>\n): ComponentType<WithWidthProps<P>> {\n function WidthProviderWrapper(props: WithWidthProps<P>) {\n const { measureBeforeMount = false, className, style, ...rest } = props;\n\n const [width, setWidth] = useState(1280);\n const [mounted, setMounted] = useState(false);\n const elementRef = useRef<HTMLDivElement>(null);\n const resizeObserverRef = useRef<ResizeObserver | null>(null);\n\n useEffect(() => {\n setMounted(true);\n\n // Set up ResizeObserver\n resizeObserverRef.current = new ResizeObserver(entries => {\n const node = elementRef.current;\n if (node instanceof HTMLElement && entries[0]) {\n const newWidth = entries[0].contentRect.width;\n setWidth(newWidth);\n }\n });\n\n const node = elementRef.current;\n if (node instanceof HTMLElement) {\n resizeObserverRef.current.observe(node);\n }\n\n return () => {\n if (node instanceof HTMLElement && resizeObserverRef.current) {\n resizeObserverRef.current.unobserve(node);\n }\n resizeObserverRef.current?.disconnect();\n };\n }, []);\n\n // If measureBeforeMount is true and not yet mounted, render placeholder\n if (measureBeforeMount && !mounted) {\n return (\n <div\n className={clsx(className, layoutClassName)}\n style={style}\n ref={elementRef}\n />\n );\n }\n\n return (\n <ComposedComponent\n innerRef={elementRef}\n className={className}\n style={style}\n {...(rest as unknown as P)}\n width={width}\n />\n );\n }\n\n WidthProviderWrapper.displayName = `WidthProvider(${ComposedComponent.displayName || ComposedComponent.name || \"Component\"})`;\n\n return WidthProviderWrapper;\n}\n\nexport default WidthProvider;\n"]}
@@ -0,0 +1,319 @@
1
+ import { L as Layout, a as LayoutItem, C as CompactType, M as Mutable, c as Compactor, P as Position, d as ResizeHandleAxis, i as PositionStrategy } from './types-Cxf4nHNr.mjs';
2
+
3
+ /**
4
+ * Core layout manipulation utilities.
5
+ *
6
+ * These functions create, modify, and query grid layouts.
7
+ * All functions treat layouts as immutable - they return new arrays/objects.
8
+ */
9
+
10
+ /**
11
+ * Get the bottom-most Y coordinate of the layout.
12
+ *
13
+ * This is the Y position plus height of the lowest item.
14
+ *
15
+ * @param layout - Layout to measure
16
+ * @returns The bottom Y coordinate (0 if layout is empty)
17
+ */
18
+ declare function bottom(layout: Layout): number;
19
+ /**
20
+ * Get a layout item by its ID.
21
+ *
22
+ * @param layout - Layout to search
23
+ * @param id - Item ID to find
24
+ * @returns The layout item, or undefined if not found
25
+ */
26
+ declare function getLayoutItem(layout: Layout, id: string): LayoutItem | undefined;
27
+ /**
28
+ * Get all static items from the layout.
29
+ *
30
+ * Static items cannot be moved or resized by the user.
31
+ *
32
+ * @param layout - Layout to filter
33
+ * @returns Array of static layout items
34
+ */
35
+ declare function getStatics(layout: Layout): LayoutItem[];
36
+ /**
37
+ * Clone a layout item.
38
+ *
39
+ * Creates a shallow copy with all properties preserved.
40
+ * Boolean properties are normalized (undefined becomes false).
41
+ *
42
+ * @param layoutItem - Item to clone
43
+ * @returns A new layout item with the same properties
44
+ */
45
+ declare function cloneLayoutItem(layoutItem: LayoutItem): LayoutItem;
46
+ /**
47
+ * Clone an entire layout.
48
+ *
49
+ * Creates a new array with cloned items.
50
+ *
51
+ * @param layout - Layout to clone
52
+ * @returns A new layout with cloned items
53
+ */
54
+ declare function cloneLayout(layout: Layout): LayoutItem[];
55
+ /**
56
+ * Replace a layout item in a layout.
57
+ *
58
+ * Returns a new layout with the item replaced. Other items are not cloned.
59
+ *
60
+ * @param layout - Layout to modify
61
+ * @param layoutItem - New item (matched by `i` property)
62
+ * @returns New layout with the item replaced
63
+ */
64
+ declare function modifyLayout(layout: Layout, layoutItem: LayoutItem): LayoutItem[];
65
+ /**
66
+ * Apply a transformation to a layout item.
67
+ *
68
+ * Finds the item by key, clones it, applies the callback, and returns
69
+ * a new layout with the modified item.
70
+ *
71
+ * @param layout - Layout to modify
72
+ * @param itemKey - Key of the item to modify
73
+ * @param cb - Callback that receives the cloned item and returns the modified item
74
+ * @returns Tuple of [new layout, modified item or null if not found]
75
+ */
76
+ declare function withLayoutItem(layout: Layout, itemKey: string, cb: (item: LayoutItem) => LayoutItem): [LayoutItem[], LayoutItem | null];
77
+ /**
78
+ * Ensure all layout items fit within the grid bounds.
79
+ *
80
+ * - Items overflowing right are moved left
81
+ * - Items overflowing left are moved to x=0 and clamped to grid width
82
+ * - Static items that collide with other statics are moved down
83
+ *
84
+ * **IMPORTANT**: This function mutates the layout items in place for performance.
85
+ * The type signature uses `Mutable<LayoutItem>[]` to make this explicit.
86
+ * Clone the layout first (e.g., with `cloneLayout()`) if you need immutability.
87
+ *
88
+ * @param layout - Layout to correct (items WILL be mutated)
89
+ * @param bounds - Grid bounds
90
+ * @returns The same layout array (for chaining)
91
+ */
92
+ declare function correctBounds(layout: Mutable<LayoutItem>[], bounds: {
93
+ cols: number;
94
+ }): LayoutItem[];
95
+ /**
96
+ * Move a layout element to a new position.
97
+ *
98
+ * Handles collision detection and cascading movements.
99
+ * Does not compact the layout - call `compact()` separately.
100
+ *
101
+ * **Note**: This function mutates the `l` parameter directly for performance.
102
+ * The item's x, y, and moved properties will be modified. Callers should
103
+ * ideally pass a cloned item if they need to preserve the original.
104
+ *
105
+ * @param layout - Full layout
106
+ * @param l - Item to move (will be mutated)
107
+ * @param x - New X position (or undefined to keep current)
108
+ * @param y - New Y position (or undefined to keep current)
109
+ * @param isUserAction - True if this is a direct user action (affects collision resolution)
110
+ * @param preventCollision - True to prevent movement if it causes collision
111
+ * @param compactType - Compaction type for collision resolution
112
+ * @param cols - Number of columns in the grid
113
+ * @param allowOverlap - True to allow items to overlap
114
+ * @returns The updated layout
115
+ */
116
+ declare function moveElement(layout: Layout, l: LayoutItem, x: number | undefined, y: number | undefined, isUserAction: boolean | undefined, preventCollision: boolean | undefined, compactType: CompactType, cols: number, allowOverlap?: boolean): LayoutItem[];
117
+ /**
118
+ * Move an item away from a collision.
119
+ *
120
+ * Attempts to move the item up/left first if there's room,
121
+ * otherwise moves it down/right.
122
+ *
123
+ * @param layout - Full layout
124
+ * @param collidesWith - The item being collided with
125
+ * @param itemToMove - The item to move away
126
+ * @param isUserAction - True if this is a direct user action
127
+ * @param compactType - Compaction type
128
+ * @param cols - Number of columns
129
+ * @returns Updated layout
130
+ */
131
+ declare function moveElementAwayFromCollision(layout: Layout, collidesWith: LayoutItem, itemToMove: LayoutItem, isUserAction: boolean | undefined, compactType: CompactType, cols: number): LayoutItem[];
132
+ /**
133
+ * Validate that a layout has the required properties.
134
+ *
135
+ * @param layout - Layout to validate
136
+ * @param contextName - Name for error messages
137
+ * @throws Error if layout is invalid
138
+ */
139
+ declare function validateLayout(layout: Layout, contextName?: string): void;
140
+
141
+ /**
142
+ * Compactor implementations.
143
+ *
144
+ * Compactors are pluggable strategies for removing gaps between grid items.
145
+ * Use the Compactor interface to create custom compaction algorithms.
146
+ */
147
+
148
+ /**
149
+ * Resolve a compaction collision by moving items.
150
+ *
151
+ * Before moving an item to a position, checks if that movement would
152
+ * cause collisions and recursively moves those items first.
153
+ *
154
+ * Useful for implementing custom compactors.
155
+ *
156
+ * @param layout - Full layout (must be sorted for optimization)
157
+ * @param item - Item being moved (will be mutated)
158
+ * @param moveToCoord - Target coordinate
159
+ * @param axis - Which axis to move on ('x' or 'y')
160
+ */
161
+ declare function resolveCompactionCollision(layout: Layout, item: LayoutItem, moveToCoord: number, axis: "x" | "y"): void;
162
+ /**
163
+ * Compact a single item vertically (move up).
164
+ *
165
+ * Moves the item as far up as possible without colliding.
166
+ * Useful for implementing custom vertical compactors.
167
+ *
168
+ * @param compareWith - Items to check for collisions
169
+ * @param l - Item to compact (will be mutated)
170
+ * @param fullLayout - Full layout for collision resolution
171
+ * @param maxY - Maximum Y to start from
172
+ * @returns The compacted item
173
+ */
174
+ declare function compactItemVertical(compareWith: Layout, l: LayoutItem, fullLayout: Layout, maxY: number): LayoutItem;
175
+ /**
176
+ * Compact a single item horizontally (move left).
177
+ *
178
+ * Moves the item as far left as possible without colliding.
179
+ * Wraps to the next row if it overflows.
180
+ * Useful for implementing custom horizontal compactors.
181
+ *
182
+ * @param compareWith - Items to check for collisions
183
+ * @param l - Item to compact (will be mutated)
184
+ * @param cols - Number of columns in the grid
185
+ * @param fullLayout - Full layout for collision resolution
186
+ * @returns The compacted item
187
+ */
188
+ declare function compactItemHorizontal(compareWith: Layout, l: LayoutItem, cols: number, fullLayout: Layout): LayoutItem;
189
+ /**
190
+ * Vertical compactor - moves items up to fill gaps.
191
+ *
192
+ * Items are sorted by row then column, and each item is moved
193
+ * as far up as possible without overlapping other items.
194
+ *
195
+ * This is the default compaction mode for react-grid-layout.
196
+ */
197
+ declare const verticalCompactor: Compactor;
198
+ /**
199
+ * Horizontal compactor - moves items left to fill gaps.
200
+ *
201
+ * Items are sorted by column then row, and each item is moved
202
+ * as far left as possible without overlapping other items.
203
+ */
204
+ declare const horizontalCompactor: Compactor;
205
+ /**
206
+ * No compaction - items stay where placed.
207
+ *
208
+ * Use this for free-form layouts where items can be placed anywhere.
209
+ * Items will not automatically move to fill gaps.
210
+ */
211
+ declare const noCompactor: Compactor;
212
+ /**
213
+ * Vertical compactor that allows overlapping items.
214
+ *
215
+ * Items compact upward but are allowed to overlap each other.
216
+ * Useful for layered layouts or when collision detection is handled externally.
217
+ */
218
+ declare const verticalOverlapCompactor: Compactor;
219
+ /**
220
+ * Horizontal compactor that allows overlapping items.
221
+ */
222
+ declare const horizontalOverlapCompactor: Compactor;
223
+ /**
224
+ * Get a compactor by type.
225
+ *
226
+ * This is a convenience function for backwards compatibility with the
227
+ * string-based compactType API.
228
+ *
229
+ * @param compactType - 'vertical', 'horizontal', or null
230
+ * @param allowOverlap - Whether to allow overlapping items
231
+ * @returns The appropriate Compactor
232
+ */
233
+ declare function getCompactor(compactType: "vertical" | "horizontal" | null, allowOverlap?: boolean, preventCollision?: boolean): Compactor;
234
+
235
+ /**
236
+ * Position calculation utilities.
237
+ *
238
+ * These functions convert between grid units and pixel positions,
239
+ * and generate CSS styles for grid items.
240
+ */
241
+
242
+ /**
243
+ * Generate CSS transform-based positioning styles.
244
+ *
245
+ * Using transforms is more performant than top/left positioning
246
+ * because it doesn't trigger layout recalculations.
247
+ *
248
+ * @param position - Position in pixels
249
+ * @returns CSS style object
250
+ */
251
+ declare function setTransform({ top, left, width, height }: Position): Record<string, string>;
252
+ /**
253
+ * Generate CSS top/left positioning styles.
254
+ *
255
+ * Use this when transforms are not suitable (e.g., for printing
256
+ * or when transform causes issues with child elements).
257
+ *
258
+ * @param position - Position in pixels
259
+ * @returns CSS style object
260
+ */
261
+ declare function setTopLeft({ top, left, width, height }: Position): Record<string, string>;
262
+ /**
263
+ * Convert a number to a percentage string.
264
+ *
265
+ * @param num - Number to convert (0-1 range typically)
266
+ * @returns Percentage string (e.g., "50%")
267
+ */
268
+ declare function perc(num: number): string;
269
+ /**
270
+ * Resize an item in a specific direction, clamping to container bounds.
271
+ *
272
+ * This handles the complex logic of resizing from different edges/corners,
273
+ * ensuring the item doesn't overflow the container.
274
+ *
275
+ * @param direction - Which edge/corner is being dragged
276
+ * @param currentSize - Current position and size
277
+ * @param newSize - Requested new position and size
278
+ * @param containerWidth - Width of the container
279
+ * @returns Constrained position and size
280
+ */
281
+ declare function resizeItemInDirection(direction: ResizeHandleAxis, currentSize: Position, newSize: Position, containerWidth: number): Position;
282
+ /**
283
+ * CSS transform-based positioning strategy.
284
+ *
285
+ * Uses CSS transforms for positioning, which is more performant
286
+ * as it doesn't trigger layout recalculations.
287
+ *
288
+ * This is the default strategy.
289
+ */
290
+ declare const transformStrategy: PositionStrategy;
291
+ /**
292
+ * Absolute (top/left) positioning strategy.
293
+ *
294
+ * Uses CSS top/left for positioning. Use this when CSS transforms
295
+ * cause issues (e.g., printing, certain child element positioning).
296
+ */
297
+ declare const absoluteStrategy: PositionStrategy;
298
+ /**
299
+ * Create a scaled transform strategy.
300
+ *
301
+ * Use this when the grid container is inside a scaled element
302
+ * (e.g., `transform: scale(0.5)`). The scale factor adjusts
303
+ * drag/resize calculations to account for the parent transform.
304
+ *
305
+ * @param scale - Scale factor (e.g., 0.5 for half size)
306
+ * @returns Position strategy with scaled calculations
307
+ *
308
+ * @example
309
+ * ```tsx
310
+ * <div style={{ transform: 'scale(0.5)' }}>
311
+ * <GridLayout positionStrategy={createScaledStrategy(0.5)} />
312
+ * </div>
313
+ * ```
314
+ */
315
+ declare function createScaledStrategy(scale: number): PositionStrategy;
316
+ /** Default position strategy (transform-based) */
317
+ declare const defaultPositionStrategy: PositionStrategy;
318
+
319
+ export { createScaledStrategy as A, defaultPositionStrategy as B, cloneLayoutItem as a, bottom as b, cloneLayout as c, getCompactor as d, verticalCompactor as e, setTopLeft as f, getLayoutItem as g, horizontalCompactor as h, getStatics as i, modifyLayout as j, correctBounds as k, moveElementAwayFromCollision as l, moveElement as m, noCompactor as n, verticalOverlapCompactor as o, horizontalOverlapCompactor as p, compactItemVertical as q, resolveCompactionCollision as r, setTransform as s, compactItemHorizontal as t, perc as u, validateLayout as v, withLayoutItem as w, resizeItemInDirection as x, transformStrategy as y, absoluteStrategy as z };