@transferwise/components 0.0.0-experimental-a4458ac → 0.0.0-experimental-3683cd4
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 +105 -153
- package/build/index.esm.js.map +1 -1
- package/build/index.js +105 -153
- 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/inputs/SelectInput.css +1 -1
- package/build/styles/main.css +1 -1
- package/build/styles/overlayHeader/OverlayHeader.css +1 -1
- package/build/styles/phoneNumberInput/PhoneNumberInput.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/inputs/SelectInput.d.ts.map +1 -1
- package/build/types/overlayHeader/OverlayHeader.d.ts.map +1 -1
- package/build/types/phoneNumberInput/PhoneNumberInput.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.story.js +22 -0
- 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/inputs/SelectInput.css +1 -1
- package/src/inputs/SelectInput.less +1 -13
- package/src/inputs/SelectInput.tsx +61 -80
- 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
- package/src/phoneNumberInput/PhoneNumberInput.css +1 -1
- package/src/phoneNumberInput/PhoneNumberInput.js +27 -28
- package/src/phoneNumberInput/PhoneNumberInput.less +4 -0
- package/src/phoneNumberInput/PhoneNumberInput.spec.js +64 -72
- package/src/phoneNumberInput/PhoneNumberInput.story.js +1 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
.np-overlay-header .np-overlay-header__content{max-width:1164px;min-height:97px;min-width:320px;width:100%}.np-theme-personal .np-overlay-header{border-bottom:1px solid #0000001a;border-bottom:1px solid var(--color-border-neutral)}.np-theme-personal--bright-green .np-overlay-header .np-flow-header__left path,.np-theme-personal--dark .np-overlay-header .np-flow-header__left path,.np-theme-personal--forest-green .np-overlay-header .np-flow-header__left path{fill:var(--color-interactive-primary)}
|
|
1
|
+
.np-overlay-header .np-overlay-header__content{max-width:1164px;min-height:97px;min-width:320px;width:100%}.np-overlay-header .np-overlay-header__content .separator{background-color:#0000001a;background-color:var(--color-border-neutral);height:32px;height:var(--size-32);width:1px}[dir=rtl] .np-overlay-header .np-overlay-header__content .separator{margin-right:16px!important;margin-right:var(--size-16)!important}[dir=rtl] .np-overlay-header .np-overlay-header__content .separator,html:not([dir=rtl]) .np-overlay-header .np-overlay-header__content .separator{margin-left:16px!important;margin-left:var(--size-16)!important}html:not([dir=rtl]) .np-overlay-header .np-overlay-header__content .separator{margin-right:16px!important;margin-right:var(--size-16)!important}.np-theme-personal .np-overlay-header{border-bottom:1px solid #0000001a;border-bottom:1px solid var(--color-border-neutral)}.np-theme-personal--bright-green .np-overlay-header .np-flow-header__left path,.np-theme-personal--dark .np-overlay-header .np-flow-header__left path,.np-theme-personal--forest-green .np-overlay-header .np-flow-header__left path{fill:var(--color-interactive-primary)}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.tw-telephone{display:flex}.tw-telephone .tw-telephone__number-input{margin-left:12px;margin-left:var(--size-12)}[dir=rtl] .tw-telephone .tw-telephone__number-input{margin-left:0;margin-right:12px;margin-right:var(--size-12)}.tw-telephone__country-select{flex-basis:120px;flex-shrink:0}.tw-telephone__number-input{flex:auto 1 1}
|
|
1
|
+
.tw-telephone{display:flex}.tw-telephone .tw-telephone__number-input{margin-left:12px;margin-left:var(--size-12)}[dir=rtl] .tw-telephone .tw-telephone__number-input{margin-left:0;margin-right:12px;margin-right:var(--size-12)}.tw-telephone__country-select{flex-basis:120px;flex-shrink:0}.tw-telephone__country-select .np-input-group{width:100%}.tw-telephone__number-input{flex:auto 1 1}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FlowHeader.d.ts","sourceRoot":"","sources":["../../../../src/common/flowHeader/FlowHeader.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAEhD,MAAM,WAAW,eAAe;IAC9B,aAAa,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAChC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC,QAAQ,GAAG,MAAM,CAAC,UAAU,CAAC;IAC7C,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC9B,YAAY,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAChC;AAED,QAAA,MAAM,UAAU,
|
|
1
|
+
{"version":3,"file":"FlowHeader.d.ts","sourceRoot":"","sources":["../../../../src/common/flowHeader/FlowHeader.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAEhD,MAAM,WAAW,eAAe;IAC9B,aAAa,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAChC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC,QAAQ,GAAG,MAAM,CAAC,UAAU,CAAC;IAC7C,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC9B,YAAY,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAChC;AAED,QAAA,MAAM,UAAU,wFAyDf,CAAC;AAEF,eAAe,UAAU,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FlowNavigation.d.ts","sourceRoot":"","sources":["../../../src/flowNavigation/FlowNavigation.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAQ1B,OAAgB,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAMnD,MAAM,WAAW,mBAAmB;IAClC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACzB,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,2FAA2F;IAC3F,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,sIAAsI;IACtI,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,wGAAwG;IACxG,KAAK,EAAE,IAAI,EAAE,CAAC;CACf;AAED,QAAA,MAAM,cAAc,kEAQjB,mBAAmB,
|
|
1
|
+
{"version":3,"file":"FlowNavigation.d.ts","sourceRoot":"","sources":["../../../src/flowNavigation/FlowNavigation.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAQ1B,OAAgB,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAMnD,MAAM,WAAW,mBAAmB;IAClC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACzB,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,2FAA2F;IAC3F,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,sIAAsI;IACtI,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,wGAAwG;IACxG,KAAK,EAAE,IAAI,EAAE,CAAC;CACf;AAED,QAAA,MAAM,cAAc,kEAQjB,mBAAmB,sBA0ErB,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
|
@@ -3,7 +3,8 @@ export interface AnimatedLabelProps {
|
|
|
3
3
|
activeLabel: number;
|
|
4
4
|
className?: string;
|
|
5
5
|
labels: React.ReactNode[];
|
|
6
|
+
'aria-label': string;
|
|
6
7
|
}
|
|
7
|
-
declare const AnimatedLabel: ({ activeLabel, className, labels }: AnimatedLabelProps) => React.JSX.Element;
|
|
8
|
+
declare const AnimatedLabel: ({ activeLabel, className, labels, "aria-label": ariaLabel, }: AnimatedLabelProps) => React.JSX.Element;
|
|
8
9
|
export default AnimatedLabel;
|
|
9
10
|
//# sourceMappingURL=AnimatedLabel.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AnimatedLabel.d.ts","sourceRoot":"","sources":["../../../../src/flowNavigation/animatedLabel/AnimatedLabel.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"AnimatedLabel.d.ts","sourceRoot":"","sources":["../../../../src/flowNavigation/animatedLabel/AnimatedLabel.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,WAAW,kBAAkB;IACjC,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,KAAK,CAAC,SAAS,EAAE,CAAC;IAC1B,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,QAAA,MAAM,aAAa,iEAKhB,kBAAkB,sBAwBpB,CAAC;AAEF,eAAe,aAAa,CAAC"}
|
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
export default BackButton;
|
|
2
|
-
declare function BackButton({ className, onClick
|
|
2
|
+
declare function BackButton({ label, className, onClick }: {
|
|
3
|
+
label: any;
|
|
3
4
|
className: any;
|
|
4
5
|
onClick: any;
|
|
5
|
-
"aria-label": any;
|
|
6
6
|
}): import("react").JSX.Element;
|
|
7
7
|
declare namespace BackButton {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
};
|
|
8
|
+
namespace propTypes {
|
|
9
|
+
const className: any;
|
|
10
|
+
const label: any;
|
|
11
|
+
const onClick: any;
|
|
12
|
+
}
|
|
14
13
|
namespace defaultProps {
|
|
15
|
-
const
|
|
16
|
-
|
|
14
|
+
const className_1: undefined;
|
|
15
|
+
export { className_1 as className };
|
|
16
|
+
const label_1: undefined;
|
|
17
|
+
export { label_1 as label };
|
|
17
18
|
}
|
|
18
19
|
}
|
|
19
20
|
//# sourceMappingURL=BackButton.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BackButton.d.ts","sourceRoot":"","sources":["../../../../src/flowNavigation/backButton/BackButton.js"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"BackButton.d.ts","sourceRoot":"","sources":["../../../../src/flowNavigation/backButton/BackButton.js"],"names":[],"mappings":";AAIA;;;;gCASC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectInput.d.ts","sourceRoot":"","sources":["../../../src/inputs/SelectInput.tsx"],"names":[],"mappings":";AAeA,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"SelectInput.d.ts","sourceRoot":"","sources":["../../../src/inputs/SelectInput.tsx"],"names":[],"mappings":"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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OverlayHeader.d.ts","sourceRoot":"","sources":["../../../src/overlayHeader/OverlayHeader.js"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"OverlayHeader.d.ts","sourceRoot":"","sources":["../../../src/overlayHeader/OverlayHeader.js"],"names":[],"mappings":";AAMA;;;;gCAiBC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PhoneNumberInput.d.ts","sourceRoot":"","sources":["../../../src/phoneNumberInput/PhoneNumberInput.js"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"PhoneNumberInput.d.ts","sourceRoot":"","sources":["../../../src/phoneNumberInput/PhoneNumberInput.js"],"names":[],"mappings":";AAqBA,2EA0JC;;;;;;;;;;;;;;;;;;;;;;;;;;QAwBC,gCAAY;QACZ,+BAAW"}
|
package/package.json
CHANGED
|
@@ -36,15 +36,9 @@ const FlowHeader = React.forwardRef(
|
|
|
36
36
|
)}
|
|
37
37
|
>
|
|
38
38
|
<div
|
|
39
|
-
className={classNames(
|
|
40
|
-
'
|
|
41
|
-
|
|
42
|
-
'align-items-center',
|
|
43
|
-
'justify-content-between',
|
|
44
|
-
{
|
|
45
|
-
'flex__item--8': isVertical,
|
|
46
|
-
},
|
|
47
|
-
)}
|
|
39
|
+
className={classNames('np-flow-header__left', {
|
|
40
|
+
'flex__item--8': isVertical,
|
|
41
|
+
})}
|
|
48
42
|
>
|
|
49
43
|
{leftContent}
|
|
50
44
|
</div>
|
|
@@ -6,7 +6,7 @@ exports[`FlowHeader renders as expected 1`] = `
|
|
|
6
6
|
class="np-flow-header d-flex flex-wrap align-items-center className"
|
|
7
7
|
>
|
|
8
8
|
<div
|
|
9
|
-
class="np-flow-header__left
|
|
9
|
+
class="np-flow-header__left"
|
|
10
10
|
>
|
|
11
11
|
leftContent
|
|
12
12
|
</div>
|
|
@@ -30,7 +30,7 @@ exports[`FlowHeader renders as expected with vertical layout 1`] = `
|
|
|
30
30
|
class="np-flow-header d-flex flex-wrap align-items-center className"
|
|
31
31
|
>
|
|
32
32
|
<div
|
|
33
|
-
class="np-flow-header__left
|
|
33
|
+
class="np-flow-header__left flex__item--8"
|
|
34
34
|
>
|
|
35
35
|
leftContent
|
|
36
36
|
</div>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.np-flow-navigation{min-height:97px;width:100%}.np-flow-navigation--border-bottom{border-bottom:1px solid #0000001a;border-bottom:1px solid var(--color-border-neutral);min-height:96px}.np-flow-navigation__content{max-width:1164px;min-width:320px;width:100%}.np-flow-navigation__stepper{padding-bottom:0!important}[dir=rtl] .np-flow-navigation__stepper{padding-right:0!important}[dir=rtl] .np-flow-navigation__stepper,html:not([dir=rtl]) .np-flow-navigation__stepper{padding-left:0!important}html:not([dir=rtl]) .np-flow-navigation__stepper{padding-right:0!important}.np-flow-navigation--xs-max .np-flow-navigation__stepper .tw-stepper-steps{display:none}.np-flow-navigation--xs-max .np-flow-navigation__stepper .progress{margin-bottom:0}.np-flow-navigation--xs-max .np-animated-label{height:auto}.np-flow-navigation--sm .np-flow-navigation__stepper{min-height:56px}[dir=rtl] .np-flow-navigation--sm .np-flow-navigation__stepper{padding-right:24px!important;padding-right:var(--size-24)!important}[dir=rtl] .np-flow-navigation--sm .np-flow-navigation__stepper,html:not([dir=rtl]) .np-flow-navigation--sm .np-flow-navigation__stepper{padding-left:24px!important;padding-left:var(--size-24)!important}html:not([dir=rtl]) .np-flow-navigation--sm .np-flow-navigation__stepper{padding-right:24px!important;padding-right:var(--size-24)!important}.np-flow-navigation--lg .np-flow-navigation__stepper{max-width:562px}.np-flow-navigation--lg .np-flow-header__left,.np-flow-navigation--lg .np-flow-header__right{width:180px}.np-flow-navigation--hidden{visibility:hidden}.np-theme-personal--bright-green .np-flow-navigation .np-flow-header__left path,.np-theme-personal--dark .np-flow-navigation .np-flow-header__left path,.np-theme-personal--forest-green .np-flow-navigation .np-flow-header__left path{fill:var(--color-interactive-primary)}
|
|
1
|
+
.np-flow-navigation{min-height:97px;width:100%}.np-flow-navigation--border-bottom{border-bottom:1px solid #0000001a;border-bottom:1px solid var(--color-border-neutral);min-height:96px}.np-flow-navigation__content{max-width:1164px;min-width:320px;width:100%}.np-flow-navigation__stepper{padding-bottom:0!important}[dir=rtl] .np-flow-navigation__stepper{padding-right:0!important}[dir=rtl] .np-flow-navigation__stepper,html:not([dir=rtl]) .np-flow-navigation__stepper{padding-left:0!important}html:not([dir=rtl]) .np-flow-navigation__stepper{padding-right:0!important}.np-flow-navigation--xs-max .np-flow-navigation__stepper .tw-stepper-steps{display:none}.np-flow-navigation--xs-max .np-flow-navigation__stepper .progress{margin-bottom:0}.np-flow-navigation--xs-max .np-animated-label{height:auto}.np-flow-navigation--sm .np-flow-navigation__stepper{min-height:56px}[dir=rtl] .np-flow-navigation--sm .np-flow-navigation__stepper{padding-right:24px!important;padding-right:var(--size-24)!important}[dir=rtl] .np-flow-navigation--sm .np-flow-navigation__stepper,html:not([dir=rtl]) .np-flow-navigation--sm .np-flow-navigation__stepper{padding-left:24px!important;padding-left:var(--size-24)!important}html:not([dir=rtl]) .np-flow-navigation--sm .np-flow-navigation__stepper{padding-right:24px!important;padding-right:var(--size-24)!important}.np-flow-navigation--lg .np-flow-navigation__stepper{max-width:562px}.np-flow-navigation--lg .np-flow-header__left,.np-flow-navigation--lg .np-flow-header__right{width:180px}.np-flow-navigation .separator{background-color:#0000001a;background-color:var(--color-border-neutral);height:32px;height:var(--size-32);min-width:1px;width:1px}[dir=rtl] .np-flow-navigation .separator{margin-right:16px!important;margin-right:var(--size-16)!important}[dir=rtl] .np-flow-navigation .separator,html:not([dir=rtl]) .np-flow-navigation .separator{margin-left:16px!important;margin-left:var(--size-16)!important}html:not([dir=rtl]) .np-flow-navigation .separator{margin-right:16px!important;margin-right:var(--size-16)!important}.np-flow-navigation--hidden{visibility:hidden}.np-theme-personal--bright-green .np-flow-navigation .np-flow-header__left path,.np-theme-personal--dark .np-flow-navigation .np-flow-header__left path,.np-theme-personal--forest-green .np-flow-navigation .np-flow-header__left path{fill:var(--color-interactive-primary)}
|
|
@@ -73,7 +73,7 @@ describe('FlowNavigation', () => {
|
|
|
73
73
|
it(`renders separator if avatar and onClose are provided`, () => {
|
|
74
74
|
const { container } = render(<FlowNavigation {...props} />);
|
|
75
75
|
|
|
76
|
-
expect(container.querySelector('
|
|
76
|
+
expect(container.querySelector('.separator')).toBeInTheDocument();
|
|
77
77
|
});
|
|
78
78
|
|
|
79
79
|
it(`doesn't render separator if avatar or onClose are not provided`, () => {
|
|
@@ -194,11 +194,11 @@ describe('FlowNavigation', () => {
|
|
|
194
194
|
<FlowNavigation {...props} activeStep={1} onGoBack={jest.fn()} />,
|
|
195
195
|
);
|
|
196
196
|
|
|
197
|
-
expect(screen.getByTestId('activeLabel-
|
|
197
|
+
expect(screen.getByTestId('activeLabel-0')).toBeInTheDocument();
|
|
198
198
|
|
|
199
199
|
rerender(<FlowNavigation {...props} activeStep={2} onGoBack={jest.fn()} />);
|
|
200
200
|
|
|
201
|
-
expect(screen.getByTestId('activeLabel-
|
|
201
|
+
expect(screen.getByTestId('activeLabel-1')).toBeInTheDocument();
|
|
202
202
|
});
|
|
203
203
|
});
|
|
204
204
|
const logoFull = () => screen.getByAltText(`logo`);
|
|
@@ -5,10 +5,8 @@ import { useState } from 'react';
|
|
|
5
5
|
|
|
6
6
|
import Avatar, { AvatarType } from '../avatar';
|
|
7
7
|
import AvatarWrapper from '../avatarWrapper';
|
|
8
|
-
import Body from '../body';
|
|
9
|
-
import Button from '../button';
|
|
10
8
|
import { ProfileType, Size } from '../common';
|
|
11
|
-
import Logo from '../logo';
|
|
9
|
+
import Logo, { LogoType } from '../logo';
|
|
12
10
|
import OverlayHeader from '../overlayHeader';
|
|
13
11
|
|
|
14
12
|
import FlowNavigation from './FlowNavigation';
|
|
@@ -23,18 +21,13 @@ const avatarProfiles = {
|
|
|
23
21
|
Profile: <ProfileIcon />,
|
|
24
22
|
};
|
|
25
23
|
|
|
26
|
-
export const
|
|
24
|
+
export const WithAvatarIcon = () => {
|
|
27
25
|
const [activeStep, setActiveStep] = useState(4);
|
|
28
26
|
const [closed, setClosed] = useState(false);
|
|
29
27
|
const showAvatar = select('avatar', Object.keys(avatarProfiles), 'Profile');
|
|
30
28
|
const showCloseButton = boolean('show closeButton', true);
|
|
31
29
|
const showMobileBackButton = boolean('show mobile backButton', true);
|
|
32
30
|
const done = boolean('done', false);
|
|
33
|
-
const profileType = select('profileType', Object.keys(ProfileType));
|
|
34
|
-
const avatarURL = text(
|
|
35
|
-
'avatarURL',
|
|
36
|
-
'https://wise.design/api/images/Logo-LogoFastFlagAvatar.webp',
|
|
37
|
-
);
|
|
38
31
|
|
|
39
32
|
return !closed ? (
|
|
40
33
|
<>
|
|
@@ -89,15 +82,16 @@ export const Varients = () => {
|
|
|
89
82
|
/>
|
|
90
83
|
|
|
91
84
|
<FlowNavigation
|
|
92
|
-
done={done}
|
|
93
85
|
avatar={
|
|
94
86
|
!showAvatar ? null : (
|
|
95
|
-
<Avatar type={AvatarType.
|
|
96
|
-
|
|
87
|
+
<Avatar type={AvatarType.ICON} size={Size.MEDIUM}>
|
|
88
|
+
{avatarProfiles[showAvatar]}
|
|
97
89
|
</Avatar>
|
|
98
90
|
)
|
|
99
91
|
}
|
|
92
|
+
logo={<Logo type={LogoType.WISE_BUSINESS} />}
|
|
100
93
|
activeStep={activeStep}
|
|
94
|
+
done={done}
|
|
101
95
|
steps={[
|
|
102
96
|
{
|
|
103
97
|
label: 'Amount',
|
|
@@ -133,14 +127,15 @@ export const Varients = () => {
|
|
|
133
127
|
]}
|
|
134
128
|
onClose={showCloseButton && (() => setClosed(true))}
|
|
135
129
|
onGoBack={
|
|
136
|
-
showMobileBackButton && (() => setActiveStep(activeStep
|
|
130
|
+
showMobileBackButton && (() => setActiveStep(activeStep > 0 ? activeStep - 1 : 0))
|
|
137
131
|
}
|
|
138
132
|
/>
|
|
139
133
|
|
|
140
134
|
<FlowNavigation
|
|
141
|
-
|
|
142
|
-
|
|
135
|
+
avatar={false}
|
|
136
|
+
logo={<Logo />}
|
|
143
137
|
activeStep={activeStep}
|
|
138
|
+
done={done}
|
|
144
139
|
steps={[
|
|
145
140
|
{
|
|
146
141
|
label: 'Amount',
|
|
@@ -176,23 +171,187 @@ export const Varients = () => {
|
|
|
176
171
|
]}
|
|
177
172
|
onClose={showCloseButton && (() => setClosed(true))}
|
|
178
173
|
onGoBack={
|
|
179
|
-
showMobileBackButton && (() => setActiveStep(activeStep
|
|
174
|
+
showMobileBackButton && (() => setActiveStep(activeStep > 0 ? activeStep - 1 : 0))
|
|
180
175
|
}
|
|
181
176
|
/>
|
|
182
177
|
|
|
183
|
-
<
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
178
|
+
<FlowNavigation
|
|
179
|
+
avatar={false}
|
|
180
|
+
logo={<Logo type={LogoType.WISE_BUSINESS} />}
|
|
181
|
+
activeStep={activeStep}
|
|
182
|
+
done={done}
|
|
183
|
+
steps={[
|
|
184
|
+
{
|
|
185
|
+
label: 'Amount',
|
|
186
|
+
hoverLabel: (
|
|
187
|
+
<>
|
|
188
|
+
<div>
|
|
189
|
+
<strong>100 GBP</strong>
|
|
190
|
+
</div>
|
|
191
|
+
0.2351 ETH
|
|
192
|
+
</>
|
|
193
|
+
),
|
|
194
|
+
onClick: () => setActiveStep(0),
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
label: 'You',
|
|
198
|
+
hoverLabel: (
|
|
199
|
+
<>
|
|
200
|
+
<div>
|
|
201
|
+
<strong>Elena Durante</strong>
|
|
202
|
+
</div>
|
|
203
|
+
elenadurante@test.com
|
|
204
|
+
</>
|
|
205
|
+
),
|
|
206
|
+
onClick: () => setActiveStep(1),
|
|
207
|
+
},
|
|
208
|
+
{ label: 'Recipient', hoverLabel: 'Daniele Tomboro', onClick: () => setActiveStep(2) },
|
|
209
|
+
{ label: 'Review', hoverLabel: 'Antonio Dozortevo', onClick: () => setActiveStep(3) },
|
|
210
|
+
{
|
|
211
|
+
label: 'Pay',
|
|
212
|
+
hoverLabel: 'Enrico Gusso II',
|
|
213
|
+
onClick: () => setActiveStep(4),
|
|
214
|
+
},
|
|
215
|
+
]}
|
|
216
|
+
onClose={showCloseButton && (() => setClosed(true))}
|
|
217
|
+
onGoBack={
|
|
218
|
+
showMobileBackButton && (() => setActiveStep(activeStep > 0 ? activeStep - 1 : 0))
|
|
219
|
+
}
|
|
220
|
+
/>
|
|
221
|
+
<div
|
|
222
|
+
className="bg--dark"
|
|
223
|
+
style={{
|
|
224
|
+
textAlign: 'center',
|
|
225
|
+
width: '538px',
|
|
226
|
+
height: '30px',
|
|
227
|
+
margin: '24px auto',
|
|
228
|
+
color: 'white',
|
|
229
|
+
}}
|
|
189
230
|
>
|
|
190
|
-
|
|
191
|
-
</
|
|
231
|
+
Content to test that the flow nav is centred
|
|
232
|
+
</div>
|
|
192
233
|
</>
|
|
193
234
|
) : null;
|
|
194
235
|
};
|
|
195
236
|
|
|
237
|
+
export const WithCustomAvatarImage = () => {
|
|
238
|
+
const [activeStep, setActiveStep] = useState(4);
|
|
239
|
+
const [closed, setClosed] = useState(false);
|
|
240
|
+
const showAvatar = boolean('show avatar', true);
|
|
241
|
+
const showCloseButton = boolean('show closeButton', true);
|
|
242
|
+
const showMobileBackButton = boolean('show mobile backButton', true);
|
|
243
|
+
const done = boolean('done', false);
|
|
244
|
+
|
|
245
|
+
return !closed ? (
|
|
246
|
+
<FlowNavigation
|
|
247
|
+
done={done}
|
|
248
|
+
avatar={
|
|
249
|
+
!showAvatar ? null : (
|
|
250
|
+
<Avatar type={AvatarType.THUMBNAIL} size={Size.MEDIUM}>
|
|
251
|
+
<Illustration name="multi-currency" alt="stack of cash and coins" disableMargin />
|
|
252
|
+
</Avatar>
|
|
253
|
+
)
|
|
254
|
+
}
|
|
255
|
+
activeStep={activeStep}
|
|
256
|
+
steps={[
|
|
257
|
+
{
|
|
258
|
+
label: 'Amount',
|
|
259
|
+
hoverLabel: (
|
|
260
|
+
<>
|
|
261
|
+
<div>
|
|
262
|
+
<strong>100 GBP</strong>
|
|
263
|
+
</div>
|
|
264
|
+
0.2351 ETH
|
|
265
|
+
</>
|
|
266
|
+
),
|
|
267
|
+
onClick: () => setActiveStep(0),
|
|
268
|
+
},
|
|
269
|
+
{
|
|
270
|
+
label: 'You',
|
|
271
|
+
hoverLabel: (
|
|
272
|
+
<>
|
|
273
|
+
<div>
|
|
274
|
+
<strong>Elena Durante</strong>
|
|
275
|
+
</div>
|
|
276
|
+
elenadurante@test.com
|
|
277
|
+
</>
|
|
278
|
+
),
|
|
279
|
+
onClick: () => setActiveStep(1),
|
|
280
|
+
},
|
|
281
|
+
{ label: 'Recipient', hoverLabel: 'Daniele Tomboro', onClick: () => setActiveStep(2) },
|
|
282
|
+
{ label: 'Review', hoverLabel: 'Antonio Dozortevo', onClick: () => setActiveStep(3) },
|
|
283
|
+
{
|
|
284
|
+
label: 'Pay',
|
|
285
|
+
hoverLabel: 'Enrico Gusso II',
|
|
286
|
+
onClick: () => setActiveStep(4),
|
|
287
|
+
},
|
|
288
|
+
]}
|
|
289
|
+
onClose={showCloseButton && (() => setClosed(true))}
|
|
290
|
+
onGoBack={
|
|
291
|
+
showMobileBackButton && (() => setActiveStep(activeStep - 1 > 0 ? activeStep - 1 : 0))
|
|
292
|
+
}
|
|
293
|
+
/>
|
|
294
|
+
) : null;
|
|
295
|
+
};
|
|
296
|
+
|
|
297
|
+
export const WithAvatarWrapper = () => {
|
|
298
|
+
const [activeStep, setActiveStep] = useState(4);
|
|
299
|
+
const [closed, setClosed] = useState(false);
|
|
300
|
+
const profileType = select('profileType', Object.keys(ProfileType));
|
|
301
|
+
const showCloseButton = boolean('show closeButton', true);
|
|
302
|
+
const showMobileBackButton = boolean('show mobile backButton', true);
|
|
303
|
+
const avatarURL = text(
|
|
304
|
+
'avatarURL',
|
|
305
|
+
'https://wise.design/api/images/Logo-LogoFastFlagAvatar.webp',
|
|
306
|
+
);
|
|
307
|
+
const done = boolean('done', false);
|
|
308
|
+
|
|
309
|
+
return !closed ? (
|
|
310
|
+
<FlowNavigation
|
|
311
|
+
done={done}
|
|
312
|
+
avatar={<AvatarWrapper url={avatarURL} profileType={profileType} />}
|
|
313
|
+
activeStep={activeStep}
|
|
314
|
+
steps={[
|
|
315
|
+
{
|
|
316
|
+
label: 'Amount',
|
|
317
|
+
hoverLabel: (
|
|
318
|
+
<>
|
|
319
|
+
<div>
|
|
320
|
+
<strong>100 GBP</strong>
|
|
321
|
+
</div>
|
|
322
|
+
0.2351 ETH
|
|
323
|
+
</>
|
|
324
|
+
),
|
|
325
|
+
onClick: () => setActiveStep(0),
|
|
326
|
+
},
|
|
327
|
+
{
|
|
328
|
+
label: 'You',
|
|
329
|
+
hoverLabel: (
|
|
330
|
+
<>
|
|
331
|
+
<div>
|
|
332
|
+
<strong>Elena Durante</strong>
|
|
333
|
+
</div>
|
|
334
|
+
elenadurante@test.com
|
|
335
|
+
</>
|
|
336
|
+
),
|
|
337
|
+
onClick: () => setActiveStep(1),
|
|
338
|
+
},
|
|
339
|
+
{ label: 'Recipient', hoverLabel: 'Daniele Tomboro', onClick: () => setActiveStep(2) },
|
|
340
|
+
{ label: 'Review', hoverLabel: 'Antonio Dozortevo', onClick: () => setActiveStep(3) },
|
|
341
|
+
{
|
|
342
|
+
label: 'Pay',
|
|
343
|
+
hoverLabel: 'Enrico Gusso II',
|
|
344
|
+
onClick: () => setActiveStep(4),
|
|
345
|
+
},
|
|
346
|
+
]}
|
|
347
|
+
onClose={showCloseButton && (() => setClosed(true))}
|
|
348
|
+
onGoBack={
|
|
349
|
+
showMobileBackButton && (() => setActiveStep(activeStep - 1 > 0 ? activeStep - 1 : 0))
|
|
350
|
+
}
|
|
351
|
+
/>
|
|
352
|
+
) : null;
|
|
353
|
+
};
|
|
354
|
+
|
|
196
355
|
export const WithOverlayHeaderComparison = () => {
|
|
197
356
|
const [activeStep, setActiveStep] = useState(4);
|
|
198
357
|
const [closed, setClosed] = useState(false);
|
|
@@ -50,16 +50,20 @@ const FlowNavigation = ({
|
|
|
50
50
|
return (
|
|
51
51
|
<>
|
|
52
52
|
{displayGoBack ? (
|
|
53
|
-
<BackButton
|
|
53
|
+
<BackButton
|
|
54
|
+
label={
|
|
55
|
+
<AnimatedLabel
|
|
56
|
+
className="m-x-1"
|
|
57
|
+
labels={steps.map((step) => step.label)}
|
|
58
|
+
activeLabel={activeStep - 1}
|
|
59
|
+
aria-label={intl.formatMessage(messages.back)}
|
|
60
|
+
/>
|
|
61
|
+
}
|
|
62
|
+
onClick={onGoBack}
|
|
63
|
+
/>
|
|
54
64
|
) : (
|
|
55
65
|
logo
|
|
56
66
|
)}
|
|
57
|
-
<AnimatedLabel
|
|
58
|
-
className="m-x-1"
|
|
59
|
-
labels={steps.map((step) => step.label)}
|
|
60
|
-
activeLabel={activeStep}
|
|
61
|
-
/>
|
|
62
|
-
<span className="m-x-1" />
|
|
63
67
|
</>
|
|
64
68
|
);
|
|
65
69
|
};
|
|
@@ -73,7 +77,7 @@ const FlowNavigation = ({
|
|
|
73
77
|
)}
|
|
74
78
|
>
|
|
75
79
|
<FlowHeader
|
|
76
|
-
className={classNames('np-flow-navigation__content
|
|
80
|
+
className={classNames('np-flow-navigation__content p-x-3', {
|
|
77
81
|
'np-flow-navigation--hidden': !clientWidth,
|
|
78
82
|
'np-flow-navigation--xs-max': isSmall,
|
|
79
83
|
// Size switches on parent container which may or may not have the same size as the window.
|
|
@@ -84,7 +88,7 @@ const FlowNavigation = ({
|
|
|
84
88
|
rightContent={
|
|
85
89
|
<>
|
|
86
90
|
{newAvatar}
|
|
87
|
-
{newAvatar && closeButton && <span className="
|
|
91
|
+
{newAvatar && closeButton && <span className="separator" />}
|
|
88
92
|
{closeButton}
|
|
89
93
|
</>
|
|
90
94
|
}
|
|
@@ -6,23 +6,20 @@ exports[`FlowNavigation on mobile renders as expected 1`] = `
|
|
|
6
6
|
class="np-flow-navigation d-flex align-items-center justify-content-center p-y-3 np-flow-navigation--border-bottom"
|
|
7
7
|
>
|
|
8
8
|
<div
|
|
9
|
-
class="np-flow-header d-flex flex-wrap align-items-center np-flow-navigation__content p-x-
|
|
9
|
+
class="np-flow-header d-flex flex-wrap align-items-center np-flow-navigation__content p-x-3 np-flow-navigation--xs-max"
|
|
10
10
|
>
|
|
11
11
|
<div
|
|
12
|
-
class="np-flow-header__left
|
|
12
|
+
class="np-flow-header__left flex__item--8"
|
|
13
13
|
>
|
|
14
14
|
<div>
|
|
15
15
|
BackButton
|
|
16
|
+
<div
|
|
17
|
+
class="m-x-1"
|
|
18
|
+
data-testid="activeLabel-0"
|
|
19
|
+
>
|
|
20
|
+
AnimatedLabel
|
|
21
|
+
</div>
|
|
16
22
|
</div>
|
|
17
|
-
<div
|
|
18
|
-
class="m-x-1"
|
|
19
|
-
data-testid="activeLabel-1"
|
|
20
|
-
>
|
|
21
|
-
AnimatedLabel
|
|
22
|
-
</div>
|
|
23
|
-
<span
|
|
24
|
-
class="m-x-1"
|
|
25
|
-
/>
|
|
26
23
|
</div>
|
|
27
24
|
<div
|
|
28
25
|
class="align-items-center d-flex np-flow-header__right justify-content-end flex__item--4 "
|
|
@@ -37,7 +34,7 @@ exports[`FlowNavigation on mobile renders as expected 1`] = `
|
|
|
37
34
|
</div>
|
|
38
35
|
</div>
|
|
39
36
|
<span
|
|
40
|
-
class="
|
|
37
|
+
class="separator"
|
|
41
38
|
/>
|
|
42
39
|
<button
|
|
43
40
|
aria-label="Close"
|
|
@@ -128,7 +125,7 @@ exports[`FlowNavigation renders as expected 1`] = `
|
|
|
128
125
|
class="np-flow-header d-flex flex-wrap align-items-center np-flow-navigation__content p-x-3 np-flow-navigation--sm np-flow-navigation--lg"
|
|
129
126
|
>
|
|
130
127
|
<div
|
|
131
|
-
class="np-flow-header__left
|
|
128
|
+
class="np-flow-header__left"
|
|
132
129
|
>
|
|
133
130
|
<img
|
|
134
131
|
alt="logo"
|
|
@@ -150,7 +147,7 @@ exports[`FlowNavigation renders as expected 1`] = `
|
|
|
150
147
|
</div>
|
|
151
148
|
</div>
|
|
152
149
|
<span
|
|
153
|
-
class="
|
|
150
|
+
class="separator"
|
|
154
151
|
/>
|
|
155
152
|
<button
|
|
156
153
|
aria-label="Close"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.np-animated-label{height:24px;overflow:hidden;padding-top:1px;position:relative}.np-animated-label>*{height:0;opacity:0;position:absolute;transform:translateX(-8px);transition:all .3s ease-in}.np-animated-label--in{height:auto;opacity:1;position:relative;top:auto;transform:translateX(0);transition:all .3s ease-in .3s}
|
|
1
|
+
.np-animated-label{height:24px;overflow:hidden;padding-top:1px;position:relative}.np-animated-label>*{height:0;opacity:0;position:absolute;transform:translateX(-8px);transition:all .3s ease-in}.np-animated-label--in{height:auto;opacity:1;position:relative;top:auto;transform:translateX(0);transition:all .3s ease-in .3s}.np-animated-label--out{position:relative;top:-24px;transform:translateX(8px)}
|
|
@@ -14,6 +14,12 @@ describe('AnimatedLabel', () => {
|
|
|
14
14
|
expect(container).toMatchSnapshot();
|
|
15
15
|
});
|
|
16
16
|
|
|
17
|
+
it('renders aria-label if provided', () => {
|
|
18
|
+
render(<AnimatedLabel {...props} aria-label="hello" />);
|
|
19
|
+
const checkbox = screen.getByLabelText('hello');
|
|
20
|
+
expect(checkbox).toBeInTheDocument();
|
|
21
|
+
});
|
|
22
|
+
|
|
17
23
|
it('renders only one label with class in', () => {
|
|
18
24
|
const { container } = render(<AnimatedLabel {...props} />);
|
|
19
25
|
expect(screen.getByText(props.labels[0])).toHaveClass('np-animated-label--in');
|
|
@@ -22,33 +28,41 @@ describe('AnimatedLabel', () => {
|
|
|
22
28
|
|
|
23
29
|
it('renders only one label with class out', () => {
|
|
24
30
|
const { container } = render(<AnimatedLabel {...props} />);
|
|
25
|
-
expect(screen.getByText(props.labels[1])).
|
|
26
|
-
expect(container.querySelectorAll('.np-animated-label--
|
|
31
|
+
expect(screen.getByText(props.labels[1])).toHaveClass('np-animated-label--out');
|
|
32
|
+
expect(container.querySelectorAll('.np-animated-label--out')).toHaveLength(1);
|
|
27
33
|
});
|
|
28
34
|
|
|
29
35
|
it('when activeLabel increase it switches class accordingly', () => {
|
|
30
36
|
const { rerender } = render(<AnimatedLabel {...props} />);
|
|
31
37
|
expect(screen.getByText(props.labels[0])).toHaveClass('np-animated-label--in');
|
|
32
|
-
expect(screen.getByText(props.labels[1])).
|
|
38
|
+
expect(screen.getByText(props.labels[1])).toHaveClass('np-animated-label--out');
|
|
39
|
+
|
|
40
|
+
expect(screen.getByText(props.labels[2])).not.toHaveClass('np-animated-label--out');
|
|
33
41
|
expect(screen.getByText(props.labels[2])).not.toHaveClass('np-animated-label--in');
|
|
34
42
|
|
|
35
43
|
rerender(<AnimatedLabel {...props} activeLabel={1} />);
|
|
36
44
|
|
|
45
|
+
expect(screen.getByText(props.labels[0])).not.toHaveClass('np-animated-label--out');
|
|
37
46
|
expect(screen.getByText(props.labels[0])).not.toHaveClass('np-animated-label--in');
|
|
47
|
+
|
|
38
48
|
expect(screen.getByText(props.labels[1])).toHaveClass('np-animated-label--in');
|
|
39
|
-
expect(screen.getByText(props.labels[2])).
|
|
49
|
+
expect(screen.getByText(props.labels[2])).toHaveClass('np-animated-label--out');
|
|
40
50
|
});
|
|
41
51
|
|
|
42
52
|
it('when activeLabel decrease it switches class accordingly', () => {
|
|
43
53
|
const { rerender } = render(<AnimatedLabel {...props} activeLabel={1} />);
|
|
44
|
-
expect(screen.getByText(props.labels[0])).not.toHaveClass('np-animated-label--in');
|
|
45
54
|
expect(screen.getByText(props.labels[1])).toHaveClass('np-animated-label--in');
|
|
46
|
-
expect(screen.getByText(props.labels[2])).
|
|
55
|
+
expect(screen.getByText(props.labels[2])).toHaveClass('np-animated-label--out');
|
|
56
|
+
|
|
57
|
+
expect(screen.getByText(props.labels[0])).not.toHaveClass('np-animated-label--out');
|
|
58
|
+
expect(screen.getByText(props.labels[0])).not.toHaveClass('np-animated-label--in');
|
|
47
59
|
|
|
48
60
|
rerender(<AnimatedLabel {...props} activeLabel={0} />);
|
|
49
61
|
|
|
50
62
|
expect(screen.getByText(props.labels[0])).toHaveClass('np-animated-label--in');
|
|
51
|
-
expect(screen.getByText(props.labels[1])).
|
|
63
|
+
expect(screen.getByText(props.labels[1])).toHaveClass('np-animated-label--out');
|
|
64
|
+
|
|
65
|
+
expect(screen.getByText(props.labels[2])).not.toHaveClass('np-animated-label--out');
|
|
52
66
|
expect(screen.getByText(props.labels[2])).not.toHaveClass('np-animated-label--in');
|
|
53
67
|
});
|
|
54
68
|
});
|