@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 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(event.target) ||
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
  };
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Fri, 27 Oct 2023 09:40:39 GMT
3
+ * Generated on Mon, 30 Oct 2023 10:30:21 GMT
4
4
  */
5
5
 
6
6
  :root {
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Fri, 27 Oct 2023 09:40:39 GMT
3
+ * Generated on Mon, 30 Oct 2023 10:30:21 GMT
4
4
  */
5
5
 
6
6
  :root.gl-dark {
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Fri, 27 Oct 2023 09:40:39 GMT
3
+ * Generated on Mon, 30 Oct 2023 10:30:21 GMT
4
4
  */
5
5
 
6
6
  export const BLACK = "#fff";
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Fri, 27 Oct 2023 09:40:39 GMT
3
+ * Generated on Mon, 30 Oct 2023 10:30:21 GMT
4
4
  */
5
5
 
6
6
  export const BLACK = "#000";
@@ -1,6 +1,6 @@
1
1
 
2
2
  // Do not edit directly
3
- // Generated on Fri, 27 Oct 2023 09:40:39 GMT
3
+ // Generated on Mon, 30 Oct 2023 10:30:21 GMT
4
4
 
5
5
  $red-950: #fff4f3;
6
6
  $red-900: #fcf1ef;
@@ -1,6 +1,6 @@
1
1
 
2
2
  // Do not edit directly
3
- // Generated on Fri, 27 Oct 2023 09:40:39 GMT
3
+ // Generated on Mon, 30 Oct 2023 10:30:21 GMT
4
4
 
5
5
  $gl-line-height-52: 3.25rem;
6
6
  $gl-line-height-44: 2.75rem;