@gitlab/ui 43.11.0 → 43.12.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": "43.11.0",
3
+ "version": "43.12.0",
4
4
  "description": "GitLab UI Components",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -26,6 +26,7 @@ export const breakpointLg = '992px'
26
26
  export const breakpointXl = '1200px'
27
27
  export const breakpoints = '(xs: 0, sm: 576px, md: 768px, lg: 992px, xl: 1200px)'
28
28
  export const limitedLayoutWidth = '990px'
29
+ export const containerXl = '1280px'
29
30
  export const black = '#000'
30
31
  export const blackNormal = '#333'
31
32
  export const white = '#fff'
@@ -167,6 +167,11 @@
167
167
  "value": "990px",
168
168
  "compiledValue": "990px"
169
169
  },
170
+ {
171
+ "name": "$container-xl",
172
+ "value": "1280px",
173
+ "compiledValue": "1280px"
174
+ },
170
175
  {
171
176
  "name": "$black",
172
177
  "value": "#000",
@@ -79,6 +79,7 @@ const generateProps = ({
79
79
  textSrOnly = defaultValue('textSrOnly'),
80
80
  icon = '',
81
81
  multiple = defaultValue('multiple'),
82
+ isCheckCentered = defaultValue('isCheckCentered'),
82
83
  ariaLabelledby,
83
84
  startOpened = true,
84
85
  } = {}) => ({
@@ -94,6 +95,7 @@ const generateProps = ({
94
95
  textSrOnly,
95
96
  icon,
96
97
  multiple,
98
+ isCheckCentered,
97
99
  ariaLabelledby,
98
100
  startOpened,
99
101
  });
@@ -120,6 +122,7 @@ const template = (content, label = '') => `
120
122
  :text-sr-only="textSrOnly"
121
123
  :icon="icon"
122
124
  :multiple="multiple"
125
+ :is-check-centered="isCheckCentered"
123
126
  :aria-labelledby="ariaLabelledby"
124
127
  >
125
128
  ${content}
@@ -183,7 +186,10 @@ export const HeaderAndFooter = (args, { argTypes }) => ({
183
186
  </div>
184
187
  </template>`),
185
188
  });
186
- HeaderAndFooter.args = generateProps({ toggleText: 'Header and Footer', multiple: true });
189
+ HeaderAndFooter.args = generateProps({
190
+ toggleText: 'Header and Footer',
191
+ multiple: true,
192
+ });
187
193
  HeaderAndFooter.decorators = [makeContainer({ height: '370px' })];
188
194
 
189
195
  export const CustomListItem = (args, { argTypes }) => ({
@@ -225,6 +231,7 @@ export const CustomListItem = (args, { argTypes }) => ({
225
231
  :text-sr-only="textSrOnly"
226
232
  :icon="icon"
227
233
  :multiple="multiple"
234
+ :is-check-centered="isCheckCentered"
228
235
  :aria-labelledby="ariaLabelledby"
229
236
  >
230
237
  <template #list-item="{ item }">
@@ -247,6 +254,7 @@ CustomListItem.args = generateProps({
247
254
  { value: 'markian', text: 'Mark Florian', secondaryText: '@markian', icon: 'bin' },
248
255
  ],
249
256
  multiple: true,
257
+ isCheckCentered: true,
250
258
  });
251
259
  CustomListItem.decorators = [makeContainer({ height: '200px' })];
252
260
 
@@ -152,6 +152,14 @@ export default {
152
152
  required: false,
153
153
  default: false,
154
154
  },
155
+ /**
156
+ * Center selected item checkmark
157
+ */
158
+ isCheckCentered: {
159
+ type: Boolean,
160
+ required: false,
161
+ default: false,
162
+ },
155
163
  /**
156
164
  * The `aria-labelledby` attribute value for the toggle button
157
165
  */
@@ -335,6 +343,7 @@ export default {
335
343
  :key="item.value"
336
344
  :is-selected="isSelected(item)"
337
345
  :is-focused="nextFocusedItemIndex === index"
346
+ :is-check-centered="isCheckCentered"
338
347
  @select="onSelect(item, $event)"
339
348
  >
340
349
  <!-- @slot Custom template of the listbox item -->
@@ -80,6 +80,31 @@ describe('GlListboxItem', () => {
80
80
  });
81
81
  });
82
82
 
83
+ describe('checkbox', () => {
84
+ describe('is NOT centered', () => {
85
+ beforeEach(() => {
86
+ buildWrapper({ isSelected: true });
87
+ });
88
+
89
+ it('should not center check icon by default', () => {
90
+ expect(findCheckIcon().classes()).toEqual(
91
+ expect.arrayContaining(['gl-mt-3', 'gl-align-self-start'])
92
+ );
93
+ });
94
+ });
95
+
96
+ describe('is centered', () => {
97
+ beforeEach(() => {
98
+ buildWrapper({ isSelected: true, isCheckCentered: true });
99
+ });
100
+ it('should center the check icon', () => {
101
+ expect(findCheckIcon().classes()).not.toEqual(
102
+ expect.arrayContaining(['gl-mt-3', 'gl-align-self-start'])
103
+ );
104
+ });
105
+ });
106
+ });
107
+
83
108
  describe('tabindex', () => {
84
109
  it('should set tabindex to `-1` when item is not focused', () => {
85
110
  buildWrapper({ isFocused: false });
@@ -18,6 +18,20 @@ export default {
18
18
  default: false,
19
19
  required: false,
20
20
  },
21
+ isCheckCentered: {
22
+ type: Boolean,
23
+ required: false,
24
+ default: false,
25
+ },
26
+ },
27
+ computed: {
28
+ checkedClasses() {
29
+ if (this.isCheckCentered) {
30
+ return '';
31
+ }
32
+
33
+ return 'gl-mt-3 gl-align-self-start';
34
+ },
21
35
  },
22
36
  methods: {
23
37
  toggleSelection() {
@@ -48,8 +62,11 @@ export default {
48
62
  <gl-icon
49
63
  name="mobile-issue-close"
50
64
  data-testid="dropdown-item-checkbox"
51
- class="gl-mt-3 gl-align-self-start"
52
- :class="['gl-new-dropdown-item-check-icon', { 'gl-visibility-hidden': !isSelected }]"
65
+ :class="[
66
+ 'gl-new-dropdown-item-check-icon',
67
+ { 'gl-visibility-hidden': !isSelected },
68
+ checkedClasses,
69
+ ]"
53
70
  />
54
71
  <span class="gl-new-dropdown-item-text-wrapper">
55
72
  <slot></slot>
@@ -4559,6 +4559,14 @@
4559
4559
  max-width: $limited-layout-width !important;
4560
4560
  }
4561
4561
 
4562
+ .gl-max-w-container-xl {
4563
+ max-width: $container-xl;
4564
+ }
4565
+
4566
+ .gl-max-w-container-xl\! {
4567
+ max-width: $container-xl !important;
4568
+ }
4569
+
4562
4570
  .gl-h-auto {
4563
4571
  height: auto;
4564
4572
  }
@@ -155,6 +155,10 @@
155
155
  max-width: $limited-layout-width;
156
156
  }
157
157
 
158
+ @mixin gl-max-w-container-xl {
159
+ max-width: $container-xl;
160
+ }
161
+
158
162
  @mixin gl-h-auto {
159
163
  height: auto;
160
164
  }
@@ -41,6 +41,7 @@ $breakpoints: (
41
41
 
42
42
  // Max widths
43
43
  $limited-layout-width: 990px !default;
44
+ $container-xl: 1280px !default;
44
45
 
45
46
  // Color schema
46
47
  $black: #000 !default;