button.mjs 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. import { buildProps, definePropType } from "../../../utils/vue/props/runtime.mjs";
  2. import { iconPropType } from "../../../utils/vue/icon.mjs";
  3. import { useSizeProp } from "../../../hooks/use-size/index.mjs";
  4. import { Loading } from "@element-plus/icons-vue";
  5. //#region ../../packages/components/button/src/button.ts
  6. const buttonTypes = [
  7. "default",
  8. "primary",
  9. "success",
  10. "warning",
  11. "info",
  12. "danger",
  13. "text",
  14. ""
  15. ];
  16. const buttonNativeTypes = [
  17. "button",
  18. "submit",
  19. "reset"
  20. ];
  21. /**
  22. * @deprecated Removed after 3.0.0, Use `ButtonProps` instead.
  23. */
  24. const buttonProps = buildProps({
  25. /**
  26. * @description button size
  27. */
  28. size: useSizeProp,
  29. /**
  30. * @description disable the button
  31. */
  32. disabled: {
  33. type: Boolean,
  34. default: void 0
  35. },
  36. /**
  37. * @description button type
  38. */
  39. type: {
  40. type: String,
  41. values: buttonTypes,
  42. default: ""
  43. },
  44. /**
  45. * @description icon component
  46. */
  47. icon: { type: iconPropType },
  48. /**
  49. * @description native button type
  50. */
  51. nativeType: {
  52. type: String,
  53. values: buttonNativeTypes,
  54. default: "button"
  55. },
  56. /**
  57. * @description determine whether it's loading
  58. */
  59. loading: Boolean,
  60. /**
  61. * @description customize loading icon component
  62. */
  63. loadingIcon: {
  64. type: iconPropType,
  65. default: () => Loading
  66. },
  67. /**
  68. * @description determine whether it's a plain button
  69. */
  70. plain: {
  71. type: Boolean,
  72. default: void 0
  73. },
  74. /**
  75. * @description determine whether it's a text button
  76. */
  77. text: {
  78. type: Boolean,
  79. default: void 0
  80. },
  81. /**
  82. * @description determine whether it's a link button
  83. */
  84. link: Boolean,
  85. /**
  86. * @description determine whether the text button background color is always on
  87. */
  88. bg: Boolean,
  89. /**
  90. * @description native button autofocus
  91. */
  92. autofocus: Boolean,
  93. /**
  94. * @description determine whether it's a round button
  95. */
  96. round: {
  97. type: Boolean,
  98. default: void 0
  99. },
  100. /**
  101. * @description determine whether it's a circle button
  102. */
  103. circle: Boolean,
  104. /**
  105. * @description determine whether it's a dashed button
  106. */
  107. dashed: {
  108. type: Boolean,
  109. default: void 0
  110. },
  111. /**
  112. * @description custom button color, automatically calculate `hover` and `active` color
  113. */
  114. color: String,
  115. /**
  116. * @description dark mode, which automatically converts `color` to dark mode colors
  117. */
  118. dark: Boolean,
  119. /**
  120. * @description automatically insert a space between two chinese characters
  121. */
  122. autoInsertSpace: {
  123. type: Boolean,
  124. default: void 0
  125. },
  126. /**
  127. * @description custom element tag
  128. */
  129. tag: {
  130. type: definePropType([String, Object]),
  131. default: "button"
  132. }
  133. });
  134. const buttonEmits = { click: (evt) => evt instanceof MouseEvent };
  135. //#endregion
  136. export { buttonEmits, buttonNativeTypes, buttonProps, buttonTypes };
  137. //# sourceMappingURL=button.mjs.map