@gitlab/ui 82.0.0 → 82.1.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 +14 -0
- package/dist/components/base/popover/popover.js +6 -3
- package/dist/directives/outside/outside.js +9 -17
- 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/package.json +1 -1
- package/src/components/base/popover/popover.scss +7 -0
- package/src/components/base/popover/popover.vue +17 -3
- package/src/directives/outside/outside.js +7 -11
- package/src/scss/gitlab_ui.scss +3 -0
- package/dist/directives/outside/get_event_like_time_stamp.js +0 -33
- package/src/directives/outside/LICENSE +0 -21
- package/src/directives/outside/get_event_like_time_stamp.js +0 -31
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
# [82.1.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v82.0.1...v82.1.0) (2024-06-20)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* **CSS:** include design token CSS custom properties in gitlab_ui.scss ([1a8db73](https://gitlab.com/gitlab-org/gitlab-ui/commit/1a8db73bde228ef91ee86660515c180984bdeebf))
|
|
7
|
+
|
|
8
|
+
## [82.0.1](https://gitlab.com/gitlab-org/gitlab-ui/compare/v82.0.0...v82.0.1) (2024-06-19)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* **GlPopover:** properly align the close button without title ([e4f314f](https://gitlab.com/gitlab-org/gitlab-ui/commit/e4f314f1113058b12f3af65921bc4145b0a47155))
|
|
14
|
+
|
|
1
15
|
# [82.0.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v81.1.0...v82.0.0) (2024-06-18)
|
|
2
16
|
|
|
3
17
|
|
|
@@ -52,11 +52,14 @@ var script = {
|
|
|
52
52
|
}
|
|
53
53
|
},
|
|
54
54
|
computed: {
|
|
55
|
+
hasTitle() {
|
|
56
|
+
return this.$scopedSlots.title || this.title;
|
|
57
|
+
},
|
|
55
58
|
customClass() {
|
|
56
|
-
return ['gl-popover', ...this.cssClasses].join(' ');
|
|
59
|
+
return ['gl-popover', this.hasTitle && 'has-title', this.showCloseButton && 'has-close-button', ...this.cssClasses].filter(Boolean).join(' ');
|
|
57
60
|
},
|
|
58
61
|
shouldShowTitle() {
|
|
59
|
-
return this
|
|
62
|
+
return this.hasTitle || this.showCloseButton;
|
|
60
63
|
}
|
|
61
64
|
},
|
|
62
65
|
methods: {
|
|
@@ -75,7 +78,7 @@ var script = {
|
|
|
75
78
|
const __vue_script__ = script;
|
|
76
79
|
|
|
77
80
|
/* template */
|
|
78
|
-
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('b-popover',_vm._g(_vm._b({ref:_vm.$options.popoverRefName,attrs:{"custom-class":_vm.customClass,"triggers":_vm.triggers,"title":_vm.title,"placement":_vm.placement,"boundary-padding":_vm.boundaryPadding},scopedSlots:_vm._u([(_vm.shouldShowTitle)?{key:"title",fn:function(){return [_vm._t("title",function(){return [_vm._v("\n "+_vm._s(_vm.title)+"\n ")]}),_vm._v(" "),(_vm.showCloseButton)?_c('div',{staticClass:"gl-mt-n2 gl-mr-n3 gl-ml-3 gl-h-0"},[_c('close-button',{attrs:{"data-testid":"close-button"},on:{"click":_vm.close}})],1):_vm._e()]},proxy:true}:null],null,true)},'b-popover',_vm.$attrs,false),_vm.$listeners),[_vm._v(" "),_vm._t("default")],2)};
|
|
81
|
+
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('b-popover',_vm._g(_vm._b({ref:_vm.$options.popoverRefName,attrs:{"custom-class":_vm.customClass,"triggers":_vm.triggers,"title":_vm.title,"placement":_vm.placement,"boundary-padding":_vm.boundaryPadding},scopedSlots:_vm._u([(_vm.shouldShowTitle)?{key:"title",fn:function(){return [_vm._t("title",function(){return [_vm._v("\n "+_vm._s(_vm.title)+"\n ")]}),_vm._v(" "),(_vm.showCloseButton)?_c('div',{staticClass:"gl-mt-n2 gl-mr-n3 gl-ml-3 gl-h-0"},[_c('close-button',{class:{ 'gl-float-right gl-mt-2': !_vm.hasTitle },attrs:{"data-testid":"close-button"},on:{"click":_vm.close}})],1):_vm._e()]},proxy:true}:null],null,true)},'b-popover',_vm.$attrs,false),_vm.$listeners),[_vm._v(" "),_vm._t("default")],2)};
|
|
79
82
|
var __vue_staticRenderFns__ = [];
|
|
80
83
|
|
|
81
84
|
/* style */
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import { getEventLikeTimeStamp } from './get_event_like_time_stamp';
|
|
2
|
-
|
|
3
1
|
/**
|
|
4
|
-
* Map<HTMLElement,
|
|
2
|
+
* Map<HTMLElement, Function>
|
|
5
3
|
*/
|
|
6
4
|
const callbacks = new Map();
|
|
7
5
|
|
|
@@ -11,17 +9,11 @@ const callbacks = new Map();
|
|
|
11
9
|
let listening = false;
|
|
12
10
|
let lastMousedown = null;
|
|
13
11
|
const globalListener = event => {
|
|
14
|
-
callbacks.forEach((
|
|
15
|
-
let {
|
|
16
|
-
bindTimeStamp,
|
|
17
|
-
callback
|
|
18
|
-
} = _ref;
|
|
12
|
+
callbacks.forEach((callback, element) => {
|
|
19
13
|
const originalEvent = lastMousedown || event;
|
|
20
14
|
if (
|
|
21
15
|
// Ignore events that aren't targeted outside the element
|
|
22
|
-
element.contains(originalEvent.target)
|
|
23
|
-
// Only consider events triggered after the directive was bound
|
|
24
|
-
event.timeStamp <= bindTimeStamp) {
|
|
16
|
+
element.contains(originalEvent.target)) {
|
|
25
17
|
return;
|
|
26
18
|
}
|
|
27
19
|
try {
|
|
@@ -47,6 +39,9 @@ const startListening = () => {
|
|
|
47
39
|
return;
|
|
48
40
|
}
|
|
49
41
|
document.addEventListener('mousedown', onMousedown);
|
|
42
|
+
// Added { capture: true } to prevent the behavior discussed in https://gitlab.com/gitlab-org/gitlab-ui/-/merge_requests/1686#note_412545027
|
|
43
|
+
// Ensures the event listener handles the event in the capturing phase, avoiding issues encountered previously.
|
|
44
|
+
// Cannot be tested with Jest or Cypress, but can be tested with Playwright in the future: https://gitlab.com/gitlab-org/gitlab-ui/-/merge_requests/4272#note_1947425384
|
|
50
45
|
document.addEventListener('click', globalListener, {
|
|
51
46
|
capture: true
|
|
52
47
|
});
|
|
@@ -61,11 +56,11 @@ const stopListening = () => {
|
|
|
61
56
|
document.removeEventListener('click', globalListener);
|
|
62
57
|
listening = false;
|
|
63
58
|
};
|
|
64
|
-
const bind = (el,
|
|
59
|
+
const bind = (el, _ref) => {
|
|
65
60
|
let {
|
|
66
61
|
value,
|
|
67
62
|
arg = 'click'
|
|
68
|
-
} =
|
|
63
|
+
} = _ref;
|
|
69
64
|
if (typeof value !== 'function') {
|
|
70
65
|
throw new Error(`[GlOutsideDirective] Value must be a function; got ${typeof value}!`);
|
|
71
66
|
}
|
|
@@ -87,10 +82,7 @@ const bind = (el, _ref2) => {
|
|
|
87
82
|
if (!listening) {
|
|
88
83
|
startListening();
|
|
89
84
|
}
|
|
90
|
-
callbacks.set(el,
|
|
91
|
-
bindTimeStamp: getEventLikeTimeStamp(),
|
|
92
|
-
callback: value
|
|
93
|
-
});
|
|
85
|
+
callbacks.set(el, value);
|
|
94
86
|
};
|
|
95
87
|
const unbind = el => {
|
|
96
88
|
callbacks.delete(el);
|