@transferwise/components 0.0.0-experimental-b2dc1ea → 0.0.0-experimental-4c86474
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/divider/Divider.js +33 -0
- package/build/divider/Divider.js.map +1 -0
- package/build/divider/Divider.mjs +31 -0
- package/build/divider/Divider.mjs.map +1 -0
- package/build/header/Header.js +34 -89
- package/build/header/Header.js.map +1 -1
- package/build/header/Header.mjs +31 -85
- package/build/header/Header.mjs.map +1 -1
- package/build/index.js +3 -1
- package/build/index.js.map +1 -1
- package/build/index.mjs +2 -1
- package/build/index.mjs.map +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 +24 -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/divider/Divider.css +24 -0
- package/build/styles/header/Header.css +0 -3
- package/build/styles/main.css +24 -3
- package/build/title/Title.js +3 -6
- package/build/title/Title.js.map +1 -1
- package/build/title/Title.mjs +3 -6
- package/build/title/Title.mjs.map +1 -1
- package/build/types/divider/Divider.d.ts +42 -0
- package/build/types/divider/Divider.d.ts.map +1 -0
- package/build/types/divider/index.d.ts +3 -0
- package/build/types/divider/index.d.ts.map +1 -0
- package/build/types/header/Header.d.ts +10 -34
- 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 +2 -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/title/Title.d.ts +4 -3
- package/build/types/title/Title.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/divider/Divider.css +24 -0
- package/src/divider/Divider.less +31 -0
- package/src/divider/Divider.spec.tsx +85 -0
- package/src/divider/Divider.story.tsx +29 -0
- package/src/divider/Divider.tsx +72 -0
- package/src/divider/index.ts +2 -0
- package/src/header/Header.css +0 -3
- package/src/header/Header.less +0 -4
- package/src/header/Header.spec.tsx +0 -33
- package/src/header/Header.story.tsx +40 -54
- package/src/header/Header.tsx +60 -126
- package/src/header/index.ts +0 -1
- package/src/index.ts +2 -1
- package/src/link/Link.tsx +27 -29
- package/src/main.css +24 -3
- package/src/main.less +1 -0
- package/src/ssr.spec.js +1 -0
- package/src/title/Title.tsx +11 -25
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
|
@@ -2038,6 +2038,30 @@ button.np-option {
|
|
|
2038
2038
|
padding: var(--size-24);
|
|
2039
2039
|
}
|
|
2040
2040
|
}
|
|
2041
|
+
.wds-Divider {
|
|
2042
|
+
--Divider-border-width: var(--size-4);
|
|
2043
|
+
--Divider-border-color: var(--color-border-neutral);
|
|
2044
|
+
--Divider-border-style: solid;
|
|
2045
|
+
--Divider-dash-length: var(--size-4);
|
|
2046
|
+
--Divider-dash-spacing: var(--size-4);
|
|
2047
|
+
border-top: 4px solid rgba(0,0,0,0.10196);
|
|
2048
|
+
border-top: var(--Divider-border-width) var(--Divider-border-style) var(--Divider-border-color);
|
|
2049
|
+
display: inline-block;
|
|
2050
|
+
margin: 0;
|
|
2051
|
+
padding: 0;
|
|
2052
|
+
height: 4px;
|
|
2053
|
+
height: var(--Divider-border-width);
|
|
2054
|
+
width: 100%;
|
|
2055
|
+
}
|
|
2056
|
+
.wds-Divider--content {
|
|
2057
|
+
border-top: none;
|
|
2058
|
+
background: repeating-linear-gradient(to right, var(--Divider-border-color), var(--Divider-border-color) var(--Divider-dash-length), transparent var(--Divider-dash-length), transparent calc(var(--Divider-dash-length) + var(--Divider-dash-spacing)));
|
|
2059
|
+
height: var(--Divider-border-width);
|
|
2060
|
+
}
|
|
2061
|
+
.wds-Divider--content,
|
|
2062
|
+
.wds-Divider--subsection {
|
|
2063
|
+
--Divider-border-width: 1px;
|
|
2064
|
+
}
|
|
2041
2065
|
.np-dropfade,
|
|
2042
2066
|
.np-dropfade-enter {
|
|
2043
2067
|
opacity: 0;
|
|
@@ -2242,9 +2266,6 @@ html:not([dir="rtl"]) .np-flow-navigation--sm .np-flow-navigation__stepper {
|
|
|
2242
2266
|
-moz-column-gap: var(--size-24);
|
|
2243
2267
|
column-gap: var(--size-24);
|
|
2244
2268
|
}
|
|
2245
|
-
.np-header--section {
|
|
2246
|
-
border-bottom: none;
|
|
2247
|
-
}
|
|
2248
2269
|
.np-header__title {
|
|
2249
2270
|
color: #5d7079;
|
|
2250
2271
|
color: var(--color-content-secondary);
|
package/src/main.less
CHANGED
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
@import "./definitionList/DefinitionList.less";
|
|
24
24
|
@import "./dimmer/Dimmer.less";
|
|
25
25
|
@import "./drawer/Drawer.less";
|
|
26
|
+
@import "./divider/Divider.less";
|
|
26
27
|
@import "./dropFade/DropFade.less";
|
|
27
28
|
@import "./emphasis/Emphasis.less";
|
|
28
29
|
@import "./flowNavigation/animatedLabel/AnimatedLabel.less";
|
package/src/ssr.spec.js
CHANGED
|
@@ -178,6 +178,7 @@ describe('Server side rendering', () => {
|
|
|
178
178
|
// Override props in case of name collision.
|
|
179
179
|
const overrideProps = {
|
|
180
180
|
Alert: { children: undefined, message: 'Fluffy kittens', size: undefined },
|
|
181
|
+
Divider: { children: undefined },
|
|
181
182
|
Card: { isExpanded: true },
|
|
182
183
|
CheckboxButton: { children: undefined, onChange: jest.fn() },
|
|
183
184
|
Typeahead: { size: 'md' },
|
package/src/title/Title.tsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { clsx } from 'clsx';
|
|
2
|
-
import {
|
|
2
|
+
import { LabelHTMLAttributes, LiHTMLAttributes, ReactHTML } from 'react';
|
|
3
3
|
|
|
4
4
|
import { TitleTypes, Typography, Heading } from '../common';
|
|
5
5
|
|
|
@@ -25,29 +25,15 @@ type Props = LabelHTMLAttributes<HTMLHeadingElement | HTMLSpanElement | HTMLLabe
|
|
|
25
25
|
type?: TitleTypes;
|
|
26
26
|
};
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
className={clsx(`np-text-${type}`, className)}
|
|
39
|
-
/>
|
|
40
|
-
);
|
|
41
|
-
}
|
|
42
|
-
const HeaderTag = as ?? titleTypeMapping[DEFAULT_TYPE];
|
|
43
|
-
return (
|
|
44
|
-
<HeaderTag
|
|
45
|
-
ref={ref as React.Ref<any>}
|
|
46
|
-
{...props}
|
|
47
|
-
className={clsx(`np-text-${DEFAULT_TYPE}`, className)}
|
|
48
|
-
/>
|
|
49
|
-
);
|
|
50
|
-
},
|
|
51
|
-
);
|
|
28
|
+
function Title({ as, type = DEFAULT_TYPE, className, ...props }: Props) {
|
|
29
|
+
const mapping = titleTypeMapping[type];
|
|
30
|
+
const isTypeSupported = mapping !== undefined;
|
|
31
|
+
if (isTypeSupported) {
|
|
32
|
+
const HeaderTag = as ?? mapping;
|
|
33
|
+
return <HeaderTag {...props} className={clsx(`np-text-${type}`, className)} />;
|
|
34
|
+
}
|
|
35
|
+
const HeaderTag = as ?? titleTypeMapping[DEFAULT_TYPE];
|
|
36
|
+
return <HeaderTag {...props} className={clsx(`np-text-${DEFAULT_TYPE}`, className)} />;
|
|
37
|
+
}
|
|
52
38
|
|
|
53
39
|
export default Title;
|