@gitlab/ui 52.11.0 → 52.13.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/button/button.js +9 -1
- package/dist/components/base/new_dropdowns/base_dropdown/base_dropdown.js +11 -1
- package/dist/components/base/new_dropdowns/listbox/listbox.js +9 -1
- package/dist/components/regions/empty_state/empty_state.js +12 -1
- package/dist/utils/charts/story_config.js +1 -1
- package/dist/utils/stories_constants.js +23 -0
- package/dist/utils/stories_utils.js +1 -13
- package/package.json +2 -2
- package/src/components/base/button/button.spec.js +15 -0
- package/src/components/base/button/button.vue +9 -0
- package/src/components/base/new_dropdowns/base_dropdown/base_dropdown.spec.js +18 -0
- package/src/components/base/new_dropdowns/base_dropdown/base_dropdown.vue +11 -0
- package/src/components/base/new_dropdowns/listbox/listbox.stories.js +121 -1
- package/src/components/base/new_dropdowns/listbox/listbox.vue +9 -0
- package/src/components/charts/legend/legend.stories.js +1 -1
- package/src/components/charts/series_label/series_label.stories.js +1 -1
- package/src/components/charts/tooltip/tooltip.stories.js +1 -1
- package/src/components/regions/empty_state/empty_state.spec.js +35 -0
- package/src/components/regions/empty_state/empty_state.stories.js +5 -0
- package/src/components/regions/empty_state/empty_state.vue +15 -1
- package/src/utils/charts/story_config.js +1 -1
- package/src/utils/stories_constants.js +24 -0
- package/src/utils/stories_utils.js +0 -15
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
# [52.13.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v52.12.0...v52.13.0) (2023-01-18)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* **GlBaseDropdown:** Allow listbox to stretch in full-width ([83ab66c](https://gitlab.com/gitlab-org/gitlab-ui/commit/83ab66c2ae3a43d906398b286d784c129b0ef9d1))
|
|
7
|
+
|
|
8
|
+
# [52.12.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v52.11.0...v52.12.0) (2023-01-17)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Features
|
|
12
|
+
|
|
13
|
+
* **GlEmptyState:** Add content-class prop ([7f850d7](https://gitlab.com/gitlab-org/gitlab-ui/commit/7f850d7661ffcb6a2db1cccfaca87cd7d794e01b))
|
|
14
|
+
|
|
1
15
|
# [52.11.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v52.10.0...v52.11.0) (2023-01-16)
|
|
2
16
|
|
|
3
17
|
|
|
@@ -58,6 +58,11 @@ var script = {
|
|
|
58
58
|
required: false,
|
|
59
59
|
default: ''
|
|
60
60
|
},
|
|
61
|
+
block: {
|
|
62
|
+
type: Boolean,
|
|
63
|
+
required: false,
|
|
64
|
+
default: false
|
|
65
|
+
},
|
|
61
66
|
disabled: {
|
|
62
67
|
type: Boolean,
|
|
63
68
|
required: false,
|
|
@@ -93,6 +98,9 @@ var script = {
|
|
|
93
98
|
},
|
|
94
99
|
buttonSize() {
|
|
95
100
|
return buttonSizeOptions[this.size];
|
|
101
|
+
},
|
|
102
|
+
displayBlock() {
|
|
103
|
+
return !this.label && this.block;
|
|
96
104
|
}
|
|
97
105
|
},
|
|
98
106
|
mounted() {
|
|
@@ -107,7 +115,7 @@ var script = {
|
|
|
107
115
|
const __vue_script__ = script;
|
|
108
116
|
|
|
109
117
|
/* template */
|
|
110
|
-
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c(_vm.label ? 'span' : 'b-button',_vm._g(_vm._b({directives:[{name:"safe-link",rawName:"v-safe-link:[safeLinkConfig]",arg:_vm.safeLinkConfig}],tag:"component",class:_vm.buttonClasses,attrs:{"target":_vm.target,"variant":_vm.variant,"size":_vm.buttonSize,"disabled":_vm.isButtonDisabled}},'component',_vm.$attrs,false),_vm.$listeners),[(_vm.loading)?_c('gl-loading-icon',{staticClass:"gl-button-icon gl-button-loading-indicator",attrs:{"inline":""}}):_vm._e(),_vm._v(" "),(_vm.hasIcon && !(_vm.hasIconOnly && _vm.loading))?_c('gl-icon',{staticClass:"gl-button-icon",attrs:{"name":_vm.icon}}):_vm._e(),_vm._v(" "),_vm._t("emoji"),_vm._v(" "),(!_vm.hasIconOnly)?_c('span',{staticClass:"gl-button-text",class:_vm.buttonTextClasses},[_vm._t("default")],2):_vm._e()],2)};
|
|
118
|
+
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c(_vm.label ? 'span' : 'b-button',_vm._g(_vm._b({directives:[{name:"safe-link",rawName:"v-safe-link:[safeLinkConfig]",arg:_vm.safeLinkConfig}],tag:"component",class:_vm.buttonClasses,attrs:{"block":_vm.displayBlock,"target":_vm.target,"variant":_vm.variant,"size":_vm.buttonSize,"disabled":_vm.isButtonDisabled}},'component',_vm.$attrs,false),_vm.$listeners),[(_vm.loading)?_c('gl-loading-icon',{staticClass:"gl-button-icon gl-button-loading-indicator",attrs:{"inline":""}}):_vm._e(),_vm._v(" "),(_vm.hasIcon && !(_vm.hasIconOnly && _vm.loading))?_c('gl-icon',{staticClass:"gl-button-icon",attrs:{"name":_vm.icon}}):_vm._e(),_vm._v(" "),_vm._t("emoji"),_vm._v(" "),(!_vm.hasIconOnly)?_c('span',{staticClass:"gl-button-text",class:_vm.buttonTextClasses},[_vm._t("default")],2):_vm._e()],2)};
|
|
111
119
|
var __vue_staticRenderFns__ = [];
|
|
112
120
|
|
|
113
121
|
/* style */
|
|
@@ -26,6 +26,11 @@ var script = {
|
|
|
26
26
|
required: false,
|
|
27
27
|
default: false
|
|
28
28
|
},
|
|
29
|
+
block: {
|
|
30
|
+
type: Boolean,
|
|
31
|
+
required: false,
|
|
32
|
+
default: false
|
|
33
|
+
},
|
|
29
34
|
category: {
|
|
30
35
|
type: String,
|
|
31
36
|
required: false,
|
|
@@ -126,6 +131,9 @@ var script = {
|
|
|
126
131
|
'dropdown-toggle-no-caret': this.noCaret
|
|
127
132
|
}];
|
|
128
133
|
},
|
|
134
|
+
toggleButtonTextClasses() {
|
|
135
|
+
return this.block ? 'gl-w-full' : '';
|
|
136
|
+
},
|
|
129
137
|
toggleLabelledBy() {
|
|
130
138
|
return this.ariaLabelledby ? `${this.ariaLabelledby} ${this.toggleId}` : this.toggleId;
|
|
131
139
|
},
|
|
@@ -137,6 +145,8 @@ var script = {
|
|
|
137
145
|
return {
|
|
138
146
|
is: GlButton,
|
|
139
147
|
icon: this.icon,
|
|
148
|
+
block: this.block,
|
|
149
|
+
buttonTextClasses: this.toggleButtonTextClasses,
|
|
140
150
|
category: this.category,
|
|
141
151
|
variant: this.variant,
|
|
142
152
|
size: this.size,
|
|
@@ -236,7 +246,7 @@ var script = {
|
|
|
236
246
|
const __vue_script__ = script;
|
|
237
247
|
|
|
238
248
|
/* template */
|
|
239
|
-
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{directives:[{name:"outside",rawName:"v-outside",value:(_vm.close),expression:"close"}],staticClass:"gl-dropdown dropdown gl-display-inline-flex gl-vertical-align-middle"},[_c(_vm.toggleOptions.is,_vm._g(_vm._b({ref:"toggle",tag:"component",attrs:{"id":_vm.toggleId,"data-testid":"base-dropdown-toggle","aria-haspopup":_vm.ariaHaspopup,"aria-expanded":_vm.visible,"aria-labelledby":_vm.toggleLabelledBy,"aria-controls":_vm.baseDropdownId}},'component',_vm.toggleOptions,false),_vm.toggleOptions.listeners),[_vm._t("toggle",function(){return [_c('span',{staticClass:"gl-dropdown-button-text",class:{ 'gl-sr-only': _vm.textSrOnly }},[_vm._v("\n "+_vm._s(_vm.toggleText)+"\n ")]),_vm._v(" "),(!_vm.noCaret)?_c('gl-icon',{staticClass:"gl-button-icon dropdown-chevron",attrs:{"name":"chevron-down"}}):_vm._e()]})],2),_vm._v(" "),_c('div',{ref:"content",staticClass:"dropdown-menu",class:{ show: _vm.visible },attrs:{"id":_vm.baseDropdownId,"data-testid":"base-dropdown-menu"},on:{"keydown":function($event){if(!$event.type.indexOf('key')&&_vm._k($event.keyCode,"esc",27,$event.key,["Esc","Escape"])){ return null; }$event.stopPropagation();$event.preventDefault();return _vm.closeAndFocus.apply(null, arguments)}}},[_c('div',{staticClass:"gl-dropdown-inner"},[_vm._t("default")],2)])],1)};
|
|
249
|
+
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{directives:[{name:"outside",rawName:"v-outside",value:(_vm.close),expression:"close"}],staticClass:"gl-dropdown dropdown gl-display-inline-flex gl-vertical-align-middle",class:{ 'gl-display-block': _vm.block }},[_c(_vm.toggleOptions.is,_vm._g(_vm._b({ref:"toggle",tag:"component",attrs:{"id":_vm.toggleId,"data-testid":"base-dropdown-toggle","aria-haspopup":_vm.ariaHaspopup,"aria-expanded":_vm.visible,"aria-labelledby":_vm.toggleLabelledBy,"aria-controls":_vm.baseDropdownId}},'component',_vm.toggleOptions,false),_vm.toggleOptions.listeners),[_vm._t("toggle",function(){return [_c('span',{staticClass:"gl-dropdown-button-text",class:{ 'gl-sr-only': _vm.textSrOnly }},[_vm._v("\n "+_vm._s(_vm.toggleText)+"\n ")]),_vm._v(" "),(!_vm.noCaret)?_c('gl-icon',{staticClass:"gl-button-icon dropdown-chevron",attrs:{"name":"chevron-down"}}):_vm._e()]})],2),_vm._v(" "),_c('div',{ref:"content",staticClass:"dropdown-menu",class:{ show: _vm.visible },attrs:{"id":_vm.baseDropdownId,"data-testid":"base-dropdown-menu"},on:{"keydown":function($event){if(!$event.type.indexOf('key')&&_vm._k($event.keyCode,"esc",27,$event.key,["Esc","Escape"])){ return null; }$event.stopPropagation();$event.preventDefault();return _vm.closeAndFocus.apply(null, arguments)}}},[_c('div',{staticClass:"gl-dropdown-inner"},[_vm._t("default")],2)])],1)};
|
|
240
250
|
var __vue_staticRenderFns__ = [];
|
|
241
251
|
|
|
242
252
|
/* style */
|
|
@@ -262,6 +262,14 @@ var script = {
|
|
|
262
262
|
type: String,
|
|
263
263
|
required: false,
|
|
264
264
|
default: ''
|
|
265
|
+
},
|
|
266
|
+
/**
|
|
267
|
+
* Render the toggle button as a block element
|
|
268
|
+
*/
|
|
269
|
+
block: {
|
|
270
|
+
type: Boolean,
|
|
271
|
+
required: false,
|
|
272
|
+
default: false
|
|
265
273
|
}
|
|
266
274
|
},
|
|
267
275
|
data() {
|
|
@@ -527,7 +535,7 @@ var script = {
|
|
|
527
535
|
const __vue_script__ = script;
|
|
528
536
|
|
|
529
537
|
/* template */
|
|
530
|
-
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('gl-base-dropdown',{ref:"baseDropdown",attrs:{"aria-haspopup":"listbox","aria-labelledby":_vm.toggleAriaLabelledBy,"toggle-id":_vm.toggleId,"toggle-text":_vm.listboxToggleText,"toggle-class":_vm.toggleClass,"text-sr-only":_vm.textSrOnly,"category":_vm.category,"variant":_vm.variant,"size":_vm.size,"icon":_vm.icon,"disabled":_vm.disabled,"loading":_vm.loading,"no-caret":_vm.noCaret,"right":_vm.right},on:_vm._d({},[_vm.$options.events.GL_DROPDOWN_SHOWN,_vm.onShow,_vm.$options.events.GL_DROPDOWN_HIDDEN,_vm.onHide]),scopedSlots:_vm._u([(_vm.hasCustomToggle)?{key:"toggle",fn:function(){return [_vm._t("toggle")]},proxy:true}:null],null,true)},[_vm._v(" "),(_vm.headerText)?_c('div',{staticClass:"gl-display-flex gl-align-items-center gl-p-4! gl-min-h-8",class:_vm.$options.HEADER_ITEMS_BORDER_CLASSES},[_c('div',{staticClass:"gl-flex-grow-1 gl-font-weight-bold gl-font-sm gl-pr-2",attrs:{"id":_vm.headerId,"data-testid":"listbox-header-text"}},[_vm._v("\n "+_vm._s(_vm.headerText)+"\n ")]),_vm._v(" "),(_vm.showResetButton)?_c('gl-button',{staticClass:"gl-focus-inset-border-2-blue-400! gl-flex-shrink-0 gl-font-sm! gl-px-2! gl-py-2!",attrs:{"category":"tertiary","data-testid":"listbox-reset-button"},on:{"click":_vm.onResetButtonClicked}},[_vm._v("\n "+_vm._s(_vm.resetButtonLabel)+"\n ")]):_vm._e()],1):_vm._e(),_vm._v(" "),(_vm.searchable)?_c('div',{class:_vm.$options.HEADER_ITEMS_BORDER_CLASSES},[_c('gl-listbox-search-input',{ref:"searchBox",attrs:{"aria-owns":_vm.listboxId,"data-testid":"listbox-search-input","placeholder":_vm.searchPlaceholder},on:{"input":_vm.search,"keydown":_vm.onKeydown},model:{value:(_vm.searchStr),callback:function ($$v) {_vm.searchStr=$$v;},expression:"searchStr"}}),_vm._v(" "),(_vm.searching)?_c('gl-loading-icon',{staticClass:"gl-my-3",attrs:{"data-testid":"listbox-search-loader","size":"md"}}):_vm._e()],1):_vm._e(),_vm._v(" "),(_vm.showList)?_c(_vm.listboxTag,{ref:"list",tag:"component",staticClass:"gl-dropdown-contents gl-list-style-none gl-pl-0 gl-mb-0",attrs:{"id":_vm.listboxId,"aria-labelledby":_vm.listAriaLabelledBy || _vm.headerId || _vm.toggleId,"role":"listbox","tabindex":"-1"},on:{"keydown":_vm.onKeydown}},[_vm._l((_vm.items),function(item,index){return [(_vm.isOption(item))?[_c('gl-listbox-item',_vm._b({key:item.value,attrs:{"data-testid":("listbox-item-" + (item.value)),"is-selected":_vm.isSelected(item),"is-focused":_vm.isFocused(item),"is-check-centered":_vm.isCheckCentered},on:{"select":function($event){return _vm.onSelect(item, $event)}}},'gl-listbox-item',_vm.listboxItemMoreItemsAriaAttributes(index),false),[_vm._t("list-item",function(){return [_vm._v("\n "+_vm._s(item.text)+"\n ")]},{"item":item})],2)]:[_c('gl-listbox-group',{key:item.text,class:_vm.groupClasses(index),attrs:{"name":item.text},scopedSlots:_vm._u([(_vm.$scopedSlots['group-label'])?{key:"group-label",fn:function(){return [_vm._t("group-label",null,{"group":item})]},proxy:true}:null],null,true)},[_vm._v(" "),_vm._l((item.options),function(option){return _c('gl-listbox-item',{key:option.value,attrs:{"data-testid":("listbox-item-" + (option.value)),"is-selected":_vm.isSelected(option),"is-focused":_vm.isFocused(option),"is-check-centered":_vm.isCheckCentered},on:{"select":function($event){return _vm.onSelect(option, $event)}}},[_vm._t("list-item",function(){return [_vm._v("\n "+_vm._s(option.text)+"\n ")]},{"item":option})],2)})],2)]]}),_vm._v(" "),(_vm.infiniteScrollLoading)?_c(_vm.listboxTag === 'ul' ? 'li' : 'div',{tag:"component"},[_c('gl-loading-icon',{staticClass:"gl-my-3",attrs:{"data-testid":"listbox-infinite-scroll-loader","size":"md"}})],1):_vm._e(),_vm._v(" "),(_vm.showIntersectionObserver)?_c('gl-intersection-observer',{on:{"appear":_vm.onIntersectionObserverAppear}}):_vm._e()],2):_vm._e(),_vm._v(" "),(_vm.announceSRSearchResults)?_c('span',{staticClass:"gl-sr-only",attrs:{"data-testid":"listbox-number-of-results","aria-live":"assertive"}},[_vm._t("search-summary-sr-only")],2):(_vm.showNoResultsText)?_c('div',{staticClass:"gl-pl-7 gl-pr-5 gl-pt-3 gl-font-base gl-text-gray-600",attrs:{"aria-live":"assertive","data-testid":"listbox-no-results-text"}},[_vm._v("\n "+_vm._s(_vm.noResultsText)+"\n ")]):_vm._e(),_vm._v(" "),_vm._t("footer")],2)};
|
|
538
|
+
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('gl-base-dropdown',{ref:"baseDropdown",attrs:{"aria-haspopup":"listbox","aria-labelledby":_vm.toggleAriaLabelledBy,"block":_vm.block,"toggle-id":_vm.toggleId,"toggle-text":_vm.listboxToggleText,"toggle-class":_vm.toggleClass,"text-sr-only":_vm.textSrOnly,"category":_vm.category,"variant":_vm.variant,"size":_vm.size,"icon":_vm.icon,"disabled":_vm.disabled,"loading":_vm.loading,"no-caret":_vm.noCaret,"right":_vm.right},on:_vm._d({},[_vm.$options.events.GL_DROPDOWN_SHOWN,_vm.onShow,_vm.$options.events.GL_DROPDOWN_HIDDEN,_vm.onHide]),scopedSlots:_vm._u([(_vm.hasCustomToggle)?{key:"toggle",fn:function(){return [_vm._t("toggle")]},proxy:true}:null],null,true)},[_vm._v(" "),(_vm.headerText)?_c('div',{staticClass:"gl-display-flex gl-align-items-center gl-p-4! gl-min-h-8",class:_vm.$options.HEADER_ITEMS_BORDER_CLASSES},[_c('div',{staticClass:"gl-flex-grow-1 gl-font-weight-bold gl-font-sm gl-pr-2",attrs:{"id":_vm.headerId,"data-testid":"listbox-header-text"}},[_vm._v("\n "+_vm._s(_vm.headerText)+"\n ")]),_vm._v(" "),(_vm.showResetButton)?_c('gl-button',{staticClass:"gl-focus-inset-border-2-blue-400! gl-flex-shrink-0 gl-font-sm! gl-px-2! gl-py-2!",attrs:{"category":"tertiary","data-testid":"listbox-reset-button"},on:{"click":_vm.onResetButtonClicked}},[_vm._v("\n "+_vm._s(_vm.resetButtonLabel)+"\n ")]):_vm._e()],1):_vm._e(),_vm._v(" "),(_vm.searchable)?_c('div',{class:_vm.$options.HEADER_ITEMS_BORDER_CLASSES},[_c('gl-listbox-search-input',{ref:"searchBox",attrs:{"aria-owns":_vm.listboxId,"data-testid":"listbox-search-input","placeholder":_vm.searchPlaceholder},on:{"input":_vm.search,"keydown":_vm.onKeydown},model:{value:(_vm.searchStr),callback:function ($$v) {_vm.searchStr=$$v;},expression:"searchStr"}}),_vm._v(" "),(_vm.searching)?_c('gl-loading-icon',{staticClass:"gl-my-3",attrs:{"data-testid":"listbox-search-loader","size":"md"}}):_vm._e()],1):_vm._e(),_vm._v(" "),(_vm.showList)?_c(_vm.listboxTag,{ref:"list",tag:"component",staticClass:"gl-dropdown-contents gl-list-style-none gl-pl-0 gl-mb-0",attrs:{"id":_vm.listboxId,"aria-labelledby":_vm.listAriaLabelledBy || _vm.headerId || _vm.toggleId,"role":"listbox","tabindex":"-1"},on:{"keydown":_vm.onKeydown}},[_vm._l((_vm.items),function(item,index){return [(_vm.isOption(item))?[_c('gl-listbox-item',_vm._b({key:item.value,attrs:{"data-testid":("listbox-item-" + (item.value)),"is-selected":_vm.isSelected(item),"is-focused":_vm.isFocused(item),"is-check-centered":_vm.isCheckCentered},on:{"select":function($event){return _vm.onSelect(item, $event)}}},'gl-listbox-item',_vm.listboxItemMoreItemsAriaAttributes(index),false),[_vm._t("list-item",function(){return [_vm._v("\n "+_vm._s(item.text)+"\n ")]},{"item":item})],2)]:[_c('gl-listbox-group',{key:item.text,class:_vm.groupClasses(index),attrs:{"name":item.text},scopedSlots:_vm._u([(_vm.$scopedSlots['group-label'])?{key:"group-label",fn:function(){return [_vm._t("group-label",null,{"group":item})]},proxy:true}:null],null,true)},[_vm._v(" "),_vm._l((item.options),function(option){return _c('gl-listbox-item',{key:option.value,attrs:{"data-testid":("listbox-item-" + (option.value)),"is-selected":_vm.isSelected(option),"is-focused":_vm.isFocused(option),"is-check-centered":_vm.isCheckCentered},on:{"select":function($event){return _vm.onSelect(option, $event)}}},[_vm._t("list-item",function(){return [_vm._v("\n "+_vm._s(option.text)+"\n ")]},{"item":option})],2)})],2)]]}),_vm._v(" "),(_vm.infiniteScrollLoading)?_c(_vm.listboxTag === 'ul' ? 'li' : 'div',{tag:"component"},[_c('gl-loading-icon',{staticClass:"gl-my-3",attrs:{"data-testid":"listbox-infinite-scroll-loader","size":"md"}})],1):_vm._e(),_vm._v(" "),(_vm.showIntersectionObserver)?_c('gl-intersection-observer',{on:{"appear":_vm.onIntersectionObserverAppear}}):_vm._e()],2):_vm._e(),_vm._v(" "),(_vm.announceSRSearchResults)?_c('span',{staticClass:"gl-sr-only",attrs:{"data-testid":"listbox-number-of-results","aria-live":"assertive"}},[_vm._t("search-summary-sr-only")],2):(_vm.showNoResultsText)?_c('div',{staticClass:"gl-pl-7 gl-pr-5 gl-pt-3 gl-font-base gl-text-gray-600",attrs:{"aria-live":"assertive","data-testid":"listbox-no-results-text"}},[_vm._v("\n "+_vm._s(_vm.noResultsText)+"\n ")]):_vm._e(),_vm._v(" "),_vm._t("footer")],2)};
|
|
531
539
|
var __vue_staticRenderFns__ = [];
|
|
532
540
|
|
|
533
541
|
/* style */
|
|
@@ -82,6 +82,14 @@ var script = {
|
|
|
82
82
|
type: Boolean,
|
|
83
83
|
required: false,
|
|
84
84
|
default: true
|
|
85
|
+
},
|
|
86
|
+
/**
|
|
87
|
+
* CSS classes to add to the content container
|
|
88
|
+
*/
|
|
89
|
+
contentClass: {
|
|
90
|
+
type: [Array, String, Object],
|
|
91
|
+
required: false,
|
|
92
|
+
default: () => []
|
|
85
93
|
}
|
|
86
94
|
},
|
|
87
95
|
computed: {
|
|
@@ -96,6 +104,9 @@ var script = {
|
|
|
96
104
|
},
|
|
97
105
|
shouldRenderSecondaryButton() {
|
|
98
106
|
return Boolean(this.secondaryButtonLink && this.secondaryButtonText);
|
|
107
|
+
},
|
|
108
|
+
contentClasses() {
|
|
109
|
+
return [this.compact ? 'gl-flex-grow-1 gl-flex-basis-0 gl-px-4' : 'gl-max-w-full gl-m-auto', this.contentClass];
|
|
99
110
|
}
|
|
100
111
|
}
|
|
101
112
|
};
|
|
@@ -107,7 +118,7 @@ const __vue_script__ = script;
|
|
|
107
118
|
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('section',{staticClass:"gl-display-flex",class:{
|
|
108
119
|
'empty-state gl-text-center gl-flex-direction-column': !_vm.compact,
|
|
109
120
|
'gl-flex-direction-row': _vm.compact,
|
|
110
|
-
}},[_c('div',{class:{ 'gl-display-none gl-sm-display-block gl-px-4': _vm.compact, 'gl-max-w-full': !_vm.compact }},[(_vm.svgPath)?_c('div',{staticClass:"svg-250",class:{ 'svg-content': !_vm.compact }},[_c('img',{staticClass:"gl-max-w-full",class:{ 'gl-dark-invert-keep-hue': _vm.invertInDarkMode },attrs:{"src":_vm.svgPath,"alt":"","role":"img","height":_vm.height}})]):_vm._e()]),_vm._v(" "),_c('div',{class:_vm.
|
|
121
|
+
}},[_c('div',{class:{ 'gl-display-none gl-sm-display-block gl-px-4': _vm.compact, 'gl-max-w-full': !_vm.compact }},[(_vm.svgPath)?_c('div',{staticClass:"svg-250",class:{ 'svg-content': !_vm.compact }},[_c('img',{staticClass:"gl-max-w-full",class:{ 'gl-dark-invert-keep-hue': _vm.invertInDarkMode },attrs:{"src":_vm.svgPath,"alt":"","role":"img","height":_vm.height}})]):_vm._e()]),_vm._v(" "),_c('div',{class:_vm.contentClasses,attrs:{"data-testid":"gl-empty-state-content"}},[_c('div',{staticClass:"gl-mx-auto gl-my-0",class:{ 'gl-p-5': !_vm.compact }},[_vm._t("title",function(){return [_c('h1',{staticClass:"gl-font-size-h-display gl-line-height-36",class:_vm.compact ? 'h5' : 'h4'},[_vm._v("\n "+_vm._s(_vm.title)+"\n ")])]}),_vm._v(" "),(_vm.description || _vm.$scopedSlots.description)?_c('p',{ref:"description",staticClass:"gl-mt-3"},[_vm._t("description",function(){return [_vm._v("\n "+_vm._s(_vm.description)+"\n ")]})],2):_vm._e(),_vm._v(" "),_c('div',{staticClass:"gl-display-flex gl-flex-wrap",class:{ 'gl-justify-content-center': !_vm.compact }},[_vm._t("actions",function(){return [(_vm.shouldRenderPrimaryButton)?_c('gl-button',{staticClass:"gl-mb-3",class:_vm.compact ? 'gl-mr-3' : 'gl-mx-2',attrs:{"variant":"confirm","href":_vm.primaryButtonLink}},[_vm._v(_vm._s(_vm.primaryButtonText))]):_vm._e(),_vm._v(" "),(_vm.shouldRenderSecondaryButton)?_c('gl-button',{staticClass:"gl-mb-3 gl-mr-3",class:{ 'gl-mx-2!': !_vm.compact },attrs:{"href":_vm.secondaryButtonLink}},[_vm._v(_vm._s(_vm.secondaryButtonText)+"\n ")]):_vm._e()]})],2)],2)])])};
|
|
111
122
|
var __vue_staticRenderFns__ = [];
|
|
112
123
|
|
|
113
124
|
/* style */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import times from 'lodash/times';
|
|
2
|
-
import { SERIES_NAME, SERIES_NAME_SHORT } from '../
|
|
2
|
+
import { SERIES_NAME, SERIES_NAME_SHORT } from '../stories_constants';
|
|
3
3
|
import { marqueeSelectionSvgPath, redoSvgPath, clearAllSvgPath, downloadSvgPath } from '../svgs/svg_paths';
|
|
4
4
|
import { colorFromDefaultPalette } from './theme';
|
|
5
5
|
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Arg types subcategories to be used to organize props within arg tables
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
const ARG_TYPE_SUBCATEGORY_LOOK_AND_FEEL = 'Look & feel';
|
|
6
|
+
const ARG_TYPE_SUBCATEGORY_STATE = 'State';
|
|
7
|
+
const ARG_TYPE_SUBCATEGORY_SEARCH = 'Search';
|
|
8
|
+
const ARG_TYPE_SUBCATEGORY_ACCESSIBILITY = 'Accessibility';
|
|
9
|
+
const ARG_TYPE_SUBCATEGORY_INFINITE_SCROLL = 'Infinite scroll';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* These are used to test varying lengths of series names
|
|
13
|
+
*/
|
|
14
|
+
const SERIES_NAME_SHORT = 'SERIES_NAME_SHORT';
|
|
15
|
+
const SERIES_NAME_LONG = 'SERIES_NAME_LONG';
|
|
16
|
+
const SERIES_NAME_LONG_WITHOUT_SPACES = 'SERIES_NAME_LONG_WITHOUT_SPACES';
|
|
17
|
+
const SERIES_NAME = {
|
|
18
|
+
[SERIES_NAME_SHORT]: 'Series ',
|
|
19
|
+
[SERIES_NAME_LONG]: 'Series name long. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed tincidunt interdum sapien ut blandit. Nulla fermentum nisi id euismod vulputate. END',
|
|
20
|
+
[SERIES_NAME_LONG_WITHOUT_SPACES]: 'Series_name_long._Lorem_ipsum_dolor_sit_amet,_consectetur_adipiscing_elit._Sed_tincidunt_interdum_sapien_ut_blandit._Nulla_fermentum_nisi_id_euismod_vulputate._END'
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export { ARG_TYPE_SUBCATEGORY_ACCESSIBILITY, ARG_TYPE_SUBCATEGORY_INFINITE_SCROLL, ARG_TYPE_SUBCATEGORY_LOOK_AND_FEEL, ARG_TYPE_SUBCATEGORY_SEARCH, ARG_TYPE_SUBCATEGORY_STATE, SERIES_NAME, SERIES_NAME_LONG, SERIES_NAME_LONG_WITHOUT_SPACES, SERIES_NAME_SHORT };
|
|
@@ -1,15 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* These are used to test varying lengths of series names
|
|
3
|
-
*/
|
|
4
|
-
const SERIES_NAME_SHORT = 'SERIES_NAME_SHORT';
|
|
5
|
-
const SERIES_NAME_LONG = 'SERIES_NAME_LONG';
|
|
6
|
-
const SERIES_NAME_LONG_WITHOUT_SPACES = 'SERIES_NAME_LONG_WITHOUT_SPACES';
|
|
7
|
-
const SERIES_NAME = {
|
|
8
|
-
[SERIES_NAME_SHORT]: 'Series ',
|
|
9
|
-
[SERIES_NAME_LONG]: 'Series name long. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed tincidunt interdum sapien ut blandit. Nulla fermentum nisi id euismod vulputate. END',
|
|
10
|
-
[SERIES_NAME_LONG_WITHOUT_SPACES]: 'Series_name_long._Lorem_ipsum_dolor_sit_amet,_consectetur_adipiscing_elit._Sed_tincidunt_interdum_sapien_ut_blandit._Nulla_fermentum_nisi_id_euismod_vulputate._END'
|
|
11
|
-
};
|
|
12
|
-
|
|
13
1
|
/**
|
|
14
2
|
* Builds the parameters object disable one or multiple controls.
|
|
15
3
|
*/
|
|
@@ -22,4 +10,4 @@ const disableControls = function () {
|
|
|
22
10
|
}]));
|
|
23
11
|
};
|
|
24
12
|
|
|
25
|
-
export {
|
|
13
|
+
export { disableControls };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gitlab/ui",
|
|
3
|
-
"version": "52.
|
|
3
|
+
"version": "52.13.0",
|
|
4
4
|
"description": "GitLab UI Components",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -85,7 +85,7 @@
|
|
|
85
85
|
"@babel/core": "^7.20.12",
|
|
86
86
|
"@babel/preset-env": "^7.20.2",
|
|
87
87
|
"@gitlab/eslint-plugin": "18.1.0",
|
|
88
|
-
"@gitlab/fonts": "^1.0
|
|
88
|
+
"@gitlab/fonts": "^1.1.0",
|
|
89
89
|
"@gitlab/stylelint-config": "4.1.0",
|
|
90
90
|
"@gitlab/svgs": "3.16.0",
|
|
91
91
|
"@rollup/plugin-commonjs": "^11.1.0",
|
|
@@ -194,6 +194,21 @@ describe('button component', () => {
|
|
|
194
194
|
|
|
195
195
|
expect(wrapper.attributes('href')).toBe(unsafeUrl);
|
|
196
196
|
});
|
|
197
|
+
|
|
198
|
+
it.each`
|
|
199
|
+
description | label | expectedResult
|
|
200
|
+
${'applies block styling'} | ${true} | ${false}
|
|
201
|
+
${'does not apply block styling when label=true'} | ${false} | ${true}
|
|
202
|
+
`('block prop $description', ({ label, expectedResult }) => {
|
|
203
|
+
buildWrapper({
|
|
204
|
+
propsData: {
|
|
205
|
+
label,
|
|
206
|
+
block: true,
|
|
207
|
+
},
|
|
208
|
+
});
|
|
209
|
+
|
|
210
|
+
expect(wrapper.classes().includes('btn-block')).toBe(expectedResult);
|
|
211
|
+
});
|
|
197
212
|
});
|
|
198
213
|
});
|
|
199
214
|
});
|
|
@@ -62,6 +62,11 @@ export default {
|
|
|
62
62
|
required: false,
|
|
63
63
|
default: '',
|
|
64
64
|
},
|
|
65
|
+
block: {
|
|
66
|
+
type: Boolean,
|
|
67
|
+
required: false,
|
|
68
|
+
default: false,
|
|
69
|
+
},
|
|
65
70
|
disabled: {
|
|
66
71
|
type: Boolean,
|
|
67
72
|
required: false,
|
|
@@ -109,6 +114,9 @@ export default {
|
|
|
109
114
|
buttonSize() {
|
|
110
115
|
return buttonSizeOptions[this.size];
|
|
111
116
|
},
|
|
117
|
+
displayBlock() {
|
|
118
|
+
return !this.label && this.block;
|
|
119
|
+
},
|
|
112
120
|
},
|
|
113
121
|
mounted() {
|
|
114
122
|
// eslint-disable-next-line @gitlab/vue-prefer-dollar-scopedslots
|
|
@@ -123,6 +131,7 @@ export default {
|
|
|
123
131
|
:is="label ? 'span' : 'b-button'"
|
|
124
132
|
v-bind="$attrs"
|
|
125
133
|
v-safe-link:[safeLinkConfig]
|
|
134
|
+
:block="displayBlock"
|
|
126
135
|
:target="target"
|
|
127
136
|
:variant="variant"
|
|
128
137
|
:size="buttonSize"
|
|
@@ -44,6 +44,7 @@ describe('base dropdown', () => {
|
|
|
44
44
|
|
|
45
45
|
const findDefaultDropdownToggle = () => wrapper.find('.btn.gl-dropdown-toggle');
|
|
46
46
|
const findCustomDropdownToggle = () => wrapper.find('.gl-dropdown-custom-toggle');
|
|
47
|
+
const findDropdownToggleText = () => findDefaultDropdownToggle().find('.gl-button-text');
|
|
47
48
|
const findDropdownMenu = () => wrapper.find('.dropdown-menu');
|
|
48
49
|
|
|
49
50
|
describe('popper.js instance', () => {
|
|
@@ -132,6 +133,23 @@ describe('base dropdown', () => {
|
|
|
132
133
|
});
|
|
133
134
|
});
|
|
134
135
|
|
|
136
|
+
describe('block prop', () => {
|
|
137
|
+
it('does not apply block style if false', () => {
|
|
138
|
+
buildWrapper({ block: false });
|
|
139
|
+
|
|
140
|
+
expect(wrapper.classes()).not.toContain('gl-w-full');
|
|
141
|
+
expect(findDropdownToggleText().classes()).not.toContain('gl-w-full');
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
it('applies block style if true', () => {
|
|
145
|
+
buildWrapper({ block: true });
|
|
146
|
+
|
|
147
|
+
expect(wrapper.classes()).toContain('gl-display-block');
|
|
148
|
+
expect(findDropdownToggleText().classes()).toContain('gl-w-full');
|
|
149
|
+
expect(findDefaultDropdownToggle().props('block')).toBe(true);
|
|
150
|
+
});
|
|
151
|
+
});
|
|
152
|
+
|
|
135
153
|
describe('toggle visibility', () => {
|
|
136
154
|
beforeEach(() => {
|
|
137
155
|
buildWrapper();
|
|
@@ -29,6 +29,11 @@ export default {
|
|
|
29
29
|
required: false,
|
|
30
30
|
default: false,
|
|
31
31
|
},
|
|
32
|
+
block: {
|
|
33
|
+
type: Boolean,
|
|
34
|
+
required: false,
|
|
35
|
+
default: false,
|
|
36
|
+
},
|
|
32
37
|
category: {
|
|
33
38
|
type: String,
|
|
34
39
|
required: false,
|
|
@@ -130,6 +135,9 @@ export default {
|
|
|
130
135
|
},
|
|
131
136
|
];
|
|
132
137
|
},
|
|
138
|
+
toggleButtonTextClasses() {
|
|
139
|
+
return this.block ? 'gl-w-full' : '';
|
|
140
|
+
},
|
|
133
141
|
toggleLabelledBy() {
|
|
134
142
|
return this.ariaLabelledby ? `${this.ariaLabelledby} ${this.toggleId}` : this.toggleId;
|
|
135
143
|
},
|
|
@@ -141,6 +149,8 @@ export default {
|
|
|
141
149
|
return {
|
|
142
150
|
is: GlButton,
|
|
143
151
|
icon: this.icon,
|
|
152
|
+
block: this.block,
|
|
153
|
+
buttonTextClasses: this.toggleButtonTextClasses,
|
|
144
154
|
category: this.category,
|
|
145
155
|
variant: this.variant,
|
|
146
156
|
size: this.size,
|
|
@@ -241,6 +251,7 @@ export default {
|
|
|
241
251
|
<div
|
|
242
252
|
v-outside="close"
|
|
243
253
|
class="gl-dropdown dropdown gl-display-inline-flex gl-vertical-align-middle"
|
|
254
|
+
:class="{ 'gl-display-block': block }"
|
|
244
255
|
>
|
|
245
256
|
<component
|
|
246
257
|
:is="toggleOptions.is"
|
|
@@ -13,8 +13,15 @@ import {
|
|
|
13
13
|
GlAvatar,
|
|
14
14
|
} from '../../../../index';
|
|
15
15
|
import { makeContainer } from '../../../../utils/story_decorators/container';
|
|
16
|
-
import { disableControls } from '../../../../utils/stories_utils';
|
|
17
16
|
import { setStoryTimeout } from '../../../../utils/test_utils';
|
|
17
|
+
import { disableControls } from '../../../../utils/stories_utils';
|
|
18
|
+
import {
|
|
19
|
+
ARG_TYPE_SUBCATEGORY_LOOK_AND_FEEL,
|
|
20
|
+
ARG_TYPE_SUBCATEGORY_STATE,
|
|
21
|
+
ARG_TYPE_SUBCATEGORY_SEARCH,
|
|
22
|
+
ARG_TYPE_SUBCATEGORY_ACCESSIBILITY,
|
|
23
|
+
ARG_TYPE_SUBCATEGORY_INFINITE_SCROLL,
|
|
24
|
+
} from '../../../../utils/stories_constants';
|
|
18
25
|
import readme from './listbox.md';
|
|
19
26
|
import { mockOptions, mockGroups, mockUsers } from './mock_data';
|
|
20
27
|
import { flattenedOptions } from './utils';
|
|
@@ -27,6 +34,7 @@ const generateProps = ({
|
|
|
27
34
|
variant = defaultValue('variant'),
|
|
28
35
|
size = defaultValue('size'),
|
|
29
36
|
disabled = defaultValue('disabled'),
|
|
37
|
+
block = defaultValue('block'),
|
|
30
38
|
loading = defaultValue('loading'),
|
|
31
39
|
searchable = defaultValue('searchable'),
|
|
32
40
|
searching = defaultValue('searching'),
|
|
@@ -52,6 +60,7 @@ const generateProps = ({
|
|
|
52
60
|
variant,
|
|
53
61
|
size,
|
|
54
62
|
disabled,
|
|
63
|
+
block,
|
|
55
64
|
loading,
|
|
56
65
|
searchable,
|
|
57
66
|
searching,
|
|
@@ -78,6 +87,7 @@ const makeBindings = (overrides = {}) =>
|
|
|
78
87
|
':items': 'items',
|
|
79
88
|
':category': 'category',
|
|
80
89
|
':variant': 'variant',
|
|
90
|
+
':block': 'block',
|
|
81
91
|
':size': 'size',
|
|
82
92
|
':disabled': 'disabled',
|
|
83
93
|
':loading': 'loading',
|
|
@@ -195,6 +205,7 @@ HeaderAndFooter.args = generateProps({
|
|
|
195
205
|
headerText: 'Assign to department',
|
|
196
206
|
resetButtonLabel: 'Unassign',
|
|
197
207
|
multiple: true,
|
|
208
|
+
block: true,
|
|
198
209
|
});
|
|
199
210
|
HeaderAndFooter.decorators = [makeContainer({ height: '370px' })];
|
|
200
211
|
|
|
@@ -396,18 +407,127 @@ export default {
|
|
|
396
407
|
type: 'select',
|
|
397
408
|
options: buttonCategoryOptions,
|
|
398
409
|
},
|
|
410
|
+
table: {
|
|
411
|
+
subcategory: ARG_TYPE_SUBCATEGORY_LOOK_AND_FEEL,
|
|
412
|
+
},
|
|
399
413
|
},
|
|
400
414
|
variant: {
|
|
401
415
|
control: {
|
|
402
416
|
type: 'select',
|
|
403
417
|
options: buttonVariantOptions,
|
|
404
418
|
},
|
|
419
|
+
table: {
|
|
420
|
+
subcategory: ARG_TYPE_SUBCATEGORY_LOOK_AND_FEEL,
|
|
421
|
+
},
|
|
405
422
|
},
|
|
406
423
|
size: {
|
|
407
424
|
control: {
|
|
408
425
|
type: 'select',
|
|
409
426
|
options: Object.keys(buttonSizeOptions),
|
|
410
427
|
},
|
|
428
|
+
table: {
|
|
429
|
+
subcategory: ARG_TYPE_SUBCATEGORY_LOOK_AND_FEEL,
|
|
430
|
+
},
|
|
431
|
+
},
|
|
432
|
+
noCaret: {
|
|
433
|
+
table: {
|
|
434
|
+
subcategory: ARG_TYPE_SUBCATEGORY_LOOK_AND_FEEL,
|
|
435
|
+
},
|
|
436
|
+
},
|
|
437
|
+
right: {
|
|
438
|
+
table: {
|
|
439
|
+
subcategory: ARG_TYPE_SUBCATEGORY_LOOK_AND_FEEL,
|
|
440
|
+
},
|
|
441
|
+
},
|
|
442
|
+
toggleText: {
|
|
443
|
+
table: {
|
|
444
|
+
subcategory: ARG_TYPE_SUBCATEGORY_LOOK_AND_FEEL,
|
|
445
|
+
},
|
|
446
|
+
},
|
|
447
|
+
icon: {
|
|
448
|
+
table: {
|
|
449
|
+
subcategory: ARG_TYPE_SUBCATEGORY_LOOK_AND_FEEL,
|
|
450
|
+
},
|
|
451
|
+
},
|
|
452
|
+
isCheckCentered: {
|
|
453
|
+
table: {
|
|
454
|
+
subcategory: ARG_TYPE_SUBCATEGORY_LOOK_AND_FEEL,
|
|
455
|
+
},
|
|
456
|
+
},
|
|
457
|
+
headerText: {
|
|
458
|
+
table: {
|
|
459
|
+
subcategory: ARG_TYPE_SUBCATEGORY_LOOK_AND_FEEL,
|
|
460
|
+
},
|
|
461
|
+
},
|
|
462
|
+
resetButtonLabel: {
|
|
463
|
+
table: {
|
|
464
|
+
subcategory: ARG_TYPE_SUBCATEGORY_LOOK_AND_FEEL,
|
|
465
|
+
},
|
|
466
|
+
},
|
|
467
|
+
toggleClass: {
|
|
468
|
+
table: {
|
|
469
|
+
subcategory: ARG_TYPE_SUBCATEGORY_LOOK_AND_FEEL,
|
|
470
|
+
},
|
|
471
|
+
},
|
|
472
|
+
disabled: {
|
|
473
|
+
table: {
|
|
474
|
+
subcategory: ARG_TYPE_SUBCATEGORY_STATE,
|
|
475
|
+
},
|
|
476
|
+
},
|
|
477
|
+
loading: {
|
|
478
|
+
table: {
|
|
479
|
+
subcategory: ARG_TYPE_SUBCATEGORY_STATE,
|
|
480
|
+
},
|
|
481
|
+
},
|
|
482
|
+
searchable: {
|
|
483
|
+
table: {
|
|
484
|
+
subcategory: ARG_TYPE_SUBCATEGORY_SEARCH,
|
|
485
|
+
},
|
|
486
|
+
},
|
|
487
|
+
searching: {
|
|
488
|
+
table: {
|
|
489
|
+
subcategory: ARG_TYPE_SUBCATEGORY_SEARCH,
|
|
490
|
+
},
|
|
491
|
+
},
|
|
492
|
+
noResultsText: {
|
|
493
|
+
table: {
|
|
494
|
+
subcategory: ARG_TYPE_SUBCATEGORY_SEARCH,
|
|
495
|
+
},
|
|
496
|
+
},
|
|
497
|
+
searchPlaceholder: {
|
|
498
|
+
table: {
|
|
499
|
+
subcategory: ARG_TYPE_SUBCATEGORY_SEARCH,
|
|
500
|
+
},
|
|
501
|
+
},
|
|
502
|
+
textSrOnly: {
|
|
503
|
+
table: {
|
|
504
|
+
subcategory: ARG_TYPE_SUBCATEGORY_ACCESSIBILITY,
|
|
505
|
+
},
|
|
506
|
+
},
|
|
507
|
+
toggleAriaLabelledBy: {
|
|
508
|
+
table: {
|
|
509
|
+
subcategory: ARG_TYPE_SUBCATEGORY_ACCESSIBILITY,
|
|
510
|
+
},
|
|
511
|
+
},
|
|
512
|
+
listAriaLabelledBy: {
|
|
513
|
+
table: {
|
|
514
|
+
subcategory: ARG_TYPE_SUBCATEGORY_ACCESSIBILITY,
|
|
515
|
+
},
|
|
516
|
+
},
|
|
517
|
+
infiniteScroll: {
|
|
518
|
+
table: {
|
|
519
|
+
subcategory: ARG_TYPE_SUBCATEGORY_INFINITE_SCROLL,
|
|
520
|
+
},
|
|
521
|
+
},
|
|
522
|
+
infiniteScrollLoading: {
|
|
523
|
+
table: {
|
|
524
|
+
subcategory: ARG_TYPE_SUBCATEGORY_INFINITE_SCROLL,
|
|
525
|
+
},
|
|
526
|
+
},
|
|
527
|
+
totalItems: {
|
|
528
|
+
table: {
|
|
529
|
+
subcategory: ARG_TYPE_SUBCATEGORY_INFINITE_SCROLL,
|
|
530
|
+
},
|
|
411
531
|
},
|
|
412
532
|
},
|
|
413
533
|
};
|
|
@@ -275,6 +275,14 @@ export default {
|
|
|
275
275
|
required: false,
|
|
276
276
|
default: '',
|
|
277
277
|
},
|
|
278
|
+
/**
|
|
279
|
+
* Render the toggle button as a block element
|
|
280
|
+
*/
|
|
281
|
+
block: {
|
|
282
|
+
type: Boolean,
|
|
283
|
+
required: false,
|
|
284
|
+
default: false,
|
|
285
|
+
},
|
|
278
286
|
},
|
|
279
287
|
data() {
|
|
280
288
|
return {
|
|
@@ -546,6 +554,7 @@ export default {
|
|
|
546
554
|
ref="baseDropdown"
|
|
547
555
|
aria-haspopup="listbox"
|
|
548
556
|
:aria-labelledby="toggleAriaLabelledBy"
|
|
557
|
+
:block="block"
|
|
549
558
|
:toggle-id="toggleId"
|
|
550
559
|
:toggle-text="listboxToggleText"
|
|
551
560
|
:toggle-class="toggleClass"
|
|
@@ -245,4 +245,39 @@ describe('empty state component', () => {
|
|
|
245
245
|
expect(p.text()).not.toBe(props.description);
|
|
246
246
|
});
|
|
247
247
|
});
|
|
248
|
+
|
|
249
|
+
describe('with custom content class', () => {
|
|
250
|
+
const findContentContainer = () => component.find('[data-testid="gl-empty-state-content"]');
|
|
251
|
+
const customContentClass = 'gl-p-0';
|
|
252
|
+
const expectedDefaultContentClasses = ['gl-max-w-full', 'gl-m-auto', customContentClass];
|
|
253
|
+
const expectedCompactContentClasses = [
|
|
254
|
+
'gl-flex-grow-1',
|
|
255
|
+
'gl-flex-basis-0',
|
|
256
|
+
'gl-px-4',
|
|
257
|
+
customContentClass,
|
|
258
|
+
];
|
|
259
|
+
|
|
260
|
+
it.each`
|
|
261
|
+
contentClass | compact | expectedClasses
|
|
262
|
+
${customContentClass} | ${false} | ${expectedDefaultContentClasses}
|
|
263
|
+
${[customContentClass]} | ${false} | ${expectedDefaultContentClasses}
|
|
264
|
+
${{ [customContentClass]: true }} | ${false} | ${expectedDefaultContentClasses}
|
|
265
|
+
${customContentClass} | ${true} | ${expectedCompactContentClasses}
|
|
266
|
+
${[customContentClass]} | ${true} | ${expectedCompactContentClasses}
|
|
267
|
+
${{ [customContentClass]: true }} | ${true} | ${expectedCompactContentClasses}
|
|
268
|
+
`(
|
|
269
|
+
'applies $contentClass class when compact is $compact',
|
|
270
|
+
({ contentClass, compact, expectedClasses }) => {
|
|
271
|
+
component = shallowMount(EmptyState, {
|
|
272
|
+
propsData: {
|
|
273
|
+
...props,
|
|
274
|
+
compact,
|
|
275
|
+
contentClass,
|
|
276
|
+
},
|
|
277
|
+
});
|
|
278
|
+
|
|
279
|
+
expect(findContentContainer().classes()).toEqual(expectedClasses);
|
|
280
|
+
}
|
|
281
|
+
);
|
|
282
|
+
});
|
|
248
283
|
});
|
|
@@ -14,6 +14,7 @@ const template = `
|
|
|
14
14
|
:compact="compact"
|
|
15
15
|
:primary-button-link="primaryButtonLink"
|
|
16
16
|
:secondary-button-link="secondaryButtonLink"
|
|
17
|
+
:contentClass="contentClass"
|
|
17
18
|
/>`;
|
|
18
19
|
|
|
19
20
|
const Template = (args) => ({
|
|
@@ -34,6 +35,7 @@ const generateProps = ({
|
|
|
34
35
|
primaryButtonLink = '#',
|
|
35
36
|
secondaryButtonLink = '#',
|
|
36
37
|
compact = false,
|
|
38
|
+
contentClass = [],
|
|
37
39
|
} = {}) => ({
|
|
38
40
|
title,
|
|
39
41
|
svgPath,
|
|
@@ -44,6 +46,7 @@ const generateProps = ({
|
|
|
44
46
|
primaryButtonLink,
|
|
45
47
|
secondaryButtonLink,
|
|
46
48
|
compact,
|
|
49
|
+
contentClass,
|
|
47
50
|
});
|
|
48
51
|
|
|
49
52
|
export const Default = Template.bind({});
|
|
@@ -82,6 +85,7 @@ export const CustomActions = (args) => ({
|
|
|
82
85
|
:compact="compact"
|
|
83
86
|
:primary-button-link="primaryButtonLink"
|
|
84
87
|
:secondary-button-link="secondaryButtonLink"
|
|
88
|
+
:contentClass="contentClass"
|
|
85
89
|
>
|
|
86
90
|
<template #actions>
|
|
87
91
|
<gl-button
|
|
@@ -125,6 +129,7 @@ export const SlottedDescription = (args) => ({
|
|
|
125
129
|
:compact="compact"
|
|
126
130
|
:primary-button-link="primaryButtonLink"
|
|
127
131
|
:secondary-button-link="secondaryButtonLink"
|
|
132
|
+
:contentClass="contentClass"
|
|
128
133
|
>
|
|
129
134
|
<template #description>
|
|
130
135
|
<p>A slotted description allows you to use more custom HTML such as <a href="#">links</a>.</p>
|
|
@@ -83,6 +83,14 @@ export default {
|
|
|
83
83
|
required: false,
|
|
84
84
|
default: true,
|
|
85
85
|
},
|
|
86
|
+
/**
|
|
87
|
+
* CSS classes to add to the content container
|
|
88
|
+
*/
|
|
89
|
+
contentClass: {
|
|
90
|
+
type: [Array, String, Object],
|
|
91
|
+
required: false,
|
|
92
|
+
default: () => [],
|
|
93
|
+
},
|
|
86
94
|
},
|
|
87
95
|
computed: {
|
|
88
96
|
height() {
|
|
@@ -97,6 +105,12 @@ export default {
|
|
|
97
105
|
shouldRenderSecondaryButton() {
|
|
98
106
|
return Boolean(this.secondaryButtonLink && this.secondaryButtonText);
|
|
99
107
|
},
|
|
108
|
+
contentClasses() {
|
|
109
|
+
return [
|
|
110
|
+
this.compact ? 'gl-flex-grow-1 gl-flex-basis-0 gl-px-4' : 'gl-max-w-full gl-m-auto',
|
|
111
|
+
this.contentClass,
|
|
112
|
+
];
|
|
113
|
+
},
|
|
100
114
|
},
|
|
101
115
|
};
|
|
102
116
|
</script>
|
|
@@ -123,7 +137,7 @@ export default {
|
|
|
123
137
|
/>
|
|
124
138
|
</div>
|
|
125
139
|
</div>
|
|
126
|
-
<div :class="
|
|
140
|
+
<div :class="contentClasses" data-testid="gl-empty-state-content">
|
|
127
141
|
<div class="gl-mx-auto gl-my-0" :class="{ 'gl-p-5': !compact }">
|
|
128
142
|
<!--
|
|
129
143
|
@slot Use this slot to customize the empty state's title area.
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Arg types subcategories to be used to organize props within arg tables
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
export const ARG_TYPE_SUBCATEGORY_LOOK_AND_FEEL = 'Look & feel';
|
|
6
|
+
export const ARG_TYPE_SUBCATEGORY_STATE = 'State';
|
|
7
|
+
export const ARG_TYPE_SUBCATEGORY_SEARCH = 'Search';
|
|
8
|
+
export const ARG_TYPE_SUBCATEGORY_ACCESSIBILITY = 'Accessibility';
|
|
9
|
+
export const ARG_TYPE_SUBCATEGORY_INFINITE_SCROLL = 'Infinite scroll';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* These are used to test varying lengths of series names
|
|
13
|
+
*/
|
|
14
|
+
export const SERIES_NAME_SHORT = 'SERIES_NAME_SHORT';
|
|
15
|
+
export const SERIES_NAME_LONG = 'SERIES_NAME_LONG';
|
|
16
|
+
export const SERIES_NAME_LONG_WITHOUT_SPACES = 'SERIES_NAME_LONG_WITHOUT_SPACES';
|
|
17
|
+
|
|
18
|
+
export const SERIES_NAME = {
|
|
19
|
+
[SERIES_NAME_SHORT]: 'Series ',
|
|
20
|
+
[SERIES_NAME_LONG]:
|
|
21
|
+
'Series name long. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed tincidunt interdum sapien ut blandit. Nulla fermentum nisi id euismod vulputate. END',
|
|
22
|
+
[SERIES_NAME_LONG_WITHOUT_SPACES]:
|
|
23
|
+
'Series_name_long._Lorem_ipsum_dolor_sit_amet,_consectetur_adipiscing_elit._Sed_tincidunt_interdum_sapien_ut_blandit._Nulla_fermentum_nisi_id_euismod_vulputate._END',
|
|
24
|
+
};
|
|
@@ -1,18 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* These are used to test varying lengths of series names
|
|
3
|
-
*/
|
|
4
|
-
export const SERIES_NAME_SHORT = 'SERIES_NAME_SHORT';
|
|
5
|
-
export const SERIES_NAME_LONG = 'SERIES_NAME_LONG';
|
|
6
|
-
export const SERIES_NAME_LONG_WITHOUT_SPACES = 'SERIES_NAME_LONG_WITHOUT_SPACES';
|
|
7
|
-
|
|
8
|
-
export const SERIES_NAME = {
|
|
9
|
-
[SERIES_NAME_SHORT]: 'Series ',
|
|
10
|
-
[SERIES_NAME_LONG]:
|
|
11
|
-
'Series name long. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed tincidunt interdum sapien ut blandit. Nulla fermentum nisi id euismod vulputate. END',
|
|
12
|
-
[SERIES_NAME_LONG_WITHOUT_SPACES]:
|
|
13
|
-
'Series_name_long._Lorem_ipsum_dolor_sit_amet,_consectetur_adipiscing_elit._Sed_tincidunt_interdum_sapien_ut_blandit._Nulla_fermentum_nisi_id_euismod_vulputate._END',
|
|
14
|
-
};
|
|
15
|
-
|
|
16
1
|
/**
|
|
17
2
|
* Builds the parameters object disable one or multiple controls.
|
|
18
3
|
*/
|