@transferwise/components 0.0.0-experimental-fdcd4f0 → 0.0.0-experimental-3f14884

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,gCA6BP,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": "0.0.0-experimental-fdcd4f0",
3
+ "version": "0.0.0-experimental-3f14884",
4
4
  "description": "Neptune React components",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -77,12 +77,12 @@
77
77
  "rollup": "^3.28.1",
78
78
  "storybook": "^7.0.6",
79
79
  "@transferwise/less-config": "3.0.6",
80
- "@transferwise/neptune-css": "0.0.0-experimental-fdcd4f0",
80
+ "@transferwise/neptune-css": "0.0.0-experimental-3f14884",
81
81
  "@wise/components-theming": "0.8.4"
82
82
  },
83
83
  "peerDependencies": {
84
84
  "@transferwise/icons": "^3.7.0",
85
- "@transferwise/neptune-css": "0.0.0-experimental-fdcd4f0",
85
+ "@transferwise/neptune-css": "0.0.0-experimental-3f14884",
86
86
  "@wise/art": "^2",
87
87
  "@wise/components-theming": "^0.8.4",
88
88
  "currency-flags": "^4.0.2",
package/src/i18n/en.json CHANGED
@@ -5,6 +5,7 @@
5
5
  "neptune.DateInput.day.label": "Day",
6
6
  "neptune.DateInput.month.label": "Month",
7
7
  "neptune.DateInput.year.label": "Year",
8
+ "neptune.Link.opensInNewTab": "(opens in new tab)",
8
9
  "neptune.MoneyInput.Select.placeholder": "Select an option...",
9
10
  "neptune.Select.searchPlaceholder": "Search...",
10
11
  "neptune.Summary.statusDone": "Item done",
@@ -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,13 @@ const Link = ({
38
43
  onClick={onClick}
39
44
  {...props}
40
45
  >
41
- {children}
42
- {isBlank && <NavigateAwayIcon />}
46
+ {children}{' '}
47
+ {isBlank && (
48
+ <>
49
+ <span className="sr-only">{formatMessage(messages.opensInNewTab)}</span>
50
+ <NavigateAwayIcon />
51
+ </>
52
+ )}
43
53
  </a>
44
54
  );
45
55
  };