@gitlab/ui 83.0.0 → 84.0.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.
@@ -118,7 +118,7 @@ var ref_item = ref.item;
118
118
  var name = ref_item.name;
119
119
  var deprecated = ref_item.deprecated;
120
120
  var description = ref_item.description;
121
- return [_c('code',{staticClass:"gl-font-base gl-text-strong"},[_vm._v("\n "+_vm._s(name)+"\n ")]),_vm._v(" "),(deprecated)?_c('gl-badge',{attrs:{"size":"sm","variant":"danger"}},[_vm._v("Deprecated")]):_vm._e(),_vm._v(" "),(description)?_c('div',{staticClass:"gl-mt-3 gl-text-subtle"},[_vm._v("\n "+_vm._s(description)+"\n ")]):_vm._e()]}},{key:"cell(value)",fn:function(ref){
121
+ return [_c('code',{staticClass:"gl-font-base gl-text-strong"},[_vm._v("\n "+_vm._s(name)+"\n ")]),_vm._v(" "),(deprecated)?_c('gl-badge',{attrs:{"variant":"danger"}},[_vm._v("Deprecated")]):_vm._e(),_vm._v(" "),(description)?_c('div',{staticClass:"gl-mt-3 gl-text-subtle"},[_vm._v("\n "+_vm._s(description)+"\n ")]):_vm._e()]}},{key:"cell(value)",fn:function(ref){
122
122
  var ref_item = ref.item;
123
123
  var type = ref_item.type;
124
124
  var value = ref_item.value;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gitlab/ui",
3
- "version": "83.0.0",
3
+ "version": "84.0.0",
4
4
  "description": "GitLab UI Components",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -1,3 +1,6 @@
1
+ $badge-padding-horizontal: 0.75 * $grid-size;
2
+ $badge-min-width: 2.5 * $grid-size;
3
+
1
4
  @mixin gl-badge-variant(
2
5
  $variant,
3
6
  $color,
@@ -15,7 +18,6 @@
15
18
  color: $color;
16
19
 
17
20
  .gl-badge-icon {
18
- color: $icon-color;
19
21
  transition: inherit;
20
22
  }
21
23
  }
@@ -66,29 +68,18 @@
66
68
  .gl-badge {
67
69
  @include gl-display-inline-flex;
68
70
  @include gl-align-items-center;
71
+ @include gl-justify-content-center;
69
72
  @include gl-font-sm;
70
73
  @include gl-font-weight-normal;
71
74
  @include gl-line-height-normal;
72
- @include gl-py-2;
73
- @include gl-px-3;
75
+ gap: $gl-spacing-scale-2;
76
+ padding: $gl-spacing-scale-1 $badge-padding-horizontal;
77
+ min-width: $badge-min-width;
74
78
 
75
79
  @media (forced-colors: active) {
76
80
  border: 1px solid;
77
81
  }
78
82
 
79
- &.sm {
80
- @include gl-py-0;
81
- }
82
-
83
- &.md {
84
- @include gl-py-2;
85
- }
86
-
87
- &.lg {
88
- @include gl-py-3;
89
- @include gl-font-base;
90
- }
91
-
92
83
  .gl-badge-icon {
93
84
  @include gl-h-5;
94
85
  @include gl-w-5;
@@ -193,4 +184,11 @@
193
184
  // overriding Bootstap's `.btn .badge {top: -1px}` as the badge is not vertically centered otherwise
194
185
  .gl-button .gl-badge {
195
186
  top: 0;
187
+ @include gl-py-0;
188
+ @include gl-px-2;
189
+ }
190
+
191
+ .gl-new-dropdown-contents .gl-badge,
192
+ .gl-tab-nav-item .gl-badge {
193
+ @include gl-my-n1;
196
194
  }
@@ -1,11 +1,7 @@
1
1
  <!-- eslint-disable vue/multi-word-component-names -->
2
2
  <script>
3
3
  import { BBadge } from 'bootstrap-vue';
4
- import {
5
- badgeSizeOptions,
6
- badgeVariantOptions,
7
- badgeIconSizeOptions,
8
- } from '../../../utils/constants';
4
+ import { badgeVariantOptions, badgeIconSizeOptions } from '../../../utils/constants';
9
5
  import GlIcon from '../icon/icon.vue';
10
6
 
11
7
  export default {
@@ -16,17 +12,6 @@ export default {
16
12
  },
17
13
  inheritAttrs: false,
18
14
  props: {
19
- /**
20
- * The size of the badge.
21
- */
22
- size: {
23
- type: String,
24
- default: badgeSizeOptions.md,
25
- validator(value) {
26
- return badgeSizeOptions[value] !== undefined;
27
- },
28
- required: false,
29
- },
30
15
  /**
31
16
  * The variant of the badge.
32
17
  */
@@ -61,6 +46,9 @@ export default {
61
46
  // eslint-disable-next-line @gitlab/vue-prefer-dollar-scopedslots
62
47
  return Boolean(this.icon && Object.keys(this.$slots).length === 0);
63
48
  },
49
+ isCircularIcon() {
50
+ return ['issue-open-m', 'issue-close'].includes(this.icon);
51
+ },
64
52
  role() {
65
53
  return this.hasIconOnly ? 'img' : undefined;
66
54
  },
@@ -82,7 +70,8 @@ export default {
82
70
  <b-badge
83
71
  v-bind="$attrs"
84
72
  :variant="variant"
85
- :class="['gl-badge', size]"
73
+ class="gl-badge"
74
+ :class="{ 'gl-px-2!': !$scopedSlots.default }"
86
75
  :role="role"
87
76
  :aria-label="ariaLabel"
88
77
  pill
@@ -91,7 +80,7 @@ export default {
91
80
  v-if="icon"
92
81
  class="gl-badge-icon"
93
82
  :size="iconSizeComputed"
94
- :class="{ 'gl-mr-2': !hasIconOnly }"
83
+ :class="{ '-gl-ml-2 gl-ml-n2': isCircularIcon }"
95
84
  :name="icon"
96
85
  />
97
86
  <!-- @slot The badge content to display. -->
@@ -1,5 +1,7 @@
1
1
  $label-max-width: 100%;
2
2
  $label-close-button: '.gl-label-close.gl-button';
3
+ $label-padding-horizontal: 0.75 * $grid-size;
4
+ $label-padding-horizontal-half: 0.375 * $grid-size;
3
5
 
4
6
  .gl-label {
5
7
  @include gl-align-items-center;
@@ -45,7 +47,7 @@ $label-close-button: '.gl-label-close.gl-button';
45
47
  .gl-label-text,
46
48
  .gl-label-text-scoped {
47
49
  @include gl-display-block;
48
- padding: $gl-spacing-scale-1 #{$gl-spacing-scale-3 - $gl-spacing-scale-1};
50
+ padding: $gl-spacing-scale-1 $label-padding-horizontal;
49
51
  @include str-truncated($label-max-width);
50
52
  }
51
53
 
@@ -54,8 +56,8 @@ $label-close-button: '.gl-label-close.gl-button';
54
56
  @include gl-display-flex;
55
57
  width: px-to-rem(14px);
56
58
  height: px-to-rem(14px);
57
- margin-left: calc(#{-$gl-spacing-scale-1} - (#{$gl-spacing-scale-1} / 2));
58
- margin-right: calc(#{$gl-spacing-scale-2} - (#{$gl-spacing-scale-1} / 2));
59
+ margin-left: -$label-padding-horizontal-half;
60
+ margin-right: $label-padding-horizontal-half;
59
61
  @include gl-p-0;
60
62
  @include gl-rounded-full;
61
63
  @include gl-shadow-none;
@@ -152,7 +154,7 @@ $label-close-button: '.gl-label-close.gl-button';
152
154
  }
153
155
 
154
156
  #{$label-close-button} {
155
- margin-left: #{-$gl-spacing-scale-2 - $gl-spacing-scale-1};
157
+ margin-left: #{-$label-padding-horizontal};
156
158
 
157
159
  &:focus,
158
160
  &:hover {
@@ -172,7 +174,7 @@ $label-close-button: '.gl-label-close.gl-button';
172
174
 
173
175
  .gl-label-text-scoped {
174
176
  @include gl-text-gray-950;
175
- padding-left: #{$gl-spacing-scale-3 - $gl-spacing-scale-2};
177
+ padding-left: $gl-spacing-scale-2;
176
178
  padding-right: $gl-spacing-scale-3;
177
179
  }
178
180
  }
@@ -80,7 +80,7 @@ export default {
80
80
  </script>
81
81
 
82
82
  <template>
83
- <gl-badge :id="triggerId" class="gl-mx-4 gl-hover-cursor-pointer" variant="neutral" size="md">
83
+ <gl-badge :id="triggerId" class="gl-mx-4 gl-hover-cursor-pointer" variant="neutral">
84
84
  <span>{{ activeType.BADGE }}</span>
85
85
  <gl-popover
86
86
  triggers="click"
@@ -142,7 +142,7 @@ export default {
142
142
  <code class="gl-font-base gl-text-strong">
143
143
  {{ name }}
144
144
  </code>
145
- <gl-badge v-if="deprecated" size="sm" variant="danger">Deprecated</gl-badge>
145
+ <gl-badge v-if="deprecated" variant="danger">Deprecated</gl-badge>
146
146
  <div v-if="description" class="gl-mt-3 gl-text-subtle">
147
147
  {{ description }}
148
148
  </div>