Skip to content
This repository was archived by the owner on Mar 27, 2025. It is now read-only.

Commit 60ce945

Browse files
authored
fix: Invalid button code in dropdown component (bootstrap-vue-next#1309)
* fix: Invalid button code in dropdown component resolves bootstrap-vue-next#1304 feat(BButton): replace loading mode with loadingFill - update to use loading fill as a boolean value --------- Co-authored-by: John <[email protected]>
1 parent eb72cdf commit 60ce945

File tree

3 files changed

+22
-62
lines changed

3 files changed

+22
-62
lines changed

apps/docs/src/data/components/button.data.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,10 @@ export default {
7171
type: 'Booleanish',
7272
},
7373
{
74-
prop: 'loadingMode',
74+
prop: 'loadingFill',
7575
description: '',
76-
type: "'fill' | 'inline'",
76+
type: 'Booleanish',
77+
default: 'false',
7778
},
7879
],
7980
emits: [

packages/bootstrap-vue-next/src/components/BButton/BButton.vue

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -21,21 +21,19 @@
2121
:router-tag="isBLink ? routerTag : null"
2222
@click="clicked"
2323
>
24-
<div
25-
v-if="loadingBoolean"
26-
class="btn-loading"
27-
:class="{'mode-fill': loadingMode === 'fill', 'mode-inline': loadingMode === 'inline'}"
28-
>
24+
<template v-if="loadingBoolean">
2925
<slot name="loading">
30-
<BSpinner class="btn-spinner" :small="size !== 'lg'" />
26+
<template v-if="!loadingFillBoolean">
27+
{{ loadingText }}
28+
</template>
29+
<slot name="loading-spinner">
30+
<BSpinner :small="size !== 'lg'" :label="loadingFillBoolean ? loadingText : undefined" />
31+
</slot>
3132
</slot>
32-
</div>
33-
<div
34-
class="btn-content"
35-
:class="{'btn-loading-fill': loadingBoolean && loadingMode === 'fill'}"
36-
>
33+
</template>
34+
<template v-else>
3735
<slot />
38-
</div>
36+
</template>
3937
</component>
4038
</template>
4139

@@ -50,9 +48,11 @@ import {useVModel} from '@vueuse/core'
5048
5149
defineSlots<{
5250
// eslint-disable-next-line @typescript-eslint/no-explicit-any
53-
default?: (props: Record<string, never>) => any
51+
'default'?: (props: Record<string, never>) => any
5452
// eslint-disable-next-line @typescript-eslint/no-explicit-any
55-
loading?: (props: Record<string, never>) => any
53+
'loading'?: (props: Record<string, never>) => any
54+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
55+
'loading-spinner'?: (props: Record<string, never>) => any
5656
}>()
5757
5858
const props = withDefaults(
@@ -66,8 +66,9 @@ const props = withDefaults(
6666
type?: ButtonType
6767
variant?: ButtonVariant | null
6868
loading?: Booleanish
69-
loadingMode?: 'fill' | 'inline'
69+
loadingFill?: Booleanish
7070
block?: Booleanish
71+
loadingText?: string
7172
} & Omit<BLinkProps, 'variant'>
7273
>(),
7374
{
@@ -80,8 +81,9 @@ const props = withDefaults(
8081
type: 'button',
8182
variant: 'secondary',
8283
loading: false,
83-
loadingMode: 'inline',
84+
loadingFill: false,
8485
block: false,
86+
loadingText: 'Loading...',
8587
// Link props
8688
activeClass: 'router-link-active',
8789
append: false,
@@ -122,6 +124,7 @@ const pillBoolean = useBooleanish(() => props.pill)
122124
const pressedBoolean = useBooleanish(() => props.pressed)
123125
const squaredBoolean = useBooleanish(() => props.squared)
124126
const loadingBoolean = useBooleanish(() => props.loading)
127+
const loadingFillBoolean = useBooleanish(() => props.loadingFill)
125128
126129
const isToggle = computed<boolean>(() => typeof pressedBoolean.value === 'boolean')
127130
const isButton = computed<boolean>(
Lines changed: 0 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,3 @@
11
.btn {
22
position: relative;
3-
4-
.btn-loading {
5-
&.mode-inline {
6-
display: inline-block;
7-
}
8-
9-
&.mode-fill {
10-
display: flex;
11-
position: absolute;
12-
left: 0;
13-
top: 0;
14-
width: 100%;
15-
height: 100%;
16-
justify-content: center;
17-
align-items: center;
18-
}
19-
20-
.btn-spinner {
21-
margin-inline-end: 0.4rem;
22-
--bs-spinner-width: 1.5rem;
23-
--bs-spinner-height: 1.5rem;
24-
--bs-spinner-border-width: 0.15em;
25-
26-
&.spinner-border-sm {
27-
margin-inline-end: 0.25rem;
28-
--bs-spinner-width: 1rem;
29-
--bs-spinner-height: 1rem;
30-
}
31-
}
32-
33-
&.fw-bold {
34-
.btn-spinner {
35-
--bs-spinner-border-width: 0.2em;
36-
}
37-
}
38-
}
39-
40-
.btn-content {
41-
display: inline-block;
42-
43-
&.btn-loading-fill {
44-
color: transparent;
45-
}
46-
}
473
}

0 commit comments

Comments
 (0)