UNPKG

@wix/design-system

Version:

@wix/design-system

38 lines 1.6 kB
import { TooltipCommonProps } from '../../common'; export type EllipsisProps = EllipsisCommonProps & { /** The render function, use it to render a text you want to truncate with ellipsis. */ render(renderProps: RenderProps): React.ReactElement; /** A className to be applied to the Ellipsis wrapper. */ wrapperClassName?: string; }; export type EllipsisCommonProps = TooltipCommonProps & { /** When true, text that is longer than it's container will be truncated to a single line followed by ellipsis. Otherwise the text will break into several lines. */ ellipsis?: boolean; /** True by default, set it to false in order to show ellipsis without a tooltip. */ showTooltip?: boolean; /** maxLines truncates text at a specific number of lines. */ maxLines?: number; /** A callback fired when ellipsis state changes. */ onEllipsisStateChange?: (isActive: boolean) => void; }; export type EllipsisState = { isActive: boolean; textContent: string | null; textRendered: boolean; }; export type RenderChildrenParams = { text: React.ReactNode; suffix?: React.ReactNode; }; export type RenderElementParams = { element: React.ReactNode; suffix?: React.ReactNode; }; export type RenderProps = { ref: React.RefObject<any>; ellipsisClasses: (className?: string) => string; ellipsisInlineStyle?: React.CSSProperties; renderChildren: ({ text, suffix }: RenderChildrenParams) => React.ReactNode; renderElement: ({ element, suffix }: RenderElementParams) => React.ReactNode; }; //# sourceMappingURL=Ellipsis.types.d.ts.map