@gitlab/ui 128.2.1 → 128.2.3

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": "128.2.1",
3
+ "version": "128.2.3",
4
4
  "description": "GitLab UI Components",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -165,7 +165,7 @@
165
165
  "start-server-and-test": "^2.1.3",
166
166
  "storybook": "^7.6.20",
167
167
  "storybook-dark-mode": "4.0.2",
168
- "style-dictionary": "^5.1.3",
168
+ "style-dictionary": "^5.1.4",
169
169
  "style-loader": "^4",
170
170
  "tailwindcss": "3.4.19",
171
171
  "vue": "2.7.16",
@@ -345,24 +345,12 @@
345
345
  }
346
346
  }
347
347
 
348
- &.btn-default,
349
- &.btn-confirm,
350
- &.btn-danger {
351
- &-tertiary {
352
- @media (forced-colors: active) {
353
- color: LinkText; // stylelint-disable-line scale-unlimited/declaration-strict-value
354
- mix-blend-mode: initial;
355
- border: 0;
356
- }
357
- }
358
- }
359
-
360
348
  &.btn-default-tertiary,
361
349
  &.btn-confirm-tertiary,
362
350
  &.btn-danger-tertiary {
363
351
  @media (forced-colors: active) {
364
- /* stylelint-disable-next-line color-named */
365
- color: black; // stylelint-disable-line scale-unlimited/declaration-strict-value
352
+ color: LinkText; // stylelint-disable-line scale-unlimited/declaration-strict-value
353
+ mix-blend-mode: initial;
366
354
  border: 0;
367
355
  }
368
356
  }
@@ -446,6 +434,10 @@
446
434
  @apply gl-bg-transparent;
447
435
  @apply gl-shadow-none;
448
436
  }
437
+
438
+ @media (forced-colors: active) {
439
+ color: LinkText; // stylelint-disable-line scale-unlimited/declaration-strict-value
440
+ }
449
441
  }
450
442
 
451
443
  &.btn-block {
@@ -1,6 +1,5 @@
1
1
  import Vue from 'vue';
2
2
  import isFunction from 'lodash/isFunction';
3
- import isString from 'lodash/isString';
4
3
  import { DISCLOSURE_DROPDOWN_ITEM_NAME, DISCLOSURE_DROPDOWN_GROUP_NAME } from './constants';
5
4
 
6
5
  const itemValidator = (item) => item?.text?.length > 0 && !Array.isArray(item?.items);
@@ -20,16 +19,29 @@ const itemsValidator = (items) => items.every(isItem) || items.every(isGroup);
20
19
  const isListItem = (tag) =>
21
20
  ['gl-disclosure-dropdown-group', 'gl-disclosure-dropdown-item', 'li'].includes(tag);
22
21
 
23
- const isValidSlotTagVue2 = (vNode) =>
24
- Boolean(vNode) && isListItem(vNode.componentOptions?.tag || vNode.tag);
22
+ const isValidSlotTagVue2 = (vNode) => {
23
+ if (!vNode) return false;
24
+ const tag = vNode.componentOptions?.tag || vNode.tag;
25
+ if (isListItem(tag)) return true;
26
+ const componentName = vNode.componentOptions?.Ctor?.options?.name;
27
+ return [DISCLOSURE_DROPDOWN_ITEM_NAME, DISCLOSURE_DROPDOWN_GROUP_NAME].includes(componentName);
28
+ };
25
29
 
26
30
  const isValidSlotTagVue3 = (vNode) => {
31
+ if (!vNode) return false;
27
32
  return (
28
33
  [DISCLOSURE_DROPDOWN_ITEM_NAME, DISCLOSURE_DROPDOWN_GROUP_NAME].includes(vNode.type?.name) ||
29
34
  vNode.type === 'li'
30
35
  );
31
36
  };
32
37
 
38
+ const isSkippableVue2 = (vNode) => {
39
+ if (!vNode) return true;
40
+ if (vNode.isComment) return true;
41
+ if (!vNode.tag && typeof vNode.text === 'string' && !vNode.text.trim()) return true;
42
+ return false;
43
+ };
44
+
33
45
  const hasOnlyListItemsVue2 = (defaultSlot) => {
34
46
  const nodes = defaultSlot();
35
47
 
@@ -37,9 +49,35 @@ const hasOnlyListItemsVue2 = (defaultSlot) => {
37
49
  return false;
38
50
  }
39
51
 
40
- const tags = nodes.filter((vNode) => vNode.tag);
52
+ const candidateNodes = nodes.filter((vNode) => !isSkippableVue2(vNode));
53
+
54
+ if (candidateNodes.length === 0) return true;
55
+
56
+ return candidateNodes.every((vNode) => isValidSlotTagVue2(vNode));
57
+ };
58
+
59
+ const isSkippableVue3 = (vNode) => {
60
+ if (!vNode) return true;
61
+ if (vNode.type === Vue.Comment) return true;
62
+ if (vNode.type === Vue.Text && !vNode.children?.trim()) return true;
63
+ if (vNode.type === Vue.Fragment && (!vNode.children || vNode.children.length === 0)) return true;
64
+ return false;
65
+ };
66
+
67
+ const validateNodesRecursiveVue3 = (nodes) => {
68
+ if (!Array.isArray(nodes) || nodes.length === 0) return true;
69
+
70
+ const candidateNodes = nodes.filter((vNode) => !isSkippableVue3(vNode));
71
+
72
+ if (candidateNodes.length === 0) return true;
41
73
 
42
- return tags.length && tags.every((tag) => isValidSlotTagVue2(tag));
74
+ return candidateNodes.every((vNode) => {
75
+ if (isValidSlotTagVue3(vNode)) return true;
76
+ if (vNode.type === Vue.Fragment && Array.isArray(vNode.children)) {
77
+ return validateNodesRecursiveVue3(vNode.children);
78
+ }
79
+ return false;
80
+ });
43
81
  };
44
82
 
45
83
  const hasOnlyListItemsVue3 = (defaultSlot) => {
@@ -47,12 +85,7 @@ const hasOnlyListItemsVue3 = (defaultSlot) => {
47
85
  const fragment = nodes.find((node) => Array.isArray(node.children) && node.children.length);
48
86
  const targetNodes = fragment ? fragment.children : nodes;
49
87
 
50
- return (
51
- targetNodes
52
- // Remove empty text vNodes
53
- .filter((vNode) => !isString(vNode.text) || vNode.text.trim().length > 0)
54
- .every((vNode) => isValidSlotTagVue3(vNode))
55
- );
88
+ return validateNodesRecursiveVue3(targetNodes);
56
89
  };
57
90
 
58
91
  const hasOnlyListItems = (defaultSlot) => {