import type { IconComponent, IconProps } from '~/components/Icon/types'; import type { TextLinkDecoration } from '~/styles/classNameForTextLinkStyle'; import type { BaseProps, ChildrenProps, LoggerProps, StylableProps } from '~/types/component'; import type { BodyTextBundle } from '~/types/type-bundles'; type Variant = 'primary' | 'muted' | 'neutral' | 'critical' | 'warning' | 'success' | 'rich'; interface BasicTextLinkProps extends BodyTextBundle, BaseProps, StylableProps, LoggerProps, ChildrenProps { /** * Specifies color of TextLink */ variant?: Variant; /** * Decoration style of the text */ decoration?: TextLinkDecoration; /** * The icon to to display alongside text in a button */ icon?: IconComponent; /** * Applies disabled styling to the button. */ disabled?: boolean; /** * Adds an Icon on the right. Only a set list of icons are allowed. */ disclosureIcon?: IconComponent; /** * Where to display the linked URL */ target?: string; /** * The relationship of the linked URL. */ rel?: string; /** * Renders the link as an inline component, rather than an inline-flex component. * Useful when the link is inline with other surrounding text. */ inline?: boolean; /** * Custom props to send to the icon */ iconProps?: IconProps; /** * Custom props to send to the icon */ disclosureIconProps?: IconProps; /** element to render (only applies to `href` links) */ as?: 'a' | ((props: Pick) => React.JSX.Element); } export interface TextLinkWithHref extends BasicTextLinkProps { /** * Link destination. */ href?: string; /** * Function to call when the link is clicked. */ onClick?: () => void; } interface TextLinkWithOnClick extends BasicTextLinkProps { /** * Function to call when the link is clicked. The event object is passed to the function * when no href is defined. */ onClick?: React.MouseEventHandler; /** * href is not allowed when used with a fully featured onClick function. */ href?: never; } export type TextLinkProps = TextLinkWithHref | TextLinkWithOnClick; export {};