@gitlab/ui 67.0.0 → 67.2.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/directives/outside/outside.js +14 -1
- package/dist/tokens/css/tokens.css +1 -1
- package/dist/tokens/css/tokens.dark.css +1 -1
- package/dist/tokens/js/tokens.dark.js +1 -1
- package/dist/tokens/js/tokens.js +1 -1
- package/dist/tokens/scss/_tokens.dark.scss +1 -1
- package/dist/tokens/scss/_tokens.scss +1 -1
- package/dist/utility_classes.css +1 -1
- package/dist/utility_classes.css.map +1 -1
- package/package.json +3 -3
- package/src/directives/outside/outside.js +14 -1
- package/src/directives/outside/outside.spec.js +19 -25
- package/src/scss/utilities.scss +8 -0
- package/src/scss/utility-mixins/color.scss +4 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
# [67.2.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v67.1.0...v67.2.0) (2023-10-30)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* **GlOutsideDirective:** respect mousedown events before click ([e2d72d5](https://gitlab.com/gitlab-org/gitlab-ui/commit/e2d72d5cc4d90c57fea3eb54f43d68338cab5ab4))
|
|
7
|
+
|
|
8
|
+
# [67.1.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v67.0.0...v67.1.0) (2023-10-27)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Features
|
|
12
|
+
|
|
13
|
+
* **color:** Add utility classes used in top header ([6d3e4cf](https://gitlab.com/gitlab-org/gitlab-ui/commit/6d3e4cfab9f78dfbfd81b1678fde6d0733fb769e))
|
|
14
|
+
|
|
1
15
|
# [67.0.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v66.37.0...v67.0.0) (2023-10-27)
|
|
2
16
|
|
|
3
17
|
|
|
@@ -9,15 +9,17 @@ const callbacks = new Map();
|
|
|
9
9
|
* Is a global listener already set up?
|
|
10
10
|
*/
|
|
11
11
|
let listening = false;
|
|
12
|
+
let lastMousedown = null;
|
|
12
13
|
const globalListener = event => {
|
|
13
14
|
callbacks.forEach((_ref, element) => {
|
|
14
15
|
let {
|
|
15
16
|
bindTimeStamp,
|
|
16
17
|
callback
|
|
17
18
|
} = _ref;
|
|
19
|
+
const originalEvent = lastMousedown || event;
|
|
18
20
|
if (
|
|
19
21
|
// Ignore events that aren't targeted outside the element
|
|
20
|
-
element.contains(
|
|
22
|
+
element.contains(originalEvent.target) ||
|
|
21
23
|
// Only consider events triggered after the directive was bound
|
|
22
24
|
event.timeStamp <= bindTimeStamp) {
|
|
23
25
|
return;
|
|
@@ -31,20 +33,31 @@ const globalListener = event => {
|
|
|
31
33
|
}
|
|
32
34
|
}
|
|
33
35
|
});
|
|
36
|
+
lastMousedown = null;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
// We need to listen for mouse events because text selection fires click event only when selection ends.
|
|
40
|
+
// This means that the click event target could differ from the element where it originally started.
|
|
41
|
+
// As example: if we use mouse events we could guarantee that selecting text within a dropdown won't close it.
|
|
42
|
+
const onMousedown = event => {
|
|
43
|
+
lastMousedown = event;
|
|
34
44
|
};
|
|
35
45
|
const startListening = () => {
|
|
36
46
|
if (listening) {
|
|
37
47
|
return;
|
|
38
48
|
}
|
|
49
|
+
document.addEventListener('mousedown', onMousedown);
|
|
39
50
|
document.addEventListener('click', globalListener, {
|
|
40
51
|
capture: true
|
|
41
52
|
});
|
|
42
53
|
listening = true;
|
|
54
|
+
lastMousedown = null;
|
|
43
55
|
};
|
|
44
56
|
const stopListening = () => {
|
|
45
57
|
if (!listening) {
|
|
46
58
|
return;
|
|
47
59
|
}
|
|
60
|
+
document.removeEventListener('mousedown', onMousedown);
|
|
48
61
|
document.removeEventListener('click', globalListener);
|
|
49
62
|
listening = false;
|
|
50
63
|
};
|
package/dist/tokens/js/tokens.js
CHANGED