import PropTypes from '../_util/vue-types'; import type { ExtractPropTypes, PropType } from 'vue'; import type { SizeType } from '../config-provider'; export type ButtonType = 'link' | 'default' | 'primary' | 'ghost' | 'dashed' | 'text'; export type ButtonShape = 'default' | 'circle' | 'round'; export type ButtonHTMLType = 'submit' | 'button' | 'reset'; export type LegacyButtonType = ButtonType | 'danger'; export function convertLegacyProps(type?: LegacyButtonType): ButtonProps { if (type === 'danger') { return { danger: true }; } return { type }; } export const buttonProps = () => ({ prefixCls: String, type: String as PropType, htmlType: { type: String as PropType, default: 'button' }, shape: { type: String as PropType }, size: { type: String as PropType, }, loading: { type: [Boolean, Object] as PropType, default: (): boolean | { delay?: number } => false, }, disabled: { type: Boolean, default: undefined }, ghost: { type: Boolean, default: undefined }, block: { type: Boolean, default: undefined }, danger: { type: Boolean, default: undefined }, icon: PropTypes.any, href: String, target: String, title: String, onClick: { type: Function as PropType<(event: MouseEvent) => void>, }, onMousedown: { type: Function as PropType<(event: MouseEvent) => void>, }, }); export type ButtonProps = Partial>>; export default buttonProps;