@transferwise/components 0.0.0-experimental-ded76ff → 0.0.0-experimental-adfacd1
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 -31
- package/build/index.esm.js.map +1 -1
- package/build/index.js +36 -31
- 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 +1 -2
- package/build/types/flowNavigation/animatedLabel/AnimatedLabel.d.ts.map +1 -1
- package/build/types/flowNavigation/backButton/BackButton.d.ts +10 -11
- package/build/types/flowNavigation/backButton/BackButton.d.ts.map +1 -1
- package/build/types/overlayHeader/OverlayHeader.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/common/flowHeader/FlowHeader.tsx +9 -3
- package/src/common/flowHeader/__snapshots__/FlowHeader.spec.js.snap +2 -2
- package/src/flowNavigation/FlowNavigation.css +1 -1
- package/src/flowNavigation/FlowNavigation.less +0 -9
- package/src/flowNavigation/FlowNavigation.spec.js +3 -3
- package/src/flowNavigation/FlowNavigation.story.js +24 -183
- package/src/flowNavigation/FlowNavigation.tsx +9 -13
- package/src/flowNavigation/__snapshots__/FlowNavigation.spec.js.snap +14 -11
- package/src/flowNavigation/animatedLabel/AnimatedLabel.css +1 -1
- package/src/flowNavigation/animatedLabel/AnimatedLabel.less +0 -6
- package/src/flowNavigation/animatedLabel/AnimatedLabel.spec.js +7 -21
- package/src/flowNavigation/animatedLabel/AnimatedLabel.tsx +8 -17
- package/src/flowNavigation/animatedLabel/__snapshots__/AnimatedLabel.spec.js.snap +4 -4
- package/src/flowNavigation/backButton/BackButton.js +14 -9
- package/src/flowNavigation/backButton/BackButton.spec.js +3 -2
- package/src/flowNavigation/backButton/__snapshots__/BackButton.spec.js.snap +28 -21
- package/src/main.css +1 -1
- package/src/overlayHeader/OverlayHeader.css +1 -1
- package/src/overlayHeader/OverlayHeader.js +4 -2
- package/src/overlayHeader/OverlayHeader.less +0 -8
- package/src/overlayHeader/OverlayHeader.spec.js +1 -1
- package/src/overlayHeader/__snapshots__/OverlayHeader.spec.js.snap +3 -3
|
@@ -1,41 +1,32 @@
|
|
|
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
|
+
|
|
4
7
|
export interface AnimatedLabelProps {
|
|
5
8
|
activeLabel: number;
|
|
6
9
|
className?: string;
|
|
7
10
|
labels: React.ReactNode[];
|
|
8
|
-
'aria-label': string;
|
|
9
11
|
}
|
|
10
12
|
|
|
11
|
-
const AnimatedLabel = ({
|
|
12
|
-
activeLabel,
|
|
13
|
-
className,
|
|
14
|
-
labels,
|
|
15
|
-
'aria-label': ariaLabel,
|
|
16
|
-
}: AnimatedLabelProps) => {
|
|
17
|
-
const numberLabels = labels.length - 1;
|
|
18
|
-
|
|
13
|
+
const AnimatedLabel = ({ activeLabel, className, labels }: AnimatedLabelProps) => {
|
|
19
14
|
return (
|
|
20
|
-
<
|
|
21
|
-
aria-label={ariaLabel}
|
|
22
|
-
className={classNames('np-animated-label', 'np-text-body-large-bold', className)}
|
|
23
|
-
>
|
|
15
|
+
<Body type={Typography.BODY_LARGE_BOLD} className={classNames('np-animated-label', className)}>
|
|
24
16
|
{labels.map((label, index) => {
|
|
25
17
|
const nextLabel = index - 1;
|
|
26
18
|
return (
|
|
27
19
|
<div
|
|
28
20
|
key={nextLabel}
|
|
29
|
-
className={classNames('text-xs-
|
|
30
|
-
'np-animated-label--in': index === activeLabel,
|
|
31
|
-
'np-animated-label--out': nextLabel === activeLabel && nextLabel !== numberLabels,
|
|
21
|
+
className={classNames('text-xs-center', {
|
|
22
|
+
'np-animated-label--in text-ellipsis': index === activeLabel,
|
|
32
23
|
})}
|
|
33
24
|
>
|
|
34
25
|
{label}
|
|
35
26
|
</div>
|
|
36
27
|
);
|
|
37
28
|
})}
|
|
38
|
-
</
|
|
29
|
+
</Body>
|
|
39
30
|
);
|
|
40
31
|
};
|
|
41
32
|
|
|
@@ -3,20 +3,20 @@
|
|
|
3
3
|
exports[`AnimatedLabel renders all labels 1`] = `
|
|
4
4
|
<div>
|
|
5
5
|
<div
|
|
6
|
-
class="np-
|
|
6
|
+
class="np-text-body-large-bold np-animated-label"
|
|
7
7
|
>
|
|
8
8
|
<div
|
|
9
|
-
class="text-xs-
|
|
9
|
+
class="text-xs-center np-animated-label--in text-ellipsis"
|
|
10
10
|
>
|
|
11
11
|
label1
|
|
12
12
|
</div>
|
|
13
13
|
<div
|
|
14
|
-
class="text-xs-
|
|
14
|
+
class="text-xs-center"
|
|
15
15
|
>
|
|
16
16
|
label2
|
|
17
17
|
</div>
|
|
18
18
|
<div
|
|
19
|
-
class="text-xs-
|
|
19
|
+
class="text-xs-center"
|
|
20
20
|
>
|
|
21
21
|
label3
|
|
22
22
|
</div>
|
|
@@ -2,18 +2,23 @@ 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
|
-
|
|
5
|
+
import Avatar, { AvatarType } from '../../avatar';
|
|
6
|
+
|
|
7
|
+
const BackButton = ({ className, onClick, 'aria-label': ariaLabel }) => (
|
|
8
|
+
<Avatar type={AvatarType.ICON} size={40}>
|
|
9
|
+
<button
|
|
10
|
+
type="button"
|
|
11
|
+
aria-label={ariaLabel}
|
|
12
|
+
className={classNames('np-back-button', 'btn-unstyled', className)}
|
|
13
|
+
onClick={onClick}
|
|
14
|
+
>
|
|
15
|
+
<ArrowLeftIcon size={24} />
|
|
16
|
+
</button>
|
|
17
|
+
</Avatar>
|
|
14
18
|
);
|
|
15
19
|
|
|
16
20
|
BackButton.propTypes = {
|
|
21
|
+
'aria-label': PropTypes.string.isRequired,
|
|
17
22
|
className: PropTypes.string,
|
|
18
23
|
label: PropTypes.element,
|
|
19
24
|
onClick: PropTypes.func,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import '
|
|
2
|
-
import
|
|
1
|
+
import { render } from '../../test-utils';
|
|
2
|
+
import messages from '../FlowNavigation.messages';
|
|
3
3
|
|
|
4
4
|
import BackButton from '.';
|
|
5
5
|
|
|
@@ -7,6 +7,7 @@ const props = {
|
|
|
7
7
|
label: <>label</>,
|
|
8
8
|
className: 'className',
|
|
9
9
|
onClick: jest.fn(),
|
|
10
|
+
'aria-label': messages.back.defaultMessage,
|
|
10
11
|
};
|
|
11
12
|
describe('BackButton', () => {
|
|
12
13
|
it(`renders as expected`, () => {
|
|
@@ -2,29 +2,36 @@
|
|
|
2
2
|
|
|
3
3
|
exports[`BackButton renders as expected 1`] = `
|
|
4
4
|
<div>
|
|
5
|
-
<
|
|
6
|
-
class="
|
|
7
|
-
type="button"
|
|
5
|
+
<div
|
|
6
|
+
class="tw-avatar tw-avatar--40 tw-avatar--icon"
|
|
8
7
|
>
|
|
9
|
-
<
|
|
10
|
-
|
|
11
|
-
class="tw-icon tw-icon-arrow-left "
|
|
12
|
-
data-testid="arrow-left-icon"
|
|
13
|
-
role="presentation"
|
|
8
|
+
<div
|
|
9
|
+
class="tw-avatar__content"
|
|
14
10
|
>
|
|
15
|
-
<
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
height="24"
|
|
19
|
-
viewBox="0 0 24 24"
|
|
20
|
-
width="24"
|
|
11
|
+
<button
|
|
12
|
+
class="np-back-button btn-unstyled className"
|
|
13
|
+
type="button"
|
|
21
14
|
>
|
|
22
|
-
<
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
15
|
+
<span
|
|
16
|
+
aria-hidden="true"
|
|
17
|
+
class="tw-icon tw-icon-arrow-left "
|
|
18
|
+
data-testid="arrow-left-icon"
|
|
19
|
+
role="presentation"
|
|
20
|
+
>
|
|
21
|
+
<svg
|
|
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>
|
|
29
36
|
</div>
|
|
30
37
|
`;
|