@transferwise/components 45.19.1 → 45.19.2
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/i18n/en.json +1 -0
- package/build/index.esm.js +38 -36
- package/build/index.esm.js.map +1 -1
- package/build/index.js +38 -36
- package/build/index.js.map +1 -1
- package/build/types/flowNavigation/FlowNavigation.d.ts.map +1 -1
- package/build/types/flowNavigation/FlowNavigation.messages.d.ts +8 -0
- package/build/types/flowNavigation/FlowNavigation.messages.d.ts.map +1 -0
- package/build/types/flowNavigation/animatedLabel/AnimatedLabel.d.ts +8 -16
- package/build/types/flowNavigation/animatedLabel/AnimatedLabel.d.ts.map +1 -1
- package/build/types/flowNavigation/animatedLabel/index.d.ts +1 -1
- package/build/types/flowNavigation/animatedLabel/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/button/Button.spec.js +12 -0
- package/src/button/Button.tsx +1 -1
- package/src/flowNavigation/FlowNavigation.messages.ts +8 -0
- package/src/flowNavigation/FlowNavigation.tsx +4 -0
- package/src/flowNavigation/animatedLabel/AnimatedLabel.spec.js +6 -0
- package/src/flowNavigation/animatedLabel/{AnimatedLabel.js → AnimatedLabel.tsx} +18 -12
- package/src/i18n/en.json +1 -0
- /package/src/flowNavigation/animatedLabel/{index.js → index.ts} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FlowNavigation.d.ts","sourceRoot":"","sources":["../../../src/flowNavigation/FlowNavigation.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FlowNavigation.messages.d.ts","sourceRoot":"","sources":["../../../src/flowNavigation/FlowNavigation.messages.ts"],"names":[],"mappings":";;;;;;AAEA,wBAKG"}
|
|
@@ -1,18 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
activeLabel:
|
|
4
|
-
className
|
|
5
|
-
labels:
|
|
6
|
-
|
|
7
|
-
declare namespace AnimatedLabel {
|
|
8
|
-
namespace propTypes {
|
|
9
|
-
const activeLabel: any;
|
|
10
|
-
const className: any;
|
|
11
|
-
const labels: any;
|
|
12
|
-
}
|
|
13
|
-
namespace defaultProps {
|
|
14
|
-
const className_1: undefined;
|
|
15
|
-
export { className_1 as className };
|
|
16
|
-
}
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface AnimatedLabelProps {
|
|
3
|
+
activeLabel: number;
|
|
4
|
+
className?: string;
|
|
5
|
+
labels: React.ReactNode[];
|
|
6
|
+
'aria-label': string;
|
|
17
7
|
}
|
|
8
|
+
declare const AnimatedLabel: ({ activeLabel, className, labels, "aria-label": ariaLabel, }: AnimatedLabelProps) => React.JSX.Element;
|
|
9
|
+
export default AnimatedLabel;
|
|
18
10
|
//# sourceMappingURL=AnimatedLabel.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AnimatedLabel.d.ts","sourceRoot":"","sources":["../../../../src/flowNavigation/animatedLabel/AnimatedLabel.
|
|
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,2 +1,2 @@
|
|
|
1
|
-
export { default } from
|
|
1
|
+
export { default } from './AnimatedLabel';
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/flowNavigation/animatedLabel/index.
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/flowNavigation/animatedLabel/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC"}
|
package/package.json
CHANGED
|
@@ -85,6 +85,12 @@ describe('Button', () => {
|
|
|
85
85
|
render(<Button {...props} className="catsarethebest" />);
|
|
86
86
|
expect(screen.getByRole('button')).toHaveClass('catsarethebest');
|
|
87
87
|
});
|
|
88
|
+
|
|
89
|
+
it('passes through aria-label if set', () => {
|
|
90
|
+
render(<Button {...props} aria-label="unique label" />);
|
|
91
|
+
const loadingButton = screen.getByLabelText('unique label');
|
|
92
|
+
expect(loadingButton).toBeInTheDocument();
|
|
93
|
+
});
|
|
88
94
|
});
|
|
89
95
|
|
|
90
96
|
describe('onClick', () => {
|
|
@@ -170,6 +176,12 @@ describe('Button', () => {
|
|
|
170
176
|
expect(screen.getByRole('button', { name: 'loading' })).toBeInTheDocument();
|
|
171
177
|
});
|
|
172
178
|
|
|
179
|
+
it('loading button has aria-label of loading', () => {
|
|
180
|
+
render(<Button {...props} loading />);
|
|
181
|
+
const loadingButton = screen.getByLabelText('loading');
|
|
182
|
+
expect(loadingButton).toBeInTheDocument();
|
|
183
|
+
});
|
|
184
|
+
|
|
173
185
|
it('renders as block if block is true', () => {
|
|
174
186
|
expect(render(<Button {...props} block />).container).toMatchSnapshot();
|
|
175
187
|
});
|
package/src/button/Button.tsx
CHANGED
|
@@ -126,7 +126,7 @@ const Button = forwardRef<ButtonReferenceType, Props>(
|
|
|
126
126
|
className={classes}
|
|
127
127
|
{...props}
|
|
128
128
|
aria-live={loading ? 'polite' : 'off'}
|
|
129
|
-
aria-label={loading ? intl.formatMessage(messages.loadingAriaLabel) :
|
|
129
|
+
aria-label={loading ? intl.formatMessage(messages.loadingAriaLabel) : rest['aria-label']}
|
|
130
130
|
>
|
|
131
131
|
{children}
|
|
132
132
|
{loading && <ProcessIndicator size={processIndicatorSize()} className="btn-loader" />}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import classNames from 'classnames';
|
|
2
2
|
import { useRef } from 'react';
|
|
3
3
|
import React from 'react';
|
|
4
|
+
import { useIntl } from 'react-intl';
|
|
4
5
|
|
|
5
6
|
import { Breakpoint, Layout } from '../common';
|
|
6
7
|
import { CloseButton } from '../common/closeButton';
|
|
@@ -9,6 +10,7 @@ import { useClientWidth } from '../common/hooks';
|
|
|
9
10
|
import Logo from '../logo';
|
|
10
11
|
import Stepper, { Step } from '../stepper/Stepper';
|
|
11
12
|
|
|
13
|
+
import messages from './FlowNavigation.messages';
|
|
12
14
|
import AnimatedLabel from './animatedLabel';
|
|
13
15
|
import BackButton from './backButton';
|
|
14
16
|
|
|
@@ -35,6 +37,7 @@ const FlowNavigation = ({
|
|
|
35
37
|
steps,
|
|
36
38
|
}: FlowNavigationProps) => {
|
|
37
39
|
const reference = useRef<HTMLDivElement>(null);
|
|
40
|
+
const intl = useIntl();
|
|
38
41
|
|
|
39
42
|
const [clientWidth] = useClientWidth({ ref: reference });
|
|
40
43
|
const closeButton = onClose != null && <CloseButton size="lg" onClick={onClose} />;
|
|
@@ -53,6 +56,7 @@ const FlowNavigation = ({
|
|
|
53
56
|
className="m-x-1"
|
|
54
57
|
labels={steps.map((step) => step.label)}
|
|
55
58
|
activeLabel={activeStep - 1}
|
|
59
|
+
aria-label={intl.formatMessage(messages.back)}
|
|
56
60
|
/>
|
|
57
61
|
}
|
|
58
62
|
onClick={onGoBack}
|
|
@@ -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');
|
|
@@ -1,11 +1,26 @@
|
|
|
1
1
|
import classNames from 'classnames';
|
|
2
|
-
import
|
|
2
|
+
import React from 'react';
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
export interface AnimatedLabelProps {
|
|
5
|
+
activeLabel: number;
|
|
6
|
+
className?: string;
|
|
7
|
+
labels: React.ReactNode[];
|
|
8
|
+
'aria-label': string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const AnimatedLabel = ({
|
|
12
|
+
activeLabel,
|
|
13
|
+
className,
|
|
14
|
+
labels,
|
|
15
|
+
'aria-label': ariaLabel,
|
|
16
|
+
}: AnimatedLabelProps) => {
|
|
5
17
|
const numberLabels = labels.length - 1;
|
|
6
18
|
|
|
7
19
|
return (
|
|
8
|
-
<div
|
|
20
|
+
<div
|
|
21
|
+
aria-label={ariaLabel}
|
|
22
|
+
className={classNames('np-animated-label', 'np-text-body-large-bold', className)}
|
|
23
|
+
>
|
|
9
24
|
{labels.map((label, index) => {
|
|
10
25
|
const nextLabel = index - 1;
|
|
11
26
|
return (
|
|
@@ -24,13 +39,4 @@ const AnimatedLabel = ({ activeLabel, className, labels }) => {
|
|
|
24
39
|
);
|
|
25
40
|
};
|
|
26
41
|
|
|
27
|
-
AnimatedLabel.propTypes = {
|
|
28
|
-
activeLabel: PropTypes.number.isRequired,
|
|
29
|
-
className: PropTypes.string,
|
|
30
|
-
labels: PropTypes.arrayOf(PropTypes.node).isRequired,
|
|
31
|
-
};
|
|
32
|
-
AnimatedLabel.defaultProps = {
|
|
33
|
-
className: undefined,
|
|
34
|
-
};
|
|
35
|
-
|
|
36
42
|
export default AnimatedLabel;
|
package/src/i18n/en.json
CHANGED
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
"neptune.DateLookup.selected": "selected",
|
|
15
15
|
"neptune.DateLookup.twentyYears": "20 years",
|
|
16
16
|
"neptune.DateLookup.year": "year",
|
|
17
|
+
"neptune.FlowNavigation.back": "back to previous step",
|
|
17
18
|
"neptune.Link.opensInNewTab": "(opens in new tab)",
|
|
18
19
|
"neptune.MoneyInput.Select.placeholder": "Select an option...",
|
|
19
20
|
"neptune.Select.searchPlaceholder": "Search...",
|
|
File without changes
|