@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/dist/tailwind.css CHANGED
@@ -1,2 +1,2 @@
1
- .gl-fixed{position:fixed}.\!gl-absolute{position:absolute!important}.gl-absolute{position:absolute}.gl-relative{position:relative}.gl-bottom-0{bottom:0}.gl-bottom-2{bottom:.25rem}.gl-left-0{left:0}.gl-right-2{right:.25rem}.gl-fill-current{fill:currentColor}.gl-fill-gray-100{fill:var(--gray-100,#dcdcde)}.gl-fill-icon-danger{fill:var(--gl-icon-color-danger,var(--gl-color-red-600,#c91c00))}.gl-fill-icon-default{fill:var(--gl-icon-color-default,var(--gl-color-neutral-700,#535158))}.gl-fill-icon-disabled{fill:var(--gl-icon-color-disabled,var(--gl-color-neutral-300,#a4a3a8))}.gl-fill-icon-info{fill:var(--gl-icon-color-info,var(--gl-color-blue-600,#1068bf))}.gl-fill-icon-link{fill:var(--gl-icon-color-link,var(--gl-color-blue-600,#1068bf))}.gl-fill-icon-strong{fill:var(--gl-icon-color-strong,var(--gl-color-neutral-900,#333238))}.gl-fill-icon-subtle{fill:var(--gl-icon-color-subtle,var(--gl-color-neutral-500,#737278))}.gl-fill-icon-success{fill:var(--gl-icon-color-success,var(--gl-color-green-600,#217645))}.gl-fill-icon-warning{fill:var(--gl-icon-color-warning,var(--gl-color-orange-600,#9e5400))}.gl-text-blue-100{color:var(--blue-100,#cbe2f9)}.gl-text-blue-500{color:var(--blue-500,#1f75cb)}.gl-text-blue-900{color:var(--blue-900,#033464)}.gl-text-danger{color:var(--gl-text-color-danger,var(--gl-color-red-600,#c91c00))}.gl-text-gray-400{color:var(--gray-400,#89888d)}.gl-text-gray-500{color:var(--gray-500,#737278)}.gl-text-gray-600{color:var(--gray-600,#626168)}.gl-text-gray-700{color:var(--gray-700,#535158)}.gl-text-gray-900{color:var(--gray-900,#333238)}.gl-text-gray-950{color:var(--gray-950,#1f1e24)}.gl-text-green-500{color:var(--green-500,#108548)}.gl-text-green-600{color:var(--green-600,#217645)}.gl-text-orange-500{color:var(--orange-500,#ab6100)}.gl-text-red-300{color:var(--red-300,#f57f6c)}.gl-text-red-500{color:var(--red-500,#dd2b0e)}.gl-text-red-600{color:var(--red-600,#c91c00)}.gl-text-secondary{color:var(--gl-text-secondary,#737278)}.gl-text-strong{color:var(--gl-text-color-strong,var(--gl-color-neutral-950,#1f1e24))}.gl-text-subtle{color:var(--gl-text-color-subtle,var(--gl-color-neutral-600,#626168))}.gl-text-white{color:var(--white,#fff)}
1
+ .gl-fixed{position:fixed}.\!gl-absolute{position:absolute!important}.gl-absolute{position:absolute}.gl-relative{position:relative}.gl-bottom-0{bottom:0}.gl-bottom-2{bottom:.25rem}.gl-left-0{left:0}.gl-right-2{right:.25rem}.gl-float-right{float:right}.gl-fill-current{fill:currentColor}.gl-fill-gray-100{fill:var(--gray-100,#dcdcde)}.gl-fill-icon-danger{fill:var(--gl-icon-color-danger,var(--gl-color-red-600,#c91c00))}.gl-fill-icon-default{fill:var(--gl-icon-color-default,var(--gl-color-neutral-700,#535158))}.gl-fill-icon-disabled{fill:var(--gl-icon-color-disabled,var(--gl-color-neutral-300,#a4a3a8))}.gl-fill-icon-info{fill:var(--gl-icon-color-info,var(--gl-color-blue-600,#1068bf))}.gl-fill-icon-link{fill:var(--gl-icon-color-link,var(--gl-color-blue-600,#1068bf))}.gl-fill-icon-strong{fill:var(--gl-icon-color-strong,var(--gl-color-neutral-900,#333238))}.gl-fill-icon-subtle{fill:var(--gl-icon-color-subtle,var(--gl-color-neutral-500,#737278))}.gl-fill-icon-success{fill:var(--gl-icon-color-success,var(--gl-color-green-600,#217645))}.gl-fill-icon-warning{fill:var(--gl-icon-color-warning,var(--gl-color-orange-600,#9e5400))}.gl-text-blue-100{color:var(--blue-100,#cbe2f9)}.gl-text-blue-500{color:var(--blue-500,#1f75cb)}.gl-text-blue-900{color:var(--blue-900,#033464)}.gl-text-danger{color:var(--gl-text-color-danger,var(--gl-color-red-600,#c91c00))}.gl-text-gray-400{color:var(--gray-400,#89888d)}.gl-text-gray-500{color:var(--gray-500,#737278)}.gl-text-gray-600{color:var(--gray-600,#626168)}.gl-text-gray-700{color:var(--gray-700,#535158)}.gl-text-gray-900{color:var(--gray-900,#333238)}.gl-text-gray-950{color:var(--gray-950,#1f1e24)}.gl-text-green-500{color:var(--green-500,#108548)}.gl-text-green-600{color:var(--green-600,#217645)}.gl-text-orange-500{color:var(--orange-500,#ab6100)}.gl-text-red-300{color:var(--red-300,#f57f6c)}.gl-text-red-500{color:var(--red-500,#dd2b0e)}.gl-text-red-600{color:var(--red-600,#c91c00)}.gl-text-secondary{color:var(--gl-text-secondary,#737278)}.gl-text-strong{color:var(--gl-text-color-strong,var(--gl-color-neutral-950,#1f1e24))}.gl-text-subtle{color:var(--gl-text-color-subtle,var(--gl-color-neutral-600,#626168))}.gl-text-white{color:var(--white,#fff)}
2
2
  /*# sourceMappingURL=tailwind.css.map */
@@ -1 +1 @@
1
- {"version":3,"sources":["tailwind.css"],"names":[],"mappings":"AAAA,UAAA,cAAmB,CAAnB,eAAA,2BAAmB,CAAnB,aAAA,iBAAmB,CAAnB,aAAA,iBAAmB,CAAnB,aAAA,QAAmB,CAAnB,aAAA,aAAmB,CAAnB,WAAA,MAAmB,CAAnB,YAAA,YAAmB,CAAnB,iBAAA,iBAAmB,CAAnB,kBAAA,4BAAmB,CAAnB,qBAAA,gEAAmB,CAAnB,sBAAA,qEAAmB,CAAnB,uBAAA,sEAAmB,CAAnB,mBAAA,+DAAmB,CAAnB,mBAAA,+DAAmB,CAAnB,qBAAA,oEAAmB,CAAnB,qBAAA,oEAAmB,CAAnB,sBAAA,mEAAmB,CAAnB,sBAAA,oEAAmB,CAAnB,kBAAA,6BAAmB,CAAnB,kBAAA,6BAAmB,CAAnB,kBAAA,6BAAmB,CAAnB,gBAAA,iEAAmB,CAAnB,kBAAA,6BAAmB,CAAnB,kBAAA,6BAAmB,CAA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BAAA,qEAAmB,CAAnB,gBAAA,qEAAmB,CAAnB,eAAA,uBAAmB","file":"tailwind.css","sourcesContent":["@tailwind utilities;\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gitlab/ui",
3
- "version": "82.0.0",
3
+ "version": "82.1.0",
4
4
  "description": "GitLab UI Components",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -67,12 +67,19 @@ $gl-popover-max-width: $grid-size * 35;
67
67
  @include gl-bg-white;
68
68
  @include gl-border-bottom-0;
69
69
  @include gl-pb-0;
70
+ }
71
+
72
+ &.has-title .popover-header {
70
73
  @include gl-overflow-anywhere;
71
74
  display: flex;
72
75
  align-items: flex-start;
73
76
  justify-content: space-between;
74
77
  }
75
78
 
79
+ &.has-close-button:not(.has-title) .popover-header {
80
+ padding-top: $gl-spacing-scale-2;
81
+ }
82
+
76
83
  .popover-body {
77
84
  @include gl-py-3;
78
85
  @include gl-px-4;
@@ -53,11 +53,21 @@ export default {
53
53
  },
54
54
  },
55
55
  computed: {
56
+ hasTitle() {
57
+ return this.$scopedSlots.title || this.title;
58
+ },
56
59
  customClass() {
57
- return ['gl-popover', ...this.cssClasses].join(' ');
60
+ return [
61
+ 'gl-popover',
62
+ this.hasTitle && 'has-title',
63
+ this.showCloseButton && 'has-close-button',
64
+ ...this.cssClasses,
65
+ ]
66
+ .filter(Boolean)
67
+ .join(' ');
58
68
  },
59
69
  shouldShowTitle() {
60
- return this.$scopedSlots.title || this.title || this.showCloseButton;
70
+ return this.hasTitle || this.showCloseButton;
61
71
  },
62
72
  },
63
73
  methods: {
@@ -89,7 +99,11 @@ export default {
89
99
  {{ title }}
90
100
  </slot>
91
101
  <div v-if="showCloseButton" class="gl-mt-n2 gl-mr-n3 gl-ml-3 gl-h-0">
92
- <close-button data-testid="close-button" @click="close" />
102
+ <close-button
103
+ :class="{ 'gl-float-right gl-mt-2': !hasTitle }"
104
+ data-testid="close-button"
105
+ @click="close"
106
+ />
93
107
  </div>
94
108
  </template>
95
109
  <slot></slot>
@@ -1,7 +1,5 @@
1
- import { getEventLikeTimeStamp } from './get_event_like_time_stamp';
2
-
3
1
  /**
4
- * Map<HTMLElement, { bindTimeStamp: number, callback: Function }>
2
+ * Map<HTMLElement, Function>
5
3
  */
6
4
  const callbacks = new Map();
7
5
 
@@ -12,13 +10,11 @@ let listening = false;
12
10
  let lastMousedown = null;
13
11
 
14
12
  const globalListener = (event) => {
15
- callbacks.forEach(({ bindTimeStamp, callback }, element) => {
13
+ callbacks.forEach((callback, element) => {
16
14
  const originalEvent = lastMousedown || event;
17
15
  if (
18
16
  // Ignore events that aren't targeted outside the element
19
- element.contains(originalEvent.target) ||
20
- // Only consider events triggered after the directive was bound
21
- event.timeStamp <= bindTimeStamp
17
+ element.contains(originalEvent.target)
22
18
  ) {
23
19
  return;
24
20
  }
@@ -48,6 +44,9 @@ const startListening = () => {
48
44
  }
49
45
 
50
46
  document.addEventListener('mousedown', onMousedown);
47
+ // Added { capture: true } to prevent the behavior discussed in https://gitlab.com/gitlab-org/gitlab-ui/-/merge_requests/1686#note_412545027
48
+ // Ensures the event listener handles the event in the capturing phase, avoiding issues encountered previously.
49
+ // 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
51
50
  document.addEventListener('click', globalListener, { capture: true });
52
51
  listening = true;
53
52
  lastMousedown = null;
@@ -91,10 +90,7 @@ const bind = (el, { value, arg = 'click' }) => {
91
90
  startListening();
92
91
  }
93
92
 
94
- callbacks.set(el, {
95
- bindTimeStamp: getEventLikeTimeStamp(),
96
- callback: value,
97
- });
93
+ callbacks.set(el, value);
98
94
  };
99
95
 
100
96
  const unbind = (el) => {
@@ -2,6 +2,9 @@
2
2
 
3
3
  @import 'bootstrap_vue';
4
4
 
5
+ // Design Tokens
6
+ @import 'tokens';
7
+
5
8
  // Settings
6
9
  @import 'functions';
7
10
  @import 'variables';
@@ -1,33 +0,0 @@
1
- /**
2
- * This file is based on Vue's scheduler code:
3
- * https://github.com/vuejs/vue/blob/v2.6.12/src/core/observer/scheduler.js#L44-L66
4
- *
5
- * See the LICENSE file in this directory.
6
- */
7
-
8
- const {
9
- performance
10
- } = window;
11
-
12
- /**
13
- * Get a current timestamp that can be meaningfully compared to an event's
14
- * `timeStamp` property.
15
- *
16
- * Event timestamps can be a DOMHighResTimeStamp (if supported), otherwise
17
- * a DOMTimeStamp (used by jsdom and older browsers).
18
- *
19
- * This function will return a current timestamp of the same type used by the
20
- * underlying environment when it creates DOM events.
21
- *
22
- * See https://developer.mozilla.org/en-US/docs/Web/API/Event/timeStamp for
23
- * more details.
24
- *
25
- * @returns {number}
26
- */
27
- const getEventLikeTimeStamp =
28
- // If the event timestamp, although evaluated AFTER the Date.now(), is
29
- // smaller, it means the event is using a hi-res timestamp, and we need to
30
- // use the hi-res version for event listener timestamps as well.
31
- typeof (performance === null || performance === void 0 ? void 0 : performance.now) === 'function' && Date.now() > document.createEvent('Event').timeStamp ? () => performance.now() : () => Date.now();
32
-
33
- export { getEventLikeTimeStamp };
@@ -1,21 +0,0 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) 2013-present, Yuxi (Evan) You
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in
13
- all copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
- THE SOFTWARE.
@@ -1,31 +0,0 @@
1
- /**
2
- * This file is based on Vue's scheduler code:
3
- * https://github.com/vuejs/vue/blob/v2.6.12/src/core/observer/scheduler.js#L44-L66
4
- *
5
- * See the LICENSE file in this directory.
6
- */
7
-
8
- const { performance } = window;
9
-
10
- /**
11
- * Get a current timestamp that can be meaningfully compared to an event's
12
- * `timeStamp` property.
13
- *
14
- * Event timestamps can be a DOMHighResTimeStamp (if supported), otherwise
15
- * a DOMTimeStamp (used by jsdom and older browsers).
16
- *
17
- * This function will return a current timestamp of the same type used by the
18
- * underlying environment when it creates DOM events.
19
- *
20
- * See https://developer.mozilla.org/en-US/docs/Web/API/Event/timeStamp for
21
- * more details.
22
- *
23
- * @returns {number}
24
- */
25
- export const getEventLikeTimeStamp =
26
- // If the event timestamp, although evaluated AFTER the Date.now(), is
27
- // smaller, it means the event is using a hi-res timestamp, and we need to
28
- // use the hi-res version for event listener timestamps as well.
29
- typeof performance?.now === 'function' && Date.now() > document.createEvent('Event').timeStamp
30
- ? () => performance.now()
31
- : () => Date.now();