fix(component): re-enable fallback attrs such as 'disabled' for split button

This commit is contained in:
upsiflu 2025-01-16 10:30:42 +02:00
parent 322c5bf5c6
commit 68885b46b3
2 changed files with 27 additions and 13 deletions

View File

@ -61,10 +61,12 @@ onMounted(() => {
<div v-if="split" class="funkwhale button-group">
<button
ref="button"
v-bind="color(props, ['interactive'])(
width(props, isIconOnly ? ['square'] : ['normalHeight', 'buttonWidth'])(
align(props, { alignSelf:'start', alignText:'center' })(
)))"
v-bind="{
...$attrs,
...color(props, ['interactive'])(
width(props, isIconOnly ? ['square'] : ['normalHeight', 'buttonWidth'])(
align(props, { alignSelf:'start', alignText:'center' })(
)))}"
class="funkwhale button split-main"
:aria-pressed="props.ariaPressed"
:class="{
@ -89,10 +91,12 @@ onMounted(() => {
<Loader v-if="isLoading" :container="false" />
</button>
<button
v-bind="color(props, ['interactive'])(
width(props, ['square'])(
align(props, { alignSelf:'start', alignText:'center' })(
)))"
v-bind="{
...$attrs,
...color(props, ['interactive'])(
width(props, ['square'])(
align(props, { alignSelf:'start', alignText:'center' })(
)))}"
class="funkwhale button split-toggle"
:title="splitTitle"
@click="onSplitClick"

View File

@ -6,7 +6,7 @@ const click = ():Promise<void> => new Promise(resolve => setTimeout(resolve, 100
</script>
```ts
import Button from "~/components/ui/Button.vue"
import Button from "~/components/ui/Button.vue";
```
# Button
@ -15,7 +15,8 @@ Buttons are UI elements that users can interact with to perform actions and mani
```ts
{
thin?: true
thinFont?: true
lowHeight?: true
isActive?: boolean
isLoading?: boolean
@ -26,8 +27,8 @@ Buttons are UI elements that users can interact with to perform actions and mani
onClick?: (...args: any[]) => void | Promise<void>
autofocus? : boolean
ariaPressed? : true
autofocus?: boolean
ariaPressed?: true
} & (ColorProps | DefaultProps)
& VariantProps
& RaisedProps
@ -89,7 +90,7 @@ Secondary buttons represent **neutral** actions such as cancelling a change or d
<Layout grid class="preview secondary">
<div style="grid-column: span 3">
<div style="grid-column: span 4">
```vue-html
<Button secondary raised>
@ -239,6 +240,15 @@ Round buttons have fully rounded edges.
Round button
</Button>
## Split button
<Layout class="preview default raised">
<Button split splitIcon="bi-star" splitTitle="Star!" :onSplitClick="()=>console.log('1 star')">I am split</Button>
<Button> I am not split </Button>
<Button disabled> I am not split and I am disabled </Button>
<Button disabled split splitIcon="bi-star" splitTitle="Star!" :onSplitClick="()=>console.log('1 star')">I am split and disabled</Button>
</Layout>
## Button states
### On/Off