@gitlab/ui 128.5.1 → 128.6.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": "128.5.1",
3
+ "version": "128.6.0",
4
4
  "description": "GitLab UI Components",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -196,6 +196,14 @@ export default {
196
196
  required: false,
197
197
  default: false,
198
198
  },
199
+ /**
200
+ * Allows the dropdown panel to match the width of the trigger element
201
+ */
202
+ panelMatchTriggerWidth: {
203
+ type: Boolean,
204
+ required: false,
205
+ default: false,
206
+ },
199
207
  /**
200
208
  * Strategy to be applied by computePosition. If this is set to fixed, the dropdown's position
201
209
  * needs to be set to fixed in CSS as well.
@@ -362,7 +370,8 @@ export default {
362
370
  panelClasses() {
363
371
  return {
364
372
  '!gl-block': this.visible,
365
- [FIXED_WIDTH_CLASS]: !this.fluidWidth,
373
+ [FIXED_WIDTH_CLASS]: !this.fluidWidth && !this.panelMatchTriggerWidth,
374
+ 'gl-new-dropdown-panel-fluid-width': this.fluidWidth && !this.panelMatchTriggerWidth,
366
375
  'gl-fixed': this.openedYet && this.isFixed,
367
376
  'gl-absolute': this.openedYet && !this.isFixed,
368
377
  };
@@ -397,6 +406,11 @@ export default {
397
406
  maxWidth: `${Math.max(0, availableWidth)}px`,
398
407
  }
399
408
  : {};
409
+ const triggerWidth = this.panelMatchTriggerWidth
410
+ ? {
411
+ minWidth: `${this.toggleElement.getBoundingClientRect().width}px`,
412
+ }
413
+ : {};
400
414
 
401
415
  Object.assign(
402
416
  contentsEl.style,
@@ -404,6 +418,7 @@ export default {
404
418
  maxHeight: `${Math.max(contentsAvailableHeight, 0)}px`,
405
419
  },
406
420
  maxWidth,
421
+ triggerWidth,
407
422
  );
408
423
  },
409
424
  }),
@@ -112,9 +112,12 @@
112
112
  @apply gl-drop-shadow-md;
113
113
  top: 0;
114
114
  left: 0;
115
+ z-index: 1000;
116
+ }
117
+
118
+ .gl-new-dropdown-panel-fluid-width {
115
119
  min-width: $gl-new-dropdown-min-width;
116
120
  max-width: $gl-new-dropdown-max-width;
117
- z-index: 1000;
118
121
  }
119
122
 
120
123
  .gl-new-dropdown-inner {
@@ -346,6 +346,14 @@ export default {
346
346
  required: false,
347
347
  default: false,
348
348
  },
349
+ /**
350
+ * Allows the dropdown panel to match the width of the trigger element
351
+ */
352
+ panelMatchTriggerWidth: {
353
+ type: Boolean,
354
+ required: false,
355
+ default: false,
356
+ },
349
357
  /**
350
358
  * Strategy to be applied by computePosition. If the dropdown's container is too short for it to
351
359
  * fit in, setting this to fixed will let it position itself above its container.
@@ -980,6 +988,7 @@ export default {
980
988
  :placement="placement"
981
989
  :offset="dropdownOffset"
982
990
  :fluid-width="fluidWidth"
991
+ :panel-match-trigger-width="panelMatchTriggerWidth"
983
992
  :positioning-strategy="positioningStrategy"
984
993
  @[$options.events.GL_DROPDOWN_FOCUS_CONTENT]="onFocusContent"
985
994
  @[$options.events.GL_DROPDOWN_SHOWN]="onShow"