import * as React from 'react'; import { IconElement, OmitPolyfill } from '../common'; import { EllipsisCommonProps } from '../common/Ellipsis'; import {PropsWithChildren} from "react"; export type ListItemActionWithAsProp = | ListItemActionAsButtonProps | ListItemActionAsAnchorProps | ListItemActionGenericProps | ListItemActionAsComponentProps; type ListItemActionAsButtonProps< T > = React.ButtonHTMLAttributes & T & { as?: 'button'; onClick?: React.MouseEventHandler; }; type ListItemActionAsAnchorProps< T > = React.AnchorHTMLAttributes & T & { as: 'a'; onClick?: React.MouseEventHandler; }; type ListItemActionGenericProps = T & { as: keyof OmitPolyfill; onClick?: React.MouseEventHandler; [additionalProps: string]: any; }; type ListItemActionAsComponentProps = T & { as: React.ComponentType; onClick?: React.MouseEventHandler; [additionalProps: string]: any; }; export type ListItemActionProps = ListItemActionWithAsProp<{ title: string; dataHook?: string; skin?: ListItemActionSkin; size?: ListItemActionSize; prefixIcon?: IconElement; autoFocus?: boolean; ellipsis?: boolean; disabled?: boolean; tooltipModifiers?: EllipsisCommonProps; highlighted?: boolean; subtitle?: string; }>; export default class ListItemAction extends React.PureComponent> {} export type ListItemActionSkin = 'standard' | 'dark' | 'destructive'; export type ListItemActionSize = 'small' | 'medium'; export const listItemActionBuilder: < T extends Partial >(data: { title: string; id: string | number; prefixIcon?: IconElement; onClick?: React.MouseEventHandler; disabled?: boolean; skin?: ListItemActionSkin; size?: ListItemActionSize; dataHook?: string; as?: any; tabIndex?: number; autoFocus?: boolean; className?: string; ellipsis?: boolean; subtitle?: string; }) => { id: string | number; disabled: boolean | undefined; overrideOptionStyle: true; value: (props: T) => React.ReactNode; };