@gitlab/ui 97.3.0 → 98.0.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 +13 -0
- package/dist/index.js +0 -1
- package/dist/vendor/bootstrap-vue/src/components/collapse/collapse.js +3 -36
- package/dist/vendor/bootstrap-vue/src/components/tabs/tabs.js +1 -1
- package/dist/vendor/bootstrap-vue/src/components/transition/bv-transition.js +12 -2
- package/dist/vendor/bootstrap-vue/src/constants/components.js +1 -3
- package/dist/vendor/bootstrap-vue/src/constants/env.js +1 -2
- package/dist/vendor/bootstrap-vue/src/index.js +0 -2
- package/dist/vendor/bootstrap-vue/src/mixins/dropdown.js +12 -39
- package/package.json +2 -1
- package/src/index.js +0 -1
- package/src/scss/bootstrap_vue.scss +0 -1
- package/src/scss/components.scss +0 -1
- package/src/vendor/bootstrap-vue/package.json +3 -20
- package/src/vendor/bootstrap-vue/src/components/collapse/MODIFICATIONS.md +14 -0
- package/src/vendor/bootstrap-vue/src/components/collapse/collapse.js +3 -37
- package/src/vendor/bootstrap-vue/src/components/collapse/collapse.spec.js +0 -132
- package/src/vendor/bootstrap-vue/src/components/collapse/package.json +0 -4
- package/src/vendor/bootstrap-vue/src/components/dropdown/README.md +1 -1
- package/src/vendor/bootstrap-vue/src/components/form-input/form-input.spec.js +3 -0
- package/src/vendor/bootstrap-vue/src/components/index.d.ts +0 -1
- package/src/vendor/bootstrap-vue/src/components/index.scss +0 -1
- package/src/vendor/bootstrap-vue/src/components/modal/MODIFICATIONS.md +8 -5
- package/src/vendor/bootstrap-vue/src/components/nav/package.json +1 -1
- package/src/vendor/bootstrap-vue/src/components/popover/popover.spec.js +0 -1
- package/src/vendor/bootstrap-vue/src/components/table/table-filtering.spec.js +1 -1
- package/src/vendor/bootstrap-vue/src/components/tabs/tabs.js +1 -1
- package/src/vendor/bootstrap-vue/src/components/toast/toast.spec.js +6 -18
- package/src/vendor/bootstrap-vue/src/components/tooltip/tooltip.spec.js +67 -356
- package/src/vendor/bootstrap-vue/src/components/transition/bv-transition.js +15 -2
- package/src/vendor/bootstrap-vue/src/constants/components.js +0 -2
- package/src/vendor/bootstrap-vue/src/constants/env.js +0 -3
- package/src/vendor/bootstrap-vue/src/directives/tooltip/tooltip.spec.js +46 -79
- package/src/vendor/bootstrap-vue/src/index.js +0 -4
- package/src/vendor/bootstrap-vue/src/mixins/dropdown.js +12 -36
- package/src/vendor/bootstrap-vue/src/utils/config.spec.js +20 -2
- package/dist/components/base/navbar/navbar.js +0 -48
- package/dist/vendor/bootstrap-vue/src/components/navbar/index.js +0 -2
- package/dist/vendor/bootstrap-vue/src/components/navbar/navbar-brand.js +0 -40
- package/dist/vendor/bootstrap-vue/src/components/navbar/navbar.js +0 -72
- package/src/components/base/navbar/navbar.md +0 -4
- package/src/components/base/navbar/navbar.scss +0 -0
- package/src/components/base/navbar/navbar.vue +0 -17
- package/src/vendor/bootstrap-vue/src/components/navbar/README.md +0 -332
- package/src/vendor/bootstrap-vue/src/components/navbar/_navbar.scss +0 -1
- package/src/vendor/bootstrap-vue/src/components/navbar/index.d.ts +0 -10
- package/src/vendor/bootstrap-vue/src/components/navbar/index.js +0 -4
- package/src/vendor/bootstrap-vue/src/components/navbar/index.scss +0 -1
- package/src/vendor/bootstrap-vue/src/components/navbar/navbar-brand.js +0 -42
- package/src/vendor/bootstrap-vue/src/components/navbar/navbar-brand.spec.js +0 -50
- package/src/vendor/bootstrap-vue/src/components/navbar/navbar.js +0 -78
- package/src/vendor/bootstrap-vue/src/components/navbar/navbar.spec.js +0 -130
- package/src/vendor/bootstrap-vue/src/components/navbar/package.json +0 -54
|
@@ -42,6 +42,8 @@ export const props = {
|
|
|
42
42
|
transProps: makeProp(PROP_TYPE_OBJECT)
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
+
const hasAnimateSupport = Boolean(Element.prototype.animate)
|
|
46
|
+
|
|
45
47
|
// --- Main component ---
|
|
46
48
|
|
|
47
49
|
// @vue/component
|
|
@@ -67,8 +69,19 @@ export const BVTransition = /*#__PURE__*/ extend({
|
|
|
67
69
|
transProps = {
|
|
68
70
|
mode: props.mode,
|
|
69
71
|
...transProps,
|
|
70
|
-
|
|
71
|
-
|
|
72
|
+
/*
|
|
73
|
+
bootstrap-vue says: We always need `css` true
|
|
74
|
+
|
|
75
|
+
@gitlab/ui says: OMG. THE FREAKING TRANSITIONS.
|
|
76
|
+
So apparently jsdom doesn't implement animations (who can blame them)
|
|
77
|
+
but a Vue Transition relies on the native animationend/transitionend
|
|
78
|
+
events in order to fire onAfterLeave. jsdom will never fire the `onAfterLeave`
|
|
79
|
+
which is relied on by e.g. the tooltip component to do it's `hidden` logic.
|
|
80
|
+
|
|
81
|
+
So if in specs, we set `css: false`, everything will work as expected.
|
|
82
|
+
The best way we have found is to do a feature detection on `Element.prototype.animate`
|
|
83
|
+
*/
|
|
84
|
+
css: hasAnimateSupport
|
|
72
85
|
}
|
|
73
86
|
|
|
74
87
|
const dataCopy = { ...data }
|
|
@@ -39,8 +39,6 @@ export const NAME_INPUT_GROUP_TEXT = 'BInputGroupText'
|
|
|
39
39
|
export const NAME_LINK = 'BLink'
|
|
40
40
|
export const NAME_MODAL = 'BModal'
|
|
41
41
|
export const NAME_NAV = 'BNav'
|
|
42
|
-
export const NAME_NAVBAR = 'BNavbar'
|
|
43
|
-
export const NAME_NAVBAR_BRAND = 'BNavbarBrand'
|
|
44
42
|
export const NAME_NAV_ITEM = 'BNavItem'
|
|
45
43
|
export const NAME_NAV_ITEM_DROPDOWN = 'BNavItemDropdown'
|
|
46
44
|
export const NAME_POPOVER = 'BPopover'
|
|
@@ -40,9 +40,6 @@ export const HAS_PASSIVE_EVENT_SUPPORT = (() => {
|
|
|
40
40
|
return passiveEventSupported
|
|
41
41
|
})()
|
|
42
42
|
|
|
43
|
-
export const HAS_TOUCH_SUPPORT =
|
|
44
|
-
IS_BROWSER && ('ontouchstart' in DOCUMENT.documentElement || NAVIGATOR.maxTouchPoints > 0)
|
|
45
|
-
|
|
46
43
|
export const HAS_POINTER_EVENT_SUPPORT =
|
|
47
44
|
IS_BROWSER && Boolean(WINDOW.PointerEvent || WINDOW.MSPointerEvent)
|
|
48
45
|
|
|
@@ -5,6 +5,9 @@ import { VBTooltip } from './tooltip'
|
|
|
5
5
|
// Key which we use to store tooltip object on element
|
|
6
6
|
const BV_TOOLTIP = '__BV_Tooltip__'
|
|
7
7
|
|
|
8
|
+
/**
|
|
9
|
+
* @gitlab/ui Note: These specs have been rewritten to be working with jest >= 29
|
|
10
|
+
*/
|
|
8
11
|
describe('v-b-tooltip directive', () => {
|
|
9
12
|
const originalCreateRange = document.createRange
|
|
10
13
|
const origGetBCR = Element.prototype.getBoundingClientRect
|
|
@@ -40,9 +43,27 @@ describe('v-b-tooltip directive', () => {
|
|
|
40
43
|
Element.prototype.getBoundingClientRect = origGetBCR
|
|
41
44
|
})
|
|
42
45
|
|
|
43
|
-
|
|
44
|
-
|
|
46
|
+
/**
|
|
47
|
+
* Little helper to wait until a tooltip is shown after a click
|
|
48
|
+
*
|
|
49
|
+
* @param $button {VueTestUtils.VueWrapper}
|
|
50
|
+
* @returns {Promise<void>}
|
|
51
|
+
*/
|
|
52
|
+
function waitForTooltipAfterClickOn($button) {
|
|
53
|
+
return new Promise(resolve => {
|
|
54
|
+
const resolver = () => {
|
|
55
|
+
$button.vm.$root.$off('bv::tooltip::shown', resolver)
|
|
56
|
+
resolve()
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
$button.vm.$root.$on('bv::tooltip::shown', resolver)
|
|
60
|
+
|
|
61
|
+
// Trigger click
|
|
62
|
+
$button.trigger('click')
|
|
63
|
+
})
|
|
64
|
+
}
|
|
45
65
|
|
|
66
|
+
it('should have BVTooltip Vue class instance', async () => {
|
|
46
67
|
const App = {
|
|
47
68
|
directives: {
|
|
48
69
|
bTooltip: VBTooltip
|
|
@@ -50,34 +71,24 @@ describe('v-b-tooltip directive', () => {
|
|
|
50
71
|
template: '<button v-b-tooltip title="foobar">button</button>'
|
|
51
72
|
}
|
|
52
73
|
|
|
53
|
-
const
|
|
74
|
+
const $button = mount(App, {
|
|
54
75
|
attachTo: document.body
|
|
55
76
|
})
|
|
56
77
|
|
|
57
|
-
expect(
|
|
58
|
-
await waitNT(
|
|
59
|
-
await waitRAF()
|
|
60
|
-
await waitNT(wrapper.vm)
|
|
61
|
-
await waitRAF()
|
|
62
|
-
await waitNT(wrapper.vm)
|
|
63
|
-
await waitRAF()
|
|
64
|
-
jest.runOnlyPendingTimers()
|
|
65
|
-
await waitNT(wrapper.vm)
|
|
78
|
+
expect($button.vm).toBeDefined()
|
|
79
|
+
await waitNT($button.vm)
|
|
66
80
|
await waitRAF()
|
|
67
81
|
|
|
68
|
-
expect(
|
|
69
|
-
const $button = wrapper.find('button')
|
|
82
|
+
expect($button.element.tagName).toBe('BUTTON')
|
|
70
83
|
|
|
71
84
|
// Should have instance of popover class on it
|
|
72
85
|
expect($button.element[BV_TOOLTIP]).toBeDefined()
|
|
73
86
|
expect($button.element[BV_TOOLTIP].$options.name).toBe('BVTooltip')
|
|
74
87
|
|
|
75
|
-
|
|
88
|
+
$button.destroy()
|
|
76
89
|
})
|
|
77
90
|
|
|
78
91
|
it('should work', async () => {
|
|
79
|
-
jest.useFakeTimers()
|
|
80
|
-
|
|
81
92
|
const App = {
|
|
82
93
|
directives: {
|
|
83
94
|
bTooltip: VBTooltip
|
|
@@ -85,23 +96,15 @@ describe('v-b-tooltip directive', () => {
|
|
|
85
96
|
template: '<button v-b-tooltip.click.html title="<b>foobar</b>">button</button>'
|
|
86
97
|
}
|
|
87
98
|
|
|
88
|
-
const
|
|
99
|
+
const $button = mount(App, {
|
|
89
100
|
attachTo: document.body
|
|
90
101
|
})
|
|
91
102
|
|
|
92
|
-
expect(
|
|
93
|
-
await waitNT(
|
|
94
|
-
await waitRAF()
|
|
95
|
-
await waitNT(wrapper.vm)
|
|
96
|
-
await waitRAF()
|
|
97
|
-
await waitNT(wrapper.vm)
|
|
98
|
-
await waitRAF()
|
|
99
|
-
jest.runOnlyPendingTimers()
|
|
100
|
-
await waitNT(wrapper.vm)
|
|
103
|
+
expect($button.vm).toBeDefined()
|
|
104
|
+
await waitNT($button.vm)
|
|
101
105
|
await waitRAF()
|
|
102
106
|
|
|
103
|
-
expect(
|
|
104
|
-
const $button = wrapper.find('button')
|
|
107
|
+
expect($button.element.tagName).toBe('BUTTON')
|
|
105
108
|
|
|
106
109
|
// Should have instance of popover class on it
|
|
107
110
|
expect($button.element[BV_TOOLTIP]).toBeDefined()
|
|
@@ -109,13 +112,7 @@ describe('v-b-tooltip directive', () => {
|
|
|
109
112
|
|
|
110
113
|
expect($button.attributes('aria-describedby')).toBeUndefined()
|
|
111
114
|
|
|
112
|
-
|
|
113
|
-
await $button.trigger('click')
|
|
114
|
-
await waitRAF()
|
|
115
|
-
await waitRAF()
|
|
116
|
-
jest.runOnlyPendingTimers()
|
|
117
|
-
await waitNT(wrapper.vm)
|
|
118
|
-
await waitRAF()
|
|
115
|
+
await waitForTooltipAfterClickOn($button)
|
|
119
116
|
|
|
120
117
|
expect($button.attributes('aria-describedby')).toBeDefined()
|
|
121
118
|
const adb = $button.attributes('aria-describedby')
|
|
@@ -124,12 +121,10 @@ describe('v-b-tooltip directive', () => {
|
|
|
124
121
|
expect(tip).not.toBe(null)
|
|
125
122
|
expect(tip.classList.contains('tooltip')).toBe(true)
|
|
126
123
|
|
|
127
|
-
|
|
124
|
+
$button.destroy()
|
|
128
125
|
})
|
|
129
126
|
|
|
130
127
|
it('should not show tooltip when title is empty', async () => {
|
|
131
|
-
jest.useFakeTimers()
|
|
132
|
-
|
|
133
128
|
const App = {
|
|
134
129
|
directives: {
|
|
135
130
|
bTooltip: VBTooltip
|
|
@@ -137,23 +132,15 @@ describe('v-b-tooltip directive', () => {
|
|
|
137
132
|
template: '<button v-b-tooltip.click title="">button</button>'
|
|
138
133
|
}
|
|
139
134
|
|
|
140
|
-
const
|
|
135
|
+
const $button = mount(App, {
|
|
141
136
|
attachTo: document.body
|
|
142
137
|
})
|
|
143
138
|
|
|
144
|
-
expect(
|
|
145
|
-
await waitNT(
|
|
146
|
-
await waitRAF()
|
|
147
|
-
await waitNT(wrapper.vm)
|
|
148
|
-
await waitRAF()
|
|
149
|
-
await waitNT(wrapper.vm)
|
|
150
|
-
await waitRAF()
|
|
151
|
-
jest.runOnlyPendingTimers()
|
|
152
|
-
await waitNT(wrapper.vm)
|
|
139
|
+
expect($button.vm).toBeDefined()
|
|
140
|
+
await waitNT($button.vm)
|
|
153
141
|
await waitRAF()
|
|
154
142
|
|
|
155
|
-
expect(
|
|
156
|
-
const $button = wrapper.find('button')
|
|
143
|
+
expect($button.element.tagName).toBe('BUTTON')
|
|
157
144
|
|
|
158
145
|
// Should have instance of popover class on it
|
|
159
146
|
expect($button.element[BV_TOOLTIP]).toBeDefined()
|
|
@@ -163,20 +150,13 @@ describe('v-b-tooltip directive', () => {
|
|
|
163
150
|
|
|
164
151
|
// Trigger click
|
|
165
152
|
await $button.trigger('click')
|
|
166
|
-
await waitRAF()
|
|
167
|
-
await waitRAF()
|
|
168
|
-
jest.runOnlyPendingTimers()
|
|
169
|
-
await waitNT(wrapper.vm)
|
|
170
|
-
await waitRAF()
|
|
171
153
|
|
|
172
154
|
expect($button.attributes('aria-describedby')).toBeUndefined()
|
|
173
155
|
|
|
174
|
-
|
|
156
|
+
$button.destroy()
|
|
175
157
|
})
|
|
176
158
|
|
|
177
159
|
it('variant and customClass should work', async () => {
|
|
178
|
-
jest.useFakeTimers()
|
|
179
|
-
|
|
180
160
|
const App = {
|
|
181
161
|
directives: {
|
|
182
162
|
bTooltip: VBTooltip
|
|
@@ -184,30 +164,17 @@ describe('v-b-tooltip directive', () => {
|
|
|
184
164
|
template: `<button v-b-tooltip.click.html.v-info="{ customClass: 'foobar'}" title="<b>foobar</b>">button</button>`
|
|
185
165
|
}
|
|
186
166
|
|
|
187
|
-
const
|
|
167
|
+
const $button = mount(App, {
|
|
188
168
|
attachTo: document.body
|
|
189
169
|
})
|
|
190
170
|
|
|
191
|
-
expect(
|
|
192
|
-
|
|
193
|
-
const $button = wrapper.find('button')
|
|
194
|
-
await waitNT(wrapper.vm)
|
|
195
|
-
await waitRAF()
|
|
196
|
-
await waitNT(wrapper.vm)
|
|
197
|
-
await waitRAF()
|
|
198
|
-
await waitNT(wrapper.vm)
|
|
199
|
-
await waitRAF()
|
|
200
|
-
jest.runOnlyPendingTimers()
|
|
201
|
-
await waitNT(wrapper.vm)
|
|
171
|
+
expect($button.vm).toBeDefined()
|
|
172
|
+
await waitNT($button.vm)
|
|
202
173
|
await waitRAF()
|
|
203
174
|
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
await
|
|
207
|
-
await waitRAF()
|
|
208
|
-
jest.runOnlyPendingTimers()
|
|
209
|
-
await waitNT(wrapper.vm)
|
|
210
|
-
await waitRAF()
|
|
175
|
+
expect($button.element.tagName).toBe('BUTTON')
|
|
176
|
+
|
|
177
|
+
await waitForTooltipAfterClickOn($button)
|
|
211
178
|
|
|
212
179
|
expect($button.attributes('aria-describedby')).toBeDefined()
|
|
213
180
|
const adb = $button.attributes('aria-describedby')
|
|
@@ -218,6 +185,6 @@ describe('v-b-tooltip directive', () => {
|
|
|
218
185
|
expect(tip.classList.contains('b-tooltip-info')).toBe(true)
|
|
219
186
|
expect(tip.classList.contains('foobar')).toBe(true)
|
|
220
187
|
|
|
221
|
-
|
|
188
|
+
$button.destroy()
|
|
222
189
|
})
|
|
223
190
|
})
|
|
@@ -128,10 +128,6 @@ export { BNav } from './components/nav/nav'
|
|
|
128
128
|
export { BNavItem } from './components/nav/nav-item'
|
|
129
129
|
export { BNavItemDropdown } from './components/nav/nav-item-dropdown'
|
|
130
130
|
|
|
131
|
-
// export * from './components/navbar'
|
|
132
|
-
export { BNavbar } from './components/navbar/navbar'
|
|
133
|
-
export { BNavbarBrand } from './components/navbar/navbar-brand'
|
|
134
|
-
|
|
135
131
|
// export * from './components/popover'
|
|
136
132
|
export { BPopover } from './components/popover/popover'
|
|
137
133
|
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import Popper from 'popper.js'
|
|
2
2
|
import { extend } from '../vue'
|
|
3
3
|
import { NAME_DROPDOWN } from '../constants/components'
|
|
4
|
-
import { HAS_TOUCH_SUPPORT } from '../constants/env'
|
|
5
4
|
import {
|
|
6
5
|
EVENT_NAME_CLICK,
|
|
7
6
|
EVENT_NAME_HIDDEN,
|
|
@@ -29,7 +28,6 @@ import { HTMLElement } from '../constants/safe-types'
|
|
|
29
28
|
import { BvEvent } from '../utils/bv-event.class'
|
|
30
29
|
import { attemptFocus, closest, contains, isVisible, requestAF, selectAll } from '../utils/dom'
|
|
31
30
|
import { getRootEventName, stopEvent } from '../utils/events'
|
|
32
|
-
import { isNull } from '../utils/inspect'
|
|
33
31
|
import { mergeDeep, sortKeys } from '../utils/object'
|
|
34
32
|
import { makeProp, makePropsConfigurable } from '../utils/props'
|
|
35
33
|
import { warn } from '../utils/warn'
|
|
@@ -93,9 +91,6 @@ export const dropdownMixin = extend({
|
|
|
93
91
|
provide() {
|
|
94
92
|
return { getBvDropdown: () => this }
|
|
95
93
|
},
|
|
96
|
-
inject: {
|
|
97
|
-
getBvNavbar: { default: () => () => null }
|
|
98
|
-
},
|
|
99
94
|
props,
|
|
100
95
|
data() {
|
|
101
96
|
return {
|
|
@@ -104,12 +99,6 @@ export const dropdownMixin = extend({
|
|
|
104
99
|
}
|
|
105
100
|
},
|
|
106
101
|
computed: {
|
|
107
|
-
bvNavbar() {
|
|
108
|
-
return this.getBvNavbar()
|
|
109
|
-
},
|
|
110
|
-
inNavbar() {
|
|
111
|
-
return !isNull(this.bvNavbar)
|
|
112
|
-
},
|
|
113
102
|
toggler() {
|
|
114
103
|
const { toggle } = this.$refs
|
|
115
104
|
return toggle ? toggle.$el || toggle : null
|
|
@@ -128,10 +117,7 @@ export const dropdownMixin = extend({
|
|
|
128
117
|
// Position `static` is needed to allow menu to "breakout" of the `scrollParent`
|
|
129
118
|
// boundaries when boundary is anything other than `scrollParent`
|
|
130
119
|
// See: https://github.com/twbs/bootstrap/issues/24251#issuecomment-341413786
|
|
131
|
-
return this.boundary !== 'scrollParent'
|
|
132
|
-
},
|
|
133
|
-
hideDelay() {
|
|
134
|
-
return this.inNavbar ? (HAS_TOUCH_SUPPORT ? 300 : 50) : 0
|
|
120
|
+
return this.boundary !== 'scrollParent' ? 'position-static' : ''
|
|
135
121
|
}
|
|
136
122
|
},
|
|
137
123
|
watch: {
|
|
@@ -176,7 +162,6 @@ export const dropdownMixin = extend({
|
|
|
176
162
|
created() {
|
|
177
163
|
// Create private non-reactive props
|
|
178
164
|
this.$_popper = null
|
|
179
|
-
this.$_hideTimeout = null
|
|
180
165
|
},
|
|
181
166
|
/* istanbul ignore next */
|
|
182
167
|
deactivated() {
|
|
@@ -192,7 +177,6 @@ export const dropdownMixin = extend({
|
|
|
192
177
|
this.visible = false
|
|
193
178
|
this.whileOpenListen(false)
|
|
194
179
|
this.destroyPopper()
|
|
195
|
-
this.clearHideTimeout()
|
|
196
180
|
removeElementToInstance(this.$el)
|
|
197
181
|
},
|
|
198
182
|
methods: {
|
|
@@ -208,19 +192,16 @@ export const dropdownMixin = extend({
|
|
|
208
192
|
return
|
|
209
193
|
}
|
|
210
194
|
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
// Instantiate Popper.js
|
|
222
|
-
this.createPopper(el)
|
|
223
|
-
}
|
|
195
|
+
if (typeof Popper === 'undefined') {
|
|
196
|
+
/* istanbul ignore next */
|
|
197
|
+
warn('Popper.js not found. Falling back to CSS positioning', NAME_DROPDOWN)
|
|
198
|
+
} else {
|
|
199
|
+
// For dropup with alignment we use the parent element as popper container
|
|
200
|
+
let el = (this.dropup && this.right) || this.split ? this.$el : this.$refs.toggle
|
|
201
|
+
// Make sure we have a reference to an element, not a component!
|
|
202
|
+
el = el.$el || el
|
|
203
|
+
// Instantiate Popper.js
|
|
204
|
+
this.createPopper(el)
|
|
224
205
|
}
|
|
225
206
|
|
|
226
207
|
// Ensure other menus are closed
|
|
@@ -259,10 +240,6 @@ export const dropdownMixin = extend({
|
|
|
259
240
|
this.$_popper.scheduleUpdate()
|
|
260
241
|
} catch {}
|
|
261
242
|
},
|
|
262
|
-
clearHideTimeout() {
|
|
263
|
-
clearTimeout(this.$_hideTimeout)
|
|
264
|
-
this.$_hideTimeout = null
|
|
265
|
-
},
|
|
266
243
|
getPopperConfig() {
|
|
267
244
|
let placement = PLACEMENT_BOTTOM_START
|
|
268
245
|
if (this.dropup) {
|
|
@@ -400,8 +377,7 @@ export const dropdownMixin = extend({
|
|
|
400
377
|
hideHandler(event) {
|
|
401
378
|
const { target } = event
|
|
402
379
|
if (this.visible && !contains(this.$refs.menu, target) && !contains(this.toggler, target)) {
|
|
403
|
-
this.
|
|
404
|
-
this.$_hideTimeout = setTimeout(() => this.hide(), this.hideDelay)
|
|
380
|
+
this.hide()
|
|
405
381
|
}
|
|
406
382
|
},
|
|
407
383
|
// Document click-out listener
|
|
@@ -18,8 +18,26 @@ describe('utils/config', () => {
|
|
|
18
18
|
resetConfig()
|
|
19
19
|
})
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
/**
|
|
22
|
+
* We needed to adjust this test to have it reflect the @gitlab/ui defaults
|
|
23
|
+
*/
|
|
24
|
+
it('getConfig() works and has @gitlab/ui defaults', async () => {
|
|
25
|
+
expect(getConfig()).toEqual({
|
|
26
|
+
BPopover: {
|
|
27
|
+
delay: {
|
|
28
|
+
hide: 150,
|
|
29
|
+
show: 50
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
BTooltip: {
|
|
33
|
+
boundaryPadding: 5,
|
|
34
|
+
customClass: 'gl-tooltip',
|
|
35
|
+
delay: {
|
|
36
|
+
hide: 0,
|
|
37
|
+
show: 500
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
})
|
|
23
41
|
})
|
|
24
42
|
|
|
25
43
|
it('setConfig() works', async () => {
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { BNavbar } from '../../../vendor/bootstrap-vue/src/components/navbar/navbar';
|
|
2
|
-
import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
|
|
3
|
-
|
|
4
|
-
var script = {
|
|
5
|
-
name: 'GlNavbar',
|
|
6
|
-
components: {
|
|
7
|
-
BNavbar
|
|
8
|
-
},
|
|
9
|
-
inheritAttrs: false
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
/* script */
|
|
13
|
-
const __vue_script__ = script;
|
|
14
|
-
|
|
15
|
-
/* template */
|
|
16
|
-
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('b-navbar',_vm._g(_vm._b({staticClass:"gl-navbar"},'b-navbar',_vm.$attrs,false),_vm.$listeners),[_vm._t("default")],2)};
|
|
17
|
-
var __vue_staticRenderFns__ = [];
|
|
18
|
-
|
|
19
|
-
/* style */
|
|
20
|
-
const __vue_inject_styles__ = undefined;
|
|
21
|
-
/* scoped */
|
|
22
|
-
const __vue_scope_id__ = undefined;
|
|
23
|
-
/* module identifier */
|
|
24
|
-
const __vue_module_identifier__ = undefined;
|
|
25
|
-
/* functional template */
|
|
26
|
-
const __vue_is_functional_template__ = false;
|
|
27
|
-
/* style inject */
|
|
28
|
-
|
|
29
|
-
/* style inject SSR */
|
|
30
|
-
|
|
31
|
-
/* style inject shadow dom */
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
const __vue_component__ = __vue_normalize__(
|
|
36
|
-
{ render: __vue_render__, staticRenderFns: __vue_staticRenderFns__ },
|
|
37
|
-
__vue_inject_styles__,
|
|
38
|
-
__vue_script__,
|
|
39
|
-
__vue_scope_id__,
|
|
40
|
-
__vue_is_functional_template__,
|
|
41
|
-
__vue_module_identifier__,
|
|
42
|
-
false,
|
|
43
|
-
undefined,
|
|
44
|
-
undefined,
|
|
45
|
-
undefined
|
|
46
|
-
);
|
|
47
|
-
|
|
48
|
-
export default __vue_component__;
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { extend, mergeData } from '../../vue';
|
|
2
|
-
import { NAME_NAVBAR_BRAND } from '../../constants/components';
|
|
3
|
-
import { PROP_TYPE_STRING } from '../../constants/props';
|
|
4
|
-
import { omit, sortKeys } from '../../utils/object';
|
|
5
|
-
import { makePropsConfigurable, makeProp, pluckProps } from '../../utils/props';
|
|
6
|
-
import { props as props$1, BLink } from '../link/link';
|
|
7
|
-
|
|
8
|
-
// --- Props ---
|
|
9
|
-
|
|
10
|
-
const linkProps = omit(props$1, ['event', 'routerTag']);
|
|
11
|
-
linkProps.href.default = undefined;
|
|
12
|
-
linkProps.to.default = undefined;
|
|
13
|
-
const props = makePropsConfigurable(sortKeys({
|
|
14
|
-
...linkProps,
|
|
15
|
-
tag: makeProp(PROP_TYPE_STRING, 'div')
|
|
16
|
-
}), NAME_NAVBAR_BRAND);
|
|
17
|
-
|
|
18
|
-
// --- Main component ---
|
|
19
|
-
|
|
20
|
-
// @vue/component
|
|
21
|
-
const BNavbarBrand = /*#__PURE__*/extend({
|
|
22
|
-
name: NAME_NAVBAR_BRAND,
|
|
23
|
-
functional: true,
|
|
24
|
-
props,
|
|
25
|
-
render(h, _ref) {
|
|
26
|
-
let {
|
|
27
|
-
props,
|
|
28
|
-
data,
|
|
29
|
-
children
|
|
30
|
-
} = _ref;
|
|
31
|
-
const isLink = props.to || props.href;
|
|
32
|
-
const tag = isLink ? BLink : props.tag;
|
|
33
|
-
return h(tag, mergeData(data, {
|
|
34
|
-
staticClass: 'navbar-brand',
|
|
35
|
-
props: isLink ? pluckProps(linkProps, props) : {}
|
|
36
|
-
}), children);
|
|
37
|
-
}
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
export { BNavbarBrand, props };
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import { extend } from '../../vue';
|
|
2
|
-
import { NAME_NAVBAR } from '../../constants/components';
|
|
3
|
-
import { PROP_TYPE_STRING, PROP_TYPE_BOOLEAN, PROP_TYPE_BOOLEAN_STRING } from '../../constants/props';
|
|
4
|
-
import { getBreakpoints } from '../../utils/config';
|
|
5
|
-
import { isTag } from '../../utils/dom';
|
|
6
|
-
import { isString } from '../../utils/inspect';
|
|
7
|
-
import { makePropsConfigurable, makeProp } from '../../utils/props';
|
|
8
|
-
import { normalizeSlotMixin } from '../../mixins/normalize-slot';
|
|
9
|
-
|
|
10
|
-
// --- Props ---
|
|
11
|
-
|
|
12
|
-
const props = makePropsConfigurable({
|
|
13
|
-
fixed: makeProp(PROP_TYPE_STRING),
|
|
14
|
-
print: makeProp(PROP_TYPE_BOOLEAN, false),
|
|
15
|
-
sticky: makeProp(PROP_TYPE_BOOLEAN, false),
|
|
16
|
-
tag: makeProp(PROP_TYPE_STRING, 'nav'),
|
|
17
|
-
toggleable: makeProp(PROP_TYPE_BOOLEAN_STRING, false),
|
|
18
|
-
type: makeProp(PROP_TYPE_STRING, 'light'),
|
|
19
|
-
variant: makeProp(PROP_TYPE_STRING)
|
|
20
|
-
}, NAME_NAVBAR);
|
|
21
|
-
|
|
22
|
-
// --- Main component ---
|
|
23
|
-
|
|
24
|
-
// @vue/component
|
|
25
|
-
const BNavbar = /*#__PURE__*/extend({
|
|
26
|
-
name: NAME_NAVBAR,
|
|
27
|
-
mixins: [normalizeSlotMixin],
|
|
28
|
-
provide() {
|
|
29
|
-
return {
|
|
30
|
-
getBvNavbar: () => this
|
|
31
|
-
};
|
|
32
|
-
},
|
|
33
|
-
props,
|
|
34
|
-
computed: {
|
|
35
|
-
breakpointClass() {
|
|
36
|
-
const {
|
|
37
|
-
toggleable
|
|
38
|
-
} = this;
|
|
39
|
-
const xs = getBreakpoints()[0];
|
|
40
|
-
let breakpoint = null;
|
|
41
|
-
if (toggleable && isString(toggleable) && toggleable !== xs) {
|
|
42
|
-
breakpoint = `navbar-expand-${toggleable}`;
|
|
43
|
-
} else if (toggleable === false) {
|
|
44
|
-
breakpoint = 'navbar-expand';
|
|
45
|
-
}
|
|
46
|
-
return breakpoint;
|
|
47
|
-
}
|
|
48
|
-
},
|
|
49
|
-
render(h) {
|
|
50
|
-
const {
|
|
51
|
-
tag,
|
|
52
|
-
type,
|
|
53
|
-
variant,
|
|
54
|
-
fixed
|
|
55
|
-
} = this;
|
|
56
|
-
return h(tag, {
|
|
57
|
-
staticClass: 'navbar',
|
|
58
|
-
class: [{
|
|
59
|
-
'd-print': this.print,
|
|
60
|
-
'sticky-top': this.sticky,
|
|
61
|
-
[`navbar-${type}`]: type,
|
|
62
|
-
[`bg-${variant}`]: variant,
|
|
63
|
-
[`fixed-${fixed}`]: fixed
|
|
64
|
-
}, this.breakpointClass],
|
|
65
|
-
attrs: {
|
|
66
|
-
role: isTag(tag, 'nav') ? null : 'navigation'
|
|
67
|
-
}
|
|
68
|
-
}, [this.normalizeSlot()]);
|
|
69
|
-
}
|
|
70
|
-
});
|
|
71
|
-
|
|
72
|
-
export { BNavbar, props };
|
|
File without changes
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
import { BNavbar } from '../../../vendor/bootstrap-vue/src/components/navbar/navbar';
|
|
3
|
-
|
|
4
|
-
export default {
|
|
5
|
-
name: 'GlNavbar',
|
|
6
|
-
components: {
|
|
7
|
-
BNavbar,
|
|
8
|
-
},
|
|
9
|
-
inheritAttrs: false,
|
|
10
|
-
};
|
|
11
|
-
</script>
|
|
12
|
-
|
|
13
|
-
<template>
|
|
14
|
-
<b-navbar class="gl-navbar" v-bind="$attrs" v-on="$listeners">
|
|
15
|
-
<slot></slot>
|
|
16
|
-
</b-navbar>
|
|
17
|
-
</template>
|