@gitlab/ui 32.36.0 → 32.37.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 +7 -0
- package/dist/components/base/dropdown/dropdown.js +3 -3
- package/dist/components/base/popover/popover.js +1 -1
- package/dist/utility_classes.css +1 -1
- package/dist/utility_classes.css.map +1 -1
- package/dist/utils/constants.js +2 -2
- package/package.json +1 -1
- package/scss_to_js/scss_variables.js +2 -0
- package/scss_to_js/scss_variables.json +11 -1
- package/src/components/base/dropdown/dropdown.spec.js +6 -9
- package/src/components/base/dropdown/dropdown.stories.js +3 -3
- package/src/components/base/dropdown/dropdown.vue +3 -3
- package/src/components/base/popover/popover.spec.js +9 -0
- package/src/components/base/popover/popover.stories.js +37 -12
- package/src/components/base/popover/popover.vue +1 -2
- package/src/scss/utilities.scss +8 -0
- package/src/scss/utility-mixins/color.scss +4 -0
- package/src/scss/variables.scss +4 -1
- package/src/utils/constants.js +1 -1
package/dist/utils/constants.js
CHANGED
|
@@ -97,7 +97,7 @@ const badgeForButtonOptions = {
|
|
|
97
97
|
[buttonVariantOptions.confirm]: badgeVariantOptions.info,
|
|
98
98
|
[buttonVariantOptions.danger]: badgeVariantOptions.danger
|
|
99
99
|
};
|
|
100
|
-
const
|
|
100
|
+
const dropdownVariantOptions = {
|
|
101
101
|
default: 'default',
|
|
102
102
|
confirm: 'confirm',
|
|
103
103
|
info: 'info (deprecated)',
|
|
@@ -251,4 +251,4 @@ const loadingIconSizes = {
|
|
|
251
251
|
'xl (64x64)': 'xl'
|
|
252
252
|
};
|
|
253
253
|
|
|
254
|
-
export { COMMA, alertVariantIconMap, alertVariantOptions, alignOptions, avatarShapeOptions, avatarSizeOptions, avatarsInlineSizeOptions, badgeForButtonOptions, badgeSizeOptions, badgeVariantOptions, bannerVariants, buttonCategoryOptions, buttonSizeOptions, buttonSizeOptionsMap, buttonVariantOptions, colorThemes, columnOptions, defaultDateFormat, drawerVariants, focusableTags, formInputSizes, formStateOptions, glThemes, iconSizeOptions, keyboard, labelColorOptions, labelSizeOptions, loadingIconSizes, maxZIndex, modalButtonDefaults, modalSizeOptions,
|
|
254
|
+
export { COMMA, alertVariantIconMap, alertVariantOptions, alignOptions, avatarShapeOptions, avatarSizeOptions, avatarsInlineSizeOptions, badgeForButtonOptions, badgeSizeOptions, badgeVariantOptions, bannerVariants, buttonCategoryOptions, buttonSizeOptions, buttonSizeOptionsMap, buttonVariantOptions, colorThemes, columnOptions, defaultDateFormat, drawerVariants, dropdownVariantOptions, focusableTags, formInputSizes, formStateOptions, glThemes, iconSizeOptions, keyboard, labelColorOptions, labelSizeOptions, loadingIconSizes, maxZIndex, modalButtonDefaults, modalSizeOptions, popoverPlacements, resizeDebounceTime, sizeOptions, sizeOptionsWithNoDefault, tabsButtonDefaults, targetOptions, toggleLabelPosition, tokenVariants, tooltipActionEvents, tooltipDelay, tooltipPlacements, triggerVariantOptions, truncateOptions, variantCssColorMap, variantOptions, variantOptionsWithNoDefault, viewModeOptions };
|
package/package.json
CHANGED
|
@@ -226,6 +226,8 @@ export const tGrayA04 = 'rgba(0, 0, 0, 0.04)'
|
|
|
226
226
|
export const tGrayA06 = 'rgba(0, 0, 0, 0.06)'
|
|
227
227
|
export const tGrayA08 = 'rgba(0, 0, 0, 0.08)'
|
|
228
228
|
export const tGrayA24 = 'rgba(0, 0, 0, 0.24)'
|
|
229
|
+
export const glTextColor = '#303030'
|
|
230
|
+
export const glTextColorSecondary = '#666'
|
|
229
231
|
export const glFontWeightLight = '300'
|
|
230
232
|
export const glFontWeightNormal = '400'
|
|
231
233
|
export const glFontWeightBold = '600'
|
|
@@ -1167,6 +1167,16 @@
|
|
|
1167
1167
|
"value": "rgba(#000, 0.24)",
|
|
1168
1168
|
"compiledValue": "rgba(0, 0, 0, 0.24)"
|
|
1169
1169
|
},
|
|
1170
|
+
{
|
|
1171
|
+
"name": "$gl-text-color",
|
|
1172
|
+
"value": "$gray-900",
|
|
1173
|
+
"compiledValue": "#303030"
|
|
1174
|
+
},
|
|
1175
|
+
{
|
|
1176
|
+
"name": "$gl-text-color-secondary",
|
|
1177
|
+
"value": "$gray-500",
|
|
1178
|
+
"compiledValue": "#666"
|
|
1179
|
+
},
|
|
1170
1180
|
{
|
|
1171
1181
|
"name": "$gl-font-weight-light",
|
|
1172
1182
|
"value": "300",
|
|
@@ -1624,7 +1634,7 @@
|
|
|
1624
1634
|
},
|
|
1625
1635
|
{
|
|
1626
1636
|
"name": "$body-color",
|
|
1627
|
-
"value": "$
|
|
1637
|
+
"value": "$gl-text-color",
|
|
1628
1638
|
"compiledValue": "#303030"
|
|
1629
1639
|
},
|
|
1630
1640
|
{
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { mount } from '@vue/test-utils';
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { dropdownVariantOptions } from '../../../utils/constants';
|
|
4
4
|
import GlLoadingIcon from '../loading_icon/loading_icon.vue';
|
|
5
5
|
import GlDropdown from './dropdown.vue';
|
|
6
6
|
|
|
@@ -175,14 +175,11 @@ describe('new dropdown', () => {
|
|
|
175
175
|
});
|
|
176
176
|
|
|
177
177
|
describe('secondary category', () => {
|
|
178
|
-
it.each(Object.keys(
|
|
179
|
-
'
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
expect(findDropdownToggle().classes()).toContain(`btn-${variant}-secondary`);
|
|
184
|
-
}
|
|
185
|
-
);
|
|
178
|
+
it.each(Object.keys(dropdownVariantOptions))('applies %s variant class properly', (variant) => {
|
|
179
|
+
buildWrapper({ category: 'secondary', variant });
|
|
180
|
+
|
|
181
|
+
expect(findDropdownToggle().classes()).toContain(`btn-${variant}-secondary`);
|
|
182
|
+
});
|
|
186
183
|
});
|
|
187
184
|
|
|
188
185
|
describe('when the header slot exists', () => {
|
|
@@ -12,8 +12,8 @@ import {
|
|
|
12
12
|
} from '../../../../index';
|
|
13
13
|
import {
|
|
14
14
|
buttonCategoryOptions,
|
|
15
|
-
newDropdownVariantOptions,
|
|
16
15
|
buttonSizeOptions,
|
|
16
|
+
dropdownVariantOptions,
|
|
17
17
|
} from '../../../utils/constants';
|
|
18
18
|
import readme from './dropdown.md';
|
|
19
19
|
|
|
@@ -57,7 +57,7 @@ function generateProps({
|
|
|
57
57
|
},
|
|
58
58
|
variant: {
|
|
59
59
|
type: String,
|
|
60
|
-
default: select('variant', Object.values(
|
|
60
|
+
default: select('variant', Object.values(dropdownVariantOptions), variant),
|
|
61
61
|
},
|
|
62
62
|
size: {
|
|
63
63
|
type: String,
|
|
@@ -197,7 +197,7 @@ documentedStoriesOf('base/dropdown', readme)
|
|
|
197
197
|
props: generateProps({
|
|
198
198
|
text: 'Some dropdown',
|
|
199
199
|
category: buttonCategoryOptions.secondary,
|
|
200
|
-
variant:
|
|
200
|
+
variant: dropdownVariantOptions.confirm,
|
|
201
201
|
}),
|
|
202
202
|
components,
|
|
203
203
|
template: wrap`
|
|
@@ -3,8 +3,8 @@ import { BDropdown } from 'bootstrap-vue';
|
|
|
3
3
|
import { isVisible, selectAll } from 'bootstrap-vue/src/utils/dom';
|
|
4
4
|
import {
|
|
5
5
|
buttonCategoryOptions,
|
|
6
|
-
newDropdownVariantOptions,
|
|
7
6
|
buttonSizeOptions,
|
|
7
|
+
dropdownVariantOptions,
|
|
8
8
|
} from '../../../utils/constants';
|
|
9
9
|
import { ButtonMixin } from '../../mixins/button_mixin';
|
|
10
10
|
import GlButton from '../button/button.vue';
|
|
@@ -106,8 +106,8 @@ export default {
|
|
|
106
106
|
variant: {
|
|
107
107
|
type: String,
|
|
108
108
|
required: false,
|
|
109
|
-
default:
|
|
110
|
-
validator: (value) => Object.keys(
|
|
109
|
+
default: dropdownVariantOptions.default,
|
|
110
|
+
validator: (value) => Object.keys(dropdownVariantOptions).includes(value),
|
|
111
111
|
},
|
|
112
112
|
size: {
|
|
113
113
|
type: String,
|
|
@@ -42,4 +42,13 @@ describe('GlPopover', () => {
|
|
|
42
42
|
expect(findBVPopover().props('triggers')).toBe(triggers);
|
|
43
43
|
});
|
|
44
44
|
});
|
|
45
|
+
|
|
46
|
+
describe('title slot', () => {
|
|
47
|
+
it('renders title slot content', () => {
|
|
48
|
+
const title = 'Popover title';
|
|
49
|
+
createWrapper({ title });
|
|
50
|
+
|
|
51
|
+
expect(findBVPopover().props('title')).toBe(title);
|
|
52
|
+
});
|
|
53
|
+
});
|
|
45
54
|
});
|
|
@@ -2,6 +2,12 @@ import { withKnobs, select, text } from '@storybook/addon-knobs';
|
|
|
2
2
|
import { documentedStoriesOf } from '../../../../documentation/documented_stories';
|
|
3
3
|
import { popoverPlacements } from '../../../utils/constants';
|
|
4
4
|
|
|
5
|
+
const contentString = `
|
|
6
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent volutpat a nisi non
|
|
7
|
+
pellentesque. Pellentesque efficitur vulputate rutrum. Fusce nisl magna, porttitor in
|
|
8
|
+
massa ac, porta condimentum libero. Ut id lacus tristique, egestas arcu non, molestie nisi.
|
|
9
|
+
`;
|
|
10
|
+
|
|
5
11
|
const template = `
|
|
6
12
|
<div class="gl-display-flex gl-justify-content-center gl-p-6">
|
|
7
13
|
<gl-button id="pop-top">{{placement}}</gl-button>
|
|
@@ -9,13 +15,29 @@ const template = `
|
|
|
9
15
|
triggers="hover focus"
|
|
10
16
|
:title="title"
|
|
11
17
|
:placement="placement"
|
|
12
|
-
|
|
18
|
+
content="${contentString}"
|
|
19
|
+
data-testid="popover-with-props"
|
|
13
20
|
show
|
|
14
21
|
/>
|
|
15
22
|
</div>
|
|
16
23
|
`;
|
|
17
24
|
|
|
18
|
-
|
|
25
|
+
const scopedSlotTemplate = `
|
|
26
|
+
<div class="gl-display-flex gl-justify-content-center gl-p-6">
|
|
27
|
+
<gl-button id="pop-top-two" data-testid="popover-button-click">{{placement}}</gl-button>
|
|
28
|
+
<gl-popover target="pop-top-two"
|
|
29
|
+
triggers="click"
|
|
30
|
+
:placement="placement"
|
|
31
|
+
content="${contentString}"
|
|
32
|
+
>
|
|
33
|
+
<template #title>
|
|
34
|
+
<span data-testid="popover-title">Popover title</span>
|
|
35
|
+
</template>
|
|
36
|
+
</gl-popover>
|
|
37
|
+
</div>
|
|
38
|
+
`;
|
|
39
|
+
|
|
40
|
+
function generateProps({ placement = popoverPlacements.top, title = 'Popover', triggers } = {}) {
|
|
19
41
|
return {
|
|
20
42
|
placement: {
|
|
21
43
|
type: String,
|
|
@@ -25,6 +47,10 @@ function generateProps({ placement = popoverPlacements.top, title = 'Popover' }
|
|
|
25
47
|
type: String,
|
|
26
48
|
default: text('title', title),
|
|
27
49
|
},
|
|
50
|
+
triggers: {
|
|
51
|
+
type: String,
|
|
52
|
+
default: text('hover focus', triggers),
|
|
53
|
+
},
|
|
28
54
|
};
|
|
29
55
|
}
|
|
30
56
|
|
|
@@ -33,13 +59,12 @@ documentedStoriesOf('base/popover', '')
|
|
|
33
59
|
.add('default', () => ({
|
|
34
60
|
template,
|
|
35
61
|
props: generateProps(),
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
}));
|
|
62
|
+
}))
|
|
63
|
+
.add(
|
|
64
|
+
'on click',
|
|
65
|
+
() => ({
|
|
66
|
+
template: scopedSlotTemplate,
|
|
67
|
+
props: generateProps(),
|
|
68
|
+
}),
|
|
69
|
+
{ storyshots: false }
|
|
70
|
+
);
|
|
@@ -39,8 +39,7 @@ export default {
|
|
|
39
39
|
v-bind="$attrs"
|
|
40
40
|
v-on="$listeners"
|
|
41
41
|
>
|
|
42
|
-
|
|
43
|
-
<template slot="title">
|
|
42
|
+
<template v-if="$scopedSlots.title" #title>
|
|
44
43
|
<slot name="title"></slot>
|
|
45
44
|
</template>
|
|
46
45
|
<slot></slot>
|
package/src/scss/utilities.scss
CHANGED
|
@@ -1997,6 +1997,14 @@
|
|
|
1997
1997
|
color: $body-color !important;
|
|
1998
1998
|
}
|
|
1999
1999
|
|
|
2000
|
+
.gl-text-secondary {
|
|
2001
|
+
color: $gl-text-color-secondary;
|
|
2002
|
+
}
|
|
2003
|
+
|
|
2004
|
+
.gl-text-secondary\! {
|
|
2005
|
+
color: $gl-text-color-secondary !important;
|
|
2006
|
+
}
|
|
2007
|
+
|
|
2000
2008
|
.gl-sm-text-body {
|
|
2001
2009
|
@include gl-media-breakpoint-up(sm) {
|
|
2002
2010
|
color: $body-color;
|
package/src/scss/variables.scss
CHANGED
|
@@ -295,6 +295,9 @@ $t-gray-a-08: rgba(#000, 0.08);
|
|
|
295
295
|
$t-gray-a-24: rgba(#000, 0.24);
|
|
296
296
|
|
|
297
297
|
// Text
|
|
298
|
+
$gl-text-color: $gray-900 !default;
|
|
299
|
+
$gl-text-color-secondary: $gray-500 !default;
|
|
300
|
+
|
|
298
301
|
$gl-font-weight-light: 300;
|
|
299
302
|
$gl-font-weight-normal: 400;
|
|
300
303
|
$gl-font-weight-bold: 600;
|
|
@@ -453,7 +456,7 @@ $modal-backdrop-opacity: 0.64;
|
|
|
453
456
|
// Bootstrap overrides
|
|
454
457
|
// these should ideally be moved further up in the file to the compoent-relevant sections
|
|
455
458
|
// but they can wait here for now
|
|
456
|
-
$body-color: $
|
|
459
|
+
$body-color: $gl-text-color !default;
|
|
457
460
|
|
|
458
461
|
$secondary: $gray-50;
|
|
459
462
|
$success: $green-500;
|
package/src/utils/constants.js
CHANGED
|
@@ -115,7 +115,7 @@ export const badgeForButtonOptions = {
|
|
|
115
115
|
[buttonVariantOptions.danger]: badgeVariantOptions.danger,
|
|
116
116
|
};
|
|
117
117
|
|
|
118
|
-
export const
|
|
118
|
+
export const dropdownVariantOptions = {
|
|
119
119
|
default: 'default',
|
|
120
120
|
confirm: 'confirm',
|
|
121
121
|
info: 'info (deprecated)',
|