@gitlab/ui 62.2.0 → 62.4.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 +14 -0
- package/dist/components/base/new_dropdowns/base_dropdown/base_dropdown.js +13 -1
- package/dist/components/base/new_dropdowns/base_dropdown/constants.js +3 -0
- package/dist/components/base/new_dropdowns/disclosure/disclosure_dropdown.js +10 -1
- package/dist/components/base/new_dropdowns/listbox/listbox.js +10 -1
- package/dist/utility_classes.css +1 -1
- package/dist/utility_classes.css.map +1 -1
- package/package.json +2 -2
- package/scss_to_js/scss_variables.js +1 -0
- package/scss_to_js/scss_variables.json +5 -0
- package/src/components/base/new_dropdowns/base_dropdown/base_dropdown.spec.js +15 -0
- package/src/components/base/new_dropdowns/base_dropdown/base_dropdown.vue +13 -1
- package/src/components/base/new_dropdowns/base_dropdown/constants.js +1 -0
- package/src/components/base/new_dropdowns/disclosure/disclosure_dropdown.spec.js +14 -0
- package/src/components/base/new_dropdowns/disclosure/disclosure_dropdown.stories.js +2 -0
- package/src/components/base/new_dropdowns/disclosure/disclosure_dropdown.vue +10 -0
- package/src/components/base/new_dropdowns/listbox/listbox.spec.js +14 -0
- package/src/components/base/new_dropdowns/listbox/listbox.stories.js +11 -1
- package/src/components/base/new_dropdowns/listbox/listbox.vue +10 -0
- package/src/scss/utilities.scss +16 -0
- package/src/scss/utility-mixins/sizing.scss +8 -0
- package/src/scss/variables.scss +1 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gitlab/ui",
|
|
3
|
-
"version": "62.
|
|
3
|
+
"version": "62.4.0",
|
|
4
4
|
"description": "GitLab UI Components",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -90,7 +90,7 @@
|
|
|
90
90
|
"@gitlab/eslint-plugin": "18.3.2",
|
|
91
91
|
"@gitlab/fonts": "^1.2.0",
|
|
92
92
|
"@gitlab/stylelint-config": "4.1.0",
|
|
93
|
-
"@gitlab/svgs": "3.
|
|
93
|
+
"@gitlab/svgs": "3.40.0",
|
|
94
94
|
"@rollup/plugin-commonjs": "^11.1.0",
|
|
95
95
|
"@rollup/plugin-node-resolve": "^7.1.3",
|
|
96
96
|
"@rollup/plugin-replace": "^2.3.2",
|
|
@@ -18,6 +18,7 @@ export const glSpacingScale20 = '10rem'
|
|
|
18
18
|
export const glSpacingScale26 = '13rem'
|
|
19
19
|
export const glSpacingScale28 = '14rem'
|
|
20
20
|
export const glSpacingScale30 = '15rem'
|
|
21
|
+
export const glSpacingScale31 = '15.5rem'
|
|
21
22
|
export const glSpacingScale34 = '17rem'
|
|
22
23
|
export const glSpacingScale48 = '24rem'
|
|
23
24
|
export const glSpacingScale62 = '31rem'
|
|
@@ -100,6 +100,11 @@
|
|
|
100
100
|
"value": "30 * $grid-size",
|
|
101
101
|
"compiledValue": "15rem"
|
|
102
102
|
},
|
|
103
|
+
{
|
|
104
|
+
"name": "$gl-spacing-scale-31",
|
|
105
|
+
"value": "31 * $grid-size",
|
|
106
|
+
"compiledValue": "15.5rem"
|
|
107
|
+
},
|
|
103
108
|
{
|
|
104
109
|
"name": "$gl-spacing-scale-34",
|
|
105
110
|
"value": "34 * $grid-size",
|
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
GL_DROPDOWN_SHOWN,
|
|
8
8
|
POPPER_CONFIG,
|
|
9
9
|
} from '../constants';
|
|
10
|
+
import { FIXED_WIDTH_CLASS } from './constants';
|
|
10
11
|
import GlBaseDropdown from './base_dropdown.vue';
|
|
11
12
|
|
|
12
13
|
const destroyPopper = jest.fn();
|
|
@@ -292,4 +293,18 @@ describe('base dropdown', () => {
|
|
|
292
293
|
expect(wrapper.emitted(GL_DROPDOWN_FOCUS_CONTENT)).toHaveLength(1);
|
|
293
294
|
});
|
|
294
295
|
});
|
|
296
|
+
|
|
297
|
+
describe('fluid width', () => {
|
|
298
|
+
it('uses a fixed width by default', () => {
|
|
299
|
+
buildWrapper();
|
|
300
|
+
|
|
301
|
+
expect(findDropdownMenu().classes()).toContain(FIXED_WIDTH_CLASS);
|
|
302
|
+
});
|
|
303
|
+
|
|
304
|
+
it('drops the fixed width when `fluidWidth` is `true`', () => {
|
|
305
|
+
buildWrapper({ fluidWidth: true });
|
|
306
|
+
|
|
307
|
+
expect(findDropdownMenu().classes()).not.toContain(FIXED_WIDTH_CLASS);
|
|
308
|
+
});
|
|
309
|
+
});
|
|
295
310
|
});
|
|
@@ -21,6 +21,7 @@ import { logWarning, isElementTabbable, isElementFocusable } from '../../../../u
|
|
|
21
21
|
import GlButton from '../../button/button.vue';
|
|
22
22
|
import GlIcon from '../../icon/icon.vue';
|
|
23
23
|
import { OutsideDirective } from '../../../../directives/outside/outside';
|
|
24
|
+
import { FIXED_WIDTH_CLASS } from './constants';
|
|
24
25
|
|
|
25
26
|
export default {
|
|
26
27
|
name: 'BaseDropdown',
|
|
@@ -123,6 +124,11 @@ export default {
|
|
|
123
124
|
required: false,
|
|
124
125
|
default: () => ({}),
|
|
125
126
|
},
|
|
127
|
+
fluidWidth: {
|
|
128
|
+
type: Boolean,
|
|
129
|
+
required: false,
|
|
130
|
+
default: false,
|
|
131
|
+
},
|
|
126
132
|
},
|
|
127
133
|
data() {
|
|
128
134
|
return {
|
|
@@ -194,6 +200,12 @@ export default {
|
|
|
194
200
|
toggleElement() {
|
|
195
201
|
return this.$refs.toggle.$el || this.$refs.toggle?.firstElementChild;
|
|
196
202
|
},
|
|
203
|
+
panelClasses() {
|
|
204
|
+
return {
|
|
205
|
+
'gl-display-block!': this.visible,
|
|
206
|
+
[FIXED_WIDTH_CLASS]: !this.fluidWidth,
|
|
207
|
+
};
|
|
208
|
+
},
|
|
197
209
|
popperConfig() {
|
|
198
210
|
return {
|
|
199
211
|
placement: dropdownPlacements[this.placement],
|
|
@@ -332,7 +344,7 @@ export default {
|
|
|
332
344
|
ref="content"
|
|
333
345
|
data-testid="base-dropdown-menu"
|
|
334
346
|
class="gl-new-dropdown-panel"
|
|
335
|
-
:class="
|
|
347
|
+
:class="panelClasses"
|
|
336
348
|
@keydown.esc.stop.prevent="closeAndFocus"
|
|
337
349
|
>
|
|
338
350
|
<div class="gl-new-dropdown-inner">
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const FIXED_WIDTH_CLASS = 'gl-w-31';
|
|
@@ -309,4 +309,18 @@ describe('GlDisclosureDropdown', () => {
|
|
|
309
309
|
});
|
|
310
310
|
});
|
|
311
311
|
});
|
|
312
|
+
|
|
313
|
+
describe('fluid width', () => {
|
|
314
|
+
it('is disabled by default', () => {
|
|
315
|
+
buildWrapper();
|
|
316
|
+
|
|
317
|
+
expect(findBaseDropdown().props('fluidWidth')).toBe(false);
|
|
318
|
+
});
|
|
319
|
+
|
|
320
|
+
it('is enabled when `fluidWidth` is `true`', () => {
|
|
321
|
+
buildWrapper({ fluidWidth: true });
|
|
322
|
+
|
|
323
|
+
expect(findBaseDropdown().props('fluidWidth')).toBe(true);
|
|
324
|
+
});
|
|
325
|
+
});
|
|
312
326
|
});
|
|
@@ -39,6 +39,7 @@ const makeBindings = (overrides = {}) =>
|
|
|
39
39
|
':icon': 'icon',
|
|
40
40
|
':toggle-aria-labelled-by': 'toggleAriaLabelledBy',
|
|
41
41
|
':list-aria-labelled-by': 'listAriaLabelledBy',
|
|
42
|
+
':fluid-width': 'fluidWidth',
|
|
42
43
|
...overrides,
|
|
43
44
|
})
|
|
44
45
|
.map(([key, value]) => `${key}="${value}"`)
|
|
@@ -302,6 +303,7 @@ MiscellaneousContent.args = {
|
|
|
302
303
|
icon: 'doc-text',
|
|
303
304
|
toggleText: 'Miscellaneous content',
|
|
304
305
|
textSrOnly: true,
|
|
306
|
+
fluidWidth: true,
|
|
305
307
|
};
|
|
306
308
|
MiscellaneousContent.decorators = [makeContainer({ height: '200px' })];
|
|
307
309
|
|
|
@@ -174,6 +174,15 @@ export default {
|
|
|
174
174
|
required: false,
|
|
175
175
|
default: () => ({}),
|
|
176
176
|
},
|
|
177
|
+
/**
|
|
178
|
+
* Lets the dropdown extend to match its content's width, up to a maximum width
|
|
179
|
+
* defined by the `$gl-new-dropdown-max-width` variable.
|
|
180
|
+
*/
|
|
181
|
+
fluidWidth: {
|
|
182
|
+
type: Boolean,
|
|
183
|
+
required: false,
|
|
184
|
+
default: false,
|
|
185
|
+
},
|
|
177
186
|
},
|
|
178
187
|
data() {
|
|
179
188
|
return {
|
|
@@ -292,6 +301,7 @@ export default {
|
|
|
292
301
|
:no-caret="noCaret"
|
|
293
302
|
:placement="placement"
|
|
294
303
|
:popper-options="popperOptions"
|
|
304
|
+
:fluid-width="fluidWidth"
|
|
295
305
|
class="gl-disclosure-dropdown"
|
|
296
306
|
@[$options.events.GL_DROPDOWN_SHOWN]="onShow"
|
|
297
307
|
@[$options.events.GL_DROPDOWN_HIDDEN]="onHide"
|
|
@@ -647,4 +647,18 @@ describe('GlCollapsibleListbox', () => {
|
|
|
647
647
|
}
|
|
648
648
|
);
|
|
649
649
|
});
|
|
650
|
+
|
|
651
|
+
describe('fluid width', () => {
|
|
652
|
+
it('is disabled by default', () => {
|
|
653
|
+
buildWrapper();
|
|
654
|
+
|
|
655
|
+
expect(findBaseDropdown().props('fluidWidth')).toBe(false);
|
|
656
|
+
});
|
|
657
|
+
|
|
658
|
+
it('is enabled when `fluidWidth` is `true`', () => {
|
|
659
|
+
buildWrapper({ fluidWidth: true });
|
|
660
|
+
|
|
661
|
+
expect(findBaseDropdown().props('fluidWidth')).toBe(true);
|
|
662
|
+
});
|
|
663
|
+
});
|
|
650
664
|
});
|
|
@@ -56,6 +56,7 @@ const generateProps = ({
|
|
|
56
56
|
listAriaLabelledBy,
|
|
57
57
|
resetButtonLabel = defaultValue('resetButtonLabel'),
|
|
58
58
|
startOpened = true,
|
|
59
|
+
fluidWidth,
|
|
59
60
|
} = {}) => ({
|
|
60
61
|
items,
|
|
61
62
|
category,
|
|
@@ -83,6 +84,7 @@ const generateProps = ({
|
|
|
83
84
|
listAriaLabelledBy,
|
|
84
85
|
resetButtonLabel,
|
|
85
86
|
startOpened,
|
|
87
|
+
fluidWidth,
|
|
86
88
|
});
|
|
87
89
|
|
|
88
90
|
const makeBindings = (overrides = {}) =>
|
|
@@ -112,6 +114,7 @@ const makeBindings = (overrides = {}) =>
|
|
|
112
114
|
':toggle-aria-labelled-by': 'toggleAriaLabelledBy',
|
|
113
115
|
':list-aria-labelled-by': 'listAriaLabelledBy',
|
|
114
116
|
':reset-button-label': 'resetButtonLabel',
|
|
117
|
+
':fluid-width': 'fluidWidth',
|
|
115
118
|
...overrides,
|
|
116
119
|
})
|
|
117
120
|
.map(([key, value]) => `${key}="${value}"`)
|
|
@@ -490,6 +493,11 @@ export default {
|
|
|
490
493
|
subcategory: ARG_TYPE_SUBCATEGORY_LOOK_AND_FEEL,
|
|
491
494
|
},
|
|
492
495
|
},
|
|
496
|
+
fluidWidth: {
|
|
497
|
+
table: {
|
|
498
|
+
subcategory: ARG_TYPE_SUBCATEGORY_LOOK_AND_FEEL,
|
|
499
|
+
},
|
|
500
|
+
},
|
|
493
501
|
disabled: {
|
|
494
502
|
table: {
|
|
495
503
|
subcategory: ARG_TYPE_SUBCATEGORY_STATE,
|
|
@@ -820,4 +828,6 @@ export const WithLongContent = (args, { argTypes: { items, ...argTypes } }) => (
|
|
|
820
828
|
}
|
|
821
829
|
),
|
|
822
830
|
});
|
|
823
|
-
WithLongContent.args = generateProps(
|
|
831
|
+
WithLongContent.args = generateProps({
|
|
832
|
+
fluidWidth: true,
|
|
833
|
+
});
|
|
@@ -297,6 +297,15 @@ export default {
|
|
|
297
297
|
required: false,
|
|
298
298
|
default: () => ({}),
|
|
299
299
|
},
|
|
300
|
+
/**
|
|
301
|
+
* Lets the dropdown extend to match its content's width, up to a maximum width
|
|
302
|
+
* defined by the `$gl-new-dropdown-max-width` variable.
|
|
303
|
+
*/
|
|
304
|
+
fluidWidth: {
|
|
305
|
+
type: Boolean,
|
|
306
|
+
required: false,
|
|
307
|
+
default: false,
|
|
308
|
+
},
|
|
300
309
|
},
|
|
301
310
|
data() {
|
|
302
311
|
return {
|
|
@@ -596,6 +605,7 @@ export default {
|
|
|
596
605
|
:no-caret="noCaret"
|
|
597
606
|
:placement="placement"
|
|
598
607
|
:popper-options="popperOptions"
|
|
608
|
+
:fluid-width="fluidWidth"
|
|
599
609
|
@[$options.events.GL_DROPDOWN_SHOWN]="onShow"
|
|
600
610
|
@[$options.events.GL_DROPDOWN_HIDDEN]="onHide"
|
|
601
611
|
>
|
package/src/scss/utilities.scss
CHANGED
|
@@ -4624,6 +4624,14 @@
|
|
|
4624
4624
|
width: $gl-spacing-scale-30 !important;
|
|
4625
4625
|
}
|
|
4626
4626
|
|
|
4627
|
+
.gl-w-31 {
|
|
4628
|
+
width: $gl-spacing-scale-31;
|
|
4629
|
+
}
|
|
4630
|
+
|
|
4631
|
+
.gl-w-31\! {
|
|
4632
|
+
width: $gl-spacing-scale-31 !important;
|
|
4633
|
+
}
|
|
4634
|
+
|
|
4627
4635
|
.gl-w-eighth {
|
|
4628
4636
|
width: 12.5%;
|
|
4629
4637
|
}
|
|
@@ -5220,6 +5228,14 @@
|
|
|
5220
5228
|
min-height: $gl-spacing-scale-8 !important;
|
|
5221
5229
|
}
|
|
5222
5230
|
|
|
5231
|
+
.gl-min-h-100vh {
|
|
5232
|
+
min-height: 100vh;
|
|
5233
|
+
}
|
|
5234
|
+
|
|
5235
|
+
.gl-min-h-100vh\! {
|
|
5236
|
+
min-height: 100vh !important;
|
|
5237
|
+
}
|
|
5238
|
+
|
|
5223
5239
|
.gl-max-w-0 {
|
|
5224
5240
|
max-width: 0;
|
|
5225
5241
|
}
|
|
@@ -73,6 +73,10 @@
|
|
|
73
73
|
width: $gl-spacing-scale-30;
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
+
@mixin gl-w-31 {
|
|
77
|
+
width: $gl-spacing-scale-31;
|
|
78
|
+
}
|
|
79
|
+
|
|
76
80
|
@mixin gl-w-eighth {
|
|
77
81
|
width: 12.5%;
|
|
78
82
|
}
|
|
@@ -388,6 +392,10 @@
|
|
|
388
392
|
min-height: $gl-spacing-scale-8;
|
|
389
393
|
}
|
|
390
394
|
|
|
395
|
+
@mixin gl-min-h-100vh {
|
|
396
|
+
min-height: 100vh;
|
|
397
|
+
}
|
|
398
|
+
|
|
391
399
|
@mixin gl-max-w-0 {
|
|
392
400
|
max-width: 0;
|
|
393
401
|
}
|
package/src/scss/variables.scss
CHANGED
|
@@ -21,6 +21,7 @@ $gl-spacing-scale-20: 20 * $grid-size;
|
|
|
21
21
|
$gl-spacing-scale-26: 26 * $grid-size;
|
|
22
22
|
$gl-spacing-scale-28: 28 * $grid-size;
|
|
23
23
|
$gl-spacing-scale-30: 30 * $grid-size;
|
|
24
|
+
$gl-spacing-scale-31: 31 * $grid-size;
|
|
24
25
|
$gl-spacing-scale-34: 34 * $grid-size;
|
|
25
26
|
$gl-spacing-scale-48: 48 * $grid-size;
|
|
26
27
|
$gl-spacing-scale-62: 62 * $grid-size;
|