@gitlab/ui 68.5.0 → 68.7.0

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.
Files changed (36) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/components/experimental/duo/chat/components/duo_chat_message/copy_code_element.js +35 -0
  3. package/dist/components/experimental/duo/chat/components/duo_chat_message/duo_chat_message.js +4 -0
  4. package/dist/index.css +1 -1
  5. package/dist/index.css.map +1 -1
  6. package/dist/tokens/common_story_options.js +32 -0
  7. package/dist/tokens/css/tokens.css +122 -56
  8. package/dist/tokens/css/tokens.dark.css +2 -2
  9. package/dist/tokens/js/tokens.dark.js +1 -1
  10. package/dist/tokens/js/tokens.js +122 -56
  11. package/dist/tokens/json/tokens.dark.grouped.json +121 -55
  12. package/dist/tokens/json/tokens.dark.json +3504 -2104
  13. package/dist/tokens/json/tokens.grouped.json +121 -55
  14. package/dist/tokens/json/tokens.json +3465 -2065
  15. package/dist/tokens/scss/_tokens.dark.scss +2 -2
  16. package/dist/tokens/scss/_tokens.scss +122 -56
  17. package/dist/utils/utils.js +3 -2
  18. package/package.json +1 -1
  19. package/scss_to_js/scss_variables.js +122 -122
  20. package/scss_to_js/scss_variables.json +1265 -1265
  21. package/src/components/experimental/duo/chat/components/duo_chat_message/copy_code_element.js +44 -0
  22. package/src/components/experimental/duo/chat/components/duo_chat_message/copy_code_element.spec.js +64 -0
  23. package/src/components/experimental/duo/chat/components/duo_chat_message/duo_chat_message.scss +15 -0
  24. package/src/components/experimental/duo/chat/components/duo_chat_message/duo_chat_message.spec.js +10 -4
  25. package/src/components/experimental/duo/chat/components/duo_chat_message/duo_chat_message.vue +4 -0
  26. package/src/scss/variables.scss +0 -74
  27. package/src/tokens/color.dark.tokens.json +1 -1
  28. package/src/tokens/color.dark.tokens.stories.js +42 -0
  29. package/src/tokens/color.data_viz.tokens.json +344 -0
  30. package/src/tokens/color.data_viz.tokens.stories.js +56 -0
  31. package/src/tokens/color.theme.tokens.json +412 -0
  32. package/src/tokens/color.theme.tokens.stories.js +60 -0
  33. package/src/tokens/color.tokens.json +0 -342
  34. package/src/tokens/color.tokens.stories.js +42 -0
  35. package/src/tokens/common_story_options.js +31 -0
  36. package/src/utils/utils.js +3 -3
@@ -425,348 +425,6 @@
425
425
  "prefix": false
426
426
  }
427
427
  },
428
- "data-viz": {
429
- "green": {
430
- "50": {
431
- "$value": "#ddfab7",
432
- "$type": "color",
433
- "themeable": true,
434
- "prefix": false
435
- },
436
- "100": {
437
- "$value": "#c6ed94",
438
- "$type": "color",
439
- "themeable": true,
440
- "prefix": false
441
- },
442
- "200": {
443
- "$value": "#b0d97b",
444
- "$type": "color",
445
- "themeable": true,
446
- "prefix": false
447
- },
448
- "300": {
449
- "$value": "#94c25e",
450
- "$type": "color",
451
- "themeable": true,
452
- "prefix": false
453
- },
454
- "400": {
455
- "$value": "#81ac41",
456
- "$type": "color",
457
- "themeable": true,
458
- "prefix": false
459
- },
460
- "500": {
461
- "$value": "#619025",
462
- "$type": "color",
463
- "themeable": true,
464
- "prefix": false
465
- },
466
- "600": {
467
- "$value": "#4e7f0e",
468
- "$type": "color",
469
- "themeable": true,
470
- "prefix": false
471
- },
472
- "700": {
473
- "$value": "#366800",
474
- "$type": "color",
475
- "themeable": true,
476
- "prefix": false
477
- },
478
- "800": {
479
- "$value": "#275600",
480
- "$type": "color",
481
- "themeable": true,
482
- "prefix": false
483
- },
484
- "900": {
485
- "$value": "#1a4500",
486
- "$type": "color",
487
- "themeable": true,
488
- "prefix": false
489
- },
490
- "950": {
491
- "$value": "#133a03",
492
- "$type": "color",
493
- "themeable": true,
494
- "prefix": false
495
- }
496
- },
497
- "aqua": {
498
- "50": {
499
- "$value": "#b5fefd",
500
- "$type": "color",
501
- "themeable": true,
502
- "prefix": false
503
- },
504
- "100": {
505
- "$value": "#93f2ef",
506
- "$type": "color",
507
- "themeable": true,
508
- "prefix": false
509
- },
510
- "200": {
511
- "$value": "#5edee3",
512
- "$type": "color",
513
- "themeable": true,
514
- "prefix": false
515
- },
516
- "300": {
517
- "$value": "#32c5d2",
518
- "$type": "color",
519
- "themeable": true,
520
- "prefix": false
521
- },
522
- "400": {
523
- "$value": "#00acc4",
524
- "$type": "color",
525
- "themeable": true,
526
- "prefix": false
527
- },
528
- "500": {
529
- "$value": "#0090b1",
530
- "$type": "color",
531
- "themeable": true,
532
- "prefix": false
533
- },
534
- "600": {
535
- "$value": "#007b9b",
536
- "$type": "color",
537
- "themeable": true,
538
- "prefix": false
539
- },
540
- "700": {
541
- "$value": "#006381",
542
- "$type": "color",
543
- "themeable": true,
544
- "prefix": false
545
- },
546
- "800": {
547
- "$value": "#00516c",
548
- "$type": "color",
549
- "themeable": true,
550
- "prefix": false
551
- },
552
- "900": {
553
- "$value": "#004059",
554
- "$type": "color",
555
- "themeable": true,
556
- "prefix": false
557
- },
558
- "950": {
559
- "$value": "#00344b",
560
- "$type": "color",
561
- "themeable": true,
562
- "prefix": false
563
- }
564
- },
565
- "blue": {
566
- "50": {
567
- "$value": "#e9ebff",
568
- "$type": "color",
569
- "themeable": true,
570
- "prefix": false
571
- },
572
- "100": {
573
- "$value": "#d2dcff",
574
- "$type": "color",
575
- "themeable": true,
576
- "prefix": false
577
- },
578
- "200": {
579
- "$value": "#b7c6ff",
580
- "$type": "color",
581
- "themeable": true,
582
- "prefix": false
583
- },
584
- "300": {
585
- "$value": "#97acff",
586
- "$type": "color",
587
- "themeable": true,
588
- "prefix": false
589
- },
590
- "400": {
591
- "$value": "#7992f5",
592
- "$type": "color",
593
- "themeable": true,
594
- "prefix": false
595
- },
596
- "500": {
597
- "$value": "#617ae2",
598
- "$type": "color",
599
- "themeable": true,
600
- "prefix": false
601
- },
602
- "600": {
603
- "$value": "#4e65cd",
604
- "$type": "color",
605
- "themeable": true,
606
- "prefix": false
607
- },
608
- "700": {
609
- "$value": "#3f51ae",
610
- "$type": "color",
611
- "themeable": true,
612
- "prefix": false
613
- },
614
- "800": {
615
- "$value": "#374291",
616
- "$type": "color",
617
- "themeable": true,
618
- "prefix": false
619
- },
620
- "900": {
621
- "$value": "#303470",
622
- "$type": "color",
623
- "themeable": true,
624
- "prefix": false
625
- },
626
- "950": {
627
- "$value": "#2a2b59",
628
- "$type": "color",
629
- "themeable": true,
630
- "prefix": false
631
- }
632
- },
633
- "magenta": {
634
- "50": {
635
- "$value": "#ffe3eb",
636
- "$type": "color",
637
- "themeable": true,
638
- "prefix": false
639
- },
640
- "100": {
641
- "$value": "#ffccdb",
642
- "$type": "color",
643
- "themeable": true,
644
- "prefix": false
645
- },
646
- "200": {
647
- "$value": "#fcacc5",
648
- "$type": "color",
649
- "themeable": true,
650
- "prefix": false
651
- },
652
- "300": {
653
- "$value": "#f88aaf",
654
- "$type": "color",
655
- "themeable": true,
656
- "prefix": false
657
- },
658
- "400": {
659
- "$value": "#e86e9a",
660
- "$type": "color",
661
- "themeable": true,
662
- "prefix": false
663
- },
664
- "500": {
665
- "$value": "#cf4d81",
666
- "$type": "color",
667
- "themeable": true,
668
- "prefix": false
669
- },
670
- "600": {
671
- "$value": "#b93d71",
672
- "$type": "color",
673
- "themeable": true,
674
- "prefix": false
675
- },
676
- "700": {
677
- "$value": "#9a2e5d",
678
- "$type": "color",
679
- "themeable": true,
680
- "prefix": false
681
- },
682
- "800": {
683
- "$value": "#7c214f",
684
- "$type": "color",
685
- "themeable": true,
686
- "prefix": false
687
- },
688
- "900": {
689
- "$value": "#661e3a",
690
- "$type": "color",
691
- "themeable": true,
692
- "prefix": false
693
- },
694
- "950": {
695
- "$value": "#541d31",
696
- "$type": "color",
697
- "themeable": true,
698
- "prefix": false
699
- }
700
- },
701
- "orange": {
702
- "50": {
703
- "$value": "#fae8d1",
704
- "$type": "color",
705
- "themeable": true,
706
- "prefix": false
707
- },
708
- "100": {
709
- "$value": "#f5d6b3",
710
- "$type": "color",
711
- "themeable": true,
712
- "prefix": false
713
- },
714
- "200": {
715
- "$value": "#eebd8c",
716
- "$type": "color",
717
- "themeable": true,
718
- "prefix": false
719
- },
720
- "300": {
721
- "$value": "#e99b60",
722
- "$type": "color",
723
- "themeable": true,
724
- "prefix": false
725
- },
726
- "400": {
727
- "$value": "#e07e41",
728
- "$type": "color",
729
- "themeable": true,
730
- "prefix": false
731
- },
732
- "500": {
733
- "$value": "#c95d2e",
734
- "$type": "color",
735
- "themeable": true,
736
- "prefix": false
737
- },
738
- "600": {
739
- "$value": "#b14f18",
740
- "$type": "color",
741
- "themeable": true,
742
- "prefix": false
743
- },
744
- "700": {
745
- "$value": "#92430a",
746
- "$type": "color",
747
- "themeable": true,
748
- "prefix": false
749
- },
750
- "800": {
751
- "$value": "#6f3500",
752
- "$type": "color",
753
- "themeable": true,
754
- "prefix": false
755
- },
756
- "900": {
757
- "$value": "#5e2f05",
758
- "$type": "color",
759
- "themeable": true,
760
- "prefix": false
761
- },
762
- "950": {
763
- "$value": "#4b2707",
764
- "$type": "color",
765
- "themeable": true,
766
- "prefix": false
767
- }
768
- }
769
- },
770
428
  "brand": {
771
429
  "charcoal": {
772
430
  "$value": "#171321",
@@ -0,0 +1,42 @@
1
+ import { methods, template } from './common_story_options';
2
+ import colorTokens from './color.tokens.json';
3
+
4
+ const generateProps = ({ name = '', tokens = colorTokens } = {}) => ({
5
+ name,
6
+ tokens,
7
+ });
8
+
9
+ export const Default = (args, { argTypes }) => ({
10
+ props: Object.keys(argTypes),
11
+ methods,
12
+ template,
13
+ });
14
+ Default.args = generateProps({
15
+ tokens: {
16
+ white: colorTokens.white,
17
+ black: colorTokens.black,
18
+ },
19
+ });
20
+
21
+ export const Gray = (args, { argTypes }) => ({ props: Object.keys(argTypes), methods, template });
22
+ Gray.args = generateProps({ name: 'gray', tokens: colorTokens.gray });
23
+
24
+ export const Blue = (args, { argTypes }) => ({ props: Object.keys(argTypes), methods, template });
25
+ Blue.args = generateProps({ name: 'blue', tokens: colorTokens.blue });
26
+
27
+ export const Green = (args, { argTypes }) => ({ props: Object.keys(argTypes), methods, template });
28
+ Green.args = generateProps({ name: 'green', tokens: colorTokens.green });
29
+
30
+ export const Orange = (args, { argTypes }) => ({ props: Object.keys(argTypes), methods, template });
31
+ Orange.args = generateProps({ name: 'orange', tokens: colorTokens.orange });
32
+
33
+ export const Red = (args, { argTypes }) => ({ props: Object.keys(argTypes), methods, template });
34
+ Red.args = generateProps({ name: 'red', tokens: colorTokens.red });
35
+
36
+ export const Purple = (args, { argTypes }) => ({ props: Object.keys(argTypes), methods, template });
37
+ Purple.args = generateProps({ name: 'purple', tokens: colorTokens.purple });
38
+
39
+ // eslint-disable-next-line storybook/csf-component
40
+ export default {
41
+ title: 'tokens/color/base/light',
42
+ };
@@ -0,0 +1,31 @@
1
+ import { colorFromBackground } from '../utils/utils';
2
+
3
+ export const methods = {
4
+ getTokenName(name, key) {
5
+ return [name, key].filter(Boolean).join('.');
6
+ },
7
+ getTextColorClass(value) {
8
+ const textColorVariant = colorFromBackground(value, 4.5);
9
+ return {
10
+ 'gl-text-gray-950': textColorVariant === 'dark',
11
+ 'gl-text-white': textColorVariant === 'light',
12
+ };
13
+ },
14
+ };
15
+
16
+ export const template = `
17
+ <ul
18
+ class="gl-list-style-none gl-m-0 gl-p-0"
19
+ >
20
+ <li
21
+ v-for="(token, key) in tokens"
22
+ :key="key"
23
+ class="gl-display-flex gl-justify-content-space-between gl-gap-3 gl-p-3"
24
+ :class="getTextColorClass(token.$value)"
25
+ :style="{ backgroundColor: token.$value }"
26
+ >
27
+ <code class="gl-reset-color">{{ getTokenName(name, key) }}</code>
28
+ <code class="gl-reset-color">{{ token.$value }}</code>
29
+ </li>
30
+ </ul>
31
+ `;
@@ -63,7 +63,7 @@ export function relativeLuminance(rgb) {
63
63
  return 0.2126 * toSrgb(rgb[0]) + 0.7152 * toSrgb(rgb[1]) + 0.0722 * toSrgb(rgb[2]);
64
64
  }
65
65
 
66
- export function colorFromBackground(backgroundColor) {
66
+ export function colorFromBackground(backgroundColor, contrastRatio = 2.4) {
67
67
  let color;
68
68
  const lightColor = rgbFromHex('#FFFFFF');
69
69
  const darkColor = rgbFromHex('#1f1e24');
@@ -83,9 +83,9 @@ export function colorFromBackground(backgroundColor) {
83
83
  const contrastLight = (lightLuminance + 0.05) / (luminance + 0.05);
84
84
  const contrastDark = (luminance + 0.05) / (darkLuminance + 0.05);
85
85
 
86
- // Using a threshold contrast of 2.4 instead of 3
86
+ // Using a default threshold contrast of 2.4 instead of 3
87
87
  // as this will solve weird color combinations in the mid tones
88
- return contrastLight >= 2.4 || contrastLight > contrastDark
88
+ return contrastLight >= contrastRatio || contrastLight > contrastDark
89
89
  ? labelColorOptions.light
90
90
  : labelColorOptions.dark;
91
91
  }