UNPKG

@wix/design-system

Version:

@wix/design-system

66 lines 3.81 kB
import * as React from 'react'; import { ButtonAsAnchorProps, ButtonAsButtonProps, ButtonAsComponentProps, ButtonGenericProps } from '../Button'; import { IconElement, TooltipCommonProps } from '../common'; import { ValuesOf } from '../utils/typeUtils'; import { SIZES, SKINS, UNDERLINE, WEIGHT } from './TextButton.constants'; type TextButtonCommonProps = { /** Accepts any item as a child element. For all common cases pass a standard text string. */ children?: React.ReactNode; /** Specifies a CSS class name to be appended to the component’s root element. * @internal */ className?: string; /** Specifies the skin of a button */ skin?: TextButtonSkin; /** Specifies whether to display and when to display an underline below button label */ underline?: TextButtonUnderline; /** Controls the font weight of button label */ weight?: TextButtonWeight; /** Controls the size of a button */ size?: TextButtonSize; /** Pass an icon or a component to display at the end of a label (e.g., svg, image, etc.) */ suffixIcon?: IconElement; /** Pass an icon or a component to display at the front of a label (e.g., svg, image, etc.) */ prefixIcon?: IconElement; /** Specifies whether user interactions are disabled */ disabled?: boolean; /** Applies a data-hook HTML attribute that can be used in the tests */ dataHook?: string; /** Stretches button to fill a 100% of its parent container width */ fluid?: boolean; /** Specifies whether component handles text overflow with ellipsis. If enabled, label that exceed available space will be displayed inside of a tooltip when user hover over a button. */ ellipsis?: boolean; /** Specifies whether the full button label is displayed in a tooltip when label overflows available space. * * Behaviour is enabled by default. Set property value to false to show ellipsis without a tooltip. */ showTooltip?: boolean; /** Allows to pass all common tooltip props. Use it to customize a tooltip created from text ellipsis. * @linkTypeTo components-overlays--tooltip */ tooltipProps?: TooltipCommonProps; /** Defines a string value that labels the button element to screen reader users */ ariaLabel?: string; /** Identifies the element that labels the button element */ ariaLabelledBy?: string; /** Indicates to screen reader users whether an interactive popup element, such as menu or dialog, can be triggered by a button */ ariaHaspopup?: string; /** Indicates to screen reader users whether the collapsible content below is in the expanded or in the collapsed state */ ariaExpanded?: boolean; /** Identifies the element whose contents or presence are controlled by the button */ ariaControls?: string; /** Identifies the element that represents the currently active descendant of the button */ ariaActiveDescendant?: string; }; type TextButtonWrap<T extends boolean | undefined> = { /** Enables wrapping when text is longer than its parent container. Cannot be used with as="button" */ wrap?: T; }; export type TextButtonProps = (ButtonAsButtonProps<TextButtonCommonProps> & TextButtonWrap<false>) | (ButtonAsAnchorProps<TextButtonCommonProps> & TextButtonWrap<boolean>) | (ButtonGenericProps<TextButtonCommonProps> & TextButtonWrap<boolean>) | (ButtonAsComponentProps<TextButtonCommonProps> & TextButtonWrap<boolean>); export default class TextButton extends React.Component<TextButtonProps> { } export type TextButtonSkin = ValuesOf<typeof SKINS>; export type TextButtonUnderline = ValuesOf<typeof UNDERLINE>; export type TextButtonWeight = ValuesOf<typeof WEIGHT>; export type TextButtonSize = ValuesOf<typeof SIZES>; export {}; //# sourceMappingURL=TextButton.types.d.ts.map