@gitlab/ui 94.6.0 → 94.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +19 -0
- package/dist/components/base/breadcrumb/breadcrumb.js +2 -1
- package/dist/components/base/dropdown/dropdown.js +1 -1
- package/dist/components/base/dropdown/dropdown_item.js +1 -1
- package/dist/components/base/new_dropdowns/disclosure/disclosure_dropdown_group.js +3 -3
- package/dist/components/base/new_dropdowns/listbox/listbox.js +4 -4
- package/dist/components/base/new_dropdowns/listbox/listbox_group.js +1 -1
- package/dist/index.css +2 -2
- package/dist/index.css.map +1 -1
- package/dist/tailwind.css +1 -1
- package/dist/tailwind.css.map +1 -1
- package/dist/tokens/build/js/tokens.dark.js +20 -1
- package/dist/tokens/build/js/tokens.js +20 -1
- package/dist/tokens/css/tokens.css +19 -0
- package/dist/tokens/css/tokens.dark.css +19 -0
- package/dist/tokens/js/tokens.dark.js +19 -0
- package/dist/tokens/js/tokens.js +19 -0
- package/dist/tokens/json/tokens.dark.json +457 -0
- package/dist/tokens/json/tokens.json +457 -0
- package/dist/tokens/scss/_tokens.dark.scss +19 -0
- package/dist/tokens/scss/_tokens.scss +19 -0
- package/dist/tokens/scss/_tokens_custom_properties.scss +19 -0
- package/dist/tokens/tailwind/tokens.cjs +2 -0
- package/dist/vendor/bootstrap-vue/src/constants/components.js +1 -4
- package/dist/vendor/bootstrap-vue/src/constants/regex.js +1 -6
- package/dist/vendor/bootstrap-vue/src/index.js +0 -4
- package/dist/vendor/bootstrap-vue/src/utils/string.js +2 -8
- package/package.json +1 -1
- package/src/components/base/breadcrumb/breadcrumb.vue +2 -1
- package/src/components/base/dropdown/dropdown.scss +6 -9
- package/src/components/base/dropdown/dropdown.vue +1 -1
- package/src/components/base/dropdown/dropdown_divider.scss +1 -1
- package/src/components/base/dropdown/dropdown_item.scss +8 -12
- package/src/components/base/dropdown/dropdown_item.vue +1 -1
- package/src/components/base/dropdown/dropdown_section_header.scss +1 -1
- package/src/components/base/filtered_search/filtered_search_suggestion.scss +2 -2
- package/src/components/base/filtered_search/filtered_search_suggestion_list.scss +2 -1
- package/src/components/base/new_dropdowns/disclosure/disclosure_dropdown.scss +1 -1
- package/src/components/base/new_dropdowns/disclosure/disclosure_dropdown_group.vue +3 -3
- package/src/components/base/new_dropdowns/dropdown.scss +5 -5
- package/src/components/base/new_dropdowns/dropdown_item.scss +29 -12
- package/src/components/base/new_dropdowns/listbox/listbox.scss +2 -2
- package/src/components/base/new_dropdowns/listbox/listbox.vue +5 -5
- package/src/components/base/new_dropdowns/listbox/listbox_group.vue +1 -1
- package/src/tokens/build/css/tokens.css +19 -0
- package/src/tokens/build/css/tokens.dark.css +19 -0
- package/src/tokens/build/js/tokens.dark.js +19 -0
- package/src/tokens/build/js/tokens.js +19 -0
- package/src/tokens/build/json/tokens.dark.json +457 -0
- package/src/tokens/build/json/tokens.json +457 -0
- package/src/tokens/build/scss/_tokens.dark.scss +19 -0
- package/src/tokens/build/scss/_tokens.scss +19 -0
- package/src/tokens/build/scss/_tokens_custom_properties.scss +19 -0
- package/src/tokens/build/tailwind/tokens.cjs +2 -0
- package/src/tokens/contextual/dropdown.tokens.json +148 -0
- package/src/vendor/bootstrap-vue/nuxt/index.js +1 -13
- package/src/vendor/bootstrap-vue/nuxt/plugin.template.js +0 -6
- package/src/vendor/bootstrap-vue/package.json +1 -4
- package/src/vendor/bootstrap-vue/src/_variables.scss +0 -14
- package/src/vendor/bootstrap-vue/src/components/breadcrumb/README.md +0 -1
- package/src/vendor/bootstrap-vue/src/components/input-group/README.md +1 -1
- package/src/vendor/bootstrap-vue/src/components/navbar/README.md +1 -2
- package/src/vendor/bootstrap-vue/src/constants/components.js +0 -3
- package/src/vendor/bootstrap-vue/src/constants/regex.js +0 -5
- package/src/vendor/bootstrap-vue/src/index.d.ts +0 -3
- package/src/vendor/bootstrap-vue/src/index.js +0 -9
- package/src/vendor/bootstrap-vue/src/index.scss +0 -3
- package/src/vendor/bootstrap-vue/src/utils/string.js +1 -8
- package/src/vendor/bootstrap-vue/src/utils/string.spec.js +1 -11
- package/dist/vendor/bootstrap-vue/src/browser-icons.js +0 -8
- package/dist/vendor/bootstrap-vue/src/icons/helpers/icon-base.js +0 -139
- package/dist/vendor/bootstrap-vue/src/icons/helpers/make-icon.js +0 -56
- package/dist/vendor/bootstrap-vue/src/icons/icon.js +0 -56
- package/dist/vendor/bootstrap-vue/src/icons/icons.js +0 -1377
- package/dist/vendor/bootstrap-vue/src/icons/iconstack.js +0 -31
- package/dist/vendor/bootstrap-vue/src/icons/index.js +0 -4
- package/dist/vendor/bootstrap-vue/src/icons/plugin.js +0 -1410
- package/dist/vendor/bootstrap-vue/src/icons-only.js +0 -10
- package/src/vendor/bootstrap-vue/src/browser-icons.js +0 -9
- package/src/vendor/bootstrap-vue/src/icons/README.md +0 -874
- package/src/vendor/bootstrap-vue/src/icons/_icons.scss +0 -156
- package/src/vendor/bootstrap-vue/src/icons/helpers/icon-base.js +0 -134
- package/src/vendor/bootstrap-vue/src/icons/helpers/make-icon.js +0 -48
- package/src/vendor/bootstrap-vue/src/icons/icon.js +0 -54
- package/src/vendor/bootstrap-vue/src/icons/icons.d.ts +0 -2757
- package/src/vendor/bootstrap-vue/src/icons/icons.js +0 -8241
- package/src/vendor/bootstrap-vue/src/icons/icons.spec.js +0 -522
- package/src/vendor/bootstrap-vue/src/icons/iconstack.js +0 -31
- package/src/vendor/bootstrap-vue/src/icons/iconstack.spec.js +0 -161
- package/src/vendor/bootstrap-vue/src/icons/index.d.ts +0 -18
- package/src/vendor/bootstrap-vue/src/icons/index.js +0 -16
- package/src/vendor/bootstrap-vue/src/icons/index.scss +0 -1
- package/src/vendor/bootstrap-vue/src/icons/package.json +0 -72782
- package/src/vendor/bootstrap-vue/src/icons/plugin.js +0 -4159
- package/src/vendor/bootstrap-vue/src/icons-only.js +0 -33
- package/src/vendor/bootstrap-vue/src/icons.scss +0 -8
|
@@ -1,156 +0,0 @@
|
|
|
1
|
-
// Base icon styling
|
|
2
|
-
.b-icon {
|
|
3
|
-
&.bi {
|
|
4
|
-
display: inline-block;
|
|
5
|
-
overflow: visible;
|
|
6
|
-
// The following is required to compensate for alignment
|
|
7
|
-
// issues with the Bootstrap Icons alpha implementation
|
|
8
|
-
vertical-align: $b-icon-vertical-offset;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
&.b-icon-animation-cylon,
|
|
12
|
-
&.b-iconstack .b-icon-animation-cylon > g {
|
|
13
|
-
transform-origin: center;
|
|
14
|
-
animation: $b-icon-animation-cylon-duration infinite ease-in-out alternate
|
|
15
|
-
b-icon-animation-cylon;
|
|
16
|
-
|
|
17
|
-
@media (prefers-reduced-motion: reduce) {
|
|
18
|
-
animation: none;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
&.b-icon-animation-cylon-vertical,
|
|
23
|
-
&.b-iconstack .b-icon-animation-cylon-vertical > g {
|
|
24
|
-
transform-origin: center;
|
|
25
|
-
animation: $b-icon-animation-cylon-vertical-duration infinite ease-in-out alternate
|
|
26
|
-
b-icon-animation-cylon-vertical;
|
|
27
|
-
|
|
28
|
-
@media (prefers-reduced-motion: reduce) {
|
|
29
|
-
animation: none;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
&.b-icon-animation-fade,
|
|
34
|
-
&.b-iconstack .b-icon-animation-fade > g {
|
|
35
|
-
transform-origin: center;
|
|
36
|
-
animation: $b-icon-animation-fade-duration infinite ease-in-out alternate b-icon-animation-fade;
|
|
37
|
-
|
|
38
|
-
@media (prefers-reduced-motion: reduce) {
|
|
39
|
-
animation: none;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
&.b-icon-animation-spin,
|
|
44
|
-
&.b-iconstack .b-icon-animation-spin > g {
|
|
45
|
-
transform-origin: center;
|
|
46
|
-
animation: $b-icon-animation-spin-duration infinite linear normal b-icon-animation-spin;
|
|
47
|
-
|
|
48
|
-
@media (prefers-reduced-motion: reduce) {
|
|
49
|
-
animation: none;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
&.b-icon-animation-spin-reverse,
|
|
54
|
-
&.b-iconstack .b-icon-animation-spin-reverse > g {
|
|
55
|
-
transform-origin: center;
|
|
56
|
-
animation: $b-icon-animation-spin-reverse-duration infinite linear reverse b-icon-animation-spin;
|
|
57
|
-
|
|
58
|
-
@media (prefers-reduced-motion: reduce) {
|
|
59
|
-
animation: none;
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
&.b-icon-animation-spin-pulse,
|
|
64
|
-
&.b-iconstack .b-icon-animation-spin-pulse > g {
|
|
65
|
-
transform-origin: center;
|
|
66
|
-
animation: $b-icon-animation-spin-pulse-duration infinite steps(8) normal b-icon-animation-spin;
|
|
67
|
-
|
|
68
|
-
@media (prefers-reduced-motion: reduce) {
|
|
69
|
-
animation: none;
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
&.b-icon-animation-spin-reverse-pulse,
|
|
74
|
-
&.b-iconstack .b-icon-animation-spin-reverse-pulse > g {
|
|
75
|
-
transform-origin: center;
|
|
76
|
-
animation: $b-icon-animation-spin-reverse-pulse-duration infinite steps(8) reverse
|
|
77
|
-
b-icon-animation-spin;
|
|
78
|
-
|
|
79
|
-
@media (prefers-reduced-motion: reduce) {
|
|
80
|
-
animation: none;
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
&.b-icon-animation-throb,
|
|
85
|
-
&.b-iconstack .b-icon-animation-throb > g {
|
|
86
|
-
transform-origin: center;
|
|
87
|
-
animation: $b-icon-animation-throb-duration infinite ease-in-out alternate
|
|
88
|
-
b-icon-animation-throb;
|
|
89
|
-
|
|
90
|
-
@media (prefers-reduced-motion: reduce) {
|
|
91
|
-
animation: none;
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
// Animation for spinning icons
|
|
97
|
-
@keyframes b-icon-animation-cylon {
|
|
98
|
-
0% {
|
|
99
|
-
transform: translateX(-25%);
|
|
100
|
-
}
|
|
101
|
-
100% {
|
|
102
|
-
transform: translateX(25%);
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
@keyframes b-icon-animation-cylon-vertical {
|
|
107
|
-
0% {
|
|
108
|
-
transform: translateY(25%);
|
|
109
|
-
}
|
|
110
|
-
100% {
|
|
111
|
-
transform: translateY(-25%);
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
@keyframes b-icon-animation-fade {
|
|
116
|
-
0% {
|
|
117
|
-
opacity: 0.1;
|
|
118
|
-
}
|
|
119
|
-
100% {
|
|
120
|
-
opacity: 1;
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
@keyframes b-icon-animation-spin {
|
|
125
|
-
0% {
|
|
126
|
-
transform: rotate(0deg);
|
|
127
|
-
}
|
|
128
|
-
100% {
|
|
129
|
-
transform: rotate(359deg);
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
@keyframes b-icon-animation-throb {
|
|
134
|
-
0% {
|
|
135
|
-
opacity: 0.5;
|
|
136
|
-
transform: scale(0.5);
|
|
137
|
-
}
|
|
138
|
-
100% {
|
|
139
|
-
opacity: 1;
|
|
140
|
-
transform: scale(1);
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
// Make icons slightly larger in buttons, nav-links, dropdowns, and input-group-text
|
|
145
|
-
.btn,
|
|
146
|
-
.nav-link,
|
|
147
|
-
.dropdown-toggle,
|
|
148
|
-
.dropdown-item,
|
|
149
|
-
.input-group-text {
|
|
150
|
-
.b-icon {
|
|
151
|
-
&.bi {
|
|
152
|
-
font-size: 125%;
|
|
153
|
-
vertical-align: text-bottom;
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
}
|
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
import { extend, mergeData } from '../../vue'
|
|
2
|
-
import { NAME_ICON_BASE } from '../../constants/components'
|
|
3
|
-
import { PROP_TYPE_BOOLEAN, PROP_TYPE_NUMBER_STRING, PROP_TYPE_STRING } from '../../constants/props'
|
|
4
|
-
import { identity } from '../../utils/identity'
|
|
5
|
-
import { isUndefinedOrNull } from '../../utils/inspect'
|
|
6
|
-
import { mathMax } from '../../utils/math'
|
|
7
|
-
import { toFloat } from '../../utils/number'
|
|
8
|
-
import { makeProp } from '../../utils/props'
|
|
9
|
-
|
|
10
|
-
// --- Constants ---
|
|
11
|
-
|
|
12
|
-
// Base attributes needed on all icons
|
|
13
|
-
const BASE_ATTRS = {
|
|
14
|
-
viewBox: '0 0 16 16',
|
|
15
|
-
width: '1em',
|
|
16
|
-
height: '1em',
|
|
17
|
-
focusable: 'false',
|
|
18
|
-
role: 'img',
|
|
19
|
-
'aria-label': 'icon'
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
// Attributes that are nulled out when stacked
|
|
23
|
-
const STACKED_ATTRS = {
|
|
24
|
-
width: null,
|
|
25
|
-
height: null,
|
|
26
|
-
focusable: null,
|
|
27
|
-
role: null,
|
|
28
|
-
'aria-label': null
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
// --- Props ---
|
|
32
|
-
|
|
33
|
-
export const props = {
|
|
34
|
-
animation: makeProp(PROP_TYPE_STRING),
|
|
35
|
-
content: makeProp(PROP_TYPE_STRING),
|
|
36
|
-
flipH: makeProp(PROP_TYPE_BOOLEAN, false),
|
|
37
|
-
flipV: makeProp(PROP_TYPE_BOOLEAN, false),
|
|
38
|
-
fontScale: makeProp(PROP_TYPE_NUMBER_STRING, 1),
|
|
39
|
-
rotate: makeProp(PROP_TYPE_NUMBER_STRING, 0),
|
|
40
|
-
scale: makeProp(PROP_TYPE_NUMBER_STRING, 1),
|
|
41
|
-
shiftH: makeProp(PROP_TYPE_NUMBER_STRING, 0),
|
|
42
|
-
shiftV: makeProp(PROP_TYPE_NUMBER_STRING, 0),
|
|
43
|
-
stacked: makeProp(PROP_TYPE_BOOLEAN, false),
|
|
44
|
-
title: makeProp(PROP_TYPE_STRING),
|
|
45
|
-
variant: makeProp(PROP_TYPE_STRING)
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
// --- Main component ---
|
|
49
|
-
|
|
50
|
-
// Shared private base component to reduce bundle/runtime size
|
|
51
|
-
// @vue/component
|
|
52
|
-
export const BVIconBase = /*#__PURE__*/ extend({
|
|
53
|
-
name: NAME_ICON_BASE,
|
|
54
|
-
functional: true,
|
|
55
|
-
props,
|
|
56
|
-
render(h, { data, props, children }) {
|
|
57
|
-
const { animation, content, flipH, flipV, stacked, title, variant } = props
|
|
58
|
-
const fontScale = mathMax(toFloat(props.fontScale, 1), 0) || 1
|
|
59
|
-
const scale = mathMax(toFloat(props.scale, 1), 0) || 1
|
|
60
|
-
const rotate = toFloat(props.rotate, 0)
|
|
61
|
-
const shiftH = toFloat(props.shiftH, 0)
|
|
62
|
-
const shiftV = toFloat(props.shiftV, 0)
|
|
63
|
-
// Compute the transforms
|
|
64
|
-
// Note that order is important as SVG transforms are applied in order from
|
|
65
|
-
// left to right and we want flipping/scale to occur before rotation
|
|
66
|
-
// Note shifting is applied separately
|
|
67
|
-
// Assumes that the viewbox is `0 0 16 16` (`8 8` is the center)
|
|
68
|
-
const hasScale = flipH || flipV || scale !== 1
|
|
69
|
-
const hasTransforms = hasScale || rotate
|
|
70
|
-
const hasShift = shiftH || shiftV
|
|
71
|
-
const hasContent = !isUndefinedOrNull(content)
|
|
72
|
-
const transforms = [
|
|
73
|
-
hasTransforms ? 'translate(8 8)' : null,
|
|
74
|
-
hasScale ? `scale(${(flipH ? -1 : 1) * scale} ${(flipV ? -1 : 1) * scale})` : null,
|
|
75
|
-
rotate ? `rotate(${rotate})` : null,
|
|
76
|
-
hasTransforms ? 'translate(-8 -8)' : null
|
|
77
|
-
].filter(identity)
|
|
78
|
-
|
|
79
|
-
// We wrap the content in a `<g>` for handling the transforms (except shift)
|
|
80
|
-
let $inner = h(
|
|
81
|
-
'g',
|
|
82
|
-
{
|
|
83
|
-
attrs: { transform: transforms.join(' ') || null },
|
|
84
|
-
domProps: hasContent ? { innerHTML: content || '' } : {}
|
|
85
|
-
},
|
|
86
|
-
children
|
|
87
|
-
)
|
|
88
|
-
|
|
89
|
-
// If needed, we wrap in an additional `<g>` in order to handle the shifting
|
|
90
|
-
if (hasShift) {
|
|
91
|
-
$inner = h(
|
|
92
|
-
'g',
|
|
93
|
-
{ attrs: { transform: `translate(${(16 * shiftH) / 16} ${(-16 * shiftV) / 16})` } },
|
|
94
|
-
[$inner]
|
|
95
|
-
)
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
// Wrap in an additional `<g>` for proper animation handling if stacked
|
|
99
|
-
if (stacked) {
|
|
100
|
-
$inner = h('g', [$inner])
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
const $title = title ? h('title', title) : null
|
|
104
|
-
|
|
105
|
-
const $content = [$title, $inner].filter(identity)
|
|
106
|
-
|
|
107
|
-
return h(
|
|
108
|
-
'svg',
|
|
109
|
-
mergeData(
|
|
110
|
-
{
|
|
111
|
-
staticClass: 'b-icon bi',
|
|
112
|
-
class: {
|
|
113
|
-
[`text-${variant}`]: variant,
|
|
114
|
-
[`b-icon-animation-${animation}`]: animation
|
|
115
|
-
},
|
|
116
|
-
attrs: BASE_ATTRS,
|
|
117
|
-
style: stacked ? {} : { fontSize: fontScale === 1 ? null : `${fontScale * 100}%` }
|
|
118
|
-
},
|
|
119
|
-
// Merge in user supplied data
|
|
120
|
-
data,
|
|
121
|
-
// If icon is stacked, null-out some attrs
|
|
122
|
-
stacked ? { attrs: STACKED_ATTRS } : {},
|
|
123
|
-
// These cannot be overridden by users
|
|
124
|
-
{
|
|
125
|
-
attrs: {
|
|
126
|
-
xmlns: stacked ? null : 'http://www.w3.org/2000/svg',
|
|
127
|
-
fill: 'currentColor'
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
),
|
|
131
|
-
$content
|
|
132
|
-
)
|
|
133
|
-
}
|
|
134
|
-
})
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { extend, mergeData } from '../../vue'
|
|
2
|
-
import { omit } from '../../utils/object'
|
|
3
|
-
import { kebabCase, pascalCase, trim } from '../../utils/string'
|
|
4
|
-
import { BVIconBase, props as BVIconBaseProps } from './icon-base'
|
|
5
|
-
|
|
6
|
-
const iconProps = omit(BVIconBaseProps, ['content'])
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Icon component generator function
|
|
10
|
-
*
|
|
11
|
-
* @param {string} icon name (minus the leading `BIcon`)
|
|
12
|
-
* @param {string} raw `innerHTML` for SVG
|
|
13
|
-
* @return {VueComponent}
|
|
14
|
-
*/
|
|
15
|
-
export const makeIcon = (name, content) => {
|
|
16
|
-
// For performance reason we pre-compute some values, so that
|
|
17
|
-
// they are not computed on each render of the icon component
|
|
18
|
-
const kebabName = kebabCase(name)
|
|
19
|
-
const iconName = `BIcon${pascalCase(name)}`
|
|
20
|
-
const iconNameClass = `bi-${kebabName}`
|
|
21
|
-
const iconTitle = kebabName.replace(/-/g, ' ')
|
|
22
|
-
const svgContent = trim(content || '')
|
|
23
|
-
|
|
24
|
-
return /*#__PURE__*/ extend({
|
|
25
|
-
name: iconName,
|
|
26
|
-
functional: true,
|
|
27
|
-
props: iconProps,
|
|
28
|
-
render(h, { data, props }) {
|
|
29
|
-
return h(
|
|
30
|
-
BVIconBase,
|
|
31
|
-
mergeData(
|
|
32
|
-
// Defaults
|
|
33
|
-
{
|
|
34
|
-
props: { title: iconTitle },
|
|
35
|
-
attrs: { 'aria-label': iconTitle }
|
|
36
|
-
},
|
|
37
|
-
// User data
|
|
38
|
-
data,
|
|
39
|
-
// Required data
|
|
40
|
-
{
|
|
41
|
-
staticClass: iconNameClass,
|
|
42
|
-
props: { ...props, content: svgContent }
|
|
43
|
-
}
|
|
44
|
-
)
|
|
45
|
-
)
|
|
46
|
-
}
|
|
47
|
-
})
|
|
48
|
-
}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { Vue, extend, mergeData } from '../vue'
|
|
2
|
-
import { NAME_ICON } from '../constants/components'
|
|
3
|
-
import { PROP_TYPE_STRING } from '../constants/props'
|
|
4
|
-
import { RX_ICON_PREFIX } from '../constants/regex'
|
|
5
|
-
import { omit, sortKeys } from '../utils/object'
|
|
6
|
-
import { makeProp, makePropsConfigurable, pluckProps } from '../utils/props'
|
|
7
|
-
import { pascalCase, trim } from '../utils/string'
|
|
8
|
-
import { BIconBlank } from './icons'
|
|
9
|
-
import { props as BVIconBaseProps } from './helpers/icon-base'
|
|
10
|
-
|
|
11
|
-
// --- Helper methods ---
|
|
12
|
-
|
|
13
|
-
const findIconComponent = (ctx, iconName) => {
|
|
14
|
-
if (!ctx) {
|
|
15
|
-
return Vue.component(iconName)
|
|
16
|
-
}
|
|
17
|
-
const components = (ctx.$options || {}).components
|
|
18
|
-
const iconComponent = components && components[iconName]
|
|
19
|
-
return iconComponent || findIconComponent(ctx.$parent, iconName)
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
// --- Props ---
|
|
23
|
-
|
|
24
|
-
const iconProps = omit(BVIconBaseProps, ['content'])
|
|
25
|
-
|
|
26
|
-
export const props = makePropsConfigurable(
|
|
27
|
-
sortKeys({
|
|
28
|
-
...iconProps,
|
|
29
|
-
icon: makeProp(PROP_TYPE_STRING)
|
|
30
|
-
}),
|
|
31
|
-
NAME_ICON
|
|
32
|
-
)
|
|
33
|
-
|
|
34
|
-
// --- Main component ---
|
|
35
|
-
|
|
36
|
-
// Helper BIcon component
|
|
37
|
-
// Requires the requested icon component to be installed
|
|
38
|
-
// @vue/component
|
|
39
|
-
export const BIcon = /*#__PURE__*/ extend({
|
|
40
|
-
name: NAME_ICON,
|
|
41
|
-
functional: true,
|
|
42
|
-
props,
|
|
43
|
-
render(h, { data, props, parent }) {
|
|
44
|
-
const icon = pascalCase(trim(props.icon || '')).replace(RX_ICON_PREFIX, '')
|
|
45
|
-
|
|
46
|
-
// If parent context exists, we check to see if the icon has been registered
|
|
47
|
-
// either locally in the parent component, or globally at the `$root` level
|
|
48
|
-
// If not registered, we render a blank icon
|
|
49
|
-
return h(
|
|
50
|
-
icon ? findIconComponent(parent, `BIcon${icon}`) || BIconBlank : BIconBlank,
|
|
51
|
-
mergeData(data, { props: pluckProps(iconProps, props) })
|
|
52
|
-
)
|
|
53
|
-
}
|
|
54
|
-
})
|