@paypal/checkout-components 5.0.246-alpha.0 → 5.0.246
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@paypal/checkout-components",
|
|
3
|
-
"version": "5.0.246
|
|
3
|
+
"version": "5.0.246",
|
|
4
4
|
"description": "PayPal Checkout components, for integrating checkout products.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"debug": "cross-env NODE_ENV=debug",
|
|
13
13
|
"delete-size": "rm dist/size.* dist/report.html",
|
|
14
14
|
"demo": "serve ./demo -l 1337",
|
|
15
|
-
"dev": "npm run check-node-version && babel-node $(npm bin)/webpack-dev-server --config webpack.config.dev.js --port 9001 --host localhost.paypal.com --open demo/dev/index.htm --https --hot=false",
|
|
15
|
+
"dev": "npm run check-node-version && babel-node $(npm bin)/webpack-dev-server --config webpack.config.dev.js --port 9001 --host localhost.paypal.com --open demo/dev/index.htm --https --hot=false --static './'",
|
|
16
16
|
"eslint-find-rules": "eslint-find-rules --current .eslintrc.js --unused --plugin",
|
|
17
17
|
"flow": "flow",
|
|
18
18
|
"flow-typed": "rm -rf flow-typed && flow-typed install && rm flow-typed/npm/puppeteer_*",
|
package/src/types.js
CHANGED
|
@@ -99,8 +99,18 @@ export function Button({ fundingSource, style, multiple, locale, env, fundingEli
|
|
|
99
99
|
preventClickFocus(el);
|
|
100
100
|
}
|
|
101
101
|
};
|
|
102
|
-
|
|
103
|
-
|
|
102
|
+
|
|
103
|
+
function getAriaLabel() : string {
|
|
104
|
+
let labelText = typeof fundingConfig.labelText === 'function' ? fundingConfig.labelText({ content, fundingEligibility }) : (fundingConfig.labelText || fundingSource);
|
|
105
|
+
|
|
106
|
+
if (!showPayLabel && instrument?.vendor && instrument.label) {
|
|
107
|
+
labelText = instrument.secondaryInstruments ? `${instrument.secondaryInstruments[0].type} & ${instrument.vendor} ${instrument.label}` : `${instrument.vendor} ${instrument.label}`;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
return labelText;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
const labelText = getAriaLabel();
|
|
104
114
|
|
|
105
115
|
const logoNode = (
|
|
106
116
|
<Logo
|
|
@@ -253,7 +263,7 @@ export function Button({ fundingSource, style, multiple, locale, env, fundingEli
|
|
|
253
263
|
<Spinner />
|
|
254
264
|
</div>
|
|
255
265
|
|
|
256
|
-
{ shouldShowWalletMenu ? <MenuButton textColor={ textColor } /> : null }
|
|
266
|
+
{ shouldShowWalletMenu ? <MenuButton textColor={ textColor } content={ content } /> : null }
|
|
257
267
|
</div>
|
|
258
268
|
);
|
|
259
269
|
}
|
|
@@ -5,10 +5,12 @@ import { node, type ChildType, Style } from '@krakenjs/jsx-pragmatic/src';
|
|
|
5
5
|
|
|
6
6
|
import { ATTRIBUTE, TEXT_COLOR } from '../../../constants';
|
|
7
7
|
import { Chevron } from '../../chevron';
|
|
8
|
+
import type { ContentType } from '../../../types';
|
|
8
9
|
|
|
9
10
|
import css from './menu-button.scoped.scss';
|
|
10
11
|
|
|
11
|
-
export function MenuButton({ textColor = TEXT_COLOR.BLACK } : {| textColor? : $Values<typeof TEXT_COLOR
|
|
12
|
+
export function MenuButton({ textColor = TEXT_COLOR.BLACK, content } : {| textColor? : $Values<typeof TEXT_COLOR>, content : ?ContentType |} = { }) : ChildType {
|
|
13
|
+
const labelText = content?.moreOptions;
|
|
12
14
|
return (
|
|
13
15
|
<Style css={ css }>
|
|
14
16
|
<div
|
|
@@ -16,7 +18,10 @@ export function MenuButton({ textColor = TEXT_COLOR.BLACK } : {| textColor? : $V
|
|
|
16
18
|
[ATTRIBUTE.MENU]: true
|
|
17
19
|
} }
|
|
18
20
|
tabindex='0'
|
|
19
|
-
class='menu-button'
|
|
21
|
+
class='menu-button'
|
|
22
|
+
role='button'
|
|
23
|
+
aria-label={ labelText }
|
|
24
|
+
aria-haspopup='menu'>
|
|
20
25
|
<Chevron color={ textColor } />
|
|
21
26
|
</div>
|
|
22
27
|
</Style>
|