@paypal/checkout-components 5.0.268 → 5.0.270-alpha.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.
- package/dist/button.js +1 -1
- package/package.json +1 -1
- package/src/ui/buttons/props.js +4 -0
- package/src/ui/buttons/style.jsx +2 -2
- package/src/ui/buttons/styles/base.js +7 -1
- package/src/ui/buttons/styles/responsive.js +3 -1
- package/src/zoid/buttons/container.jsx +1 -7
- package/src/zoid/checkout/component.jsx +0 -1
package/package.json
CHANGED
package/src/ui/buttons/props.js
CHANGED
|
@@ -317,6 +317,7 @@ export type ButtonStyle = {|
|
|
|
317
317
|
menuPlacement: $Values<typeof MENU_PLACEMENT>,
|
|
318
318
|
period?: number,
|
|
319
319
|
height?: number,
|
|
320
|
+
disableMaxWidth?: boolean,
|
|
320
321
|
|};
|
|
321
322
|
|
|
322
323
|
export type ButtonStyleInputs = {|
|
|
@@ -327,6 +328,7 @@ export type ButtonStyleInputs = {|
|
|
|
327
328
|
layout?: $Values<typeof BUTTON_LAYOUT> | void,
|
|
328
329
|
period?: number | void,
|
|
329
330
|
height?: number | void,
|
|
331
|
+
disableMaxWidth?: boolean | void,
|
|
330
332
|
|};
|
|
331
333
|
|
|
332
334
|
type PersonalizationComponentProps = {|
|
|
@@ -613,6 +615,7 @@ export function normalizeButtonStyle(
|
|
|
613
615
|
height,
|
|
614
616
|
period,
|
|
615
617
|
menuPlacement = MENU_PLACEMENT.BELOW,
|
|
618
|
+
disableMaxWidth,
|
|
616
619
|
} = style;
|
|
617
620
|
|
|
618
621
|
// $FlowFixMe
|
|
@@ -684,6 +687,7 @@ export function normalizeButtonStyle(
|
|
|
684
687
|
height,
|
|
685
688
|
period,
|
|
686
689
|
menuPlacement,
|
|
690
|
+
disableMaxWidth,
|
|
687
691
|
};
|
|
688
692
|
}
|
|
689
693
|
|
package/src/ui/buttons/style.jsx
CHANGED
|
@@ -18,8 +18,8 @@ export function Style({
|
|
|
18
18
|
nonce,
|
|
19
19
|
fundingEligibility,
|
|
20
20
|
}: StyleProps): ElementNode {
|
|
21
|
-
const { height } = style;
|
|
22
|
-
const css = componentStyle({ height, fundingEligibility });
|
|
21
|
+
const { height, disableMaxWidth } = style;
|
|
22
|
+
const css = componentStyle({ height, fundingEligibility, disableMaxWidth });
|
|
23
23
|
|
|
24
24
|
return <style nonce={nonce} innerHTML={css} />;
|
|
25
25
|
}
|
|
@@ -11,15 +11,21 @@ import { buttonColorStyle } from "./color";
|
|
|
11
11
|
export function componentStyle({
|
|
12
12
|
height,
|
|
13
13
|
fundingEligibility,
|
|
14
|
+
disableMaxWidth,
|
|
14
15
|
}: {|
|
|
15
16
|
height?: ?number,
|
|
16
17
|
fundingEligibility: FundingEligibilityType,
|
|
18
|
+
disableMaxWidth?: ?boolean,
|
|
17
19
|
|}): string {
|
|
18
20
|
return `
|
|
19
21
|
${pageStyle}
|
|
20
22
|
${buttonStyle}
|
|
21
23
|
${buttonColorStyle}
|
|
22
24
|
${labelStyle}
|
|
23
|
-
${buttonResponsiveStyle({
|
|
25
|
+
${buttonResponsiveStyle({
|
|
26
|
+
height,
|
|
27
|
+
fundingEligibility,
|
|
28
|
+
disableMaxWidth,
|
|
29
|
+
})}
|
|
24
30
|
`;
|
|
25
31
|
}
|
|
@@ -24,9 +24,11 @@ const WALLET_BUTTON_PERC = 60;
|
|
|
24
24
|
export function buttonResponsiveStyle({
|
|
25
25
|
height,
|
|
26
26
|
fundingEligibility,
|
|
27
|
+
disableMaxWidth,
|
|
27
28
|
}: {|
|
|
28
29
|
height?: ?number,
|
|
29
30
|
fundingEligibility: FundingEligibilityType,
|
|
31
|
+
disableMaxWidth?: ?boolean,
|
|
30
32
|
|}): string {
|
|
31
33
|
return Object.keys(BUTTON_SIZE_STYLE)
|
|
32
34
|
.map((size) => {
|
|
@@ -59,7 +61,7 @@ export function buttonResponsiveStyle({
|
|
|
59
61
|
|
|
60
62
|
.${CLASS.CONTAINER} {
|
|
61
63
|
min-width: ${style.minWidth}px;
|
|
62
|
-
max-width: ${style.maxWidth}px;
|
|
64
|
+
${disableMaxWidth ? "" : `max-width: ${style.maxWidth}px;`};
|
|
63
65
|
}
|
|
64
66
|
|
|
65
67
|
.${CLASS.CONTAINER} .${CLASS.BUTTON_ROW} .${CLASS.TEXT}, .${
|
|
@@ -7,11 +7,7 @@ import { EVENT, type RenderOptionsType } from "@krakenjs/zoid/src";
|
|
|
7
7
|
import { getVersion } from "@paypal/sdk-client/src";
|
|
8
8
|
|
|
9
9
|
import { BUTTON_SIZE, ATTRIBUTE, MENU_PLACEMENT } from "../../constants";
|
|
10
|
-
import {
|
|
11
|
-
BUTTON_SIZE_STYLE,
|
|
12
|
-
MINIMUM_SIZE,
|
|
13
|
-
MAXIMUM_SIZE,
|
|
14
|
-
} from "../../ui/buttons/config";
|
|
10
|
+
import { BUTTON_SIZE_STYLE, MINIMUM_SIZE } from "../../ui/buttons/config";
|
|
15
11
|
import { type ButtonProps } from "../../ui/buttons/props";
|
|
16
12
|
|
|
17
13
|
const CLASS = {
|
|
@@ -70,7 +66,6 @@ export function containerTemplate({
|
|
|
70
66
|
const { label, layout, height: buttonHeight, menuPlacement } = style;
|
|
71
67
|
|
|
72
68
|
let minimumSize = MINIMUM_SIZE[layout];
|
|
73
|
-
const maximumSize = MAXIMUM_SIZE[layout];
|
|
74
69
|
|
|
75
70
|
if (buttonHeight) {
|
|
76
71
|
const possibleSizes = values(BUTTON_SIZE).filter((possibleSize) => {
|
|
@@ -128,7 +123,6 @@ export function containerTemplate({
|
|
|
128
123
|
BUTTON_SIZE_STYLE[minimumSize].minHeight
|
|
129
124
|
}px;
|
|
130
125
|
min-width: ${BUTTON_SIZE_STYLE[minimumSize].minWidth}px;
|
|
131
|
-
max-width: ${BUTTON_SIZE_STYLE[maximumSize].maxWidth}px;
|
|
132
126
|
font-size: 0;
|
|
133
127
|
}
|
|
134
128
|
|