@gitlab/ui 71.1.1 → 71.3.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.
@@ -1,6 +1,6 @@
1
1
 
2
2
  // Do not edit directly
3
- // Generated on Tue, 28 Nov 2023 15:59:58 GMT
3
+ // Generated on Mon, 04 Dec 2023 02:31:35 GMT
4
4
 
5
5
  $red-950: #fff4f3;
6
6
  $red-900: #fcf1ef;
@@ -71,3 +71,124 @@ $blue-100: #064787;
71
71
  $blue-50: #033464;
72
72
  $white: #333238;
73
73
  $black: #fff;
74
+ $theme-light-red-950: #faf2f1;
75
+ $theme-light-red-900: #f6d9d5;
76
+ $theme-light-red-800: #ebada2;
77
+ $theme-light-red-700: #e07f6f;
78
+ $theme-light-red-600: #d36250;
79
+ $theme-light-red-500: #c24b38;
80
+ $theme-light-red-400: #b53a26;
81
+ $theme-light-red-300: #a02e1c;
82
+ $theme-light-red-200: #8b2212;
83
+ $theme-light-red-100: #751709;
84
+ $theme-light-red-50: #5c1105;
85
+ $theme-red-950: #f4e9e7;
86
+ $theme-red-900: #ecd3d0;
87
+ $theme-red-800: #e3bab5;
88
+ $theme-red-700: #d59086;
89
+ $theme-red-600: #c66e60;
90
+ $theme-red-500: #ad4a3b;
91
+ $theme-red-400: #a13322;
92
+ $theme-red-300: #8f2110;
93
+ $theme-red-200: #761405;
94
+ $theme-red-100: #580d02;
95
+ $theme-red-50: #380700;
96
+ $theme-green-950: #dde9de;
97
+ $theme-green-900: #b1d6b5;
98
+ $theme-green-800: #8cc497;
99
+ $theme-green-700: #69af7d;
100
+ $theme-green-600: #499767;
101
+ $theme-green-500: #308258;
102
+ $theme-green-400: #25744c;
103
+ $theme-green-300: #1b653f;
104
+ $theme-green-200: #155635;
105
+ $theme-green-100: #0e4328;
106
+ $theme-green-50: #052e19;
107
+ $theme-light-blue-950: #dde6ee;
108
+ $theme-light-blue-900: #c1d4e6;
109
+ $theme-light-blue-800: #a0bedc;
110
+ $theme-light-blue-700: #74a3d3;
111
+ $theme-light-blue-600: #4f8bc7;
112
+ $theme-light-blue-500: #3476b9;
113
+ $theme-light-blue-400: #2268ae;
114
+ $theme-light-blue-300: #145aa1;
115
+ $theme-light-blue-200: #0e4d8d;
116
+ $theme-light-blue-100: #0c4277;
117
+ $theme-light-blue-50: #0a3764;
118
+ $theme-blue-950: #cdd8e3;
119
+ $theme-blue-900: #b9cadc;
120
+ $theme-blue-800: #a6bdd5;
121
+ $theme-blue-700: #81a5c9;
122
+ $theme-blue-600: #628eb9;
123
+ $theme-blue-500: #4977a5;
124
+ $theme-blue-400: #346596;
125
+ $theme-blue-300: #235180;
126
+ $theme-blue-200: #153c63;
127
+ $theme-blue-100: #0b2640;
128
+ $theme-blue-50: #04101c;
129
+ $theme-indigo-950: #f1f1ff;
130
+ $theme-indigo-900: #dbdbf8;
131
+ $theme-indigo-800: #c7c7f2;
132
+ $theme-indigo-700: #a2a2e6;
133
+ $theme-indigo-600: #8181d7;
134
+ $theme-indigo-500: #6666c4;
135
+ $theme-indigo-400: #5252b5;
136
+ $theme-indigo-300: #41419f;
137
+ $theme-indigo-200: #303083;
138
+ $theme-indigo-100: #222261;
139
+ $theme-indigo-50: #14143d;
140
+ $data-viz-orange-950: #fae8d1;
141
+ $data-viz-orange-900: #f5d6b3;
142
+ $data-viz-orange-800: #eebd8c;
143
+ $data-viz-orange-700: #e99b60;
144
+ $data-viz-orange-600: #e07e41;
145
+ $data-viz-orange-500: #c95d2e;
146
+ $data-viz-orange-400: #b14f18;
147
+ $data-viz-orange-300: #92430a;
148
+ $data-viz-orange-200: #6f3500;
149
+ $data-viz-orange-100: #5e2f05;
150
+ $data-viz-orange-50: #4b2707;
151
+ $data-viz-magenta-950: #ffe3eb;
152
+ $data-viz-magenta-900: #ffccdb;
153
+ $data-viz-magenta-800: #fcacc5;
154
+ $data-viz-magenta-700: #f88aaf;
155
+ $data-viz-magenta-600: #e86e9a;
156
+ $data-viz-magenta-500: #cf4d81;
157
+ $data-viz-magenta-400: #b93d71;
158
+ $data-viz-magenta-300: #9a2e5d;
159
+ $data-viz-magenta-200: #7c214f;
160
+ $data-viz-magenta-100: #661e3a;
161
+ $data-viz-magenta-50: #541d31;
162
+ $data-viz-blue-950: #e9ebff;
163
+ $data-viz-blue-900: #d2dcff;
164
+ $data-viz-blue-800: #b7c6ff;
165
+ $data-viz-blue-700: #97acff;
166
+ $data-viz-blue-600: #7992f5;
167
+ $data-viz-blue-500: #617ae2;
168
+ $data-viz-blue-400: #4e65cd;
169
+ $data-viz-blue-300: #3f51ae;
170
+ $data-viz-blue-200: #374291;
171
+ $data-viz-blue-100: #303470;
172
+ $data-viz-blue-50: #2a2b59;
173
+ $data-viz-aqua-950: #b5fefd;
174
+ $data-viz-aqua-900: #93f2ef;
175
+ $data-viz-aqua-800: #5edee3;
176
+ $data-viz-aqua-700: #32c5d2;
177
+ $data-viz-aqua-600: #00acc4;
178
+ $data-viz-aqua-500: #0090b1;
179
+ $data-viz-aqua-400: #007b9b;
180
+ $data-viz-aqua-300: #006381;
181
+ $data-viz-aqua-200: #00516c;
182
+ $data-viz-aqua-100: #004059;
183
+ $data-viz-aqua-50: #00344b;
184
+ $data-viz-green-950: #ddfab7;
185
+ $data-viz-green-900: #c6ed94;
186
+ $data-viz-green-800: #b0d97b;
187
+ $data-viz-green-700: #94c25e;
188
+ $data-viz-green-600: #81ac41;
189
+ $data-viz-green-500: #619025;
190
+ $data-viz-green-400: #4e7f0e;
191
+ $data-viz-green-300: #366800;
192
+ $data-viz-green-200: #275600;
193
+ $data-viz-green-100: #1a4500;
194
+ $data-viz-green-50: #133a03;
@@ -1,6 +1,6 @@
1
1
 
2
2
  // Do not edit directly
3
- // Generated on Tue, 28 Nov 2023 15:59:58 GMT
3
+ // Generated on Mon, 04 Dec 2023 02:31:35 GMT
4
4
 
5
5
  $gl-line-height-52: 3.25rem;
6
6
  $gl-line-height-44: 2.75rem;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gitlab/ui",
3
- "version": "71.1.1",
3
+ "version": "71.3.0",
4
4
  "description": "GitLab UI Components",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -66,23 +66,38 @@
66
66
  .gl-badge {
67
67
  @include gl-display-inline-flex;
68
68
  @include gl-align-items-center;
69
- @include gl-font-sm;
69
+ @include gl-justify-content-center;
70
70
  @include gl-font-weight-normal;
71
71
  @include gl-line-height-normal;
72
- @include gl-py-2;
73
- @include gl-px-3;
74
72
 
75
73
  &.sm {
76
74
  @include gl-py-0;
75
+ @include gl-px-3;
76
+ @include gl-gap-2;
77
+ @include gl-font-sm;
78
+
79
+ min-height: 1rem;
80
+ min-width: 1rem;
77
81
  }
78
82
 
79
83
  &.md {
80
84
  @include gl-py-2;
85
+ @include gl-px-3;
86
+ @include gl-gap-2;
87
+ @include gl-font-sm;
88
+
89
+ min-height: 1.5rem;
90
+ min-width: 1.5rem;
81
91
  }
82
92
 
83
93
  &.lg {
84
94
  @include gl-py-3;
95
+ @include gl-px-4;
96
+ @include gl-gap-2;
85
97
  @include gl-font-base;
98
+
99
+ min-height: 2rem;
100
+ min-width: 2rem;
86
101
  }
87
102
 
88
103
  .gl-badge-icon {
@@ -91,6 +106,28 @@
91
106
  @include gl-flex-shrink-0;
92
107
  @include gl-top-auto;
93
108
  }
109
+
110
+ &.gl-badge-round-icon.gl-badge-icon-only {
111
+ @include gl-px-0;
112
+ }
113
+
114
+ &.sm.gl-badge-round-icon:not(.gl-badge-icon-only) {
115
+ @include gl-pl-1;
116
+ }
117
+
118
+ &.md.gl-badge-round-icon:not(.gl-badge-icon-only) {
119
+ .gl-badge-icon.s12 {
120
+ @include gl-ml-n1;
121
+ }
122
+
123
+ .gl-badge-icon.s16 {
124
+ @include gl-ml-n2;
125
+ }
126
+ }
127
+
128
+ &.lg.gl-badge-round-icon:not(.gl-badge-icon-only) {
129
+ @include gl-pl-3;
130
+ }
94
131
  }
95
132
 
96
133
  /* Variants */
@@ -39,9 +39,7 @@ describe('badge', () => {
39
39
  });
40
40
 
41
41
  it('with correct class', () => {
42
- const icon = findIcon();
43
-
44
- expect(icon.classes('gl-mr-2')).toBe(hasSlot);
42
+ expect(wrapper.classes('gl-badge-icon-only')).toBe(!hasSlot);
45
43
  });
46
44
 
47
45
  it('with correct size', () => {
@@ -51,6 +49,16 @@ describe('badge', () => {
51
49
  });
52
50
  });
53
51
 
52
+ describe('with "roundIcon" prop', () => {
53
+ beforeEach(() => {
54
+ createComponent({ propsData: { icon: 'warning', roundIcon: true } });
55
+ });
56
+
57
+ it('has `gl-badge-round-icon` class', () => {
58
+ expect(wrapper.classes()).toContain('gl-badge-round-icon');
59
+ });
60
+ });
61
+
54
62
  describe('without "icon" prop', () => {
55
63
  const mockSlotContent = 'slot-content';
56
64
  beforeEach(() => {
@@ -27,6 +27,7 @@ const generateProps = ({
27
27
  content = 'TestBadge',
28
28
  icon = '',
29
29
  iconSize = defaultValue('iconSize'),
30
+ roundIcon = false,
30
31
  } = {}) => ({
31
32
  variant,
32
33
  size,
@@ -34,6 +35,7 @@ const generateProps = ({
34
35
  content,
35
36
  icon,
36
37
  iconSize,
38
+ roundIcon,
37
39
  });
38
40
 
39
41
  const Template = (args, { argTypes }) => ({
@@ -156,6 +158,52 @@ IconOnly.args = generateProps({
156
158
  icon: 'calendar',
157
159
  });
158
160
 
161
+ export const AllVariantsAndCategories = (args, { argTypes }) => ({
162
+ components: { GlBadge },
163
+ props: Object.keys(argTypes),
164
+ template: `
165
+ <div>
166
+ <div class="gl-display-flex gl-gap-3">
167
+ <gl-badge variant="info" size="sm" icon="terminal" iconSize="sm" />
168
+ <gl-badge variant="info" size="sm" icon="cancel" :roundIcon="true" iconSize="sm" />
169
+ <gl-badge variant="info" size="sm" icon="terminal" iconSize="sm">Small</gl-badge>
170
+ <gl-badge variant="info" size="sm" icon="cancel" :roundIcon="true" iconSize="sm">Small</gl-badge>
171
+ <gl-badge variant="info" size="sm">Small</gl-badge>
172
+ <gl-badge variant="info" size="sm">5</gl-badge>
173
+ </div>
174
+ <div class="gl-display-flex gl-gap-3 gl-mt-6">
175
+ <gl-badge variant="info" size="md" icon="terminal" iconSize="sm" />
176
+ <gl-badge variant="info" size="md" icon="cancel" :roundIcon="true" iconSize="sm" />
177
+ <gl-badge variant="info" size="md" icon="terminal" iconSize="sm">Medium</gl-badge>
178
+ <gl-badge variant="info" size="md" icon="cancel" :roundIcon="true" iconSize="sm">Medium</gl-badge>
179
+ <gl-badge variant="info" size="md">Medium</gl-badge>
180
+ </div>
181
+ <div class="gl-display-flex gl-gap-3 gl-mt-3">
182
+ <gl-badge variant="info" size="md" icon="terminal" iconSize="md" />
183
+ <gl-badge variant="info" size="md" icon="cancel" :roundIcon="true" iconSize="md" />
184
+ <gl-badge variant="info" size="md" icon="terminal" iconSize="md">Medium</gl-badge>
185
+ <gl-badge variant="info" size="md" icon="cancel" :roundIcon="true" iconSize="md">Medium</gl-badge>
186
+ <gl-badge variant="info" size="md">5</gl-badge>
187
+ </div>
188
+ <div class="gl-display-flex gl-gap-3 gl-mt-6">
189
+ <gl-badge variant="info" size="lg" icon="terminal" iconSize="md" />
190
+ <gl-badge variant="info" size="lg" icon="cancel" :roundIcon="true" iconSize="md" />
191
+ <gl-badge variant="info" size="lg" icon="terminal" iconSize="md">Large</gl-badge>
192
+ <gl-badge variant="info" size="lg" icon="cancel" :roundIcon="true" iconSize="md">Large</gl-badge>
193
+ <gl-badge variant="info" size="lg">5</gl-badge>
194
+ <gl-badge variant="info" size="lg">Large</gl-badge>
195
+ </div>
196
+ </div>
197
+ `,
198
+ });
199
+ AllVariantsAndCategories.argTypes = disableControls([
200
+ 'iconSize',
201
+ 'icon',
202
+ 'variant',
203
+ 'size',
204
+ 'roundIcon',
205
+ ]);
206
+
159
207
  export default {
160
208
  title: 'base/badge',
161
209
  component: GlBadge,
@@ -55,6 +55,14 @@ export default {
55
55
  validator: (value) => Object.keys(badgeIconSizeOptions).includes(value),
56
56
  required: false,
57
57
  },
58
+ /**
59
+ * Whether the `icon` is round. Affects padding around the icon.
60
+ */
61
+ roundIcon: {
62
+ type: Boolean,
63
+ default: false,
64
+ required: false,
65
+ },
58
66
  },
59
67
  computed: {
60
68
  hasIconOnly() {
@@ -72,14 +80,18 @@ export default {
72
80
  </script>
73
81
 
74
82
  <template>
75
- <b-badge v-bind="$attrs" :variant="variant" :class="['gl-badge', size]" :role="role" pill>
76
- <gl-icon
77
- v-if="icon"
78
- class="gl-badge-icon"
79
- :size="iconSizeComputed"
80
- :class="{ 'gl-mr-2': !hasIconOnly }"
81
- :name="icon"
82
- />
83
+ <b-badge
84
+ v-bind="$attrs"
85
+ :variant="variant"
86
+ :class="[
87
+ 'gl-badge',
88
+ size,
89
+ { 'gl-badge-icon-only': hasIconOnly, 'gl-badge-round-icon': roundIcon },
90
+ ]"
91
+ :role="role"
92
+ pill
93
+ >
94
+ <gl-icon v-if="icon" class="gl-badge-icon" :size="iconSizeComputed" :name="icon" />
83
95
  <!-- @slot The badge content to display. -->
84
96
  <slot></slot>
85
97
  </b-badge>
@@ -22,6 +22,32 @@ export default {
22
22
  </template>
23
23
  ```
24
24
 
25
+ ### When handler expects arguments
26
+
27
+ In case a click handler expects an arument to be passed, simple `v-outside="onClick('foo')"` will
28
+ invoke the handler instantly when mounting the component and the directive won't be active. The
29
+ simplest solution to pass the arguments to the directive is to wrap the handler into an anonumous
30
+ function.
31
+
32
+ ```html
33
+ <script>
34
+ import { GlOutsideDirective as Outside } from '@gitlab/ui';
35
+
36
+ export default {
37
+ directives: { Outside },
38
+ methods: {
39
+ onClick(foo) {
40
+ // This
41
+ },
42
+ },
43
+ };
44
+ </script>
45
+
46
+ <template>
47
+ <div v-outside="() => onClick('foo')">Click anywhere but here</div>
48
+ </template>
49
+ ```
50
+
25
51
  ## Caveats
26
52
 
27
53
  - If a click event is stopped (e.g., via `event.stopPropagation()`) before it