@gitlab/ui 32.19.1 → 32.20.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/alert/alert.js +3 -3
- package/dist/components/base/button/button.documentation.js +17 -1
- package/dist/components/base/button/button.js +10 -10
- package/dist/components/base/dropdown/dropdown.js +8 -8
- package/dist/components/base/tabs/tabs/examples/tabs.basic.example.js +1 -1
- package/dist/components/base/tabs/tabs/examples/tabs.counterbadges.example.js +1 -1
- package/dist/components/base/tabs/tabs/examples/tabs.custom_title.example.js +1 -1
- package/dist/components/base/tabs/tabs/examples/tabs.disabled.example.js +1 -1
- package/dist/components/base/tabs/tabs/examples/tabs.justified.example.js +1 -1
- package/dist/components/base/tabs/tabs/examples/tabs.scrollable.example.js +2 -2
- package/dist/components/base/tabs/tabs/examples/tabs.styles_only.example.js +1 -1
- package/dist/components/base/tabs/tabs/tabs.documentation.js +1 -1
- package/dist/components/mixins/button_mixin.js +2 -2
- package/dist/utils/constants.js +8 -8
- package/package.json +9 -9
- package/src/components/base/alert/alert.spec.js +3 -3
- package/src/components/base/alert/alert.vue +3 -3
- package/src/components/base/button/button.documentation.js +18 -0
- package/src/components/base/button/button.stories.js +13 -13
- package/src/components/base/button/button.vue +15 -15
- package/src/components/base/dropdown/dropdown.stories.js +5 -5
- package/src/components/base/dropdown/dropdown.vue +11 -11
- package/src/components/base/tabs/tabs/examples/tabs.basic.example.vue +2 -2
- package/src/components/base/tabs/tabs/examples/tabs.counterbadges.example.vue +9 -6
- package/src/components/base/tabs/tabs/examples/tabs.custom_title.example.vue +3 -3
- package/src/components/base/tabs/tabs/examples/tabs.disabled.example.vue +3 -3
- package/src/components/base/tabs/tabs/examples/tabs.justified.example.vue +2 -2
- package/src/components/base/tabs/tabs/examples/tabs.scrollable.example.vue +2 -2
- package/src/components/base/tabs/tabs/examples/tabs.styles_only.example.vue +4 -4
- package/src/components/base/tabs/tabs/tabs.md +8 -8
- package/src/components/base/tabs/tabs/tabs.stories.js +42 -40
- package/src/components/mixins/button_mixin.js +2 -2
- package/src/utils/constants.js +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
# [32.20.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v32.19.1...v32.20.0) (2021-10-14)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* **Tabs:** Badge counter should use SR only ([4706ff0](https://gitlab.com/gitlab-org/gitlab-ui/commit/4706ff0fb1f6b550133d904868d19bc39d01ef45))
|
|
7
|
+
|
|
1
8
|
## [32.19.1](https://gitlab.com/gitlab-org/gitlab-ui/compare/v32.19.0...v32.19.1) (2021-10-11)
|
|
2
9
|
|
|
3
10
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { alertVariantOptions, alertVariantIconMap,
|
|
1
|
+
import { alertVariantOptions, alertVariantIconMap, buttonCategoryOptions } from '../../../utils/constants';
|
|
2
2
|
import CloseButton from '../../shared_components/close_button/close_button';
|
|
3
3
|
import GlButton from '../button/button';
|
|
4
4
|
import GlIcon from '../icon/icon';
|
|
@@ -106,7 +106,7 @@ var script = {
|
|
|
106
106
|
attrs: {
|
|
107
107
|
href: this.primaryButtonLink,
|
|
108
108
|
variant: 'confirm',
|
|
109
|
-
category:
|
|
109
|
+
category: buttonCategoryOptions.primary
|
|
110
110
|
},
|
|
111
111
|
listeners: {
|
|
112
112
|
click: this.primaryButtonClicked
|
|
@@ -116,7 +116,7 @@ var script = {
|
|
|
116
116
|
attrs: {
|
|
117
117
|
href: this.secondaryButtonLink,
|
|
118
118
|
variant: 'default',
|
|
119
|
-
category:
|
|
119
|
+
category: buttonCategoryOptions.secondary
|
|
120
120
|
},
|
|
121
121
|
listeners: {
|
|
122
122
|
click: this.secondaryButtonClicked
|
|
@@ -2,7 +2,23 @@ var description = "Buttons execute an action, either in the background or foregr
|
|
|
2
2
|
|
|
3
3
|
var button_documentation = {
|
|
4
4
|
description,
|
|
5
|
-
followsDesignSystem: true
|
|
5
|
+
followsDesignSystem: true,
|
|
6
|
+
bootstrapComponent: 'b-button',
|
|
7
|
+
bootstrapPropsInfo: {
|
|
8
|
+
category: {
|
|
9
|
+
enum: 'buttonCategoryOptions'
|
|
10
|
+
},
|
|
11
|
+
variant: {
|
|
12
|
+
enum: 'buttonVariantOptions'
|
|
13
|
+
},
|
|
14
|
+
size: {
|
|
15
|
+
enum: 'buttonSizeOptions'
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
events: [{
|
|
19
|
+
event: 'click',
|
|
20
|
+
description: 'Emitted when clicked on button'
|
|
21
|
+
}]
|
|
6
22
|
};
|
|
7
23
|
|
|
8
24
|
export default button_documentation;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BButton } from 'bootstrap-vue/esm/index.js';
|
|
2
|
-
import {
|
|
2
|
+
import { buttonCategoryOptions, buttonVariantOptions, buttonSizeOptions, buttonSizeOptionsMap } from '../../../utils/constants';
|
|
3
3
|
import { logWarning } from '../../../utils/utils';
|
|
4
4
|
import { SafeLinkMixin } from '../../mixins/safe_link_mixin';
|
|
5
5
|
import GlIcon from '../icon/icon';
|
|
@@ -17,20 +17,20 @@ var script = {
|
|
|
17
17
|
category: {
|
|
18
18
|
type: String,
|
|
19
19
|
required: false,
|
|
20
|
-
default:
|
|
21
|
-
validator: value => Object.keys(
|
|
20
|
+
default: buttonCategoryOptions.primary,
|
|
21
|
+
validator: value => Object.keys(buttonCategoryOptions).includes(value)
|
|
22
22
|
},
|
|
23
23
|
variant: {
|
|
24
24
|
type: String,
|
|
25
25
|
required: false,
|
|
26
|
-
default:
|
|
27
|
-
validator: value => Object.keys(
|
|
26
|
+
default: buttonVariantOptions.default,
|
|
27
|
+
validator: value => Object.keys(buttonVariantOptions).includes(value)
|
|
28
28
|
},
|
|
29
29
|
size: {
|
|
30
30
|
type: String,
|
|
31
31
|
required: false,
|
|
32
|
-
default:
|
|
33
|
-
validator: value => Object.keys(
|
|
32
|
+
default: buttonSizeOptions.medium,
|
|
33
|
+
validator: value => Object.keys(buttonSizeOptions).includes(value)
|
|
34
34
|
},
|
|
35
35
|
selected: {
|
|
36
36
|
type: Boolean,
|
|
@@ -78,9 +78,9 @@ var script = {
|
|
|
78
78
|
|
|
79
79
|
buttonClasses() {
|
|
80
80
|
const classes = ['gl-button'];
|
|
81
|
-
const nonCategoryVariants = [
|
|
81
|
+
const nonCategoryVariants = [buttonVariantOptions.dashed, buttonVariantOptions.link, buttonVariantOptions.reset];
|
|
82
82
|
|
|
83
|
-
if (!nonCategoryVariants.includes(this.variant) && this.category !==
|
|
83
|
+
if (!nonCategoryVariants.includes(this.variant) && this.category !== buttonCategoryOptions.primary) {
|
|
84
84
|
classes.push(`btn-${this.variant}-${this.category}`);
|
|
85
85
|
}
|
|
86
86
|
|
|
@@ -98,7 +98,7 @@ var script = {
|
|
|
98
98
|
},
|
|
99
99
|
|
|
100
100
|
buttonSize() {
|
|
101
|
-
return
|
|
101
|
+
return buttonSizeOptionsMap[this.size];
|
|
102
102
|
}
|
|
103
103
|
|
|
104
104
|
},
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BDropdown } from 'bootstrap-vue/esm/index.js';
|
|
2
2
|
import { selectAll, isVisible } from 'bootstrap-vue/esm/utils/dom';
|
|
3
|
-
import {
|
|
3
|
+
import { buttonCategoryOptions, newDropdownVariantOptions, buttonSizeOptions } from '../../../utils/constants';
|
|
4
4
|
import { ButtonMixin } from '../../mixins/button_mixin';
|
|
5
5
|
import GlButton from '../button/button';
|
|
6
6
|
import GlIcon from '../icon/icon';
|
|
@@ -93,8 +93,8 @@ var script = {
|
|
|
93
93
|
category: {
|
|
94
94
|
type: String,
|
|
95
95
|
required: false,
|
|
96
|
-
default:
|
|
97
|
-
validator: value => Object.keys(
|
|
96
|
+
default: buttonCategoryOptions.primary,
|
|
97
|
+
validator: value => Object.keys(buttonCategoryOptions).includes(value)
|
|
98
98
|
},
|
|
99
99
|
variant: {
|
|
100
100
|
type: String,
|
|
@@ -105,8 +105,8 @@ var script = {
|
|
|
105
105
|
size: {
|
|
106
106
|
type: String,
|
|
107
107
|
required: false,
|
|
108
|
-
default:
|
|
109
|
-
validator: value => Object.keys(
|
|
108
|
+
default: buttonSizeOptions.medium,
|
|
109
|
+
validator: value => Object.keys(buttonSizeOptions).includes(value)
|
|
110
110
|
},
|
|
111
111
|
icon: {
|
|
112
112
|
type: String,
|
|
@@ -160,8 +160,8 @@ var script = {
|
|
|
160
160
|
return [this.toggleClass, {
|
|
161
161
|
'gl-button': true,
|
|
162
162
|
'gl-dropdown-toggle': true,
|
|
163
|
-
[`btn-${this.variant}-secondary`]: this.category ===
|
|
164
|
-
[`btn-${this.variant}-tertiary`]: this.category ===
|
|
163
|
+
[`btn-${this.variant}-secondary`]: this.category === buttonCategoryOptions.secondary || this.category === buttonCategoryOptions.tertiary && this.split,
|
|
164
|
+
[`btn-${this.variant}-tertiary`]: this.category === buttonCategoryOptions.tertiary && !this.split,
|
|
165
165
|
'dropdown-icon-only': this.isIconOnly,
|
|
166
166
|
'dropdown-icon-text': this.isIconWithText
|
|
167
167
|
}];
|
|
@@ -172,7 +172,7 @@ var script = {
|
|
|
172
172
|
'gl-button': true,
|
|
173
173
|
'split-content-button': Boolean(this.text),
|
|
174
174
|
'icon-split-content-button': Boolean(this.icon),
|
|
175
|
-
[`btn-${this.variant}-secondary`]: this.category ===
|
|
175
|
+
[`btn-${this.variant}-secondary`]: this.category === buttonCategoryOptions.secondary || this.category === buttonCategoryOptions.tertiary
|
|
176
176
|
}];
|
|
177
177
|
},
|
|
178
178
|
|
|
@@ -3,7 +3,7 @@ import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
|
|
|
3
3
|
/* script */
|
|
4
4
|
|
|
5
5
|
/* template */
|
|
6
|
-
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('gl-tabs',[_c('gl-tab',{attrs:{"title":"
|
|
6
|
+
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('gl-tabs',[_c('gl-tab',{attrs:{"title":"Tab 1"}},[_vm._v("Tab panel 1")]),_vm._v(" "),_c('gl-tab',{attrs:{"title":"Tab 2"}},[_vm._v("Tab panel 2")])],1)};
|
|
7
7
|
var __vue_staticRenderFns__ = [];
|
|
8
8
|
|
|
9
9
|
/* style */
|
|
@@ -3,7 +3,7 @@ import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
|
|
|
3
3
|
/* script */
|
|
4
4
|
|
|
5
5
|
/* template */
|
|
6
|
-
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('gl-tabs',[_c('gl-tab',{scopedSlots:_vm._u([{key:"title",fn:function(){return [_c('span',[_vm._v("
|
|
6
|
+
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('gl-tabs',[_c('gl-tab',{scopedSlots:_vm._u([{key:"title",fn:function(){return [_c('span',[_vm._v("Tab")]),_vm._v(" "),_c('gl-badge',{staticClass:"gl-tab-counter-badge",attrs:{"size":"sm"}},[_vm._v("500")]),_vm._v(" "),_c('span',{staticClass:"sr-only"},[_vm._v("items")])]},proxy:true}])},[_vm._v("\n Tab panel 1\n ")]),_vm._v(" "),_c('gl-tab',{scopedSlots:_vm._u([{key:"title",fn:function(){return [_c('span',[_vm._v("Tab")]),_vm._v(" "),_c('gl-badge',{staticClass:"gl-tab-counter-badge",attrs:{"size":"sm"}},[_vm._v("250")]),_vm._v(" "),_c('span',{staticClass:"sr-only"},[_vm._v("items")])]},proxy:true}])},[_vm._v("\n Tab panel 2\n ")]),_vm._v(" "),_c('gl-tab',{scopedSlots:_vm._u([{key:"title",fn:function(){return [_c('span',[_vm._v("Tab")]),_vm._v(" "),_c('gl-badge',{staticClass:"gl-tab-counter-badge",attrs:{"size":"sm"}},[_vm._v("250")]),_vm._v(" "),_c('span',{staticClass:"sr-only"},[_vm._v("items")])]},proxy:true}])},[_vm._v("\n Tab panel 3\n ")])],1)};
|
|
7
7
|
var __vue_staticRenderFns__ = [];
|
|
8
8
|
|
|
9
9
|
/* style */
|
|
@@ -3,7 +3,7 @@ import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
|
|
|
3
3
|
/* script */
|
|
4
4
|
|
|
5
5
|
/* template */
|
|
6
|
-
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('gl-tabs',[_c('gl-tab',{attrs:{"title":"
|
|
6
|
+
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('gl-tabs',[_c('gl-tab',{attrs:{"title":"Tab 1"},scopedSlots:_vm._u([{key:"title",fn:function(){return [_c('i',[_vm._v("custom")]),_vm._v(" "),_c('strong',[_vm._v("Title")])]},proxy:true}])},[_vm._v("\n Tab panel 1\n ")]),_vm._v(" "),_c('gl-tab',{attrs:{"title":"Tab 2"}},[_vm._v("Tab panel 2")])],1)};
|
|
7
7
|
var __vue_staticRenderFns__ = [];
|
|
8
8
|
|
|
9
9
|
/* style */
|
|
@@ -3,7 +3,7 @@ import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
|
|
|
3
3
|
/* script */
|
|
4
4
|
|
|
5
5
|
/* template */
|
|
6
|
-
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('gl-tabs',[_c('gl-tab',{attrs:{"title":"
|
|
6
|
+
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('gl-tabs',[_c('gl-tab',{attrs:{"title":"Tab 1"}},[_vm._v("Tab panel 1")]),_vm._v(" "),_c('gl-tab',{attrs:{"title":"Tab 2"}},[_vm._v("Tab panel 2")]),_vm._v(" "),_c('gl-tab',{attrs:{"title":"Tab 3","disabled":""}},[_vm._v("Disabled tab panel")])],1)};
|
|
7
7
|
var __vue_staticRenderFns__ = [];
|
|
8
8
|
|
|
9
9
|
/* style */
|
|
@@ -3,7 +3,7 @@ import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
|
|
|
3
3
|
/* script */
|
|
4
4
|
|
|
5
5
|
/* template */
|
|
6
|
-
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('gl-tabs',{attrs:{"justified":""}},[_c('gl-tab',{attrs:{"title":"
|
|
6
|
+
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('gl-tabs',{attrs:{"justified":""}},[_c('gl-tab',{attrs:{"title":"Tab 1"}},[_vm._v("Tab panel 1")]),_vm._v(" "),_c('gl-tab',{attrs:{"title":"Tab 2"}},[_vm._v("Tab panel 2")])],1)};
|
|
7
7
|
var __vue_staticRenderFns__ = [];
|
|
8
8
|
|
|
9
9
|
/* style */
|
|
@@ -3,8 +3,8 @@ import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
|
|
|
3
3
|
var script = {
|
|
4
4
|
tabs: Array(20).fill(1).map((_, index) => index + 1).map(id => ({
|
|
5
5
|
id,
|
|
6
|
-
title: `
|
|
7
|
-
content: `
|
|
6
|
+
title: `Tab ${id}`,
|
|
7
|
+
content: `Tab panel ${id} content...`
|
|
8
8
|
}))
|
|
9
9
|
};
|
|
10
10
|
|
|
@@ -4,7 +4,7 @@ import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
|
|
|
4
4
|
|
|
5
5
|
/* template */
|
|
6
6
|
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;_vm._self._c||_h;return _vm._m(0)};
|
|
7
|
-
var __vue_staticRenderFns__ = [function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"tabs gl-tabs"},[_c('ul',{staticClass:"nav gl-tabs-nav",attrs:{"role":"tablist"}},[_c('li',{staticClass:"nav-item",attrs:{"role":"presentation"}},[_c('a',{staticClass:"nav-link gl-tab-nav-item gl-tab-nav-item-active gl-tab-nav-item-active-indigo",attrs:{"role":"tab","target":"_self","href":"#"}},[_vm._v("
|
|
7
|
+
var __vue_staticRenderFns__ = [function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"tabs gl-tabs"},[_c('ul',{staticClass:"nav gl-tabs-nav",attrs:{"role":"tablist"}},[_c('li',{staticClass:"nav-item",attrs:{"role":"presentation"}},[_c('a',{staticClass:"nav-link gl-tab-nav-item gl-tab-nav-item-active gl-tab-nav-item-active-indigo",attrs:{"role":"tab","target":"_self","href":"#"}},[_vm._v("Tab 1")])]),_vm._v(" "),_c('li',{staticClass:"nav-item",attrs:{"role":"presentation"}},[_c('a',{staticClass:"nav-link gl-tab-nav-item",attrs:{"role":"tab","target":"_self","href":"#"}},[_vm._v("Tab 2")])])]),_vm._v(" "),_c('div',{staticClass:"tab-content gl-tab-content"},[_c('div',{staticClass:"tab-pane active",attrs:{"role":"tabpanel"}},[_vm._v("Tab panel 1")]),_vm._v(" "),_c('div',{staticClass:"tab-pane",attrs:{"role":"tabpanel"}},[_vm._v("Tab panel 2")])])])}];
|
|
8
8
|
|
|
9
9
|
/* style */
|
|
10
10
|
const __vue_inject_styles__ = undefined;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import examples from './examples';
|
|
2
2
|
|
|
3
|
-
var description = "# Tabs\n\n<!-- STORY -->\n## Usage\n\nTabs are used to divide content into meaningful, related sections. Tabs allow users to focus on one\nspecific view at a time while maintaining sight of all the relevant content options available. Each\ntab, when active, will reveal it’s own unique content.\n\n## Using the component Vue\n\n~~~js\n<gl-tabs theme=\"indigo\">\n <gl-tab title=\"
|
|
3
|
+
var description = "# Tabs\n\n<!-- STORY -->\n## Usage\n\nTabs are used to divide content into meaningful, related sections. Tabs allow users to focus on one\nspecific view at a time while maintaining sight of all the relevant content options available. Each\ntab, when active, will reveal it’s own unique content.\n\n## Using the component Vue\n\n~~~js\n<gl-tabs theme=\"indigo\">\n <gl-tab title=\"Tab 1\">\n Tab panel 1\n </gl-tab>\n <gl-tab title=\"Tab 2\">\n Tab panel 2\n </gl-tab>\n</gl-tabs>\n~~~\n\n## Using the component HTML\n\n~~~js\n<div class=\"tabs gl-tabs\">\n <ul role=\"tablist\" class=\"nav gl-tabs-nav\">\n <li role=\"presentation\" class=\"nav-item\">\n <a\n role=\"tab\"\n target=\"_self\"\n href=\"#\"\n class=\"nav-link gl-tab-nav-item gl-tab-nav-item-active gl-tab-nav-item-active-indigo\"\n >Tab 1</a>\n </li>\n <li role=\"presentation\" class=\"nav-item\">\n <a role=\"tab\" target=\"_self\" href=\"#\" class=\"nav-link gl-tab-nav-item\">Tab 2</a>\n </li>\n </ul>\n <div class=\"tab-content gl-tab-content\">\n <div role=\"tabpanel\" class=\"tab-pane gl-tab-content active\">Tab panel 1</div>\n <div role=\"tabpanel\" class=\"tab-pane gl-tab-content\">Tab panel 2</div>\n </div>\n</div>\n~~~\n\n## Adding Action Buttons to the Tabs\n\nTabs start and end slot can be populated via props: `action-primary`, `action-secondary` and\n`action-tertiary`. These props allow you to handle how a primary, secondary and tertiary button will\nbehave and look. The props receive an object as such:\n\n~~~js\n{\n text: 'Save Changes',\n attributes: [\n { variant: 'info' },\n { disabled: this.someState },\n { class: 'some-class' },\n ...\n ]\n}\n~~~\n\n## Scrollable tab buttons\n\nBy default, `GlTab` will wrap tab buttons when they overflow the container. To\nenable horizontally scrolling for the tab buttons, use the `GlScrollableTabs`\ncomponent. This is a separate Vue component because of some limitations:\n\n- The action props (e.g., `action-primary`) are not respected in `GlScrollableTabs`. At the\n moment, BootstrapVue does not provide a reliable way for us to achieve this desired combination.\n\n`GlScrollableTabs` composes `GlTabs` and passes through every listener, slot, or prop (with the above\nexceptions).\n\n~~~html\n<gl-scrollable-tabs theme=\"indigo\">\n <gl-tab v-for=\"tab in tabs\" :key=\"tab.key\" :title=\"tab.title\"> {{ tab.content }} </gl-tab>\n</gl-scrollable-tabs>\n~~~\n";
|
|
4
4
|
|
|
5
5
|
var tabs_documentation = {
|
|
6
6
|
description,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { buttonSizeOptionsMap } from '../../utils/constants';
|
|
2
2
|
|
|
3
3
|
const ButtonMixin = {
|
|
4
4
|
computed: {
|
|
5
5
|
buttonSize() {
|
|
6
|
-
return
|
|
6
|
+
return buttonSizeOptionsMap[this.size];
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
}
|
package/dist/utils/constants.js
CHANGED
|
@@ -69,12 +69,12 @@ const formStateOptions = {
|
|
|
69
69
|
valid: true,
|
|
70
70
|
invalid: false
|
|
71
71
|
};
|
|
72
|
-
const
|
|
72
|
+
const buttonCategoryOptions = {
|
|
73
73
|
primary: 'primary',
|
|
74
74
|
secondary: 'secondary',
|
|
75
75
|
tertiary: 'tertiary'
|
|
76
76
|
};
|
|
77
|
-
const
|
|
77
|
+
const buttonVariantOptions = {
|
|
78
78
|
default: 'default',
|
|
79
79
|
confirm: 'confirm',
|
|
80
80
|
info: 'info (deprecated)',
|
|
@@ -93,9 +93,9 @@ const newButtonVariantOptions = {
|
|
|
93
93
|
reset: 'gl-reset'
|
|
94
94
|
};
|
|
95
95
|
const badgeForButtonOptions = {
|
|
96
|
-
[
|
|
97
|
-
[
|
|
98
|
-
[
|
|
96
|
+
[buttonVariantOptions.default]: badgeVariantOptions.neutral,
|
|
97
|
+
[buttonVariantOptions.confirm]: badgeVariantOptions.info,
|
|
98
|
+
[buttonVariantOptions.danger]: badgeVariantOptions.danger
|
|
99
99
|
};
|
|
100
100
|
const newDropdownVariantOptions = {
|
|
101
101
|
default: 'default',
|
|
@@ -106,11 +106,11 @@ const newDropdownVariantOptions = {
|
|
|
106
106
|
danger: 'danger',
|
|
107
107
|
link: 'link'
|
|
108
108
|
};
|
|
109
|
-
const
|
|
109
|
+
const buttonSizeOptions = {
|
|
110
110
|
small: 'small',
|
|
111
111
|
medium: 'medium'
|
|
112
112
|
};
|
|
113
|
-
const
|
|
113
|
+
const buttonSizeOptionsMap = {
|
|
114
114
|
small: 'sm',
|
|
115
115
|
medium: 'md'
|
|
116
116
|
}; // size options all have corresponding styles (e.g. .s12 defined in icon.scss)
|
|
@@ -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, 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, focusableTags, formInputSizes, formStateOptions, glThemes, iconSizeOptions, keyboard, labelColorOptions, labelSizeOptions, loadingIconSizes, maxZIndex, modalButtonDefaults, modalSizeOptions, newDropdownVariantOptions, popoverPlacements, resizeDebounceTime, sizeOptions, sizeOptionsWithNoDefault, tabsButtonDefaults, targetOptions, toggleLabelPosition, tokenVariants, tooltipActionEvents, tooltipDelay, tooltipPlacements, triggerVariantOptions, truncateOptions, variantCssColorMap, variantOptions, variantOptionsWithNoDefault, viewModeOptions };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gitlab/ui",
|
|
3
|
-
"version": "32.
|
|
3
|
+
"version": "32.20.0",
|
|
4
4
|
"description": "GitLab UI Components",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -88,15 +88,15 @@
|
|
|
88
88
|
"@rollup/plugin-commonjs": "^11.1.0",
|
|
89
89
|
"@rollup/plugin-node-resolve": "^7.1.3",
|
|
90
90
|
"@rollup/plugin-replace": "^2.3.2",
|
|
91
|
-
"@storybook/addon-a11y": "6.3.
|
|
92
|
-
"@storybook/addon-docs": "6.3.
|
|
93
|
-
"@storybook/addon-essentials": "6.3.
|
|
91
|
+
"@storybook/addon-a11y": "6.3.12",
|
|
92
|
+
"@storybook/addon-docs": "6.3.12",
|
|
93
|
+
"@storybook/addon-essentials": "6.3.12",
|
|
94
94
|
"@storybook/addon-knobs": "6.3.1",
|
|
95
|
-
"@storybook/addon-storyshots": "6.3.
|
|
96
|
-
"@storybook/addon-storyshots-puppeteer": "6.3.
|
|
97
|
-
"@storybook/addon-viewport": "6.3.
|
|
98
|
-
"@storybook/theming": "6.3.
|
|
99
|
-
"@storybook/vue": "6.3.
|
|
95
|
+
"@storybook/addon-storyshots": "6.3.12",
|
|
96
|
+
"@storybook/addon-storyshots-puppeteer": "6.3.12",
|
|
97
|
+
"@storybook/addon-viewport": "6.3.12",
|
|
98
|
+
"@storybook/theming": "6.3.12",
|
|
99
|
+
"@storybook/vue": "6.3.12",
|
|
100
100
|
"@vue/test-utils": "1.1.3",
|
|
101
101
|
"autoprefixer": "^9.7.6",
|
|
102
102
|
"babel-jest": "^26.6.3",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { shallowMount } from '@vue/test-utils';
|
|
2
|
-
import {
|
|
2
|
+
import { buttonCategoryOptions } from '../../../utils/constants';
|
|
3
3
|
import GlAlert from './alert.vue';
|
|
4
4
|
|
|
5
5
|
const DummyComponent = {
|
|
@@ -89,7 +89,7 @@ describe('Alert component', () => {
|
|
|
89
89
|
|
|
90
90
|
const props = button.props();
|
|
91
91
|
expect('href' in props).toBe(false);
|
|
92
|
-
expect(props.category).toEqual(
|
|
92
|
+
expect(props.category).toEqual(buttonCategoryOptions.primary);
|
|
93
93
|
});
|
|
94
94
|
|
|
95
95
|
it('emits a primaryAction event when primary button is clicked', () => {
|
|
@@ -126,7 +126,7 @@ describe('Alert component', () => {
|
|
|
126
126
|
|
|
127
127
|
const attrs = button.attributes();
|
|
128
128
|
expect('href' in attrs).toBe(false);
|
|
129
|
-
expect(attrs.category).toEqual(
|
|
129
|
+
expect(attrs.category).toEqual(buttonCategoryOptions.secondary);
|
|
130
130
|
});
|
|
131
131
|
|
|
132
132
|
it('emits a secondaryAction event when secondary button is clicked', () => {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import {
|
|
3
3
|
alertVariantOptions,
|
|
4
4
|
alertVariantIconMap,
|
|
5
|
-
|
|
5
|
+
buttonCategoryOptions,
|
|
6
6
|
} from '../../../utils/constants';
|
|
7
7
|
import CloseButton from '../../shared_components/close_button/close_button.vue';
|
|
8
8
|
import GlButton from '../button/button.vue';
|
|
@@ -102,7 +102,7 @@ export default {
|
|
|
102
102
|
attrs: {
|
|
103
103
|
href: this.primaryButtonLink,
|
|
104
104
|
variant: 'confirm',
|
|
105
|
-
category:
|
|
105
|
+
category: buttonCategoryOptions.primary,
|
|
106
106
|
},
|
|
107
107
|
listeners: {
|
|
108
108
|
click: this.primaryButtonClicked,
|
|
@@ -113,7 +113,7 @@ export default {
|
|
|
113
113
|
attrs: {
|
|
114
114
|
href: this.secondaryButtonLink,
|
|
115
115
|
variant: 'default',
|
|
116
|
-
category:
|
|
116
|
+
category: buttonCategoryOptions.secondary,
|
|
117
117
|
},
|
|
118
118
|
listeners: {
|
|
119
119
|
click: this.secondaryButtonClicked,
|
|
@@ -3,4 +3,22 @@ import description from './button.md';
|
|
|
3
3
|
export default {
|
|
4
4
|
description,
|
|
5
5
|
followsDesignSystem: true,
|
|
6
|
+
bootstrapComponent: 'b-button',
|
|
7
|
+
bootstrapPropsInfo: {
|
|
8
|
+
category: {
|
|
9
|
+
enum: 'buttonCategoryOptions',
|
|
10
|
+
},
|
|
11
|
+
variant: {
|
|
12
|
+
enum: 'buttonVariantOptions',
|
|
13
|
+
},
|
|
14
|
+
size: {
|
|
15
|
+
enum: 'buttonSizeOptions',
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
events: [
|
|
19
|
+
{
|
|
20
|
+
event: 'click',
|
|
21
|
+
description: 'Emitted when clicked on button',
|
|
22
|
+
},
|
|
23
|
+
],
|
|
6
24
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { GlButton } from '../../../../index';
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
newButtonSizeOptions,
|
|
3
|
+
buttonCategoryOptions,
|
|
4
|
+
buttonVariantOptions,
|
|
6
5
|
badgeForButtonOptions,
|
|
6
|
+
buttonSizeOptions,
|
|
7
7
|
targetOptions,
|
|
8
8
|
} from '../../../utils/constants';
|
|
9
9
|
import readme from './button.md';
|
|
@@ -105,8 +105,8 @@ export const IconButton = (args, { argTypes }) => ({
|
|
|
105
105
|
`,
|
|
106
106
|
});
|
|
107
107
|
IconButton.args = generateProps({
|
|
108
|
-
category:
|
|
109
|
-
variant:
|
|
108
|
+
category: buttonCategoryOptions.primary,
|
|
109
|
+
variant: buttonVariantOptions.danger,
|
|
110
110
|
});
|
|
111
111
|
|
|
112
112
|
export const DropdownButton = (args, { argTypes }) => ({
|
|
@@ -186,7 +186,7 @@ export const DropdownIconOnlyButton = (args, { argTypes }) => ({
|
|
|
186
186
|
`),
|
|
187
187
|
});
|
|
188
188
|
DropdownIconOnlyButton.args = generateProps({
|
|
189
|
-
category:
|
|
189
|
+
category: buttonCategoryOptions.tertiary,
|
|
190
190
|
});
|
|
191
191
|
|
|
192
192
|
export const DropdownSplitButton = (args, { argTypes }) => ({
|
|
@@ -356,10 +356,10 @@ LabelButton.parameters = { controls: { disable: true } };
|
|
|
356
356
|
export const AllVariantsAndCategories = (args, { argTypes = {} }) => ({
|
|
357
357
|
props: Object.keys(argTypes),
|
|
358
358
|
components,
|
|
359
|
-
variants: Object.keys(
|
|
360
|
-
(variant) => !
|
|
359
|
+
variants: Object.keys(buttonVariantOptions).filter(
|
|
360
|
+
(variant) => !buttonVariantOptions[variant].includes('deprecated')
|
|
361
361
|
),
|
|
362
|
-
categories:
|
|
362
|
+
categories: buttonCategoryOptions,
|
|
363
363
|
style: {
|
|
364
364
|
display: 'grid',
|
|
365
365
|
gridTemplateColumns: 'repeat(3, 150px)',
|
|
@@ -453,7 +453,7 @@ export const Badges = (args, { argTypes = {} }) => ({
|
|
|
453
453
|
props: Object.keys(argTypes),
|
|
454
454
|
components,
|
|
455
455
|
variants: Object.keys(badgeForButtonOptions),
|
|
456
|
-
categories:
|
|
456
|
+
categories: buttonCategoryOptions,
|
|
457
457
|
style: {
|
|
458
458
|
display: 'grid',
|
|
459
459
|
gridTemplateColumns: 'repeat(3, 200px)',
|
|
@@ -513,19 +513,19 @@ export default {
|
|
|
513
513
|
category: {
|
|
514
514
|
control: {
|
|
515
515
|
type: 'select',
|
|
516
|
-
options:
|
|
516
|
+
options: buttonCategoryOptions,
|
|
517
517
|
},
|
|
518
518
|
},
|
|
519
519
|
variant: {
|
|
520
520
|
control: {
|
|
521
521
|
type: 'select',
|
|
522
|
-
options:
|
|
522
|
+
options: buttonVariantOptions,
|
|
523
523
|
},
|
|
524
524
|
},
|
|
525
525
|
size: {
|
|
526
526
|
control: {
|
|
527
527
|
type: 'select',
|
|
528
|
-
options:
|
|
528
|
+
options: buttonSizeOptions,
|
|
529
529
|
},
|
|
530
530
|
},
|
|
531
531
|
target: {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
<script>
|
|
2
2
|
import { BButton } from 'bootstrap-vue';
|
|
3
3
|
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
buttonCategoryOptions,
|
|
5
|
+
buttonVariantOptions,
|
|
6
|
+
buttonSizeOptions,
|
|
7
|
+
buttonSizeOptionsMap,
|
|
8
8
|
} from '../../../utils/constants';
|
|
9
9
|
import { logWarning } from '../../../utils/utils';
|
|
10
10
|
import { SafeLinkMixin } from '../../mixins/safe_link_mixin';
|
|
@@ -22,20 +22,20 @@ export default {
|
|
|
22
22
|
category: {
|
|
23
23
|
type: String,
|
|
24
24
|
required: false,
|
|
25
|
-
default:
|
|
26
|
-
validator: (value) => Object.keys(
|
|
25
|
+
default: buttonCategoryOptions.primary,
|
|
26
|
+
validator: (value) => Object.keys(buttonCategoryOptions).includes(value),
|
|
27
27
|
},
|
|
28
28
|
variant: {
|
|
29
29
|
type: String,
|
|
30
30
|
required: false,
|
|
31
|
-
default:
|
|
32
|
-
validator: (value) => Object.keys(
|
|
31
|
+
default: buttonVariantOptions.default,
|
|
32
|
+
validator: (value) => Object.keys(buttonVariantOptions).includes(value),
|
|
33
33
|
},
|
|
34
34
|
size: {
|
|
35
35
|
type: String,
|
|
36
36
|
required: false,
|
|
37
|
-
default:
|
|
38
|
-
validator: (value) => Object.keys(
|
|
37
|
+
default: buttonSizeOptions.medium,
|
|
38
|
+
validator: (value) => Object.keys(buttonSizeOptions).includes(value),
|
|
39
39
|
},
|
|
40
40
|
selected: {
|
|
41
41
|
type: Boolean,
|
|
@@ -81,14 +81,14 @@ export default {
|
|
|
81
81
|
buttonClasses() {
|
|
82
82
|
const classes = ['gl-button'];
|
|
83
83
|
const nonCategoryVariants = [
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
84
|
+
buttonVariantOptions.dashed,
|
|
85
|
+
buttonVariantOptions.link,
|
|
86
|
+
buttonVariantOptions.reset,
|
|
87
87
|
];
|
|
88
88
|
|
|
89
89
|
if (
|
|
90
90
|
!nonCategoryVariants.includes(this.variant) &&
|
|
91
|
-
this.category !==
|
|
91
|
+
this.category !== buttonCategoryOptions.primary
|
|
92
92
|
) {
|
|
93
93
|
classes.push(`btn-${this.variant}-${this.category}`);
|
|
94
94
|
}
|
|
@@ -106,7 +106,7 @@ export default {
|
|
|
106
106
|
return classes;
|
|
107
107
|
},
|
|
108
108
|
buttonSize() {
|
|
109
|
-
return
|
|
109
|
+
return buttonSizeOptionsMap[this.size];
|
|
110
110
|
},
|
|
111
111
|
},
|
|
112
112
|
mounted() {
|
|
@@ -11,9 +11,9 @@ import {
|
|
|
11
11
|
GlDropdownForm,
|
|
12
12
|
} from '../../../../index';
|
|
13
13
|
import {
|
|
14
|
-
|
|
14
|
+
buttonCategoryOptions,
|
|
15
15
|
newDropdownVariantOptions,
|
|
16
|
-
|
|
16
|
+
buttonSizeOptions,
|
|
17
17
|
} from '../../../utils/constants';
|
|
18
18
|
import readme from './dropdown.md';
|
|
19
19
|
|
|
@@ -53,7 +53,7 @@ function generateProps({
|
|
|
53
53
|
const props = {
|
|
54
54
|
category: {
|
|
55
55
|
type: String,
|
|
56
|
-
default: select('category',
|
|
56
|
+
default: select('category', buttonCategoryOptions, category),
|
|
57
57
|
},
|
|
58
58
|
variant: {
|
|
59
59
|
type: String,
|
|
@@ -61,7 +61,7 @@ function generateProps({
|
|
|
61
61
|
},
|
|
62
62
|
size: {
|
|
63
63
|
type: String,
|
|
64
|
-
default: select('size',
|
|
64
|
+
default: select('size', buttonSizeOptions, size),
|
|
65
65
|
},
|
|
66
66
|
block: {
|
|
67
67
|
type: Boolean,
|
|
@@ -196,7 +196,7 @@ documentedStoriesOf('base/dropdown', readme)
|
|
|
196
196
|
.add('secondary', () => ({
|
|
197
197
|
props: generateProps({
|
|
198
198
|
text: 'Some dropdown',
|
|
199
|
-
category:
|
|
199
|
+
category: buttonCategoryOptions.secondary,
|
|
200
200
|
variant: newDropdownVariantOptions.confirm,
|
|
201
201
|
}),
|
|
202
202
|
components,
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
import { BDropdown } from 'bootstrap-vue';
|
|
3
3
|
import { isVisible, selectAll } from 'bootstrap-vue/src/utils/dom';
|
|
4
4
|
import {
|
|
5
|
-
|
|
5
|
+
buttonCategoryOptions,
|
|
6
6
|
newDropdownVariantOptions,
|
|
7
|
-
|
|
7
|
+
buttonSizeOptions,
|
|
8
8
|
} from '../../../utils/constants';
|
|
9
9
|
import { ButtonMixin } from '../../mixins/button_mixin';
|
|
10
10
|
import GlButton from '../button/button.vue';
|
|
@@ -100,8 +100,8 @@ export default {
|
|
|
100
100
|
category: {
|
|
101
101
|
type: String,
|
|
102
102
|
required: false,
|
|
103
|
-
default:
|
|
104
|
-
validator: (value) => Object.keys(
|
|
103
|
+
default: buttonCategoryOptions.primary,
|
|
104
|
+
validator: (value) => Object.keys(buttonCategoryOptions).includes(value),
|
|
105
105
|
},
|
|
106
106
|
variant: {
|
|
107
107
|
type: String,
|
|
@@ -112,8 +112,8 @@ export default {
|
|
|
112
112
|
size: {
|
|
113
113
|
type: String,
|
|
114
114
|
required: false,
|
|
115
|
-
default:
|
|
116
|
-
validator: (value) => Object.keys(
|
|
115
|
+
default: buttonSizeOptions.medium,
|
|
116
|
+
validator: (value) => Object.keys(buttonSizeOptions).includes(value),
|
|
117
117
|
},
|
|
118
118
|
icon: {
|
|
119
119
|
type: String,
|
|
@@ -163,10 +163,10 @@ export default {
|
|
|
163
163
|
'gl-button': true,
|
|
164
164
|
'gl-dropdown-toggle': true,
|
|
165
165
|
[`btn-${this.variant}-secondary`]:
|
|
166
|
-
this.category ===
|
|
167
|
-
(this.category ===
|
|
166
|
+
this.category === buttonCategoryOptions.secondary ||
|
|
167
|
+
(this.category === buttonCategoryOptions.tertiary && this.split),
|
|
168
168
|
[`btn-${this.variant}-tertiary`]:
|
|
169
|
-
this.category ===
|
|
169
|
+
this.category === buttonCategoryOptions.tertiary && !this.split,
|
|
170
170
|
'dropdown-icon-only': this.isIconOnly,
|
|
171
171
|
'dropdown-icon-text': this.isIconWithText,
|
|
172
172
|
},
|
|
@@ -180,8 +180,8 @@ export default {
|
|
|
180
180
|
'split-content-button': Boolean(this.text),
|
|
181
181
|
'icon-split-content-button': Boolean(this.icon),
|
|
182
182
|
[`btn-${this.variant}-secondary`]:
|
|
183
|
-
this.category ===
|
|
184
|
-
this.category ===
|
|
183
|
+
this.category === buttonCategoryOptions.secondary ||
|
|
184
|
+
this.category === buttonCategoryOptions.tertiary,
|
|
185
185
|
},
|
|
186
186
|
];
|
|
187
187
|
},
|
|
@@ -2,24 +2,27 @@
|
|
|
2
2
|
<gl-tabs>
|
|
3
3
|
<gl-tab>
|
|
4
4
|
<template #title>
|
|
5
|
-
<span>
|
|
5
|
+
<span>Tab</span>
|
|
6
6
|
<gl-badge size="sm" class="gl-tab-counter-badge">500</gl-badge>
|
|
7
|
+
<span class="sr-only">items</span>
|
|
7
8
|
</template>
|
|
8
|
-
|
|
9
|
+
Tab panel 1
|
|
9
10
|
</gl-tab>
|
|
10
11
|
<gl-tab>
|
|
11
12
|
<template #title>
|
|
12
|
-
<span>
|
|
13
|
+
<span>Tab</span>
|
|
13
14
|
<gl-badge size="sm" class="gl-tab-counter-badge">250</gl-badge>
|
|
15
|
+
<span class="sr-only">items</span>
|
|
14
16
|
</template>
|
|
15
|
-
|
|
17
|
+
Tab panel 2
|
|
16
18
|
</gl-tab>
|
|
17
19
|
<gl-tab>
|
|
18
20
|
<template #title>
|
|
19
|
-
<span>
|
|
21
|
+
<span>Tab</span>
|
|
20
22
|
<gl-badge size="sm" class="gl-tab-counter-badge">250</gl-badge>
|
|
23
|
+
<span class="sr-only">items</span>
|
|
21
24
|
</template>
|
|
22
|
-
|
|
25
|
+
Tab panel 3
|
|
23
26
|
</gl-tab>
|
|
24
27
|
</gl-tabs>
|
|
25
28
|
</template>
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<gl-tabs>
|
|
3
|
-
<gl-tab title="
|
|
3
|
+
<gl-tab title="Tab 1">
|
|
4
4
|
<template #title><i>custom</i> <strong>Title</strong></template>
|
|
5
|
-
|
|
5
|
+
Tab panel 1
|
|
6
6
|
</gl-tab>
|
|
7
|
-
<gl-tab title="
|
|
7
|
+
<gl-tab title="Tab 2">Tab panel 2</gl-tab>
|
|
8
8
|
</gl-tabs>
|
|
9
9
|
</template>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<gl-tabs>
|
|
3
|
-
<gl-tab title="
|
|
4
|
-
<gl-tab title="
|
|
5
|
-
<gl-tab title="
|
|
3
|
+
<gl-tab title="Tab 1">Tab panel 1</gl-tab>
|
|
4
|
+
<gl-tab title="Tab 2">Tab panel 2</gl-tab>
|
|
5
|
+
<gl-tab title="Tab 3" disabled>Disabled tab panel</gl-tab>
|
|
6
6
|
</gl-tabs>
|
|
7
7
|
</template>
|
|
@@ -7,16 +7,16 @@
|
|
|
7
7
|
target="_self"
|
|
8
8
|
href="#"
|
|
9
9
|
class="nav-link gl-tab-nav-item gl-tab-nav-item-active gl-tab-nav-item-active-indigo"
|
|
10
|
-
>
|
|
10
|
+
>Tab 1</a
|
|
11
11
|
>
|
|
12
12
|
</li>
|
|
13
13
|
<li role="presentation" class="nav-item">
|
|
14
|
-
<a role="tab" target="_self" href="#" class="nav-link gl-tab-nav-item">
|
|
14
|
+
<a role="tab" target="_self" href="#" class="nav-link gl-tab-nav-item">Tab 2</a>
|
|
15
15
|
</li>
|
|
16
16
|
</ul>
|
|
17
17
|
<div class="tab-content gl-tab-content">
|
|
18
|
-
<div role="tabpanel" class="tab-pane active">
|
|
19
|
-
<div role="tabpanel" class="tab-pane">
|
|
18
|
+
<div role="tabpanel" class="tab-pane active">Tab panel 1</div>
|
|
19
|
+
<div role="tabpanel" class="tab-pane">Tab panel 2</div>
|
|
20
20
|
</div>
|
|
21
21
|
</div>
|
|
22
22
|
</template>
|
|
@@ -11,11 +11,11 @@ tab, when active, will reveal it’s own unique content.
|
|
|
11
11
|
|
|
12
12
|
~~~js
|
|
13
13
|
<gl-tabs theme="indigo">
|
|
14
|
-
<gl-tab title="
|
|
15
|
-
|
|
14
|
+
<gl-tab title="Tab 1">
|
|
15
|
+
Tab panel 1
|
|
16
16
|
</gl-tab>
|
|
17
|
-
<gl-tab title="
|
|
18
|
-
|
|
17
|
+
<gl-tab title="Tab 2">
|
|
18
|
+
Tab panel 2
|
|
19
19
|
</gl-tab>
|
|
20
20
|
</gl-tabs>
|
|
21
21
|
~~~
|
|
@@ -31,15 +31,15 @@ tab, when active, will reveal it’s own unique content.
|
|
|
31
31
|
target="_self"
|
|
32
32
|
href="#"
|
|
33
33
|
class="nav-link gl-tab-nav-item gl-tab-nav-item-active gl-tab-nav-item-active-indigo"
|
|
34
|
-
>
|
|
34
|
+
>Tab 1</a>
|
|
35
35
|
</li>
|
|
36
36
|
<li role="presentation" class="nav-item">
|
|
37
|
-
<a role="tab" target="_self" href="#" class="nav-link gl-tab-nav-item">
|
|
37
|
+
<a role="tab" target="_self" href="#" class="nav-link gl-tab-nav-item">Tab 2</a>
|
|
38
38
|
</li>
|
|
39
39
|
</ul>
|
|
40
40
|
<div class="tab-content gl-tab-content">
|
|
41
|
-
<div role="tabpanel" class="tab-pane gl-tab-content active">
|
|
42
|
-
<div role="tabpanel" class="tab-pane gl-tab-content">
|
|
41
|
+
<div role="tabpanel" class="tab-pane gl-tab-content active">Tab panel 1</div>
|
|
42
|
+
<div role="tabpanel" class="tab-pane gl-tab-content">Tab panel 2</div>
|
|
43
43
|
</div>
|
|
44
44
|
</div>
|
|
45
45
|
~~~
|
|
@@ -19,8 +19,8 @@ const ScrollableTabsGenerator = {
|
|
|
19
19
|
computed: {
|
|
20
20
|
tabs() {
|
|
21
21
|
return range(this.count).map((i) => ({
|
|
22
|
-
title: `
|
|
23
|
-
content: `
|
|
22
|
+
title: `Tab ${i + 1}`,
|
|
23
|
+
content: `Tab panel ${i + 1} content...`,
|
|
24
24
|
}));
|
|
25
25
|
},
|
|
26
26
|
},
|
|
@@ -56,47 +56,47 @@ documentedStoriesOf('base/tabs/tabs', docs)
|
|
|
56
56
|
...createBaseStory(),
|
|
57
57
|
template: `
|
|
58
58
|
<gl-tabs :theme="theme" :sync-active-tab-with-query-params="syncActiveTabWithQueryParams">
|
|
59
|
-
<gl-tab title="
|
|
60
|
-
|
|
59
|
+
<gl-tab title="Tab 1">
|
|
60
|
+
Tab panel 1
|
|
61
61
|
</gl-tab>
|
|
62
|
-
<gl-tab title="
|
|
63
|
-
|
|
62
|
+
<gl-tab title="Tab 2">
|
|
63
|
+
Tab panel 2
|
|
64
64
|
</gl-tab>
|
|
65
|
-
<gl-tab title="
|
|
66
|
-
|
|
65
|
+
<gl-tab title="Tab 3">
|
|
66
|
+
Tab panel 3
|
|
67
67
|
</gl-tab>
|
|
68
|
-
<gl-tab title="
|
|
69
|
-
|
|
68
|
+
<gl-tab title="Tab 4">
|
|
69
|
+
Tab panel 4
|
|
70
70
|
</gl-tab>
|
|
71
|
-
<gl-tab title="
|
|
72
|
-
|
|
71
|
+
<gl-tab title="Tab 5">
|
|
72
|
+
Tab panel 5
|
|
73
73
|
</gl-tab>
|
|
74
|
-
<gl-tab title="
|
|
75
|
-
|
|
74
|
+
<gl-tab title="Tab 6">
|
|
75
|
+
Tab panel 6
|
|
76
76
|
</gl-tab>
|
|
77
|
-
<gl-tab title="
|
|
78
|
-
|
|
77
|
+
<gl-tab title="Tab 7">
|
|
78
|
+
Tab panel 7
|
|
79
79
|
</gl-tab>
|
|
80
|
-
<gl-tab title="
|
|
81
|
-
|
|
80
|
+
<gl-tab title="Tab 8">
|
|
81
|
+
Tab panel 8
|
|
82
82
|
</gl-tab>
|
|
83
|
-
<gl-tab title="
|
|
84
|
-
|
|
83
|
+
<gl-tab title="Tab 9">
|
|
84
|
+
Tab panel 9
|
|
85
85
|
</gl-tab>
|
|
86
|
-
<gl-tab title="
|
|
87
|
-
|
|
86
|
+
<gl-tab title="Tab 10">
|
|
87
|
+
Tab panel 10
|
|
88
88
|
</gl-tab>
|
|
89
|
-
<gl-tab title="
|
|
90
|
-
|
|
89
|
+
<gl-tab title="Tab 11">
|
|
90
|
+
Tab panel 11
|
|
91
91
|
</gl-tab>
|
|
92
|
-
<gl-tab title="
|
|
93
|
-
|
|
92
|
+
<gl-tab title="Tab 12">
|
|
93
|
+
Tab panel 12
|
|
94
94
|
</gl-tab>
|
|
95
|
-
<gl-tab title="
|
|
96
|
-
|
|
95
|
+
<gl-tab title="Tab 13" query-param-value="thirteenth">
|
|
96
|
+
Tab panel 13
|
|
97
97
|
</gl-tab>
|
|
98
|
-
<gl-tab title="
|
|
99
|
-
|
|
98
|
+
<gl-tab title="Tab 14">
|
|
99
|
+
Tab panel 14
|
|
100
100
|
</gl-tab>
|
|
101
101
|
</gl-tabs>
|
|
102
102
|
`,
|
|
@@ -134,11 +134,11 @@ documentedStoriesOf('base/tabs/tabs', docs)
|
|
|
134
134
|
...createBaseStory(),
|
|
135
135
|
template: `
|
|
136
136
|
<gl-tabs :theme="theme" justified>
|
|
137
|
-
<gl-tab title="
|
|
138
|
-
<p>
|
|
137
|
+
<gl-tab title="Tab 1">
|
|
138
|
+
<p>Tab panel 1</p>
|
|
139
139
|
</gl-tab>
|
|
140
|
-
<gl-tab title="
|
|
141
|
-
<p>
|
|
140
|
+
<gl-tab title="Tab 2">
|
|
141
|
+
<p>Tab panel 2</p>
|
|
142
142
|
</gl-tab>
|
|
143
143
|
</gl-tabs>
|
|
144
144
|
`,
|
|
@@ -149,23 +149,25 @@ documentedStoriesOf('base/tabs/tabs', docs)
|
|
|
149
149
|
<gl-tabs>
|
|
150
150
|
<gl-tab>
|
|
151
151
|
<template #title>
|
|
152
|
-
<span>
|
|
152
|
+
<span>Tab</span>
|
|
153
153
|
<gl-badge size="sm" class="gl-tab-counter-badge">500</gl-badge>
|
|
154
|
+
<span class="sr-only">items</span>
|
|
154
155
|
</template>
|
|
155
|
-
|
|
156
|
+
Tab panel 1
|
|
156
157
|
</gl-tab>
|
|
157
158
|
<gl-tab>
|
|
158
159
|
<template #title>
|
|
159
|
-
<span>
|
|
160
|
+
<span>Tab</span>
|
|
160
161
|
<gl-badge size="sm" class="gl-tab-counter-badge">250</gl-badge>
|
|
162
|
+
<span class="sr-only">items</span>
|
|
161
163
|
</template>
|
|
162
|
-
|
|
164
|
+
Tab panel 2
|
|
163
165
|
</gl-tab>
|
|
164
166
|
<gl-tab>
|
|
165
167
|
<template #title>
|
|
166
|
-
<span>
|
|
168
|
+
<span>Tab</span>
|
|
167
169
|
</template>
|
|
168
|
-
|
|
170
|
+
Tab panel 3
|
|
169
171
|
</gl-tab>
|
|
170
172
|
</gl-tabs>
|
|
171
173
|
`,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { buttonSizeOptionsMap } from '../../utils/constants';
|
|
2
2
|
|
|
3
3
|
export const ButtonMixin = {
|
|
4
4
|
computed: {
|
|
5
5
|
buttonSize() {
|
|
6
|
-
return
|
|
6
|
+
return buttonSizeOptionsMap[this.size];
|
|
7
7
|
},
|
|
8
8
|
},
|
|
9
9
|
};
|
package/src/utils/constants.js
CHANGED
|
@@ -85,13 +85,13 @@ export const formStateOptions = {
|
|
|
85
85
|
invalid: false,
|
|
86
86
|
};
|
|
87
87
|
|
|
88
|
-
export const
|
|
88
|
+
export const buttonCategoryOptions = {
|
|
89
89
|
primary: 'primary',
|
|
90
90
|
secondary: 'secondary',
|
|
91
91
|
tertiary: 'tertiary',
|
|
92
92
|
};
|
|
93
93
|
|
|
94
|
-
export const
|
|
94
|
+
export const buttonVariantOptions = {
|
|
95
95
|
default: 'default',
|
|
96
96
|
confirm: 'confirm',
|
|
97
97
|
info: 'info (deprecated)',
|
|
@@ -110,9 +110,9 @@ export const newButtonVariantOptions = {
|
|
|
110
110
|
};
|
|
111
111
|
|
|
112
112
|
export const badgeForButtonOptions = {
|
|
113
|
-
[
|
|
114
|
-
[
|
|
115
|
-
[
|
|
113
|
+
[buttonVariantOptions.default]: badgeVariantOptions.neutral,
|
|
114
|
+
[buttonVariantOptions.confirm]: badgeVariantOptions.info,
|
|
115
|
+
[buttonVariantOptions.danger]: badgeVariantOptions.danger,
|
|
116
116
|
};
|
|
117
117
|
|
|
118
118
|
export const newDropdownVariantOptions = {
|
|
@@ -125,12 +125,12 @@ export const newDropdownVariantOptions = {
|
|
|
125
125
|
link: 'link',
|
|
126
126
|
};
|
|
127
127
|
|
|
128
|
-
export const
|
|
128
|
+
export const buttonSizeOptions = {
|
|
129
129
|
small: 'small',
|
|
130
130
|
medium: 'medium',
|
|
131
131
|
};
|
|
132
132
|
|
|
133
|
-
export const
|
|
133
|
+
export const buttonSizeOptionsMap = {
|
|
134
134
|
small: 'sm',
|
|
135
135
|
medium: 'md',
|
|
136
136
|
};
|