import type { AnchorHTMLAttributes, ButtonHTMLAttributes, CSSProperties, ElementType, HTMLAttributes, SVGAttributes } from 'react';
import type { Theme, WithTestId } from '../types';
export type ButtonSize = 'xs' | 's' | 'm';
export type ButtonViewType = 'primary' | 'secondary' | 'success' | 'info' | 'unset';
export type ButtonAppearance = 'button' | 'link' | 'container';
export type ButtonIconPosition = 'start' | 'end';
export interface ButtonStyle extends CSSProperties {
'--button-color'?: string;
'--button-background'?: string;
'--button-hover-color'?: string;
'--button-hover-background'?: string;
'--button-disabled-color'?: string;
'--button-disabled-background'?: string;
}
export interface CommonProps extends WithTestId {
/** Определяет внешний вид кнопки. */
viewType?: ButtonViewType;
/** Тема. */
theme?: Theme;
/** Определяет тип корневого элемента. */
appearance?: T;
/** Иконка. */
icon?: ElementType>;
/** Позиция иконки относительно текста. */
iconPosition?: ButtonIconPosition;
/** Размер. */
size?: ButtonSize;
/** Нужно ли отображать состояние загрузки. */
loading?: boolean;
/** Отключенное состояние. */
disabled?: boolean;
/** Стили. */
style?: ButtonStyle;
}
type AsButtonProps = CommonProps & Omit, keyof CommonProps> & {
appearance?: 'button';
};
type AsAnchorProps = CommonProps & Omit, keyof CommonProps> & {
appearance: 'link';
};
type AsContainerProps = CommonProps & Omit, keyof CommonProps> & {
appearance: 'container';
};
export type ButtonProps = AsButtonProps | AsAnchorProps | AsContainerProps;
export {};