@gitlab/ui 103.5.1 → 103.6.1

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/CHANGELOG.md CHANGED
@@ -1,3 +1,17 @@
1
+ ## [103.6.1](https://gitlab.com/gitlab-org/gitlab-ui/compare/v103.6.0...v103.6.1) (2024-11-26)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **GlCollapse:** Don't close on nav-link clicks ([d789933](https://gitlab.com/gitlab-org/gitlab-ui/commit/d789933f6cf88d759e8d8c56b00e66e60ec02c9e))
7
+
8
+ # [103.6.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v103.5.1...v103.6.0) (2024-11-26)
9
+
10
+
11
+ ### Features
12
+
13
+ * **Tailwind:** add status design tokens to Tailwind classes ([b57449f](https://gitlab.com/gitlab-org/gitlab-ui/commit/b57449f522dd4c38c58830cc84735658c12a09be))
14
+
1
15
  ## [103.5.1](https://gitlab.com/gitlab-org/gitlab-ui/compare/v103.5.0...v103.5.1) (2024-11-26)
2
16
 
3
17
 
@@ -282,6 +282,32 @@ const brandColors = {
282
282
  },
283
283
  'brand-pink': { '01g': 'var(--gl-color-brand-pink-01g, #ffb9c9)' },
284
284
  };
285
+ const statusBackgroundColors = {
286
+ 'status-neutral':
287
+ 'var(--gl-status-neutral-background-color, var(--gl-color-neutral-100, #dcdcde))',
288
+ 'status-info': 'var(--gl-status-info-background-color, var(--gl-color-blue-100, #cbe2f9))',
289
+ 'status-success': 'var(--gl-status-success-background-color, var(--gl-color-green-100, #c3e6cd))',
290
+ 'status-warning':
291
+ 'var(--gl-status-warning-background-color, var(--gl-color-orange-100, #f5d9a8))',
292
+ 'status-danger': 'var(--gl-status-danger-background-color, var(--gl-color-red-100, #fdd4cd))',
293
+ 'status-brand': 'var(--gl-status-brand-background-color, var(--gl-color-purple-100, #e1d8f9))',
294
+ };
295
+ const statusTextColors = {
296
+ 'status-neutral': 'var(--gl-status-neutral-text-color, var(--gl-color-neutral-700, #4c4b51))',
297
+ 'status-info': 'var(--gl-status-info-text-color, var(--gl-color-blue-700, #0b5cad))',
298
+ 'status-success': 'var(--gl-status-success-text-color, var(--gl-color-green-700, #24663b))',
299
+ 'status-warning': 'var(--gl-status-warning-text-color, var(--gl-color-orange-700, #8f4700))',
300
+ 'status-danger': 'var(--gl-status-danger-text-color, var(--gl-color-red-700, #ae1800))',
301
+ 'status-brand': 'var(--gl-status-brand-text-color, var(--gl-color-purple-700, #5943b6))',
302
+ };
303
+ const statusIconColors = {
304
+ 'status-neutral': 'var(--gl-status-neutral-icon-color, var(--gl-color-neutral-500, #737278))',
305
+ 'status-info': 'var(--gl-status-info-icon-color, var(--gl-color-blue-500, #1f75cb))',
306
+ 'status-success': 'var(--gl-status-success-icon-color, var(--gl-color-green-500, #108548))',
307
+ 'status-warning': 'var(--gl-status-warning-icon-color, var(--gl-color-orange-500, #ab6100))',
308
+ 'status-danger': 'var(--gl-status-danger-icon-color, var(--gl-color-red-500, #dd2b0e))',
309
+ 'status-brand': 'var(--gl-status-brand-icon-color, var(--gl-color-purple-500, #7b58cf))',
310
+ };
285
311
 
286
312
  const colors = {
287
313
  inherit: 'inherit',
@@ -302,6 +328,7 @@ const colors = {
302
328
  const backgroundColor = {
303
329
  ...colors,
304
330
  ...backgroundColors,
331
+ ...statusBackgroundColors,
305
332
  dropdown: 'var(--gl-dropdown-background-color, var(--gl-background-color-overlap, #fff))',
306
333
  };
307
334
 
@@ -317,6 +344,7 @@ const outlineColor = {
317
344
 
318
345
  const fill = {
319
346
  ...colors,
347
+ ...statusIconColors,
320
348
  icon: {
321
349
  ...iconColors,
322
350
  },
@@ -325,6 +353,7 @@ const fill = {
325
353
  const textColor = {
326
354
  ...colors,
327
355
  ...textColors,
356
+ ...statusTextColors,
328
357
  primary: 'var(--gl-text-primary, #28272d)',
329
358
  secondary: 'var(--gl-text-secondary, #737278)',
330
359
  tertiary: 'var(--gl-text-tertiary, #89888d)',
@@ -9,5 +9,20 @@ const disableControls = function () {
9
9
  }
10
10
  }]));
11
11
  };
12
+ const getA11yParameters = function () {
13
+ let {
14
+ skipRules = [],
15
+ temporarySkipRules = []
16
+ } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
17
+ const skippedRules = skipRules.concat(temporarySkipRules).map(id => ({
18
+ id,
19
+ enabled: false
20
+ }));
21
+ return {
22
+ config: {
23
+ rules: skippedRules
24
+ }
25
+ };
26
+ };
12
27
 
13
- export { disableControls };
28
+ export { disableControls, getA11yParameters };
@@ -3,7 +3,6 @@ import { NAME_COLLAPSE } from '../../constants/components';
3
3
  import { EVENT_NAME_SHOW, EVENT_NAME_SHOWN, EVENT_NAME_HIDE, EVENT_NAME_HIDDEN } from '../../constants/events';
4
4
  import { PROP_TYPE_BOOLEAN, PROP_TYPE_STRING } from '../../constants/props';
5
5
  import { SLOT_NAME_DEFAULT } from '../../constants/slots';
6
- import { hasClass, removeClass, getCS, addClass, matches, closest } from '../../utils/dom';
7
6
  import { getRootActionEventName, getRootEventName } from '../../utils/events';
8
7
  import { makeModelMixin } from '../../utils/model';
9
8
  import { sortKeys } from '../../utils/object';
@@ -14,7 +13,6 @@ import { normalizeSlotMixin } from '../../mixins/normalize-slot';
14
13
  import { BVCollapse } from './helpers/bv-collapse';
15
14
 
16
15
  // --- Constants ---
17
- const CLASS_NAME_SHOW = 'show';
18
16
  const ROOT_ACTION_EVENT_NAME_TOGGLE = getRootActionEventName(NAME_COLLAPSE, 'toggle');
19
17
  const ROOT_ACTION_EVENT_NAME_REQUEST_STATE = getRootActionEventName(NAME_COLLAPSE, 'request-state');
20
18
  const ROOT_EVENT_NAME_ACCORDION = getRootEventName(NAME_COLLAPSE, 'accordion');
@@ -157,34 +155,6 @@ const BCollapse = /*#__PURE__*/extend({
157
155
  // It is emitted regardless if the visible state changes
158
156
  this.emitOnRoot(ROOT_EVENT_NAME_SYNC_STATE, this.safeId(), this.show);
159
157
  },
160
- checkDisplayBlock() {
161
- // Check to see if the collapse has `display: block !important` set
162
- // We can't set `display: none` directly on `this.$el`, as it would
163
- // trigger a new transition to start (or cancel a current one)
164
- const {
165
- $el
166
- } = this;
167
- const restore = hasClass($el, CLASS_NAME_SHOW);
168
- removeClass($el, CLASS_NAME_SHOW);
169
- const isBlock = getCS($el).display === 'block';
170
- if (restore) {
171
- addClass($el, CLASS_NAME_SHOW);
172
- }
173
- return isBlock;
174
- },
175
- clickHandler(event) {
176
- const {
177
- target: el
178
- } = event;
179
- /* istanbul ignore next: can't test `getComputedStyle()` in JSDOM */
180
- if (!el || getCS(this.$el).display !== 'block') {
181
- return;
182
- }
183
- // Only close the collapse if it is not forced to be `display: block !important`
184
- if ((matches(el, '.nav-link,.dropdown-item') || closest('.nav-link,.dropdown-item', el)) && !this.checkDisplayBlock()) {
185
- this.show = false;
186
- }
187
- },
188
158
  handleToggleEvent(id) {
189
159
  if (id === this.safeId()) {
190
160
  this.toggle();
@@ -218,9 +188,6 @@ const BCollapse = /*#__PURE__*/extend({
218
188
  }],
219
189
  attrs: {
220
190
  id: this.safeId()
221
- },
222
- on: {
223
- click: this.clickHandler
224
191
  }
225
192
  }, this.normalizeSlot(SLOT_NAME_DEFAULT, this.slotScope));
226
193
  return h(BVCollapse, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gitlab/ui",
3
- "version": "103.5.1",
3
+ "version": "103.6.1",
4
4
  "description": "GitLab UI Components",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -141,6 +141,7 @@
141
141
  "acorn-walk": "^8.3.2",
142
142
  "autoprefixer": "^9.7.6",
143
143
  "axe-core": "^4.2.3",
144
+ "axe-playwright": "^2.0.3",
144
145
  "babel-jest": "29.0.1",
145
146
  "babel-loader": "^8.0.5",
146
147
  "cypress": "13.16.0",
@@ -282,6 +282,32 @@ const brandColors = {
282
282
  },
283
283
  'brand-pink': { '01g': 'var(--gl-color-brand-pink-01g, #ffb9c9)' },
284
284
  };
285
+ const statusBackgroundColors = {
286
+ 'status-neutral':
287
+ 'var(--gl-status-neutral-background-color, var(--gl-color-neutral-100, #dcdcde))',
288
+ 'status-info': 'var(--gl-status-info-background-color, var(--gl-color-blue-100, #cbe2f9))',
289
+ 'status-success': 'var(--gl-status-success-background-color, var(--gl-color-green-100, #c3e6cd))',
290
+ 'status-warning':
291
+ 'var(--gl-status-warning-background-color, var(--gl-color-orange-100, #f5d9a8))',
292
+ 'status-danger': 'var(--gl-status-danger-background-color, var(--gl-color-red-100, #fdd4cd))',
293
+ 'status-brand': 'var(--gl-status-brand-background-color, var(--gl-color-purple-100, #e1d8f9))',
294
+ };
295
+ const statusTextColors = {
296
+ 'status-neutral': 'var(--gl-status-neutral-text-color, var(--gl-color-neutral-700, #4c4b51))',
297
+ 'status-info': 'var(--gl-status-info-text-color, var(--gl-color-blue-700, #0b5cad))',
298
+ 'status-success': 'var(--gl-status-success-text-color, var(--gl-color-green-700, #24663b))',
299
+ 'status-warning': 'var(--gl-status-warning-text-color, var(--gl-color-orange-700, #8f4700))',
300
+ 'status-danger': 'var(--gl-status-danger-text-color, var(--gl-color-red-700, #ae1800))',
301
+ 'status-brand': 'var(--gl-status-brand-text-color, var(--gl-color-purple-700, #5943b6))',
302
+ };
303
+ const statusIconColors = {
304
+ 'status-neutral': 'var(--gl-status-neutral-icon-color, var(--gl-color-neutral-500, #737278))',
305
+ 'status-info': 'var(--gl-status-info-icon-color, var(--gl-color-blue-500, #1f75cb))',
306
+ 'status-success': 'var(--gl-status-success-icon-color, var(--gl-color-green-500, #108548))',
307
+ 'status-warning': 'var(--gl-status-warning-icon-color, var(--gl-color-orange-500, #ab6100))',
308
+ 'status-danger': 'var(--gl-status-danger-icon-color, var(--gl-color-red-500, #dd2b0e))',
309
+ 'status-brand': 'var(--gl-status-brand-icon-color, var(--gl-color-purple-500, #7b58cf))',
310
+ };
285
311
 
286
312
  const colors = {
287
313
  inherit: 'inherit',
@@ -302,6 +328,7 @@ const colors = {
302
328
  const backgroundColor = {
303
329
  ...colors,
304
330
  ...backgroundColors,
331
+ ...statusBackgroundColors,
305
332
  dropdown: 'var(--gl-dropdown-background-color, var(--gl-background-color-overlap, #fff))',
306
333
  };
307
334
 
@@ -317,6 +344,7 @@ const outlineColor = {
317
344
 
318
345
  const fill = {
319
346
  ...colors,
347
+ ...statusIconColors,
320
348
  icon: {
321
349
  ...iconColors,
322
350
  },
@@ -325,6 +353,7 @@ const fill = {
325
353
  const textColor = {
326
354
  ...colors,
327
355
  ...textColors,
356
+ ...statusTextColors,
328
357
  primary: 'var(--gl-text-primary, #28272d)',
329
358
  secondary: 'var(--gl-text-secondary, #737278)',
330
359
  tertiary: 'var(--gl-text-tertiary, #89888d)',
@@ -3,3 +3,12 @@
3
3
  */
4
4
  export const disableControls = (controls = []) =>
5
5
  Object.fromEntries(controls.map((control) => [control, { control: { disable: true } }]));
6
+
7
+ export const getA11yParameters = ({ skipRules = [], temporarySkipRules = [] } = {}) => {
8
+ const skippedRules = skipRules.concat(temporarySkipRules).map((id) => ({ id, enabled: false }));
9
+ return {
10
+ config: {
11
+ rules: skippedRules,
12
+ },
13
+ };
14
+ };
@@ -8,7 +8,6 @@ import {
8
8
  } from '../../constants/events'
9
9
  import { PROP_TYPE_BOOLEAN, PROP_TYPE_STRING } from '../../constants/props'
10
10
  import { SLOT_NAME_DEFAULT } from '../../constants/slots'
11
- import { addClass, hasClass, removeClass, closest, matches, getCS } from '../../utils/dom'
12
11
  import { getRootActionEventName, getRootEventName } from '../../utils/events'
13
12
  import { makeModelMixin } from '../../utils/model'
14
13
  import { sortKeys } from '../../utils/object'
@@ -19,8 +18,6 @@ import { normalizeSlotMixin } from '../../mixins/normalize-slot'
19
18
  import { BVCollapse } from './helpers/bv-collapse'
20
19
 
21
20
  // --- Constants ---
22
- const CLASS_NAME_SHOW = 'show'
23
-
24
21
  const ROOT_ACTION_EVENT_NAME_TOGGLE = getRootActionEventName(NAME_COLLAPSE, 'toggle')
25
22
  const ROOT_ACTION_EVENT_NAME_REQUEST_STATE = getRootActionEventName(NAME_COLLAPSE, 'request-state')
26
23
 
@@ -162,33 +159,6 @@ export const BCollapse = /*#__PURE__*/ extend({
162
159
  // It is emitted regardless if the visible state changes
163
160
  this.emitOnRoot(ROOT_EVENT_NAME_SYNC_STATE, this.safeId(), this.show)
164
161
  },
165
- checkDisplayBlock() {
166
- // Check to see if the collapse has `display: block !important` set
167
- // We can't set `display: none` directly on `this.$el`, as it would
168
- // trigger a new transition to start (or cancel a current one)
169
- const { $el } = this
170
- const restore = hasClass($el, CLASS_NAME_SHOW)
171
- removeClass($el, CLASS_NAME_SHOW)
172
- const isBlock = getCS($el).display === 'block'
173
- if (restore) {
174
- addClass($el, CLASS_NAME_SHOW)
175
- }
176
- return isBlock
177
- },
178
- clickHandler(event) {
179
- const { target: el } = event
180
- /* istanbul ignore next: can't test `getComputedStyle()` in JSDOM */
181
- if (!el || getCS(this.$el).display !== 'block') {
182
- return
183
- }
184
- // Only close the collapse if it is not forced to be `display: block !important`
185
- if (
186
- (matches(el, '.nav-link,.dropdown-item') || closest('.nav-link,.dropdown-item', el)) &&
187
- !this.checkDisplayBlock()
188
- ) {
189
- this.show = false
190
- }
191
- },
192
162
  handleToggleEvent(id) {
193
163
  if (id === this.safeId()) {
194
164
  this.toggle()
@@ -215,8 +185,7 @@ export const BCollapse = /*#__PURE__*/ extend({
215
185
  {
216
186
  class: this.classObject,
217
187
  directives: [{ name: 'show', value: this.show }],
218
- attrs: { id: this.safeId() },
219
- on: { click: this.clickHandler }
188
+ attrs: { id: this.safeId() }
220
189
  },
221
190
  this.normalizeSlot(SLOT_NAME_DEFAULT, this.slotScope)
222
191
  )