@gitlab/ui 39.7.1 → 40.2.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 +37 -0
- package/dist/components/base/form/form_input/form_input.js +22 -5
- package/dist/index.css +1 -1
- package/dist/index.css.map +1 -1
- package/dist/index.js +1 -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/form/form_input/form_input.scss +12 -4
- package/src/components/base/form/form_input/form_input.spec.js +41 -12
- package/src/components/base/form/form_input/form_input.stories.js +19 -0
- package/src/components/base/form/form_input/form_input.vue +24 -5
- package/src/components/base/new_dropdowns/listbox/listbox.md +1 -1
- package/src/index.js +1 -4
- package/src/scss/utilities.scss +30 -0
- package/src/scss/utility-mixins/overflow.scss +4 -0
- package/src/scss/utility-mixins/spacing.scss +14 -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": "
|
|
3
|
+
"version": "40.2.0",
|
|
4
4
|
"description": "GitLab UI Components",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -83,7 +83,7 @@
|
|
|
83
83
|
"@babel/preset-env": "^7.10.2",
|
|
84
84
|
"@gitlab/eslint-plugin": "12.0.1",
|
|
85
85
|
"@gitlab/stylelint-config": "4.0.0",
|
|
86
|
-
"@gitlab/svgs": "2.
|
|
86
|
+
"@gitlab/svgs": "2.13.0",
|
|
87
87
|
"@rollup/plugin-commonjs": "^11.1.0",
|
|
88
88
|
"@rollup/plugin-node-resolve": "^7.1.3",
|
|
89
89
|
"@rollup/plugin-replace": "^2.3.2",
|
|
@@ -294,6 +294,7 @@ export const glTransitionDurationSlow = '0.4s'
|
|
|
294
294
|
export const glTransitionDurationMedium = '0.2s'
|
|
295
295
|
export const outlineOffset = '1px'
|
|
296
296
|
export const outlineWidth = '2px'
|
|
297
|
+
export const outline = '3px'
|
|
297
298
|
export const focusRing = '0 0 0 1px #fff, 0 0 0 3px #428fdc'
|
|
298
299
|
export const focusRingInset = 'inset 0 0 0 3px #fff, inset 0 0 0 1px #fff'
|
|
299
300
|
export const focusRingDark = '0 0 0 1px rgba(0, 0, 0, 0.6), 0 0 0 3px #63a6e9'
|
|
@@ -1531,6 +1531,11 @@
|
|
|
1531
1531
|
"value": "2px",
|
|
1532
1532
|
"compiledValue": "2px"
|
|
1533
1533
|
},
|
|
1534
|
+
{
|
|
1535
|
+
"name": "$outline",
|
|
1536
|
+
"value": "#{$outline-offset + $outline-width}",
|
|
1537
|
+
"compiledValue": "3px"
|
|
1538
|
+
},
|
|
1534
1539
|
{
|
|
1535
1540
|
"name": "$focus-ring",
|
|
1536
1541
|
"value": "0 0 0 $outline-offset $white, 0 0 0 #{$outline-offset + $outline-width} $blue-400",
|
|
@@ -47,10 +47,18 @@
|
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
50
|
+
@each $name, $size in $gl-form-input-sizes {
|
|
51
|
+
.gl-form-input-#{$name} {
|
|
52
|
+
max-width: $size;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
@each $breakpointName, $breakpointSize in $gl-form-input-sizes {
|
|
56
|
+
@if $breakpointName != xs {
|
|
57
|
+
.gl-#{$breakpointName}-form-input-#{$name} {
|
|
58
|
+
@include gl-media-breakpoint-up($breakpointName) {
|
|
59
|
+
max-width: $size;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
54
62
|
}
|
|
55
63
|
}
|
|
56
64
|
}
|
|
@@ -15,25 +15,54 @@ describe('GlFormInput', () => {
|
|
|
15
15
|
};
|
|
16
16
|
|
|
17
17
|
describe('size prop', () => {
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
describe('when number is passed', () => {
|
|
19
|
+
// Exclude the default null value
|
|
20
|
+
const sizes = Object.values(formInputSizes).filter(Boolean);
|
|
20
21
|
|
|
21
|
-
|
|
22
|
-
|
|
22
|
+
it.each(sizes)('adds correct class for size %s', (size) => {
|
|
23
|
+
createComponent({ size });
|
|
23
24
|
|
|
24
|
-
|
|
25
|
-
|
|
25
|
+
expect(wrapper.classes()).toEqual(['gl-form-input', `gl-form-input-${size}`]);
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
it('does not add a size class if not given the size prop', () => {
|
|
29
|
+
createComponent();
|
|
30
|
+
|
|
31
|
+
expect(wrapper.classes()).toEqual(['gl-form-input']);
|
|
32
|
+
});
|
|
26
33
|
|
|
27
|
-
|
|
28
|
-
|
|
34
|
+
it('does not add a size class if passed null', () => {
|
|
35
|
+
createComponent({ size: null });
|
|
29
36
|
|
|
30
|
-
|
|
37
|
+
expect(wrapper.classes()).toEqual(['gl-form-input']);
|
|
38
|
+
});
|
|
31
39
|
});
|
|
32
40
|
|
|
33
|
-
|
|
34
|
-
|
|
41
|
+
describe('when object is passed', () => {
|
|
42
|
+
describe('when `default` key is provided', () => {
|
|
43
|
+
it('adds responsive CSS classes and base class', () => {
|
|
44
|
+
createComponent({ size: { default: 'md', md: 'lg', lg: 'xl' } });
|
|
45
|
+
|
|
46
|
+
expect(wrapper.classes()).toEqual([
|
|
47
|
+
'gl-form-input',
|
|
48
|
+
'gl-form-input-md',
|
|
49
|
+
'gl-md-form-input-lg',
|
|
50
|
+
'gl-lg-form-input-xl',
|
|
51
|
+
]);
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
describe('when `default` key is not provided', () => {
|
|
56
|
+
it('adds responsive CSS classes', () => {
|
|
57
|
+
createComponent({ size: { md: 'lg', lg: 'xl' } });
|
|
35
58
|
|
|
36
|
-
|
|
59
|
+
expect(wrapper.classes()).toEqual([
|
|
60
|
+
'gl-form-input',
|
|
61
|
+
'gl-md-form-input-lg',
|
|
62
|
+
'gl-lg-form-input-xl',
|
|
63
|
+
]);
|
|
64
|
+
});
|
|
65
|
+
});
|
|
37
66
|
});
|
|
38
67
|
});
|
|
39
68
|
|
|
@@ -57,6 +57,25 @@ export const Sizes = (args, { argTypes }) => ({
|
|
|
57
57
|
});
|
|
58
58
|
Sizes.args = {};
|
|
59
59
|
|
|
60
|
+
export const ResponsiveSizes = (args, { argTypes }) => ({
|
|
61
|
+
components: { GlFormInput },
|
|
62
|
+
props: Object.keys(argTypes),
|
|
63
|
+
template: `
|
|
64
|
+
<div>
|
|
65
|
+
<gl-form-input
|
|
66
|
+
:size="{ default: 'md', md: 'lg', lg: 'xl' }"
|
|
67
|
+
value="With \`default\` key"
|
|
68
|
+
/>
|
|
69
|
+
<gl-form-input
|
|
70
|
+
class="gl-mt-4"
|
|
71
|
+
:size="{ md: 'lg', lg: 'xl' }"
|
|
72
|
+
value="Without \`default\` key"
|
|
73
|
+
/>
|
|
74
|
+
</div>
|
|
75
|
+
`,
|
|
76
|
+
});
|
|
77
|
+
ResponsiveSizes.args = {};
|
|
78
|
+
|
|
60
79
|
export default {
|
|
61
80
|
title: 'base/form/form-input',
|
|
62
81
|
component: GlFormInput,
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
<script>
|
|
2
|
+
import { isObject } from 'lodash';
|
|
2
3
|
import { BFormInput } from 'bootstrap-vue';
|
|
4
|
+
|
|
3
5
|
import { formInputSizes } from '../../../../utils/constants';
|
|
4
6
|
|
|
5
7
|
const MODEL_PROP = 'value';
|
|
@@ -19,17 +21,34 @@ export default {
|
|
|
19
21
|
* Maximum width of the input
|
|
20
22
|
*/
|
|
21
23
|
size: {
|
|
22
|
-
type: String,
|
|
24
|
+
type: [String, Object],
|
|
23
25
|
required: false,
|
|
24
26
|
default: null,
|
|
25
|
-
validator: (value) =>
|
|
27
|
+
validator: (value) => {
|
|
28
|
+
const sizes = isObject(value) ? Object.values(value) : [value];
|
|
29
|
+
|
|
30
|
+
return sizes.every((size) => Object.values(formInputSizes).includes(size));
|
|
31
|
+
},
|
|
26
32
|
},
|
|
27
33
|
},
|
|
28
34
|
computed: {
|
|
29
35
|
cssClasses() {
|
|
30
|
-
|
|
31
|
-
[
|
|
32
|
-
}
|
|
36
|
+
if (this.size === null) {
|
|
37
|
+
return [];
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
if (isObject(this.size)) {
|
|
41
|
+
const { default: defaultSize, ...nonDefaultSizes } = this.size;
|
|
42
|
+
|
|
43
|
+
return [
|
|
44
|
+
...(defaultSize ? [`gl-form-input-${defaultSize}`] : []),
|
|
45
|
+
...Object.entries(nonDefaultSizes).map(
|
|
46
|
+
([breakpoint, size]) => `gl-${breakpoint}-form-input-${size}`
|
|
47
|
+
),
|
|
48
|
+
];
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
return [`gl-form-input-${this.size}`];
|
|
33
52
|
},
|
|
34
53
|
listeners() {
|
|
35
54
|
return {
|
package/src/index.js
CHANGED
|
@@ -28,10 +28,7 @@ export { default as GlPaginatedList } from './components/base/paginated_list/pag
|
|
|
28
28
|
export { default as GlPopover } from './components/base/popover/popover.vue';
|
|
29
29
|
export { default as GlProgressBar } from './components/base/progress_bar/progress_bar.vue';
|
|
30
30
|
export { default as GlToken } from './components/base/token/token.vue';
|
|
31
|
-
export {
|
|
32
|
-
default as GlSkeletonLoading,
|
|
33
|
-
default as GlDeprecatedSkeletonLoading,
|
|
34
|
-
} from './components/base/skeleton_loading/skeleton_loading.vue';
|
|
31
|
+
export { default as GlDeprecatedSkeletonLoading } from './components/base/skeleton_loading/skeleton_loading.vue';
|
|
35
32
|
export { default as GlBadge } from './components/base/badge/badge.vue';
|
|
36
33
|
export { default as GlBanner } from './components/base/banner/banner.vue';
|
|
37
34
|
export { default as GlButton } from './components/base/button/button.vue';
|
package/src/scss/utilities.scss
CHANGED
|
@@ -3676,6 +3676,14 @@
|
|
|
3676
3676
|
overflow-wrap: break-word !important
|
|
3677
3677
|
}
|
|
3678
3678
|
|
|
3679
|
+
.gl-overflow-wrap-anywhere {
|
|
3680
|
+
overflow-wrap: anywhere
|
|
3681
|
+
}
|
|
3682
|
+
|
|
3683
|
+
.gl-overflow-wrap-anywhere\! {
|
|
3684
|
+
overflow-wrap: anywhere !important
|
|
3685
|
+
}
|
|
3686
|
+
|
|
3679
3687
|
.gl-overflow-scroll {
|
|
3680
3688
|
overflow: scroll
|
|
3681
3689
|
}
|
|
@@ -5564,12 +5572,24 @@
|
|
|
5564
5572
|
.gl-mb-2\! {
|
|
5565
5573
|
margin-bottom: $gl-spacing-scale-2 !important;
|
|
5566
5574
|
}
|
|
5575
|
+
.gl-mb-n2 {
|
|
5576
|
+
margin-bottom: -$gl-spacing-scale-2;
|
|
5577
|
+
}
|
|
5578
|
+
.gl-mb-n2\! {
|
|
5579
|
+
margin-bottom: -$gl-spacing-scale-2 !important;
|
|
5580
|
+
}
|
|
5567
5581
|
.gl-mb-3 {
|
|
5568
5582
|
margin-bottom: $gl-spacing-scale-3;
|
|
5569
5583
|
}
|
|
5570
5584
|
.gl-mb-3\! {
|
|
5571
5585
|
margin-bottom: $gl-spacing-scale-3 !important;
|
|
5572
5586
|
}
|
|
5587
|
+
.gl-mb-n3 {
|
|
5588
|
+
margin-bottom: -$gl-spacing-scale-3;
|
|
5589
|
+
}
|
|
5590
|
+
.gl-mb-n3\! {
|
|
5591
|
+
margin-bottom: -$gl-spacing-scale-3 !important;
|
|
5592
|
+
}
|
|
5573
5593
|
.gl-mb-4 {
|
|
5574
5594
|
margin-bottom: $gl-spacing-scale-4;
|
|
5575
5595
|
}
|
|
@@ -6002,6 +6022,16 @@
|
|
|
6002
6022
|
margin-left: $gl-spacing-scale-3 !important;
|
|
6003
6023
|
}
|
|
6004
6024
|
}
|
|
6025
|
+
.gl-sm-ml-7 {
|
|
6026
|
+
@include gl-media-breakpoint-up(sm) {
|
|
6027
|
+
margin-left: $gl-spacing-scale-7;
|
|
6028
|
+
}
|
|
6029
|
+
}
|
|
6030
|
+
.gl-sm-ml-7\! {
|
|
6031
|
+
@include gl-media-breakpoint-up(sm) {
|
|
6032
|
+
margin-left: $gl-spacing-scale-7 !important;
|
|
6033
|
+
}
|
|
6034
|
+
}
|
|
6005
6035
|
.gl-sm-mt-0 {
|
|
6006
6036
|
@include gl-media-breakpoint-up(sm) {
|
|
6007
6037
|
margin-top: 0;
|
|
@@ -486,10 +486,18 @@
|
|
|
486
486
|
margin-bottom: $gl-spacing-scale-2;
|
|
487
487
|
}
|
|
488
488
|
|
|
489
|
+
@mixin gl-mb-n2 {
|
|
490
|
+
margin-bottom: -$gl-spacing-scale-2;
|
|
491
|
+
}
|
|
492
|
+
|
|
489
493
|
@mixin gl-mb-3 {
|
|
490
494
|
margin-bottom: $gl-spacing-scale-3;
|
|
491
495
|
}
|
|
492
496
|
|
|
497
|
+
@mixin gl-mb-n3 {
|
|
498
|
+
margin-bottom: -$gl-spacing-scale-3;
|
|
499
|
+
}
|
|
500
|
+
|
|
493
501
|
@mixin gl-mb-4 {
|
|
494
502
|
margin-bottom: $gl-spacing-scale-4;
|
|
495
503
|
}
|
|
@@ -787,6 +795,12 @@
|
|
|
787
795
|
}
|
|
788
796
|
}
|
|
789
797
|
|
|
798
|
+
@mixin gl-sm-ml-7 {
|
|
799
|
+
@include gl-media-breakpoint-up(sm) {
|
|
800
|
+
@include gl-ml-7;
|
|
801
|
+
}
|
|
802
|
+
}
|
|
803
|
+
|
|
790
804
|
@mixin gl-sm-mt-0 {
|
|
791
805
|
@include gl-media-breakpoint-up(sm) {
|
|
792
806
|
@include gl-mt-0;
|
package/src/scss/variables.scss
CHANGED
|
@@ -420,6 +420,7 @@ $gl-transition-duration-medium: 0.2s;
|
|
|
420
420
|
// Focus ring
|
|
421
421
|
$outline-offset: 1px;
|
|
422
422
|
$outline-width: 2px;
|
|
423
|
+
$outline: #{$outline-offset + $outline-width};
|
|
423
424
|
$focus-ring: 0 0 0 $outline-offset $white, 0 0 0 #{$outline-offset + $outline-width} $blue-400;
|
|
424
425
|
$focus-ring-inset: inset 0 0 0 #{$outline-width + $outline-offset} $white,
|
|
425
426
|
inset 0 0 0 $outline-offset $white;
|