@gitlab/ui 112.3.1 → 112.3.2
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 +7 -0
- 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/build/js/tokens.dark.js +611 -611
- package/dist/tokens/build/js/tokens.js +611 -611
- 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/js/tokens.dark.js +611 -611
- package/dist/tokens/js/tokens.js +611 -611
- package/dist/tokens/tokens_tailwind_table.js +278 -0
- package/package.json +2 -2
- package/src/components/base/new_dropdowns/listbox/listbox.vue +3 -3
- 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/build/js/tokens.dark.js +611 -611
- package/src/tokens/build/js/tokens.js +611 -611
- package/src/tokens/tokens_tailwind_table.vue +360 -0
|
@@ -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.2",
|
|
4
4
|
"description": "GitLab UI Components",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -191,7 +191,7 @@
|
|
|
191
191
|
"start-server-and-test": "^1.10.6",
|
|
192
192
|
"storybook": "^7.6.20",
|
|
193
193
|
"storybook-dark-mode": "4.0.2",
|
|
194
|
-
"style-dictionary": "^4.
|
|
194
|
+
"style-dictionary": "^4.3.3",
|
|
195
195
|
"stylelint": "16.8.1",
|
|
196
196
|
"tailwind-config-viewer": "2.0.4",
|
|
197
197
|
"tailwindcss": "3.4.4",
|
|
@@ -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
|
},
|