@paypal/checkout-components 5.0.413 → 5.0.414
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/dist/button.js +1 -1
- package/dist/test/button.js +1 -1
- package/package.json +2 -2
- package/src/funding/common.jsx +6 -0
- package/src/funding/funding.js +8 -1
- package/src/funding/funding.test.js +69 -0
- package/src/funding/itau/config.jsx +21 -8
- package/src/funding/paylater/config.jsx +7 -12
- package/src/funding/sepa/config.jsx +29 -1
- package/src/marks/component.jsx +4 -0
- package/src/ui/buttons/buttons.jsx +2 -0
- package/src/ui/buttons/config.js +50 -26
- package/src/ui/buttons/poweredBy.jsx +8 -3
- package/src/ui/buttons/props.js +7 -29
- package/src/ui/buttons/props.test.js +0 -42
- package/src/ui/buttons/script.jsx +0 -47
- package/src/ui/buttons/styles/button.js +21 -4
- package/src/ui/buttons/styles/color.js +67 -41
- package/src/ui/buttons/styles/disableMaxHeightConfig.test.js +71 -0
- package/src/ui/buttons/styles/labels.js +23 -0
- package/src/ui/buttons/styles/responsive.js +124 -88
- package/src/ui/buttons/styles/styleUtils.js +9 -7
- package/src/ui/buttons/styles/styleUtils.test.js +23 -76
- package/src/ui/buttons/tagline.jsx +8 -4
- package/src/zoid/buttons/component.jsx +4 -0
|
@@ -18,6 +18,8 @@ import {
|
|
|
18
18
|
BUTTON_RELATIVE_STYLE,
|
|
19
19
|
BUTTON_DISABLE_MAX_HEIGHT_STYLE,
|
|
20
20
|
BUTTON_REDESIGN_STYLE,
|
|
21
|
+
BUTTON_REDESIGN_DISABLEMAXHEIGHT_STYLE,
|
|
22
|
+
REBRAND_LABEL_HEIGHT_RATIO,
|
|
21
23
|
} from "../config";
|
|
22
24
|
import { isBorderRadiusNumber } from "../util";
|
|
23
25
|
|
|
@@ -179,20 +181,23 @@ const generateButtonSizeStyles = ({
|
|
|
179
181
|
.${CLASS.BUTTON}.${CLASS.BORDER_RADIUS} {
|
|
180
182
|
${
|
|
181
183
|
borderRadius && isBorderRadiusNumber(borderRadius)
|
|
182
|
-
?
|
|
184
|
+
? `--btn-radius: ${borderRadius}px; border-radius: ${borderRadius}px`
|
|
183
185
|
: ""
|
|
184
186
|
}
|
|
185
187
|
}
|
|
186
188
|
|
|
187
189
|
.${CLASS.BUTTON}.${CLASS.SHAPE}-${BUTTON_SHAPE.SHARP} {
|
|
190
|
+
--btn-radius: 0px;
|
|
188
191
|
border-radius: 0px;
|
|
189
192
|
}
|
|
190
193
|
|
|
191
194
|
.${CLASS.BUTTON}.${CLASS.SHAPE}-${BUTTON_SHAPE.RECT} {
|
|
195
|
+
--btn-radius: 4px;
|
|
192
196
|
border-radius: 4px;
|
|
193
197
|
}
|
|
194
198
|
|
|
195
199
|
.${CLASS.BUTTON}.${CLASS.SHAPE}-${BUTTON_SHAPE.PILL} {
|
|
200
|
+
--btn-radius: ${pillBorderRadius}px;
|
|
196
201
|
border-radius: ${pillBorderRadius}px;
|
|
197
202
|
}
|
|
198
203
|
|
|
@@ -399,7 +404,7 @@ const generateDisableMaxHeightStyles = ({
|
|
|
399
404
|
const { minHeight, maxHeight } = disableHeightStyle;
|
|
400
405
|
|
|
401
406
|
return `
|
|
402
|
-
@
|
|
407
|
+
@container (min-height: ${minHeight}px) and (max-height: ${maxHeight}px) {
|
|
403
408
|
.${CLASS.BUTTON_LABEL} {
|
|
404
409
|
gap: ${gap}px;
|
|
405
410
|
}
|
|
@@ -457,7 +462,7 @@ const generateDisableMaxHeightStyles = ({
|
|
|
457
462
|
border-radius: ${pillBorderRadius}px;
|
|
458
463
|
}
|
|
459
464
|
|
|
460
|
-
.${CLASS.BUTTON_ROW}.${CLASS.SHAPE}-${BUTTON_SHAPE.PILL}
|
|
465
|
+
.${CLASS.BUTTON_ROW}.${CLASS.SHAPE}-${BUTTON_SHAPE.PILL}
|
|
461
466
|
.menu-button {
|
|
462
467
|
border-top-right-radius: ${pillBorderRadius}px;
|
|
463
468
|
border-bottom-right-radius: ${pillBorderRadius}px;
|
|
@@ -482,21 +487,26 @@ const generateDisableMaxHeightStyles = ({
|
|
|
482
487
|
};
|
|
483
488
|
|
|
484
489
|
const generateRebrandedDisableMaxHeightStyles = (): string => {
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
490
|
+
const sizeKeys = Object.keys(BUTTON_REDESIGN_DISABLEMAXHEIGHT_STYLE);
|
|
491
|
+
return sizeKeys
|
|
492
|
+
.map((redesignSize, sizeIndex) => {
|
|
493
|
+
const isLastSizeBucket = sizeIndex === sizeKeys.length - 1;
|
|
494
|
+
const style = BUTTON_REDESIGN_DISABLEMAXHEIGHT_STYLE[redesignSize];
|
|
495
|
+
const { gap, fontSize, minHeight, maxHeight } = style;
|
|
496
|
+
const maxHeightQuery = isLastSizeBucket
|
|
497
|
+
? ""
|
|
498
|
+
: `and (max-height: ${maxHeight}px)`;
|
|
491
499
|
|
|
492
500
|
return `
|
|
493
|
-
@
|
|
501
|
+
@container (min-height: ${minHeight}px) ${maxHeightQuery} {
|
|
494
502
|
.${CLASS.BUTTON_REBRAND} > .${CLASS.BUTTON_LABEL} {
|
|
495
503
|
gap: ${gap}px;
|
|
496
504
|
}
|
|
497
|
-
.${CLASS.CONTAINER} .${CLASS.BUTTON_ROW} .${CLASS.TEXT},
|
|
498
|
-
.${CLASS.CONTAINER} .${CLASS.BUTTON_ROW} .${CLASS.SPACE} {
|
|
505
|
+
.${CLASS.CONTAINER} .${CLASS.BUTTON_ROW} .${CLASS.BUTTON_REBRAND} .${CLASS.TEXT},
|
|
506
|
+
.${CLASS.CONTAINER} .${CLASS.BUTTON_ROW} .${CLASS.BUTTON_REBRAND} .${CLASS.SPACE} {
|
|
499
507
|
font-size: ${fontSize}px;
|
|
508
|
+
line-height: 1.2;
|
|
509
|
+
margin: 0;
|
|
500
510
|
}
|
|
501
511
|
}
|
|
502
512
|
`;
|
|
@@ -517,11 +527,12 @@ const generateRebrandedButtonSizeStyles = ({
|
|
|
517
527
|
borderRadius?: ?number,
|
|
518
528
|
shouldApplyRebrandedStyles?: boolean,
|
|
519
529
|
|}): string => {
|
|
520
|
-
|
|
521
|
-
|
|
530
|
+
const redesignSizeKeys = Object.keys(BUTTON_REDESIGN_STYLE);
|
|
531
|
+
return redesignSizeKeys
|
|
532
|
+
.map((redesignSize, sizeIndex) => {
|
|
533
|
+
const isLastSizeBucket = sizeIndex === redesignSizeKeys.length - 1;
|
|
522
534
|
const {
|
|
523
535
|
buttonHeight,
|
|
524
|
-
pillBorderRadius,
|
|
525
536
|
gap,
|
|
526
537
|
fontSize,
|
|
527
538
|
defaultHeight,
|
|
@@ -532,9 +543,13 @@ const generateRebrandedButtonSizeStyles = ({
|
|
|
532
543
|
minDualWidth,
|
|
533
544
|
} = getResponsiveRebrandedStyleVariables({
|
|
534
545
|
height,
|
|
535
|
-
|
|
546
|
+
redesignSize,
|
|
536
547
|
});
|
|
537
548
|
|
|
549
|
+
const maxWidthQuery = isLastSizeBucket
|
|
550
|
+
? ""
|
|
551
|
+
: `and (max-width: ${maxWidth}px)`;
|
|
552
|
+
|
|
538
553
|
const widthBasedStyles = `
|
|
539
554
|
@media only screen and (min-width: ${minWidth}px) {
|
|
540
555
|
.${CLASS.CONTAINER} {
|
|
@@ -556,7 +571,9 @@ const generateRebrandedButtonSizeStyles = ({
|
|
|
556
571
|
.${CLASS.BUTTON_REBRAND} > .${CLASS.BUTTON_LABEL} {
|
|
557
572
|
margin: 0px 4vw;
|
|
558
573
|
box-sizing: border-box;
|
|
559
|
-
height: ${
|
|
574
|
+
height: ${Math.round(
|
|
575
|
+
buttonHeight * REBRAND_LABEL_HEIGHT_RATIO
|
|
576
|
+
)}px;
|
|
560
577
|
}
|
|
561
578
|
|
|
562
579
|
.${CLASS.BUTTON_REBRAND}.${CLASS.NUMBER}-${BUTTON_NUMBER.MULTIPLE} .${
|
|
@@ -565,20 +582,8 @@ const generateRebrandedButtonSizeStyles = ({
|
|
|
565
582
|
gap: ${gap}px;
|
|
566
583
|
}
|
|
567
584
|
|
|
568
|
-
.${CLASS.
|
|
569
|
-
|
|
570
|
-
} .${CLASS.TEXT},
|
|
571
|
-
.${CLASS.CONTAINER} .${CLASS.BUTTON_ROW}.${CLASS.NUMBER}-${
|
|
572
|
-
BUTTON_NUMBER.MULTIPLE
|
|
573
|
-
} .${CLASS.SPACE} {
|
|
574
|
-
font-size: ${fontSize}px;
|
|
575
|
-
}
|
|
576
|
-
|
|
577
|
-
.${CLASS.BUTTON_ROW}.${CLASS.NUMBER}-${BUTTON_NUMBER.MULTIPLE} .${
|
|
578
|
-
CLASS.BUTTON_REBRAND
|
|
579
|
-
} .${CLASS.TEXT} {
|
|
580
|
-
line-height: 1.2;
|
|
581
|
-
margin: 0;
|
|
585
|
+
.${CLASS.TAGLINE} .${CLASS.TEXT} {
|
|
586
|
+
font-size: ${minWidth >= 500 ? 14 : 12}px;
|
|
582
587
|
}
|
|
583
588
|
|
|
584
589
|
.${CLASS.BUTTON_ROW}.${CLASS.LAYOUT}-${BUTTON_LAYOUT.VERTICAL}.${
|
|
@@ -596,8 +601,73 @@ const generateRebrandedButtonSizeStyles = ({
|
|
|
596
601
|
}-${BUTTON_NUMBER.MULTIPLE}:last-child {
|
|
597
602
|
margin-bottom: 0;
|
|
598
603
|
}
|
|
604
|
+
|
|
605
|
+
.${CLASS.BUTTON}.${CLASS.BORDER_RADIUS} {
|
|
606
|
+
${
|
|
607
|
+
borderRadius && isBorderRadiusNumber(borderRadius)
|
|
608
|
+
? `--btn-radius: ${borderRadius}px; border-radius: ${borderRadius}px`
|
|
609
|
+
: ""
|
|
610
|
+
}
|
|
611
|
+
}
|
|
612
|
+
|
|
613
|
+
.${CLASS.BUTTON}.${CLASS.SHAPE}-${BUTTON_SHAPE.SHARP} {
|
|
614
|
+
--btn-radius: 0px;
|
|
615
|
+
border-radius: 0px;
|
|
616
|
+
}
|
|
617
|
+
|
|
618
|
+
.${CLASS.BUTTON}.${CLASS.SHAPE}-${BUTTON_SHAPE.RECT} {
|
|
619
|
+
--btn-radius: 4px;
|
|
620
|
+
border-radius: 4px;
|
|
621
|
+
}
|
|
622
|
+
|
|
623
|
+
.${CLASS.BUTTON}.${CLASS.SHAPE}-${BUTTON_SHAPE.PILL} {
|
|
624
|
+
--btn-radius: 9999px;
|
|
625
|
+
border-radius: 9999px;
|
|
626
|
+
}
|
|
627
|
+
|
|
628
|
+
.${CLASS.BUTTON_ROW}.${CLASS.BORDER_RADIUS} .menu-button {
|
|
629
|
+
${
|
|
630
|
+
borderRadius && isBorderRadiusNumber(borderRadius)
|
|
631
|
+
? `border-top-right-radius: ${borderRadius}px; border-bottom-right-radius: ${borderRadius}px`
|
|
632
|
+
: ""
|
|
633
|
+
}
|
|
634
|
+
}
|
|
635
|
+
|
|
636
|
+
.${CLASS.BUTTON_ROW}.${CLASS.SHAPE}-${
|
|
637
|
+
BUTTON_SHAPE.SHARP
|
|
638
|
+
} .menu-button {
|
|
639
|
+
border-top-right-radius: 0px;
|
|
640
|
+
border-bottom-right-radius: 0px;
|
|
641
|
+
}
|
|
642
|
+
|
|
643
|
+
.${CLASS.BUTTON_ROW}.${CLASS.SHAPE}-${
|
|
644
|
+
BUTTON_SHAPE.RECT
|
|
645
|
+
} .menu-button {
|
|
646
|
+
border-top-right-radius: 4px;
|
|
647
|
+
border-bottom-right-radius: 4px;
|
|
648
|
+
}
|
|
649
|
+
|
|
650
|
+
.${CLASS.BUTTON_ROW}.${CLASS.SHAPE}-${
|
|
651
|
+
BUTTON_SHAPE.PILL
|
|
652
|
+
} .menu-button {
|
|
653
|
+
border-top-right-radius: 9999px;
|
|
654
|
+
border-bottom-right-radius: 9999px;
|
|
655
|
+
}
|
|
599
656
|
}
|
|
600
|
-
|
|
657
|
+
|
|
658
|
+
@media only screen and (min-width: ${minWidth}px) ${maxWidthQuery} {
|
|
659
|
+
.${CLASS.CONTAINER} .${CLASS.BUTTON_ROW} .${CLASS.BUTTON_REBRAND} .${
|
|
660
|
+
CLASS.TEXT
|
|
661
|
+
},
|
|
662
|
+
.${CLASS.CONTAINER} .${CLASS.BUTTON_ROW} .${CLASS.BUTTON_REBRAND} .${
|
|
663
|
+
CLASS.SPACE
|
|
664
|
+
} {
|
|
665
|
+
font-size: ${fontSize}px;
|
|
666
|
+
line-height: 1.2;
|
|
667
|
+
margin: 0;
|
|
668
|
+
}
|
|
669
|
+
}
|
|
670
|
+
|
|
601
671
|
@media only screen and (min-width: ${minWidth}px) and (max-width: ${minDualWidth}px) {
|
|
602
672
|
.${CLASS.BUTTON_ROW}.${CLASS.LAYOUT}-${BUTTON_LAYOUT.HORIZONTAL}.${
|
|
603
673
|
CLASS.NUMBER
|
|
@@ -672,17 +742,18 @@ const generateRebrandedButtonSizeStyles = ({
|
|
|
672
742
|
`;
|
|
673
743
|
|
|
674
744
|
const heightBasedStyles = `
|
|
675
|
-
@
|
|
745
|
+
@container (min-height: ${minHeight}px) and (max-height: ${maxHeight}px) {
|
|
676
746
|
.${CLASS.BUTTON_REBRAND} > .${CLASS.BUTTON_LABEL} {
|
|
677
747
|
gap: ${gap}px;
|
|
678
748
|
}
|
|
679
749
|
|
|
680
|
-
.${CLASS.CONTAINER} .${CLASS.BUTTON_ROW} .${CLASS.
|
|
681
|
-
|
|
750
|
+
.${CLASS.CONTAINER} .${CLASS.BUTTON_ROW} .${CLASS.BUTTON_REBRAND}.${
|
|
751
|
+
CLASS.BUTTON_REBRAND
|
|
752
|
+
} .${CLASS.TEXT},
|
|
753
|
+
.${CLASS.CONTAINER} .${CLASS.BUTTON_ROW} .${CLASS.BUTTON_REBRAND}.${
|
|
754
|
+
CLASS.BUTTON_REBRAND
|
|
755
|
+
} .${CLASS.SPACE} {
|
|
682
756
|
font-size: ${fontSize}px;
|
|
683
|
-
}
|
|
684
|
-
|
|
685
|
-
.${CLASS.BUTTON_ROW} .${CLASS.BUTTON_REBRAND} .${CLASS.TEXT} {
|
|
686
757
|
line-height: 1.2;
|
|
687
758
|
margin: 0;
|
|
688
759
|
}
|
|
@@ -733,56 +804,7 @@ const generateRebrandedButtonSizeStyles = ({
|
|
|
733
804
|
} .${CLASS.SPACE} {
|
|
734
805
|
line-height: ${perc(buttonHeight, 50) + 5}px;
|
|
735
806
|
}
|
|
736
|
-
|
|
737
|
-
.${CLASS.BUTTON}.${CLASS.BORDER_RADIUS} {
|
|
738
|
-
${
|
|
739
|
-
borderRadius && isBorderRadiusNumber(borderRadius)
|
|
740
|
-
? `border-radius: ${borderRadius}px`
|
|
741
|
-
: ""
|
|
742
|
-
}
|
|
743
|
-
}
|
|
744
|
-
|
|
745
|
-
.${CLASS.BUTTON}.${CLASS.SHAPE}-${BUTTON_SHAPE.SHARP} {
|
|
746
|
-
border-radius: 0px;
|
|
747
|
-
}
|
|
748
807
|
|
|
749
|
-
.${CLASS.BUTTON}.${CLASS.SHAPE}-${BUTTON_SHAPE.RECT} {
|
|
750
|
-
border-radius: 4px;
|
|
751
|
-
}
|
|
752
|
-
|
|
753
|
-
.${CLASS.BUTTON}.${CLASS.SHAPE}-${BUTTON_SHAPE.PILL} {
|
|
754
|
-
border-radius: ${pillBorderRadius}px;
|
|
755
|
-
}
|
|
756
|
-
|
|
757
|
-
.${CLASS.BUTTON_ROW}.${CLASS.BORDER_RADIUS} .menu-button {
|
|
758
|
-
${
|
|
759
|
-
borderRadius && isBorderRadiusNumber(borderRadius)
|
|
760
|
-
? `border-top-right-radius: ${borderRadius}px; border-bottom-right-radius: ${borderRadius}px`
|
|
761
|
-
: ""
|
|
762
|
-
}
|
|
763
|
-
}
|
|
764
|
-
|
|
765
|
-
.${CLASS.BUTTON_ROW}.${CLASS.SHAPE}-${
|
|
766
|
-
BUTTON_SHAPE.SHARP
|
|
767
|
-
} .menu-button {
|
|
768
|
-
border-top-right-radius: 0px;
|
|
769
|
-
border-bottom-right-radius: 0px;
|
|
770
|
-
}
|
|
771
|
-
|
|
772
|
-
.${CLASS.BUTTON_ROW}.${CLASS.SHAPE}-${
|
|
773
|
-
BUTTON_SHAPE.RECT
|
|
774
|
-
} .menu-button {
|
|
775
|
-
border-top-right-radius: 4px;
|
|
776
|
-
border-bottom-right-radius: 4px;
|
|
777
|
-
}
|
|
778
|
-
|
|
779
|
-
.${CLASS.BUTTON_ROW}.${CLASS.SHAPE}-${
|
|
780
|
-
BUTTON_SHAPE.PILL
|
|
781
|
-
} .menu-button {
|
|
782
|
-
border-top-right-radius: ${pillBorderRadius}px;
|
|
783
|
-
border-bottom-right-radius: ${pillBorderRadius}px;
|
|
784
|
-
}
|
|
785
|
-
|
|
786
808
|
.${CLASS.TAGLINE} .${CLASS.TEXT} {
|
|
787
809
|
height: ${perc(buttonHeight, BUTTON_RELATIVE_STYLE.TAGLINE)}px;
|
|
788
810
|
line-height: ${perc(
|
|
@@ -869,16 +891,22 @@ export function buttonResponsiveStyle({
|
|
|
869
891
|
.${CLASS.BUTTON}.${CLASS.BORDER_RADIUS} {
|
|
870
892
|
${
|
|
871
893
|
borderRadius && isBorderRadiusNumber(borderRadius)
|
|
872
|
-
?
|
|
894
|
+
? `--btn-radius: ${borderRadius}px; border-radius: ${borderRadius}px`
|
|
873
895
|
: ""
|
|
874
896
|
};
|
|
875
897
|
}
|
|
876
898
|
.${CLASS.BUTTON}.${CLASS.SHAPE}-${BUTTON_SHAPE.SHARP} {
|
|
899
|
+
--btn-radius: 0px;
|
|
877
900
|
border-radius: 0px;
|
|
878
901
|
}
|
|
879
902
|
.${CLASS.BUTTON}.${CLASS.SHAPE}-${BUTTON_SHAPE.RECT} {
|
|
903
|
+
--btn-radius: 4px;
|
|
880
904
|
border-radius: 4px;
|
|
881
905
|
}
|
|
906
|
+
.${CLASS.BUTTON}.${CLASS.SHAPE}-${BUTTON_SHAPE.PILL} {
|
|
907
|
+
--btn-radius: 9999px;
|
|
908
|
+
border-radius: 9999px;
|
|
909
|
+
}
|
|
882
910
|
|
|
883
911
|
// menu button - border radius
|
|
884
912
|
.${CLASS.BUTTON_ROW}.${CLASS.BORDER_RADIUS} .menu-button {
|
|
@@ -898,10 +926,18 @@ export function buttonResponsiveStyle({
|
|
|
898
926
|
border-top-right-radius: 4px;
|
|
899
927
|
border-bottom-right-radius: 4px;
|
|
900
928
|
}
|
|
929
|
+
.${CLASS.BUTTON_ROW}.${CLASS.SHAPE}-${BUTTON_SHAPE.PILL} .menu-button {
|
|
930
|
+
border-top-right-radius: 9999px;
|
|
931
|
+
border-bottom-right-radius: 9999px;
|
|
932
|
+
}
|
|
901
933
|
|
|
902
934
|
.${CLASS.CARD} {
|
|
903
935
|
display: inline-block;
|
|
904
936
|
height: 100%;
|
|
937
|
+
}
|
|
938
|
+
|
|
939
|
+
.${CLASS.BUTTON_ROW} {
|
|
940
|
+
container-type: size;
|
|
905
941
|
}`;
|
|
906
942
|
|
|
907
943
|
const rebrandedStyles = shouldApplyRebrandedStyles
|
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
BUTTON_DISABLE_MAX_HEIGHT_STYLE,
|
|
8
8
|
BUTTON_SIZE_STYLE,
|
|
9
9
|
BUTTON_REDESIGN_STYLE,
|
|
10
|
+
REBRAND_LABEL_HEIGHT_RATIO,
|
|
10
11
|
} from "../config";
|
|
11
12
|
import {
|
|
12
13
|
BUTTON_SIZE,
|
|
@@ -32,7 +33,7 @@ function getLabelHeight({
|
|
|
32
33
|
let labelHeight = max(roundUp(perc(height, labelPercPercentage) + 5, 2), 12);
|
|
33
34
|
|
|
34
35
|
if (shouldApplyRebrandedStyles) {
|
|
35
|
-
labelHeight = roundUp(perc(height,
|
|
36
|
+
labelHeight = roundUp(perc(height, REBRAND_LABEL_HEIGHT_RATIO * 100), 1);
|
|
36
37
|
}
|
|
37
38
|
|
|
38
39
|
return parseInt(labelHeight, 10);
|
|
@@ -141,7 +142,10 @@ export function getResponsiveStyleVariables({
|
|
|
141
142
|
const pillBorderRadius = Math.ceil(buttonHeight / 2);
|
|
142
143
|
|
|
143
144
|
if (shouldApplyRebrandedStyles) {
|
|
144
|
-
labelHeight = roundUp(
|
|
145
|
+
labelHeight = roundUp(
|
|
146
|
+
perc(buttonHeight, REBRAND_LABEL_HEIGHT_RATIO * 100),
|
|
147
|
+
1
|
|
148
|
+
);
|
|
145
149
|
// smallerLabelHeight gets triggered at widths < 320px
|
|
146
150
|
// We will need to investigate why the labels need to get significantly smaller at this breakpoint
|
|
147
151
|
smallerLabelHeight = labelHeight;
|
|
@@ -165,12 +169,12 @@ export function getResponsiveStyleVariables({
|
|
|
165
169
|
|
|
166
170
|
export function getResponsiveRebrandedStyleVariables({
|
|
167
171
|
height,
|
|
168
|
-
|
|
172
|
+
redesignSize,
|
|
169
173
|
}: {|
|
|
170
174
|
height?: ?number,
|
|
171
|
-
|
|
175
|
+
redesignSize: $Values<typeof BUTTON_REDESIGN_SIZE>,
|
|
172
176
|
|}): Object {
|
|
173
|
-
const style = BUTTON_REDESIGN_STYLE[
|
|
177
|
+
const style = BUTTON_REDESIGN_STYLE[redesignSize];
|
|
174
178
|
const {
|
|
175
179
|
minHeight,
|
|
176
180
|
maxHeight,
|
|
@@ -182,7 +186,6 @@ export function getResponsiveRebrandedStyleVariables({
|
|
|
182
186
|
} = style;
|
|
183
187
|
|
|
184
188
|
const buttonHeight = height || defaultHeight;
|
|
185
|
-
const pillBorderRadius = Math.ceil(buttonHeight / 2);
|
|
186
189
|
|
|
187
190
|
const minDualWidth = Math.max(
|
|
188
191
|
Math.round(
|
|
@@ -194,7 +197,6 @@ export function getResponsiveRebrandedStyleVariables({
|
|
|
194
197
|
const styleVariables = {
|
|
195
198
|
style,
|
|
196
199
|
buttonHeight,
|
|
197
|
-
pillBorderRadius,
|
|
198
200
|
gap,
|
|
199
201
|
defaultHeight,
|
|
200
202
|
minHeight,
|
|
@@ -398,10 +398,9 @@ const expectedRebrandDisableMaxHeightStylesTiny = {
|
|
|
398
398
|
buttonHeight: 25,
|
|
399
399
|
disableHeightStyle:
|
|
400
400
|
BUTTON_DISABLE_MAX_HEIGHT_STYLE[BUTTON_DISABLE_MAX_HEIGHT_SIZE.TINY],
|
|
401
|
-
labelHeight:
|
|
401
|
+
labelHeight: 13,
|
|
402
402
|
fontSize: 10,
|
|
403
403
|
marginTop: 1,
|
|
404
|
-
pillBorderRadius: 13,
|
|
405
404
|
spinnerSize: 13,
|
|
406
405
|
gap: 3,
|
|
407
406
|
};
|
|
@@ -412,10 +411,9 @@ const expectedRebrandDisableMaxHeightStylesSmall = {
|
|
|
412
411
|
buttonHeight: 30,
|
|
413
412
|
disableHeightStyle:
|
|
414
413
|
BUTTON_DISABLE_MAX_HEIGHT_STYLE[BUTTON_DISABLE_MAX_HEIGHT_SIZE.SMALL],
|
|
415
|
-
labelHeight:
|
|
414
|
+
labelHeight: 15,
|
|
416
415
|
fontSize: 11,
|
|
417
416
|
marginTop: 1,
|
|
418
|
-
pillBorderRadius: 15,
|
|
419
417
|
spinnerSize: 15,
|
|
420
418
|
gap: 3,
|
|
421
419
|
};
|
|
@@ -428,10 +426,9 @@ const expectedRebrandDisableMaxHeightStylesMediumSmall = {
|
|
|
428
426
|
BUTTON_DISABLE_MAX_HEIGHT_STYLE[
|
|
429
427
|
BUTTON_DISABLE_MAX_HEIGHT_SIZE.MEDIUM_SMALL
|
|
430
428
|
],
|
|
431
|
-
labelHeight:
|
|
429
|
+
labelHeight: 18,
|
|
432
430
|
fontSize: 13,
|
|
433
431
|
marginTop: 1,
|
|
434
|
-
pillBorderRadius: 18,
|
|
435
432
|
spinnerSize: 18,
|
|
436
433
|
gap: 4,
|
|
437
434
|
};
|
|
@@ -442,10 +439,9 @@ const expectedRebrandDisableMaxHeightStylesMediumBig = {
|
|
|
442
439
|
buttonHeight: 40,
|
|
443
440
|
disableHeightStyle:
|
|
444
441
|
BUTTON_DISABLE_MAX_HEIGHT_STYLE[BUTTON_DISABLE_MAX_HEIGHT_SIZE.MEDIUM_BIG],
|
|
445
|
-
labelHeight:
|
|
442
|
+
labelHeight: 20,
|
|
446
443
|
fontSize: 14,
|
|
447
444
|
marginTop: 1,
|
|
448
|
-
pillBorderRadius: 20,
|
|
449
445
|
spinnerSize: 20,
|
|
450
446
|
gap: 4,
|
|
451
447
|
};
|
|
@@ -456,10 +452,9 @@ const expectedRebrandDisableMaxHeightStylesLargeSmall = {
|
|
|
456
452
|
buttonHeight: 45,
|
|
457
453
|
disableHeightStyle:
|
|
458
454
|
BUTTON_DISABLE_MAX_HEIGHT_STYLE[BUTTON_DISABLE_MAX_HEIGHT_SIZE.LARGE_SMALL],
|
|
459
|
-
labelHeight:
|
|
455
|
+
labelHeight: 23,
|
|
460
456
|
fontSize: 16,
|
|
461
457
|
marginTop: 2,
|
|
462
|
-
pillBorderRadius: 23,
|
|
463
458
|
spinnerSize: 23,
|
|
464
459
|
gap: 5,
|
|
465
460
|
};
|
|
@@ -470,10 +465,9 @@ const expectedRebrandDisableMaxHeightStylesLargeBig = {
|
|
|
470
465
|
buttonHeight: 50,
|
|
471
466
|
disableHeightStyle:
|
|
472
467
|
BUTTON_DISABLE_MAX_HEIGHT_STYLE[BUTTON_DISABLE_MAX_HEIGHT_SIZE.LARGE_BIG],
|
|
473
|
-
labelHeight:
|
|
468
|
+
labelHeight: 25,
|
|
474
469
|
fontSize: 18,
|
|
475
470
|
marginTop: 2,
|
|
476
|
-
pillBorderRadius: 25,
|
|
477
471
|
spinnerSize: 25,
|
|
478
472
|
gap: 5,
|
|
479
473
|
};
|
|
@@ -484,10 +478,9 @@ const expectedRebrandDisableMaxHeightStylesXL = {
|
|
|
484
478
|
buttonHeight: 55,
|
|
485
479
|
disableHeightStyle:
|
|
486
480
|
BUTTON_DISABLE_MAX_HEIGHT_STYLE[BUTTON_DISABLE_MAX_HEIGHT_SIZE.XL],
|
|
487
|
-
labelHeight:
|
|
481
|
+
labelHeight: 28,
|
|
488
482
|
fontSize: 20,
|
|
489
483
|
marginTop: 2,
|
|
490
|
-
pillBorderRadius: 28,
|
|
491
484
|
spinnerSize: 28,
|
|
492
485
|
gap: 6,
|
|
493
486
|
};
|
|
@@ -498,10 +491,9 @@ const expectedRebrandDisableMaxHeightStylesXXL = {
|
|
|
498
491
|
buttonHeight: 65,
|
|
499
492
|
disableHeightStyle:
|
|
500
493
|
BUTTON_DISABLE_MAX_HEIGHT_STYLE[BUTTON_DISABLE_MAX_HEIGHT_SIZE.XXL],
|
|
501
|
-
labelHeight:
|
|
494
|
+
labelHeight: 33,
|
|
502
495
|
fontSize: 23,
|
|
503
496
|
marginTop: 2,
|
|
504
|
-
pillBorderRadius: 33,
|
|
505
497
|
spinnerSize: 33,
|
|
506
498
|
gap: 7,
|
|
507
499
|
};
|
|
@@ -512,10 +504,9 @@ const expectedRebrandDisableMaxHeightStylesXXXL = {
|
|
|
512
504
|
buttonHeight: 75,
|
|
513
505
|
disableHeightStyle:
|
|
514
506
|
BUTTON_DISABLE_MAX_HEIGHT_STYLE[BUTTON_DISABLE_MAX_HEIGHT_SIZE.XXXL],
|
|
515
|
-
labelHeight:
|
|
507
|
+
labelHeight: 38,
|
|
516
508
|
fontSize: 27,
|
|
517
509
|
marginTop: 3,
|
|
518
|
-
pillBorderRadius: 38,
|
|
519
510
|
spinnerSize: 38,
|
|
520
511
|
gap: 7,
|
|
521
512
|
};
|
|
@@ -524,7 +515,6 @@ const expectedRebrandDisableMaxHeightStylesXXXL = {
|
|
|
524
515
|
const expectedRebrandedResponsiveStylesExtraSmall = {
|
|
525
516
|
style: BUTTON_REDESIGN_STYLE[BUTTON_REDESIGN_SIZE.EXTRA_SMALL],
|
|
526
517
|
buttonHeight: 20,
|
|
527
|
-
pillBorderRadius: 10,
|
|
528
518
|
gap: 3,
|
|
529
519
|
defaultHeight: 20,
|
|
530
520
|
minHeight: 20,
|
|
@@ -532,13 +522,12 @@ const expectedRebrandedResponsiveStylesExtraSmall = {
|
|
|
532
522
|
minWidth: 50,
|
|
533
523
|
minDualWidth: 300,
|
|
534
524
|
maxWidth: 75,
|
|
535
|
-
fontSize:
|
|
525
|
+
fontSize: 10,
|
|
536
526
|
};
|
|
537
527
|
|
|
538
528
|
const expectedRebrandedResponsiveStylesTiny = {
|
|
539
529
|
style: BUTTON_REDESIGN_STYLE[BUTTON_REDESIGN_SIZE.TINY],
|
|
540
530
|
buttonHeight: 25,
|
|
541
|
-
pillBorderRadius: 13,
|
|
542
531
|
gap: 3,
|
|
543
532
|
defaultHeight: 25,
|
|
544
533
|
minHeight: 25,
|
|
@@ -546,27 +535,25 @@ const expectedRebrandedResponsiveStylesTiny = {
|
|
|
546
535
|
minWidth: 75,
|
|
547
536
|
minDualWidth: 300,
|
|
548
537
|
maxWidth: 200,
|
|
549
|
-
fontSize:
|
|
538
|
+
fontSize: 10,
|
|
550
539
|
};
|
|
551
540
|
|
|
552
541
|
const expectedRebrandedResponsiveStylesSmall = {
|
|
553
542
|
style: BUTTON_REDESIGN_STYLE[BUTTON_REDESIGN_SIZE.SMALL],
|
|
554
543
|
buttonHeight: 35,
|
|
555
|
-
|
|
556
|
-
gap: 3,
|
|
544
|
+
gap: 4,
|
|
557
545
|
defaultHeight: 35,
|
|
558
546
|
minHeight: 30,
|
|
559
547
|
maxHeight: 35,
|
|
560
548
|
minWidth: 200,
|
|
561
549
|
minDualWidth: 300,
|
|
562
550
|
maxWidth: 250,
|
|
563
|
-
fontSize:
|
|
551
|
+
fontSize: 12,
|
|
564
552
|
};
|
|
565
553
|
|
|
566
554
|
const expectedRebrandedResponsiveStylesMediumSmall = {
|
|
567
555
|
style: BUTTON_REDESIGN_STYLE[BUTTON_REDESIGN_SIZE.MEDIUM_SMALL],
|
|
568
556
|
buttonHeight: 35,
|
|
569
|
-
pillBorderRadius: 18,
|
|
570
557
|
gap: 4,
|
|
571
558
|
defaultHeight: 35,
|
|
572
559
|
minHeight: 35,
|
|
@@ -574,27 +561,25 @@ const expectedRebrandedResponsiveStylesMediumSmall = {
|
|
|
574
561
|
minWidth: 250,
|
|
575
562
|
minDualWidth: 300,
|
|
576
563
|
maxWidth: 300,
|
|
577
|
-
fontSize:
|
|
564
|
+
fontSize: 14,
|
|
578
565
|
};
|
|
579
566
|
|
|
580
567
|
const expectedRebrandedResponsiveStylesMediumBig = {
|
|
581
568
|
style: BUTTON_REDESIGN_STYLE[BUTTON_REDESIGN_SIZE.MEDIUM_BIG],
|
|
582
569
|
buttonHeight: 45,
|
|
583
|
-
|
|
584
|
-
gap: 4,
|
|
570
|
+
gap: 5,
|
|
585
571
|
defaultHeight: 45,
|
|
586
572
|
minHeight: 40,
|
|
587
573
|
maxHeight: 45,
|
|
588
574
|
minWidth: 300,
|
|
589
575
|
minDualWidth: 300,
|
|
590
576
|
maxWidth: 350,
|
|
591
|
-
fontSize:
|
|
577
|
+
fontSize: 14,
|
|
592
578
|
};
|
|
593
579
|
|
|
594
580
|
const expectedRebrandedResponsiveStylesLargeSmall = {
|
|
595
581
|
style: BUTTON_REDESIGN_STYLE[BUTTON_REDESIGN_SIZE.LARGE_SMALL],
|
|
596
582
|
buttonHeight: 45,
|
|
597
|
-
pillBorderRadius: 23,
|
|
598
583
|
gap: 5,
|
|
599
584
|
defaultHeight: 45,
|
|
600
585
|
minHeight: 45,
|
|
@@ -602,63 +587,33 @@ const expectedRebrandedResponsiveStylesLargeSmall = {
|
|
|
602
587
|
minWidth: 350,
|
|
603
588
|
minDualWidth: 300,
|
|
604
589
|
maxWidth: 425,
|
|
605
|
-
fontSize:
|
|
590
|
+
fontSize: 16,
|
|
606
591
|
};
|
|
607
592
|
|
|
608
593
|
const expectedRebrandedResponsiveStylesLargeBig = {
|
|
609
594
|
style: BUTTON_REDESIGN_STYLE[BUTTON_REDESIGN_SIZE.LARGE_BIG],
|
|
610
|
-
buttonHeight:
|
|
611
|
-
pillBorderRadius: 23,
|
|
595
|
+
buttonHeight: 50,
|
|
612
596
|
gap: 5,
|
|
613
|
-
defaultHeight:
|
|
597
|
+
defaultHeight: 50,
|
|
614
598
|
minHeight: 50,
|
|
615
599
|
maxHeight: 55,
|
|
616
600
|
minWidth: 425,
|
|
617
601
|
minDualWidth: 300,
|
|
618
602
|
maxWidth: 500,
|
|
619
|
-
fontSize:
|
|
603
|
+
fontSize: 18,
|
|
620
604
|
};
|
|
621
605
|
|
|
622
606
|
const expectedRebrandedResponsiveStylesXlSmall = {
|
|
623
607
|
style: BUTTON_REDESIGN_STYLE[BUTTON_REDESIGN_SIZE.XL_SMALL],
|
|
624
608
|
buttonHeight: 55,
|
|
625
|
-
pillBorderRadius: 28,
|
|
626
609
|
gap: 6,
|
|
627
610
|
defaultHeight: 55,
|
|
628
611
|
minHeight: 55,
|
|
629
612
|
maxHeight: 60,
|
|
630
613
|
minWidth: 500,
|
|
631
614
|
minDualWidth: 300,
|
|
632
|
-
maxWidth: 550,
|
|
633
|
-
fontSize: 22,
|
|
634
|
-
};
|
|
635
|
-
|
|
636
|
-
const expectedRebrandedResponsiveStylesXlBig = {
|
|
637
|
-
style: BUTTON_REDESIGN_STYLE[BUTTON_REDESIGN_SIZE.XL_BIG],
|
|
638
|
-
buttonHeight: 55,
|
|
639
|
-
pillBorderRadius: 28,
|
|
640
|
-
gap: 7,
|
|
641
|
-
defaultHeight: 55,
|
|
642
|
-
minHeight: 60,
|
|
643
|
-
maxHeight: 65,
|
|
644
|
-
minWidth: 550,
|
|
645
|
-
minDualWidth: 300,
|
|
646
|
-
maxWidth: 650,
|
|
647
|
-
fontSize: 24,
|
|
648
|
-
};
|
|
649
|
-
|
|
650
|
-
const expectedRebrandedResponsiveStylesXXL = {
|
|
651
|
-
style: BUTTON_REDESIGN_STYLE[BUTTON_REDESIGN_SIZE.XXL],
|
|
652
|
-
buttonHeight: 55,
|
|
653
|
-
pillBorderRadius: 28,
|
|
654
|
-
gap: 7,
|
|
655
|
-
defaultHeight: 55,
|
|
656
|
-
minHeight: 65,
|
|
657
|
-
maxHeight: 100,
|
|
658
|
-
minWidth: 650,
|
|
659
|
-
minDualWidth: 300,
|
|
660
615
|
maxWidth: 750,
|
|
661
|
-
fontSize:
|
|
616
|
+
fontSize: 18,
|
|
662
617
|
};
|
|
663
618
|
|
|
664
619
|
describe("test responsive style variables for legacy", () => {
|
|
@@ -784,20 +739,12 @@ describe("test responsive style variables for rebranded buttons", () => {
|
|
|
784
739
|
input: BUTTON_REDESIGN_SIZE.XL_SMALL,
|
|
785
740
|
expected: expectedRebrandedResponsiveStylesXlSmall,
|
|
786
741
|
},
|
|
787
|
-
{
|
|
788
|
-
input: BUTTON_REDESIGN_SIZE.XL_BIG,
|
|
789
|
-
expected: expectedRebrandedResponsiveStylesXlBig,
|
|
790
|
-
},
|
|
791
|
-
{
|
|
792
|
-
input: BUTTON_REDESIGN_SIZE.XXL,
|
|
793
|
-
expected: expectedRebrandedResponsiveStylesXXL,
|
|
794
|
-
},
|
|
795
742
|
])(
|
|
796
743
|
`should return rebrand responsive styles for size $input`,
|
|
797
744
|
({ input, expected }) => {
|
|
798
745
|
expect(
|
|
799
746
|
getResponsiveRebrandedStyleVariables({
|
|
800
|
-
|
|
747
|
+
redesignSize: input,
|
|
801
748
|
})
|
|
802
749
|
).toEqual(expected);
|
|
803
750
|
}
|
|
@@ -993,7 +940,7 @@ describe("test rebrand responsive style variables for disable max height", () =>
|
|
|
993
940
|
shouldApplyRebrandedStyles,
|
|
994
941
|
disableMaxHeightSize: input,
|
|
995
942
|
})
|
|
996
|
-
).
|
|
943
|
+
).toMatchObject(expected);
|
|
997
944
|
}
|
|
998
945
|
);
|
|
999
946
|
});
|