@transferwise/components 45.14.1 → 45.14.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.
@@ -1 +1 @@
1
- {"version":3,"file":"Link.d.ts","sourceRoot":"","sources":["../../../src/link/Link.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,oBAAoB,EAAE,MAAM,OAAO,CAAC;AAE7C,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAEnD,MAAM,MAAM,KAAK,GAAG,oBAAoB,CAAC,iBAAiB,CAAC,GAAG;IAAE,IAAI,CAAC,EAAE,SAAS,GAAG,WAAW,CAAA;CAAE,CAAC;AAEjG;;;;GAIG;AACH,QAAA,MAAM,IAAI,4FASP,KAAK,gCAsBP,CAAC;AAEF,eAAe,IAAI,CAAC"}
1
+ {"version":3,"file":"Link.d.ts","sourceRoot":"","sources":["../../../src/link/Link.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,oBAAoB,EAAE,MAAM,OAAO,CAAC;AAG7C,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAInD,MAAM,MAAM,KAAK,GAAG,oBAAoB,CAAC,iBAAiB,CAAC,GAAG;IAAE,IAAI,CAAC,EAAE,SAAS,GAAG,WAAW,CAAA;CAAE,CAAC;AAEjG;;;;GAIG;AACH,QAAA,MAAM,IAAI,4FASP,KAAK,gCAuBP,CAAC;AAEF,eAAe,IAAI,CAAC"}
@@ -0,0 +1,8 @@
1
+ declare const _default: {
2
+ opensInNewTab: {
3
+ id: string;
4
+ defaultMessage: string;
5
+ };
6
+ };
7
+ export default _default;
8
+ //# sourceMappingURL=Link.messages.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Link.messages.d.ts","sourceRoot":"","sources":["../../../src/link/Link.messages.ts"],"names":[],"mappings":";;;;;;AAEA,wBAKG"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@transferwise/components",
3
- "version": "45.14.1",
3
+ "version": "45.14.2",
4
4
  "description": "Neptune React components",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -62,7 +62,7 @@
62
62
  "@types/react-dom": "^17.0.20",
63
63
  "@types/react-transition-group": "4.4.5",
64
64
  "@types/testing-library__jest-dom": "^5.14.5",
65
- "@wise/art": "^2.0.1",
65
+ "@wise/art": "^2.7.0",
66
66
  "@wojtekmaj/enzyme-adapter-react-17": "^0.6.3",
67
67
  "babel-plugin-formatjs": "^10.5.3",
68
68
  "babel-plugin-inline-react-svg": "^2.0.2",
@@ -77,7 +77,7 @@
77
77
  "rollup": "^3.28.1",
78
78
  "storybook": "^7.0.6",
79
79
  "@transferwise/less-config": "3.0.6",
80
- "@transferwise/neptune-css": "14.5.2",
80
+ "@transferwise/neptune-css": "14.6.0",
81
81
  "@wise/components-theming": "0.8.4"
82
82
  },
83
83
  "peerDependencies": {
@@ -1,5 +1,6 @@
1
1
  import { Meta, StoryObj } from '@storybook/react';
2
2
  import * as wiseIcons from '@transferwise/icons';
3
+ import { Flag } from '@wise/art';
3
4
 
4
5
  import { Size } from '../common';
5
6
  import { storyConfig } from '../test-utils';
@@ -22,10 +23,11 @@ export const Emoji: Story = {
22
23
  },
23
24
  };
24
25
 
25
- export const Flag: Story = {
26
+ export const FlagStory: Story = {
27
+ name: 'Flag',
26
28
  render: (args) => (
27
29
  <Avatar {...args}>
28
- <img src="https://wise.com/web-art/assets/flags/gbp.svg" alt="" />
30
+ <Flag code="GBP" />
29
31
  </Avatar>
30
32
  ),
31
33
  args: {
@@ -38,8 +40,8 @@ export const Flag: Story = {
38
40
  export const Table: Story = storyConfig(
39
41
  {
40
42
  render: () => {
41
- const flagResourceJpy = 'https://wise.com/web-art/assets/flags/jpy.svg';
42
- const flagResourceGbp = 'https://wise.com/web-art/assets/flags/gbp.svg';
43
+ const flagJPY = <Flag code="JPY" />;
44
+ const flagGBP = <Flag code="GBP" />;
43
45
  const backgroundColor = '#d6f5e3';
44
46
  const emoji = '✈️';
45
47
  const initials = 'GN';
@@ -52,27 +54,27 @@ export const Table: Story = storyConfig(
52
54
  <tr>
53
55
  <td>
54
56
  <Avatar size={Size.LARGE} type={AvatarType.THUMBNAIL} outlined>
55
- <img src={flagResourceJpy} alt="" />
57
+ {flagJPY}
56
58
  </Avatar>
57
59
  </td>
58
60
  <td>
59
61
  <Avatar size={56} type={AvatarType.THUMBNAIL} outlined>
60
- <img src={flagResourceJpy} alt="" />
62
+ {flagJPY}
61
63
  </Avatar>
62
64
  </td>
63
65
  <td>
64
66
  <Avatar size={Size.MEDIUM} type={AvatarType.THUMBNAIL} outlined>
65
- <img src={flagResourceJpy} alt="" />
67
+ {flagJPY}
66
68
  </Avatar>
67
69
  </td>
68
70
  <td>
69
71
  <Avatar size={40} type={AvatarType.THUMBNAIL} outlined>
70
- <img src={flagResourceJpy} alt="" />
72
+ {flagJPY}
71
73
  </Avatar>
72
74
  </td>
73
75
  <td>
74
76
  <Avatar size={Size.SMALL} type={AvatarType.THUMBNAIL} outlined>
75
- <img src={flagResourceJpy} alt="" />
77
+ {flagJPY}
76
78
  </Avatar>
77
79
  </td>
78
80
  </tr>
@@ -80,27 +82,27 @@ export const Table: Story = storyConfig(
80
82
  <tr>
81
83
  <td>
82
84
  <Avatar size={Size.LARGE} type={AvatarType.THUMBNAIL}>
83
- <img src={flagResourceGbp} alt="" />
85
+ {flagGBP}
84
86
  </Avatar>
85
87
  </td>
86
88
  <td>
87
89
  <Avatar size={56} type={AvatarType.THUMBNAIL}>
88
- <img src={flagResourceGbp} alt="" />
90
+ {flagGBP}
89
91
  </Avatar>
90
92
  </td>
91
93
  <td>
92
94
  <Avatar size={Size.MEDIUM} type={AvatarType.THUMBNAIL}>
93
- <img src={flagResourceGbp} alt="" />
95
+ {flagGBP}
94
96
  </Avatar>
95
97
  </td>
96
98
  <td>
97
99
  <Avatar size={40} type={AvatarType.THUMBNAIL}>
98
- <img src={flagResourceGbp} alt="" />
100
+ {flagGBP}
99
101
  </Avatar>
100
102
  </td>
101
103
  <td>
102
104
  <Avatar size={Size.SMALL} type={AvatarType.THUMBNAIL}>
103
- <img src={flagResourceGbp} alt="" />
105
+ {flagGBP}
104
106
  </Avatar>
105
107
  </td>
106
108
  </tr>
@@ -0,0 +1,8 @@
1
+ import { defineMessages } from 'react-intl';
2
+
3
+ export default defineMessages({
4
+ opensInNewTab: {
5
+ id: 'neptune.Link.opensInNewTab',
6
+ defaultMessage: '(opens in new tab)',
7
+ },
8
+ });
package/src/link/Link.tsx CHANGED
@@ -1,9 +1,12 @@
1
1
  import { NavigateAway as NavigateAwayIcon } from '@transferwise/icons';
2
2
  import classNames from 'classnames';
3
3
  import { AnchorHTMLAttributes } from 'react';
4
+ import { useIntl } from 'react-intl';
4
5
 
5
6
  import { LinkLarge, LinkDefault } from '../common';
6
7
 
8
+ import messages from './Link.messages';
9
+
7
10
  export type Props = AnchorHTMLAttributes<HTMLAnchorElement> & { type?: LinkLarge | LinkDefault };
8
11
 
9
12
  /**
@@ -23,6 +26,8 @@ const Link = ({
23
26
  }: Props) => {
24
27
  const isBlank = target === '_blank';
25
28
 
29
+ const { formatMessage } = useIntl();
30
+
26
31
  return (
27
32
  <a
28
33
  href={href}
@@ -38,8 +43,7 @@ const Link = ({
38
43
  onClick={onClick}
39
44
  {...props}
40
45
  >
41
- {children}
42
- {isBlank && <NavigateAwayIcon />}
46
+ {children} {isBlank && <NavigateAwayIcon title={formatMessage(messages.opensInNewTab)} />}
43
47
  </a>
44
48
  );
45
49
  };
@@ -7,7 +7,7 @@ import {
7
7
  Profile,
8
8
  UpwardGraph as UpwardGraphIcon,
9
9
  } from '@transferwise/icons';
10
- import { Illustration, Assets } from '@wise/art';
10
+ import { Illustration, Assets, Flag } from '@wise/art';
11
11
 
12
12
  import { Badge, Nudge, Avatar, Header } from '..';
13
13
 
@@ -203,7 +203,7 @@ export const BalanceContent = () => (
203
203
  showMediaCircle={false}
204
204
  media={
205
205
  <Avatar type="icon">
206
- <img src="https://wise.com/web-art/assets/flags/gbp.svg" alt="" />
206
+ <Flag code="GBP" />
207
207
  </Avatar>
208
208
  }
209
209
  />
@@ -229,9 +229,7 @@ export const ExistingContactContent = () => (
229
229
  content="EUR account ending in 1111"
230
230
  showMediaCircle={false}
231
231
  media={
232
- <Badge
233
- badge={<img src="https://wise.com/public-resources/assets/flags/square/eur.svg" alt="" />}
234
- >
232
+ <Badge badge={<Flag code="EUR" />}>
235
233
  <Avatar type="initials" size="md">
236
234
  <span aria-hidden>WS</span>
237
235
  </Avatar>
@@ -1,5 +1,6 @@
1
1
  import { boolean, text } from '@storybook/addon-knobs';
2
2
  import { Check } from '@transferwise/icons';
3
+ import { Flag } from '@wise/art';
3
4
  import { useState } from 'react';
4
5
 
5
6
  import Avatar, { AvatarType } from '../avatar';
@@ -33,7 +34,7 @@ export const Basic = () => {
33
34
  avatar={
34
35
  showAvatar ? (
35
36
  <Avatar type={AvatarType.THUMBNAIL}>
36
- <img src="https://wise.com/web-art/assets/flags/imp.svg" alt="" />
37
+ <Flag code="IMP" />
37
38
  </Avatar>
38
39
  ) : null
39
40
  }
@@ -51,7 +52,7 @@ export const Basic = () => {
51
52
  avatar={
52
53
  showAvatar ? (
53
54
  <Avatar type={AvatarType.THUMBNAIL}>
54
- <img src="https://wise.com/web-art/assets/flags/kes.svg" alt="" />
55
+ <Flag code="KES" />
55
56
  </Avatar>
56
57
  ) : null
57
58
  }
@@ -1,5 +1,6 @@
1
1
  import { action } from '@storybook/addon-actions';
2
2
  import { boolean } from '@storybook/addon-knobs';
3
+ import { Flag } from '@wise/art';
3
4
 
4
5
  import Avatar, { AvatarType } from '../avatar';
5
6
 
@@ -16,7 +17,7 @@ export const Basic = () => {
16
17
 
17
18
  const avatar = showAvatars ? (
18
19
  <Avatar type={AvatarType.THUMBNAIL}>
19
- <img src="https://wise.com/web-art/assets/flags/nzd.svg" alt="" />
20
+ <Flag code="NZD" />
20
21
  </Avatar>
21
22
  ) : undefined;
22
23