@gitlab/ui 79.2.0 → 79.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 +21 -0
- package/dist/components/base/breadcrumb/breadcrumb.js +31 -5
- package/dist/components/base/pagination/pagination.js +3 -3
- package/dist/tokens/css/tokens.css +12 -4
- package/dist/tokens/css/tokens.dark.css +10 -4
- package/dist/tokens/js/tokens.dark.js +10 -4
- package/dist/tokens/js/tokens.js +12 -4
- package/dist/tokens/json/tokens.dark.grouped.json +9 -1
- package/dist/tokens/json/tokens.dark.json +182 -0
- package/dist/tokens/json/tokens.grouped.json +9 -1
- package/dist/tokens/json/tokens.json +182 -0
- package/dist/tokens/scss/_tokens.dark.scss +10 -4
- package/dist/tokens/scss/_tokens.scss +12 -4
- package/dist/tokens/tokens_story.js +7 -1
- package/package.json +1 -1
- package/src/components/base/breadcrumb/breadcrumb.spec.js +61 -7
- package/src/components/base/breadcrumb/breadcrumb.stories.js +2 -0
- package/src/components/base/breadcrumb/breadcrumb.vue +32 -5
- package/src/components/base/form/form_date/form_date.stories.js +10 -2
- package/src/components/base/pagination/pagination.vue +6 -0
- package/src/tokens/text.dark.tokens.json +44 -0
- package/src/tokens/text.dark.tokens.stories.js +6 -1
- package/src/tokens/text.tokens.json +56 -0
- package/src/tokens/text.tokens.stories.js +6 -1
- package/src/tokens/tokens_story.vue +12 -1
- package/tailwind.defaults.js +10 -5
|
@@ -4800,12 +4800,16 @@
|
|
|
4800
4800
|
"primary": {
|
|
4801
4801
|
"value": "#333238",
|
|
4802
4802
|
"$type": "color",
|
|
4803
|
+
"comment": "Use text.color.strong instead",
|
|
4804
|
+
"deprecated": true,
|
|
4803
4805
|
"themeable": true,
|
|
4804
4806
|
"filePath": "/builds/gitlab-org/gitlab-ui/src/tokens/text.tokens.json",
|
|
4805
4807
|
"isSource": false,
|
|
4806
4808
|
"original": {
|
|
4807
4809
|
"value": "#333238",
|
|
4808
4810
|
"$type": "color",
|
|
4811
|
+
"comment": "Use text.color.strong instead",
|
|
4812
|
+
"deprecated": true,
|
|
4809
4813
|
"themeable": true
|
|
4810
4814
|
},
|
|
4811
4815
|
"name": "TEXT_PRIMARY",
|
|
@@ -4818,12 +4822,16 @@
|
|
|
4818
4822
|
"secondary": {
|
|
4819
4823
|
"value": "#737278",
|
|
4820
4824
|
"$type": "color",
|
|
4825
|
+
"comment": "Use text.color.subtle instead",
|
|
4826
|
+
"deprecated": true,
|
|
4821
4827
|
"themeable": true,
|
|
4822
4828
|
"filePath": "/builds/gitlab-org/gitlab-ui/src/tokens/text.tokens.json",
|
|
4823
4829
|
"isSource": false,
|
|
4824
4830
|
"original": {
|
|
4825
4831
|
"value": "#737278",
|
|
4826
4832
|
"$type": "color",
|
|
4833
|
+
"comment": "Use text.color.subtle instead",
|
|
4834
|
+
"deprecated": true,
|
|
4827
4835
|
"themeable": true
|
|
4828
4836
|
},
|
|
4829
4837
|
"name": "TEXT_SECONDARY",
|
|
@@ -4836,12 +4844,16 @@
|
|
|
4836
4844
|
"tertiary": {
|
|
4837
4845
|
"value": "#89888d",
|
|
4838
4846
|
"$type": "color",
|
|
4847
|
+
"comment": "Use text.color.disabled instead",
|
|
4848
|
+
"deprecated": true,
|
|
4839
4849
|
"themeable": true,
|
|
4840
4850
|
"filePath": "/builds/gitlab-org/gitlab-ui/src/tokens/text.tokens.json",
|
|
4841
4851
|
"isSource": false,
|
|
4842
4852
|
"original": {
|
|
4843
4853
|
"value": "#89888d",
|
|
4844
4854
|
"$type": "color",
|
|
4855
|
+
"comment": "Use text.color.disabled instead",
|
|
4856
|
+
"deprecated": true,
|
|
4845
4857
|
"themeable": true
|
|
4846
4858
|
},
|
|
4847
4859
|
"name": "TEXT_TERTIARY",
|
|
@@ -4850,6 +4862,176 @@
|
|
|
4850
4862
|
"text",
|
|
4851
4863
|
"tertiary"
|
|
4852
4864
|
]
|
|
4865
|
+
},
|
|
4866
|
+
"color": {
|
|
4867
|
+
"default": {
|
|
4868
|
+
"value": "#434248",
|
|
4869
|
+
"$type": "color",
|
|
4870
|
+
"comment": "Used for the default text color.",
|
|
4871
|
+
"themeable": true,
|
|
4872
|
+
"filePath": "/builds/gitlab-org/gitlab-ui/src/tokens/text.tokens.json",
|
|
4873
|
+
"isSource": false,
|
|
4874
|
+
"original": {
|
|
4875
|
+
"value": "#434248",
|
|
4876
|
+
"$type": "color",
|
|
4877
|
+
"comment": "Used for the default text color.",
|
|
4878
|
+
"themeable": true
|
|
4879
|
+
},
|
|
4880
|
+
"name": "TEXT_COLOR_DEFAULT",
|
|
4881
|
+
"attributes": {},
|
|
4882
|
+
"path": [
|
|
4883
|
+
"text",
|
|
4884
|
+
"color",
|
|
4885
|
+
"default"
|
|
4886
|
+
]
|
|
4887
|
+
},
|
|
4888
|
+
"subtle": {
|
|
4889
|
+
"value": "#626168",
|
|
4890
|
+
"$type": "color",
|
|
4891
|
+
"comment": "Used for supplemental text that doesn't need to be as prominent as other text.",
|
|
4892
|
+
"themeable": true,
|
|
4893
|
+
"filePath": "/builds/gitlab-org/gitlab-ui/src/tokens/text.tokens.json",
|
|
4894
|
+
"isSource": false,
|
|
4895
|
+
"original": {
|
|
4896
|
+
"value": "#626168",
|
|
4897
|
+
"$type": "color",
|
|
4898
|
+
"comment": "Used for supplemental text that doesn't need to be as prominent as other text.",
|
|
4899
|
+
"themeable": true
|
|
4900
|
+
},
|
|
4901
|
+
"name": "TEXT_COLOR_SUBTLE",
|
|
4902
|
+
"attributes": {},
|
|
4903
|
+
"path": [
|
|
4904
|
+
"text",
|
|
4905
|
+
"color",
|
|
4906
|
+
"subtle"
|
|
4907
|
+
]
|
|
4908
|
+
},
|
|
4909
|
+
"strong": {
|
|
4910
|
+
"value": "#1f1e24",
|
|
4911
|
+
"$type": "color",
|
|
4912
|
+
"comment": "Used for text with the highest contrast.",
|
|
4913
|
+
"themeable": true,
|
|
4914
|
+
"filePath": "/builds/gitlab-org/gitlab-ui/src/tokens/text.tokens.json",
|
|
4915
|
+
"isSource": false,
|
|
4916
|
+
"original": {
|
|
4917
|
+
"value": "#1f1e24",
|
|
4918
|
+
"$type": "color",
|
|
4919
|
+
"comment": "Used for text with the highest contrast.",
|
|
4920
|
+
"themeable": true
|
|
4921
|
+
},
|
|
4922
|
+
"name": "TEXT_COLOR_STRONG",
|
|
4923
|
+
"attributes": {},
|
|
4924
|
+
"path": [
|
|
4925
|
+
"text",
|
|
4926
|
+
"color",
|
|
4927
|
+
"strong"
|
|
4928
|
+
]
|
|
4929
|
+
},
|
|
4930
|
+
"heading": {
|
|
4931
|
+
"value": "#1f1e24",
|
|
4932
|
+
"$type": "color",
|
|
4933
|
+
"comment": "Used for headings level 1-6.",
|
|
4934
|
+
"themeable": true,
|
|
4935
|
+
"filePath": "/builds/gitlab-org/gitlab-ui/src/tokens/text.tokens.json",
|
|
4936
|
+
"isSource": false,
|
|
4937
|
+
"original": {
|
|
4938
|
+
"value": "#1f1e24",
|
|
4939
|
+
"$type": "color",
|
|
4940
|
+
"comment": "Used for headings level 1-6.",
|
|
4941
|
+
"themeable": true
|
|
4942
|
+
},
|
|
4943
|
+
"name": "TEXT_COLOR_HEADING",
|
|
4944
|
+
"attributes": {},
|
|
4945
|
+
"path": [
|
|
4946
|
+
"text",
|
|
4947
|
+
"color",
|
|
4948
|
+
"heading"
|
|
4949
|
+
]
|
|
4950
|
+
},
|
|
4951
|
+
"link": {
|
|
4952
|
+
"value": "#0b5cad",
|
|
4953
|
+
"$type": "color",
|
|
4954
|
+
"comment": "Used for default text links.",
|
|
4955
|
+
"themeable": true,
|
|
4956
|
+
"filePath": "/builds/gitlab-org/gitlab-ui/src/tokens/text.tokens.json",
|
|
4957
|
+
"isSource": false,
|
|
4958
|
+
"original": {
|
|
4959
|
+
"value": "#0b5cad",
|
|
4960
|
+
"$type": "color",
|
|
4961
|
+
"comment": "Used for default text links.",
|
|
4962
|
+
"themeable": true
|
|
4963
|
+
},
|
|
4964
|
+
"name": "TEXT_COLOR_LINK",
|
|
4965
|
+
"attributes": {},
|
|
4966
|
+
"path": [
|
|
4967
|
+
"text",
|
|
4968
|
+
"color",
|
|
4969
|
+
"link"
|
|
4970
|
+
]
|
|
4971
|
+
},
|
|
4972
|
+
"danger": {
|
|
4973
|
+
"value": "#c91c00",
|
|
4974
|
+
"$type": "color",
|
|
4975
|
+
"comment": "Used for text indicating a problem, critical state, destructive action, error, failure, removal, stop, or declination.",
|
|
4976
|
+
"themeable": true,
|
|
4977
|
+
"filePath": "/builds/gitlab-org/gitlab-ui/src/tokens/text.tokens.json",
|
|
4978
|
+
"isSource": false,
|
|
4979
|
+
"original": {
|
|
4980
|
+
"value": "#c91c00",
|
|
4981
|
+
"$type": "color",
|
|
4982
|
+
"comment": "Used for text indicating a problem, critical state, destructive action, error, failure, removal, stop, or declination.",
|
|
4983
|
+
"themeable": true
|
|
4984
|
+
},
|
|
4985
|
+
"name": "TEXT_COLOR_DANGER",
|
|
4986
|
+
"attributes": {},
|
|
4987
|
+
"path": [
|
|
4988
|
+
"text",
|
|
4989
|
+
"color",
|
|
4990
|
+
"danger"
|
|
4991
|
+
]
|
|
4992
|
+
},
|
|
4993
|
+
"success": {
|
|
4994
|
+
"value": "#217645",
|
|
4995
|
+
"$type": "color",
|
|
4996
|
+
"comment": "Used for text indicating success or validity.",
|
|
4997
|
+
"themeable": true,
|
|
4998
|
+
"filePath": "/builds/gitlab-org/gitlab-ui/src/tokens/text.tokens.json",
|
|
4999
|
+
"isSource": false,
|
|
5000
|
+
"original": {
|
|
5001
|
+
"value": "#217645",
|
|
5002
|
+
"$type": "color",
|
|
5003
|
+
"comment": "Used for text indicating success or validity.",
|
|
5004
|
+
"themeable": true
|
|
5005
|
+
},
|
|
5006
|
+
"name": "TEXT_COLOR_SUCCESS",
|
|
5007
|
+
"attributes": {},
|
|
5008
|
+
"path": [
|
|
5009
|
+
"text",
|
|
5010
|
+
"color",
|
|
5011
|
+
"success"
|
|
5012
|
+
]
|
|
5013
|
+
},
|
|
5014
|
+
"disabled": {
|
|
5015
|
+
"value": "#89888d",
|
|
5016
|
+
"$type": "color",
|
|
5017
|
+
"comment": "Used for disabled text.",
|
|
5018
|
+
"themeable": true,
|
|
5019
|
+
"filePath": "/builds/gitlab-org/gitlab-ui/src/tokens/text.tokens.json",
|
|
5020
|
+
"isSource": false,
|
|
5021
|
+
"original": {
|
|
5022
|
+
"value": "#89888d",
|
|
5023
|
+
"$type": "color",
|
|
5024
|
+
"comment": "Used for disabled text.",
|
|
5025
|
+
"themeable": true
|
|
5026
|
+
},
|
|
5027
|
+
"name": "TEXT_COLOR_DISABLED",
|
|
5028
|
+
"attributes": {},
|
|
5029
|
+
"path": [
|
|
5030
|
+
"text",
|
|
5031
|
+
"color",
|
|
5032
|
+
"disabled"
|
|
5033
|
+
]
|
|
5034
|
+
}
|
|
4853
5035
|
}
|
|
4854
5036
|
}
|
|
4855
5037
|
}
|
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
|
|
2
2
|
// Do not edit directly
|
|
3
|
-
// Generated on
|
|
3
|
+
// Generated on Thu, 25 Apr 2024 15:30:17 GMT
|
|
4
4
|
|
|
5
|
-
$gl-text-
|
|
6
|
-
$gl-text-
|
|
7
|
-
$gl-text-
|
|
5
|
+
$gl-text-color-disabled: #89888d !default; // Used for disabled text.
|
|
6
|
+
$gl-text-color-link: #63a6e9 !default; // Used for default text links.
|
|
7
|
+
$gl-text-color-heading: #fff !default; // Used for headings level 1-6.
|
|
8
|
+
$gl-text-color-strong: #fff !default; // Used for text with the highest contrast.
|
|
9
|
+
$gl-text-color-subtle: #bfbfc3 !default; // Used for supplemental text that doesn't need to be as prominent as other text.
|
|
10
|
+
$gl-text-color-default: #ececef !default; // Used for the default text color.
|
|
11
|
+
$gl-text-tertiary: #737278 !default; // Use text.color.disabled instead
|
|
12
|
+
$gl-text-secondary: #89888d !default; // Use text.color.subtle instead
|
|
13
|
+
$gl-text-primary: #ececef !default; // Use text.color.strong instead
|
|
8
14
|
$red-950: #fff4f3;
|
|
9
15
|
$red-900: #fcf1ef;
|
|
10
16
|
$red-800: #fdd4cd;
|
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
|
|
2
2
|
// Do not edit directly
|
|
3
|
-
// Generated on
|
|
3
|
+
// Generated on Thu, 25 Apr 2024 15:30:17 GMT
|
|
4
4
|
|
|
5
|
-
$gl-text-
|
|
6
|
-
$gl-text-
|
|
7
|
-
$gl-text-
|
|
5
|
+
$gl-text-color-disabled: #89888d !default; // Used for disabled text.
|
|
6
|
+
$gl-text-color-success: #217645 !default; // Used for text indicating success or validity.
|
|
7
|
+
$gl-text-color-danger: #c91c00 !default; // Used for text indicating a problem, critical state, destructive action, error, failure, removal, stop, or declination.
|
|
8
|
+
$gl-text-color-link: #0b5cad !default; // Used for default text links.
|
|
9
|
+
$gl-text-color-heading: #1f1e24 !default; // Used for headings level 1-6.
|
|
10
|
+
$gl-text-color-strong: #1f1e24 !default; // Used for text with the highest contrast.
|
|
11
|
+
$gl-text-color-subtle: #626168 !default; // Used for supplemental text that doesn't need to be as prominent as other text.
|
|
12
|
+
$gl-text-color-default: #434248 !default; // Used for the default text color.
|
|
13
|
+
$gl-text-tertiary: #89888d !default; // Use text.color.disabled instead
|
|
14
|
+
$gl-text-secondary: #737278 !default; // Use text.color.subtle instead
|
|
15
|
+
$gl-text-primary: #333238 !default; // Use text.color.strong instead
|
|
8
16
|
$gl-line-height-52: 3.25rem;
|
|
9
17
|
$gl-line-height-44: 2.75rem;
|
|
10
18
|
$gl-line-height-42: 2.625rem;
|
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
import { colorFromBackground } from '../utils/utils';
|
|
2
|
+
import { GlTooltipDirective } from '../directives/tooltip';
|
|
3
|
+
import GlBadge from '../components/base/badge/badge';
|
|
2
4
|
import GlColorContrast from '../internal/color_contrast/color_contrast';
|
|
3
5
|
import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
|
|
4
6
|
|
|
5
7
|
var script = {
|
|
6
8
|
name: 'TokensStory',
|
|
7
9
|
components: {
|
|
10
|
+
GlBadge,
|
|
8
11
|
GlColorContrast
|
|
9
12
|
},
|
|
13
|
+
directives: {
|
|
14
|
+
GlTooltip: GlTooltipDirective
|
|
15
|
+
},
|
|
10
16
|
inject: ['isBackgroundColorStory', 'lightBackground', 'darkBackground', 'containerClass'],
|
|
11
17
|
props: {
|
|
12
18
|
tokens: {
|
|
@@ -48,7 +54,7 @@ var script = {
|
|
|
48
54
|
const __vue_script__ = script;
|
|
49
55
|
|
|
50
56
|
/* template */
|
|
51
|
-
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{class:_vm.containerClass},[_c('ul',{staticClass:"gl-list-style-none gl-m-0 gl-p-0"},_vm._l((_vm.tokens),function(token){return _c('li',{key:token.name,staticClass:"gl-display-flex gl-flex-wrap gl-align-items-center gl-justify-content-space-between gl-gap-3 gl-p-3",class:_vm.getClasses(token.value),style:(_vm.getStyle(token.value))},[_c('code',{staticClass:"gl-reset-color"},[_vm._v(_vm._s(_vm.getTokenName(token)))]),_vm._v(" "),_c('div',{staticClass:"gl-display-flex gl-align-items-center gl-gap-3"},[_c('code',{staticClass:"gl-reset-color"},[_vm._v(_vm._s(token.value))]),_vm._v(" "),(!_vm.isAlpha(token.value))?_c('gl-color-contrast',{attrs:{"foreground":token.value,"background":_vm.darkBackground}}):_vm._e(),_vm._v(" "),(!_vm.isAlpha(token.value))?_c('gl-color-contrast',{attrs:{"foreground":token.value,"background":_vm.lightBackground}}):_vm._e()],1)])}),0)])};
|
|
57
|
+
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{class:_vm.containerClass},[_c('ul',{staticClass:"gl-list-style-none gl-m-0 gl-p-0"},_vm._l((_vm.tokens),function(token){return _c('li',{key:token.name,staticClass:"gl-display-flex gl-flex-wrap gl-align-items-center gl-justify-content-space-between gl-gap-3 gl-p-3",class:_vm.getClasses(token.value),style:(_vm.getStyle(token.value))},[_c('code',{directives:[{name:"gl-tooltip",rawName:"v-gl-tooltip"}],staticClass:"gl-reset-color",attrs:{"title":token.comment}},[_vm._v("\n "+_vm._s(_vm.getTokenName(token))+"\n ")]),_vm._v(" "),_c('div',{staticClass:"gl-display-flex gl-align-items-center gl-gap-3"},[(token.deprecated)?_c('gl-badge',{directives:[{name:"gl-tooltip",rawName:"v-gl-tooltip"}],attrs:{"title":token.comment,"variant":"danger"}},[_vm._v("\n Deprecated\n ")]):_vm._e(),_vm._v(" "),_c('code',{staticClass:"gl-reset-color"},[_vm._v(_vm._s(token.value))]),_vm._v(" "),(!_vm.isAlpha(token.value))?_c('gl-color-contrast',{attrs:{"foreground":token.value,"background":_vm.darkBackground}}):_vm._e(),_vm._v(" "),(!_vm.isAlpha(token.value))?_c('gl-color-contrast',{attrs:{"foreground":token.value,"background":_vm.lightBackground}}):_vm._e()],1)])}),0)])};
|
|
52
58
|
var __vue_staticRenderFns__ = [];
|
|
53
59
|
|
|
54
60
|
/* style */
|
package/package.json
CHANGED
|
@@ -29,6 +29,7 @@ describe('Breadcrumb component', () => {
|
|
|
29
29
|
const findAllAvatars = () => wrapper.findAll('[data-testid="avatar"]');
|
|
30
30
|
const findBreadcrumbItems = () => wrapper.findAllComponents(GlBreadcrumbItem);
|
|
31
31
|
const findOverflowDropdown = () => wrapper.findComponent(GlDisclosureDropdown);
|
|
32
|
+
const findOverflowingItems = () => wrapper.findAllComponents(GlDisclosureDropdownItem);
|
|
32
33
|
|
|
33
34
|
const findVisibleBreadcrumbItems = () =>
|
|
34
35
|
findBreadcrumbItems().wrappers.filter((item) => item.isVisible());
|
|
@@ -43,21 +44,24 @@ describe('Breadcrumb component', () => {
|
|
|
43
44
|
});
|
|
44
45
|
};
|
|
45
46
|
|
|
46
|
-
const
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
Object.defineProperty(wrapper.element, 'clientWidth', {
|
|
47
|
+
const mockElementWidth = (element, widthInPx) => {
|
|
48
|
+
Object.defineProperty(element, 'clientWidth', {
|
|
50
49
|
get: () => widthInPx,
|
|
51
|
-
configurable: true,
|
|
52
50
|
});
|
|
53
51
|
};
|
|
54
52
|
|
|
55
53
|
const mockWideWrapperWidth = () => {
|
|
56
|
-
|
|
54
|
+
mockElementWidth(wrapper.element, 1000);
|
|
57
55
|
};
|
|
58
56
|
|
|
59
57
|
const mockSmallWrapperWidth = () => {
|
|
60
|
-
|
|
58
|
+
mockElementWidth(wrapper.element, 1);
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
const mockItemsWidths = () => {
|
|
62
|
+
findBreadcrumbItems().wrappers.forEach((item) => {
|
|
63
|
+
mockElementWidth(item.element, 100);
|
|
64
|
+
});
|
|
61
65
|
};
|
|
62
66
|
|
|
63
67
|
describe('items', () => {
|
|
@@ -88,6 +92,7 @@ describe('Breadcrumb component', () => {
|
|
|
88
92
|
beforeEach(async () => {
|
|
89
93
|
createComponent({ items, showMoreLabel: 'More...' });
|
|
90
94
|
mockSmallWrapperWidth();
|
|
95
|
+
mockItemsWidths();
|
|
91
96
|
await wrapper.vm.$nextTick();
|
|
92
97
|
});
|
|
93
98
|
|
|
@@ -100,6 +105,7 @@ describe('Breadcrumb component', () => {
|
|
|
100
105
|
beforeEach(async () => {
|
|
101
106
|
createComponent();
|
|
102
107
|
mockSmallWrapperWidth();
|
|
108
|
+
mockItemsWidths();
|
|
103
109
|
await wrapper.vm.$nextTick();
|
|
104
110
|
});
|
|
105
111
|
|
|
@@ -109,6 +115,53 @@ describe('Breadcrumb component', () => {
|
|
|
109
115
|
});
|
|
110
116
|
});
|
|
111
117
|
|
|
118
|
+
describe('autoResize', () => {
|
|
119
|
+
describe('by default', () => {
|
|
120
|
+
beforeEach(async () => {
|
|
121
|
+
createComponent();
|
|
122
|
+
mockSmallWrapperWidth();
|
|
123
|
+
mockItemsWidths();
|
|
124
|
+
await wrapper.vm.$nextTick();
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
it('moves overflowing items into dropdown', () => {
|
|
128
|
+
expect(findOverflowDropdown().exists()).toBe(true);
|
|
129
|
+
expect(findOverflowingItems().length).toBeGreaterThan(0);
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
it('reacts to prop changing to false', async () => {
|
|
133
|
+
expect(findOverflowDropdown().exists()).toBe(true);
|
|
134
|
+
await wrapper.setProps({ autoResize: false });
|
|
135
|
+
await wrapper.vm.$nextTick();
|
|
136
|
+
expect(findOverflowDropdown().exists()).toBe(false);
|
|
137
|
+
expect(findBreadcrumbItems().length).toEqual(items.length);
|
|
138
|
+
});
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
describe('when set to false', () => {
|
|
142
|
+
beforeEach(async () => {
|
|
143
|
+
createComponent({ items, autoResize: false });
|
|
144
|
+
mockSmallWrapperWidth();
|
|
145
|
+
mockItemsWidths();
|
|
146
|
+
await wrapper.vm.$nextTick();
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
it('keeps all items visible', () => {
|
|
150
|
+
expect(findOverflowDropdown().exists()).toBe(false);
|
|
151
|
+
expect(findBreadcrumbItems().length).toEqual(items.length);
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
it('reacts to prop changing to true', async () => {
|
|
155
|
+
expect(findOverflowDropdown().exists()).toBe(false);
|
|
156
|
+
await wrapper.setProps({ autoResize: true });
|
|
157
|
+
await wrapper.vm.$nextTick();
|
|
158
|
+
await wrapper.vm.$nextTick(); // otherwise test fails with VUE_VERSION=3
|
|
159
|
+
expect(findOverflowDropdown().exists()).toBe(true);
|
|
160
|
+
expect(findOverflowingItems().length).toBeGreaterThan(0);
|
|
161
|
+
});
|
|
162
|
+
});
|
|
163
|
+
});
|
|
164
|
+
|
|
112
165
|
describe('avatars', () => {
|
|
113
166
|
it('renders 2 avatars when 2 avatarPaths are passed', async () => {
|
|
114
167
|
createComponent();
|
|
@@ -169,6 +222,7 @@ describe('Breadcrumb component', () => {
|
|
|
169
222
|
beforeEach(async () => {
|
|
170
223
|
createComponent();
|
|
171
224
|
mockSmallWrapperWidth();
|
|
225
|
+
mockItemsWidths();
|
|
172
226
|
await wrapper.vm.$nextTick();
|
|
173
227
|
});
|
|
174
228
|
|
|
@@ -7,6 +7,7 @@ const template = `
|
|
|
7
7
|
<gl-breadcrumb
|
|
8
8
|
:items="items"
|
|
9
9
|
:aria-label="ariaLabel"
|
|
10
|
+
:auto-resize="autoResize"
|
|
10
11
|
/>
|
|
11
12
|
`;
|
|
12
13
|
|
|
@@ -15,6 +16,7 @@ const collapsedTemplate = `
|
|
|
15
16
|
<gl-breadcrumb
|
|
16
17
|
:items="items"
|
|
17
18
|
:aria-label="ariaLabel"
|
|
19
|
+
:auto-resize="autoResize"
|
|
18
20
|
/>
|
|
19
21
|
</div>
|
|
20
22
|
`;
|
|
@@ -48,6 +48,14 @@ export default {
|
|
|
48
48
|
required: false,
|
|
49
49
|
default: () => translate('GlBreadcrumb.showMoreLabel', 'Show more breadcrumbs'),
|
|
50
50
|
},
|
|
51
|
+
/**
|
|
52
|
+
* Allows to disable auto-resize behavior. Items will then overflow their container instead of being collapsed into a dropdown.
|
|
53
|
+
*/
|
|
54
|
+
autoResize: {
|
|
55
|
+
type: Boolean,
|
|
56
|
+
required: false,
|
|
57
|
+
default: true,
|
|
58
|
+
},
|
|
51
59
|
},
|
|
52
60
|
data() {
|
|
53
61
|
return {
|
|
@@ -89,16 +97,23 @@ export default {
|
|
|
89
97
|
handler: 'measureAndMakeBreadcrumbsFit',
|
|
90
98
|
deep: true,
|
|
91
99
|
},
|
|
100
|
+
autoResize(newValue) {
|
|
101
|
+
if (newValue) this.enableAutoResize();
|
|
102
|
+
else this.disableAutoResize();
|
|
103
|
+
},
|
|
92
104
|
},
|
|
93
105
|
created() {
|
|
94
106
|
this.debounceMakeBreadcrumbsFit = debounce(this.makeBreadcrumbsFit, 25);
|
|
95
107
|
},
|
|
96
108
|
mounted() {
|
|
97
|
-
|
|
98
|
-
|
|
109
|
+
if (this.autoResize) {
|
|
110
|
+
this.enableAutoResize();
|
|
111
|
+
} else {
|
|
112
|
+
this.resizeDone = true;
|
|
113
|
+
}
|
|
99
114
|
},
|
|
100
115
|
beforeDestroy() {
|
|
101
|
-
|
|
116
|
+
this.disableAutoResize();
|
|
102
117
|
},
|
|
103
118
|
methods: {
|
|
104
119
|
resetItems() {
|
|
@@ -126,9 +141,9 @@ export default {
|
|
|
126
141
|
this.resetItems();
|
|
127
142
|
|
|
128
143
|
const containerWidth = this.$el.clientWidth;
|
|
129
|
-
const buttonWidth =
|
|
144
|
+
const buttonWidth = 40; // px
|
|
130
145
|
|
|
131
|
-
if (this.totalBreadcrumbsWidth
|
|
146
|
+
if (this.totalBreadcrumbsWidth > containerWidth) {
|
|
132
147
|
// Not all breadcrumb items fit. Start moving items over to the dropdown.
|
|
133
148
|
const startSlicingAt = 0;
|
|
134
149
|
|
|
@@ -156,6 +171,18 @@ export default {
|
|
|
156
171
|
getAriaCurrentAttr(index) {
|
|
157
172
|
return this.isLastItem(index) ? 'page' : false;
|
|
158
173
|
},
|
|
174
|
+
enableAutoResize() {
|
|
175
|
+
this.resizeObserver ||= new ResizeObserver(this.debounceMakeBreadcrumbsFit);
|
|
176
|
+
this.resizeObserver.observe(this.$el);
|
|
177
|
+
this.measureAndMakeBreadcrumbsFit();
|
|
178
|
+
},
|
|
179
|
+
disableAutoResize() {
|
|
180
|
+
if (this.resizeObserver) {
|
|
181
|
+
this.resizeObserver.unobserve(this.$el);
|
|
182
|
+
this.resizeObserver = null;
|
|
183
|
+
}
|
|
184
|
+
this.resetItems();
|
|
185
|
+
},
|
|
159
186
|
},
|
|
160
187
|
};
|
|
161
188
|
</script>
|
|
@@ -1,10 +1,13 @@
|
|
|
1
|
+
import GlFormGroup from '../form_group/form_group.vue';
|
|
1
2
|
import readme from './form_date.md';
|
|
2
3
|
import GlFormDate from './form_date.vue';
|
|
3
4
|
|
|
4
5
|
const defaultValue = (prop) => GlFormDate.props[prop].default;
|
|
5
6
|
|
|
6
7
|
const template = `
|
|
8
|
+
<gl-form-group :label="labelText" :label-for="inputId">
|
|
7
9
|
<gl-form-date
|
|
10
|
+
:id="inputId"
|
|
8
11
|
v-model="localValue"
|
|
9
12
|
:disabled="disabled"
|
|
10
13
|
:min="min"
|
|
@@ -13,9 +16,12 @@ const template = `
|
|
|
13
16
|
:max-invalid-feedback="maxInvalidFeedback"
|
|
14
17
|
:readonly="readonly"
|
|
15
18
|
:value="value"
|
|
16
|
-
|
|
19
|
+
/>
|
|
20
|
+
</gl-form-group>`;
|
|
17
21
|
|
|
18
22
|
const generateProps = ({
|
|
23
|
+
inputId = 'input-id',
|
|
24
|
+
labelText = 'Label',
|
|
19
25
|
disabled = false,
|
|
20
26
|
min = '',
|
|
21
27
|
max = '',
|
|
@@ -24,6 +30,8 @@ const generateProps = ({
|
|
|
24
30
|
readonly = false,
|
|
25
31
|
value = '',
|
|
26
32
|
} = {}) => ({
|
|
33
|
+
inputId,
|
|
34
|
+
labelText,
|
|
27
35
|
disabled,
|
|
28
36
|
min,
|
|
29
37
|
max,
|
|
@@ -34,7 +42,7 @@ const generateProps = ({
|
|
|
34
42
|
});
|
|
35
43
|
|
|
36
44
|
const Template = (args) => ({
|
|
37
|
-
components: { GlFormDate },
|
|
45
|
+
components: { GlFormDate, GlFormGroup },
|
|
38
46
|
props: Object.keys(args),
|
|
39
47
|
watch: {
|
|
40
48
|
value(newValue) {
|
|
@@ -379,6 +379,7 @@ export default {
|
|
|
379
379
|
<ul class="pagination" :class="wrapperClasses">
|
|
380
380
|
<li
|
|
381
381
|
class="page-item"
|
|
382
|
+
data-testid="page-item"
|
|
382
383
|
:class="{
|
|
383
384
|
disabled: prevPageIsDisabled,
|
|
384
385
|
'flex-fill': isFillAlign,
|
|
@@ -387,6 +388,7 @@ export default {
|
|
|
387
388
|
>
|
|
388
389
|
<component
|
|
389
390
|
:is="prevPageIsDisabled ? 'span' : 'a'"
|
|
391
|
+
data-testid="page-link"
|
|
390
392
|
class="gl-link page-link prev-page-item gl-display-flex"
|
|
391
393
|
:aria-label="prevPageAriaLabel"
|
|
392
394
|
:href="prevPageHref"
|
|
@@ -408,6 +410,7 @@ export default {
|
|
|
408
410
|
v-for="item in visibleItems"
|
|
409
411
|
:key="item.key"
|
|
410
412
|
class="page-item"
|
|
413
|
+
data-testid="page-item"
|
|
411
414
|
:class="{
|
|
412
415
|
disabled: item.disabled,
|
|
413
416
|
'flex-fill': isFillAlign,
|
|
@@ -415,6 +418,7 @@ export default {
|
|
|
415
418
|
>
|
|
416
419
|
<component
|
|
417
420
|
:is="item.component"
|
|
421
|
+
data-testid="page-link"
|
|
418
422
|
size="md"
|
|
419
423
|
:aria-disabled="item.disabled"
|
|
420
424
|
class="page-link"
|
|
@@ -442,6 +446,7 @@ export default {
|
|
|
442
446
|
|
|
443
447
|
<li
|
|
444
448
|
class="page-item"
|
|
449
|
+
data-testid="page-item"
|
|
445
450
|
:class="{
|
|
446
451
|
disabled: nextPageIsDisabled,
|
|
447
452
|
'flex-fill': isFillAlign,
|
|
@@ -450,6 +455,7 @@ export default {
|
|
|
450
455
|
>
|
|
451
456
|
<component
|
|
452
457
|
:is="nextPageIsDisabled ? 'span' : 'a'"
|
|
458
|
+
data-testid="page-link"
|
|
453
459
|
class="gl-link page-link next-page-item gl-display-flex"
|
|
454
460
|
:aria-label="nextPageAriaLabel"
|
|
455
461
|
:href="nextPageHref"
|
|
@@ -3,17 +3,61 @@
|
|
|
3
3
|
"primary": {
|
|
4
4
|
"$value": "#ececef",
|
|
5
5
|
"$type": "color",
|
|
6
|
+
"$description": "Use text.color.strong instead",
|
|
7
|
+
"deprecated": true,
|
|
6
8
|
"themeable": true
|
|
7
9
|
},
|
|
8
10
|
"secondary": {
|
|
9
11
|
"$value": "#89888d",
|
|
10
12
|
"$type": "color",
|
|
13
|
+
"$description": "Use text.color.subtle instead",
|
|
14
|
+
"deprecated": true,
|
|
11
15
|
"themeable": true
|
|
12
16
|
},
|
|
13
17
|
"tertiary": {
|
|
14
18
|
"$value": "#737278",
|
|
15
19
|
"$type": "color",
|
|
20
|
+
"$description": "Use text.color.disabled instead",
|
|
21
|
+
"deprecated": true,
|
|
16
22
|
"themeable": true
|
|
23
|
+
},
|
|
24
|
+
"color": {
|
|
25
|
+
"default": {
|
|
26
|
+
"$value": "#ececef",
|
|
27
|
+
"$type": "color",
|
|
28
|
+
"$description": "Used for the default text color.",
|
|
29
|
+
"themeable": true
|
|
30
|
+
},
|
|
31
|
+
"subtle": {
|
|
32
|
+
"$value": "#bfbfc3",
|
|
33
|
+
"$type": "color",
|
|
34
|
+
"$description": "Used for supplemental text that doesn't need to be as prominent as other text.",
|
|
35
|
+
"themeable": true
|
|
36
|
+
},
|
|
37
|
+
"strong": {
|
|
38
|
+
"$value": "#fff",
|
|
39
|
+
"$type": "color",
|
|
40
|
+
"$description": "Used for text with the highest contrast.",
|
|
41
|
+
"themeable": true
|
|
42
|
+
},
|
|
43
|
+
"heading": {
|
|
44
|
+
"$value": "#fff",
|
|
45
|
+
"$type": "color",
|
|
46
|
+
"$description": "Used for headings level 1-6.",
|
|
47
|
+
"themeable": true
|
|
48
|
+
},
|
|
49
|
+
"link": {
|
|
50
|
+
"$value": "#63a6e9",
|
|
51
|
+
"$type": "color",
|
|
52
|
+
"$description": "Used for default text links.",
|
|
53
|
+
"themeable": true
|
|
54
|
+
},
|
|
55
|
+
"disabled": {
|
|
56
|
+
"$value": "#89888d",
|
|
57
|
+
"$type": "color",
|
|
58
|
+
"$description": "Used for disabled text.",
|
|
59
|
+
"themeable": true
|
|
60
|
+
}
|
|
17
61
|
}
|
|
18
62
|
}
|
|
19
63
|
}
|