@gitlab/ui 32.9.1 → 32.11.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.
@@ -45,6 +45,9 @@ function generateProps({
45
45
  hideHeaderBorder = true,
46
46
  showClearAll = false,
47
47
  clearAllText = '',
48
+ showHighlightedItemsTitle = false,
49
+ highlightedItemsTitle = '',
50
+ highlightedItemsTitleClass = '',
48
51
  } = {}) {
49
52
  const props = {
50
53
  category: {
@@ -107,6 +110,18 @@ function generateProps({
107
110
  type: String,
108
111
  default: textKnob('clear all text', clearAllText),
109
112
  },
113
+ showHighlightedItemsTitle: {
114
+ type: Boolean,
115
+ default: boolean('show highlighted items title', showHighlightedItemsTitle),
116
+ },
117
+ highlightedItemsTitle: {
118
+ type: String,
119
+ default: textKnob('highlighted items title', highlightedItemsTitle),
120
+ },
121
+ highlightedItemsTitleClass: {
122
+ type: String,
123
+ default: textKnob('highlighted items title class', highlightedItemsTitleClass),
124
+ },
110
125
  right: {
111
126
  type: Boolean,
112
127
  default: boolean('right', false),
@@ -134,6 +149,9 @@ function wrap([template]) {
134
149
  :hide-header-border="hideHeaderBorder"
135
150
  :show-clear-all="showClearAll"
136
151
  :clear-all-text="clearAllText"
152
+ :show-highlighted-items-title="showHighlightedItemsTitle"
153
+ :highlighted-items-title="highlightedItemsTitle"
154
+ :highlighted-items-title-class="highlightedItemsTitleClass"
137
155
  :loading="loading"
138
156
  :right="right"
139
157
  >
@@ -445,6 +463,7 @@ documentedStoriesOf('base/dropdown', readme)
445
463
  text: 'Some dropdown',
446
464
  showClearAll: true,
447
465
  clearAllText: 'Clear all',
466
+ highlightedItemsTitleClass: 'gl-px-5',
448
467
  }),
449
468
  components,
450
469
  template: wrap`
@@ -457,4 +476,27 @@ documentedStoriesOf('base/dropdown', readme)
457
476
  updated() {
458
477
  addClass(this);
459
478
  },
479
+ }))
480
+ .add('with highlighted items', () => ({
481
+ props: generateProps({
482
+ text: 'Some dropdown',
483
+ showHighlightedItemsTitle: true,
484
+ highlightedItemsTitle: 'Highlights',
485
+ highlightedItemsTitleClass: 'gl-px-5',
486
+ }),
487
+ components,
488
+ template: wrap`
489
+ <template #highlighted-items>
490
+ <gl-dropdown-item :is-check-item="true" :is-checked="true">First item</gl-dropdown-item>
491
+ <gl-dropdown-item :is-check-item="true" :is-checked="true">Second item</gl-dropdown-item>
492
+ </template>
493
+ <gl-dropdown-item>Third item</gl-dropdown-item>
494
+ <gl-dropdown-item>Fourth item</gl-dropdown-item>
495
+ `,
496
+ mounted() {
497
+ clickDropdown(this);
498
+ },
499
+ updated() {
500
+ addClass(this);
501
+ },
460
502
  }));
@@ -10,6 +10,7 @@ import ButtonMixin from '../../mixins/button_mixin';
10
10
  import GlButton from '../button/button.vue';
11
11
  import GlIcon from '../icon/icon.vue';
12
12
  import GlLoadingIcon from '../loading_icon/loading_icon.vue';
13
+ import GlDropdownDivider from './dropdown_divider.vue';
13
14
 
14
15
  // Return an Array of visible items
15
16
  function filterVisible(els) {
@@ -35,6 +36,7 @@ export default {
35
36
  components: {
36
37
  BDropdown: ExtendedBDropdown,
37
38
  GlButton,
39
+ GlDropdownDivider,
38
40
  GlIcon,
39
41
  GlLoadingIcon,
40
42
  },
@@ -65,6 +67,21 @@ export default {
65
67
  required: false,
66
68
  default: '',
67
69
  },
70
+ showHighlightedItemsTitle: {
71
+ type: Boolean,
72
+ required: false,
73
+ default: true,
74
+ },
75
+ highlightedItemsTitle: {
76
+ type: String,
77
+ required: false,
78
+ default: 'Selected',
79
+ },
80
+ highlightedItemsTitleClass: {
81
+ type: String,
82
+ required: false,
83
+ default: 'gl-px-5',
84
+ },
68
85
  textSrOnly: {
69
86
  type: Boolean,
70
87
  required: false,
@@ -166,6 +183,12 @@ export default {
166
183
  buttonText() {
167
184
  return this.split && this.icon ? null : this.text;
168
185
  },
186
+ hasHighlightedItemsContent() {
187
+ return this.hasSlotContents('highlighted-items');
188
+ },
189
+ hasHighlightedItemsOrClearAll() {
190
+ return this.showHighlightedItemsTitle || this.showClearAll;
191
+ },
169
192
  },
170
193
  methods: {
171
194
  hasSlotContents(slotName) {
@@ -180,7 +203,6 @@ export default {
180
203
  },
181
204
  };
182
205
  </script>
183
-
184
206
  <template>
185
207
  <b-dropdown
186
208
  ref="dropdown"
@@ -207,17 +229,40 @@ export default {
207
229
  </p>
208
230
  <slot name="header"></slot>
209
231
  </div>
210
- <div v-if="showClearAll" class="gl-text-right gl-px-5">
211
- <gl-button
212
- size="small"
213
- category="tertiary"
214
- variant="link"
215
- data-testid="clear-all-button"
216
- @click="$emit('clear-all')"
217
- >{{ clearAllText }}</gl-button
218
- >
232
+ <div
233
+ v-if="hasHighlightedItemsOrClearAll"
234
+ class="gl-display-flex gl-flex-direction-row gl-justify-content-space-between gl-align-items-center"
235
+ :class="highlightedItemsTitleClass"
236
+ >
237
+ <div class="gl-display-flex">
238
+ <span
239
+ v-if="hasHighlightedItemsContent && showHighlightedItemsTitle"
240
+ class="gl-font-weight-bold"
241
+ data-testid="highlighted-items-title"
242
+ >{{ highlightedItemsTitle }}</span
243
+ >
244
+ </div>
245
+ <div class="gl-display-flex">
246
+ <gl-button
247
+ v-if="showClearAll"
248
+ size="small"
249
+ category="tertiary"
250
+ variant="link"
251
+ data-testid="clear-all-button"
252
+ @click="$emit('clear-all')"
253
+ >{{ clearAllText }}</gl-button
254
+ >
255
+ </div>
219
256
  </div>
220
257
  <div class="gl-new-dropdown-contents">
258
+ <div
259
+ v-if="hasHighlightedItemsContent"
260
+ class="gl-overflow-visible"
261
+ data-testid="highlighted-items"
262
+ >
263
+ <slot name="highlighted-items"></slot>
264
+ <gl-dropdown-divider />
265
+ </div>
221
266
  <slot></slot>
222
267
  </div>
223
268
  <div v-if="hasSlotContents('footer')" class="gl-new-dropdown-footer">
@@ -0,0 +1,9 @@
1
+ <template>
2
+ <gl-dropdown text="Some dropdown">
3
+ <template #highlighted-items>
4
+ <gl-dropdown-item>First item</gl-dropdown-item>
5
+ <gl-dropdown-item>Second item</gl-dropdown-item>
6
+ </template>
7
+ <gl-dropdown-item>Last item</gl-dropdown-item>
8
+ </gl-dropdown>
9
+ </template>
@@ -6,6 +6,7 @@ import DropdownClearAllExample from './dropdown.with_clear_all.example.vue';
6
6
  import DropdownWithDividerExample from './dropdown.with_divider.example.vue';
7
7
  import DropdownWithFormExample from './dropdown.with_form.example.vue';
8
8
  import DropdownWithHeaderExample from './dropdown.with_header.example.vue';
9
+ import DropdownWithHighlightedItemsExample from './dropdown.with_highlighted_items.example.vue';
9
10
  import DropdownWithIcons from './dropdown.with_icons.example.vue';
10
11
  import DropdownWithRightAlignExample from './dropdown.with_right_align.example.vue';
11
12
  import DropdownWithSearchExample from './dropdown.with_search.example.vue';
@@ -39,6 +40,12 @@ export default [
39
40
  description: 'Dropdown with section header',
40
41
  component: DropdownWithHeaderExample,
41
42
  },
43
+ {
44
+ id: 'new-dropdown-with-highlighted-items',
45
+ name: 'With Highlighted items',
46
+ description: 'Dropdown with highlighted items',
47
+ component: DropdownWithHighlightedItemsExample,
48
+ },
42
49
  {
43
50
  id: 'new-dropdown-with-section-headers',
44
51
  name: 'With Section Headers',
@@ -118,7 +118,8 @@
118
118
  @include gl-line-height-20;
119
119
  }
120
120
 
121
- .monospace {
121
+ .monospace,
122
+ code {
122
123
  @include gl-font-monospace;
123
124
  @include gl-font-size-monospace-lg;
124
125
  @include gl-line-height-24;
@@ -153,6 +154,14 @@
153
154
  .addition {
154
155
  @include gl-bg-green-100;
155
156
  }
157
+
158
+ code {
159
+ @include gl-bg-gray-50;
160
+ @include gl-text-gray-950;
161
+ @include gl-rounded-base;
162
+ @include gl-px-2;
163
+ @include gl-py-1;
164
+ }
156
165
  }
157
166
 
158
167
  .gl-compact-markdown {
@@ -224,7 +233,8 @@
224
233
  @include gl-font-sm;
225
234
  }
226
235
 
227
- .monospace {
236
+ .monospace,
237
+ code {
228
238
  @include gl-font-monospace;
229
239
  @include gl-font-size-monospace;
230
240
  @include gl-line-height-20;
@@ -38,4 +38,6 @@ merge requests, milestones, snippets and more.</p>
38
38
  This is a paragraph with two types inline diff <span class="idiff addition">addition</span> and
39
39
  <span class="idiff deletion">deletion</span>
40
40
  </p>
41
-
41
+ <p>
42
+ This block implements the "GitLab Flavored Markdown" <code>Code span</code> styles.
43
+ </p>
@@ -83,33 +83,18 @@ Object {
83
83
  },
84
84
  "type": "category",
85
85
  },
86
- "yAxis": Array [
87
- Object {
88
- "axisLabel": Object {
89
- "formatter": [Function],
90
- },
91
- "axisTick": Object {
92
- "show": false,
93
- },
94
- "name": "y axis",
95
- "nameGap": 50,
96
- "nameLocation": "center",
97
- "type": "value",
86
+ "yAxis": Object {
87
+ "axisLabel": Object {
88
+ "formatter": [Function],
98
89
  },
99
- Object {
100
- "axisLabel": Object {
101
- "formatter": [Function],
102
- },
103
- "axisTick": Object {
104
- "show": false,
105
- },
106
- "name": "",
107
- "nameGap": 50,
108
- "nameLocation": "center",
90
+ "axisTick": Object {
109
91
  "show": false,
110
- "type": "value",
111
92
  },
112
- ],
93
+ "name": "y axis",
94
+ "nameGap": 50,
95
+ "nameLocation": "center",
96
+ "type": "value",
97
+ },
113
98
  }
114
99
  `;
115
100
 
@@ -190,33 +175,18 @@ Object {
190
175
  },
191
176
  "type": "category",
192
177
  },
193
- "yAxis": Array [
194
- Object {
195
- "axisLabel": Object {
196
- "formatter": [Function],
197
- },
198
- "axisTick": Object {
199
- "show": false,
200
- },
201
- "name": "y axis",
202
- "nameGap": 50,
203
- "nameLocation": "center",
204
- "type": "value",
178
+ "yAxis": Object {
179
+ "axisLabel": Object {
180
+ "formatter": [Function],
205
181
  },
206
- Object {
207
- "axisLabel": Object {
208
- "formatter": [Function],
209
- },
210
- "axisTick": Object {
211
- "show": false,
212
- },
213
- "name": "",
214
- "nameGap": 50,
215
- "nameLocation": "center",
182
+ "axisTick": Object {
216
183
  "show": false,
217
- "type": "value",
218
184
  },
219
- ],
185
+ "name": "y axis",
186
+ "nameGap": 50,
187
+ "nameLocation": "center",
188
+ "type": "value",
189
+ },
220
190
  }
221
191
  `;
222
192
 
@@ -118,6 +118,11 @@ export default {
118
118
  return [...this.barSeries, ...this.lineSeries, ...this.secondarySeries];
119
119
  },
120
120
  options() {
121
+ const yAxisPrimary = {
122
+ ...yAxisDefaults,
123
+ name: this.yAxisTitle,
124
+ };
125
+
121
126
  const mergedOptions = merge(
122
127
  {},
123
128
  defaultChartOptions,
@@ -142,17 +147,16 @@ export default {
142
147
  name: this.xAxisTitle,
143
148
  type: this.xAxisType,
144
149
  },
145
- yAxis: [
146
- {
147
- ...yAxisDefaults,
148
- name: this.yAxisTitle,
149
- },
150
- {
151
- ...yAxisDefaults,
152
- name: this.secondaryDataTitle,
153
- show: this.hasSecondaryAxis,
154
- },
155
- ],
150
+ yAxis: this.hasSecondaryAxis
151
+ ? [
152
+ yAxisPrimary,
153
+ {
154
+ ...yAxisDefaults,
155
+ name: this.secondaryDataTitle,
156
+ show: this.hasSecondaryAxis,
157
+ },
158
+ ]
159
+ : yAxisPrimary,
156
160
  legend: {
157
161
  show: false,
158
162
  },
@@ -1863,19 +1863,19 @@
1863
1863
  }
1864
1864
 
1865
1865
  .gl-shadow {
1866
- box-shadow: 0 1px 4px 0 rgba($black, 0.3)
1866
+ box-shadow: 0 1px 4px 0 rgba(#000, 0.3)
1867
1867
  }
1868
1868
 
1869
1869
  .gl-shadow\! {
1870
- box-shadow: 0 1px 4px 0 rgba($black, 0.3) !important
1870
+ box-shadow: 0 1px 4px 0 rgba(#000, 0.3) !important
1871
1871
  }
1872
1872
 
1873
1873
  .gl-shadow-x0-y2-b4-s0 {
1874
- box-shadow: 0 2px 4px 0 rgba($black, 0.1)
1874
+ box-shadow: 0 2px 4px 0 rgba(#000, 0.1)
1875
1875
  }
1876
1876
 
1877
1877
  .gl-shadow-x0-y2-b4-s0\! {
1878
- box-shadow: 0 2px 4px 0 rgba($black, 0.1) !important
1878
+ box-shadow: 0 2px 4px 0 rgba(#000, 0.1) !important
1879
1879
  }
1880
1880
 
1881
1881
  .gl-shadow-blue-200-x0-y0-b4-s2 {
@@ -133,11 +133,11 @@
133
133
  }
134
134
 
135
135
  @mixin gl-shadow {
136
- box-shadow: 0 1px 4px 0 rgba($black, 0.3);
136
+ box-shadow: 0 1px 4px 0 rgba(#000, 0.3);
137
137
  }
138
138
 
139
139
  @mixin gl-shadow-x0-y2-b4-s0 {
140
- box-shadow: 0 2px 4px 0 rgba($black, 0.1);
140
+ box-shadow: 0 2px 4px 0 rgba(#000, 0.1);
141
141
  }
142
142
 
143
143
  @mixin gl-shadow-blue-200-x0-y0-b4-s2 {
@@ -282,8 +282,8 @@ $darken-border-dashed-factor: 25%;
282
282
  $t-gray-a-02: rgba($black, 0.02);
283
283
  $t-gray-a-04: rgba($black, 0.04);
284
284
  $t-gray-a-06: rgba($black, 0.06);
285
- $t-gray-a-08: rgba($black, 0.08);
286
- $t-gray-a-24: rgba($black, 0.24);
285
+ $t-gray-a-08: rgba(#000, 0.08);
286
+ $t-gray-a-24: rgba(#000, 0.24);
287
287
 
288
288
  // Text
289
289
  $gl-font-weight-light: 300;
@@ -443,6 +443,7 @@ $gl-modal-large-width: px-to-rem(990px);
443
443
  $modal-header-border-color: $gray-200;
444
444
  $modal-footer-border-color: $gray-200;
445
445
  $modal-title-line-height: $gl-line-height-20;
446
+ $modal-backdrop: #000;
446
447
  $modal-backdrop-opacity: 0.64;
447
448
 
448
449
  // Bootstrap overrides
@@ -109,6 +109,12 @@ export const newButtonVariantOptions = {
109
109
  reset: 'gl-reset',
110
110
  };
111
111
 
112
+ export const badgeForButtonOptions = {
113
+ [newButtonVariantOptions.default]: badgeVariantOptions.neutral,
114
+ [newButtonVariantOptions.confirm]: badgeVariantOptions.info,
115
+ [newButtonVariantOptions.danger]: badgeVariantOptions.danger,
116
+ };
117
+
112
118
  export const newDropdownVariantOptions = {
113
119
  default: 'default',
114
120
  confirm: 'confirm',