import React, { ButtonHTMLAttributes, AnchorHTMLAttributes, CSSProperties } from 'react'; import { IconDefinition } from '../../atoms/Icon/index'; export declare type ButtonKind = 'normal' | 'primary' | 'cancel' | 'link' | 'secondLink' | 'inverted' | 'negative' | 'voca-normal' | 'voca-inverted' | 'voca-purple' | 'voca-purple-inverted'; export declare type ButtonType = 'button' | 'reset' | 'submit'; export declare type ButtonMargin = 'top' | 'bottom'; export declare type IconPlacement = 'left' | 'right'; export interface HTMLButtonProps { component?: 'button'; } export interface HTMLAElementProps { component?: 'link'; href: string; } export interface HTMLDivElementProps { component?: 'div'; } export interface CommonButtonProps { /** * you can define a component tag with one of these below. * 'button' are default and is not necessary to define */ component?: 'button' | 'link' | 'div'; /** * A button can have a text. */ text?: string; /** * When defining component as 'link', href should to be added */ href?: string; /** * Look at Icon component for aviable icons to choose from */ icon?: IconDefinition; /** * On which side of the button the icon shows e.g 'left' or 'right' */ iconPlacement?: IconPlacement; type?: ButtonType; /** * A button can have different appearances e.g. 'primary', 'cancel'. */ kind?: ButtonKind; /** * Optional margin */ margin?: ButtonMargin; /** * A button can have different sizes e.g. 'small'. */ size?: 'small' | 'xs'; onClick?: React.MouseEventHandler; /** * Additional classes. */ className?: string; /** * A button can change text while it is processing. */ processingText?: string; /** * A button can be in processing state */ isProcessing?: boolean; /** * A button can be disabled. */ isDisabled?: boolean; /** * Children is not a valid prop, and is present with type `never` to override the default React.FC definition. * See https://github.com/DefinitelyTyped/DefinitelyTyped/issues/34237 */ children?: never; style?: CSSProperties; } export declare type ButtonProps = CommonButtonProps & ((HTMLButtonProps & ButtonHTMLAttributes) | (HTMLAElementProps & AnchorHTMLAttributes) | HTMLDivElementProps); /** * Status: *finished*. * Category: Buttons */ declare const Button: { (props: ButtonProps): JSX.Element; types: ButtonTypeDict; kinds: ButtonKindDict; margins: ButtonMarginDict; }; export default Button; declare type ButtonTypeDict = { [key in ButtonType]: ButtonType; }; declare type ButtonKindDict = { [key in ButtonKind]: ButtonKind; }; declare type ButtonMarginDict = { [key in ButtonMargin]: ButtonMargin; };