@gitlab/ui 37.0.0 → 37.1.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.
Files changed (66) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/dist/components/base/drawer/drawer.documentation.js +1 -1
  3. package/dist/components/base/pagination/pagination.js +1 -0
  4. package/dist/components/base/path/data.js +2 -1
  5. package/dist/components/base/path/path.js +5 -4
  6. package/dist/components/base/tabs/tab/tab.js +4 -0
  7. package/dist/components/base/tabs/tabs/tabs.documentation.js +2 -14
  8. package/dist/components/base/tabs/tabs/tabs.js +8 -0
  9. package/dist/components/charts/legend/legend.js +12 -0
  10. package/dist/index.css +1 -1
  11. package/dist/index.css.map +1 -1
  12. package/documentation/components_documentation.js +0 -2
  13. package/documentation/documented_stories.js +3 -0
  14. package/package.json +1 -1
  15. package/src/components/base/drawer/drawer.documentation.js +1 -1
  16. package/src/components/base/pagination/pagination.spec.js +3 -0
  17. package/src/components/base/pagination/pagination.vue +1 -0
  18. package/src/components/base/path/__snapshots__/path.spec.js.snap +6 -0
  19. package/src/components/base/path/data.js +1 -0
  20. package/src/components/base/path/path.scss +6 -1
  21. package/src/components/base/path/path.spec.js +8 -0
  22. package/src/components/base/path/path.vue +10 -4
  23. package/src/components/base/tabs/tab/tab.vue +4 -0
  24. package/src/components/base/tabs/tabs/tabs.documentation.js +0 -12
  25. package/src/components/base/tabs/tabs/tabs.md +2 -7
  26. package/src/components/base/tabs/tabs/tabs.stories.js +221 -161
  27. package/src/components/base/tabs/tabs/tabs.vue +6 -0
  28. package/src/components/charts/legend/legend.stories.js +22 -15
  29. package/src/components/charts/legend/legend.vue +9 -0
  30. package/dist/components/base/tabs/tab/examples/index.js +0 -13
  31. package/dist/components/base/tabs/tab/examples/tab.basic.example.js +0 -38
  32. package/dist/components/base/tabs/tab/tab.documentation.js +0 -18
  33. package/dist/components/base/tabs/tabs/examples/index.js +0 -60
  34. package/dist/components/base/tabs/tabs/examples/tabs.basic.example.js +0 -38
  35. package/dist/components/base/tabs/tabs/examples/tabs.contentless_tab.example.js +0 -38
  36. package/dist/components/base/tabs/tabs/examples/tabs.counterbadges.example.js +0 -38
  37. package/dist/components/base/tabs/tabs/examples/tabs.custom_title.example.js +0 -38
  38. package/dist/components/base/tabs/tabs/examples/tabs.disabled.example.js +0 -38
  39. package/dist/components/base/tabs/tabs/examples/tabs.justified.example.js +0 -38
  40. package/dist/components/base/tabs/tabs/examples/tabs.no_tabs.example.js +0 -38
  41. package/dist/components/base/tabs/tabs/examples/tabs.scrollable.example.js +0 -47
  42. package/dist/components/base/tabs/tabs/examples/tabs.styles_only.example.js +0 -38
  43. package/dist/components/charts/legend/examples/index.js +0 -22
  44. package/dist/components/charts/legend/examples/legend.basic.example.js +0 -93
  45. package/dist/components/charts/legend/examples/legend.toggled.example.js +0 -100
  46. package/dist/components/charts/legend/legend.documentation.js +0 -21
  47. package/src/components/base/tabs/tab/examples/index.js +0 -15
  48. package/src/components/base/tabs/tab/examples/tab.basic.example.vue +0 -5
  49. package/src/components/base/tabs/tab/tab.documentation.js +0 -16
  50. package/src/components/base/tabs/tab/tab.md +0 -3
  51. package/src/components/base/tabs/tab/tab.stories.js +0 -12
  52. package/src/components/base/tabs/tabs/examples/index.js +0 -72
  53. package/src/components/base/tabs/tabs/examples/tabs.basic.example.vue +0 -6
  54. package/src/components/base/tabs/tabs/examples/tabs.contentless_tab.example.vue +0 -17
  55. package/src/components/base/tabs/tabs/examples/tabs.counterbadges.example.vue +0 -28
  56. package/src/components/base/tabs/tabs/examples/tabs.custom_title.example.vue +0 -9
  57. package/src/components/base/tabs/tabs/examples/tabs.disabled.example.vue +0 -7
  58. package/src/components/base/tabs/tabs/examples/tabs.justified.example.vue +0 -6
  59. package/src/components/base/tabs/tabs/examples/tabs.no_tabs.example.vue +0 -8
  60. package/src/components/base/tabs/tabs/examples/tabs.scrollable.example.vue +0 -20
  61. package/src/components/base/tabs/tabs/examples/tabs.styles_only.example.vue +0 -22
  62. package/src/components/charts/legend/examples/index.js +0 -27
  63. package/src/components/charts/legend/examples/legend.basic.example.vue +0 -55
  64. package/src/components/charts/legend/examples/legend.toggled.example.vue +0 -60
  65. package/src/components/charts/legend/legend.documentation.js +0 -19
  66. package/src/components/charts/legend/legend.md +0 -0
@@ -16,7 +16,6 @@ export { default as GlNavbarDocumentation } from '../src/components/base/navbar/
16
16
  export { default as GlIntersectionObserverDocumentation } from '../src/components/utilities/intersection_observer/intersection_observer.documentation';
17
17
  export { default as GlChartDocumentation } from '../src/components/charts/chart/chart.documentation';
18
18
  export { default as GlAreaChartDocumentation } from '../src/components/charts/area/area.documentation';
19
- export { default as GlChartLegendDocumentation } from '../src/components/charts/legend/legend.documentation';
20
19
  export { default as GlLineChartDocumentation } from '../src/components/charts/line/line.documentation';
21
20
  export { default as GlSparklineChartDocumentation } from '../src/components/charts/sparkline/sparkline.documentation';
22
21
  export { default as GlChartSeriesLabelDocumentation } from '../src/components/charts/series_label/series_label.documentation';
@@ -64,7 +63,6 @@ export { default as GlTableDocumentation } from '../src/components/base/table/ta
64
63
  export { default as GlBreadcrumbDocumentation } from '../src/components/base/breadcrumb/breadcrumb.documentation';
65
64
  export { default as GlHeatmapDocumentation } from '../src/components/charts/heatmap/heatmap.documentation';
66
65
  export { default as GlTabsDocumentation } from '../src/components/base/tabs/tabs/tabs.documentation';
67
- export { default as GlTabDocumentation } from '../src/components/base/tabs/tab/tab.documentation';
68
66
  export { default as GlButtonGroupDocumentation } from '../src/components/base/button_group/button_group.documentation';
69
67
  export { default as GlFormCheckboxDocumentation } from '../src/components/base/form/form_checkbox/form_checkbox.documentation';
70
68
  export { default as GlLabelDocumentation } from '../src/components/base/label/label.documentation';
@@ -102,6 +102,7 @@ export const setupStorybookReadme = () =>
102
102
  'GlFormInput',
103
103
  'GlSegmentedControl',
104
104
  'GlAvatar',
105
+ 'GlChartLegend',
105
106
  'GlAvatarLink',
106
107
  'GlPagination',
107
108
  'GlSkeletonLoader',
@@ -117,6 +118,8 @@ export const setupStorybookReadme = () =>
117
118
  'GlKeysetPagination',
118
119
  'GlForm',
119
120
  'GlTable',
121
+ 'GlTab',
122
+ 'GlTabs',
120
123
  'GlToast',
121
124
  'GlPaginatedList',
122
125
  'GlIntersectionObserver',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gitlab/ui",
3
- "version": "37.0.0",
3
+ "version": "37.1.0",
4
4
  "description": "GitLab UI Components",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -1,6 +1,6 @@
1
1
  import description from './drawer.md';
2
2
 
3
3
  export default {
4
- followsDesignSystem: false,
4
+ followsDesignSystem: true,
5
5
  description,
6
6
  };
@@ -179,6 +179,7 @@ describe('pagination component', () => {
179
179
  it('shows 3rd page as active and enables all buttons', () => {
180
180
  const buttons = findButtons();
181
181
  expect(buttons.at(3).classes()).toEqual(expectClassActive);
182
+ expect(buttons.at(3).attributes('aria-current')).toEqual('page');
182
183
  buttons.wrappers.forEach((button) => {
183
184
  expect(button.element.tagName).not.toBe('SPAN');
184
185
  });
@@ -222,6 +223,7 @@ describe('pagination component', () => {
222
223
  const buttons = findButtons();
223
224
  expect(buttons.at(0).element.tagName).toBe('SPAN');
224
225
  expect(buttons.at(1).classes()).toEqual(expectClassActive);
226
+ expect(buttons.at(1).attributes('aria-current')).toEqual('page');
225
227
  expect(buttons.at(buttons.length - 1).element.tagName).not.toBe('SPAN');
226
228
  });
227
229
 
@@ -310,6 +312,7 @@ describe('pagination component', () => {
310
312
  const buttons = findButtons();
311
313
  expect(buttons.at(0).element.tagName).not.toBe('SPAN');
312
314
  expect(buttons.at(7).classes()).toEqual(expectClassActive);
315
+ expect(buttons.at(7).attributes('aria-current')).toEqual('page');
313
316
  expect(buttons.at(buttons.length - 1).element.tagName).toBe('SPAN');
314
317
  });
315
318
 
@@ -293,6 +293,7 @@ export default {
293
293
  const listeners = {};
294
294
  if (isActivePage) {
295
295
  attrs.class.push('active');
296
+ attrs['aria-current'] = 'page';
296
297
  }
297
298
  // Disable previous and/or next buttons if needed
298
299
  if (this.isLinkBased) {
@@ -155,7 +155,9 @@ exports[`Path matches the snapshot 1`] = `
155
155
  id="path-1-item-7"
156
156
  >
157
157
  <button
158
+ category="tertiary"
158
159
  class="gl-path-button"
160
+ disabled="disabled"
159
161
  >
160
162
  <!---->
161
163
 
@@ -383,7 +385,9 @@ exports[`Path renders the list of items with icons matches the snapshot 1`] = `
383
385
  id="path-15-item-7"
384
386
  >
385
387
  <button
388
+ category="tertiary"
386
389
  class="gl-path-button"
390
+ disabled="disabled"
387
391
  >
388
392
  <!---->
389
393
 
@@ -606,7 +610,9 @@ exports[`Path renders the list of items with metrics matches the snapshot 1`] =
606
610
  id="path-11-item-7"
607
611
  >
608
612
  <button
613
+ category="tertiary"
609
614
  class="gl-path-button"
615
+ disabled="disabled"
610
616
  >
611
617
  <!---->
612
618
 
@@ -30,6 +30,7 @@ export const mockPathItems = [
30
30
  {
31
31
  title: 'Eighth',
32
32
  metric: '8d',
33
+ disabled: true,
33
34
  },
34
35
  {
35
36
  title: 'Ninth',
@@ -78,7 +78,12 @@ $path-chevron-right-margin: px-to-rem(14px);
78
78
  @include gl-path-chevron;
79
79
  }
80
80
 
81
- &:hover {
81
+ &[disabled] {
82
+ @include gl-text-gray-400;
83
+ @include gl-cursor-not-allowed;
84
+ }
85
+
86
+ &:not([disabled]):hover {
82
87
  @include gl-path-active-item-color($gray-100);
83
88
  @include gl-text-gray-900;
84
89
  }
@@ -188,6 +188,14 @@ describe('Path', () => {
188
188
  ]);
189
189
  });
190
190
  });
191
+
192
+ describe('when a disabled item is clicked', () => {
193
+ it('does not emit the selected event', () => {
194
+ clickItemAt(7);
195
+
196
+ expect(wrapper.emitted('selected')).toBeUndefined();
197
+ });
198
+ });
191
199
  });
192
200
 
193
201
  describe('slots', () => {
@@ -21,9 +21,10 @@ export default {
21
21
  * A list of path items in the form:
22
22
  * ```
23
23
  * {
24
- * title: String, required
25
- * metric: Any, optional
26
- * icon: String, optional
24
+ * title: String, required
25
+ * metric: Any, optional
26
+ * icon: String, optional
27
+ * disabled: Boolean, optional
27
28
  * }
28
29
  * ```
29
30
  */
@@ -164,7 +165,12 @@ export default {
164
165
  :key="index"
165
166
  class="gl-path-nav-list-item"
166
167
  >
167
- <button :class="pathItemClass(index)" @click="onItemClicked(index)">
168
+ <button
169
+ :class="pathItemClass(index)"
170
+ :category="item.disabled ? 'tertiary' : undefined"
171
+ :disabled="item.disabled"
172
+ @click="onItemClicked(index)"
173
+ >
168
174
  <gl-icon
169
175
  v-if="shouldDisplayIcon(item.icon)"
170
176
  :name="item.icon"
@@ -15,6 +15,9 @@ export default {
15
15
  required: false,
16
16
  default: '',
17
17
  },
18
+ /**
19
+ * Query string parameter value to use when `gl-tabs` `sync-active-tab-with-query-params` prop is set to `true`.
20
+ */
18
21
  queryParamValue: {
19
22
  type: String,
20
23
  required: false,
@@ -36,6 +39,7 @@ export default {
36
39
  },
37
40
  };
38
41
  </script>
42
+
39
43
  <template>
40
44
  <b-tab
41
45
  :title-link-class="linkClass"
@@ -1,18 +1,6 @@
1
- import examples from './examples';
2
1
  import description from './tabs.md';
3
2
 
4
3
  export default {
5
4
  description,
6
- examples,
7
- bootstrapComponent: 'b-tabs',
8
5
  followsDesignSystem: true,
9
- propsInfo: {
10
- syncActiveTabWithQueryParams: {
11
- additionalInfo:
12
- 'Sync active tab with query string parameters. Allows for deep linking into specific tabs.',
13
- },
14
- queryParamName: {
15
- additionalInfo: 'Name to use for query string parameter.',
16
- },
17
- },
18
6
  };
@@ -1,15 +1,10 @@
1
- # Tabs
2
-
3
- <!-- STORY -->
4
- ## Usage
5
-
6
1
  Tabs are used to divide content into meaningful, related sections. Tabs allow users to focus on one
7
2
  specific view at a time while maintaining sight of all the relevant content options available. Each
8
3
  tab, when active, will reveal it’s own unique content.
9
4
 
10
5
  ## Using the component Vue
11
6
 
12
- ~~~js
7
+ ~~~html
13
8
  <gl-tabs>
14
9
  <gl-tab title="Tab 1">
15
10
  Tab panel 1
@@ -22,7 +17,7 @@ tab, when active, will reveal it’s own unique content.
22
17
 
23
18
  ## Using the component HTML
24
19
 
25
- ~~~js
20
+ ~~~html
26
21
  <div class="tabs gl-tabs">
27
22
  <ul role="tablist" class="nav gl-tabs-nav">
28
23
  <li role="presentation" class="nav-item">
@@ -1,8 +1,36 @@
1
- import { withKnobs, boolean } from '@storybook/addon-knobs';
2
1
  import { range } from 'lodash';
3
- import { documentedStoriesOf } from '../../../../../documentation/documented_stories';
4
2
  import { GlTabs, GlTab, GlScrollableTabs } from '../../../../index';
5
- import docs from './tabs.md';
3
+ import readme from './tabs.md';
4
+
5
+ const components = {
6
+ GlTabs,
7
+ GlTab,
8
+ };
9
+
10
+ const defaultValue = (prop) => GlTabs.props[prop].default;
11
+
12
+ const generateProps = ({
13
+ justified = defaultValue('justified'),
14
+ actionPrimary = null,
15
+ actionSecondary = null,
16
+ actionTertiary = null,
17
+ } = {}) => ({
18
+ justified,
19
+ actionPrimary,
20
+ actionSecondary,
21
+ actionTertiary,
22
+ });
23
+
24
+ const wrap = (template) => `
25
+ <gl-tabs
26
+ :justified="justified"
27
+ :action-primary="actionPrimary"
28
+ :action-secondary="actionSecondary"
29
+ :action-tertiary="actionTertiary"
30
+ >
31
+ ${template}
32
+ </gl-tabs>
33
+ `;
6
34
 
7
35
  const ScrollableTabsGenerator = {
8
36
  components: {
@@ -33,167 +61,199 @@ const ScrollableTabsGenerator = {
33
61
  `,
34
62
  };
35
63
 
36
- const createBaseStory = () => ({
37
- components: {
38
- GlTabs,
39
- GlTab,
64
+ export const Default = (_args, { argTypes }) => ({
65
+ props: Object.keys(argTypes),
66
+ components,
67
+ template: wrap(`
68
+ <gl-tab title="Tab 1">
69
+ Tab panel 1
70
+ </gl-tab>
71
+ <gl-tab title="Tab 2">
72
+ Tab panel 2
73
+ </gl-tab>
74
+ <gl-tab title="Tab 3">
75
+ Tab panel 3
76
+ </gl-tab>
77
+ <gl-tab title="Tab 4">
78
+ Tab panel 4
79
+ </gl-tab>
80
+ <gl-tab title="Tab 5">
81
+ Tab panel 5
82
+ </gl-tab>
83
+ <gl-tab title="Tab 6">
84
+ Tab panel 6
85
+ </gl-tab>
86
+ <gl-tab title="Tab 7">
87
+ Tab panel 7
88
+ </gl-tab>
89
+ <gl-tab title="Tab 8">
90
+ Tab panel 8
91
+ </gl-tab>
92
+ <gl-tab title="Tab 9">
93
+ Tab panel 9
94
+ </gl-tab>
95
+ <gl-tab title="Tab 10">
96
+ Tab panel 10
97
+ </gl-tab>
98
+ <gl-tab title="Tab 11">
99
+ Tab panel 11
100
+ </gl-tab>
101
+ <gl-tab title="Tab 12">
102
+ Tab panel 12
103
+ </gl-tab>
104
+ <gl-tab title="Tab 13" query-param-value="thirteenth">
105
+ Tab panel 13
106
+ </gl-tab>
107
+ <gl-tab title="Tab 14">
108
+ Tab panel 14
109
+ </gl-tab>`),
110
+ });
111
+ Default.args = generateProps();
112
+
113
+ export const ContentlessTab = (_args, { argTypes }) => ({
114
+ props: Object.keys(argTypes),
115
+ components,
116
+ template: wrap(`
117
+ <gl-tab title="Regular tab">
118
+ <p>Regular tab content.</p>
119
+ <p>The contentless tab is not selectable, as it has no content. This is useful for displaying things that aren't really tabs after the list of tabs.</p>
120
+ </gl-tab>
121
+ <gl-tab title="Another tab">
122
+ <p>Another tab's content.</p>
123
+ </gl-tab>
124
+ <template #tabs-end>
125
+ <li class="gl-tab-nav-item">
126
+ Contentless tab
127
+ </li>
128
+ </template>`),
129
+ });
130
+
131
+ export const EmptyState = (_args, { argTypes }) => ({
132
+ props: Object.keys(argTypes),
133
+ components,
134
+ template: wrap(`
135
+ <template #empty>
136
+ This content is only displayed when there are no tabs. Useful for dynamically added/removed tabs.
137
+ </template>`),
138
+ });
139
+
140
+ export const JustifiedTabs = (_args, { argTypes }) => ({
141
+ props: Object.keys(argTypes),
142
+ components,
143
+ template: wrap(`
144
+ <gl-tab title="Tab 1">
145
+ <p>Tab panel 1</p>
146
+ </gl-tab>
147
+ <gl-tab title="Tab 2">
148
+ <p>Tab panel 2</p>
149
+ </gl-tab>`),
150
+ });
151
+ JustifiedTabs.args = generateProps({ justified: true });
152
+
153
+ export const WithCounterBadges = (_args, { argTypes }) => ({
154
+ props: Object.keys(argTypes),
155
+ components,
156
+ template: wrap(`
157
+ <gl-tab>
158
+ <template #title>
159
+ <span>Tab</span>
160
+ <gl-badge size="sm" class="gl-tab-counter-badge">500</gl-badge>
161
+ <span class="sr-only">items</span>
162
+ </template>
163
+ Tab panel 1
164
+ </gl-tab>
165
+ <gl-tab>
166
+ <template #title>
167
+ <span>Tab</span>
168
+ <gl-badge size="sm" class="gl-tab-counter-badge">250</gl-badge>
169
+ <span class="sr-only">items</span>
170
+ </template>
171
+ Tab panel 2
172
+ </gl-tab>
173
+ <gl-tab>
174
+ <template #title>
175
+ <span>Tab</span>
176
+ </template>
177
+ Tab panel 3
178
+ </gl-tab>`),
179
+ });
180
+
181
+ export const WithActions = (_args, { argTypes }) => ({
182
+ props: Object.keys(argTypes),
183
+ components,
184
+ template: wrap(`
185
+ <gl-tab title="Tab 1">
186
+ Tab panel 1
187
+ </gl-tab>`),
188
+ });
189
+ WithActions.args = generateProps({
190
+ actionPrimary: {
191
+ attributes: {
192
+ variant: 'danger',
193
+ },
194
+ text: 'Primary action',
40
195
  },
41
- props: {
42
- syncActiveTabWithQueryParams: {
43
- type: Boolean,
44
- default: boolean('sync-active-tab-with-query-params', false),
196
+ actionSecondary: {
197
+ attributes: {
198
+ variant: 'success',
199
+ },
200
+ text: 'Secondary action',
201
+ },
202
+ actionTertiary: {
203
+ attributes: {
204
+ variant: 'default',
45
205
  },
206
+ text: 'Tertiary action',
46
207
  },
47
208
  });
48
209
 
49
- documentedStoriesOf('base/tabs/tabs', docs)
50
- .addDecorator(withKnobs)
51
- .add('default', () => ({
52
- ...createBaseStory(),
53
- template: `
54
- <gl-tabs :sync-active-tab-with-query-params="syncActiveTabWithQueryParams">
55
- <gl-tab title="Tab 1">
56
- Tab panel 1
57
- </gl-tab>
58
- <gl-tab title="Tab 2">
59
- Tab panel 2
60
- </gl-tab>
61
- <gl-tab title="Tab 3">
62
- Tab panel 3
63
- </gl-tab>
64
- <gl-tab title="Tab 4">
65
- Tab panel 4
66
- </gl-tab>
67
- <gl-tab title="Tab 5">
68
- Tab panel 5
69
- </gl-tab>
70
- <gl-tab title="Tab 6">
71
- Tab panel 6
72
- </gl-tab>
73
- <gl-tab title="Tab 7">
74
- Tab panel 7
75
- </gl-tab>
76
- <gl-tab title="Tab 8">
77
- Tab panel 8
78
- </gl-tab>
79
- <gl-tab title="Tab 9">
80
- Tab panel 9
81
- </gl-tab>
82
- <gl-tab title="Tab 10">
83
- Tab panel 10
84
- </gl-tab>
85
- <gl-tab title="Tab 11">
86
- Tab panel 11
87
- </gl-tab>
88
- <gl-tab title="Tab 12">
89
- Tab panel 12
90
- </gl-tab>
91
- <gl-tab title="Tab 13" query-param-value="thirteenth">
92
- Tab panel 13
93
- </gl-tab>
94
- <gl-tab title="Tab 14">
95
- Tab panel 14
96
- </gl-tab>
97
- </gl-tabs>
98
- `,
99
- }))
100
- .add('contentless tab', () => ({
101
- ...createBaseStory(),
102
- template: `
103
- <gl-tabs>
104
- <gl-tab title="Regular tab">
105
- <p>Regular tab content.</p>
106
- <p>The contentless tab is not selectable, as it has no content. This is useful for displaying things that aren't really tabs after the list of tabs.</p>
107
- </gl-tab>
108
- <gl-tab title="Another tab">
109
- <p>Another tab's content.</p>
110
- </gl-tab>
111
- <template #tabs-end>
112
- <li class="gl-tab-nav-item">
113
- Contentless tab
114
- </li>
115
- </template>
116
- </gl-tabs>
117
- `,
118
- }))
119
- .add('empty state', () => ({
120
- ...createBaseStory(),
121
- template: `
122
- <gl-tabs>
123
- <template #empty>
124
- This content is only displayed when there are no tabs. Useful for dynamically added/removed tabs.
125
- </template>
126
- </gl-tabs>
127
- `,
128
- }))
129
- .add('justified tabs', () => ({
130
- ...createBaseStory(),
131
- template: `
132
- <gl-tabs justified>
133
- <gl-tab title="Tab 1">
134
- <p>Tab panel 1</p>
135
- </gl-tab>
136
- <gl-tab title="Tab 2">
137
- <p>Tab panel 2</p>
138
- </gl-tab>
139
- </gl-tabs>
140
- `,
141
- }))
142
- .add('with counter badges', () => ({
143
- ...createBaseStory(),
144
- template: `
145
- <gl-tabs>
146
- <gl-tab>
147
- <template #title>
148
- <span>Tab</span>
149
- <gl-badge size="sm" class="gl-tab-counter-badge">500</gl-badge>
150
- <span class="sr-only">items</span>
151
- </template>
152
- Tab panel 1
153
- </gl-tab>
154
- <gl-tab>
155
- <template #title>
156
- <span>Tab</span>
157
- <gl-badge size="sm" class="gl-tab-counter-badge">250</gl-badge>
158
- <span class="sr-only">items</span>
159
- </template>
160
- Tab panel 2
161
- </gl-tab>
162
- <gl-tab>
163
- <template #title>
164
- <span>Tab</span>
165
- </template>
166
- Tab panel 3
167
- </gl-tab>
168
- </gl-tabs>
169
- `,
170
- }))
171
- .add('with scroll', () => ({
172
- ...createBaseStory(),
173
- components: {
174
- ScrollableTabsGenerator,
175
- },
176
- template: '<scrollable-tabs-generator :count="50" />',
177
- }))
178
- .add(
179
- 'with scroll and growing',
180
- () => ({
181
- ...createBaseStory(),
182
- components: {
183
- ScrollableTabsGenerator,
184
- },
185
- data() {
186
- return {
187
- count: 2,
188
- intervalId: 0,
189
- };
190
- },
191
- mounted() {
192
- this.intervalId = setInterval(() => {
193
- this.count += 1;
194
- }, 2000);
210
+ export const WithScroll = (_args, { argTypes }) => ({
211
+ props: Object.keys(argTypes),
212
+ components: {
213
+ ScrollableTabsGenerator,
214
+ },
215
+ template: '<scrollable-tabs-generator :count="50" />',
216
+ });
217
+
218
+ export const WithScrollAndGrowing = (_args, { argTypes }) => ({
219
+ props: Object.keys(argTypes),
220
+ components: {
221
+ ScrollableTabsGenerator,
222
+ },
223
+ data() {
224
+ return {
225
+ count: 2,
226
+ intervalId: 0,
227
+ };
228
+ },
229
+ mounted() {
230
+ this.intervalId = setInterval(() => {
231
+ this.count += 1;
232
+ }, 2000);
233
+ },
234
+ template: '<scrollable-tabs-generator :count="count" />',
235
+ });
236
+ WithScrollAndGrowing.parameters = {
237
+ storyshots: { disable: true },
238
+ };
239
+
240
+ export default {
241
+ title: 'base/tabs/tabs',
242
+ component: GlTabs,
243
+ subcomponents: { GlTab, GlScrollableTabs },
244
+ parameters: {
245
+ bootstrapComponent: 'b-tabs',
246
+ docs: {
247
+ description: {
248
+ component: readme,
195
249
  },
196
- template: '<scrollable-tabs-generator :count="count" />',
197
- }),
198
- { storyshots: false }
199
- );
250
+ },
251
+ },
252
+ argTypes: {
253
+ contentClass: { control: { disable: true } },
254
+ navClass: { control: { disable: true } },
255
+ syncActiveTabWithQueryParams: { control: { disable: true } },
256
+ queryParamName: { control: { disable: true } },
257
+ value: { control: { disable: true } },
258
+ },
259
+ };
@@ -46,11 +46,17 @@ export default {
46
46
  required: false,
47
47
  default: false,
48
48
  },
49
+ /**
50
+ * Sync active tab with query string parameters. Allows for deep linking into specific tabs.
51
+ */
49
52
  syncActiveTabWithQueryParams: {
50
53
  type: Boolean,
51
54
  required: false,
52
55
  default: false,
53
56
  },
57
+ /**
58
+ * Name to use for query string parameter.
59
+ */
54
60
  queryParamName: {
55
61
  type: String,
56
62
  required: false,