@@ -10,7 +10,7 @@ import { makeProp } from '../../utils/props'
10
10
// --- Constants ---
11
11
12
12
// Base attributes needed on all icons
13
- const baseAttrs = {
13
+ const BASE_ATTRS = {
14
14
viewBox : '0 0 16 16' ,
15
15
width : '1em' ,
16
16
height : '1em' ,
@@ -20,7 +20,7 @@ const baseAttrs = {
20
20
}
21
21
22
22
// Attributes that are nulled out when stacked
23
- const stackedAttrs = {
23
+ const STACKED_ATTRS = {
24
24
width : null ,
25
25
height : null ,
26
26
focusable : null ,
@@ -95,14 +95,15 @@ export const BVIconBase = /*#__PURE__*/ Vue.extend({
95
95
)
96
96
}
97
97
98
+ // Wrap in an additional `<g>` for proper animation handling if stacked
98
99
if ( stacked ) {
99
- // Wrap in an additional `<g>` for proper
100
- // animation handling if stacked
101
- $inner = h ( 'g' , { } , [ $inner ] )
100
+ $inner = h ( 'g' , [ $inner ] )
102
101
}
103
102
104
103
const $title = title ? h ( 'title' , title ) : null
105
104
105
+ const $content = [ $title , $inner ] . filter ( identity )
106
+
106
107
return h (
107
108
'svg' ,
108
109
mergeData (
@@ -112,13 +113,13 @@ export const BVIconBase = /*#__PURE__*/ Vue.extend({
112
113
[ `text-${ variant } ` ] : variant ,
113
114
[ `b-icon-animation-${ animation } ` ] : animation
114
115
} ,
115
- attrs : baseAttrs ,
116
+ attrs : BASE_ATTRS ,
116
117
style : stacked ? { } : { fontSize : fontScale === 1 ? null : `${ fontScale * 100 } %` }
117
118
} ,
118
119
// Merge in user supplied data
119
120
data ,
120
- // If icon is stacked, null out some attrs
121
- stacked ? { attrs : stackedAttrs } : { } ,
121
+ // If icon is stacked, null- out some attrs
122
+ stacked ? { attrs : STACKED_ATTRS } : { } ,
122
123
// These cannot be overridden by users
123
124
{
124
125
attrs : {
@@ -127,7 +128,7 @@ export const BVIconBase = /*#__PURE__*/ Vue.extend({
127
128
}
128
129
}
129
130
) ,
130
- [ $title , $inner ]
131
+ $content
131
132
)
132
133
}
133
134
} )
0 commit comments