import type { RefCallback } from "react"; import type { PropsWithRef } from "../types"; /** * This is the css variable that is used store the current size of each cell. */ export declare const CELL_SIZE_VAR = "--rmd-cell-size"; /** * This is the css variable that is used store the current margin of each cell. */ export declare const CELL_MARGIN_VAR = "--rmd-cell-margin"; /** * @remarks \@since 2.3.0 */ export declare const DEFAULT_GRID_LIST_MAX_CELL_SIZE = 150; /** * @remarks \@since 2.3.0 */ export declare const DEFAULT_GRID_LIST_PADDING = 16; export interface GridListSize { /** * The current number of columns in the `GridList`. */ columns: number; /** * The current width of each cell within the grid. */ cellWidth: number; } /** * @remarks \@since 2.3.0 */ export declare const GridListSizeProvider: import("react").Provider; /** * Gets the current size of each cell within the `GridList` component. If this * is used without a parent `GridList` component, `-1` is returned instead. * * @remarks \@since 2.3.0 */ export declare function useGridListSize(): GridListSize; /** * @remarks \@since 2.3.0 */ export interface UseGridListOptions { /** * An optional style object to merge with the grid custom css properties * object. */ style?: React.CSSProperties; /** * An optional className to merge with the grid list class name */ className?: string; /** * Boolean if the recalculation of grid sizing should not happen for height * changes. */ disableHeight?: boolean; /** * Boolean if the recalculation of grid sizing should not happen for width * changes. */ disableWidth?: boolean; /** * An optional margin to apply to each cell as the `CELL_MARGIN_VAR` css * variable only when it is defined. This has to be a number string with a * `px`, `em`, `rem` or `%` suffix or else the grid will break. */ cellMargin?: string; /** * The max size that each cell can be. */ maxCellSize?: number; /** * Since the `GridList` requires being fully rendered in the DOM to be able to * correctly calculate the number of `columns` and `cellWidth`, this _might_ * cause problems when server-side rendering when using the children renderer * to create a grid list dynamically based on the number of columns. If the * number of columns and default `cellWidth` can be guessed server-side, you * should provide this prop. Otherwise it will be: * `{ cellSize; maxCellSize, columns: -1 }` */ defaultSize?: GridListSize | (() => GridListSize); /** * This is _normally_ the amount of padding on the grid list item itself to * subtract from the `offsetWidth` since `padding`, `border`, and vertical * scrollbars will be included. If you add a border or change the padding or * add borders to this component, you'll need to update the `containerPadding` * to be the new number. */ containerPadding?: number; } export interface ProvidedGridListProps { ref: RefCallback; style: CSSProperties; className: string; } declare type CSSProperties = React.CSSProperties & { [CELL_SIZE_VAR]: string; [CELL_MARGIN_VAR]?: string; }; export declare type UseGridListReturnValue = readonly [ ProvidedGridListProps, GridListSize ]; /** * The `useGridList` hook allows you to get all the grid and sizing * functionality of the `GridList` component without needing to wrap your * children in a `
` element. * * Example: * * ```tsx * const [gridListProps] = useGridList({ * cellMargin: 16, * maxCellSize: 300, * containerPadding: 4, * }); * * return
{children}
; * ``` * * Note: You must manually provide the `gridSize` to the `GridListSizeProvider` * component that was added in 2.3.0 if you want to use the `useGridSize` hook. * * Example: * * ```tsx * const [gridListProps, gridSize] = useGridList() * * return ( * * * * ); * ``` * * @remarks \@since 2.3.0 */ export declare function useGridList({ ref: propRef, style, className, cellMargin, defaultSize, maxCellSize, disableHeight, disableWidth, containerPadding, }?: PropsWithRef): UseGridListReturnValue; export {};