44 :class =" [
55 variantClass,
66 {
7- 'is-loading': props. loading,
8- 'has-no-shadow': !props. shadow || props. variant === 'tertiary',
7+ 'is-loading': loading,
8+ 'has-no-shadow': !shadow || variant === 'tertiary',
99 }
1010 ]"
11- :disabled =" props. disabled || props. loading"
11+ :disabled =" disabled || loading"
1212 :style =" {
13- '--button-white-space': props. wrap ? 'break-spaces' : 'nowrap',
13+ '--button-white-space': wrap ? 'break-spaces' : 'nowrap',
1414 }"
15- :type =" props.type"
16- :to =" props.to"
17- :href =" props.href"
18- :open-external-in-new-tab =" props.openExternalInNewTab"
15+ v-bind =" $attrs"
1916 >
20- <template v-if =" props . icon " >
17+ <template v-if =" icon " >
2118 <Icon
2219 v-if =" !$slots.default"
23- :icon =" props. icon"
24- :style =" {color: props. iconColor}"
20+ :icon =" icon"
21+ :style =" {color: iconColor}"
2522 />
2623 <span
2724 v-else
2825 class =" icon is-small"
2926 >
3027 <Icon
31- :icon =" props. icon"
32- :style =" {color: props. iconColor}"
28+ :icon =" icon"
29+ :style =" {color: iconColor}"
3330 />
3431 </span >
3532 </template >
4138import {computed , type PropType } from ' vue'
4239import BaseButton from ' @/components/base/BaseButton.vue'
4340import type {IconProp } from ' @fortawesome/fontawesome-svg-core'
44- import type {RouteLocationRaw } from ' vue-router'
41+
42+ export type ButtonTypes = keyof typeof VARIANT_CLASS_MAP
4543
4644const props = defineProps ({
4745 variant: {
48- type: String as PropType <' primary ' | ' secondary ' | ' tertiary ' >,
49- default: ' primary' ,
46+ type: String as PropType <ButtonTypes >,
47+ default: ' primary' as ButtonTypes ,
5048 },
5149 icon: {
5250 type: Object as PropType <IconProp >,
@@ -72,25 +70,9 @@ const props = defineProps({
7270 type: Boolean ,
7371 default: true ,
7472 },
75- type: {
76- type: String as PropType <' button' | ' submit' | undefined >,
77- default: undefined ,
78- },
79- to: {
80- type: Object as PropType <RouteLocationRaw >,
81- default: undefined ,
82- },
83- href: {
84- type: String ,
85- default: undefined ,
86- },
87- openExternalInNewTab: {
88- type: Boolean ,
89- default: true ,
90- },
9173})
9274
93- defineOptions ({name: ' XButton' })
75+ defineOptions ({name: ' XButton' , inheritAttrs: false })
9476
9577const VARIANT_CLASS_MAP = {
9678 primary: ' is-primary' ,
0 commit comments