@transferwise/components 0.0.0-experimental-fb37b6d → 0.0.0-experimental-ad7e2f8
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/header/Header.js +34 -77
- package/build/header/Header.js.map +1 -1
- package/build/header/Header.mjs +31 -73
- package/build/header/Header.mjs.map +1 -1
- package/build/index.js +1 -1
- package/build/index.mjs +1 -1
- package/build/link/Link.js +3 -5
- package/build/link/Link.js.map +1 -1
- package/build/link/Link.mjs +3 -5
- package/build/link/Link.mjs.map +1 -1
- package/build/main.css +0 -3
- package/build/selectOption/SelectOption.js +1 -1
- package/build/selectOption/SelectOption.js.map +1 -1
- package/build/selectOption/SelectOption.mjs +1 -1
- package/build/styles/header/Header.css +0 -3
- package/build/styles/main.css +0 -3
- package/build/typeahead/util/highlight.js +4 -2
- package/build/typeahead/util/highlight.js.map +1 -1
- package/build/typeahead/util/highlight.mjs +5 -3
- package/build/typeahead/util/highlight.mjs.map +1 -1
- package/build/types/header/Header.d.ts +10 -43
- package/build/types/header/Header.d.ts.map +1 -1
- package/build/types/header/index.d.ts +0 -1
- package/build/types/header/index.d.ts.map +1 -1
- package/build/types/index.d.ts +0 -1
- package/build/types/index.d.ts.map +1 -1
- package/build/types/link/Link.d.ts +1 -3
- package/build/types/link/Link.d.ts.map +1 -1
- package/build/types/typeahead/util/highlight.d.ts +1 -1
- package/build/types/typeahead/util/highlight.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/header/Header.css +0 -3
- package/src/header/Header.less +0 -4
- package/src/header/Header.spec.tsx +0 -7
- package/src/header/Header.story.tsx +40 -62
- package/src/header/Header.tsx +59 -123
- package/src/header/index.ts +0 -1
- package/src/index.ts +0 -1
- package/src/link/Link.tsx +27 -29
- package/src/main.css +0 -3
- package/src/typeahead/typeaheadOption/TypeaheadOption.spec.js +1 -1
- package/src/typeahead/util/highlight.spec.js +1 -1
- package/src/typeahead/util/highlight.tsx +3 -3
package/src/link/Link.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { NavigateAway as NavigateAwayIcon } from '@transferwise/icons';
|
|
2
2
|
import { clsx } from 'clsx';
|
|
3
|
-
import { AnchorHTMLAttributes
|
|
3
|
+
import { AnchorHTMLAttributes } from 'react';
|
|
4
4
|
import { useIntl } from 'react-intl';
|
|
5
5
|
|
|
6
6
|
import { LinkLarge, LinkDefault } from '../common';
|
|
@@ -14,35 +14,33 @@ export type Props = AnchorHTMLAttributes<HTMLAnchorElement> & { type?: LinkLarge
|
|
|
14
14
|
*
|
|
15
15
|
* Documentation: https://transferwise.github.io/neptune-web/components/content/Link
|
|
16
16
|
*/
|
|
17
|
-
const Link =
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
17
|
+
const Link = ({
|
|
18
|
+
className,
|
|
19
|
+
children,
|
|
20
|
+
href,
|
|
21
|
+
target,
|
|
22
|
+
type,
|
|
23
|
+
'aria-label': ariaLabel,
|
|
24
|
+
onClick,
|
|
25
|
+
...props
|
|
26
|
+
}: Props) => {
|
|
27
|
+
const isBlank = target === '_blank';
|
|
23
28
|
|
|
24
|
-
|
|
29
|
+
const { formatMessage } = useIntl();
|
|
25
30
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
{...props}
|
|
41
|
-
>
|
|
42
|
-
{children} {isBlank && <NavigateAwayIcon title={formatMessage(messages.opensInNewTab)} />}
|
|
43
|
-
</a>
|
|
44
|
-
);
|
|
45
|
-
},
|
|
46
|
-
);
|
|
31
|
+
return (
|
|
32
|
+
<a
|
|
33
|
+
href={href}
|
|
34
|
+
target={target}
|
|
35
|
+
className={clsx('np-link', type ? `np-text-${type}` : undefined, 'd-inline-flex', className)}
|
|
36
|
+
aria-label={ariaLabel}
|
|
37
|
+
rel={isBlank ? 'noreferrer' : undefined}
|
|
38
|
+
onClick={onClick}
|
|
39
|
+
{...props}
|
|
40
|
+
>
|
|
41
|
+
{children} {isBlank && <NavigateAwayIcon title={formatMessage(messages.opensInNewTab)} />}
|
|
42
|
+
</a>
|
|
43
|
+
);
|
|
44
|
+
};
|
|
47
45
|
|
|
48
46
|
export default Link;
|
package/src/main.css
CHANGED
|
@@ -2242,9 +2242,6 @@ html:not([dir="rtl"]) .np-flow-navigation--sm .np-flow-navigation__stepper {
|
|
|
2242
2242
|
-moz-column-gap: var(--size-24);
|
|
2243
2243
|
column-gap: var(--size-24);
|
|
2244
2244
|
}
|
|
2245
|
-
.np-header--section {
|
|
2246
|
-
border-bottom: none;
|
|
2247
|
-
}
|
|
2248
2245
|
.np-header__title {
|
|
2249
2246
|
color: #5d7079;
|
|
2250
2247
|
color: var(--color-content-secondary);
|
|
@@ -8,7 +8,7 @@ describe('Typeahead Option', () => {
|
|
|
8
8
|
let props;
|
|
9
9
|
let component;
|
|
10
10
|
|
|
11
|
-
const labelSpan = () => component.find('span
|
|
11
|
+
const labelSpan = () => component.find('span > span');
|
|
12
12
|
const noteSpan = () => component.find('.np-text-body-default.m-l-1');
|
|
13
13
|
const secondaryTextSpan = () => component.find('.np-text-body-default.text-ellipsis');
|
|
14
14
|
const dropdownItem = () => component.find('.dropdown-item');
|
|
@@ -21,7 +21,7 @@ describe('Typeahead input', () => {
|
|
|
21
21
|
const label = `this is a label`;
|
|
22
22
|
const result = highlight(label, query);
|
|
23
23
|
|
|
24
|
-
expect(result).
|
|
24
|
+
expect(result).toStrictEqual(<span>{label}</span>);
|
|
25
25
|
});
|
|
26
26
|
|
|
27
27
|
it('highlights whole label that matches the query', () => {
|
|
@@ -4,13 +4,13 @@ export default function highlight(value: string, query: string) {
|
|
|
4
4
|
const highlightEnd = highlightStart + query.trim().length;
|
|
5
5
|
if (highlightStart !== -1) {
|
|
6
6
|
return (
|
|
7
|
-
|
|
7
|
+
<span>
|
|
8
8
|
{value.slice(0, Math.max(0, highlightStart))}
|
|
9
9
|
<strong>{value.slice(highlightStart, highlightEnd)}</strong>
|
|
10
10
|
{value.slice(Math.max(0, highlightEnd))}
|
|
11
|
-
|
|
11
|
+
</span>
|
|
12
12
|
);
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
|
-
return value
|
|
15
|
+
return <span>{value}</span>;
|
|
16
16
|
}
|