@gitlab/ui 126.2.0 → 126.3.1

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 (32) hide show
  1. package/dist/components/base/avatars_inline/avatars_inline.js +21 -0
  2. package/dist/components/base/badge/badge.js +7 -7
  3. package/dist/components/base/drawer/drawer.js +19 -0
  4. package/dist/components/base/dropdown/dropdown_item.js +34 -0
  5. package/dist/components/base/form/form_input_group/form_input_group.js +6 -0
  6. package/dist/components/base/keyset_pagination/keyset_pagination.js +1 -1
  7. package/dist/components/base/label/label.js +26 -6
  8. package/dist/components/base/pagination/pagination.js +2 -18
  9. package/dist/components/base/popover/popover.js +15 -0
  10. package/dist/components/base/progress_bar/progress_bar.js +15 -0
  11. package/dist/components/base/search_box_by_type/search_box_by_type.js +20 -0
  12. package/dist/components/base/tabs/tab/tab.js +31 -2
  13. package/dist/components/base/token/token.js +3 -0
  14. package/dist/components/dashboards/dashboard_layout/dashboard_layout.js +27 -1
  15. package/dist/components/dashboards/dashboard_layout/grid_layout/grid_layout.js +28 -6
  16. package/package.json +2 -2
  17. package/src/components/base/avatars_inline/avatars_inline.vue +22 -0
  18. package/src/components/base/badge/badge.vue +9 -8
  19. package/src/components/base/drawer/drawer.vue +23 -0
  20. package/src/components/base/dropdown/dropdown_item.vue +35 -0
  21. package/src/components/base/form/form_input_group/form_input_group.vue +6 -0
  22. package/src/components/base/keyset_pagination/keyset_pagination.vue +2 -2
  23. package/src/components/base/label/label.vue +26 -6
  24. package/src/components/base/pagination/pagination.vue +4 -22
  25. package/src/components/base/popover/popover.vue +20 -1
  26. package/src/components/base/progress_bar/progress_bar.vue +15 -0
  27. package/src/components/base/search_box_by_type/search_box_by_type.vue +18 -0
  28. package/src/components/base/tabs/tab/tab.vue +46 -2
  29. package/src/components/base/token/token.vue +4 -0
  30. package/src/components/dashboards/dashboard_layout/dashboard_layout.vue +29 -0
  31. package/src/components/dashboards/dashboard_layout/grid_layout/grid_layout.vue +29 -6
  32. package/translations.js +0 -2
@@ -27,11 +27,17 @@ export default {
27
27
  required: false,
28
28
  default: '',
29
29
  },
30
+ /**
31
+ * Whether to render the search box without borders
32
+ */
30
33
  borderless: {
31
34
  type: Boolean,
32
35
  required: false,
33
36
  default: false,
34
37
  },
38
+ /**
39
+ * Title text for the clear button
40
+ */
35
41
  clearButtonTitle: {
36
42
  type: String,
37
43
  required: false,
@@ -104,6 +110,10 @@ export default {
104
110
  this.$refs.input.$el.focus();
105
111
  },
106
112
  onInput(value) {
113
+ /**
114
+ * Emitted when the input value changes or gets cleared.
115
+ * @event input
116
+ */
107
117
  this.$emit('input', value);
108
118
  },
109
119
  onFocusout(event) {
@@ -113,6 +123,10 @@ export default {
113
123
  return;
114
124
  }
115
125
 
126
+ /**
127
+ * Emitted when focus leaves the search box (input and clear button).
128
+ * @event focusout
129
+ */
116
130
  this.$emit('focusout', event);
117
131
  },
118
132
  onFocusin(event) {
@@ -122,6 +136,10 @@ export default {
122
136
  return;
123
137
  }
124
138
 
139
+ /**
140
+ * Emitted when focus enters the search box (input or clear button).
141
+ * @event focusin
142
+ */
125
143
  this.$emit('focusin', event);
126
144
  },
127
145
  },
@@ -2,6 +2,7 @@
2
2
  <script>
3
3
  import isPlainObject from 'lodash/isPlainObject';
4
4
  import { BTab } from '../../../../vendor/bootstrap-vue/src/components/tabs/tab';
5
+ import GlBadge from '../../badge/badge.vue';
5
6
 
6
7
  import { DEFAULT_TAB_TITLE_LINK_CLASS } from '../constants';
7
8
 
@@ -9,6 +10,7 @@ export default {
9
10
  name: 'GlTab',
10
11
  components: {
11
12
  BTab,
13
+ GlBadge,
12
14
  },
13
15
  inheritAttrs: false,
14
16
  props: {
@@ -25,6 +27,24 @@ export default {
25
27
  required: false,
26
28
  default: null,
27
29
  },
30
+ /**
31
+ * Display a count badge next to the tab title.
32
+ */
33
+ tabCount: {
34
+ type: Number,
35
+ required: false,
36
+ default: null,
37
+ },
38
+ /**
39
+ * Screen reader text to provide context for the tab count value.
40
+ * Should be the result of calling n__() with the count.
41
+ * Example: :tab-count-sr-text="n__('%d changed file', '%d changed files', count)"
42
+ */
43
+ tabCountSrText: {
44
+ type: String,
45
+ required: false,
46
+ default: null,
47
+ },
28
48
  },
29
49
  computed: {
30
50
  linkClass() {
@@ -38,19 +58,43 @@ export default {
38
58
  }
39
59
  return `${titleLinkClass} ${DEFAULT_TAB_TITLE_LINK_CLASS}`.trim();
40
60
  },
61
+ hasTabCount() {
62
+ return this.tabCount != null && this.tabCount >= 0;
63
+ },
64
+ },
65
+ created() {
66
+ if (process.env.NODE_ENV !== 'production' && this.hasTabCount && !this.tabCountSrText) {
67
+ // eslint-disable-next-line no-console
68
+ console.warn(
69
+ '[GlTab] When using "tab-count", you should also provide "tab-count-sr-text" for screen reader accessibility. Example: :tab-count-sr-text="n__(\'%d item\', \'%d items\', count)"',
70
+ );
71
+ }
41
72
  },
42
73
  };
43
74
  </script>
44
75
 
45
76
  <template>
46
77
  <b-tab
78
+ :title="hasTabCount ? null : $attrs.title"
47
79
  :title-link-class="linkClass"
48
80
  :query-param-value="queryParamValue"
49
81
  v-bind="$attrs"
50
82
  v-on="$listeners"
51
83
  >
52
- <!-- eslint-disable-next-line @gitlab/vue-prefer-dollar-scopedslots -->
53
- <template v-for="slot in Object.keys($slots)" #[slot]>
84
+ <template v-if="hasTabCount" #title>
85
+ <slot name="title">{{ $attrs.title }}</slot>
86
+ <gl-badge
87
+ class="gl-ml-2"
88
+ variant="neutral"
89
+ aria-hidden="true"
90
+ data-testid="tab-counter-badge"
91
+ >
92
+ {{ tabCount }}
93
+ </gl-badge>
94
+ <span v-if="tabCountSrText" class="gl-sr-only">{{ tabCountSrText }}</span>
95
+ </template>
96
+
97
+ <template v-for="slot in Object.keys($scopedSlots)" #[slot]>
54
98
  <slot :name="slot"></slot>
55
99
  </template>
56
100
  </b-tab>
@@ -10,6 +10,9 @@ export default {
10
10
  CloseButton,
11
11
  },
12
12
  props: {
13
+ /**
14
+ * When true, hides the close button and makes the token non-removable.
15
+ */
13
16
  viewOnly: {
14
17
  type: Boolean,
15
18
  required: false,
@@ -60,6 +63,7 @@ export default {
60
63
  <template>
61
64
  <span :class="['gl-token', variantClass, viewOnlyClass]" v-on="$listeners">
62
65
  <span class="gl-token-content">
66
+ <!-- @slot Content to display inside the token -->
63
67
  <slot></slot>
64
68
  <close-button v-if="!viewOnly" class="gl-token-close" :label="removeLabel" @click="close" />
65
69
  </span>
@@ -35,6 +35,33 @@ export default {
35
35
  required: false,
36
36
  default: true,
37
37
  },
38
+ /**
39
+ * Adjusts the cell height of the grid. Setting this too high can leave unwanted whitespace
40
+ * between grid panels. Reduce the number to allow for a more compact grid.
41
+ * For more information, see:
42
+ * https://gitlab.com/gitlab-org/gitlab-services/design.gitlab.com/-/issues/3051
43
+ */
44
+ cellHeight: {
45
+ type: Number,
46
+ required: false,
47
+
48
+ /* Magic number:
49
+ * After allowing for padding, and the panel title row, this leaves us with minimum 48px height for the cell content.
50
+ * This means text/content with our spacing scale can fit up to 49px without scrolling.
51
+ */
52
+ default: 137,
53
+ validator: (value) => value > 0,
54
+ },
55
+ /**
56
+ * Sets a default minimum height for grid panels. This can still be overriden on a per-panel
57
+ * basis by setting `value.panels[].gridAttributes.minHeight`
58
+ */
59
+ minCellHeight: {
60
+ type: Number,
61
+ required: false,
62
+ default: 1,
63
+ validator: (value) => value > 0,
64
+ },
38
65
  },
39
66
  computed: {
40
67
  dashboardHasPanels() {
@@ -104,6 +131,8 @@ export default {
104
131
  v-if="dashboardHasPanels"
105
132
  :value="config"
106
133
  :is-static-grid="isStaticGrid"
134
+ :cell-height="cellHeight"
135
+ :min-cell-height="minCellHeight"
107
136
  class="-gl-mx-3"
108
137
  @input="emitChanges"
109
138
  >
@@ -35,6 +35,33 @@ export default {
35
35
  required: false,
36
36
  default: true,
37
37
  },
38
+ /**
39
+ * Adjusts the cell height of the grid. Setting this too high can leave unwanted whitespace
40
+ * between grid panels. Reduce the number to allow for a more compact grid.
41
+ * For more information, see:
42
+ * https://gitlab.com/gitlab-org/gitlab-services/design.gitlab.com/-/issues/3051
43
+ */
44
+ cellHeight: {
45
+ type: Number,
46
+ required: false,
47
+
48
+ /* Magic number:
49
+ * After allowing for padding, and the panel title row, this leaves us with minimum 48px height for the cell content.
50
+ * This means text/content with our spacing scale can fit up to 49px without scrolling.
51
+ */
52
+ default: 137,
53
+ validator: (value) => value > 0,
54
+ },
55
+ /**
56
+ * Sets a default minimum height for grid panels. This can still be overriden on a per-panel
57
+ * basis by setting `value.panels[].gridAttributes.minHeight`
58
+ */
59
+ minCellHeight: {
60
+ type: Number,
61
+ required: false,
62
+ default: 1,
63
+ validator: (value) => value > 0,
64
+ },
38
65
  },
39
66
  data() {
40
67
  return {
@@ -143,15 +170,11 @@ export default {
143
170
  margin: '8px',
144
171
  // CSS Selector for finding the drag handle element
145
172
  handle: '.grid-stack-item-handle',
146
- /* Magic number:
147
- * After allowing for padding, and the panel title row, this leaves us with minimum 48px height for the cell content.
148
- * This means text/content with our spacing scale can fit up to 49px without scrolling.
149
- */
150
- cellHeight: '137px',
151
173
  // Setting 1 in minRow prevents the grid collapsing when all panels are removed
152
174
  minRow: 1,
153
175
  // Define the number of columns for anything below a set width, defaults to fill the available space
154
176
  columnOpts: { breakpoints: [{ w: breakpoints.md, c: 1 }] },
177
+ cellHeight: this.cellHeight,
155
178
  alwaysShowResizeHandle: true,
156
179
  animate: true,
157
180
  float: true,
@@ -194,7 +217,7 @@ export default {
194
217
  y: yPos,
195
218
  w: width,
196
219
  h: height,
197
- minH: minHeight,
220
+ minH: minHeight || this.minCellHeight,
198
221
  minW: minWidth,
199
222
  maxH: maxHeight,
200
223
  maxW: maxWidth,
package/translations.js CHANGED
@@ -29,8 +29,6 @@ export default {
29
29
  'GlPagination.labelPage': 'Go to page %{page}',
30
30
  'GlPagination.labelPrevPage': 'Go to previous page',
31
31
  'GlPagination.nav': 'Pagination',
32
- 'GlPagination.nextText': 'Next',
33
- 'GlPagination.prevText': 'Previous',
34
32
  'GlProgressBar.ariaLabel': 'Progress bar',
35
33
  'GlSearchBoxByType.clearButtonTitle': 'Clear',
36
34
  'GlSearchBoxByType.input.placeholder': 'Search',