import { type FC, type ReactElement, type Ref } from 'react'; import { type CoreProps } from 'react-grid-layout'; import { type GridBreakPointWiseValues, type GridLayoutModel } from './config'; import { type GridLayoutRowsProp } from './utils'; export interface GridLayoutHandleValue { /** Used to get layout model with imperative handle. Returns the layout model from all breakpoints. Returns undefined when no children. */ getLayoutModel: () => GridLayoutModel | undefined; /** * Returns a flag indicating whether there are any gaps in the current layout. * Highlights all background cells to indicate the same. */ checkForGaps: () => boolean; } /** Props for GridLayoutEditor component */ export interface GridLayoutEditorProps { /** * Called whenever there's a change in the layoutModel. * Change-handler of the CONTROLLED COMPONENT */ onModelChange: (newModel: GridLayoutModel | undefined) => void; /** * Value of the CONTROLLED component * Passed when editing a previously saved layout. * Can be `undefined` when no children. * It should be the same as the one emitted by `getLayoutModel` or `handle` */ layoutModel: GridLayoutModel | undefined; /** * Breakpoints set on the Grid. * Needs to be aligned with `rows` and `cols` */ breakpoints: GridBreakPointWiseValues; /** * # of rows to fit into the container height at each breakpoint (unless a fixed rowHeight is preferred) * rows should be aligned with `breakpoints` prop */ rows: GridLayoutRowsProp; /** * Breakpoint-wise numColumns on the Grid. * cols should be aligned with `breakpoints` prop */ cols: GridBreakPointWiseValues; /** * If parent DOM node of ResponsiveReactGridLayout or ReactGridLayout has "transform: scale(n)" css property, * we should set scale coefficient to avoid render artifacts while dragging. */ transformScale?: CoreProps['transformScale']; /** Ref to access the editor state. Used to get the current layout-model when persisting it. */ handle?: Ref; /** * Child elements to be rendered as Grid items. * Each element should have a unique `key` * Memoize children for a better performance: https://github.com/react-grid-layout/react-grid-layout#performance * Set up an `itemLabel` prop with the text to call out when the item is focused. * If a child needs to be initialized with a specific x/y/w/h, * or if you want to specify any special properties like minW, minH, etc., * set up a `data-grid` in layoutModel prop with any subset of properties * The prop can be undefined on init when no elements. */ children?: ReactElement[]; /** Item label mapped with item id for a11y */ itemLabelMap: Record; /** * Optional minimum row height (px) to override the built-in defaults. * Useful when grid items contain content that requires more vertical space * than the default minimum (e.g. compact SimpleValue insights). */ minRowHeight?: number; } /** * Editor component to create Grid Layouts * @component */ declare const GridLayoutEditor: FC; export default GridLayoutEditor; //# sourceMappingURL=GridLayoutEditor.d.ts.map