@transferwise/components 0.0.0-experimental-d11e9c5 → 0.0.0-experimental-76bb7cd
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/avatar/Avatar.js +0 -3
- package/build/avatar/Avatar.js.map +1 -1
- package/build/avatar/Avatar.mjs +0 -3
- package/build/avatar/Avatar.mjs.map +1 -1
- package/build/avatarWrapper/AvatarWrapper.js +4 -10
- package/build/avatarWrapper/AvatarWrapper.js.map +1 -1
- package/build/avatarWrapper/AvatarWrapper.mjs +4 -10
- package/build/avatarWrapper/AvatarWrapper.mjs.map +1 -1
- package/build/badge/Badge.js +1 -3
- package/build/badge/Badge.js.map +1 -1
- package/build/badge/Badge.mjs +1 -3
- package/build/badge/Badge.mjs.map +1 -1
- package/build/button/Button.js.map +1 -1
- package/build/button/Button.mjs.map +1 -1
- package/build/button/legacyUtils/legacyUtils.js.map +1 -1
- package/build/button/legacyUtils/legacyUtils.mjs.map +1 -1
- package/build/common/circle/Circle.js +1 -17
- package/build/common/circle/Circle.js.map +1 -1
- package/build/common/circle/Circle.mjs +1 -17
- package/build/common/circle/Circle.mjs.map +1 -1
- package/build/index.js +121 -128
- package/build/index.js.map +1 -1
- package/build/index.mjs +29 -33
- package/build/index.mjs.map +1 -1
- package/build/main.css +5 -109
- package/build/styles/badge/Badge.css +5 -6
- package/build/styles/common/circle/Circle.css +0 -32
- package/build/styles/main.css +5 -109
- package/build/types/avatar/Avatar.d.ts +0 -3
- package/build/types/avatar/Avatar.d.ts.map +1 -1
- package/build/types/avatarWrapper/AvatarWrapper.d.ts +0 -3
- package/build/types/avatarWrapper/AvatarWrapper.d.ts.map +1 -1
- package/build/types/badge/Badge.d.ts +1 -5
- package/build/types/badge/Badge.d.ts.map +1 -1
- package/build/types/badge/index.d.ts +0 -2
- package/build/types/badge/index.d.ts.map +1 -1
- package/build/types/button/Button.d.ts +1 -1
- package/build/types/button/Button.d.ts.map +1 -1
- package/build/types/button/legacyUtils/legacyUtils.d.ts +2 -2
- package/build/types/button/legacyUtils/legacyUtils.d.ts.map +1 -1
- package/build/types/common/circle/Circle.d.ts +0 -2
- package/build/types/common/circle/Circle.d.ts.map +1 -1
- package/build/types/index.d.ts +1 -3
- package/build/types/index.d.ts.map +1 -1
- package/build/types/test-utils/index.d.ts +158 -0
- package/build/types/test-utils/index.d.ts.map +1 -0
- package/build/types/test-utils/jest.setup.d.ts +2 -0
- package/build/types/test-utils/jest.setup.d.ts.map +1 -0
- package/package.json +4 -3
- package/src/avatar/Avatar.tsx +0 -3
- package/src/avatarWrapper/AvatarWrapper.tsx +0 -3
- package/src/badge/Badge.css +5 -6
- package/src/badge/Badge.less +3 -4
- package/src/badge/Badge.tsx +1 -8
- package/src/badge/index.ts +0 -3
- package/src/button/{Button.spec.js → Button.spec.tsx} +3 -2
- package/src/button/Button.tsx +1 -1
- package/src/button/legacyUtils/{legacyUtils.spec.js → legacyUtils.spec.tsx} +1 -1
- package/src/button/legacyUtils/legacyUtils.ts +2 -2
- package/src/common/circle/Circle.css +0 -32
- package/src/common/circle/Circle.less +0 -35
- package/src/common/circle/Circle.tsx +1 -22
- package/src/decision/Decision.story.tsx +46 -10
- package/src/flowNavigation/FlowNavigation.story.tsx +48 -10
- package/src/index.ts +0 -4
- package/src/listItem/ListItem.story.tsx +43 -5
- package/src/main.css +5 -109
- package/src/main.less +0 -2
- package/src/modal/{Modal.rtl.spec.js → Modal.rtl.spec.tsx} +8 -7
- package/src/navigationOption/NavigationOption.story.tsx +65 -14
- package/src/overlayHeader/OverlayHeader.story.tsx +10 -5
- package/src/radio/Radio.story.tsx +5 -5
- package/src/radioGroup/RadioGroup.story.tsx +3 -3
- package/src/selectOption/SelectOption.story.tsx +30 -31
- package/src/slidingPanel/SlidingPanel.spec.js +1 -1
- package/src/ssr.spec.tsx +264 -0
- package/src/test-utils/{index.js → index.tsx} +11 -6
- package/src/test-utils/{jest.setup.js → jest.setup.ts} +13 -8
- package/src/tile/Tile.story.tsx +6 -2
- package/build/avatarView/AvatarView.js +0 -163
- package/build/avatarView/AvatarView.js.map +0 -1
- package/build/avatarView/AvatarView.mjs +0 -161
- package/build/avatarView/AvatarView.mjs.map +0 -1
- package/build/avatarView/NotificationDot.js +0 -59
- package/build/avatarView/NotificationDot.js.map +0 -1
- package/build/avatarView/NotificationDot.mjs +0 -57
- package/build/avatarView/NotificationDot.mjs.map +0 -1
- package/build/badge/BadgeAssets.js +0 -85
- package/build/badge/BadgeAssets.js.map +0 -1
- package/build/badge/BadgeAssets.mjs +0 -83
- package/build/badge/BadgeAssets.mjs.map +0 -1
- package/build/styles/avatarGroup/AvatarGroup.css +0 -29
- package/build/styles/avatarView/AvatarView.css +0 -42
- package/build/styles/avatarView/NotificationDot.css +0 -20
- package/build/types/avatarGroup/AvatarGroup.d.ts +0 -18
- package/build/types/avatarGroup/AvatarGroup.d.ts.map +0 -1
- package/build/types/avatarGroup/index.d.ts +0 -3
- package/build/types/avatarGroup/index.d.ts.map +0 -1
- package/build/types/avatarView/AvatarView.d.ts +0 -19
- package/build/types/avatarView/AvatarView.d.ts.map +0 -1
- package/build/types/avatarView/NotificationDot.d.ts +0 -8
- package/build/types/avatarView/NotificationDot.d.ts.map +0 -1
- package/build/types/avatarView/index.d.ts +0 -3
- package/build/types/avatarView/index.d.ts.map +0 -1
- package/build/types/badge/BadgeAssets.d.ts +0 -15
- package/build/types/badge/BadgeAssets.d.ts.map +0 -1
- package/src/avatarGroup/AvatarGroup.css +0 -29
- package/src/avatarGroup/AvatarGroup.less +0 -42
- package/src/avatarGroup/AvatarGroup.story.tsx +0 -284
- package/src/avatarGroup/AvatarGroup.tsx +0 -117
- package/src/avatarGroup/index.ts +0 -2
- package/src/avatarView/AvatarView.css +0 -42
- package/src/avatarView/AvatarView.less +0 -33
- package/src/avatarView/AvatarView.story.tsx +0 -425
- package/src/avatarView/AvatarView.tsx +0 -141
- package/src/avatarView/NotificationDot.css +0 -20
- package/src/avatarView/NotificationDot.less +0 -24
- package/src/avatarView/NotificationDot.tsx +0 -35
- package/src/avatarView/index.ts +0 -2
- package/src/badge/BadgeAssets.tsx +0 -65
- package/src/ssr.spec.js +0 -256
- /package/src/button/__snapshots__/{Button.spec.js.snap → Button.spec.tsx.snap} +0 -0
- /package/src/dimmer/{Dimmer.rtl.spec.js → Dimmer.rtl.spec.tsx} +0 -0
- /package/src/info/{Info.spec.js → Info.spec.jsx} +0 -0
package/src/badge/Badge.less
CHANGED
|
@@ -17,7 +17,6 @@
|
|
|
17
17
|
--badge-mask: @badge-mask-sm;
|
|
18
18
|
--badge-mask-offset: calc(var(--badge-size) / 2);
|
|
19
19
|
--badge-border-color: @badge-border-light;
|
|
20
|
-
--badge-content-position: 0px;
|
|
21
20
|
|
|
22
21
|
&.tw-badge-lg {
|
|
23
22
|
--badge-size: @badge-size-lg;
|
|
@@ -34,7 +33,7 @@
|
|
|
34
33
|
|
|
35
34
|
mask-image:
|
|
36
35
|
radial-gradient(
|
|
37
|
-
circle at top calc(100% - var(--badge-mask-offset)
|
|
36
|
+
circle at top calc(100% - var(--badge-mask-offset)) left calc(100% - var(--badge-mask-offset)),
|
|
38
37
|
transparent 0,
|
|
39
38
|
transparent calc(var(--badge-size) / 2 + var(--badge-mask)),
|
|
40
39
|
black calc(var(--badge-size) / 2 + var(--badge-mask) + 0.5px)
|
|
@@ -55,8 +54,8 @@
|
|
|
55
54
|
position: absolute;
|
|
56
55
|
width: var(--badge-size);
|
|
57
56
|
height: var(--badge-size);
|
|
58
|
-
bottom:
|
|
59
|
-
.right(
|
|
57
|
+
bottom: 0;
|
|
58
|
+
.right(0);
|
|
60
59
|
|
|
61
60
|
box-sizing: border-box;
|
|
62
61
|
border-radius: 50%;
|
package/src/badge/Badge.tsx
CHANGED
|
@@ -26,14 +26,8 @@ export type BadgeProps = {
|
|
|
26
26
|
size?: SizeSmall | DeprecatedSizes | SizeLarge;
|
|
27
27
|
border?: ThemeDark | ThemeLight;
|
|
28
28
|
'aria-label'?: string;
|
|
29
|
-
style?: React.CSSProperties;
|
|
30
29
|
} & CommonProps;
|
|
31
30
|
|
|
32
|
-
// Note: Badge component is not deprecated, we want stop it's direct usage on consumer side.
|
|
33
|
-
// Deprecation notice will hint consumers to migrate. Eventually the component will become internal.
|
|
34
|
-
/**
|
|
35
|
-
* @deprecated Use `<AvatarView badge={..} />` instead.
|
|
36
|
-
*/
|
|
37
31
|
const Badge = ({
|
|
38
32
|
badge,
|
|
39
33
|
className = undefined,
|
|
@@ -41,7 +35,6 @@ const Badge = ({
|
|
|
41
35
|
border = Theme.LIGHT,
|
|
42
36
|
'aria-label': ariaLabel,
|
|
43
37
|
children,
|
|
44
|
-
style,
|
|
45
38
|
}: BadgeProps) => {
|
|
46
39
|
// medium is deprecated, so we map it to small
|
|
47
40
|
const size = sizeProp === Size.MEDIUM ? Size.SMALL : sizeProp;
|
|
@@ -55,7 +48,7 @@ const Badge = ({
|
|
|
55
48
|
);
|
|
56
49
|
|
|
57
50
|
return (
|
|
58
|
-
<div aria-label={ariaLabel} className={classes}
|
|
51
|
+
<div aria-label={ariaLabel} className={classes}>
|
|
59
52
|
<div className="tw-badge__children">{children}</div>
|
|
60
53
|
<div className="tw-badge__content">{badge}</div>
|
|
61
54
|
</div>
|
package/src/badge/index.ts
CHANGED
|
@@ -5,6 +5,7 @@ import { render, screen, userEvent } from '../test-utils';
|
|
|
5
5
|
|
|
6
6
|
import Button from '.';
|
|
7
7
|
import messages from './Button.messages';
|
|
8
|
+
import { ButtonReferenceType } from './Button';
|
|
8
9
|
|
|
9
10
|
const { ACCENT, POSITIVE, NEGATIVE } = ControlType;
|
|
10
11
|
const { PAY, LINK, DANGER } = Type;
|
|
@@ -14,7 +15,7 @@ const { SMALL, MEDIUM, LARGE } = Size;
|
|
|
14
15
|
describe('Button', () => {
|
|
15
16
|
// eslint-disable-next-line no-console
|
|
16
17
|
const originalWarn = console.warn;
|
|
17
|
-
let mockedWarn;
|
|
18
|
+
let mockedWarn: typeof originalWarn;
|
|
18
19
|
|
|
19
20
|
const props = {
|
|
20
21
|
onClick: jest.fn(),
|
|
@@ -47,7 +48,7 @@ describe('Button', () => {
|
|
|
47
48
|
});
|
|
48
49
|
|
|
49
50
|
it('set `ref` to be true on Button', () => {
|
|
50
|
-
const reference = createRef();
|
|
51
|
+
const reference = createRef<ButtonReferenceType>();
|
|
51
52
|
|
|
52
53
|
expect(reference.current).toBeFalsy();
|
|
53
54
|
render(<Button ref={reference}>Click me!</Button>);
|
package/src/button/Button.tsx
CHANGED
|
@@ -51,7 +51,7 @@ type AnchorProps = CommonProps &
|
|
|
51
51
|
|
|
52
52
|
export type Props = ButtonProps | AnchorProps;
|
|
53
53
|
|
|
54
|
-
type ButtonReferenceType = HTMLButtonElement | HTMLAnchorElement;
|
|
54
|
+
export type ButtonReferenceType = HTMLButtonElement | HTMLAnchorElement;
|
|
55
55
|
|
|
56
56
|
const Button = forwardRef<ButtonReferenceType, Props>(
|
|
57
57
|
(
|
|
@@ -57,8 +57,8 @@ export const establishNewPriority: EstablishNewPriorityType = (originalPriority,
|
|
|
57
57
|
|
|
58
58
|
type DeprecatedTypeMapMessageType = keyof typeof deprecatedTypeMapMessage;
|
|
59
59
|
type LogDeprecationNoticesType = (params: {
|
|
60
|
-
size
|
|
61
|
-
type
|
|
60
|
+
size?: `${Size}`;
|
|
61
|
+
type?: DeprecatedTypeMapMessageType | (string & Record<never, never>) | null;
|
|
62
62
|
}) => void;
|
|
63
63
|
export const logDeprecationNotices: LogDeprecationNoticesType = ({ size, type }) => {
|
|
64
64
|
logActionRequiredIf(
|
|
@@ -4,40 +4,8 @@
|
|
|
4
4
|
width: var(--circle-size);
|
|
5
5
|
height: var(--circle-size);
|
|
6
6
|
flex-shrink: 0;
|
|
7
|
-
--circle-border-color: var(--color-border-neutral);
|
|
8
|
-
--circle-border-width: 1px;
|
|
9
|
-
font-size: var(--circle-font-size);
|
|
10
|
-
font-weight: 600;
|
|
11
|
-
font-weight: var(--font-weight-semi-bold);
|
|
12
|
-
line-height: 1;
|
|
13
|
-
}
|
|
14
|
-
.np-circle .np-display {
|
|
15
|
-
font-size: var(--circle-font-size);
|
|
16
7
|
}
|
|
17
8
|
.np-circle .tw-icon > svg {
|
|
18
9
|
height: var(--circle-icon-size);
|
|
19
10
|
width: var(--circle-icon-size);
|
|
20
11
|
}
|
|
21
|
-
.np-circle img,
|
|
22
|
-
.np-circle .wds-flag {
|
|
23
|
-
border-radius: 9999px;
|
|
24
|
-
border-radius: var(--radius-full);
|
|
25
|
-
width: 100%;
|
|
26
|
-
height: 100%;
|
|
27
|
-
-o-object-fit: cover;
|
|
28
|
-
object-fit: cover;
|
|
29
|
-
}
|
|
30
|
-
.np-circle-border {
|
|
31
|
-
position: relative;
|
|
32
|
-
}
|
|
33
|
-
.np-circle-border::after {
|
|
34
|
-
content: "";
|
|
35
|
-
position: absolute;
|
|
36
|
-
top: 0;
|
|
37
|
-
left: 0;
|
|
38
|
-
width: 100%;
|
|
39
|
-
height: 100%;
|
|
40
|
-
border-radius: 9999px;
|
|
41
|
-
border-radius: var(--radius-full);
|
|
42
|
-
box-shadow: inset 0 0 0 var(--circle-border-width) var(--circle-border-color);
|
|
43
|
-
}
|
|
@@ -4,44 +4,9 @@
|
|
|
4
4
|
height: var(--circle-size);
|
|
5
5
|
flex-shrink: 0;
|
|
6
6
|
|
|
7
|
-
--circle-border-color: var(--color-border-neutral);
|
|
8
|
-
--circle-border-width: 1px;
|
|
9
|
-
|
|
10
|
-
// sets custom typography styles for default (Inter) font
|
|
11
|
-
font-size: var(--circle-font-size);
|
|
12
|
-
font-weight: var(--font-weight-semi-bold);
|
|
13
|
-
line-height: 1;
|
|
14
|
-
|
|
15
|
-
// sets custom typography styles for Wise Sand font
|
|
16
|
-
.np-display {
|
|
17
|
-
font-size: var(--circle-font-size);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
7
|
// circle like components has custom icon sizes
|
|
21
8
|
.tw-icon > svg {
|
|
22
9
|
height: var(--circle-icon-size);
|
|
23
10
|
width: var(--circle-icon-size);
|
|
24
11
|
}
|
|
25
|
-
|
|
26
|
-
img,
|
|
27
|
-
.wds-flag {
|
|
28
|
-
border-radius: var(--radius-full);
|
|
29
|
-
width: 100%;
|
|
30
|
-
height: 100%;
|
|
31
|
-
object-fit: cover;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
&-border {
|
|
35
|
-
position: relative;
|
|
36
|
-
&::after {
|
|
37
|
-
content: "";
|
|
38
|
-
position: absolute;
|
|
39
|
-
top: 0;
|
|
40
|
-
left: 0;
|
|
41
|
-
width: 100%;
|
|
42
|
-
height: 100%;
|
|
43
|
-
border-radius: var(--radius-full);
|
|
44
|
-
box-shadow: inset 0 0 0 var(--circle-border-width) var(--circle-border-color);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
12
|
}
|
|
@@ -19,7 +19,6 @@ export type Props = {
|
|
|
19
19
|
* as those can be dynamic a at certain viewport sizes
|
|
20
20
|
*/
|
|
21
21
|
fixedSize?: boolean;
|
|
22
|
-
enableBorder?: boolean;
|
|
23
22
|
} & HTMLAttributes<HTMLDivElement>;
|
|
24
23
|
|
|
25
24
|
/**
|
|
@@ -35,26 +34,12 @@ const MAP_ICON_SIZE = {
|
|
|
35
34
|
72: 36,
|
|
36
35
|
};
|
|
37
36
|
|
|
38
|
-
/**
|
|
39
|
-
* circle like components have custom font styles
|
|
40
|
-
*/
|
|
41
|
-
const MAP_FONT_SIZE = {
|
|
42
|
-
16: 8,
|
|
43
|
-
24: 12,
|
|
44
|
-
32: 14,
|
|
45
|
-
40: 18,
|
|
46
|
-
48: 22,
|
|
47
|
-
56: 26,
|
|
48
|
-
72: 30,
|
|
49
|
-
};
|
|
50
|
-
|
|
51
37
|
const Circle = forwardRef(function Circle(
|
|
52
38
|
{
|
|
53
39
|
as: Element = 'div',
|
|
54
40
|
children,
|
|
55
41
|
size = 48,
|
|
56
42
|
fixedSize = false,
|
|
57
|
-
enableBorder = false,
|
|
58
43
|
className,
|
|
59
44
|
style,
|
|
60
45
|
...props
|
|
@@ -72,15 +57,9 @@ const Circle = forwardRef(function Circle(
|
|
|
72
57
|
isTinyViewport && !fixedSize
|
|
73
58
|
? `${MAP_ICON_SIZE[size] / 2}px`
|
|
74
59
|
: `${MAP_ICON_SIZE[size]}px`,
|
|
75
|
-
'--circle-font-size': `${MAP_FONT_SIZE[size]}px`,
|
|
76
60
|
...style,
|
|
77
61
|
}}
|
|
78
|
-
className={clsx(
|
|
79
|
-
'np-circle',
|
|
80
|
-
{ 'np-circle-border': enableBorder },
|
|
81
|
-
'd-flex align-items-center justify-content-center',
|
|
82
|
-
className,
|
|
83
|
-
)}
|
|
62
|
+
className={clsx('np-circle', 'd-flex align-items-center justify-content-center', className)}
|
|
84
63
|
>
|
|
85
64
|
{children}
|
|
86
65
|
</Element>
|
|
@@ -2,7 +2,7 @@ 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
|
|
5
|
+
import Avatar from '../avatar';
|
|
6
6
|
import { Size } from '../common';
|
|
7
7
|
|
|
8
8
|
import Decision, { DecisionPresentation, DecisionType } from '.';
|
|
@@ -33,7 +33,11 @@ export const Basic = () => {
|
|
|
33
33
|
disabled,
|
|
34
34
|
media: {
|
|
35
35
|
block: <Illustration name="globe" alt="" disablePadding />,
|
|
36
|
-
list:
|
|
36
|
+
list: (
|
|
37
|
+
<Avatar size="md" type="initials">
|
|
38
|
+
HM
|
|
39
|
+
</Avatar>
|
|
40
|
+
),
|
|
37
41
|
},
|
|
38
42
|
'aria-label': 'Click to see something',
|
|
39
43
|
title: 'Hank Miller',
|
|
@@ -46,7 +50,11 @@ export const Basic = () => {
|
|
|
46
50
|
href: '#href2',
|
|
47
51
|
media: {
|
|
48
52
|
block: <Illustration name="confetti" alt="" disablePadding />,
|
|
49
|
-
list:
|
|
53
|
+
list: (
|
|
54
|
+
<Avatar size="md" type="initials">
|
|
55
|
+
HM
|
|
56
|
+
</Avatar>
|
|
57
|
+
),
|
|
50
58
|
},
|
|
51
59
|
'aria-label': 'Click here to send money to Hank Miller.',
|
|
52
60
|
title: 'Hank Miller',
|
|
@@ -101,7 +109,11 @@ export const grid = () => {
|
|
|
101
109
|
alt=""
|
|
102
110
|
/>
|
|
103
111
|
),
|
|
104
|
-
list:
|
|
112
|
+
list: (
|
|
113
|
+
<Avatar size="md" type="initials">
|
|
114
|
+
HM
|
|
115
|
+
</Avatar>
|
|
116
|
+
),
|
|
105
117
|
},
|
|
106
118
|
'aria-label': 'Click to see something',
|
|
107
119
|
title: 'Hank Miller',
|
|
@@ -119,7 +131,11 @@ export const grid = () => {
|
|
|
119
131
|
alt=""
|
|
120
132
|
/>
|
|
121
133
|
),
|
|
122
|
-
list:
|
|
134
|
+
list: (
|
|
135
|
+
<Avatar size="md" type="initials">
|
|
136
|
+
HM
|
|
137
|
+
</Avatar>
|
|
138
|
+
),
|
|
123
139
|
},
|
|
124
140
|
'aria-label': 'Click here to send money to Hank Miller.',
|
|
125
141
|
title: 'Hank Miller',
|
|
@@ -136,7 +152,11 @@ export const grid = () => {
|
|
|
136
152
|
alt=""
|
|
137
153
|
/>
|
|
138
154
|
),
|
|
139
|
-
list:
|
|
155
|
+
list: (
|
|
156
|
+
<Avatar size="md" type="initials">
|
|
157
|
+
HM
|
|
158
|
+
</Avatar>
|
|
159
|
+
),
|
|
140
160
|
},
|
|
141
161
|
'aria-label': 'Click here to send money to Hank Miller.',
|
|
142
162
|
disabled,
|
|
@@ -155,7 +175,11 @@ export const grid = () => {
|
|
|
155
175
|
alt=""
|
|
156
176
|
/>
|
|
157
177
|
),
|
|
158
|
-
list:
|
|
178
|
+
list: (
|
|
179
|
+
<Avatar size="md" type="initials">
|
|
180
|
+
HM
|
|
181
|
+
</Avatar>
|
|
182
|
+
),
|
|
159
183
|
},
|
|
160
184
|
'aria-label': 'Click here to send money to Hank Miller.',
|
|
161
185
|
title: 'Hank Miller',
|
|
@@ -173,7 +197,11 @@ export const grid = () => {
|
|
|
173
197
|
alt=""
|
|
174
198
|
/>
|
|
175
199
|
),
|
|
176
|
-
list:
|
|
200
|
+
list: (
|
|
201
|
+
<Avatar size="md" type="initials">
|
|
202
|
+
HM
|
|
203
|
+
</Avatar>
|
|
204
|
+
),
|
|
177
205
|
},
|
|
178
206
|
'aria-label': 'Click here to send money to Hank Miller.',
|
|
179
207
|
title: 'Hank Miller',
|
|
@@ -191,7 +219,11 @@ export const grid = () => {
|
|
|
191
219
|
alt=""
|
|
192
220
|
/>
|
|
193
221
|
),
|
|
194
|
-
list:
|
|
222
|
+
list: (
|
|
223
|
+
<Avatar size="md" type="initials">
|
|
224
|
+
HM
|
|
225
|
+
</Avatar>
|
|
226
|
+
),
|
|
195
227
|
},
|
|
196
228
|
'aria-label': 'Click here to send money to Hank Miller.',
|
|
197
229
|
title: 'Hank Miller',
|
|
@@ -209,7 +241,11 @@ export const grid = () => {
|
|
|
209
241
|
alt=""
|
|
210
242
|
/>
|
|
211
243
|
),
|
|
212
|
-
list:
|
|
244
|
+
list: (
|
|
245
|
+
<Avatar size="md" type="initials">
|
|
246
|
+
HM
|
|
247
|
+
</Avatar>
|
|
248
|
+
),
|
|
213
249
|
},
|
|
214
250
|
'aria-label': 'Click here to send money to Hank Miller.',
|
|
215
251
|
title: 'Hank Miller',
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { boolean, select, text } from '@storybook/addon-knobs';
|
|
2
|
+
import { Person as ProfileIcon, Briefcase as BriefcaseIcon } from '@transferwise/icons';
|
|
2
3
|
import { useState } from 'react';
|
|
3
4
|
|
|
4
|
-
import
|
|
5
|
+
import Avatar, { AvatarType } from '../avatar';
|
|
6
|
+
import AvatarWrapper from '../avatarWrapper';
|
|
5
7
|
import Body from '../body';
|
|
6
8
|
import Button from '../button';
|
|
7
|
-
import { ProfileType, Typography } from '../common';
|
|
9
|
+
import { ProfileType, Size, Typography } from '../common';
|
|
8
10
|
import Logo from '../logo';
|
|
9
11
|
import OverlayHeader from '../overlayHeader';
|
|
10
12
|
|
|
@@ -17,14 +19,28 @@ export default {
|
|
|
17
19
|
component: FlowNavigation,
|
|
18
20
|
title: 'Navigation/FlowNavigation',
|
|
19
21
|
};
|
|
22
|
+
const avatarProfiles = {
|
|
23
|
+
'': null,
|
|
24
|
+
Business: <BriefcaseIcon />,
|
|
25
|
+
Profile: <ProfileIcon />,
|
|
26
|
+
};
|
|
27
|
+
type ProfileTypeKeys = keyof typeof ProfileType;
|
|
28
|
+
|
|
29
|
+
const getAvatarProfile = (showAvatar: string) =>
|
|
30
|
+
showAvatar in avatarProfiles ? avatarProfiles[showAvatar as keyof typeof avatarProfiles] : null;
|
|
20
31
|
|
|
21
32
|
export const Variants = () => {
|
|
22
33
|
const [activeStep, setActiveStep] = useState(2);
|
|
23
34
|
const [closed, setClosed] = useState(false);
|
|
24
|
-
const showAvatar = select('avatar',
|
|
35
|
+
const showAvatar = select('avatar', Object.keys(avatarProfiles), 'Profile');
|
|
25
36
|
const showCloseButton = boolean('show closeButton', true);
|
|
26
37
|
const showMobileBackButton = boolean('show mobile backButton', true);
|
|
27
38
|
const done = boolean('done', false);
|
|
39
|
+
const profileType: ProfileTypeKeys | undefined = select(
|
|
40
|
+
'profileType',
|
|
41
|
+
Object.keys(ProfileType) as ProfileTypeKeys[],
|
|
42
|
+
undefined,
|
|
43
|
+
);
|
|
28
44
|
const avatarURL = text(
|
|
29
45
|
'avatarURL',
|
|
30
46
|
'https://wise.com/web-art/assets/illustrations/heart-small@2x.webp',
|
|
@@ -33,7 +49,13 @@ export const Variants = () => {
|
|
|
33
49
|
return !closed ? (
|
|
34
50
|
<>
|
|
35
51
|
<FlowNavigation
|
|
36
|
-
avatar={
|
|
52
|
+
avatar={
|
|
53
|
+
!showAvatar ? null : (
|
|
54
|
+
<Avatar type={AvatarType.ICON} size={Size.MEDIUM}>
|
|
55
|
+
{getAvatarProfile(showAvatar)}
|
|
56
|
+
</Avatar>
|
|
57
|
+
)
|
|
58
|
+
}
|
|
37
59
|
logo={<Logo />}
|
|
38
60
|
activeStep={activeStep}
|
|
39
61
|
done={done}
|
|
@@ -110,7 +132,7 @@ export const Variants = () => {
|
|
|
110
132
|
|
|
111
133
|
<FlowNavigation
|
|
112
134
|
done={done}
|
|
113
|
-
avatar={<
|
|
135
|
+
avatar={<AvatarWrapper url={avatarURL} profileType={profileType} />}
|
|
114
136
|
activeStep={activeStep}
|
|
115
137
|
steps={[
|
|
116
138
|
{
|
|
@@ -156,7 +178,7 @@ export const Variants = () => {
|
|
|
156
178
|
{/* Instance of always `done` FlowNav for visual testing */}
|
|
157
179
|
<FlowNavigation
|
|
158
180
|
done
|
|
159
|
-
avatar={<
|
|
181
|
+
avatar={<AvatarWrapper url={avatarURL} profileType={profileType} />}
|
|
160
182
|
activeStep={activeStep}
|
|
161
183
|
steps={[
|
|
162
184
|
{ label: 'Recipient', hoverLabel: 'Daniele Tomboro', onClick: () => setActiveStep(0) },
|
|
@@ -218,7 +240,11 @@ export const SendFlow = () => {
|
|
|
218
240
|
return (
|
|
219
241
|
<>
|
|
220
242
|
<FlowNavigation
|
|
221
|
-
avatar={
|
|
243
|
+
avatar={
|
|
244
|
+
<Avatar type={AvatarType.ICON} size={Size.MEDIUM}>
|
|
245
|
+
<ProfileIcon />
|
|
246
|
+
</Avatar>
|
|
247
|
+
}
|
|
222
248
|
logo={<Logo />}
|
|
223
249
|
activeStep={activeStep}
|
|
224
250
|
steps={steps}
|
|
@@ -246,7 +272,7 @@ export const SendFlow = () => {
|
|
|
246
272
|
export const WithOverlayHeaderComparison = () => {
|
|
247
273
|
const [activeStep, setActiveStep] = useState(4);
|
|
248
274
|
const [closed, setClosed] = useState(false);
|
|
249
|
-
const showAvatar = select('avatar',
|
|
275
|
+
const showAvatar = select('avatar', Object.keys(avatarProfiles), 'Profile');
|
|
250
276
|
const showCloseButton = boolean('show closeButton', true);
|
|
251
277
|
const showMobileBackButton = boolean('show mobile backButton', true);
|
|
252
278
|
const done = boolean('done', false);
|
|
@@ -255,7 +281,13 @@ export const WithOverlayHeaderComparison = () => {
|
|
|
255
281
|
<>
|
|
256
282
|
<div style={{ border: '1px solid #e8e8e8' }}>
|
|
257
283
|
<FlowNavigation
|
|
258
|
-
avatar={
|
|
284
|
+
avatar={
|
|
285
|
+
showAvatar ? (
|
|
286
|
+
<Avatar type={AvatarType.ICON} size={Size.MEDIUM}>
|
|
287
|
+
{getAvatarProfile(showAvatar)}
|
|
288
|
+
</Avatar>
|
|
289
|
+
) : null
|
|
290
|
+
}
|
|
259
291
|
activeStep={activeStep}
|
|
260
292
|
done={done}
|
|
261
293
|
steps={[]}
|
|
@@ -269,7 +301,13 @@ export const WithOverlayHeaderComparison = () => {
|
|
|
269
301
|
</div>
|
|
270
302
|
<div style={{ border: '1px solid #e8e8e8' }}>
|
|
271
303
|
<OverlayHeader
|
|
272
|
-
avatar={
|
|
304
|
+
avatar={
|
|
305
|
+
showAvatar ? (
|
|
306
|
+
<Avatar type={AvatarType.ICON} size={Size.MEDIUM}>
|
|
307
|
+
{getAvatarProfile(showAvatar)}
|
|
308
|
+
</Avatar>
|
|
309
|
+
) : null
|
|
310
|
+
}
|
|
273
311
|
onClose={showCloseButton ? () => setClosed(true) : undefined}
|
|
274
312
|
/>
|
|
275
313
|
</div>
|
package/src/index.ts
CHANGED
|
@@ -8,7 +8,6 @@ export type { ActionOptionProps } from './actionOption';
|
|
|
8
8
|
export type { SelectOptionProps, SelectOptionValue, SelectOptiopsSection } from './selectOption';
|
|
9
9
|
export type { AlertAction, AlertProps, AlertType } from './alert';
|
|
10
10
|
export type { AvatarProps } from './avatar';
|
|
11
|
-
export type { AvatarViewProps } from './avatarView';
|
|
12
11
|
export type { BadgeProps } from './badge';
|
|
13
12
|
export type { CardProps } from './card';
|
|
14
13
|
export type { CarouselProps } from './carousel';
|
|
@@ -104,7 +103,6 @@ export { default as ActionOption } from './actionOption';
|
|
|
104
103
|
export { default as SelectOption } from './selectOption';
|
|
105
104
|
export { default as Alert } from './alert';
|
|
106
105
|
export { default as Avatar } from './avatar';
|
|
107
|
-
export { default as AvatarView } from './avatarView';
|
|
108
106
|
export { default as AvatarWrapper } from './avatarWrapper';
|
|
109
107
|
export { default as Badge } from './badge';
|
|
110
108
|
export { default as Body } from './body';
|
|
@@ -246,8 +244,6 @@ export {
|
|
|
246
244
|
getLangFromLocale,
|
|
247
245
|
isBrowser,
|
|
248
246
|
isServerSide,
|
|
249
|
-
getInitials,
|
|
250
|
-
getBrandColorFromSeed,
|
|
251
247
|
} from './common';
|
|
252
248
|
|
|
253
249
|
/**
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
/* eslint-disable react/jsx-child-element-spacing */
|
|
2
2
|
|
|
3
3
|
import { action } from '@storybook/addon-actions';
|
|
4
|
-
import { Documents
|
|
4
|
+
import { Documents } from '@transferwise/icons';
|
|
5
5
|
import { ComponentProps } from 'react';
|
|
6
6
|
|
|
7
7
|
import ActionButton from '../actionButton/ActionButton';
|
|
8
|
-
import
|
|
8
|
+
import Avatar from '../avatar';
|
|
9
|
+
import Badge from '../badge';
|
|
9
10
|
import Info from '../info';
|
|
10
11
|
import Title from '../title/Title';
|
|
12
|
+
|
|
11
13
|
import ListItem, { List } from '.';
|
|
12
14
|
|
|
13
15
|
export default {
|
|
@@ -40,7 +42,13 @@ export const Variants = () => {
|
|
|
40
42
|
<List>
|
|
41
43
|
<Template
|
|
42
44
|
media={
|
|
43
|
-
<
|
|
45
|
+
<Avatar>
|
|
46
|
+
<img
|
|
47
|
+
style={{ width: 32, height: 32 }}
|
|
48
|
+
src="https://wise.com/public-resources/assets/balances/savings-emoji/google/✈️.png"
|
|
49
|
+
alt=""
|
|
50
|
+
/>
|
|
51
|
+
</Avatar>
|
|
44
52
|
}
|
|
45
53
|
/>
|
|
46
54
|
</List>
|
|
@@ -51,7 +59,22 @@ export const Variants = () => {
|
|
|
51
59
|
<Template
|
|
52
60
|
title="Sandra Pepper"
|
|
53
61
|
value="Personal account"
|
|
54
|
-
media={
|
|
62
|
+
media={
|
|
63
|
+
<Badge
|
|
64
|
+
badge={
|
|
65
|
+
<img
|
|
66
|
+
src="https://wise.com/public-resources/assets/brand/fast_flag_badge_personal.svg"
|
|
67
|
+
alt=""
|
|
68
|
+
height="24px"
|
|
69
|
+
width="24px"
|
|
70
|
+
/>
|
|
71
|
+
}
|
|
72
|
+
>
|
|
73
|
+
<Avatar type="initials" size="md">
|
|
74
|
+
<span aria-hidden>SP</span>
|
|
75
|
+
</Avatar>
|
|
76
|
+
</Badge>
|
|
77
|
+
}
|
|
55
78
|
/>
|
|
56
79
|
</List>
|
|
57
80
|
</div>
|
|
@@ -61,7 +84,22 @@ export const Variants = () => {
|
|
|
61
84
|
<Template
|
|
62
85
|
title="Account holder"
|
|
63
86
|
value="Sandra Pepper"
|
|
64
|
-
media={
|
|
87
|
+
media={
|
|
88
|
+
<Badge
|
|
89
|
+
badge={
|
|
90
|
+
<img
|
|
91
|
+
src="https://wise.com/public-resources/assets/brand/fast_flag_badge_personal.svg"
|
|
92
|
+
alt=""
|
|
93
|
+
height="24px"
|
|
94
|
+
width="24px"
|
|
95
|
+
/>
|
|
96
|
+
}
|
|
97
|
+
>
|
|
98
|
+
<Avatar type="initials" size="md">
|
|
99
|
+
<span aria-hidden>SP</span>
|
|
100
|
+
</Avatar>
|
|
101
|
+
</Badge>
|
|
102
|
+
}
|
|
65
103
|
action={<ActionButton>Share details</ActionButton>}
|
|
66
104
|
/>
|
|
67
105
|
</List>
|