{"version":3,"file":"button.mjs","names":[],"sources":["../../../../../../packages/components/button/src/button.ts"],"sourcesContent":["import { useSizeProp } from '@element-plus/hooks'\nimport { buildProps, definePropType, iconPropType } from '@element-plus/utils'\nimport { Loading } from '@element-plus/icons-vue'\n\nimport type { Component, ExtractPublicPropTypes } from 'vue'\nimport type { ComponentSize } from '@element-plus/constants'\nimport type { IconPropType } from '@element-plus/utils'\n\nexport const buttonTypes = [\n  'default',\n  'primary',\n  'success',\n  'warning',\n  'info',\n  'danger',\n  /**\n   * @deprecated\n   * Text type will be deprecated in the next major version (3.0.0)\n   */\n  'text',\n  '',\n] as const\nexport const buttonNativeTypes = ['button', 'submit', 'reset'] as const\n\nexport type ButtonType = (typeof buttonTypes)[number]\nexport type ButtonNativeType = (typeof buttonNativeTypes)[number]\n\nexport interface ButtonProps {\n  /**\n   * @description button size\n   */\n  size?: ComponentSize\n  /**\n   * @description disable the button\n   */\n  disabled?: boolean\n  /**\n   * @description button type\n   */\n  type?: ButtonType\n  /**\n   * @description icon component\n   */\n  icon?: IconPropType\n  /**\n   * @description native button type\n   */\n  nativeType?: ButtonNativeType\n  /**\n   * @description determine whether it's loading\n   */\n  loading?: boolean\n  /**\n   * @description customize loading icon component\n   */\n  loadingIcon?: IconPropType\n  /**\n   * @description determine whether it's a plain button\n   */\n  plain?: boolean\n  /**\n   * @description determine whether it's a text button\n   */\n  text?: boolean\n  /**\n   * @description determine whether it's a link button\n   */\n  link?: boolean\n  /**\n   * @description determine whether the text button background color is always on\n   */\n  bg?: boolean\n  /**\n   * @description native button autofocus\n   */\n  autofocus?: boolean\n  /**\n   * @description determine whether it's a round button\n   */\n  round?: boolean\n  /**\n   * @description determine whether it's a circle button\n   */\n  circle?: boolean\n  /**\n   * @description determine whether it's a dashed button\n   */\n  dashed?: boolean\n  /**\n   * @description custom button color, automatically calculate `hover` and `active` color\n   */\n  color?: string\n  /**\n   * @description dark mode, which automatically converts `color` to dark mode colors\n   */\n  dark?: boolean\n  /**\n   * @description automatically insert a space between two chinese characters\n   */\n  autoInsertSpace?: boolean\n  /**\n   * @description custom element tag\n   */\n  tag?: string | Component\n}\n\n/**\n * @deprecated Removed after 3.0.0, Use `ButtonProps` instead.\n */\nexport const buttonProps = buildProps({\n  /**\n   * @description button size\n   */\n  size: useSizeProp,\n  /**\n   * @description disable the button\n   */\n  disabled: {\n    type: Boolean,\n    default: undefined,\n  },\n  /**\n   * @description button type\n   */\n  type: {\n    type: String,\n    values: buttonTypes,\n    default: '',\n  },\n  /**\n   * @description icon component\n   */\n  icon: {\n    type: iconPropType,\n  },\n  /**\n   * @description native button type\n   */\n  nativeType: {\n    type: String,\n    values: buttonNativeTypes,\n    default: 'button',\n  },\n  /**\n   * @description determine whether it's loading\n   */\n  loading: Boolean,\n  /**\n   * @description customize loading icon component\n   */\n  loadingIcon: {\n    type: iconPropType,\n    default: () => Loading,\n  },\n  /**\n   * @description determine whether it's a plain button\n   */\n  plain: {\n    type: Boolean,\n    default: undefined,\n  },\n  /**\n   * @description determine whether it's a text button\n   */\n  text: {\n    type: Boolean,\n    default: undefined,\n  },\n  /**\n   * @description determine whether it's a link button\n   */\n  link: Boolean,\n  /**\n   * @description determine whether the text button background color is always on\n   */\n  bg: Boolean,\n  /**\n   * @description native button autofocus\n   */\n  autofocus: Boolean,\n  /**\n   * @description determine whether it's a round button\n   */\n  round: {\n    type: Boolean,\n    default: undefined,\n  },\n  /**\n   * @description determine whether it's a circle button\n   */\n  circle: Boolean,\n  /**\n   * @description determine whether it's a dashed button\n   */\n  dashed: {\n    type: Boolean,\n    default: undefined,\n  },\n  /**\n   * @description custom button color, automatically calculate `hover` and `active` color\n   */\n  color: String,\n  /**\n   * @description dark mode, which automatically converts `color` to dark mode colors\n   */\n  dark: Boolean,\n  /**\n   * @description automatically insert a space between two chinese characters\n   */\n  autoInsertSpace: {\n    type: Boolean,\n    default: undefined,\n  },\n  /**\n   * @description custom element tag\n   */\n  tag: {\n    type: definePropType<string | Component>([String, Object]),\n    default: 'button',\n  },\n} as const)\nexport const buttonEmits = {\n  click: (evt: MouseEvent) => evt instanceof MouseEvent,\n}\n\n/**\n * @deprecated Removed after 3.0.0, Use `ButtonProps` instead.\n */\nexport type ButtonPropsPublic = ExtractPublicPropTypes<typeof buttonProps>\nexport type ButtonEmits = typeof buttonEmits\n\nexport interface ButtonConfigContext {\n  type?: ButtonProps['type']\n  plain?: ButtonProps['plain']\n  text?: ButtonProps['text']\n  round?: ButtonProps['round']\n  dashed?: ButtonProps['dashed']\n  autoInsertSpace?: ButtonProps['autoInsertSpace']\n}\n"],"mappings":";;;;;;AAQA,MAAa,cAAc;CACzB;CACA;CACA;CACA;CACA;CACA;CAKA;CACA;CACD;AACD,MAAa,oBAAoB;CAAC;CAAU;CAAU;CAAQ;;;;AAuF9D,MAAa,cAAc,WAAW;CAIpC,MAAM;CAIN,UAAU;EACR,MAAM;EACN,SAAS;EACV;CAID,MAAM;EACJ,MAAM;EACN,QAAQ;EACR,SAAS;EACV;CAID,MAAM,EACJ,MAAM,cACP;CAID,YAAY;EACV,MAAM;EACN,QAAQ;EACR,SAAS;EACV;CAID,SAAS;CAIT,aAAa;EACX,MAAM;EACN,eAAe;EAChB;CAID,OAAO;EACL,MAAM;EACN,SAAS;EACV;CAID,MAAM;EACJ,MAAM;EACN,SAAS;EACV;CAID,MAAM;CAIN,IAAI;CAIJ,WAAW;CAIX,OAAO;EACL,MAAM;EACN,SAAS;EACV;CAID,QAAQ;CAIR,QAAQ;EACN,MAAM;EACN,SAAS;EACV;CAID,OAAO;CAIP,MAAM;CAIN,iBAAiB;EACf,MAAM;EACN,SAAS;EACV;CAID,KAAK;EACH,MAAM,eAAmC,CAAC,QAAQ,OAAO,CAAC;EAC1D,SAAS;EACV;CACF,CAAU;AACX,MAAa,cAAc,EACzB,QAAQ,QAAoB,eAAe,YAC5C"}