import { type ReactElement } from 'react'; import { type Layout } from 'react-grid-layout'; import { type FlexProps } from '../../Flex'; import type { ForwardRefForwardPropsComponent } from '../../../types'; import type { GridBreakPoint, GridBreakPointWiseValues, GridLayoutModel } from './config'; /** * Returns a sorter function to apply on Grid children to ensure intuitive tabbing order * @param currentLayout - Layout objects at the current breakpoint * @param numColumns - Number of columns at the current breakpoint * @returns A sorter function to apply on Grid children */ export declare const useGridItemSorter: (currentLayout?: Layout[], numColumns?: number) => (a: ReactElement, b: ReactElement) => number; /** * Determines the current breakpoint and numColumns based on the given width. * Uses the same mechanism as React-grid-layout. * @param width - Container width * @param breakpoints - Breakpoint configuration * @param cols - Columns configured at different breakpoints * @returns Current breakpoint and # of columns */ export declare const getBreakpointAndCols: (width: number, breakpoints: GridBreakPointWiseValues, cols: GridBreakPointWiseValues) => { breakpoint: GridBreakPoint; numColumns: number; }; /** * Breakpoint-wise configuration for GridLayout rows * For each breakpoint, specify wither a fixed height(px) or # of rows to fit into container */ export type GridLayoutRowsProp = Partial>; /** * Determines the rowHeight to use based on auto-fit configuration. * Returns a static rowHeight & `rowsPerPage: null` if no auto-fit configuration specified for the current breakpoint. * @param breakpoint - Current breakpoint * @param parentHeight - Height of the container element * @param gap - Gutter size in pixels * @param rows - Rows configuration * @param layoutModel - Breakpoint-wise layout model * @param minRowHeightOverride - Optional minimum row height (px) that overrides the built-in defaults * @returns Row height in pixels */ export declare const getRowHeight: (breakpoint: GridBreakPoint, parentHeight: number, gap: number, rows: GridLayoutRowsProp, layoutModel: GridLayoutModel | undefined, minRowHeightOverride?: number) => { rowHeight: number; numRowsPerPage: number | null; }; /** * Checks the current layouts for any gaps between/around grid items. * @param layout - Layout objects at a given breakpoint * @param numColumns - # of columns at the breakpoint * @returns A flag indicating whether there are gaps */ export declare const checkLayoutForGaps: (layout: Layout[], numColumns: number) => boolean; /** * Sets up a ResizeObserver on the given element and returns a new size whenever the element is resized. * NOTE: The input element and the output can be null on load when the corresponding ref is yet to be initialized. * @param element - Element to monitor size * @param delay - Debounce delay for the observer * @returns The current size object for the element */ export declare const useMonitoredSize: (element: HTMLElement | null, delay?: number) => DOMRectReadOnly | null; /** * Creates an array from the range specified by the args. Supports both ascending and descending ranges * @param left - Left bound for the range * @param right - Right bound for the range * @param inclusive - Specifies whether the right bound should be included in the range * @returns - A new array */ export declare const getArrayFromRange: (left: number, right: number, inclusive: boolean) => number[]; /** * Check for a non-null existence of the prop. * @param obj - Target object. * @param prop - Target property. * @returns A boolean flag indicating the non-null existence of the property. */ export declare const hasNonNullProp: (obj: T, prop: P) => obj is Extract>; /** * Wraps the children around a Flex item, * that grows exactly into the remaining parent height/width (depending on flex direction), * regardless of the child content. * @component */ export declare const ParentFitFlexItem: ForwardRefForwardPropsComponent>; /** * Returns last items in layout, vertically * @param layout - Grid layout * @returns Last items in layout */ export declare const getLastItemsInLayout: (layout: Layout[] | undefined) => string[]; /** * This method converts the layout model from ltr to rtl * @param layout - current layoutModel * @param cols - numColumns on the Grid for each breakpoint * @returns rtl layout */ export declare const convertLtrToRtl: (layout: GridLayoutModel, cols: GridBreakPointWiseValues) => Partial>; //# sourceMappingURL=utils.d.ts.map