mediacube-ui 0.1.352 → 0.1.354

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.
@@ -35,7 +35,6 @@
35
35
  <script>
36
36
  import McSvgIcon from '../McSvgIcon/McSvgIcon'
37
37
  import { VTooltip } from 'v-tooltip'
38
- import { checkContrastColor } from '../../utils/checkColor'
39
38
 
40
39
  VTooltip.options.defaultBoundariesElement = 'window'
41
40
  export default {
@@ -273,7 +272,6 @@ export default {
273
272
  'mc-button--disabled': this.disabled,
274
273
  'mc-button--rounded': this.rounded && /-compact$/.test(this.size),
275
274
  'mc-button--semi-rounded': this.semiRounded,
276
- 'mc-button--contrast': this.isContrast,
277
275
  'mc-button--full-width': this.fullWidth,
278
276
  'mc-button--uppercase': this.uppercase,
279
277
  'mc-button--shadow': this.shadow,
@@ -305,25 +303,13 @@ export default {
305
303
  type: currentStyle,
306
304
  }
307
305
  },
308
- /**
309
- * Так как сейчас мы используем светлую тему, то проверяем контраст цвета на основе белого
310
- * Проверяем только для main цветов, так как остальные должны подходить по стандарту
311
- * TODO: сделать проверку контраста для темных тем
312
- * */
313
- isContrast() {
314
- let [color] = this.variation.split('-') || []
315
- return color.includes('main') && checkContrastColor(color, [255, 255, 255])
316
- },
317
306
  styles() {
318
307
  let hoverBrightness
319
308
  let textColor
320
309
  switch (this.buttonVariation.type) {
321
310
  case 'flat':
322
311
  case 'outline':
323
- case 'invert': {
324
- if (this.isContrast) textColor = 'black'
325
- break
326
- }
312
+ case 'invert':
327
313
  case 'link':
328
314
  textColor = this.buttonVariation.color
329
315
  break
@@ -338,7 +324,7 @@ export default {
338
324
  break
339
325
  }
340
326
  default: {
341
- textColor = this.isContrast ? 'black' : 'white'
327
+ textColor = 'main-contrast'
342
328
  }
343
329
  }
344
330
  break
@@ -383,15 +369,15 @@ export default {
383
369
  tooltipOptions() {
384
370
  return this.tooltip
385
371
  ? {
386
- content: this.tooltip,
387
- placement: 'top',
388
- classes: 'mc-tooltip mc-tooltip--width-m mc-tooltip--size-s',
389
- trigger: 'hover focus',
390
- show: false,
391
- container: 'body',
392
- template: `<div class="tooltip" role="tooltip"> <div class="tooltip-arrow"></div> <div class="tooltip-inner"><div class="tooltip-inner__content"></div></div> </div>`,
393
- innerSelector: '.tooltip-inner__content',
394
- }
372
+ content: this.tooltip,
373
+ placement: 'top',
374
+ classes: 'mc-tooltip mc-tooltip--width-m mc-tooltip--size-s',
375
+ trigger: 'hover focus',
376
+ show: false,
377
+ container: 'body',
378
+ template: `<div class="tooltip" role="tooltip"> <div class="tooltip-arrow"></div> <div class="tooltip-inner"><div class="tooltip-inner__content"></div></div> </div>`,
379
+ innerSelector: '.tooltip-inner__content',
380
+ }
395
381
  : null
396
382
  },
397
383
  },
@@ -404,7 +390,7 @@ export default {
404
390
  animateUp() {
405
391
  if (this.animation) {
406
392
  this.customAnimation?.text &&
407
- (this.$refs['mc-button'].querySelector('.mc-button__text').innerHTML = this.customAnimation?.text)
393
+ (this.$refs['mc-button'].querySelector('.mc-button__text').innerHTML = this.customAnimation?.text)
408
394
  this.custom_background = this.customAnimation?.background
409
395
  }
410
396
  },
@@ -465,7 +451,6 @@ export default {
465
451
  -webkit-appearance: none;
466
452
  -webkit-text-fill-color: currentColor;
467
453
  z-index: 0;
468
-
469
454
  &__loader {
470
455
  display: none;
471
456
  @include align(true, true, absolute);
@@ -480,18 +465,6 @@ export default {
480
465
  align-items: center;
481
466
  z-index: 1;
482
467
  }
483
- &--contrast {
484
- color: var(--mc-button-text-color) !important;
485
- #{$block-name} {
486
- &--is-active,
487
- &.nuxt-link-active {
488
- color: var(--color-main-dark);
489
- background-color: transparent;
490
- border-color: transparent;
491
- pointer-events: none;
492
- }
493
- }
494
- }
495
468
  &__text {
496
469
  @include ellipsis($display: inline-block);
497
470
  @include layout-flex-fix();
@@ -508,7 +481,6 @@ export default {
508
481
  }
509
482
  }
510
483
  }
511
-
512
484
  &:active {
513
485
  #{$block-name}__background {
514
486
  @content;
@@ -518,7 +490,6 @@ export default {
518
490
  @include hoverMixin {
519
491
  filter: brightness(var(--mc-button-hover-brightness));
520
492
  }
521
-
522
493
  &--size {
523
494
  &-xxs {
524
495
  height: $size-300;
@@ -526,7 +497,6 @@ export default {
526
497
  letter-spacing: normal;
527
498
  font-size: $font-size-200;
528
499
  line-height: $line-height-200;
529
-
530
500
  &-compact {
531
501
  @include size($size-300);
532
502
  padding: $space-50;
@@ -537,7 +507,6 @@ export default {
537
507
  .mc-svg-icon {
538
508
  @include size($size-200);
539
509
  }
540
-
541
510
  #{$block-name} {
542
511
  &__prepend {
543
512
  margin-inline-end: $space-50;
@@ -553,7 +522,6 @@ export default {
553
522
  letter-spacing: normal;
554
523
  font-size: $font-size-200;
555
524
  line-height: $line-height-200;
556
-
557
525
  &-compact {
558
526
  @include size($size-400);
559
527
  padding: 6px;
@@ -564,7 +532,6 @@ export default {
564
532
  .mc-svg-icon {
565
533
  @include size($size-250);
566
534
  }
567
-
568
535
  #{$block-name} {
569
536
  &__prepend {
570
537
  margin-inline-end: $space-50;
@@ -580,7 +547,6 @@ export default {
580
547
  letter-spacing: normal;
581
548
  font-size: $font-size-200;
582
549
  line-height: $line-height-200;
583
-
584
550
  &-compact {
585
551
  @include size($size-500);
586
552
  padding: $space-150;
@@ -591,7 +557,6 @@ export default {
591
557
  .mc-svg-icon {
592
558
  @include size($size-250);
593
559
  }
594
-
595
560
  #{$block-name} {
596
561
  &__prepend {
597
562
  margin-inline-end: $space-50;
@@ -606,7 +571,6 @@ export default {
606
571
  padding: 0 $space-200;
607
572
  font-size: $font-size-200;
608
573
  line-height: $line-height-200;
609
-
610
574
  &-compact {
611
575
  @include size($size-500);
612
576
  padding: $space-100;
@@ -617,7 +581,6 @@ export default {
617
581
  .mc-svg-icon {
618
582
  @include size($size-300);
619
583
  }
620
-
621
584
  #{$block-name} {
622
585
  &__prepend {
623
586
  margin-inline-end: $space-50;
@@ -632,7 +595,6 @@ export default {
632
595
  padding: $space-150 $space-300;
633
596
  font-size: $font-size-200;
634
597
  line-height: $line-height-200;
635
-
636
598
  &-compact {
637
599
  @include size($size-600);
638
600
  padding: $space-150;
@@ -643,7 +605,6 @@ export default {
643
605
  .mc-svg-icon {
644
606
  @include size($size-300);
645
607
  }
646
-
647
608
  #{$block-name} {
648
609
  &__prepend {
649
610
  margin-inline-end: $space-100;
@@ -653,7 +614,6 @@ export default {
653
614
  }
654
615
  }
655
616
  }
656
-
657
617
  &-s,
658
618
  &-m,
659
619
  &-l {
@@ -667,7 +627,6 @@ export default {
667
627
  }
668
628
  }
669
629
  }
670
-
671
630
  &__background {
672
631
  position: absolute;
673
632
  top: 0;
@@ -709,22 +668,9 @@ export default {
709
668
  opacity: 0.1 !important;
710
669
  }
711
670
  }
712
- // TODO check contast colors
713
- //&#{$block-name}--contrast {
714
- // #{$block-name} {
715
- // &__background {
716
- // opacity: 0.4 !important;
717
- // }
718
- // }
719
- //}
720
671
  @include hoverMixin {
721
672
  opacity: 0.2 !important;
722
673
  }
723
- //&#{$block-name}--contrast {
724
- // @include hoverMixin {
725
- // opacity: 0.6 !important;
726
- // }
727
- //}
728
674
  }
729
675
  &-flat {
730
676
  color: var(--mc-button-background-color);
@@ -744,9 +690,6 @@ export default {
744
690
  &#{$block-name}--size-l {
745
691
  line-height: $line-height-250;
746
692
  }
747
- &#{$block-name}--contrast {
748
- filter: brightness(80%);
749
- }
750
693
  &#{$block-name} {
751
694
  &--disabled {
752
695
  opacity: $opacity-disabled;
@@ -760,7 +703,6 @@ export default {
760
703
  filter: brightness(0.85);
761
704
  }
762
705
  }
763
-
764
706
  &:active {
765
707
  filter: brightness(0.85);
766
708
  }
@@ -786,7 +728,6 @@ export default {
786
728
  text-decoration: underline !important;
787
729
  }
788
730
  }
789
-
790
731
  &--secondary-color {
791
732
  @media #{$media-desktop} {
792
733
  &:hover {
@@ -797,12 +738,10 @@ export default {
797
738
  color: var(--mc-button-secondary-color);
798
739
  }
799
740
  }
800
-
801
741
  &--uppercase {
802
742
  text-transform: uppercase;
803
743
  letter-spacing: $letter-spacing-m;
804
744
  }
805
-
806
745
  &--is-active,
807
746
  &.nuxt-link-active {
808
747
  color: var(--color-main);
@@ -810,19 +749,15 @@ export default {
810
749
  border-color: transparent;
811
750
  pointer-events: none;
812
751
  }
813
-
814
752
  &--rounded {
815
753
  border-radius: $radius-circle;
816
754
  }
817
-
818
755
  &--semi-rounded {
819
756
  border-radius: 50px;
820
757
  }
821
-
822
758
  &--full-width {
823
759
  width: 100%;
824
760
  }
825
-
826
761
  &--text-align {
827
762
  &-left {
828
763
  justify-content: flex-start;
@@ -834,20 +769,17 @@ export default {
834
769
  justify-content: flex-end;
835
770
  }
836
771
  }
837
-
838
772
  &--loading,
839
773
  &--icon-loading,
840
774
  &--disabled {
841
775
  pointer-events: none;
842
776
  }
843
-
844
777
  &--loading {
845
778
  #{$block-name} {
846
779
  &__loader {
847
780
  display: inline-block;
848
781
  }
849
782
  }
850
-
851
783
  > *:not(#{$block-name}__loader) {
852
784
  opacity: 0;
853
785
  }
@@ -862,7 +794,6 @@ export default {
862
794
  }
863
795
  }
864
796
  }
865
-
866
797
  &--disabled {
867
798
  color: $color-outline-gray;
868
799
  cursor: not-allowed;
@@ -873,7 +804,6 @@ export default {
873
804
  }
874
805
  }
875
806
  }
876
-
877
807
  &--inactive {
878
808
  pointer-events: none;
879
809
  }
@@ -24,6 +24,7 @@
24
24
  v-if="info || withIndicator"
25
25
  slot="icon-append"
26
26
  variation="main"
27
+ text-color="main-contrast"
27
28
  class="mc-side-bar-button__chip"
28
29
  :class="{ indicator: withIndicator }"
29
30
  >
@@ -276,12 +276,12 @@ export default {
276
276
  }
277
277
  @include col-right-color($vxe-table-row-hover-background-color);
278
278
  &.row--current {
279
- @include col-right-color($vxe-table-row-hover-current-background-color);
279
+ @include col-right-color(transparent);
280
280
  }
281
281
  }
282
282
  &.row--current {
283
283
  background-color: var(--color-main-alpha-10) !important;
284
- @include col-right-color($vxe-table-row-current-background-color);
284
+ @include col-right-color(transparent);
285
285
  }
286
286
  // описка названия в библиотеке таблицы
287
287
  &.row--cheched {
@@ -123,12 +123,12 @@ a {
123
123
 
124
124
  ::selection {
125
125
  background: var(--color-main);
126
- color: $color-white;
126
+ color: var(--color-main-contrast);
127
127
  }
128
128
 
129
129
  ::-moz-selection {
130
130
  background: var(--color-main);
131
- color: $color-white;
131
+ color: var(--color-main-contrast);
132
132
  }
133
133
 
134
134
  input,
@@ -289,6 +289,7 @@ pre {
289
289
  #{'--color-'}#{$name}: #{$color};
290
290
  }
291
291
  // Default main project colors
292
+ --color-main-contrast: $color-white;
292
293
  --color-main: $color-purple;
293
294
  --color-main-dark: $color-hover-purple;
294
295
  @for $i from 1 through 10 {
@@ -8,7 +8,7 @@ $gradient-blue: linear-gradient(180deg, #1ADBFE 0%, #3580F8 100%); /* Нотиф
8
8
  $gradient-yellow: linear-gradient(180deg, #FEE41A 0%, #F89B35 100%); /* Столбики в графике 3 порядка */
9
9
  $gradient-green: linear-gradient(180deg, #C9DD4C 0%, #63BE7E 100%); /* Столбики в графике 2 порядка */
10
10
  $gradient-red: linear-gradient(180deg, #F26567 0%, #F79440 100%); /* Столбики в графике 1 порядка */
11
- $gradient-purple: linear-gradient(270deg, var(--color-main-dark) 0%, var(--color-main) 100%); /* Основной градиент для MCPay */
11
+ $gradient-purple: linear-gradient(270deg, var(--color-main) 0%, var(--color-main-dark) 100%); /* Основной градиент для MCPay */
12
12
  $gradient-purple-pink: linear-gradient(90deg, var(--color-main) 2%, #fe6ffc 100%); /*Градиент промоакции*/
13
13
  $gradient-blue-purple: linear-gradient(90deg, #18bfe3 20%, var(--color-main) 70%); /*Градиент промоакции*/
14
14
  $gradient-dark-blue: linear-gradient(90deg, #5550EF 0%, var(--color-main) 100%); /*Градиент автоплатежей*/
@@ -1,38 +0,0 @@
1
- export function hexToRGB(hex, alpha, byArray = false) {
2
- const r = parseInt(hex.slice(1, 3), 16)
3
- const g = parseInt(hex.slice(3, 5), 16)
4
- const b = parseInt(hex.slice(5, 7), 16)
5
- if (byArray) return [r, g, b]
6
- const rgb_color = `${r}, ${g}, ${b}`
7
- return alpha ? `rgba(${rgb_color}, ${alpha})` : `rgb(${rgb_color})`
8
- }
9
-
10
- /**
11
- * Проверяем контрастность по формуле
12
- * https://www.w3.org/TR/WCAG20-TECHS/G17.html#G17-procedure
13
- * bgColor -
14
- * */
15
- export function checkContrastColor(colorName, bgColor) {
16
- const RED = 0.2126
17
- const GREEN = 0.7152
18
- const BLUE = 0.0722
19
- const GAMMA = 2.4
20
-
21
- function luminance(r, g, b) {
22
- const a = [r, g, b].map(v => {
23
- v /= 255
24
- return v <= 0.03928 ? v / 12.92 : Math.pow((v + 0.055) / 1.055, GAMMA)
25
- })
26
- return a[0] * RED + a[1] * GREEN + a[2] * BLUE
27
- }
28
-
29
- function contrast(rgb1, rgb2) {
30
- const lum1 = luminance(...rgb2)
31
- const lum2 = luminance(...rgb1)
32
- const brightest = Math.max(lum1, lum2)
33
- const darkest = Math.min(lum1, lum2)
34
- return (brightest + 0.05) / (darkest + 0.05)
35
- }
36
- const color = getComputedStyle(document.querySelector(':root')).getPropertyValue(`--color-${colorName}`) || colorName
37
- return contrast(hexToRGB(color, null, true), bgColor) < 4
38
- }