@wix/design-system
Version:
@wix/design-system
81 lines • 3.71 kB
TypeScript
import * as React from 'react';
import { IconElement, TooltipCommonProps } from '../common';
import { PopoverMenuProps } from '../PopoverMenu';
import { ButtonPriority, ButtonWithAsProp } from '../Button';
import { IconButtonPriority, IconButtonSkin } from '../IconButton';
export type TableActionCellPrimaryActionVisibility = 'onHover' | 'always';
export type TableActionCellSize = 'tiny' | 'small' | 'medium';
type BaseActionProps = {
text: string;
onClick: () => void;
/** @deprecated will be removed in next major release. The visibility property switches skin properties automatically based on visibility options. */
skin?: 'standard' | 'inverted' | 'premium';
disabled?: boolean;
prefixIcon?: IconElement;
suffixIcon?: IconElement;
dataHook?: string;
disabledDescription?: string;
tooltipProps?: TooltipCommonProps;
};
export type TableActionCellPrimaryAction = ButtonWithAsProp<{
visibility?: TableActionCellPrimaryActionVisibility;
}> & BaseActionProps;
export type TableActionCellMainAction = ButtonWithAsProp<{
priority?: ButtonPriority;
}> & BaseActionProps;
export type TableActionCellMainActions = TableActionCellPrimaryAction | TableActionCellMainAction[];
export type TableActionCellSecondaryAction = {
text: string;
icon: IconElement;
onClick: (event?: React.MouseEvent<HTMLElement>) => void;
disabled?: boolean;
disabledDescription?: string;
tooltipProps?: TooltipCommonProps;
skin?: 'dark' | 'destructive' | 'premium';
subtitle?: string;
dataHook?: string;
};
export type TableActionCellSecondaryDivider = {
divider: boolean;
};
export type TableActionCellMoreActionsProps = {
priority?: IconButtonPriority;
skin?: IconButtonSkin;
};
export type TableActionCellPopoverMenuProps = Omit<PopoverMenuProps, 'triggerElement' | 'children' | 'dataHook' | 'className'>;
export interface TableActionCellProps {
/** Applies a data-hook HTML attribute to be used in the tests. */
dataHook?: string;
/** Called when clicking on the table action cell. */
onClick?: () => void;
/**
* Controls the behaviour and appearance of a primary action.
* Can be a single action object or an array of action objects.
*/
primaryAction?: TableActionCellMainActions;
/** Controls the behaviour and appearance of secondary actions. */
secondaryActions?: (TableActionCellSecondaryAction | TableActionCellSecondaryDivider)[];
/** Specifies the number of secondary actions to display outside of the popover menu. */
numOfVisibleSecondaryActions?: number;
/** Specifies whether secondary actions should be visible all the time. By default secondary actions are visible on row hover only. */
alwaysShowSecondaryActions?: boolean;
/** Specifies whether primary actions should be visible all the time. By default primary actions are visible on row hover only. */
alwaysShowPrimaryActions?: boolean;
/** Sets the tooltip text of more actions icon button. */
moreActionsTooltipText?: string;
/** Controls the appearance of the more actions icon button. */
moreActionsProps?: TableActionCellMoreActionsProps;
/** Controls the appearance of secondary actions menu with all common popover menu props. */
popoverMenuProps?: TableActionCellPopoverMenuProps;
/** Controls the size of action buttons.
* @default medium
*/
size?: TableActionCellSize;
}
export type HoverSlotDisplay = 'always' | 'onHover' | 'notOnHover';
export interface HoverSlotProps extends React.HTMLAttributes<HTMLSpanElement> {
display?: HoverSlotDisplay;
children?: React.ReactNode;
}
export {};
//# sourceMappingURL=TableActionCell.types.d.ts.map