@gitlab/ui 85.14.0 → 86.0.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.
@@ -1,3 +1,5 @@
1
+ const { range, round } = require('lodash');
2
+ const plugin = require('tailwindcss/plugin');
1
3
  const {
2
4
  colors,
3
5
  backgroundColor,
@@ -9,6 +11,7 @@ const {
9
11
  const gridSize = 0.5; // rem
10
12
  const spacing = {
11
13
  0: '0',
14
+ px: '1px',
12
15
  ...Object.fromEntries(
13
16
  Object.entries({
14
17
  1: 0.25,
@@ -43,26 +46,390 @@ const spacing = {
43
46
  ),
44
47
  };
45
48
 
49
+ function addCustomDefinitions({ addComponents, addUtilities }) {
50
+ addComponents({
51
+ '.border': {
52
+ 'border-style': 'solid',
53
+ 'border-color': 'var(--gray-100, #dcdcde)',
54
+ },
55
+ '.border-t': {
56
+ 'border-top-style': 'solid',
57
+ 'border-top-color': 'var(--gray-100, #dcdcde)',
58
+ },
59
+ '.border-r': {
60
+ 'border-right-style': 'solid',
61
+ 'border-right-color': 'var(--gray-100, #dcdcde)',
62
+ },
63
+ '.border-b': {
64
+ 'border-bottom-style': 'solid',
65
+ 'border-bottom-color': 'var(--gray-100, #dcdcde)',
66
+ },
67
+ '.border-l': {
68
+ 'border-left-style': 'solid',
69
+ 'border-left-color': 'var(--gray-100, #dcdcde)',
70
+ },
71
+ '.str-truncated': {
72
+ display: 'inline-block',
73
+ overflow: 'hidden',
74
+ 'text-overflow': 'ellipsis',
75
+ 'vertical-align': 'top',
76
+ 'white-space': 'nowrap',
77
+ 'max-width': '82%',
78
+ },
79
+ '.no-spin[type="number"]': {
80
+ '&::-webkit-outer-spin-button': {
81
+ '-webkit-appearance': 'none',
82
+ margin: '0',
83
+ },
84
+ '&::-webkit-inner-spin-button': {
85
+ '-webkit-appearance': 'none',
86
+ margin: '0',
87
+ },
88
+ '-moz-appearance': 'textfield',
89
+ },
90
+ '.heading-6': {
91
+ 'font-weight': '600',
92
+ 'margin-top': '0',
93
+ 'font-size': '0.8125rem',
94
+ 'letter-spacing': 'inherit',
95
+ 'line-height': '1.25',
96
+ 'margin-bottom': '1rem',
97
+ },
98
+ '.heading-6-fixed': {
99
+ 'font-weight': '600',
100
+ 'margin-top': '0',
101
+ 'font-size': '0.8125rem',
102
+ 'letter-spacing': 'inherit',
103
+ 'line-height': '1.25',
104
+ 'margin-bottom': '1rem',
105
+ },
106
+ '.heading-5': {
107
+ 'font-weight': '600',
108
+ 'margin-top': '0',
109
+ 'font-size': '0.875rem',
110
+ 'letter-spacing': 'inherit',
111
+ 'line-height': '1.25',
112
+ 'margin-bottom': '1rem',
113
+ },
114
+ '.heading-5-fixed': {
115
+ 'font-weight': '600',
116
+ 'margin-top': '0',
117
+ 'font-size': '0.875rem',
118
+ 'letter-spacing': 'inherit',
119
+ 'line-height': '1.25',
120
+ 'margin-bottom': '1rem',
121
+ },
122
+ '.heading-4': {
123
+ 'font-weight': '600',
124
+ 'margin-top': '0',
125
+ 'font-size': '1rem',
126
+ 'letter-spacing': 'inherit',
127
+ 'line-height': '1.25',
128
+ 'margin-bottom': '1rem',
129
+ },
130
+ '.heading-4-fixed': {
131
+ 'font-weight': '600',
132
+ 'margin-top': '0',
133
+ 'font-size': '1rem',
134
+ 'letter-spacing': 'inherit',
135
+ 'line-height': '1.25',
136
+ 'margin-bottom': '1rem',
137
+ },
138
+ '.heading-3': {
139
+ 'font-weight': '600',
140
+ 'margin-top': '0',
141
+ 'font-size': 'clamp(1.125rem, 0.9027777778rem + 0.462962963vw, 1.25rem)',
142
+ 'letter-spacing': 'inherit',
143
+ 'line-height': '1.25',
144
+ 'margin-bottom': '1rem',
145
+ },
146
+ '.heading-3-fixed': {
147
+ 'font-weight': '600',
148
+ 'margin-top': '0',
149
+ 'font-size': '1.125rem',
150
+ 'letter-spacing': 'inherit',
151
+ 'line-height': '1.25',
152
+ 'margin-bottom': '1rem',
153
+ },
154
+ '.heading-2': {
155
+ 'font-weight': '600',
156
+ 'margin-top': '0',
157
+ 'font-size': 'clamp(1.3125rem, 0.8680555556rem + 0.9259259259vw, 1.5625rem)',
158
+ 'letter-spacing': '-0.01em',
159
+ 'line-height': '1.25',
160
+ 'margin-bottom': '1rem',
161
+ },
162
+ '.heading-2-fixed': {
163
+ 'font-weight': '600',
164
+ 'margin-top': '0',
165
+ 'font-size': '1.3125rem',
166
+ 'letter-spacing': '-0.01em',
167
+ 'line-height': '1.25',
168
+ 'margin-bottom': '1rem',
169
+ },
170
+ '.heading-1': {
171
+ 'font-weight': '600',
172
+ 'margin-top': '0',
173
+ 'font-size': 'clamp(1.5rem, 0.8333333333rem + 1.3888888889vw, 1.875rem)',
174
+ 'letter-spacing': '-0.01em',
175
+ 'line-height': '1.25',
176
+ 'margin-bottom': '1rem',
177
+ },
178
+ '.heading-1-fixed': {
179
+ 'font-weight': '600',
180
+ 'margin-top': '0',
181
+ 'font-size': '1.5rem',
182
+ 'letter-spacing': '-0.01em',
183
+ 'line-height': '1.25',
184
+ 'margin-bottom': '1rem',
185
+ },
186
+ '.heading-display': {
187
+ 'font-weight': '600',
188
+ 'margin-top': '0',
189
+ 'font-size': 'clamp(1.75rem, 0.8611111111rem + 1.8518518519vw, 2.25rem)',
190
+ 'letter-spacing': '-0.01em',
191
+ 'line-height': '1.125',
192
+ 'margin-bottom': '1.5rem',
193
+ },
194
+ '.heading-scale-100': {
195
+ 'font-weight': '600',
196
+ 'margin-top': '0',
197
+ 'font-size': '0.75rem',
198
+ 'letter-spacing': 'inherit',
199
+ 'line-height': '1.25',
200
+ },
201
+ '.heading-scale-100-fixed': {
202
+ 'font-weight': '600',
203
+ 'margin-top': '0',
204
+ 'font-size': '0.75rem',
205
+ 'letter-spacing': 'inherit',
206
+ 'line-height': '1.25',
207
+ },
208
+ '.heading-scale-200': {
209
+ 'font-weight': '600',
210
+ 'margin-top': '0',
211
+ 'font-size': '0.8125rem',
212
+ 'letter-spacing': 'inherit',
213
+ 'line-height': '1.25',
214
+ },
215
+ '.heading-scale-200-fixed': {
216
+ 'font-weight': '600',
217
+ 'margin-top': '0',
218
+ 'font-size': '0.8125rem',
219
+ 'letter-spacing': 'inherit',
220
+ 'line-height': '1.25',
221
+ },
222
+ '.heading-scale-300': {
223
+ 'font-weight': '600',
224
+ 'margin-top': '0',
225
+ 'font-size': '0.875rem',
226
+ 'letter-spacing': 'inherit',
227
+ 'line-height': '1.25',
228
+ },
229
+ '.heading-scale-300-fixed': {
230
+ 'font-weight': '600',
231
+ 'margin-top': '0',
232
+ 'font-size': '0.875rem',
233
+ 'letter-spacing': 'inherit',
234
+ 'line-height': '1.25',
235
+ },
236
+ '.heading-scale-400': {
237
+ 'font-weight': '600',
238
+ 'margin-top': '0',
239
+ 'font-size': '1rem',
240
+ 'letter-spacing': 'inherit',
241
+ 'line-height': '1.25',
242
+ },
243
+ '.heading-scale-400-fixed': {
244
+ 'font-weight': '600',
245
+ 'margin-top': '0',
246
+ 'font-size': '1rem',
247
+ 'letter-spacing': 'inherit',
248
+ 'line-height': '1.25',
249
+ },
250
+ '.heading-scale-500': {
251
+ 'font-weight': '600',
252
+ 'margin-top': '0',
253
+ 'font-size': 'clamp(1.125rem, 0.9027777778rem + 0.462962963vw, 1.25rem)',
254
+ 'letter-spacing': 'inherit',
255
+ 'line-height': '1.25',
256
+ },
257
+ '.heading-scale-500-fixed': {
258
+ 'font-weight': '600',
259
+ 'margin-top': '0',
260
+ 'font-size': '1.125rem',
261
+ 'letter-spacing': 'inherit',
262
+ 'line-height': '1.25',
263
+ },
264
+ '.heading-scale-600': {
265
+ 'font-weight': '600',
266
+ 'margin-top': '0',
267
+ 'font-size': 'clamp(1.3125rem, 0.8680555556rem + 0.9259259259vw, 1.5625rem)',
268
+ 'letter-spacing': '-0.01em',
269
+ 'line-height': '1.25',
270
+ },
271
+ '.heading-scale-600-fixed': {
272
+ 'font-weight': '600',
273
+ 'margin-top': '0',
274
+ 'font-size': '1.3125rem',
275
+ 'letter-spacing': '-0.01em',
276
+ 'line-height': '1.25',
277
+ },
278
+ '.heading-scale-700': {
279
+ 'font-weight': '600',
280
+ 'margin-top': '0',
281
+ 'font-size': 'clamp(1.5rem, 0.8333333333rem + 1.3888888889vw, 1.875rem)',
282
+ 'letter-spacing': '-0.01em',
283
+ 'line-height': '1.25',
284
+ },
285
+ '.heading-scale-700-fixed': {
286
+ 'font-weight': '600',
287
+ 'margin-top': '0',
288
+ 'font-size': '1.5rem',
289
+ 'letter-spacing': '-0.01em',
290
+ 'line-height': '1.25',
291
+ },
292
+ '.heading-scale-800': {
293
+ 'font-weight': '600',
294
+ 'margin-top': '0',
295
+ 'font-size': 'clamp(1.75rem, 0.8611111111rem + 1.8518518519vw, 2.25rem)',
296
+ 'letter-spacing': '-0.01em',
297
+ 'line-height': '1.125',
298
+ },
299
+ '.heading-scale-800-fixed': {
300
+ 'font-weight': '600',
301
+ 'margin-top': '0',
302
+ 'font-size': '1.75rem',
303
+ 'letter-spacing': '-0.01em',
304
+ 'line-height': '1.125',
305
+ },
306
+ });
307
+
308
+ addUtilities({
309
+ '.font-monospace': {
310
+ 'font-family':
311
+ 'var(--default-mono-font, "GitLab Mono"), "JetBrains Mono", "Menlo", "DejaVu Sans Mono", "Liberation Mono", "Consolas", "Ubuntu Mono", "Courier New", "andale mono", "lucida console", monospace',
312
+ 'font-variant-ligatures': 'none',
313
+ },
314
+ '.break-anywhere': {
315
+ 'overflow-wrap': 'anywhere',
316
+ 'word-break': 'normal',
317
+ },
318
+ '.wrap-anywhere': {
319
+ 'overflow-wrap': 'anywhere',
320
+ },
321
+ '.border-b-solid': {
322
+ 'border-bottom-style': 'solid',
323
+ },
324
+ '.border-b-initial': {
325
+ 'border-bottom-style': 'initial',
326
+ },
327
+ '.border-l-solid': {
328
+ 'border-left-style': 'solid',
329
+ },
330
+ '.border-r-solid': {
331
+ 'border-right-style': 'solid',
332
+ },
333
+ '.border-t-solid': {
334
+ 'border-top-style': 'solid',
335
+ },
336
+ '.clearfix': {
337
+ '&::after': {
338
+ display: 'block',
339
+ clear: 'both',
340
+ content: '""',
341
+ },
342
+ },
343
+ '.focus': {
344
+ 'box-shadow': '0 0 0 1px var(--white, #fff), 0 0 0 3px var(--blue-400, #428fdc)',
345
+ outline: 'none',
346
+ },
347
+ '.text-align-inherit': {
348
+ 'text-align': 'inherit',
349
+ },
350
+ });
351
+ }
352
+
353
+ const widthPercentageScales = [8, 10, 20].reduce((accumulator1, denominator) => {
354
+ return {
355
+ ...accumulator1,
356
+ ...range(1, denominator).reduce((accumulator2, numerator) => {
357
+ const width = (numerator / denominator) * 100;
358
+
359
+ return {
360
+ ...accumulator2,
361
+ [`${numerator}/${denominator}`]: `${round(width, 6)}%`,
362
+ };
363
+ }, {}),
364
+ };
365
+ }, {});
366
+
46
367
  /** @type {import('tailwindcss').Config} */
47
368
  module.exports = {
48
369
  prefix: 'gl-',
370
+ corePlugins: {
371
+ /*
372
+ * Disable preflight styles so that `@tailwind base` compiles to CSS vars declarations without
373
+ * any of the resets which we don't need.
374
+ * More on this at https://tailwindcss.com/docs/preflight.
375
+ */
376
+ preflight: false,
377
+ },
378
+ plugins: [plugin(addCustomDefinitions)],
49
379
  theme: {
50
- screens: {
51
- sm: '576px',
52
- md: '768px',
53
- lg: '992px',
54
- xl: '1200px',
380
+ animation: {
381
+ spin: 'spin 2s infinite linear',
55
382
  },
56
- colors,
57
383
  backgroundColor,
58
384
  borderColor,
385
+ borderRadius: {
386
+ none: '0',
387
+ 6: '1.5rem',
388
+ base: '.25rem',
389
+ full: '50%', // Tailwind gl-rounded-full is 9999px
390
+ small: '.125rem',
391
+ lg: '.5rem',
392
+ pill: '.75rem',
393
+ },
394
+ boxShadow: {
395
+ DEFAULT: '0 1px 4px 0 #0000004d',
396
+ none: 'none',
397
+ sm: '0 1px 2px var(--t-gray-a-08, #1f1e2414)',
398
+ md: '0 2px 8px var(--t-gray-a-16, #1f1e2429), 0 0 2px var(--t-gray-a-16, #1f1e2429)',
399
+ lg: '0 4px 12px var(--t-gray-a-16, #1f1e2429), 0 0 4px var(--t-gray-a-16, #1f1e2429)',
400
+ 'inner-1-blue-500': 'inset 0 0 0 1px var(--blue-500, #1f75cb)',
401
+ 'inner-1-gray-100': 'inset 0 0 0 1px var(--gray-100, #dcdcde)',
402
+ 'inner-1-gray-200': 'inset 0 0 0 1px var(--gray-200, #bfbfc3)',
403
+ 'inner-1-gray-400': 'inset 0 0 0 1px var(--gray-400, #89888d)',
404
+ 'inner-1-red-400': 'inset 0 0 0 1px var(--red-400, #ec5941)',
405
+ 'inner-1-red-500': 'inset 0 0 0 1px var(--red-500, #dd2b0e)',
406
+ 'inner-2-blue-400': 'inset 0 0 0 2px var(--blue-400, #428fdc)',
407
+ 'inner-b-1-gray-100': 'inset 0 -1px 0 0 var(--gray-100, #dcdcde)',
408
+ 'inner-b-2-blue-500': 'inset 0 -2px 0 0 var(--blue-500, #1f75cb)',
409
+ 'inner-b-2-theme-accent':
410
+ 'inset 0 -2px 0 0 var(--gl-theme-accent, var(--theme-indigo-500, #6666c4))',
411
+ 'inner-l-3-red-600': 'inset 3px 0 0 0 var(--red-600, #c91c00)',
412
+ 'inner-l-4-gray-100': 'inset 4px 0 0 0 var(--gray-100, #dcdcde)',
413
+ 'x0-y0-b3-s1-blue-500': 'inset 0 0 3px 1px var(--blue-500, #1f75cb)',
414
+ 'x0-y2-b4-s0': '0 2px 4px 0 #0000001a',
415
+ },
416
+ colors,
59
417
  fill,
60
- spacing,
418
+ fontFamily: {
419
+ regular:
420
+ 'var(--default-regular-font, "GitLab Sans"), -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans", Ubuntu, Cantarell, "Helvetica Neue", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"',
421
+ },
61
422
  fontSize: {
62
423
  xs: '0.625rem',
63
424
  sm: '0.75rem',
64
425
  base: '0.875rem',
65
426
  lg: '1rem',
427
+ 'size-h-display': '1.75rem',
428
+ 'size-h1': '1.4375rem',
429
+ 'size-h2': '1.1875rem',
430
+ 'size-h1-xl': '2rem',
431
+ 'size-h2-xl': '1.4375rem',
432
+ 'size-reset': 'inherit',
66
433
  },
67
434
  fontWeight: {
68
435
  100: 100,
@@ -71,6 +438,88 @@ module.exports = {
71
438
  semibold: 500,
72
439
  bold: 600,
73
440
  },
441
+ lineHeight: {
442
+ reset: 'inherit',
443
+ 0: '0',
444
+ 1: '1',
445
+ normal: '1rem',
446
+ 20: '1.25rem',
447
+ 24: '1.5rem',
448
+ 28: '1.75rem',
449
+ 32: '2rem',
450
+ 36: '2.25rem',
451
+ 42: '2.625rem',
452
+ },
453
+ opacity: {
454
+ 0: '0',
455
+ 1: '.1',
456
+ 2: '.2',
457
+ 3: '.3',
458
+ 4: '.4',
459
+ 5: '.5',
460
+ 6: '.6',
461
+ 7: '.7',
462
+ 8: '.8',
463
+ 9: '.9',
464
+ 10: '1',
465
+ },
466
+ screens: {
467
+ sm: '576px',
468
+ md: '768px',
469
+ lg: '992px',
470
+ xl: '1200px',
471
+ },
472
+ spacing,
74
473
  textColor,
474
+ transitionDuration: {
475
+ DEFAULT: '200ms',
476
+ slow: '400ms',
477
+ medium: '200ms',
478
+ fast: '100ms',
479
+ },
480
+ transitionTimingFunction: {
481
+ DEFAULT: 'ease',
482
+ ease: 'ease',
483
+ linear: 'linear',
484
+ },
485
+ zIndex: {
486
+ 0: '0',
487
+ 1: '1',
488
+ 2: '2',
489
+ 3: '3',
490
+ 4: '4',
491
+ 200: '200',
492
+ 9999: '9999',
493
+ },
494
+ extend: {
495
+ borderWidth: {
496
+ 1: '1px',
497
+ },
498
+ flexGrow: {
499
+ 2: '2',
500
+ },
501
+ gridTemplateRows: {
502
+ auto: 'auto',
503
+ },
504
+ maxWidth: {
505
+ ...widthPercentageScales,
506
+ screen: '100vw',
507
+ limited: '1006px',
508
+ '1/2': '50%',
509
+ },
510
+ transitionProperty: {
511
+ 'box-shadow': 'box-shadow',
512
+ 'stroke-opacity': 'stroke-opacity',
513
+ background: 'background',
514
+ left: 'left',
515
+ opacity: 'opacity',
516
+ padding: 'padding',
517
+ right: 'right',
518
+ stroke: 'stroke',
519
+ transform: 'transform',
520
+ width: 'width',
521
+ },
522
+ width: widthPercentageScales,
523
+ },
75
524
  },
76
525
  };