import { type ReactNode } from 'react'; import type { CustomCellRendererProps } from 'ag-grid-react'; export interface ActionDef { /** Lucide-style icon node. */ icon: ReactNode; /** Accessible label — also used as the tooltip. */ label: string; /** Invoked with the row data. */ onClick: (data: TData) => void; /** Disable the action. Pass a predicate for per-row disablement. */ disabled?: boolean | ((data: TData) => boolean); /** Human-readable reason shown in the tooltip when disabled. */ disabledReason?: string; /** `destructive` swaps the button intent. */ variant?: 'default' | 'destructive'; /** Hide the action entirely. Pass a predicate for per-row hiding. */ hidden?: boolean | ((data: TData) => boolean); } export interface ActionsCellRendererParams { actions: ActionDef[]; /** Intent of the inline buttons / the collapsed trigger (default `ghost`). */ intent?: 'ghost' | 'outline'; /** * Render the inline buttons as a connected `IconButtonGroup` (a segmented * control) rather than a loose row. Requires `label` for the group name. */ group?: boolean; /** Accessible name for the group and the collapsed overflow trigger. */ label?: string; /** * Collapse the actions into a single "…" overflow menu instead of inline * buttons. Pass a getter to flip it at runtime — call * `api.refreshCells({ force: true })` after the underlying value changes so * the cells re-read it (this preserves column state, unlike rebuilding defs). */ collapsed?: boolean | (() => boolean); /** * Split button: keep the first `maxInline` visible actions as inline buttons * and fold the rest into a trailing "…" menu at the end of the row. The * column then needs `actionsColumnWidth(maxInline + 1)`. Ignored while * `collapsed`; `0` is the same as `collapsed`. */ maxInline?: number; } /** * Pixel width an actions column needs so `count` inline `sm` IconButtons (32px * each — whether segmented via `group` or loose) plus the data-table cell's * inline padding never clip. AG Grid gives a column ONE width for every row, so * pass the TOTAL number of actions (the worst case where a single row shows them * all) — not the per-row visible count, which varies with `hidden` predicates. * * Use it as the column `width` so a fully-actioned row can't overflow: * * { * colId: 'actions', * cellRenderer: ActionsCellRenderer, * cellRendererParams: { actions, group: true }, * width: actionsColumnWidth(actions.length), * // minWidth stays at the collapsed footprint when `collapsed` is used. * } */ export declare function actionsColumnWidth(count: number): number; export declare function ActionsCellRenderer(props: CustomCellRendererProps & ActionsCellRendererParams): import("react/jsx-runtime").JSX.Element | null; //# sourceMappingURL=actions-cell-renderer.d.ts.map