import React from 'react'; import PropTypes from 'prop-types'; import { PinnedColumnsProp, TableRequestMoveRowHandler } from '@splunk/react-ui/Table'; import { ComponentProps } from '../utils/types'; /** @public */ type RowActionPrimaryClickHandler = (event: React.MouseEvent, data?: any) => void; /** @public */ type RowActionSecondaryClickHandler = (event: React.MouseEvent, data?: any) => void; /** @public */ type RowClickHandler = (event: React.MouseEvent | React.KeyboardEvent, data?: any) => void; type RowRequestMoveRowHandler = TableRequestMoveRowHandler; type RowExpansionHandler = (event: React.MouseEvent | React.KeyboardEvent, data?: any) => void; /** @public */ type RowRequestExpansionHandler = (event: React.MouseEvent | React.KeyboardEvent, data?: any) => void; /** @public */ type RowRequestToggleHandler = (event: React.MouseEvent, data?: any) => void; interface RowPropsBase { /** @private. Generally passed by Table rather than added directly. */ activeElementId?: string; /** * Adds primary actions. For best results, use an icon-only button style. * The `onClick` handler of each action is passed the event and the `data` prop of this row. */ actionPrimary?: React.ReactElement; /** * Adds a secondary actions dropdown menu. This prop must be a `Menu`. * The `onClick` handler of each action is passed the event and the `data` prop of this row. */ actionsSecondary?: React.ReactElement; /** * Must be `Table.Cell`. */ children?: React.ReactNode; /** This data is returned with the onClick and toggle events as the second argument. */ data?: any; /** Indicates whether the row selection is disabled. */ disabled?: boolean; /** @private. Generally passed by Table rather than added directly. */ isDraggable?: boolean; /** @private. Generally passed by Table rather than added directly. */ dragId?: string | number; /** * A React ref which is set to the DOM element when the component mounts and null when it unmounts. */ elementRef?: React.Ref; /** @private. */ expandable?: boolean; /** * Allows row expansion to be controlled programmatically if the `rowExpansion` prop is set to `controlled` in `Table`. */ expanded?: boolean; /** * @private. Identifies the unique id (or ids) for an expanded row (or rows). In expandable rows `ExpansionRowIcon` uses `expansionRowId` for accessibility aria attributes. */ expansionRowIds?: string; /** * An optional row that is displayed when this row is expanded, or an array of rows. */ expansionRow?: React.ReactElement | React.ReactElement[]; /** @private. Indicates whether the table has an actions column. */ actions?: boolean; /** @private. Generally passed by `Table` rather than added directly. */ index?: number; /** @private. Generally passed by `Table` rather than added directly. */ movableColumns?: boolean; /** Providing an `onClick` handler enables focus, hover, and related styles. */ onClick?: RowClickHandler; /** * An event handler that triggers when the row expansion element is selected. */ onExpansion?: RowExpansionHandler; /** @private. This is passed through and works as expected. */ onKeyDown?: React.KeyboardEventHandler; /** @private. Generally passed by `Table` rather than added directly. */ onRequestMoveRow?: RowRequestMoveRowHandler; /** * An event handler for toggle of the row. resize of columns. The function is passed the event and the `data` prop for this row. */ onRequestToggle?: RowRequestToggleHandler; /** @private. */ pinnedColumns?: PinnedColumnsProp; /** * @private. Generally passed by Table rather than added directly. Indicates the column to use as the primary label for each row. */ primaryColumnIndex?: number; /** * Indicates the row's label when selected or unselected. */ rowScreenReaderText?: string; /** * When an `onRequestToggle` handler is defined, this prop determines the appearance * of the toggle. */ selected?: boolean; /** @private. */ stripe?: 'odd' | 'even' | 'none'; } type RowProps = ComponentProps; declare function Row({ actions, actionPrimary, actionsSecondary, children, data, dragId, disabled, pinnedColumns, isDraggable, elementRef, expandable, expanded, expansionRowIds, expansionRow, index, movableColumns, onClick, onExpansion, onKeyDown, onRequestToggle, primaryColumnIndex, rowScreenReaderText, selected, stripe, style, ...otherProps }: RowProps): React.JSX.Element; declare namespace Row { var propTypes: { /** @private. Generally passed by Table rather than added directly. */ activeElementId: PropTypes.Requireable; actionPrimary: PropTypes.Requireable; actionsSecondary: PropTypes.Requireable; children: PropTypes.Requireable; data: PropTypes.Requireable; disabled: PropTypes.Requireable; /** @private. Generally passed by Table rather than added directly. */ isDraggable: PropTypes.Requireable; /** @private. Generally passed by Table rather than added directly. */ dragId: PropTypes.Requireable>; elementRef: PropTypes.Requireable; /** @private. */ expandable: PropTypes.Requireable; expanded: PropTypes.Requireable; /** @private. Identifies the unique id (or ids) for an expanded row (or rows). In expandable rows `ExpansionRowIcon` uses `expansionRowId` for accessibility aria attributes. */ expansionRowIds: PropTypes.Requireable; expansionRow: PropTypes.Requireable>; /** @private. Indicates whether the table has an actions column. */ actions: PropTypes.Requireable; /** @private. Generally passed by `Table` rather than added directly. */ index: PropTypes.Requireable; /** @private. Generally passed by `Table` rather than added directly. */ movableColumns: PropTypes.Requireable; onClick: PropTypes.Requireable<(...args: any[]) => any>; onExpansion: PropTypes.Requireable<(...args: any[]) => any>; /** @private. This is passed through and works as expected. */ onKeyDown: PropTypes.Requireable<(...args: any[]) => any>; /** @private. Generally passed by `Table` rather than added directly. */ onRequestMoveRow: PropTypes.Requireable<(...args: any[]) => any>; onRequestToggle: PropTypes.Requireable<(...args: any[]) => any>; /** @private. */ pinnedColumns: PropTypes.Requireable; /** @private. Generally passed by `Table` rather than added directly. */ primaryColumnIndex: PropTypes.Requireable; rowScreenReaderText: PropTypes.Requireable; selected: PropTypes.Requireable; /** @private. */ stripe: PropTypes.Requireable; }; var splunkUiType: string; } export default Row; export { RowActionPrimaryClickHandler, RowActionSecondaryClickHandler, RowClickHandler, RowRequestExpansionHandler, RowRequestMoveRowHandler, RowRequestToggleHandler, RowExpansionHandler, };