import React, { ComponentPropsWithoutRef, ReactNode, ComponentType } from 'react'; import { Merge } from 'type-fest'; import { DocumentedPropsWithChildren } from 'bloko/common/helpers/types'; export declare enum LinkKind { Success = "success", Secondary = "secondary", Tertiary = "tertiary", Warning = "warning", Inversed = "inversed", InversedSecondary = "inversed-secondary" } export declare enum LinkAppearance { Underlined = "underlined", Pseudo = "pseudo", Loading = "loading" } export declare enum LinkIconPosition { Left = "left", Right = "right" } interface LinkProps { /** * Тип ссылки */ kind?: LinkKind; /** * Указывает на строку с компонентом в исходном коде в режиме разработки. Генерируется babel-plugin-react-source */ source?: string; /** * Внешний вид, возможные варианты * `Loading` - состояние загрузки, * `Underlined` - ссылка с подчеркиваением, * `Pseudo` - ссылка с подчеркиванием пунктиром */ appearance?: LA; /** Иконка */ icon?: ReactNode; /** Расположение иконки */ iconPosition?: LinkIconPosition; /** * Отключить visited состояние */ disableVisited?: boolean; /** * Кастомный компонент */ Element?: CT; } type AnchorElementProps = ComponentPropsWithoutRef<'a'> & { href: string; }; interface LinkAppearanceAdditionalProps { [LinkAppearance.Underlined]: AnchorElementProps; [LinkAppearance.Pseudo]: ComponentPropsWithoutRef<'button'>; [LinkAppearance.Loading]: ComponentPropsWithoutRef<'button'>; } type LinkWithDefaultAppearanceAdditionalProps = AnchorElementProps | ComponentPropsWithoutRef<'button'>; export type LinkPropsHelper = DocumentedPropsWithChildren ? Merge> : LA extends keyof LinkAppearanceAdditionalProps ? LinkAppearanceAdditionalProps[LA] & LinkProps : LinkWithDefaultAppearanceAdditionalProps & LinkProps>; declare const Link: (props: (CT extends React.ComponentType ? import("type-fest").Simplify>> : LA extends keyof LinkAppearanceAdditionalProps ? LinkAppearanceAdditionalProps[LA] & LinkProps : LinkWithDefaultAppearanceAdditionalProps & LinkProps>) & { children?: React.ReactNode; } & React.RefAttributes) => React.ReactElement> | null; export default Link;