declare module 'react-data-grid' {
  export interface FormatterProps<TRow = any, TSummaryRow = unknown> {
    row: TRow;
    column: Column<TRow, TSummaryRow>;
    isCellSelected: boolean;
    onRowChange: (row: TRow) => void;
    rowIdx: number;
  }

  export interface Column<TRow, TSummaryRow = unknown> {
    /** The name of the column. By default it will be displayed in the header cell */
    name: string | JSX.Element;
    /** A unique key to distinguish each column */
    key: string;
    /** Column width. If not specified, it will be determined automatically based on grid width and specified widths of other columns */
    width?: number | string;
    /** Minimum column width in px. */
    minWidth?: number;
    /** Maximum column width in px. */
    maxWidth?: number;
    cellClass?: string | ((row: TRow) => string);
    headerCellClass?: string;
    summaryCellClass?: string | ((row: TSummaryRow) => string);
    /** Formatter to be used to render the cell content */
    formatter?: React.ComponentType<FormatterProps<TRow, TSummaryRow>>;
    /** Formatter to be used to render the summary cell content */
    summaryFormatter?: React.ComponentType<FormatterProps<TRow, TSummaryRow>>;
    /** Formatter to be used to render the group cell content */
    groupFormatter?: React.ComponentType<FormatterProps<TRow, TSummaryRow>>;
    /** Enables cell editing. If set and no editor property specified, then a textinput will be used as the cell editor */
    editable?: boolean | ((row: TRow) => boolean);
    /** Enable filtering for this column */
    filterable?: boolean;
    /** Enable sorting for this column */
    sortable?: boolean;
    /** Sets the column sort order to be descending instead of ascending the first time the column is sorted */
    sortDescendingFirst?: boolean;
    /** Editor to be rendered when cell of column is being edited. If set, then the column is automatically set to be editable */
    editor?: React.ComponentType<any>;
    /** Header renderer for each header cell */
    headerRenderer?: React.ComponentType<any>;
    /** Component to be used to filter the data of the column */
    filterRenderer?: React.ComponentType<any>;
    /** Whether the column can be resized */
    resizable?: boolean;
    /** Whether the column is frozen (fixed position) */
    frozen?: boolean;
  }

  export interface SelectRowEvent<TRow> {
    row: TRow;
    checked: boolean;
    isShiftClick: boolean;
  }

  export interface RowSelectionHook {
    (): [boolean, (selectRowEvent: SelectRowEvent<any>) => void];
  }

  export const useRowSelection: RowSelectionHook;

  export interface DataGridProps<TRow, TSummaryRow = unknown> {
    /** Grid columns. */
    columns: readonly Column<TRow, TSummaryRow>[];
    /** An array of objects representing each row */
    rows: readonly TRow[];
    /** Rows to be pinned at the top of the rows view for summary */
    summaryRows?: readonly TSummaryRow[];
    /** Used to uniquely identify each row */
    rowKeyGetter?: (row: TRow) => React.Key;
    onRowsChange?: (rows: TRow[], data: any) => void;
    /** Function called whenever row data is updated */
    onRowChange?: (row: TRow, data: any) => void;
    /** Called when the grid is scrolled */
    onScroll?: (event: React.UIEvent<HTMLDivElement>) => void;
    /** Number of rows to render at a time */
    rowHeight?: number;
    /** Header row height */
    headerRowHeight?: number;
    /** Summary row height */
    summaryRowHeight?: number;
    /** Set of selected row keys */
    selectedRows?: ReadonlySet<React.Key>;
    /** Function called whenever row selection is changed */
    onSelectedRowsChange?: (selectedRows: Set<React.Key>) => void;
    /** Used to specify the height of the grid */
    height?: number;
    /** Used to specify the width of the grid */
    width?: number;
    /** Toggles whether cells should be autofocused when navigated to via keyboard */
    enableCellAutoFocus?: boolean;
    className?: string;
    style?: React.CSSProperties;
    /** Direction of the grid */
    direction?: 'ltr' | 'rtl';
  }

  const DataGrid: React.FC<DataGridProps<any, any>>;
  export default DataGrid;
} 