@transferwise/components 46.95.1 → 46.96.0
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/alert/Alert.js +18 -6
- package/build/alert/Alert.js.map +1 -1
- package/build/alert/Alert.mjs +18 -6
- package/build/alert/Alert.mjs.map +1 -1
- package/build/link/Link.js +32 -4
- package/build/link/Link.js.map +1 -1
- package/build/link/Link.mjs +32 -4
- package/build/link/Link.mjs.map +1 -1
- package/build/main.css +2 -16
- package/build/nudge/Nudge.js +8 -4
- package/build/nudge/Nudge.js.map +1 -1
- package/build/nudge/Nudge.mjs +8 -4
- package/build/nudge/Nudge.mjs.map +1 -1
- package/build/promoCard/PromoCardIndicator.js +6 -5
- package/build/promoCard/PromoCardIndicator.js.map +1 -1
- package/build/promoCard/PromoCardIndicator.mjs +6 -5
- package/build/promoCard/PromoCardIndicator.mjs.map +1 -1
- package/build/select/option/Option.js +3 -1
- package/build/select/option/Option.js.map +1 -1
- package/build/select/option/Option.mjs +3 -1
- package/build/select/option/Option.mjs.map +1 -1
- package/build/styles/link/Link.css +2 -1
- package/build/styles/main.css +2 -16
- package/build/styles/stepper/Stepper.css +0 -7
- package/build/styles/summary/Summary.css +0 -4
- package/build/summary/Summary.js +8 -4
- package/build/summary/Summary.js.map +1 -1
- package/build/summary/Summary.mjs +8 -4
- package/build/summary/Summary.mjs.map +1 -1
- package/build/types/alert/Alert.d.ts.map +1 -1
- package/build/types/link/Link.d.ts +2 -2
- package/build/types/link/Link.d.ts.map +1 -1
- package/build/types/nudge/Nudge.d.ts +2 -2
- package/build/types/nudge/Nudge.d.ts.map +1 -1
- package/build/types/select/option/Option.d.ts +2 -1
- package/build/types/select/option/Option.d.ts.map +1 -1
- package/build/types/summary/Summary.d.ts +2 -2
- package/build/types/summary/Summary.d.ts.map +1 -1
- package/package.json +5 -5
- package/src/alert/Alert.tsx +27 -10
- package/src/dateLookup/DateLookup.less +0 -1
- package/src/decision/Decision.spec.tsx +2 -2
- package/src/decision/Decision.story.tsx +10 -46
- package/src/flowNavigation/FlowNavigation.spec.js +3 -7
- package/src/flowNavigation/__snapshots__/FlowNavigation.spec.js.snap +8 -4
- package/src/link/Link.css +2 -1
- package/src/link/Link.less +1 -1
- package/src/link/Link.spec.tsx +32 -1
- package/src/link/Link.story.tsx +12 -0
- package/src/link/Link.tsx +17 -6
- package/src/main.css +2 -16
- package/src/navigationOption/NavigationOption.story.tsx +30 -53
- package/src/nudge/Nudge.tsx +15 -3
- package/src/overlayHeader/OverlayHeader.spec.tsx +5 -8
- package/src/overlayHeader/__snapshots__/OverlayHeader.spec.tsx.snap +4 -2
- package/src/promoCard/PromoCard.spec.tsx +3 -1
- package/src/promoCard/PromoCardIndicator.tsx +5 -5
- package/src/select/option/Option.spec.tsx +51 -0
- package/src/select/option/Option.tsx +3 -1
- package/src/stepper/Stepper.css +0 -7
- package/src/stepper/Stepper.less +0 -8
- package/src/summary/Summary.css +0 -4
- package/src/summary/Summary.less +0 -2
- package/src/summary/Summary.tsx +14 -3
- package/src/tile/Tile.story.tsx +2 -6
- package/build/common/action/Action.js +0 -53
- package/build/common/action/Action.js.map +0 -1
- package/build/common/action/Action.mjs +0 -51
- package/build/common/action/Action.mjs.map +0 -1
- package/build/types/common/action/Action.d.ts +0 -18
- package/build/types/common/action/Action.d.ts.map +0 -1
- package/src/common/action/Action.tsx +0 -74
- package/src/select/option/Option.spec.js +0 -43
package/src/alert/Alert.tsx
CHANGED
|
@@ -9,7 +9,8 @@ import Title from '../title/Title';
|
|
|
9
9
|
import { logActionRequired } from '../utilities';
|
|
10
10
|
|
|
11
11
|
import InlineMarkdown from './inlineMarkdown';
|
|
12
|
-
import
|
|
12
|
+
import Button from '../button';
|
|
13
|
+
import Link from '../link';
|
|
13
14
|
|
|
14
15
|
export type AlertAction = {
|
|
15
16
|
'aria-label'?: string;
|
|
@@ -193,15 +194,31 @@ export default function Alert({
|
|
|
193
194
|
{children || <InlineMarkdown>{message}</InlineMarkdown>}
|
|
194
195
|
</Body>
|
|
195
196
|
</div>
|
|
196
|
-
{action &&
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
197
|
+
{action &&
|
|
198
|
+
('href' in action ? (
|
|
199
|
+
<Link
|
|
200
|
+
href={action.href}
|
|
201
|
+
aria-label={action['aria-label']}
|
|
202
|
+
target={action.target}
|
|
203
|
+
type={Typography.LINK_LARGE}
|
|
204
|
+
className="alert__action"
|
|
205
|
+
onClick={action.onClick}
|
|
206
|
+
>
|
|
207
|
+
{action.text}
|
|
208
|
+
</Link>
|
|
209
|
+
) : (
|
|
210
|
+
<Button
|
|
211
|
+
v2
|
|
212
|
+
size="sm"
|
|
213
|
+
sentiment="default"
|
|
214
|
+
aria-label={action['aria-label']}
|
|
215
|
+
priority="secondary-neutral"
|
|
216
|
+
className="alert__action"
|
|
217
|
+
onClick={action.onClick}
|
|
218
|
+
>
|
|
219
|
+
{action.text}
|
|
220
|
+
</Button>
|
|
221
|
+
))}
|
|
205
222
|
</div>
|
|
206
223
|
</div>
|
|
207
224
|
{onDismiss && (
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import Avatar from '../avatar';
|
|
2
1
|
import { Breakpoint, Size } from '../common';
|
|
3
2
|
import { mockMatchMedia } from '../mocks';
|
|
4
3
|
import { render, screen } from '../test-utils';
|
|
5
4
|
|
|
6
5
|
import Decision, { DecisionPresentation, DecisionType } from '.';
|
|
7
6
|
import { DecisionProps } from './Decision';
|
|
7
|
+
import AvatarView from '../avatarView';
|
|
8
8
|
|
|
9
9
|
mockMatchMedia(jest);
|
|
10
10
|
|
|
@@ -13,7 +13,7 @@ describe('Decision', () => {
|
|
|
13
13
|
options: [
|
|
14
14
|
{
|
|
15
15
|
media: {
|
|
16
|
-
list: <
|
|
16
|
+
list: <AvatarView profileName="Henry Mike" />,
|
|
17
17
|
block: <img src="img.jpg" alt="alt" />,
|
|
18
18
|
},
|
|
19
19
|
href: '#href',
|
|
@@ -2,10 +2,10 @@ import { action } from '@storybook/addon-actions';
|
|
|
2
2
|
import { boolean, select } from '@storybook/addon-knobs';
|
|
3
3
|
import { Illustration } from '@wise/art';
|
|
4
4
|
|
|
5
|
-
import Avatar from '../avatar';
|
|
6
5
|
import { Size } from '../common';
|
|
7
6
|
|
|
8
7
|
import Decision, { DecisionPresentation, DecisionType } from '.';
|
|
8
|
+
import AvatarView from '../avatarView';
|
|
9
9
|
|
|
10
10
|
export default {
|
|
11
11
|
component: Decision,
|
|
@@ -33,11 +33,7 @@ export const Basic = () => {
|
|
|
33
33
|
disabled,
|
|
34
34
|
media: {
|
|
35
35
|
block: <Illustration name="globe" alt="" disablePadding />,
|
|
36
|
-
list:
|
|
37
|
-
<Avatar size="md" type="initials">
|
|
38
|
-
HM
|
|
39
|
-
</Avatar>
|
|
40
|
-
),
|
|
36
|
+
list: <AvatarView profileName="Henry Mike" />,
|
|
41
37
|
},
|
|
42
38
|
'aria-label': 'Click to see something',
|
|
43
39
|
title: 'Hank Miller',
|
|
@@ -50,11 +46,7 @@ export const Basic = () => {
|
|
|
50
46
|
href: '#href2',
|
|
51
47
|
media: {
|
|
52
48
|
block: <Illustration name="confetti" alt="" disablePadding />,
|
|
53
|
-
list:
|
|
54
|
-
<Avatar size="md" type="initials">
|
|
55
|
-
HM
|
|
56
|
-
</Avatar>
|
|
57
|
-
),
|
|
49
|
+
list: <AvatarView profileName="Henry Mike" />,
|
|
58
50
|
},
|
|
59
51
|
'aria-label': 'Click here to send money to Hank Miller.',
|
|
60
52
|
title: 'Hank Miller',
|
|
@@ -109,11 +101,7 @@ export const grid = () => {
|
|
|
109
101
|
alt=""
|
|
110
102
|
/>
|
|
111
103
|
),
|
|
112
|
-
list:
|
|
113
|
-
<Avatar size="md" type="initials">
|
|
114
|
-
HM
|
|
115
|
-
</Avatar>
|
|
116
|
-
),
|
|
104
|
+
list: <AvatarView profileName="Henry Mike" />,
|
|
117
105
|
},
|
|
118
106
|
'aria-label': 'Click to see something',
|
|
119
107
|
title: 'Hank Miller',
|
|
@@ -131,11 +119,7 @@ export const grid = () => {
|
|
|
131
119
|
alt=""
|
|
132
120
|
/>
|
|
133
121
|
),
|
|
134
|
-
list:
|
|
135
|
-
<Avatar size="md" type="initials">
|
|
136
|
-
HM
|
|
137
|
-
</Avatar>
|
|
138
|
-
),
|
|
122
|
+
list: <AvatarView profileName="Henry Mike" />,
|
|
139
123
|
},
|
|
140
124
|
'aria-label': 'Click here to send money to Hank Miller.',
|
|
141
125
|
title: 'Hank Miller',
|
|
@@ -152,11 +136,7 @@ export const grid = () => {
|
|
|
152
136
|
alt=""
|
|
153
137
|
/>
|
|
154
138
|
),
|
|
155
|
-
list:
|
|
156
|
-
<Avatar size="md" type="initials">
|
|
157
|
-
HM
|
|
158
|
-
</Avatar>
|
|
159
|
-
),
|
|
139
|
+
list: <AvatarView profileName="Henry Mike" />,
|
|
160
140
|
},
|
|
161
141
|
'aria-label': 'Click here to send money to Hank Miller.',
|
|
162
142
|
disabled,
|
|
@@ -175,11 +155,7 @@ export const grid = () => {
|
|
|
175
155
|
alt=""
|
|
176
156
|
/>
|
|
177
157
|
),
|
|
178
|
-
list:
|
|
179
|
-
<Avatar size="md" type="initials">
|
|
180
|
-
HM
|
|
181
|
-
</Avatar>
|
|
182
|
-
),
|
|
158
|
+
list: <AvatarView profileName="Henry Mike" />,
|
|
183
159
|
},
|
|
184
160
|
'aria-label': 'Click here to send money to Hank Miller.',
|
|
185
161
|
title: 'Hank Miller',
|
|
@@ -197,11 +173,7 @@ export const grid = () => {
|
|
|
197
173
|
alt=""
|
|
198
174
|
/>
|
|
199
175
|
),
|
|
200
|
-
list:
|
|
201
|
-
<Avatar size="md" type="initials">
|
|
202
|
-
HM
|
|
203
|
-
</Avatar>
|
|
204
|
-
),
|
|
176
|
+
list: <AvatarView profileName="Henry Mike" />,
|
|
205
177
|
},
|
|
206
178
|
'aria-label': 'Click here to send money to Hank Miller.',
|
|
207
179
|
title: 'Hank Miller',
|
|
@@ -219,11 +191,7 @@ export const grid = () => {
|
|
|
219
191
|
alt=""
|
|
220
192
|
/>
|
|
221
193
|
),
|
|
222
|
-
list:
|
|
223
|
-
<Avatar size="md" type="initials">
|
|
224
|
-
HM
|
|
225
|
-
</Avatar>
|
|
226
|
-
),
|
|
194
|
+
list: <AvatarView profileName="Henry Mike" />,
|
|
227
195
|
},
|
|
228
196
|
'aria-label': 'Click here to send money to Hank Miller.',
|
|
229
197
|
title: 'Hank Miller',
|
|
@@ -241,11 +209,7 @@ export const grid = () => {
|
|
|
241
209
|
alt=""
|
|
242
210
|
/>
|
|
243
211
|
),
|
|
244
|
-
list:
|
|
245
|
-
<Avatar size="md" type="initials">
|
|
246
|
-
HM
|
|
247
|
-
</Avatar>
|
|
248
|
-
),
|
|
212
|
+
list: <AvatarView profileName="Henry Mike" />,
|
|
249
213
|
},
|
|
250
214
|
'aria-label': 'Click here to send money to Hank Miller.',
|
|
251
215
|
title: 'Hank Miller',
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { Breakpoint
|
|
1
|
+
import AvatarView from '../avatarView';
|
|
2
|
+
import { Breakpoint } from '../common';
|
|
3
3
|
import { mockMatchMedia, render, screen } from '../test-utils';
|
|
4
4
|
|
|
5
5
|
import FlowNavigation from './FlowNavigation';
|
|
@@ -22,11 +22,7 @@ describe('FlowNavigation', () => {
|
|
|
22
22
|
});
|
|
23
23
|
|
|
24
24
|
const props = {
|
|
25
|
-
avatar:
|
|
26
|
-
<Avatar type={AvatarType.INITIALS} size={Size.MEDIUM}>
|
|
27
|
-
TM
|
|
28
|
-
</Avatar>
|
|
29
|
-
),
|
|
25
|
+
avatar: <AvatarView profileName="Tim Mike" />,
|
|
30
26
|
logo: <img alt="logo" src="logo.svg" width="138" height="24" />,
|
|
31
27
|
onClose: jest.fn(),
|
|
32
28
|
steps: [
|
|
@@ -46,10 +46,12 @@ exports[`FlowNavigation on mobile renders as expected 1`] = `
|
|
|
46
46
|
class="np-flow-header__right d-flex align-items-center justify-content-end order-2--lg"
|
|
47
47
|
>
|
|
48
48
|
<div
|
|
49
|
-
class="
|
|
49
|
+
class="np-circle d-flex align-items-center justify-content-center np-avatar-view np-avatar-view-non-interactive"
|
|
50
|
+
style="--circle-size: 48px; --circle-icon-size: 24px; --circle-font-size: 22px;"
|
|
50
51
|
>
|
|
51
52
|
<div
|
|
52
|
-
class="
|
|
53
|
+
class="np-circle np-circle-border d-flex align-items-center justify-content-center np-avatar-view-content"
|
|
54
|
+
style="--circle-size: 48px; --circle-icon-size: 24px; --circle-font-size: 22px;"
|
|
53
55
|
>
|
|
54
56
|
TM
|
|
55
57
|
</div>
|
|
@@ -162,10 +164,12 @@ exports[`FlowNavigation renders as expected 1`] = `
|
|
|
162
164
|
class="np-flow-header__right d-flex align-items-center justify-content-end order-2--lg"
|
|
163
165
|
>
|
|
164
166
|
<div
|
|
165
|
-
class="
|
|
167
|
+
class="np-circle d-flex align-items-center justify-content-center np-avatar-view np-avatar-view-non-interactive"
|
|
168
|
+
style="--circle-size: 48px; --circle-icon-size: 24px; --circle-font-size: 22px;"
|
|
166
169
|
>
|
|
167
170
|
<div
|
|
168
|
-
class="
|
|
171
|
+
class="np-circle np-circle-border d-flex align-items-center justify-content-center np-avatar-view-content"
|
|
172
|
+
style="--circle-size: 48px; --circle-icon-size: 24px; --circle-font-size: 22px;"
|
|
169
173
|
>
|
|
170
174
|
TM
|
|
171
175
|
</div>
|
package/src/link/Link.css
CHANGED
package/src/link/Link.less
CHANGED
package/src/link/Link.spec.tsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { render, screen } from '../test-utils';
|
|
1
|
+
import { render, screen, userEvent } from '../test-utils';
|
|
2
2
|
|
|
3
3
|
import Link from '.';
|
|
4
4
|
|
|
@@ -32,6 +32,37 @@ describe('Link', () => {
|
|
|
32
32
|
expect(link).toHaveAttribute('rel', 'noreferrer');
|
|
33
33
|
});
|
|
34
34
|
|
|
35
|
+
it('renders as link (`a` element) when href and onClick provided', async () => {
|
|
36
|
+
const href = 'wise.com';
|
|
37
|
+
const onClick = jest.fn();
|
|
38
|
+
render(
|
|
39
|
+
<Link href={href} onClick={onClick}>
|
|
40
|
+
link text
|
|
41
|
+
</Link>,
|
|
42
|
+
);
|
|
43
|
+
expect(onClick).toHaveBeenCalledTimes(0);
|
|
44
|
+
|
|
45
|
+
const link = screen.getByText('link text');
|
|
46
|
+
|
|
47
|
+
expect(link).toHaveAttribute('href', href);
|
|
48
|
+
await userEvent.click(link);
|
|
49
|
+
expect(link.tagName).toBe('A');
|
|
50
|
+
expect(onClick).toHaveBeenCalledTimes(1);
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
it('renders as button element when only onClick provided', async () => {
|
|
54
|
+
const onClick = jest.fn();
|
|
55
|
+
// eslint-disable-next-line jsx-a11y/click-events-have-key-events
|
|
56
|
+
render(<Link onClick={onClick}>link text</Link>);
|
|
57
|
+
expect(onClick).toHaveBeenCalledTimes(0);
|
|
58
|
+
|
|
59
|
+
const link = screen.getByText('link text');
|
|
60
|
+
|
|
61
|
+
await userEvent.click(link);
|
|
62
|
+
expect(link.tagName).toBe('BUTTON');
|
|
63
|
+
expect(onClick).toHaveBeenCalledTimes(1);
|
|
64
|
+
});
|
|
65
|
+
|
|
35
66
|
it('renders with the provided aria-label', () => {
|
|
36
67
|
render(
|
|
37
68
|
<Link {...props} aria-label="make me accessible">
|
package/src/link/Link.story.tsx
CHANGED
|
@@ -24,6 +24,18 @@ export const Basic = () => {
|
|
|
24
24
|
<Link type={Typography.LINK_LARGE} target="_blank" className="m-t-3" href="#">
|
|
25
25
|
Large link
|
|
26
26
|
</Link>
|
|
27
|
+
{/* eslint-disable-next-line jsx-a11y/click-events-have-key-events */}
|
|
28
|
+
<Link className="m-t-3" onClick={() => console.log('click link')}>
|
|
29
|
+
button as Link
|
|
30
|
+
</Link>
|
|
31
|
+
{/* eslint-disable-next-line jsx-a11y/click-events-have-key-events */}
|
|
32
|
+
<Link
|
|
33
|
+
className="m-t-3"
|
|
34
|
+
type={Typography.LINK_LARGE}
|
|
35
|
+
onClick={() => console.log('click link')}
|
|
36
|
+
>
|
|
37
|
+
button as Link
|
|
38
|
+
</Link>
|
|
27
39
|
<Title type={Typography.TITLE_SCREEN} className="m-t-3">
|
|
28
40
|
Links via <code>{'<Link />'}</code> component in all types of body copy
|
|
29
41
|
</Title>
|
package/src/link/Link.tsx
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { NavigateAway as NavigateAwayIcon } from '@transferwise/icons';
|
|
2
2
|
import { clsx } from 'clsx';
|
|
3
3
|
import { useIntl } from 'react-intl';
|
|
4
|
-
import { PrimitiveAnchor } from '../primitives';
|
|
5
|
-
import type { PrimitiveAnchorProps } from '../primitives';
|
|
4
|
+
import { PrimitiveAnchor, PrimitiveButton } from '../primitives';
|
|
5
|
+
import type { PrimitiveAnchorProps, PrimitiveButtonProps } from '../primitives';
|
|
6
6
|
|
|
7
|
-
import { LinkLarge, LinkDefault } from '../common';
|
|
7
|
+
import { LinkLarge, LinkDefault, Typography } from '../common';
|
|
8
8
|
|
|
9
9
|
import messages from './Link.messages';
|
|
10
10
|
|
|
11
|
-
export type Props = PrimitiveAnchorProps &
|
|
11
|
+
export type Props = PrimitiveAnchorProps &
|
|
12
|
+
Pick<PrimitiveButtonProps, 'onClick'> & { type?: LinkLarge | LinkDefault };
|
|
12
13
|
|
|
13
14
|
/**
|
|
14
15
|
* Standard Link component with navigate away icon
|
|
@@ -20,12 +21,13 @@ const Link = ({
|
|
|
20
21
|
children,
|
|
21
22
|
href,
|
|
22
23
|
target,
|
|
23
|
-
type,
|
|
24
|
+
type = Typography.LINK_DEFAULT,
|
|
24
25
|
'aria-label': ariaLabel,
|
|
25
26
|
onClick,
|
|
26
27
|
...props
|
|
27
28
|
}: Props) => {
|
|
28
29
|
const { formatMessage } = useIntl();
|
|
30
|
+
const isButton = Boolean(onClick) && href === undefined;
|
|
29
31
|
const isBlank = target === '_blank';
|
|
30
32
|
|
|
31
33
|
const classNames = clsx(
|
|
@@ -37,7 +39,16 @@ const Link = ({
|
|
|
37
39
|
className,
|
|
38
40
|
);
|
|
39
41
|
|
|
40
|
-
return (
|
|
42
|
+
return isButton ? (
|
|
43
|
+
<PrimitiveButton
|
|
44
|
+
type="button"
|
|
45
|
+
aria-label={ariaLabel}
|
|
46
|
+
className={clsx(classNames, 'btn-unstyled', className)}
|
|
47
|
+
onClick={onClick}
|
|
48
|
+
>
|
|
49
|
+
{children}
|
|
50
|
+
</PrimitiveButton>
|
|
51
|
+
) : (
|
|
41
52
|
<PrimitiveAnchor
|
|
42
53
|
href={href}
|
|
43
54
|
target={target}
|
package/src/main.css
CHANGED
|
@@ -34,10 +34,6 @@
|
|
|
34
34
|
margin-left: var(--padding-small);
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
|
-
.tw-date-lookup-calendar > tbody > tr > td.weekend button {
|
|
38
|
-
font-size: 0.875rem;
|
|
39
|
-
font-size: var(--font-size-14);line-height: 155%;letter-spacing: -0.006em;font-weight: 400;font-weight: var(--font-weight-regular);
|
|
40
|
-
}
|
|
41
37
|
@media (min-width: 768px) {
|
|
42
38
|
}
|
|
43
39
|
@media (min-width: 768px) {
|
|
@@ -3106,7 +3102,8 @@ html:not([dir="rtl"]) .np-flow-navigation--sm .np-flow-navigation__stepper {
|
|
|
3106
3102
|
.tw-instructions .instruction .dont {
|
|
3107
3103
|
color: var(--color-sentiment-negative);
|
|
3108
3104
|
}
|
|
3109
|
-
a
|
|
3105
|
+
a,
|
|
3106
|
+
button.np-link {
|
|
3110
3107
|
border-radius: 2px;
|
|
3111
3108
|
}
|
|
3112
3109
|
.np-link .tw-icon {
|
|
@@ -4541,13 +4538,6 @@ html:not([dir="rtl"]) .np-navigation-option {
|
|
|
4541
4538
|
transition: width 0.6s ease-in-out;
|
|
4542
4539
|
will-change: width;
|
|
4543
4540
|
}
|
|
4544
|
-
.btn-unstyled {
|
|
4545
|
-
background: none;
|
|
4546
|
-
border: none;
|
|
4547
|
-
margin: 0;
|
|
4548
|
-
padding: 0;
|
|
4549
|
-
display: block;
|
|
4550
|
-
}
|
|
4551
4541
|
.np-select .np-dropdown-toggle {
|
|
4552
4542
|
background-color: #ffffff;
|
|
4553
4543
|
background-color: var(--color-background-screen);
|
|
@@ -5093,10 +5083,6 @@ html:not([dir="rtl"]) .np-navigation-option {
|
|
|
5093
5083
|
.np-summary__action {
|
|
5094
5084
|
margin-top: 4px;
|
|
5095
5085
|
margin-top: var(--size-4);
|
|
5096
|
-
font-size: 0.875rem;
|
|
5097
|
-
font-size: var(--font-size-14);
|
|
5098
|
-
font-weight: 600;
|
|
5099
|
-
font-weight: var(--font-weight-semi-bold);
|
|
5100
5086
|
}
|
|
5101
5087
|
.np-summary + .np-summary {
|
|
5102
5088
|
margin-top: 24px;
|
|
@@ -7,10 +7,11 @@ import {
|
|
|
7
7
|
PlusCircle,
|
|
8
8
|
Profile,
|
|
9
9
|
UpwardGraph as UpwardGraphIcon,
|
|
10
|
+
FastFlag,
|
|
10
11
|
} from '@transferwise/icons';
|
|
11
12
|
import { Illustration, Assets, Flag } from '@wise/art';
|
|
12
13
|
|
|
13
|
-
import {
|
|
14
|
+
import { Nudge, Header, Title, Typography, AvatarView } from '..';
|
|
14
15
|
|
|
15
16
|
import NavigationOption from './NavigationOption';
|
|
16
17
|
|
|
@@ -85,11 +86,9 @@ export const Variants = () => (
|
|
|
85
86
|
<Template
|
|
86
87
|
showMediaCircle={false}
|
|
87
88
|
media={
|
|
88
|
-
<
|
|
89
|
-
<
|
|
90
|
-
|
|
91
|
-
</Avatar>
|
|
92
|
-
</Badge>
|
|
89
|
+
<AvatarView badge={{ type: 'reference' }}>
|
|
90
|
+
<Profile />
|
|
91
|
+
</AvatarView>
|
|
93
92
|
}
|
|
94
93
|
/>
|
|
95
94
|
</div>
|
|
@@ -98,20 +97,13 @@ export const Variants = () => (
|
|
|
98
97
|
<Template
|
|
99
98
|
showMediaCircle={false}
|
|
100
99
|
media={
|
|
101
|
-
<
|
|
102
|
-
badge={
|
|
103
|
-
<
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
/>
|
|
109
|
-
}
|
|
110
|
-
>
|
|
111
|
-
<Avatar type="initials" size="md">
|
|
112
|
-
<span aria-hidden>SP</span>
|
|
113
|
-
</Avatar>
|
|
114
|
-
</Badge>
|
|
100
|
+
<AvatarView
|
|
101
|
+
badge={{
|
|
102
|
+
icon: <FastFlag />,
|
|
103
|
+
type: 'action',
|
|
104
|
+
}}
|
|
105
|
+
profileName="Spencer Penn"
|
|
106
|
+
/>
|
|
115
107
|
}
|
|
116
108
|
/>
|
|
117
109
|
</div>
|
|
@@ -125,20 +117,13 @@ export const Variants = () => (
|
|
|
125
117
|
<Template
|
|
126
118
|
showMediaCircle
|
|
127
119
|
media={
|
|
128
|
-
<
|
|
129
|
-
badge={
|
|
130
|
-
<
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
/>
|
|
136
|
-
}
|
|
137
|
-
>
|
|
138
|
-
<Avatar type="initials" size="md">
|
|
139
|
-
<span aria-hidden>SP</span>
|
|
140
|
-
</Avatar>
|
|
141
|
-
</Badge>
|
|
120
|
+
<AvatarView
|
|
121
|
+
badge={{
|
|
122
|
+
icon: <FastFlag />,
|
|
123
|
+
type: 'action',
|
|
124
|
+
}}
|
|
125
|
+
profileName="Spencer Penn"
|
|
126
|
+
/>
|
|
142
127
|
}
|
|
143
128
|
/>
|
|
144
129
|
</div>
|
|
@@ -222,9 +207,9 @@ export const BalanceContent = () => (
|
|
|
222
207
|
content="British pound"
|
|
223
208
|
showMediaCircle={false}
|
|
224
209
|
media={
|
|
225
|
-
<
|
|
210
|
+
<AvatarView>
|
|
226
211
|
<Flag code="GBP" />
|
|
227
|
-
</
|
|
212
|
+
</AvatarView>
|
|
228
213
|
}
|
|
229
214
|
/>
|
|
230
215
|
);
|
|
@@ -234,11 +219,9 @@ export const NewContactContent = () => (
|
|
|
234
219
|
title="New Contact"
|
|
235
220
|
showMediaCircle={false}
|
|
236
221
|
media={
|
|
237
|
-
<
|
|
238
|
-
<
|
|
239
|
-
|
|
240
|
-
</Avatar>
|
|
241
|
-
</Badge>
|
|
222
|
+
<AvatarView badge={{ type: 'reference' }}>
|
|
223
|
+
<Profile size="24" />
|
|
224
|
+
</AvatarView>
|
|
242
225
|
}
|
|
243
226
|
/>
|
|
244
227
|
);
|
|
@@ -248,13 +231,7 @@ export const ExistingContactContent = () => (
|
|
|
248
231
|
title="Wise Customer"
|
|
249
232
|
content="EUR account ending in 1111"
|
|
250
233
|
showMediaCircle={false}
|
|
251
|
-
media={
|
|
252
|
-
<Badge badge={<Flag code="EUR" />}>
|
|
253
|
-
<Avatar type="initials" size="md">
|
|
254
|
-
<span aria-hidden>WS</span>
|
|
255
|
-
</Avatar>
|
|
256
|
-
</Badge>
|
|
257
|
-
}
|
|
234
|
+
media={<AvatarView profileName="Walter Smith" badge={{ flagCode: 'EUR' }} />}
|
|
258
235
|
/>
|
|
259
236
|
);
|
|
260
237
|
|
|
@@ -280,9 +257,9 @@ export const ManageAccountContent = () => (
|
|
|
280
257
|
content="View and share your account details to get paid."
|
|
281
258
|
showMediaCircle={false}
|
|
282
259
|
media={
|
|
283
|
-
<
|
|
284
|
-
<BankIcon
|
|
285
|
-
</
|
|
260
|
+
<AvatarView>
|
|
261
|
+
<BankIcon />
|
|
262
|
+
</AvatarView>
|
|
286
263
|
}
|
|
287
264
|
/>
|
|
288
265
|
<NavigationOptionTemplate
|
|
@@ -290,9 +267,9 @@ export const ManageAccountContent = () => (
|
|
|
290
267
|
content="Convert money between your balances at your desired exchange rate."
|
|
291
268
|
showMediaCircle={false}
|
|
292
269
|
media={
|
|
293
|
-
<
|
|
270
|
+
<AvatarView>
|
|
294
271
|
<UpwardGraphIcon size={24} />
|
|
295
|
-
</
|
|
272
|
+
</AvatarView>
|
|
296
273
|
}
|
|
297
274
|
/>
|
|
298
275
|
</>
|
package/src/nudge/Nudge.tsx
CHANGED
|
@@ -6,7 +6,7 @@ import Body from '../body';
|
|
|
6
6
|
import { Typography } from '../common';
|
|
7
7
|
import { CloseButton } from '../common/closeButton';
|
|
8
8
|
import Link from '../link';
|
|
9
|
-
import {
|
|
9
|
+
import type { AlertAction } from '../alert';
|
|
10
10
|
|
|
11
11
|
// WARNING: Changing this will cause nudges to reappear wherever persist nudge is used and privacy team will need to be updated too
|
|
12
12
|
export const STORAGE_NAME = 'dismissedNudges';
|
|
@@ -52,7 +52,7 @@ type BaseProps = {
|
|
|
52
52
|
/** Fired when the user clicks on close button */
|
|
53
53
|
onDismiss?: () => void;
|
|
54
54
|
/** An optional call to action to sit under the main body of the nudge. If your label is short, use aria-label to provide more context */
|
|
55
|
-
action?:
|
|
55
|
+
action?: AlertAction;
|
|
56
56
|
className?: string;
|
|
57
57
|
};
|
|
58
58
|
|
|
@@ -151,6 +151,7 @@ const Nudge = ({
|
|
|
151
151
|
<Body type={Typography.BODY_LARGE} className={clsx('wds-nudge-body')}>
|
|
152
152
|
{title}
|
|
153
153
|
</Body>
|
|
154
|
+
{/* Merge these two Link instances into one */}
|
|
154
155
|
{link && (
|
|
155
156
|
<Link
|
|
156
157
|
href={href}
|
|
@@ -161,7 +162,18 @@ const Nudge = ({
|
|
|
161
162
|
{link}
|
|
162
163
|
</Link>
|
|
163
164
|
)}
|
|
164
|
-
{action &&
|
|
165
|
+
{action && (
|
|
166
|
+
<Link
|
|
167
|
+
href={action.href}
|
|
168
|
+
target={action.target}
|
|
169
|
+
className="m-t-1"
|
|
170
|
+
aria-label={action['aria-label']}
|
|
171
|
+
type={Typography.LINK_LARGE}
|
|
172
|
+
onClick={action.onClick}
|
|
173
|
+
>
|
|
174
|
+
{action.text}
|
|
175
|
+
</Link>
|
|
176
|
+
)}
|
|
165
177
|
</div>
|
|
166
178
|
{onDismiss || persistDismissal ? (
|
|
167
179
|
<CloseButton className="wds-nudge-control" size="sm" onClick={handleOnDismiss} />
|
|
@@ -1,16 +1,13 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { Size } from '../common';
|
|
3
|
-
import { render } from '../test-utils';
|
|
1
|
+
import { render, mockMatchMedia } from '../test-utils';
|
|
4
2
|
|
|
5
3
|
import OverlayHeader from '.';
|
|
4
|
+
import AvatarView from '../avatarView';
|
|
5
|
+
|
|
6
|
+
mockMatchMedia();
|
|
6
7
|
|
|
7
8
|
describe('OverlayHeader', () => {
|
|
8
9
|
const props = {
|
|
9
|
-
avatar:
|
|
10
|
-
<Avatar type={AvatarType.INITIALS} size={Size.MEDIUM}>
|
|
11
|
-
TM
|
|
12
|
-
</Avatar>
|
|
13
|
-
),
|
|
10
|
+
avatar: <AvatarView profileName="Tim Morris" />,
|
|
14
11
|
logo: <img alt="logo_desktop" src="img_desktop" width="138" height="24" />,
|
|
15
12
|
onClose: jest.fn(),
|
|
16
13
|
};
|
|
@@ -18,10 +18,12 @@ exports[`OverlayHeader renders as expected 1`] = `
|
|
|
18
18
|
class="d-flex align-items-center order-2"
|
|
19
19
|
>
|
|
20
20
|
<div
|
|
21
|
-
class="
|
|
21
|
+
class="np-circle d-flex align-items-center justify-content-center np-avatar-view np-avatar-view-non-interactive"
|
|
22
|
+
style="--circle-size: 48px; --circle-icon-size: 24px; --circle-font-size: 22px;"
|
|
22
23
|
>
|
|
23
24
|
<div
|
|
24
|
-
class="
|
|
25
|
+
class="np-circle np-circle-border d-flex align-items-center justify-content-center np-avatar-view-content"
|
|
26
|
+
style="--circle-size: 48px; --circle-icon-size: 24px; --circle-font-size: 22px;"
|
|
25
27
|
>
|
|
26
28
|
TM
|
|
27
29
|
</div>
|