@gitlab/ui 64.13.1 → 64.13.3

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.
@@ -109,6 +109,11 @@ const dropdownPlacements = {
109
109
  center: 'bottom',
110
110
  right: 'bottom-end'
111
111
  };
112
+ const dropdownAllowedAutoPlacements = {
113
+ left: [dropdownPlacements.left, 'top-start'],
114
+ center: [dropdownPlacements.center, 'top'],
115
+ right: [dropdownPlacements.right, 'top-end']
116
+ };
112
117
  const buttonSizeOptions = {
113
118
  small: 'sm',
114
119
  medium: 'md'
@@ -257,4 +262,4 @@ const loadingIconSizes = {
257
262
  'xl (64x64)': 'xl'
258
263
  };
259
264
 
260
- export { COMMA, LEFT_MOUSE_BUTTON, alertVariantIconMap, alertVariantOptions, alignOptions, avatarShapeOptions, avatarSizeOptions, avatarsInlineSizeOptions, badgeForButtonOptions, badgeIconSizeOptions, badgeSizeOptions, badgeVariantOptions, bannerVariants, buttonCategoryOptions, buttonSizeOptions, buttonVariantOptions, colorThemes, columnOptions, datepickerSizeOptionsMap, defaultDateFormat, drawerVariants, dropdownPlacements, dropdownVariantOptions, focusableTags, formInputSizes, formStateOptions, glThemes, iconSizeOptions, keyboard, labelColorOptions, labelSizeOptions, loadingIconSizes, maxZIndex, modalButtonDefaults, modalSizeOptions, popoverPlacements, resizeDebounceTime, tabsButtonDefaults, targetOptions, toggleLabelPosition, tokenVariants, tooltipActionEvents, tooltipDelay, tooltipPlacements, triggerVariantOptions, truncateOptions, variantCssColorMap, variantOptions, variantOptionsWithNoDefault, viewModeOptions };
265
+ export { COMMA, LEFT_MOUSE_BUTTON, alertVariantIconMap, alertVariantOptions, alignOptions, avatarShapeOptions, avatarSizeOptions, avatarsInlineSizeOptions, badgeForButtonOptions, badgeIconSizeOptions, badgeSizeOptions, badgeVariantOptions, bannerVariants, buttonCategoryOptions, buttonSizeOptions, buttonVariantOptions, colorThemes, columnOptions, datepickerSizeOptionsMap, defaultDateFormat, drawerVariants, dropdownAllowedAutoPlacements, dropdownPlacements, dropdownVariantOptions, focusableTags, formInputSizes, formStateOptions, glThemes, iconSizeOptions, keyboard, labelColorOptions, labelSizeOptions, loadingIconSizes, maxZIndex, modalButtonDefaults, modalSizeOptions, popoverPlacements, resizeDebounceTime, tabsButtonDefaults, targetOptions, toggleLabelPosition, tokenVariants, tooltipActionEvents, tooltipDelay, tooltipPlacements, triggerVariantOptions, truncateOptions, variantCssColorMap, variantOptions, variantOptionsWithNoDefault, viewModeOptions };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gitlab/ui",
3
- "version": "64.13.1",
3
+ "version": "64.13.3",
4
4
  "description": "GitLab UI Components",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -1,6 +1,6 @@
1
1
  import { mount } from '@vue/test-utils';
2
2
  import { nextTick } from 'vue';
3
- import { computePosition, autoUpdate, offset } from '@floating-ui/dom';
3
+ import { computePosition, autoUpdate, offset, autoPlacement } from '@floating-ui/dom';
4
4
  import {
5
5
  ARROW_DOWN,
6
6
  GL_DROPDOWN_FOCUS_CONTENT,
@@ -15,6 +15,7 @@ import GlBaseDropdown from './base_dropdown.vue';
15
15
  jest.mock('@floating-ui/dom');
16
16
  const mockStopAutoUpdate = jest.fn();
17
17
  offset.mockImplementation((options) => options);
18
+ autoPlacement.mockImplementation((options) => options);
18
19
 
19
20
  const DEFAULT_BTN_TOGGLE_CLASSES = [
20
21
  'btn',
@@ -104,7 +105,12 @@ describe('base dropdown', () => {
104
105
  {
105
106
  placement: 'bottom-start',
106
107
  strategy: 'absolute',
107
- middleware: [offset({ mainAxis: DEFAULT_OFFSET })],
108
+ middleware: [
109
+ offset({ mainAxis: DEFAULT_OFFSET }),
110
+ autoPlacement({
111
+ allowedPlacements: ['bottom-start', 'top-start'],
112
+ }),
113
+ ],
108
114
  }
109
115
  );
110
116
  });
@@ -119,7 +125,12 @@ describe('base dropdown', () => {
119
125
  {
120
126
  placement: 'bottom',
121
127
  strategy: 'absolute',
122
- middleware: [offset({ mainAxis: DEFAULT_OFFSET })],
128
+ middleware: [
129
+ offset({ mainAxis: DEFAULT_OFFSET }),
130
+ autoPlacement({
131
+ allowedPlacements: ['bottom', 'top'],
132
+ }),
133
+ ],
123
134
  }
124
135
  );
125
136
  });
@@ -134,7 +145,12 @@ describe('base dropdown', () => {
134
145
  {
135
146
  placement: 'bottom-end',
136
147
  strategy: 'absolute',
137
- middleware: [offset({ mainAxis: DEFAULT_OFFSET })],
148
+ middleware: [
149
+ offset({ mainAxis: DEFAULT_OFFSET }),
150
+ autoPlacement({
151
+ allowedPlacements: ['bottom-end', 'top-end'],
152
+ }),
153
+ ],
138
154
  }
139
155
  );
140
156
  });
@@ -153,7 +169,7 @@ describe('base dropdown', () => {
153
169
  {
154
170
  placement: 'bottom-end',
155
171
  strategy: 'absolute',
156
- middleware: [offset(customOffset)],
172
+ middleware: [offset(customOffset), autoPlacement(expect.any(Object))],
157
173
  }
158
174
  );
159
175
  });
@@ -1,10 +1,11 @@
1
1
  <script>
2
2
  import uniqueId from 'lodash/uniqueId';
3
- import { computePosition, autoUpdate, offset, size, flip } from '@floating-ui/dom';
3
+ import { computePosition, autoUpdate, offset, size, autoPlacement } from '@floating-ui/dom';
4
4
  import {
5
5
  buttonCategoryOptions,
6
6
  buttonSizeOptions,
7
7
  dropdownPlacements,
8
+ dropdownAllowedAutoPlacements,
8
9
  dropdownVariantOptions,
9
10
  } from '../../../../utils/constants';
10
11
  import {
@@ -235,7 +236,9 @@ export default {
235
236
  strategy: this.positioningStrategy,
236
237
  middleware: [
237
238
  offset(this.offset),
238
- flip(),
239
+ autoPlacement({
240
+ allowedPlacements: dropdownAllowedAutoPlacements[this.placement],
241
+ }),
239
242
  size({
240
243
  apply: ({ availableHeight, elements }) => {
241
244
  const contentsEl = elements.floating.querySelector(`.${GL_DROPDOWN_CONTENTS_CLASS}`);
@@ -137,12 +137,12 @@
137
137
  &.top-scrim-light {
138
138
  height: 2.25rem;
139
139
  border-radius: 0.375rem 0.375rem 0 0;
140
- background: linear-gradient(180deg, rgba(255, 255, 255, 1) 0%, rgba(255, 255, 255, 0));
140
+ background: linear-gradient(180deg, $white 0%, $transparent-rgba);
141
141
  }
142
142
 
143
143
  &.top-scrim-dark {
144
144
  height: 0.25rem;
145
- background: linear-gradient(180deg, rgba(0, 0, 0, 0.16) 0%, rgba(255, 255, 255, 0) 100%);
145
+ background: linear-gradient(180deg, $t-gray-a-16 0%, $transparent-rgba 100%);
146
146
  }
147
147
  }
148
148
  }
@@ -156,7 +156,7 @@
156
156
  position: relative;
157
157
  top: calc(-2.25rem + #{$dropdown-content-padding});
158
158
  border-radius: 0 0 0.375rem 0.375rem;
159
- background: linear-gradient(180deg, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 1));
159
+ background: linear-gradient(180deg, $transparent-rgba 0%, $white);
160
160
  }
161
161
  }
162
162
 
@@ -2241,27 +2241,27 @@
2241
2241
  }
2242
2242
 
2243
2243
  .gl-shadow-sm {
2244
- box-shadow: 0 1px 2px rgba($gray-950, 0.1)
2244
+ box-shadow: 0 1px 2px $t-gray-a-08
2245
2245
  }
2246
2246
 
2247
2247
  .gl-shadow-sm\! {
2248
- box-shadow: 0 1px 2px rgba($gray-950, 0.1) !important
2248
+ box-shadow: 0 1px 2px $t-gray-a-08 !important
2249
2249
  }
2250
2250
 
2251
2251
  .gl-shadow-md {
2252
- box-shadow: 0 2px 8px rgba($gray-950, 0.16), 0 0 2px rgba($gray-950, 0.16)
2252
+ box-shadow: 0 2px 8px $t-gray-a-16, 0 0 2px $t-gray-a-16
2253
2253
  }
2254
2254
 
2255
2255
  .gl-shadow-md\! {
2256
- box-shadow: 0 2px 8px rgba($gray-950, 0.16), 0 0 2px rgba($gray-950, 0.16) !important
2256
+ box-shadow: 0 2px 8px $t-gray-a-16, 0 0 2px $t-gray-a-16 !important
2257
2257
  }
2258
2258
 
2259
2259
  .gl-shadow-lg {
2260
- box-shadow: 0 4px 12px rgba($gray-950, 0.16), 0 0 4px rgba($gray-950, 0.16)
2260
+ box-shadow: 0 4px 12px $t-gray-a-16, 0 0 4px $t-gray-a-16
2261
2261
  }
2262
2262
 
2263
2263
  .gl-shadow-lg\! {
2264
- box-shadow: 0 4px 12px rgba($gray-950, 0.16), 0 0 4px rgba($gray-950, 0.16) !important
2264
+ box-shadow: 0 4px 12px $t-gray-a-16, 0 0 4px $t-gray-a-16 !important
2265
2265
  }
2266
2266
  .gl-clearfix {
2267
2267
  &::after {
@@ -200,13 +200,13 @@
200
200
  */
201
201
 
202
202
  @mixin gl-shadow-sm {
203
- box-shadow: 0 1px 2px rgba($gray-950, 0.1);
203
+ box-shadow: 0 1px 2px $t-gray-a-08;
204
204
  }
205
205
 
206
206
  @mixin gl-shadow-md {
207
- box-shadow: 0 2px 8px rgba($gray-950, 0.16), 0 0 2px rgba($gray-950, 0.16);
207
+ box-shadow: 0 2px 8px $t-gray-a-16, 0 0 2px $t-gray-a-16;
208
208
  }
209
209
 
210
210
  @mixin gl-shadow-lg {
211
- box-shadow: 0 4px 12px rgba($gray-950, 0.16), 0 0 4px rgba($gray-950, 0.16);
211
+ box-shadow: 0 4px 12px $t-gray-a-16, 0 0 4px $t-gray-a-16;
212
212
  }
@@ -128,6 +128,12 @@ export const dropdownPlacements = {
128
128
  right: 'bottom-end',
129
129
  };
130
130
 
131
+ export const dropdownAllowedAutoPlacements = {
132
+ left: [dropdownPlacements.left, 'top-start'],
133
+ center: [dropdownPlacements.center, 'top'],
134
+ right: [dropdownPlacements.right, 'top-end'],
135
+ };
136
+
131
137
  export const buttonSizeOptions = {
132
138
  small: 'sm',
133
139
  medium: 'md',