@transferwise/components 0.0.0-experimental-adfacd1 → 0.0.0-experimental-b5cc5ec
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/build/index.esm.js +36 -36
- package/build/index.esm.js.map +1 -1
- package/build/index.js +36 -36
- package/build/index.js.map +1 -1
- package/build/main.css +1 -1
- package/build/styles/flowNavigation/FlowNavigation.css +1 -1
- package/build/styles/flowNavigation/animatedLabel/AnimatedLabel.css +1 -1
- package/build/styles/main.css +1 -1
- package/build/styles/overlayHeader/OverlayHeader.css +1 -1
- package/build/types/common/flowHeader/FlowHeader.d.ts.map +1 -1
- package/build/types/flowNavigation/FlowNavigation.d.ts.map +1 -1
- package/build/types/flowNavigation/animatedLabel/AnimatedLabel.d.ts +2 -1
- package/build/types/flowNavigation/animatedLabel/AnimatedLabel.d.ts.map +1 -1
- package/build/types/flowNavigation/backButton/BackButton.d.ts +11 -10
- package/build/types/flowNavigation/backButton/BackButton.d.ts.map +1 -1
- package/build/types/logo/Logo.d.ts.map +1 -1
- package/build/types/overlayHeader/OverlayHeader.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/common/flowHeader/FlowHeader.tsx +3 -9
- package/src/common/flowHeader/__snapshots__/FlowHeader.spec.js.snap +2 -2
- package/src/flowNavigation/FlowNavigation.css +1 -1
- package/src/flowNavigation/FlowNavigation.less +9 -0
- package/src/flowNavigation/FlowNavigation.spec.js +3 -3
- package/src/flowNavigation/FlowNavigation.story.js +183 -24
- package/src/flowNavigation/FlowNavigation.tsx +13 -9
- package/src/flowNavigation/__snapshots__/FlowNavigation.spec.js.snap +11 -14
- package/src/flowNavigation/animatedLabel/AnimatedLabel.css +1 -1
- package/src/flowNavigation/animatedLabel/AnimatedLabel.less +6 -0
- package/src/flowNavigation/animatedLabel/AnimatedLabel.spec.js +21 -7
- package/src/flowNavigation/animatedLabel/AnimatedLabel.tsx +17 -8
- package/src/flowNavigation/animatedLabel/__snapshots__/AnimatedLabel.spec.js.snap +4 -4
- package/src/flowNavigation/backButton/BackButton.js +9 -14
- package/src/flowNavigation/backButton/BackButton.spec.js +2 -3
- package/src/flowNavigation/backButton/__snapshots__/BackButton.spec.js.snap +21 -28
- package/src/logo/Logo.js +5 -0
- package/src/main.css +1 -1
- package/src/overlayHeader/OverlayHeader.css +1 -1
- package/src/overlayHeader/OverlayHeader.js +2 -4
- package/src/overlayHeader/OverlayHeader.less +8 -0
- package/src/overlayHeader/OverlayHeader.spec.js +1 -1
- package/src/overlayHeader/__snapshots__/OverlayHeader.spec.js.snap +3 -3
|
@@ -1,32 +1,41 @@
|
|
|
1
1
|
import classNames from 'classnames';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
|
|
4
|
-
import Body from '../../body';
|
|
5
|
-
import { Typography } from '../../common';
|
|
6
|
-
|
|
7
4
|
export interface AnimatedLabelProps {
|
|
8
5
|
activeLabel: number;
|
|
9
6
|
className?: string;
|
|
10
7
|
labels: React.ReactNode[];
|
|
8
|
+
'aria-label': string;
|
|
11
9
|
}
|
|
12
10
|
|
|
13
|
-
const AnimatedLabel = ({
|
|
11
|
+
const AnimatedLabel = ({
|
|
12
|
+
activeLabel,
|
|
13
|
+
className,
|
|
14
|
+
labels,
|
|
15
|
+
'aria-label': ariaLabel,
|
|
16
|
+
}: AnimatedLabelProps) => {
|
|
17
|
+
const numberLabels = labels.length - 1;
|
|
18
|
+
|
|
14
19
|
return (
|
|
15
|
-
<
|
|
20
|
+
<div
|
|
21
|
+
aria-label={ariaLabel}
|
|
22
|
+
className={classNames('np-animated-label', 'np-text-body-large-bold', className)}
|
|
23
|
+
>
|
|
16
24
|
{labels.map((label, index) => {
|
|
17
25
|
const nextLabel = index - 1;
|
|
18
26
|
return (
|
|
19
27
|
<div
|
|
20
28
|
key={nextLabel}
|
|
21
|
-
className={classNames('text-xs-
|
|
22
|
-
'np-animated-label--in
|
|
29
|
+
className={classNames('text-xs-left', {
|
|
30
|
+
'np-animated-label--in': index === activeLabel,
|
|
31
|
+
'np-animated-label--out': nextLabel === activeLabel && nextLabel !== numberLabels,
|
|
23
32
|
})}
|
|
24
33
|
>
|
|
25
34
|
{label}
|
|
26
35
|
</div>
|
|
27
36
|
);
|
|
28
37
|
})}
|
|
29
|
-
</
|
|
38
|
+
</div>
|
|
30
39
|
);
|
|
31
40
|
};
|
|
32
41
|
|
|
@@ -3,20 +3,20 @@
|
|
|
3
3
|
exports[`AnimatedLabel renders all labels 1`] = `
|
|
4
4
|
<div>
|
|
5
5
|
<div
|
|
6
|
-
class="np-text-body-large-bold
|
|
6
|
+
class="np-animated-label np-text-body-large-bold"
|
|
7
7
|
>
|
|
8
8
|
<div
|
|
9
|
-
class="text-xs-
|
|
9
|
+
class="text-xs-left np-animated-label--in"
|
|
10
10
|
>
|
|
11
11
|
label1
|
|
12
12
|
</div>
|
|
13
13
|
<div
|
|
14
|
-
class="text-xs-
|
|
14
|
+
class="text-xs-left np-animated-label--out"
|
|
15
15
|
>
|
|
16
16
|
label2
|
|
17
17
|
</div>
|
|
18
18
|
<div
|
|
19
|
-
class="text-xs-
|
|
19
|
+
class="text-xs-left"
|
|
20
20
|
>
|
|
21
21
|
label3
|
|
22
22
|
</div>
|
|
@@ -2,23 +2,18 @@ import { ArrowLeft as ArrowLeftIcon } from '@transferwise/icons';
|
|
|
2
2
|
import classNames from 'classnames';
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
>
|
|
15
|
-
<ArrowLeftIcon size={24} />
|
|
16
|
-
</button>
|
|
17
|
-
</Avatar>
|
|
5
|
+
const BackButton = ({ label, className, onClick }) => (
|
|
6
|
+
<button
|
|
7
|
+
type="button"
|
|
8
|
+
className={classNames('np-back-button', 'align-items-center', 'btn-unstyled', className)}
|
|
9
|
+
onClick={onClick}
|
|
10
|
+
>
|
|
11
|
+
<ArrowLeftIcon size={24} />
|
|
12
|
+
{label}
|
|
13
|
+
</button>
|
|
18
14
|
);
|
|
19
15
|
|
|
20
16
|
BackButton.propTypes = {
|
|
21
|
-
'aria-label': PropTypes.string.isRequired,
|
|
22
17
|
className: PropTypes.string,
|
|
23
18
|
label: PropTypes.element,
|
|
24
19
|
onClick: PropTypes.func,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import '@testing-library/jest-dom';
|
|
2
|
+
import { render } from '@testing-library/react';
|
|
3
3
|
|
|
4
4
|
import BackButton from '.';
|
|
5
5
|
|
|
@@ -7,7 +7,6 @@ const props = {
|
|
|
7
7
|
label: <>label</>,
|
|
8
8
|
className: 'className',
|
|
9
9
|
onClick: jest.fn(),
|
|
10
|
-
'aria-label': messages.back.defaultMessage,
|
|
11
10
|
};
|
|
12
11
|
describe('BackButton', () => {
|
|
13
12
|
it(`renders as expected`, () => {
|
|
@@ -2,36 +2,29 @@
|
|
|
2
2
|
|
|
3
3
|
exports[`BackButton renders as expected 1`] = `
|
|
4
4
|
<div>
|
|
5
|
-
<
|
|
6
|
-
class="
|
|
5
|
+
<button
|
|
6
|
+
class="np-back-button align-items-center btn-unstyled className"
|
|
7
|
+
type="button"
|
|
7
8
|
>
|
|
8
|
-
<
|
|
9
|
-
|
|
9
|
+
<span
|
|
10
|
+
aria-hidden="true"
|
|
11
|
+
class="tw-icon tw-icon-arrow-left "
|
|
12
|
+
data-testid="arrow-left-icon"
|
|
13
|
+
role="presentation"
|
|
10
14
|
>
|
|
11
|
-
<
|
|
12
|
-
|
|
13
|
-
|
|
15
|
+
<svg
|
|
16
|
+
fill="currentColor"
|
|
17
|
+
focusable="false"
|
|
18
|
+
height="24"
|
|
19
|
+
viewBox="0 0 24 24"
|
|
20
|
+
width="24"
|
|
14
21
|
>
|
|
15
|
-
<
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
fill="currentColor"
|
|
23
|
-
focusable="false"
|
|
24
|
-
height="24"
|
|
25
|
-
viewBox="0 0 24 24"
|
|
26
|
-
width="24"
|
|
27
|
-
>
|
|
28
|
-
<path
|
|
29
|
-
d="M22.286 11.316H4.629l7.114-7.114-1.2-1.2-8.572 8.571a.829.829 0 0 0 0 1.2l8.572 8.572 1.2-1.2-7.114-7.114h17.657v-1.715Z"
|
|
30
|
-
/>
|
|
31
|
-
</svg>
|
|
32
|
-
</span>
|
|
33
|
-
</button>
|
|
34
|
-
</div>
|
|
35
|
-
</div>
|
|
22
|
+
<path
|
|
23
|
+
d="M22.286 11.316H4.629l7.114-7.114-1.2-1.2-8.572 8.571a.829.829 0 0 0 0 1.2l8.572 8.572 1.2-1.2-7.114-7.114h17.657v-1.715Z"
|
|
24
|
+
/>
|
|
25
|
+
</svg>
|
|
26
|
+
</span>
|
|
27
|
+
label
|
|
28
|
+
</button>
|
|
36
29
|
</div>
|
|
37
30
|
`;
|
package/src/logo/Logo.js
CHANGED
|
@@ -27,6 +27,11 @@ const Logo = ({ className, inverse, type }) => {
|
|
|
27
27
|
? svgPaths[`WISE_FLAG${inverse ? '_INVERSE' : ''}`]
|
|
28
28
|
: svgPaths[`${type}${inverse ? '_INVERSE' : ''}`];
|
|
29
29
|
|
|
30
|
+
// If clientWidth is not defined, don't render anything
|
|
31
|
+
if (clientWidth === null) {
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
|
|
30
35
|
return (
|
|
31
36
|
<LogoSvg
|
|
32
37
|
className={classNames('np-logo-svg', className)}
|