@gitlab/ui 32.19.0 → 32.20.2

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 (77) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/dist/components/base/accordion/accordion_item.js +2 -2
  3. package/dist/components/base/alert/alert.js +3 -3
  4. package/dist/components/base/button/button.documentation.js +17 -1
  5. package/dist/components/base/button/button.js +10 -10
  6. package/dist/components/base/daterange_picker/daterange_picker.js +2 -2
  7. package/dist/components/base/dropdown/dropdown.js +8 -8
  8. package/dist/components/base/filtered_search/filtered_search.js +2 -2
  9. package/dist/components/base/path/path.js +1 -1
  10. package/dist/components/base/search_box_by_click/search_box_by_click.js +2 -2
  11. package/dist/components/base/sorting/sorting.js +2 -2
  12. package/dist/components/base/tabs/tabs/examples/tabs.basic.example.js +1 -1
  13. package/dist/components/base/tabs/tabs/examples/tabs.counterbadges.example.js +1 -1
  14. package/dist/components/base/tabs/tabs/examples/tabs.custom_title.example.js +1 -1
  15. package/dist/components/base/tabs/tabs/examples/tabs.disabled.example.js +1 -1
  16. package/dist/components/base/tabs/tabs/examples/tabs.justified.example.js +1 -1
  17. package/dist/components/base/tabs/tabs/examples/tabs.scrollable.example.js +2 -2
  18. package/dist/components/base/tabs/tabs/examples/tabs.styles_only.example.js +1 -1
  19. package/dist/components/base/tabs/tabs/scrollable_tabs.js +1 -1
  20. package/dist/components/base/tabs/tabs/tabs.documentation.js +1 -1
  21. package/dist/components/base/toggle/toggle.js +5 -1
  22. package/dist/components/charts/heatmap/heatmap.js +2 -2
  23. package/dist/components/charts/single_stat/single_stat.js +1 -1
  24. package/dist/components/charts/sparkline/sparkline.js +2 -2
  25. package/dist/components/mixins/button_mixin.js +2 -2
  26. package/dist/components/shared_components/clear_icon_button/clear_icon_button.js +2 -2
  27. package/dist/directives/collapse_toggle.js +1 -2
  28. package/dist/directives/modal.js +1 -2
  29. package/dist/directives/resize_observer/resize_observer.js +2 -2
  30. package/dist/directives/tooltip.js +1 -2
  31. package/dist/index.css +1 -1
  32. package/dist/index.css.map +1 -1
  33. package/dist/index.js +4 -4
  34. package/dist/utils/constants.js +8 -8
  35. package/index.js +4 -4
  36. package/package.json +10 -10
  37. package/src/components/base/accordion/accordion_item.spec.js +1 -1
  38. package/src/components/base/accordion/accordion_item.vue +2 -2
  39. package/src/components/base/alert/alert.spec.js +3 -3
  40. package/src/components/base/alert/alert.vue +3 -3
  41. package/src/components/base/avatar/avatar.stories.js +1 -1
  42. package/src/components/base/avatar_labeled/avatar_labeled.stories.js +1 -1
  43. package/src/components/base/badge/badge.scss +1 -0
  44. package/src/components/base/button/button.documentation.js +18 -0
  45. package/src/components/base/button/button.stories.js +13 -13
  46. package/src/components/base/button/button.vue +15 -15
  47. package/src/components/base/daterange_picker/daterange_picker.vue +2 -2
  48. package/src/components/base/dropdown/dropdown.stories.js +5 -5
  49. package/src/components/base/dropdown/dropdown.vue +11 -11
  50. package/src/components/base/filtered_search/filtered_search.vue +2 -2
  51. package/src/components/base/path/path.vue +1 -1
  52. package/src/components/base/search_box_by_click/search_box_by_click.vue +2 -2
  53. package/src/components/base/sorting/sorting.vue +2 -2
  54. package/src/components/base/tabs/tabs/examples/tabs.basic.example.vue +2 -2
  55. package/src/components/base/tabs/tabs/examples/tabs.counterbadges.example.vue +9 -6
  56. package/src/components/base/tabs/tabs/examples/tabs.custom_title.example.vue +3 -3
  57. package/src/components/base/tabs/tabs/examples/tabs.disabled.example.vue +3 -3
  58. package/src/components/base/tabs/tabs/examples/tabs.justified.example.vue +2 -2
  59. package/src/components/base/tabs/tabs/examples/tabs.scrollable.example.vue +2 -2
  60. package/src/components/base/tabs/tabs/examples/tabs.styles_only.example.vue +4 -4
  61. package/src/components/base/tabs/tabs/scrollable_tabs.vue +1 -1
  62. package/src/components/base/tabs/tabs/tabs.md +8 -8
  63. package/src/components/base/tabs/tabs/tabs.stories.js +42 -40
  64. package/src/components/base/toggle/toggle.spec.js +1 -1
  65. package/src/components/base/toggle/toggle.vue +4 -1
  66. package/src/components/charts/heatmap/heatmap.vue +2 -2
  67. package/src/components/charts/single_stat/single_stat.vue +5 -1
  68. package/src/components/charts/sparkline/sparkline.spec.js +4 -2
  69. package/src/components/charts/sparkline/sparkline.vue +2 -2
  70. package/src/components/mixins/button_mixin.js +2 -2
  71. package/src/components/shared_components/clear_icon_button/clear_icon_button.vue +2 -2
  72. package/src/directives/collapse_toggle.js +1 -3
  73. package/src/directives/modal.js +1 -3
  74. package/src/directives/resize_observer/resize_observer.js +1 -3
  75. package/src/directives/resize_observer/resize_observer.spec.js +3 -3
  76. package/src/directives/tooltip.js +1 -3
  77. package/src/utils/constants.js +7 -7
@@ -1,6 +1,6 @@
1
1
  <template>
2
2
  <gl-tabs justified>
3
- <gl-tab title="First tab">First content</gl-tab>
4
- <gl-tab title="Second tab">Second content</gl-tab>
3
+ <gl-tab title="Tab 1">Tab panel 1</gl-tab>
4
+ <gl-tab title="Tab 2">Tab panel 2</gl-tab>
5
5
  </gl-tabs>
6
6
  </template>
@@ -5,8 +5,8 @@ export default {
5
5
  .map((_, index) => index + 1)
6
6
  .map((id) => ({
7
7
  id,
8
- title: `Lorem ${id}`,
9
- content: `(${id}) Lorem ipsum dolar sit amit...`,
8
+ title: `Tab ${id}`,
9
+ content: `Tab panel ${id} content...`,
10
10
  })),
11
11
  };
12
12
  </script>
@@ -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
- >First</a
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">Second</a>
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">first content</div>
19
- <div role="tabpanel" class="tab-pane">second content</div>
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>
@@ -1,6 +1,6 @@
1
1
  <script>
2
2
  import { debounce, isArray } from 'lodash';
3
- import GlResizeObserverDirective from '../../../../directives/resize_observer/resize_observer';
3
+ import { GlResizeObserverDirective } from '../../../../directives/resize_observer/resize_observer';
4
4
  import GlIcon from '../../icon/icon.vue';
5
5
  import GlTabs from './tabs.vue';
6
6
 
@@ -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="First">
15
- first content
14
+ <gl-tab title="Tab 1">
15
+ Tab panel 1
16
16
  </gl-tab>
17
- <gl-tab title="Second">
18
- second content
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
- >First</a>
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">Second</a>
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">first content</div>
42
- <div role="tabpanel" class="tab-pane gl-tab-content">second content</div>
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: `Lorem ${i + 1}`,
23
- content: `(${i + 1}) Lorem ipsum dolar sit amit...`,
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="First">
60
- first tab content
59
+ <gl-tab title="Tab 1">
60
+ Tab panel 1
61
61
  </gl-tab>
62
- <gl-tab title="Second">
63
- second tab content
62
+ <gl-tab title="Tab 2">
63
+ Tab panel 2
64
64
  </gl-tab>
65
- <gl-tab title="Third">
66
- third tab content
65
+ <gl-tab title="Tab 3">
66
+ Tab panel 3
67
67
  </gl-tab>
68
- <gl-tab title="Fourth">
69
- fourth tab content
68
+ <gl-tab title="Tab 4">
69
+ Tab panel 4
70
70
  </gl-tab>
71
- <gl-tab title="Fifth">
72
- fifth tab content
71
+ <gl-tab title="Tab 5">
72
+ Tab panel 5
73
73
  </gl-tab>
74
- <gl-tab title="Sixth">
75
- sixth tab content
74
+ <gl-tab title="Tab 6">
75
+ Tab panel 6
76
76
  </gl-tab>
77
- <gl-tab title="Seventh">
78
- seventh tab content
77
+ <gl-tab title="Tab 7">
78
+ Tab panel 7
79
79
  </gl-tab>
80
- <gl-tab title="Eighth">
81
- eighth tab content
80
+ <gl-tab title="Tab 8">
81
+ Tab panel 8
82
82
  </gl-tab>
83
- <gl-tab title="Ninth">
84
- ninth tab content
83
+ <gl-tab title="Tab 9">
84
+ Tab panel 9
85
85
  </gl-tab>
86
- <gl-tab title="Tenth">
87
- tenth tab content
86
+ <gl-tab title="Tab 10">
87
+ Tab panel 10
88
88
  </gl-tab>
89
- <gl-tab title="Eleventh">
90
- eleventh tab content
89
+ <gl-tab title="Tab 11">
90
+ Tab panel 11
91
91
  </gl-tab>
92
- <gl-tab title="Twelfth">
93
- twelfth tab content
92
+ <gl-tab title="Tab 12">
93
+ Tab panel 12
94
94
  </gl-tab>
95
- <gl-tab title="Thirteenth" query-param-value="thirteenth">
96
- thirteenth tab content
95
+ <gl-tab title="Tab 13" query-param-value="thirteenth">
96
+ Tab panel 13
97
97
  </gl-tab>
98
- <gl-tab title="Fourteenth">
99
- fourteenth tab content
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="First tab">
138
- <p>First content</p>
137
+ <gl-tab title="Tab 1">
138
+ <p>Tab panel 1</p>
139
139
  </gl-tab>
140
- <gl-tab title="Second tab">
141
- <p>Second content</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>1st</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
- first content
156
+ Tab panel 1
156
157
  </gl-tab>
157
158
  <gl-tab>
158
159
  <template #title>
159
- <span>2nd</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
- second content
164
+ Tab panel 2
163
165
  </gl-tab>
164
166
  <gl-tab>
165
167
  <template #title>
166
- <span>3rd</span>
168
+ <span>Tab</span>
167
169
  </template>
168
- third content
170
+ Tab panel 3
169
171
  </gl-tab>
170
172
  </gl-tabs>
171
173
  `,
@@ -36,7 +36,7 @@ describe('toggle', () => {
36
36
  describe.each`
37
37
  state | value | ariaCheckedExpected | checkedClassExpected
38
38
  ${'on'} | ${true} | ${'true'} | ${true}
39
- ${'off'} | ${false} | ${undefined} | ${false}
39
+ ${'off'} | ${false} | ${'false'} | ${false}
40
40
  `('when $state', ({ value, ariaCheckedExpected, checkedClassExpected }) => {
41
41
  beforeEach(() => {
42
42
  createWrapper({ value });
@@ -83,6 +83,9 @@ export default {
83
83
  helpId() {
84
84
  return this.help ? `toggle-help-${this.uuid}` : undefined;
85
85
  },
86
+ isChecked() {
87
+ return this.value ? 'true' : 'false';
88
+ },
86
89
  },
87
90
 
88
91
  beforeCreate() {
@@ -119,7 +122,7 @@ export default {
119
122
  <input v-if="name" :name="name" :value="value" type="hidden" />
120
123
  <button
121
124
  role="switch"
122
- :aria-checked="value"
125
+ :aria-checked="isChecked"
123
126
  :aria-label="label"
124
127
  :aria-describedby="helpId"
125
128
  :class="{
@@ -1,7 +1,7 @@
1
1
  <script>
2
2
  import merge from 'lodash/merge';
3
3
  import { white, gray100 } from '../../../../scss_to_js/scss_variables';
4
- import resizeObserver from '../../../directives/resize_observer/resize_observer';
4
+ import { GlResizeObserverDirective } from '../../../directives/resize_observer/resize_observer';
5
5
  import { getDefaultTooltipContent } from '../../../utils/charts/config';
6
6
  import { TOOLTIP_LEFT_OFFSET } from '../../../utils/charts/constants';
7
7
  import { heatmapHues } from '../../../utils/charts/theme';
@@ -50,7 +50,7 @@ export default {
50
50
  TooltipDefaultFormat,
51
51
  },
52
52
  directives: {
53
- resizeObserver,
53
+ resizeObserver: GlResizeObserverDirective,
54
54
  },
55
55
  mixins: [ToolboxMixin],
56
56
  props: {
@@ -87,7 +87,11 @@ export default {
87
87
  </script>
88
88
 
89
89
  <template>
90
- <div class="gl-single-stat gl-display-flex gl-flex-direction-column gl-p-2">
90
+ <div
91
+ class="gl-single-stat gl-display-flex gl-flex-direction-column gl-p-2"
92
+ v-bind="$attrs"
93
+ v-on="$listeners"
94
+ >
91
95
  <div class="gl-display-flex gl-align-items-center gl-text-gray-700 gl-mb-2">
92
96
  <gl-icon v-if="showTitleIcon" :name="titleIcon" class="gl-mr-2" data-testid="title-icon" />
93
97
  <span class="gl-font-base gl-font-weight-normal" data-testid="title-text">{{ title }}</span>
@@ -26,8 +26,10 @@ jest.mock('~/utils/charts/theme', () => ({
26
26
 
27
27
  let triggerResize = () => {};
28
28
  jest.mock('~/directives/resize_observer/resize_observer', () => ({
29
- bind(el, { value: resizeHandler }) {
30
- triggerResize = () => resizeHandler();
29
+ GlResizeObserverDirective: {
30
+ bind(el, { value: resizeHandler }) {
31
+ triggerResize = () => resizeHandler();
32
+ },
31
33
  },
32
34
  }));
33
35
 
@@ -1,6 +1,6 @@
1
1
  <script>
2
2
  import merge from 'lodash/merge';
3
- import resizeObserver from '../../../directives/resize_observer/resize_observer';
3
+ import { GlResizeObserverDirective } from '../../../directives/resize_observer/resize_observer';
4
4
  import defaultChartOptions, {
5
5
  mergeSeriesToOptions,
6
6
  symbolSize,
@@ -14,7 +14,7 @@ const gridPadding = symbolSize / 2;
14
14
  export default {
15
15
  components: { Chart, ChartTooltip },
16
16
  directives: {
17
- resizeObserver,
17
+ resizeObserver: GlResizeObserverDirective,
18
18
  },
19
19
  props: {
20
20
  /**
@@ -1,9 +1,9 @@
1
- import { newButtonSizeOptionsMap } from '../../utils/constants';
1
+ import { buttonSizeOptionsMap } from '../../utils/constants';
2
2
 
3
3
  export const ButtonMixin = {
4
4
  computed: {
5
5
  buttonSize() {
6
- return newButtonSizeOptionsMap[this.size];
6
+ return buttonSizeOptionsMap[this.size];
7
7
  },
8
8
  },
9
9
  };
@@ -1,5 +1,5 @@
1
1
  <script>
2
- import GlTooltip from '../../../directives/tooltip';
2
+ import { GlTooltipDirective } from '../../../directives/tooltip';
3
3
  import GlButton from '../../base/button/button.vue';
4
4
 
5
5
  export default {
@@ -7,7 +7,7 @@ export default {
7
7
  GlButton,
8
8
  },
9
9
  directives: {
10
- GlTooltip,
10
+ GlTooltip: GlTooltipDirective,
11
11
  },
12
12
  props: {
13
13
  title: {
@@ -1,3 +1 @@
1
- import { VBToggle } from 'bootstrap-vue';
2
-
3
- export default VBToggle;
1
+ export { VBToggle as GlCollapseToggleDirective } from 'bootstrap-vue';
@@ -1,3 +1 @@
1
- import { VBModal } from 'bootstrap-vue';
2
-
3
- export default VBModal;
1
+ export { VBModal as GlModalDirective } from 'bootstrap-vue';
@@ -2,7 +2,7 @@ import isFunction from 'lodash/isFunction';
2
2
 
3
3
  let observer = null;
4
4
 
5
- const ResizeObserverDirective = {
5
+ export const GlResizeObserverDirective = {
6
6
  bind(el, { value: resizeHandler }) {
7
7
  if (!isFunction(resizeHandler)) {
8
8
  throw TypeError('directive value must be a function');
@@ -28,5 +28,3 @@ const ResizeObserverDirective = {
28
28
  }
29
29
  },
30
30
  };
31
-
32
- export default ResizeObserverDirective;
@@ -1,5 +1,5 @@
1
1
  import { shallowMount, createLocalVue } from '@vue/test-utils';
2
- import resizeObserver from './resize_observer';
2
+ import { GlResizeObserverDirective } from './resize_observer';
3
3
  import { useMockResizeObserver } from '~helpers/mock_dom_observer';
4
4
 
5
5
  describe('resize observer directive', () => {
@@ -15,7 +15,7 @@ describe('resize observer directive', () => {
15
15
 
16
16
  const component = {
17
17
  directives: {
18
- resizeObserver,
18
+ resizeObserver: GlResizeObserverDirective,
19
19
  },
20
20
  methods: {
21
21
  handleResize: mockHandleResize,
@@ -84,7 +84,7 @@ describe('resize observer directive', () => {
84
84
  (directiveValue) => {
85
85
  const testComponentWithoutHandler = {
86
86
  directives: {
87
- resizeObserver,
87
+ resizeObserver: GlResizeObserverDirective,
88
88
  },
89
89
  data() {
90
90
  return {
@@ -1,3 +1 @@
1
- import { VBTooltip } from 'bootstrap-vue';
2
-
3
- export default VBTooltip;
1
+ export { VBTooltip as GlTooltipDirective } from 'bootstrap-vue';
@@ -85,13 +85,13 @@ export const formStateOptions = {
85
85
  invalid: false,
86
86
  };
87
87
 
88
- export const newButtonCategoryOptions = {
88
+ export const buttonCategoryOptions = {
89
89
  primary: 'primary',
90
90
  secondary: 'secondary',
91
91
  tertiary: 'tertiary',
92
92
  };
93
93
 
94
- export const newButtonVariantOptions = {
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
- [newButtonVariantOptions.default]: badgeVariantOptions.neutral,
114
- [newButtonVariantOptions.confirm]: badgeVariantOptions.info,
115
- [newButtonVariantOptions.danger]: badgeVariantOptions.danger,
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 newButtonSizeOptions = {
128
+ export const buttonSizeOptions = {
129
129
  small: 'small',
130
130
  medium: 'medium',
131
131
  };
132
132
 
133
- export const newButtonSizeOptionsMap = {
133
+ export const buttonSizeOptionsMap = {
134
134
  small: 'sm',
135
135
  medium: 'md',
136
136
  };