@gitlab/ui 53.0.1 → 53.2.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gitlab/ui",
3
- "version": "53.0.1",
3
+ "version": "53.2.0",
4
4
  "description": "GitLab UI Components",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -17,6 +17,7 @@ export const glSpacingScale15 = '7.5rem'
17
17
  export const glSpacingScale20 = '10rem'
18
18
  export const glSpacingScale26 = '13rem'
19
19
  export const glSpacingScale28 = '14rem'
20
+ export const glSpacingScale30 = '15rem'
20
21
  export const glSpacingScale34 = '17rem'
21
22
  export const glSpacingScale62 = '31rem'
22
23
  export const glSpacingScale80 = '40rem'
@@ -95,6 +95,11 @@
95
95
  "value": "28 * $grid-size",
96
96
  "compiledValue": "14rem"
97
97
  },
98
+ {
99
+ "name": "$gl-spacing-scale-30",
100
+ "value": "30 * $grid-size",
101
+ "compiledValue": "15rem"
102
+ },
98
103
  {
99
104
  "name": "$gl-spacing-scale-34",
100
105
  "value": "34 * $grid-size",
@@ -16,7 +16,13 @@ import {
16
16
  } from '../../../../index';
17
17
  import { makeContainer } from '../../../../utils/story_decorators/container';
18
18
  import readme from './disclosure_dropdown.md';
19
- import { mockItems, mockItemsCustomItem, mockGroups, mockProfileGroups } from './mock_data';
19
+ import {
20
+ mockItems,
21
+ mockItemsCustomItem,
22
+ mockGroups,
23
+ mockProfileGroups,
24
+ mockGroupsCustomItem,
25
+ } from './mock_data';
20
26
 
21
27
  const defaultValue = (prop) => GlDisclosureDropdown.props[prop].default;
22
28
 
@@ -185,6 +191,51 @@ Groups.args = generateProps({
185
191
  textSrOnly: true,
186
192
  });
187
193
 
194
+ export const CustomGroupsAndItems = (args, { argTypes }) => ({
195
+ props: Object.keys(argTypes),
196
+ components: {
197
+ GlDisclosureDropdown,
198
+ GlBadge,
199
+ },
200
+ mounted() {
201
+ if (this.startOpened) {
202
+ openDisclosure(this);
203
+ }
204
+ },
205
+ methods: {
206
+ navigate() {
207
+ this.$refs.link.click();
208
+ },
209
+ getTotalMrs(items) {
210
+ return items.reduce((acc, item) => acc + item.count, 0);
211
+ },
212
+ },
213
+ template: template(
214
+ `
215
+ <template #group-label="{ group }">
216
+ {{ group.name }} <gl-badge size="sm">{{ getTotalMrs(group.items) }}</gl-badge>
217
+ </template>
218
+ <template #list-item="{ item }">
219
+ <a ref="link" class="gl-display-flex gl-align-items-center gl-justify-content-space-between gl-hover-text-gray-900 gl-hover-text-decoration-none gl-text-gray-900" :href="item.href" v-bind="item.extraAttrs">
220
+ {{item.text}}
221
+ <gl-badge pill size="sm" v-if="item.count">{{item.count}}</gl-badge>
222
+ </a>
223
+ </template>
224
+ `,
225
+ {
226
+ bindingOverrides: {
227
+ '@action': 'navigate',
228
+ },
229
+ }
230
+ ),
231
+ });
232
+
233
+ CustomGroupsAndItems.args = generateProps({
234
+ items: mockGroupsCustomItem,
235
+ toggleText: 'Merge requests',
236
+ });
237
+ CustomGroupsAndItems.decorators = [makeContainer({ height: '200px' })];
238
+
188
239
  export const CustomGroupsItemsAndToggle = makeGroupedExample({
189
240
  template: template(`
190
241
  <template #toggle>
@@ -328,9 +328,15 @@ export default {
328
328
  <slot name="group-label" :group="item"></slot>
329
329
  </template>
330
330
 
331
- <template #list-item>
332
- <!-- @slot Custom template of the disclosure dropdown item -->
333
- <slot name="list-item"></slot>
331
+ <template v-if="$scopedSlots['list-item']">
332
+ <gl-disclosure-dropdown-item
333
+ v-for="groupItem in item.items"
334
+ :key="groupItem.text"
335
+ @action="handleAction"
336
+ >
337
+ <!-- @slot Custom template of the disclosure dropdown item -->
338
+ <slot name="list-item" :item="groupItem"></slot>
339
+ </gl-disclosure-dropdown-item>
334
340
  </template>
335
341
  </gl-disclosure-dropdown-group>
336
342
  </template>
@@ -51,6 +51,24 @@ export const mockItemsCustomItem = [
51
51
  },
52
52
  ];
53
53
 
54
+ export const mockGroupsCustomItem = [
55
+ {
56
+ name: 'Merge requests',
57
+ items: [
58
+ {
59
+ text: 'Assigned to you',
60
+ href: 'https://gitlab.com/dashboard/merge_requests?assignee_username=root',
61
+ count: 1,
62
+ },
63
+ {
64
+ text: 'Review requests from you',
65
+ href: 'https://gitlab.com/dashboard/merge_requests?reviewer_username=root',
66
+ count: 4,
67
+ },
68
+ ],
69
+ },
70
+ ];
71
+
54
72
  export const mockGroups = [
55
73
  {
56
74
  name: 'This project',
@@ -4443,6 +4443,14 @@
4443
4443
  width: $gl-spacing-scale-28 !important;
4444
4444
  }
4445
4445
 
4446
+ .gl-w-30 {
4447
+ width: $gl-spacing-scale-30;
4448
+ }
4449
+
4450
+ .gl-w-30\! {
4451
+ width: $gl-spacing-scale-30 !important;
4452
+ }
4453
+
4446
4454
  .gl-w-eighth {
4447
4455
  width: 12.5%;
4448
4456
  }
@@ -69,6 +69,10 @@
69
69
  width: $gl-spacing-scale-28;
70
70
  }
71
71
 
72
+ @mixin gl-w-30 {
73
+ width: $gl-spacing-scale-30;
74
+ }
75
+
72
76
  @mixin gl-w-eighth {
73
77
  width: 12.5%;
74
78
  }
@@ -20,6 +20,7 @@ $gl-spacing-scale-15: 15 * $grid-size;
20
20
  $gl-spacing-scale-20: 20 * $grid-size;
21
21
  $gl-spacing-scale-26: 26 * $grid-size;
22
22
  $gl-spacing-scale-28: 28 * $grid-size;
23
+ $gl-spacing-scale-30: 30 * $grid-size;
23
24
  $gl-spacing-scale-34: 34 * $grid-size;
24
25
  $gl-spacing-scale-62: 62 * $grid-size;
25
26
  $gl-spacing-scale-80: 80 * $grid-size;