@gitlab/ui 86.7.0 → 86.8.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gitlab/ui",
3
- "version": "86.7.0",
3
+ "version": "86.8.0",
4
4
  "description": "GitLab UI Components",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -33,10 +33,9 @@ $label-padding-horizontal-half: 0.375 * $grid-size;
33
33
  @include gl-overflow-hidden;
34
34
  @include gl-reset-color;
35
35
  @include gl-max-w-full;
36
- @include gl-text-decoration-none;
37
36
 
38
- &:focus,
39
37
  &:hover,
38
+ &:focus,
40
39
  &:focus:active {
41
40
  @include gl-reset-color;
42
41
  @include gl-shadow-none;
@@ -44,6 +43,19 @@ $label-padding-horizontal-half: 0.375 * $grid-size;
44
43
  }
45
44
  }
46
45
 
46
+ .gl-label-link-underline {
47
+ text-decoration: none;
48
+
49
+ &:hover,
50
+ &:focus,
51
+ &:focus:active {
52
+ .gl-label-text,
53
+ .gl-label-text-scoped {
54
+ text-decoration: underline;
55
+ }
56
+ }
57
+ }
58
+
47
59
  .gl-label-text,
48
60
  .gl-label-text-scoped {
49
61
  @include gl-display-block;
@@ -125,6 +125,7 @@ export default {
125
125
  ref="labelTitle"
126
126
  :href="target ? target : false"
127
127
  class="gl-label-link"
128
+ :class="{ 'gl-label-link-underline': target }"
128
129
  tabindex="0"
129
130
  >
130
131
  <span class="gl-label-text">
@@ -21,10 +21,10 @@ import {
21
21
  POSITION_FIXED,
22
22
  } from '../constants';
23
23
  import { logWarning, isElementTabbable, isElementFocusable } from '../../../../utils/utils';
24
-
25
24
  import GlButton from '../../button/button.vue';
26
25
  import GlIcon from '../../icon/icon.vue';
27
- import { OutsideDirective } from '../../../../directives/outside/outside';
26
+ import BaseDropdownDeprecatedWrapper from './base_dropdown_deprecated_wrapper.vue';
27
+ import BaseDropdownImprovedWrapper from './base_dropdown_improved_wrapper.vue';
28
28
  import { DEFAULT_OFFSET, FIXED_WIDTH_CLASS } from './constants';
29
29
 
30
30
  export const BASE_DROPDOWN_CLASS = 'gl-new-dropdown';
@@ -35,8 +35,9 @@ export default {
35
35
  components: {
36
36
  GlButton,
37
37
  GlIcon,
38
+ BaseDropdownDeprecatedWrapper,
39
+ BaseDropdownImprovedWrapper,
38
40
  },
39
- directives: { Outside: OutsideDirective },
40
41
  props: {
41
42
  toggleText: {
42
43
  type: String,
@@ -160,6 +161,14 @@ export default {
160
161
  default: POSITION_ABSOLUTE,
161
162
  validator: (strategy) => [POSITION_ABSOLUTE, POSITION_FIXED].includes(strategy),
162
163
  },
164
+ /**
165
+ * Whether to use the deprecated or improved wrapper
166
+ */
167
+ improvedHideHeuristics: {
168
+ type: Boolean,
169
+ required: false,
170
+ default: false,
171
+ },
163
172
  },
164
173
  data() {
165
174
  return {
@@ -169,6 +178,11 @@ export default {
169
178
  };
170
179
  },
171
180
  computed: {
181
+ wrapperComponent() {
182
+ return this.improvedHideHeuristics
183
+ ? BaseDropdownImprovedWrapper
184
+ : BaseDropdownDeprecatedWrapper;
185
+ },
172
186
  hasNoVisibleToggleText() {
173
187
  return !this.toggleText?.length || this.textSrOnly;
174
188
  },
@@ -462,7 +476,11 @@ export default {
462
476
  </script>
463
477
 
464
478
  <template>
465
- <div v-outside="close" :class="[$options.BASE_DROPDOWN_CLASS, { 'gl-display-block!': block }]">
479
+ <component
480
+ :is="wrapperComponent"
481
+ :class="[$options.BASE_DROPDOWN_CLASS, { 'gl-display-block!': block }]"
482
+ @close="close"
483
+ >
466
484
  <component
467
485
  :is="toggleComponent"
468
486
  v-bind="toggleAttributes"
@@ -497,5 +515,5 @@ export default {
497
515
  <slot></slot>
498
516
  </div>
499
517
  </div>
500
- </div>
518
+ </component>
501
519
  </template>
@@ -0,0 +1,14 @@
1
+ <script>
2
+ import { OutsideDirective } from '../../../../directives/outside/outside';
3
+
4
+ export default {
5
+ name: 'BaseDropdownDeprecatedWrapper',
6
+ directives: { Outside: OutsideDirective },
7
+ };
8
+ </script>
9
+
10
+ <template>
11
+ <div v-outside="(event) => $emit('close', event)">
12
+ <slot></slot>
13
+ </div>
14
+ </template>
@@ -0,0 +1,14 @@
1
+ <script>
2
+ import { OutsideDirective } from '../../../../directives/outside/outside';
3
+
4
+ export default {
5
+ name: 'BaseDropdownImprovedWrapper',
6
+ directives: { Outside: OutsideDirective },
7
+ };
8
+ </script>
9
+
10
+ <template>
11
+ <div v-outside.click.focusin="(event) => $emit('close', event)">
12
+ <slot></slot>
13
+ </div>
14
+ </template>
@@ -228,6 +228,15 @@ export default {
228
228
  required: false,
229
229
  default: false,
230
230
  },
231
+ /**
232
+ * Whether to use an improved hide
233
+ * functionality for the dropdown.
234
+ */
235
+ improvedHideHeuristics: {
236
+ type: Boolean,
237
+ required: false,
238
+ default: false,
239
+ },
231
240
  },
232
241
  data() {
233
242
  return {
@@ -378,6 +387,7 @@ export default {
378
387
  :offset="dropdownOffset"
379
388
  :fluid-width="fluidWidth"
380
389
  :positioning-strategy="positioningStrategy"
390
+ :improved-hide-heuristics="improvedHideHeuristics"
381
391
  class="gl-disclosure-dropdown"
382
392
  @[$options.events.GL_DROPDOWN_SHOWN]="onShow"
383
393
  @[$options.events.GL_DROPDOWN_HIDDEN]="onHide"
@@ -349,6 +349,15 @@ export default {
349
349
  '%d results'
350
350
  ),
351
351
  },
352
+ /**
353
+ * Whether to use an improved hide
354
+ * functionality for the dropdown.
355
+ */
356
+ improvedHideHeuristics: {
357
+ type: Boolean,
358
+ required: false,
359
+ default: false,
360
+ },
352
361
  },
353
362
  data() {
354
363
  return {
@@ -770,6 +779,7 @@ export default {
770
779
  :offset="dropdownOffset"
771
780
  :fluid-width="fluidWidth"
772
781
  :positioning-strategy="positioningStrategy"
782
+ :improved-hide-heuristics="improvedHideHeuristics"
773
783
  @[$options.events.GL_DROPDOWN_SHOWN]="onShow"
774
784
  @[$options.events.GL_DROPDOWN_HIDDEN]="onHide"
775
785
  >
@@ -98,9 +98,13 @@ function parseBinding({ arg, value, modifiers }) {
98
98
  );
99
99
  }
100
100
 
101
- if (modifiersList.some((modifier) => !supportedEventTypes.includes(modifier))) {
101
+ const unsupportedModifiers = modifiersList.filter(
102
+ (modifier) => !supportedEventTypes.includes(modifier)
103
+ );
104
+
105
+ if (unsupportedModifiers.length > 0) {
102
106
  throw new Error(
103
- `[GlOutsideDirective] Cannot bind ${modifiersList} events; supported event types are: ${supportedEventTypes.join(
107
+ `[GlOutsideDirective] Cannot bind ${unsupportedModifiers.join(', ')} events; supported event types are: ${supportedEventTypes.join(
104
108
  ', '
105
109
  )}`
106
110
  );