2023-03-25 17:16:46 +08:00
|
|
|
import { booleanType, someType, stringType, vNodeType } from '@v-c/utils'
|
|
|
|
import type { ExtractPropTypes } from 'vue'
|
|
|
|
import type { SizeType } from '../config-provider/context'
|
|
|
|
import type { ButtonHTMLType, ButtonShape, ButtonType } from './button-helper'
|
2023-03-27 07:51:19 +08:00
|
|
|
export interface LoadingConfigType {
|
|
|
|
loading: boolean
|
|
|
|
delay: number
|
|
|
|
}
|
2023-03-25 17:16:46 +08:00
|
|
|
|
|
|
|
export const buttonProps = {
|
|
|
|
type: stringType<ButtonType>('default'),
|
|
|
|
icon: vNodeType(),
|
|
|
|
shape: stringType<ButtonShape>(),
|
|
|
|
size: someType<SizeType | 'default'>([String], 'default'),
|
|
|
|
disabled: booleanType(),
|
2023-03-27 07:51:19 +08:00
|
|
|
loading: someType<boolean | LoadingConfigType>(),
|
2023-03-25 17:16:46 +08:00
|
|
|
prefixCls: stringType(),
|
|
|
|
rootClassName: stringType(),
|
|
|
|
ghost: booleanType(),
|
|
|
|
danger: booleanType(),
|
|
|
|
block: booleanType(),
|
|
|
|
htmlType: stringType<ButtonHTMLType>('button')
|
|
|
|
}
|
|
|
|
|
|
|
|
export type ButtonProps = ExtractPropTypes<typeof buttonProps>
|