@gitlab/ui 112.3.1 → 112.3.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/CHANGELOG.md +14 -0
- package/dist/components/base/nav/nav_item.js +81 -4
- package/dist/components/base/new_dropdowns/listbox/listbox.js +3 -4
- package/dist/index.css +1 -1
- package/dist/index.css.map +1 -1
- package/dist/tailwind.css +1 -1
- package/dist/tailwind.css.map +1 -1
- package/dist/tokens/css/tokens.dark.css +1 -1
- package/dist/tokens/docs/tokens-tailwind-docs.dark.json +32018 -0
- package/dist/tokens/docs/tokens-tailwind-docs.json +32018 -0
- package/dist/tokens/figma/constants.tokens.json +998 -0
- package/dist/tokens/figma/contextual.tokens.json +3496 -0
- package/dist/tokens/figma/deprecated.tokens.json +2243 -0
- package/dist/tokens/figma/semantic.tokens.json +1423 -0
- package/dist/tokens/tokens_story.js +2 -2
- package/dist/tokens/tokens_tailwind_table.js +278 -0
- package/package.json +12 -9
- package/src/components/base/nav/nav_item.vue +98 -6
- package/src/components/base/new_dropdowns/listbox/listbox.vue +3 -3
- package/src/internal/color_contrast/color_contrast.vue +2 -2
- package/src/tokens/build/css/tokens.dark.css +1 -1
- package/src/tokens/build/docs/tokens-tailwind-docs.dark.json +32018 -0
- package/src/tokens/build/docs/tokens-tailwind-docs.json +32018 -0
- package/src/tokens/tokens_story.vue +2 -2
- package/src/tokens/tokens_tailwind_table.vue +360 -0
- package/src/vendor/bootstrap/scss/_reboot.scss +1 -1
|
@@ -33,8 +33,8 @@ var script = {
|
|
|
33
33
|
if (!this.isBackgroundColorStory) return '';
|
|
34
34
|
const textColorVariant = colorFromBackground(value, 4.5);
|
|
35
35
|
return {
|
|
36
|
-
'gl-text-
|
|
37
|
-
'gl-text-
|
|
36
|
+
'gl-text-neutral-950': textColorVariant === 'dark',
|
|
37
|
+
'gl-text-neutral-0': textColorVariant === 'light'
|
|
38
38
|
};
|
|
39
39
|
},
|
|
40
40
|
getStyle(value) {
|
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
import Fuse from 'fuse.js';
|
|
2
|
+
import GlBadge from '../components/base/badge/badge';
|
|
3
|
+
import GlButton from '../components/base/button/button';
|
|
4
|
+
import GlSearchBoxByType from '../components/base/search_box_by_type/search_box_by_type';
|
|
5
|
+
import GlLink from '../components/base/link/link';
|
|
6
|
+
import GlTable from '../components/base/table/table';
|
|
7
|
+
import GlPagination from '../components/base/pagination/pagination';
|
|
8
|
+
import { GlTooltipDirective } from '../directives/tooltip/tooltip';
|
|
9
|
+
import TOKENS_DEFAULT from './build/docs/tokens-tailwind-docs.json';
|
|
10
|
+
import TOKENS_DARK from './build/docs/tokens-tailwind-docs.dark.json';
|
|
11
|
+
import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
|
|
12
|
+
|
|
13
|
+
var script = {
|
|
14
|
+
name: 'TokensTable',
|
|
15
|
+
tokens: {
|
|
16
|
+
default: TOKENS_DEFAULT,
|
|
17
|
+
dark: TOKENS_DARK
|
|
18
|
+
},
|
|
19
|
+
components: {
|
|
20
|
+
GlBadge,
|
|
21
|
+
GlButton,
|
|
22
|
+
GlSearchBoxByType,
|
|
23
|
+
GlLink,
|
|
24
|
+
GlTable,
|
|
25
|
+
GlPagination
|
|
26
|
+
},
|
|
27
|
+
directives: {
|
|
28
|
+
GlTooltip: GlTooltipDirective
|
|
29
|
+
},
|
|
30
|
+
fields: [{
|
|
31
|
+
key: 'description',
|
|
32
|
+
label: 'Description'
|
|
33
|
+
}, {
|
|
34
|
+
key: 'value',
|
|
35
|
+
label: 'Light mode',
|
|
36
|
+
thClass: 'gl-w-1/5'
|
|
37
|
+
}, {
|
|
38
|
+
key: 'value_dark',
|
|
39
|
+
label: 'Dark mode',
|
|
40
|
+
thClass: 'gl-w-1/5'
|
|
41
|
+
}],
|
|
42
|
+
data() {
|
|
43
|
+
return {
|
|
44
|
+
filter: '',
|
|
45
|
+
currentPage: 1,
|
|
46
|
+
perPage: 50,
|
|
47
|
+
totalFilteredItems: 0
|
|
48
|
+
};
|
|
49
|
+
},
|
|
50
|
+
watch: {
|
|
51
|
+
filter: 'resetCurrentPage'
|
|
52
|
+
},
|
|
53
|
+
methods: {
|
|
54
|
+
isColor(type) {
|
|
55
|
+
return type === 'color';
|
|
56
|
+
},
|
|
57
|
+
isAliasValue(value) {
|
|
58
|
+
return typeof value === 'string' && value.includes('{');
|
|
59
|
+
},
|
|
60
|
+
isAliasObject(value) {
|
|
61
|
+
return typeof value === 'object' && Object.values(value).some(val => this.isAliasValue(val));
|
|
62
|
+
},
|
|
63
|
+
getAliasValueName(value) {
|
|
64
|
+
if (this.isAliasValue(value)) {
|
|
65
|
+
return value.slice(1, -1);
|
|
66
|
+
}
|
|
67
|
+
return value;
|
|
68
|
+
},
|
|
69
|
+
getValueLabel(token) {
|
|
70
|
+
const value = token.original.$value;
|
|
71
|
+
if (this.isAliasObject(value)) {
|
|
72
|
+
return this.getAliasValueName(value.default);
|
|
73
|
+
}
|
|
74
|
+
if (this.isAliasValue(value)) {
|
|
75
|
+
return this.getAliasValueName(value);
|
|
76
|
+
}
|
|
77
|
+
return token.$value;
|
|
78
|
+
},
|
|
79
|
+
getDarkValueLabel(token) {
|
|
80
|
+
const value = token.original.$value;
|
|
81
|
+
if (this.isAliasObject(value)) {
|
|
82
|
+
return this.getAliasValueName(value.dark);
|
|
83
|
+
}
|
|
84
|
+
if (this.isAliasValue(value)) {
|
|
85
|
+
return this.getAliasValueName(value);
|
|
86
|
+
}
|
|
87
|
+
return token.$value;
|
|
88
|
+
},
|
|
89
|
+
transformTokenToTableColumns(token) {
|
|
90
|
+
return {
|
|
91
|
+
id: token.path.filter(Boolean).join('-'),
|
|
92
|
+
name: this.formatTokenName('name', token),
|
|
93
|
+
type: token.$type,
|
|
94
|
+
value: token.$value,
|
|
95
|
+
valueLabel: this.getValueLabel(token),
|
|
96
|
+
darkValueLabel: this.getDarkValueLabel(token),
|
|
97
|
+
deprecated: token.deprecated ? 'deprecated' : '',
|
|
98
|
+
description: token.$description,
|
|
99
|
+
className: this.formatContextToClass(token.context),
|
|
100
|
+
cssValue: token.cssWithValue,
|
|
101
|
+
figmaName: this.formatTokenName('figma', token),
|
|
102
|
+
cssName: this.formatTokenName('css', token),
|
|
103
|
+
scssName: this.formatTokenName('scss', token)
|
|
104
|
+
};
|
|
105
|
+
},
|
|
106
|
+
filterItems(items, filter) {
|
|
107
|
+
if (!filter) return items;
|
|
108
|
+
const fuse = new Fuse(items, {
|
|
109
|
+
keys: Object.keys(items[0]),
|
|
110
|
+
includeScore: true
|
|
111
|
+
});
|
|
112
|
+
const results = fuse.search(filter);
|
|
113
|
+
return results.sort((a, b) => {
|
|
114
|
+
if (a.item.deprecated && !b.item.deprecated) return 1;
|
|
115
|
+
if (!a.item.deprecated && b.item.deprecated) return -1;
|
|
116
|
+
return a.score - b.score;
|
|
117
|
+
}).map(_ref => {
|
|
118
|
+
let {
|
|
119
|
+
item
|
|
120
|
+
} = _ref;
|
|
121
|
+
return item;
|
|
122
|
+
});
|
|
123
|
+
},
|
|
124
|
+
paginateItems(items, currentPage, perPage) {
|
|
125
|
+
const start = (currentPage - 1) * perPage;
|
|
126
|
+
return items.slice(start, start + perPage);
|
|
127
|
+
},
|
|
128
|
+
itemsProvider(_ref2) {
|
|
129
|
+
let {
|
|
130
|
+
currentPage,
|
|
131
|
+
perPage,
|
|
132
|
+
filter
|
|
133
|
+
} = _ref2;
|
|
134
|
+
try {
|
|
135
|
+
const items = this.transformTokensToTableRows(this.$options.tokens.default);
|
|
136
|
+
const filteredItems = this.filterItems(items, filter);
|
|
137
|
+
this.totalFilteredItems = filteredItems.length;
|
|
138
|
+
const paginatedFilteredItems = this.paginateItems(filteredItems, currentPage, perPage);
|
|
139
|
+
return paginatedFilteredItems;
|
|
140
|
+
} catch (e) {
|
|
141
|
+
// eslint-disable-next-line no-console
|
|
142
|
+
console.error('Failed to provide items', e);
|
|
143
|
+
return [];
|
|
144
|
+
}
|
|
145
|
+
},
|
|
146
|
+
transformTokensToTableRows(tokens) {
|
|
147
|
+
let context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
148
|
+
const tokensArray = [];
|
|
149
|
+
Object.keys(tokens).forEach(key => {
|
|
150
|
+
const token = tokens[key];
|
|
151
|
+
if (token.$value) {
|
|
152
|
+
tokensArray.push(this.transformTokenToTableColumns({
|
|
153
|
+
...token,
|
|
154
|
+
context: [...context, key]
|
|
155
|
+
}));
|
|
156
|
+
} else if (key !== 'colors') {
|
|
157
|
+
tokensArray.push(...this.transformTokensToTableRows(token, [...context, key]));
|
|
158
|
+
}
|
|
159
|
+
});
|
|
160
|
+
tokensArray
|
|
161
|
+
// Sort tokensArray by id
|
|
162
|
+
.sort((a, b) => {
|
|
163
|
+
if (a.id < b.id) {
|
|
164
|
+
return -1;
|
|
165
|
+
}
|
|
166
|
+
if (a.id > b.id) {
|
|
167
|
+
return 1;
|
|
168
|
+
}
|
|
169
|
+
return 0;
|
|
170
|
+
})
|
|
171
|
+
// Sort tokensArray so deprecated items are last
|
|
172
|
+
.sort((a, b) => {
|
|
173
|
+
if (a.deprecated && !b.deprecated) {
|
|
174
|
+
return 1;
|
|
175
|
+
}
|
|
176
|
+
if (!a.deprecated && b.deprecated) {
|
|
177
|
+
return -1;
|
|
178
|
+
}
|
|
179
|
+
return 0;
|
|
180
|
+
});
|
|
181
|
+
return tokensArray;
|
|
182
|
+
},
|
|
183
|
+
formatTokenName(format, token) {
|
|
184
|
+
let figmaPrefix = '';
|
|
185
|
+
const prefix = token.prefix === false ? '' : 'gl';
|
|
186
|
+
switch (format) {
|
|
187
|
+
case 'figma':
|
|
188
|
+
if (token.filePath.match('contextual')) {
|
|
189
|
+
figmaPrefix = '🔒/';
|
|
190
|
+
}
|
|
191
|
+
if (token.deprecated) {
|
|
192
|
+
figmaPrefix = '⚠️ DEPRECATED/';
|
|
193
|
+
}
|
|
194
|
+
return `${figmaPrefix}${token.path.filter(Boolean).join('-')}`;
|
|
195
|
+
case 'css':
|
|
196
|
+
return `var(--${[prefix, ...token.path].filter(Boolean).join('-')})`;
|
|
197
|
+
case 'scss':
|
|
198
|
+
return `$${[prefix, ...token.path].filter(Boolean).join('-')}`;
|
|
199
|
+
default:
|
|
200
|
+
return token.path.filter(Boolean).join('.');
|
|
201
|
+
}
|
|
202
|
+
},
|
|
203
|
+
formatContextToClass(context) {
|
|
204
|
+
const cleanContext = context.filter(segment => segment !== 'color');
|
|
205
|
+
if (cleanContext[0] === 'background') {
|
|
206
|
+
cleanContext[0] = 'bg';
|
|
207
|
+
}
|
|
208
|
+
// eslint-disable-next-line @gitlab/tailwind-no-interpolation
|
|
209
|
+
return `gl-${cleanContext.join('-')}`;
|
|
210
|
+
},
|
|
211
|
+
copyToClipboard(value) {
|
|
212
|
+
navigator.clipboard.writeText(value);
|
|
213
|
+
},
|
|
214
|
+
resetCurrentPage() {
|
|
215
|
+
this.currentPage = 1;
|
|
216
|
+
},
|
|
217
|
+
refresh() {
|
|
218
|
+
this.$root.$emit('bv::refresh::table', 'tokens-table');
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
};
|
|
222
|
+
|
|
223
|
+
/* script */
|
|
224
|
+
const __vue_script__ = script;
|
|
225
|
+
|
|
226
|
+
/* template */
|
|
227
|
+
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',[_c('p',{staticClass:"gl-text-sm gl-text-subtle"},[_vm._v("\n For full token details, see\n "),_c('gl-link',{attrs:{"href":"https://gitlab.com/gitlab-org/gitlab-ui/-/tree/main/src/tokens/build/json","target":"_blank"}},[_vm._v("https://gitlab.com/gitlab-org/gitlab-ui/-/tree/main/src/tokens/build/json")])],1),_vm._v(" "),_c('div',{staticClass:"gl-mb-5 gl-flex gl-items-center gl-gap-3"},[_c('gl-search-box-by-type',{staticClass:"gl-grow",attrs:{"debounce":"250"},model:{value:(_vm.filter),callback:function ($$v) {_vm.filter=$$v;},expression:"filter"}})],1),_vm._v(" "),_c('gl-table',{attrs:{"id":"tokens-table","filter":_vm.filter,"items":_vm.itemsProvider,"fields":_vm.$options.fields,"tbody-tr-attr":function (item) { return ({ id: item.id }); },"current-page":_vm.currentPage,"per-page":_vm.perPage,"hover":"","fixed":"","stacked":"sm"},scopedSlots:_vm._u([{key:"cell(description)",fn:function(ref){
|
|
228
|
+
var ref_item = ref.item;
|
|
229
|
+
var name = ref_item.name;
|
|
230
|
+
var deprecated = ref_item.deprecated;
|
|
231
|
+
var description = ref_item.description;
|
|
232
|
+
var className = ref_item.className;
|
|
233
|
+
var figmaName = ref_item.figmaName;
|
|
234
|
+
var cssName = ref_item.cssName;
|
|
235
|
+
var scssName = ref_item.scssName;
|
|
236
|
+
return [_c('strong',{staticClass:"gl-heading-4 !gl-mb-2 gl-flex gl-items-center gl-gap-3"},[_vm._v("\n "+_vm._s(name)+"\n "),_c('gl-button',{directives:[{name:"gl-tooltip",rawName:"v-gl-tooltip"}],attrs:{"title":"Copy token name value to clipboard","icon":"copy-to-clipboard","aria-label":"Copy token name value to clipboard","size":"small"},on:{"click":function($event){return _vm.copyToClipboard(name)}}}),_vm._v(" "),(deprecated)?_c('gl-badge',{attrs:{"variant":"danger"}},[_vm._v("Deprecated")]):_vm._e()],1),_vm._v(" "),(description)?_c('p',{staticClass:"gl-mt-3 gl-text-subtle"},[_vm._v("\n "+_vm._s(description)+"\n ")]):_vm._e(),_vm._v(" "),_c('ul',{staticClass:"!gl-m-0 gl-flex gl-list-none gl-flex-col !gl-p-0"},[_c('li',[_c('code',{staticClass:"gl-text-base gl-text-strong"},[_c('span',{staticClass:"gl-inline-block gl-w-12"},[_vm._v("Tailwind:")]),_vm._v(" "+_vm._s(className)+"\n "),_c('gl-button',{directives:[{name:"gl-tooltip",rawName:"v-gl-tooltip"}],attrs:{"title":"Copy Tailwind class to clipboard","icon":"copy-to-clipboard","aria-label":"Copy Tailwind class to clipboard","size":"small","category":"tertiary"},on:{"click":function($event){return _vm.copyToClipboard(className)}}})],1)]),_vm._v(" "),_c('li',[_c('code',{staticClass:"gl-text-base gl-text-strong"},[_c('span',{staticClass:"gl-inline-block gl-w-12"},[_vm._v("Figma:")]),_vm._v(" "+_vm._s(figmaName)+"\n "),_c('gl-button',{directives:[{name:"gl-tooltip",rawName:"v-gl-tooltip"}],attrs:{"title":"Copy Figma value to clipboard","icon":"copy-to-clipboard","aria-label":"Copy Figma value to clipboard","size":"small","category":"tertiary"},on:{"click":function($event){return _vm.copyToClipboard(figmaName)}}})],1)]),_vm._v(" "),_c('li',[_c('code',{staticClass:"gl-text-base gl-text-strong"},[_c('span',{staticClass:"gl-inline-block gl-w-12"},[_vm._v("CSS:")]),_vm._v(" "+_vm._s(cssName)+"\n "),_c('gl-button',{directives:[{name:"gl-tooltip",rawName:"v-gl-tooltip"}],attrs:{"title":"Copy CSS value to clipboard","icon":"copy-to-clipboard","aria-label":"Copy CSS value to clipboard","size":"small","category":"tertiary"},on:{"click":function($event){return _vm.copyToClipboard(cssName)}}})],1)]),_vm._v(" "),_c('li',[_c('code',{staticClass:"gl-text-base gl-text-strong"},[_c('span',{staticClass:"gl-inline-block gl-w-12"},[_vm._v("SCSS:")]),_vm._v(" "+_vm._s(scssName)+"\n "),_c('gl-button',{directives:[{name:"gl-tooltip",rawName:"v-gl-tooltip"}],attrs:{"title":"Copy SCSS value to clipboard","icon":"copy-to-clipboard","aria-label":"Copy SCSS value to clipboard","size":"small","category":"tertiary"},on:{"click":function($event){return _vm.copyToClipboard(scssName)}}})],1)])])]}},{key:"cell(value)",fn:function(ref){
|
|
237
|
+
var ref_item = ref.item;
|
|
238
|
+
var type = ref_item.type;
|
|
239
|
+
var valueLabel = ref_item.valueLabel;
|
|
240
|
+
var cssValue = ref_item.cssValue;
|
|
241
|
+
return [_c('div',{staticClass:"gl-flex gl-items-start gl-gap-3"},[(_vm.isColor(type))?_c('div',{staticClass:"gl-border gl-h-5 gl-w-5 gl-rounded-base",style:({ 'background-color': cssValue })}):_vm._e(),_vm._v(" "),_c('code',{staticClass:"gl-min-w-0 gl-text-base gl-text-strong"},[_vm._v(_vm._s(valueLabel))])])]}},{key:"cell(value_dark)",fn:function(ref){
|
|
242
|
+
var ref_item = ref.item;
|
|
243
|
+
var type = ref_item.type;
|
|
244
|
+
var darkValueLabel = ref_item.darkValueLabel;
|
|
245
|
+
var cssValue = ref_item.cssValue;
|
|
246
|
+
return [_c('div',{staticClass:"gl-flex gl-items-start gl-gap-3"},[(_vm.isColor(type))?_c('div',{staticClass:"gl-dark-scope gl-border gl-h-5 gl-w-5 gl-rounded-base",style:({ 'background-color': cssValue })}):_vm._e(),_vm._v(" "),_c('code',{staticClass:"gl-min-w-0 gl-text-base gl-text-strong"},[_vm._v(_vm._s(darkValueLabel))])])]}}])}),_vm._v(" "),_c('gl-pagination',{attrs:{"align":"center","per-page":_vm.perPage,"total-items":_vm.totalFilteredItems},model:{value:(_vm.currentPage),callback:function ($$v) {_vm.currentPage=$$v;},expression:"currentPage"}})],1)};
|
|
247
|
+
var __vue_staticRenderFns__ = [];
|
|
248
|
+
|
|
249
|
+
/* style */
|
|
250
|
+
const __vue_inject_styles__ = undefined;
|
|
251
|
+
/* scoped */
|
|
252
|
+
const __vue_scope_id__ = undefined;
|
|
253
|
+
/* module identifier */
|
|
254
|
+
const __vue_module_identifier__ = undefined;
|
|
255
|
+
/* functional template */
|
|
256
|
+
const __vue_is_functional_template__ = false;
|
|
257
|
+
/* style inject */
|
|
258
|
+
|
|
259
|
+
/* style inject SSR */
|
|
260
|
+
|
|
261
|
+
/* style inject shadow dom */
|
|
262
|
+
|
|
263
|
+
|
|
264
|
+
|
|
265
|
+
const __vue_component__ = /*#__PURE__*/__vue_normalize__(
|
|
266
|
+
{ render: __vue_render__, staticRenderFns: __vue_staticRenderFns__ },
|
|
267
|
+
__vue_inject_styles__,
|
|
268
|
+
__vue_script__,
|
|
269
|
+
__vue_scope_id__,
|
|
270
|
+
__vue_is_functional_template__,
|
|
271
|
+
__vue_module_identifier__,
|
|
272
|
+
false,
|
|
273
|
+
undefined,
|
|
274
|
+
undefined,
|
|
275
|
+
undefined
|
|
276
|
+
);
|
|
277
|
+
|
|
278
|
+
export { __vue_component__ as default };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gitlab/ui",
|
|
3
|
-
"version": "112.3.
|
|
3
|
+
"version": "112.3.3",
|
|
4
4
|
"description": "GitLab UI Components",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -96,7 +96,10 @@
|
|
|
96
96
|
"resolutions": {
|
|
97
97
|
"chokidar": "^3.5.2",
|
|
98
98
|
"sane": "^5.0.1",
|
|
99
|
-
"jackspeak": "2.1.1"
|
|
99
|
+
"jackspeak": "2.1.1",
|
|
100
|
+
"postcss": "8.5.3",
|
|
101
|
+
"json5": "2.2.3",
|
|
102
|
+
"rollup-plugin-vue/@vue/component-compiler/postcss-modules-sync/generic-names/loader-utils": "1.4.2"
|
|
100
103
|
},
|
|
101
104
|
"devDependencies": {
|
|
102
105
|
"@babel/core": "^7.26.10",
|
|
@@ -138,7 +141,7 @@
|
|
|
138
141
|
"@yarnpkg/lockfile": "^1.1.0",
|
|
139
142
|
"acorn": "^8.11.3",
|
|
140
143
|
"acorn-walk": "^8.3.2",
|
|
141
|
-
"autoprefixer": "
|
|
144
|
+
"autoprefixer": "10.4.21",
|
|
142
145
|
"axe-playwright": "^2.1.0",
|
|
143
146
|
"babel-jest": "29.0.1",
|
|
144
147
|
"babel-loader": "^8.0.5",
|
|
@@ -170,11 +173,11 @@
|
|
|
170
173
|
"npm-run-all": "^4.1.5",
|
|
171
174
|
"patch-package": "^8.0.0",
|
|
172
175
|
"pikaday": "^1.8.0",
|
|
173
|
-
"playwright": "^1.
|
|
174
|
-
"playwright-core": "^1.
|
|
175
|
-
"postcss": "8.
|
|
176
|
-
"postcss-loader": "
|
|
177
|
-
"postcss-scss": "4.0.
|
|
176
|
+
"playwright": "^1.52.0",
|
|
177
|
+
"playwright-core": "^1.52.0",
|
|
178
|
+
"postcss": "8.5.3",
|
|
179
|
+
"postcss-loader": "8.1.1",
|
|
180
|
+
"postcss-scss": "4.0.9",
|
|
178
181
|
"prettier": "3.3.2",
|
|
179
182
|
"prettier-plugin-tailwindcss": "^0.6.5",
|
|
180
183
|
"react": "^18.2.0",
|
|
@@ -191,7 +194,7 @@
|
|
|
191
194
|
"start-server-and-test": "^1.10.6",
|
|
192
195
|
"storybook": "^7.6.20",
|
|
193
196
|
"storybook-dark-mode": "4.0.2",
|
|
194
|
-
"style-dictionary": "^4.
|
|
197
|
+
"style-dictionary": "^4.3.3",
|
|
195
198
|
"stylelint": "16.8.1",
|
|
196
199
|
"tailwind-config-viewer": "2.0.4",
|
|
197
200
|
"tailwindcss": "3.4.4",
|
|
@@ -1,17 +1,109 @@
|
|
|
1
1
|
<script>
|
|
2
|
-
import
|
|
2
|
+
import GlLink from '../link/link.vue';
|
|
3
3
|
|
|
4
4
|
export default {
|
|
5
5
|
name: 'GlNavItem',
|
|
6
6
|
components: {
|
|
7
|
-
|
|
7
|
+
GlLink,
|
|
8
|
+
},
|
|
9
|
+
props: {
|
|
10
|
+
/**
|
|
11
|
+
* When set to `true`, places the component in the active state with active styling
|
|
12
|
+
*/
|
|
13
|
+
active: {
|
|
14
|
+
type: Boolean,
|
|
15
|
+
required: false,
|
|
16
|
+
default: false,
|
|
17
|
+
},
|
|
18
|
+
/**
|
|
19
|
+
* When set to `true`, disables the component's functionality and places it in a disabled state.
|
|
20
|
+
*/
|
|
21
|
+
disabled: {
|
|
22
|
+
type: Boolean,
|
|
23
|
+
required: false,
|
|
24
|
+
default: false,
|
|
25
|
+
},
|
|
26
|
+
/**
|
|
27
|
+
* Denotes the target URL of the link for standard links.
|
|
28
|
+
*/
|
|
29
|
+
href: {
|
|
30
|
+
type: String,
|
|
31
|
+
required: false,
|
|
32
|
+
default: undefined,
|
|
33
|
+
},
|
|
34
|
+
/**
|
|
35
|
+
* <router-link> prop: Denotes the target route of the link.
|
|
36
|
+
* When clicked, the value of the to prop will be passed to `router.push()` internally,
|
|
37
|
+
* so the value can be either a string or a Location descriptor object.
|
|
38
|
+
*/
|
|
39
|
+
to: {
|
|
40
|
+
type: [Object, String],
|
|
41
|
+
required: false,
|
|
42
|
+
default: undefined,
|
|
43
|
+
},
|
|
44
|
+
/**
|
|
45
|
+
* <router-link> prop: Configure the active CSS class applied when the link is active.
|
|
46
|
+
*/
|
|
47
|
+
activeClass: {
|
|
48
|
+
type: String,
|
|
49
|
+
required: false,
|
|
50
|
+
default: undefined,
|
|
51
|
+
},
|
|
52
|
+
/**
|
|
53
|
+
* <router-link> prop: Configure the active CSS class applied when the link is active with exact match.
|
|
54
|
+
*/
|
|
55
|
+
exactActiveClass: {
|
|
56
|
+
type: String,
|
|
57
|
+
required: false,
|
|
58
|
+
default: undefined,
|
|
59
|
+
},
|
|
60
|
+
/**
|
|
61
|
+
* Attributes for the link element
|
|
62
|
+
*/
|
|
63
|
+
linkAttrs: {
|
|
64
|
+
type: Object,
|
|
65
|
+
required: false,
|
|
66
|
+
default: null,
|
|
67
|
+
},
|
|
68
|
+
/**
|
|
69
|
+
* Classes for the link element
|
|
70
|
+
*/
|
|
71
|
+
linkClasses: {
|
|
72
|
+
type: Array,
|
|
73
|
+
required: false,
|
|
74
|
+
default: () => [],
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
computed: {
|
|
78
|
+
computedLinkClasses() {
|
|
79
|
+
const classes = this.linkClasses;
|
|
80
|
+
|
|
81
|
+
// the `unstyled` link variant does not do this by itself
|
|
82
|
+
if (this.disabled) classes.push('disabled');
|
|
83
|
+
if (this.active) classes.push('active');
|
|
84
|
+
|
|
85
|
+
return classes;
|
|
86
|
+
},
|
|
8
87
|
},
|
|
9
|
-
inheritAttrs: false,
|
|
10
88
|
};
|
|
11
89
|
</script>
|
|
12
90
|
|
|
13
91
|
<template>
|
|
14
|
-
<
|
|
15
|
-
<
|
|
16
|
-
|
|
92
|
+
<li class="nav-item">
|
|
93
|
+
<gl-link
|
|
94
|
+
class="nav-link"
|
|
95
|
+
variant="unstyled"
|
|
96
|
+
:active="active"
|
|
97
|
+
:class="computedLinkClasses"
|
|
98
|
+
:disabled="disabled"
|
|
99
|
+
:href="href"
|
|
100
|
+
:to="to"
|
|
101
|
+
:active-class="activeClass"
|
|
102
|
+
:exact-active-class="exactActiveClass"
|
|
103
|
+
v-bind="linkAttrs"
|
|
104
|
+
v-on="$listeners"
|
|
105
|
+
>
|
|
106
|
+
<slot></slot>
|
|
107
|
+
</gl-link>
|
|
108
|
+
</li>
|
|
17
109
|
</template>
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
<script>
|
|
3
3
|
import clamp from 'lodash/clamp';
|
|
4
4
|
import uniqueId from 'lodash/uniqueId';
|
|
5
|
-
import isNil from 'lodash/isNil';
|
|
6
5
|
import { stopEvent } from '../../../../utils/utils';
|
|
7
6
|
import {
|
|
8
7
|
GL_DROPDOWN_SHOWN,
|
|
@@ -84,7 +83,7 @@ export default {
|
|
|
84
83
|
* Array of selected items values for multi-select and selected item value for single-select
|
|
85
84
|
*/
|
|
86
85
|
selected: {
|
|
87
|
-
type: [Array, String, Number],
|
|
86
|
+
type: [Array, String, Number, null],
|
|
88
87
|
required: false,
|
|
89
88
|
default: () => [],
|
|
90
89
|
},
|
|
@@ -420,6 +419,7 @@ export default {
|
|
|
420
419
|
selectedIndices() {
|
|
421
420
|
return this.selectedValues
|
|
422
421
|
.map((selected) => this.flattenedOptions.findIndex(({ value }) => value === selected))
|
|
422
|
+
.filter((index) => index !== -1)
|
|
423
423
|
.sort();
|
|
424
424
|
},
|
|
425
425
|
showList() {
|
|
@@ -508,7 +508,7 @@ export default {
|
|
|
508
508
|
}
|
|
509
509
|
this.selectedValues = [...newSelected];
|
|
510
510
|
} else {
|
|
511
|
-
this.selectedValues =
|
|
511
|
+
this.selectedValues = [newSelected];
|
|
512
512
|
}
|
|
513
513
|
},
|
|
514
514
|
},
|
|
@@ -21,11 +21,11 @@ export default {
|
|
|
21
21
|
return HEX_REGEX.test(this.foreground) && HEX_REGEX.test(this.background);
|
|
22
22
|
},
|
|
23
23
|
classes() {
|
|
24
|
-
if (!this.isValidColorCombination) return 'gl-text-
|
|
24
|
+
if (!this.isValidColorCombination) return 'gl-text-neutral-950';
|
|
25
25
|
const { grade } = this.contrast.level;
|
|
26
26
|
const isFail = grade === 'F';
|
|
27
27
|
const contrastScore = getColorContrast('#fff', this.background).score > 4.5;
|
|
28
|
-
const textClass = contrastScore ? 'gl-text-
|
|
28
|
+
const textClass = contrastScore ? 'gl-text-neutral-0' : 'gl-text-neutral-950';
|
|
29
29
|
const failClasses = contrastScore
|
|
30
30
|
? 'gl-shadow-inner-1-red-300 gl-text-red-300'
|
|
31
31
|
: 'gl-shadow-inner-1-red-500 gl-text-red-500';
|