@transferwise/components 0.0.0-experimental-8d0974a → 0.0.0-experimental-53b8447
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 +3 -0
- package/build/avatar/Avatar.js.map +1 -1
- package/build/avatar/Avatar.mjs +3 -0
- package/build/avatar/Avatar.mjs.map +1 -1
- package/build/avatarView/AvatarView.js +187 -0
- package/build/avatarView/AvatarView.js.map +1 -0
- package/build/avatarView/AvatarView.mjs +185 -0
- package/build/avatarView/AvatarView.mjs.map +1 -0
- package/build/avatarView/NotificationDot.js +56 -0
- package/build/avatarView/NotificationDot.js.map +1 -0
- package/build/avatarView/NotificationDot.mjs +54 -0
- package/build/avatarView/NotificationDot.mjs.map +1 -0
- package/build/avatarWrapper/AvatarWrapper.js +6 -1
- package/build/avatarWrapper/AvatarWrapper.js.map +1 -1
- package/build/avatarWrapper/AvatarWrapper.mjs +6 -1
- package/build/avatarWrapper/AvatarWrapper.mjs.map +1 -1
- package/build/badge/Badge.js +8 -1
- package/build/badge/Badge.js.map +1 -1
- package/build/badge/Badge.mjs +8 -1
- package/build/badge/Badge.mjs.map +1 -1
- package/build/badge/BadgeAssets.js +63 -0
- package/build/badge/BadgeAssets.js.map +1 -0
- package/build/badge/BadgeAssets.mjs +61 -0
- package/build/badge/BadgeAssets.mjs.map +1 -0
- package/build/common/circle/Circle.js +29 -3
- package/build/common/circle/Circle.js.map +1 -1
- package/build/common/circle/Circle.mjs +29 -3
- package/build/common/circle/Circle.mjs.map +1 -1
- package/build/dateLookup/DateLookup.js +6 -6
- package/build/dateLookup/DateLookup.js.map +1 -1
- package/build/dateLookup/DateLookup.mjs +6 -6
- package/build/dateLookup/DateLookup.mjs.map +1 -1
- package/build/dateLookup/dayCalendar/table/DayCalendarTable.js +1 -4
- package/build/dateLookup/dayCalendar/table/DayCalendarTable.js.map +1 -1
- package/build/dateLookup/dayCalendar/table/DayCalendarTable.mjs +1 -4
- package/build/dateLookup/dayCalendar/table/DayCalendarTable.mjs.map +1 -1
- package/build/i18n/de.json +5 -0
- package/build/i18n/de.json.js +5 -0
- package/build/i18n/de.json.js.map +1 -1
- package/build/i18n/de.json.mjs +5 -0
- package/build/i18n/de.json.mjs.map +1 -1
- package/build/i18n/es.json +5 -0
- package/build/i18n/es.json.js +5 -0
- package/build/i18n/es.json.js.map +1 -1
- package/build/i18n/es.json.mjs +5 -0
- package/build/i18n/es.json.mjs.map +1 -1
- package/build/i18n/fr.json +5 -0
- package/build/i18n/fr.json.js +5 -0
- package/build/i18n/fr.json.js.map +1 -1
- package/build/i18n/fr.json.mjs +5 -0
- package/build/i18n/fr.json.mjs.map +1 -1
- package/build/i18n/hu.json +5 -0
- package/build/i18n/hu.json.js +5 -0
- package/build/i18n/hu.json.js.map +1 -1
- package/build/i18n/hu.json.mjs +5 -0
- package/build/i18n/hu.json.mjs.map +1 -1
- package/build/i18n/id.json +5 -0
- package/build/i18n/id.json.js +5 -0
- package/build/i18n/id.json.js.map +1 -1
- package/build/i18n/id.json.mjs +5 -0
- package/build/i18n/id.json.mjs.map +1 -1
- package/build/i18n/it.json +5 -0
- package/build/i18n/it.json.js +5 -0
- package/build/i18n/it.json.js.map +1 -1
- package/build/i18n/it.json.mjs +5 -0
- package/build/i18n/it.json.mjs.map +1 -1
- package/build/i18n/ja.json +5 -0
- package/build/i18n/ja.json.js +5 -0
- package/build/i18n/ja.json.js.map +1 -1
- package/build/i18n/ja.json.mjs +5 -0
- package/build/i18n/ja.json.mjs.map +1 -1
- package/build/i18n/pl.json +5 -0
- package/build/i18n/pl.json.js +5 -0
- package/build/i18n/pl.json.js.map +1 -1
- package/build/i18n/pl.json.mjs +5 -0
- package/build/i18n/pl.json.mjs.map +1 -1
- package/build/i18n/pt.json +5 -0
- package/build/i18n/pt.json.js +5 -0
- package/build/i18n/pt.json.js.map +1 -1
- package/build/i18n/pt.json.mjs +5 -0
- package/build/i18n/pt.json.mjs.map +1 -1
- package/build/i18n/ro.json +5 -0
- package/build/i18n/ro.json.js +5 -0
- package/build/i18n/ro.json.js.map +1 -1
- package/build/i18n/ro.json.mjs +5 -0
- package/build/i18n/ro.json.mjs.map +1 -1
- package/build/i18n/ru.json +5 -0
- package/build/i18n/ru.json.js +5 -0
- package/build/i18n/ru.json.js.map +1 -1
- package/build/i18n/ru.json.mjs +5 -0
- package/build/i18n/ru.json.mjs.map +1 -1
- package/build/i18n/tr.json +5 -0
- package/build/i18n/tr.json.js +5 -0
- package/build/i18n/tr.json.js.map +1 -1
- package/build/i18n/tr.json.mjs +5 -0
- package/build/i18n/tr.json.mjs.map +1 -1
- package/build/index.js +15 -4
- package/build/index.js.map +1 -1
- package/build/index.mjs +10 -2
- package/build/index.mjs.map +1 -1
- package/build/main.css +98 -25
- package/build/statusIcon/StatusIcon.js +2 -2
- package/build/statusIcon/StatusIcon.js.map +1 -1
- package/build/statusIcon/StatusIcon.mjs +2 -2
- package/build/statusIcon/StatusIcon.mjs.map +1 -1
- package/build/styles/avatarGroup/AvatarGroup.css +28 -0
- package/build/styles/avatarView/AvatarView.css +28 -0
- package/build/styles/avatarView/NotificationDot.css +20 -0
- package/build/styles/badge/Badge.css +6 -5
- package/build/styles/common/circle/Circle.css +36 -0
- package/build/styles/main.css +98 -25
- package/build/styles/statusIcon/StatusIcon.css +0 -20
- package/build/types/avatar/Avatar.d.ts +3 -0
- package/build/types/avatar/Avatar.d.ts.map +1 -1
- package/build/types/avatarGroup/AvatarGroup.d.ts +18 -0
- package/build/types/avatarGroup/AvatarGroup.d.ts.map +1 -0
- package/build/types/avatarGroup/index.d.ts +3 -0
- package/build/types/avatarGroup/index.d.ts.map +1 -0
- package/build/types/avatarView/AvatarView.d.ts +25 -0
- package/build/types/avatarView/AvatarView.d.ts.map +1 -0
- package/build/types/avatarView/NotificationDot.d.ts +8 -0
- package/build/types/avatarView/NotificationDot.d.ts.map +1 -0
- package/build/types/avatarView/index.d.ts +3 -0
- package/build/types/avatarView/index.d.ts.map +1 -0
- package/build/types/avatarWrapper/AvatarWrapper.d.ts +3 -0
- package/build/types/avatarWrapper/AvatarWrapper.d.ts.map +1 -1
- package/build/types/badge/Badge.d.ts +5 -1
- package/build/types/badge/Badge.d.ts.map +1 -1
- package/build/types/badge/BadgeAssets.d.ts +15 -0
- package/build/types/badge/BadgeAssets.d.ts.map +1 -0
- package/build/types/badge/index.d.ts +2 -0
- package/build/types/badge/index.d.ts.map +1 -1
- package/build/types/common/circle/Circle.d.ts +3 -1
- package/build/types/common/circle/Circle.d.ts.map +1 -1
- package/build/types/common/dateUtils/index.d.ts +0 -1
- package/build/types/common/dateUtils/index.d.ts.map +1 -1
- package/build/types/dateLookup/DateLookup.d.ts +1 -1
- package/build/types/dateLookup/DateLookup.d.ts.map +1 -1
- package/build/types/dateLookup/dayCalendar/table/DayCalendarTable.d.ts +1 -1
- package/build/types/dateLookup/dayCalendar/table/DayCalendarTable.d.ts.map +1 -1
- package/build/types/index.d.ts +3 -1
- package/build/types/index.d.ts.map +1 -1
- package/build/types/statusIcon/StatusIcon.d.ts +6 -2
- package/build/types/statusIcon/StatusIcon.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/avatar/Avatar.tsx +3 -0
- package/src/avatarGroup/AvatarGroup.css +28 -0
- package/src/avatarGroup/AvatarGroup.less +32 -0
- package/src/avatarGroup/AvatarGroup.story.tsx +195 -0
- package/src/avatarGroup/AvatarGroup.tsx +80 -0
- package/src/avatarGroup/index.ts +2 -0
- package/src/avatarView/AvatarView.css +28 -0
- package/src/avatarView/AvatarView.less +16 -0
- package/src/avatarView/AvatarView.story.tsx +573 -0
- package/src/avatarView/AvatarView.tsx +184 -0
- package/src/avatarView/NotificationDot.css +20 -0
- package/src/avatarView/NotificationDot.less +24 -0
- package/src/avatarView/NotificationDot.tsx +32 -0
- package/src/avatarView/index.ts +2 -0
- package/src/avatarWrapper/AvatarWrapper.story.tsx +6 -0
- package/src/avatarWrapper/AvatarWrapper.tsx +3 -0
- package/src/badge/Badge.css +6 -5
- package/src/badge/Badge.less +4 -3
- package/src/badge/Badge.tsx +8 -1
- package/src/badge/BadgeAssets.tsx +65 -0
- package/src/badge/index.ts +3 -0
- package/src/common/circle/Circle.css +36 -0
- package/src/common/circle/Circle.less +42 -1
- package/src/common/circle/Circle.tsx +41 -3
- package/src/common/dateUtils/index.ts +0 -1
- package/src/dateLookup/DateLookup.tests.story.tsx +5 -40
- package/src/dateLookup/DateLookup.tsx +11 -9
- package/src/dateLookup/dayCalendar/table/DayCalendarTable.tsx +2 -5
- package/src/decision/Decision.story.tsx +10 -46
- package/src/flowNavigation/FlowNavigation.story.js +10 -39
- package/src/i18n/de.json +5 -0
- package/src/i18n/es.json +5 -0
- package/src/i18n/fr.json +5 -0
- package/src/i18n/hu.json +5 -0
- package/src/i18n/id.json +5 -0
- package/src/i18n/it.json +5 -0
- package/src/i18n/ja.json +5 -0
- package/src/i18n/pl.json +5 -0
- package/src/i18n/pt.json +5 -0
- package/src/i18n/ro.json +5 -0
- package/src/i18n/ru.json +5 -0
- package/src/i18n/tr.json +5 -0
- package/src/index.ts +4 -0
- package/src/listItem/ListItem.story.tsx +6 -43
- package/src/main.css +98 -25
- package/src/main.less +2 -0
- package/src/navigationOption/NavigationOption.story.js +14 -65
- package/src/overlayHeader/OverlayHeader.story.tsx +5 -10
- package/src/radio/Radio.story.tsx +5 -5
- package/src/radioGroup/RadioGroup.story.tsx +3 -3
- package/src/selectOption/SelectOption.story.tsx +31 -30
- package/src/statusIcon/StatusIcon.css +0 -20
- package/src/statusIcon/StatusIcon.less +0 -17
- package/src/statusIcon/StatusIcon.tsx +14 -4
- package/src/tile/Tile.story.tsx +2 -6
- package/build/common/dateUtils/getDateView/getDateView.js +0 -10
- package/build/common/dateUtils/getDateView/getDateView.js.map +0 -1
- package/build/common/dateUtils/getDateView/getDateView.mjs +0 -8
- package/build/common/dateUtils/getDateView/getDateView.mjs.map +0 -1
- package/build/types/common/dateUtils/getDateView/getDateView.d.ts +0 -2
- package/build/types/common/dateUtils/getDateView/getDateView.d.ts.map +0 -1
- package/src/common/dateUtils/getDateView/getDateView.ts +0 -5
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
|
2
|
+
/* eslint-disable react/jsx-key */
|
|
3
|
+
import { clsx } from 'clsx';
|
|
4
|
+
import { CommonProps } from '../common';
|
|
5
|
+
import AvatarView, { AvatarViewProps } from '../avatarView';
|
|
6
|
+
|
|
7
|
+
type AvatarType = { asset?: AvatarViewProps['children'] } & Omit<
|
|
8
|
+
AvatarViewProps,
|
|
9
|
+
'notification' | 'selected' | 'size' | 'badge' | 'action' | 'children'
|
|
10
|
+
>;
|
|
11
|
+
type AvatarGroupOrientation = 'horizontal' | 'diagonal';
|
|
12
|
+
type AvatarGroupDiagonalSize = 24 | 32 | 40 | 48 | 56 | 72;
|
|
13
|
+
type AvatarGroupSize = 16 | AvatarGroupDiagonalSize;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Diagonal orientation sets custom sizes for avatars
|
|
17
|
+
*/
|
|
18
|
+
const avatarGroupDiagonalSizeMap: Record<AvatarGroupDiagonalSize, number> = {
|
|
19
|
+
24: 15,
|
|
20
|
+
32: 20,
|
|
21
|
+
40: 24,
|
|
22
|
+
48: 30,
|
|
23
|
+
56: 34,
|
|
24
|
+
72: 44,
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export type Props = {
|
|
28
|
+
'aria-label'?: string;
|
|
29
|
+
avatars: AvatarType[];
|
|
30
|
+
orientation?: AvatarGroupOrientation;
|
|
31
|
+
size?: AvatarGroupSize;
|
|
32
|
+
interactive?: boolean;
|
|
33
|
+
} & CommonProps;
|
|
34
|
+
|
|
35
|
+
export default function AvatarGroup({
|
|
36
|
+
avatars,
|
|
37
|
+
orientation: orientationProp = 'horizontal',
|
|
38
|
+
size = 48,
|
|
39
|
+
'aria-label': ariaLabel,
|
|
40
|
+
className,
|
|
41
|
+
interactive,
|
|
42
|
+
}: Props) {
|
|
43
|
+
const orientation =
|
|
44
|
+
orientationProp === 'diagonal' && size === 16 ? 'horizontal' : orientationProp;
|
|
45
|
+
const avatarSize = orientation === 'diagonal' ? avatarGroupDiagonalSizeMap[size] : size;
|
|
46
|
+
return (
|
|
47
|
+
<div
|
|
48
|
+
className={clsx('np-avatar-group', `np-avatar-group-${orientation}`, className)}
|
|
49
|
+
// @ts-expect-error `--np-avatar-group-size` exsits in styles of AvatarGroup
|
|
50
|
+
style={{ '--np-avatar-group-size': `${size}px`, '--np-avatar-size': `${avatarSize}px` }}
|
|
51
|
+
aria-label={ariaLabel}
|
|
52
|
+
>
|
|
53
|
+
{avatars.length < 2 || (size === 16 && orientationProp === 'diagonal')
|
|
54
|
+
? null
|
|
55
|
+
: avatars.map((avatar, index) => (
|
|
56
|
+
<div
|
|
57
|
+
className={clsx(
|
|
58
|
+
{ [`np-avatar-group-${orientation}-child`]: index !== 0 },
|
|
59
|
+
{ [`np-avatar-group-${orientation}-mask`]: index !== avatars.length - 1 },
|
|
60
|
+
)}
|
|
61
|
+
style={{
|
|
62
|
+
// @ts-expect-error CSS custom props allowed
|
|
63
|
+
'--np-avatar-group-index': index,
|
|
64
|
+
}}
|
|
65
|
+
>
|
|
66
|
+
<AvatarView
|
|
67
|
+
key={index}
|
|
68
|
+
{...avatar}
|
|
69
|
+
size={avatarSize}
|
|
70
|
+
// @ts-expect-error CSS custom props allowed
|
|
71
|
+
style={{ '--circle-size': `${avatarSize}px`, ...avatar.style }}
|
|
72
|
+
interactive={interactive}
|
|
73
|
+
>
|
|
74
|
+
{avatar.asset}
|
|
75
|
+
</AvatarView>
|
|
76
|
+
</div>
|
|
77
|
+
))}
|
|
78
|
+
</div>
|
|
79
|
+
);
|
|
80
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
.np-notification-dot {
|
|
2
|
+
--np-notification-dot-size: 14px;
|
|
3
|
+
position: relative;
|
|
4
|
+
display: inline-block;
|
|
5
|
+
}
|
|
6
|
+
.np-notification-dot-mask {
|
|
7
|
+
-webkit-mask-image: radial-gradient(circle at bottom calc(100% - (var(--np-notification-dot-size) / 2)) left calc(100% - (var(--np-notification-dot-size) / 2)), transparent 0, transparent calc(var(--np-notification-dot-size) / 2 + var(--np-notification-dot-offset)), black 0);
|
|
8
|
+
mask-image: radial-gradient(circle at bottom calc(100% - (var(--np-notification-dot-size) / 2)) left calc(100% - (var(--np-notification-dot-size) / 2)), transparent 0, transparent calc(var(--np-notification-dot-size) / 2 + var(--np-notification-dot-offset)), black 0);
|
|
9
|
+
-webkit-mask-image: radial-gradient(circle at bottom calc(100% - calc(var(--np-notification-dot-size) / 2)) left calc(100% - calc(var(--np-notification-dot-size) / 2)), transparent 0, transparent calc(var(--np-notification-dot-size) / 2 + var(--np-notification-dot-offset)), black 0);
|
|
10
|
+
mask-image: radial-gradient(circle at bottom calc(100% - calc(var(--np-notification-dot-size) / 2)) left calc(100% - calc(var(--np-notification-dot-size) / 2)), transparent 0, transparent calc(var(--np-notification-dot-size) / 2 + var(--np-notification-dot-offset)), black 0);
|
|
11
|
+
}
|
|
12
|
+
.np-notification-dot-badge {
|
|
13
|
+
position: absolute;
|
|
14
|
+
width: var(--np-notification-dot-size);
|
|
15
|
+
height: var(--np-notification-dot-size);
|
|
16
|
+
background-color: var(--color-sentiment-negative);
|
|
17
|
+
border-radius: 9999px;
|
|
18
|
+
border-radius: var(--radius-full);
|
|
19
|
+
right: 0;
|
|
20
|
+
}
|
|
21
|
+
.np-avatar-view {
|
|
22
|
+
border-radius: 9999px;
|
|
23
|
+
border-radius: var(--radius-full);
|
|
24
|
+
color: var(--color-interactive-primary);
|
|
25
|
+
}
|
|
26
|
+
.np-avatar-view-non-interactive .np-avatar-view-content .wds-flag {
|
|
27
|
+
box-shadow: none;
|
|
28
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
@import './NotificationDot.less';
|
|
2
|
+
|
|
3
|
+
.np-avatar-view {
|
|
4
|
+
border-radius: var(--radius-full);
|
|
5
|
+
color: var(--color-interactive-primary);
|
|
6
|
+
|
|
7
|
+
&-non-interactive {
|
|
8
|
+
.np-avatar-view-content {
|
|
9
|
+
// dismiss broken shadow (DS-6309) on Flag component
|
|
10
|
+
// https://github.com/transferwise/web-art/blob/main/src/flags/Flag.css#L2
|
|
11
|
+
.wds-flag {
|
|
12
|
+
box-shadow: none;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,573 @@
|
|
|
1
|
+
/* eslint-disable react/jsx-key */
|
|
2
|
+
import { Meta, StoryObj } from '@storybook/react';
|
|
3
|
+
import { storyConfig } from '../test-utils';
|
|
4
|
+
import {
|
|
5
|
+
Camera,
|
|
6
|
+
Convert,
|
|
7
|
+
FastFlag,
|
|
8
|
+
Freeze,
|
|
9
|
+
Graph,
|
|
10
|
+
Leaf,
|
|
11
|
+
MassPayout,
|
|
12
|
+
Money,
|
|
13
|
+
Plane,
|
|
14
|
+
PlusCircle,
|
|
15
|
+
QrCode,
|
|
16
|
+
Rewards,
|
|
17
|
+
Target,
|
|
18
|
+
Team,
|
|
19
|
+
Transport,
|
|
20
|
+
Wallet,
|
|
21
|
+
Water,
|
|
22
|
+
} from '@transferwise/icons';
|
|
23
|
+
import { action } from '@storybook/addon-actions';
|
|
24
|
+
import { useState } from 'react';
|
|
25
|
+
import AvatarView, { AvatarViewProps } from '.';
|
|
26
|
+
import { Flag } from '@wise/art';
|
|
27
|
+
import Body from '../body';
|
|
28
|
+
import { getBrandColorFromSeed, getInitials } from '../common';
|
|
29
|
+
import Display from '../display';
|
|
30
|
+
import Image from '../image';
|
|
31
|
+
|
|
32
|
+
export default {
|
|
33
|
+
title: 'Content/AvatarView',
|
|
34
|
+
} satisfies Meta<typeof AvatarView>;
|
|
35
|
+
|
|
36
|
+
type Story = StoryObj<typeof AvatarView>;
|
|
37
|
+
|
|
38
|
+
const profileName1 = 'Wolter White';
|
|
39
|
+
const profileName2 = 'Tyler Durden';
|
|
40
|
+
const sizes: AvatarViewProps['size'][] = [16, 24, 32, 40, 48, 56, 72];
|
|
41
|
+
|
|
42
|
+
export const Selected: Story = storyConfig(
|
|
43
|
+
{
|
|
44
|
+
render: () => {
|
|
45
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
46
|
+
const [selected, setSelected] = useState(true);
|
|
47
|
+
return (
|
|
48
|
+
<div
|
|
49
|
+
style={{
|
|
50
|
+
gap: '1em',
|
|
51
|
+
display: 'grid',
|
|
52
|
+
justifyContent: 'space-between',
|
|
53
|
+
gridTemplate: `auto auto / repeat(${sizes.length}, min-content)`,
|
|
54
|
+
}}
|
|
55
|
+
>
|
|
56
|
+
{sizes.map((size) => (
|
|
57
|
+
<AvatarView key={size} size={size} selected={selected}>
|
|
58
|
+
<Freeze />
|
|
59
|
+
</AvatarView>
|
|
60
|
+
))}
|
|
61
|
+
{sizes.map((size) => (
|
|
62
|
+
<AvatarView
|
|
63
|
+
key={size}
|
|
64
|
+
size={size}
|
|
65
|
+
selected={selected}
|
|
66
|
+
action={{
|
|
67
|
+
onClick: () => {
|
|
68
|
+
action('interactive avatar');
|
|
69
|
+
setSelected(!selected);
|
|
70
|
+
},
|
|
71
|
+
}}
|
|
72
|
+
>
|
|
73
|
+
<Freeze />
|
|
74
|
+
</AvatarView>
|
|
75
|
+
))}
|
|
76
|
+
|
|
77
|
+
{sizes.map((size) => (
|
|
78
|
+
<AvatarView key={size} size={size} selected={selected}>
|
|
79
|
+
<Image src="../avatar-square-dude.webp" alt="avatar" />
|
|
80
|
+
</AvatarView>
|
|
81
|
+
))}
|
|
82
|
+
{sizes.map((size) => (
|
|
83
|
+
<AvatarView
|
|
84
|
+
key={size}
|
|
85
|
+
size={size}
|
|
86
|
+
imgSrc="../avatar-square-dude.webp"
|
|
87
|
+
selected={selected}
|
|
88
|
+
action={{
|
|
89
|
+
onClick: () => {
|
|
90
|
+
action('interactive avatar');
|
|
91
|
+
setSelected(!selected);
|
|
92
|
+
},
|
|
93
|
+
}}
|
|
94
|
+
/>
|
|
95
|
+
))}
|
|
96
|
+
</div>
|
|
97
|
+
);
|
|
98
|
+
},
|
|
99
|
+
},
|
|
100
|
+
{ variants: ['light', 'dark'] },
|
|
101
|
+
);
|
|
102
|
+
|
|
103
|
+
export const Notification: Story = storyConfig(
|
|
104
|
+
{
|
|
105
|
+
render: () => (
|
|
106
|
+
<div
|
|
107
|
+
style={{
|
|
108
|
+
gap: '1em',
|
|
109
|
+
display: 'grid',
|
|
110
|
+
justifyContent: 'space-between',
|
|
111
|
+
gridTemplate: `auto auto / repeat(${sizes.length}, min-content)`,
|
|
112
|
+
}}
|
|
113
|
+
>
|
|
114
|
+
{sizes.map((size) => (
|
|
115
|
+
<AvatarView key={size} size={size} notification>
|
|
116
|
+
<Freeze />
|
|
117
|
+
</AvatarView>
|
|
118
|
+
))}
|
|
119
|
+
{sizes.map((size) => (
|
|
120
|
+
<AvatarView
|
|
121
|
+
key={size}
|
|
122
|
+
size={size}
|
|
123
|
+
notification
|
|
124
|
+
action={{
|
|
125
|
+
onClick: () => action('interactive avatar'),
|
|
126
|
+
}}
|
|
127
|
+
>
|
|
128
|
+
<Freeze />
|
|
129
|
+
</AvatarView>
|
|
130
|
+
))}
|
|
131
|
+
|
|
132
|
+
{sizes.map((size) => (
|
|
133
|
+
<AvatarView key={size} size={size} notification action={{ href: '#' }}>
|
|
134
|
+
<Freeze />
|
|
135
|
+
</AvatarView>
|
|
136
|
+
))}
|
|
137
|
+
</div>
|
|
138
|
+
),
|
|
139
|
+
},
|
|
140
|
+
{ variants: ['light', 'dark'] },
|
|
141
|
+
);
|
|
142
|
+
|
|
143
|
+
export const Badge: Story = storyConfig(
|
|
144
|
+
{
|
|
145
|
+
render: () => {
|
|
146
|
+
const currencies = ['USD', 'EUR', 'GBP', 'AUD', 'CAD', 'JPY', 'CNY'];
|
|
147
|
+
const icons = [
|
|
148
|
+
<Plane />,
|
|
149
|
+
<QrCode />,
|
|
150
|
+
<Target />,
|
|
151
|
+
<Transport />,
|
|
152
|
+
<Wallet />,
|
|
153
|
+
<Water />,
|
|
154
|
+
<Team />,
|
|
155
|
+
];
|
|
156
|
+
return (
|
|
157
|
+
<div
|
|
158
|
+
style={{
|
|
159
|
+
gap: '1em',
|
|
160
|
+
display: 'grid',
|
|
161
|
+
justifyContent: 'space-between',
|
|
162
|
+
gridTemplate: 'auto auto / repeat(7, min-content)',
|
|
163
|
+
}}
|
|
164
|
+
>
|
|
165
|
+
{sizes.map((size, index) => (
|
|
166
|
+
<AvatarView key={size} size={size} badge={{ flagCode: currencies[index] }}>
|
|
167
|
+
{icons[index]}
|
|
168
|
+
</AvatarView>
|
|
169
|
+
))}
|
|
170
|
+
|
|
171
|
+
{sizes.map((size, index) => (
|
|
172
|
+
<AvatarView
|
|
173
|
+
key={size}
|
|
174
|
+
size={size}
|
|
175
|
+
imgSrc="../avatar-rectangle-fox.webp"
|
|
176
|
+
badge={{ imgSrc: '../tapestry-01.png' }}
|
|
177
|
+
/>
|
|
178
|
+
))}
|
|
179
|
+
|
|
180
|
+
{sizes.map((size, index) => (
|
|
181
|
+
<AvatarView
|
|
182
|
+
key={size}
|
|
183
|
+
size={size}
|
|
184
|
+
imgSrc="../avatar-square-dude.webp"
|
|
185
|
+
badge={{ imgSrc: '../tapestry-01.png' }}
|
|
186
|
+
/>
|
|
187
|
+
))}
|
|
188
|
+
|
|
189
|
+
{sizes.map((size, index) => (
|
|
190
|
+
<AvatarView key={size} size={size} badge={{ imgSrc: '../tapestry-01.png' }}>
|
|
191
|
+
{icons[index]}
|
|
192
|
+
</AvatarView>
|
|
193
|
+
))}
|
|
194
|
+
|
|
195
|
+
{sizes.map((size, index) => (
|
|
196
|
+
<AvatarView key={size} size={size} badge={{ status: 'warning' }}>
|
|
197
|
+
{icons[index]}
|
|
198
|
+
</AvatarView>
|
|
199
|
+
))}
|
|
200
|
+
|
|
201
|
+
{sizes.map((size, index) => (
|
|
202
|
+
<AvatarView key={size} size={size} badge={{ status: 'neutral' }}>
|
|
203
|
+
{icons[index]}
|
|
204
|
+
</AvatarView>
|
|
205
|
+
))}
|
|
206
|
+
|
|
207
|
+
{sizes.map((size, index) => (
|
|
208
|
+
<AvatarView key={size} size={size} badge={{ status: 'negative' }}>
|
|
209
|
+
{icons[index]}
|
|
210
|
+
</AvatarView>
|
|
211
|
+
))}
|
|
212
|
+
|
|
213
|
+
{sizes.map((size, index) => (
|
|
214
|
+
<AvatarView key={size} size={size} badge={{ icon: <FastFlag /> }}>
|
|
215
|
+
{icons[index]}
|
|
216
|
+
</AvatarView>
|
|
217
|
+
))}
|
|
218
|
+
|
|
219
|
+
{sizes.map((size, index) => (
|
|
220
|
+
<AvatarView key={size} size={size} badge={{ type: 'reference' }}>
|
|
221
|
+
{icons[index]}
|
|
222
|
+
</AvatarView>
|
|
223
|
+
))}
|
|
224
|
+
|
|
225
|
+
{sizes.map((size, index) => (
|
|
226
|
+
<AvatarView key={size} size={size} badge={{ type: 'action' }}>
|
|
227
|
+
{icons[index]}
|
|
228
|
+
</AvatarView>
|
|
229
|
+
))}
|
|
230
|
+
|
|
231
|
+
{sizes.map((size) => (
|
|
232
|
+
<AvatarView
|
|
233
|
+
key={size}
|
|
234
|
+
size={size}
|
|
235
|
+
imgSrc="../avatar-square-dude.webp"
|
|
236
|
+
badge={{ type: 'action', icon: <Camera /> }}
|
|
237
|
+
/>
|
|
238
|
+
))}
|
|
239
|
+
|
|
240
|
+
{sizes.map((size) => (
|
|
241
|
+
<AvatarView
|
|
242
|
+
key={size}
|
|
243
|
+
size={size}
|
|
244
|
+
imgSrc="../avatar-square-dude.webp"
|
|
245
|
+
badge={{ type: 'reference', icon: <Convert /> }}
|
|
246
|
+
/>
|
|
247
|
+
))}
|
|
248
|
+
|
|
249
|
+
{sizes.map((size) => (
|
|
250
|
+
<AvatarView
|
|
251
|
+
key={size}
|
|
252
|
+
size={size}
|
|
253
|
+
imgSrc="../avatar-square-dude.webp"
|
|
254
|
+
badge={{ icon: <Convert /> }}
|
|
255
|
+
/>
|
|
256
|
+
))}
|
|
257
|
+
</div>
|
|
258
|
+
);
|
|
259
|
+
},
|
|
260
|
+
},
|
|
261
|
+
{ variants: ['light', 'dark'] },
|
|
262
|
+
);
|
|
263
|
+
|
|
264
|
+
export const Interactive: Story = storyConfig(
|
|
265
|
+
{
|
|
266
|
+
render: () => {
|
|
267
|
+
return (
|
|
268
|
+
<div
|
|
269
|
+
style={{
|
|
270
|
+
gap: '1em',
|
|
271
|
+
display: 'grid',
|
|
272
|
+
justifyContent: 'space-between',
|
|
273
|
+
gridTemplate: 'auto auto / repeat(2, min-content)',
|
|
274
|
+
}}
|
|
275
|
+
>
|
|
276
|
+
<Body type="body-large-bold">Button</Body>
|
|
277
|
+
<Body type="body-large-bold">Link</Body>
|
|
278
|
+
|
|
279
|
+
<AvatarView action={{ onClick: action('onClick') }} imgSrc="../avatar-square-dude.webp" />
|
|
280
|
+
|
|
281
|
+
<AvatarView action={{ href: '#' }} imgSrc="../avatar-square-dude.webp" />
|
|
282
|
+
|
|
283
|
+
<AvatarView
|
|
284
|
+
action={{ onClick: action('onClick') }}
|
|
285
|
+
badge={{ flagCode: 'EU' }}
|
|
286
|
+
imgSrc="../avatar-square-dude.webp"
|
|
287
|
+
name="Test Name"
|
|
288
|
+
/>
|
|
289
|
+
|
|
290
|
+
<AvatarView
|
|
291
|
+
action={{ href: '#' }}
|
|
292
|
+
badge={{ flagCode: 'EU' }}
|
|
293
|
+
imgSrc="../avatar-square-dude.webp"
|
|
294
|
+
name="Test Name"
|
|
295
|
+
/>
|
|
296
|
+
|
|
297
|
+
<AvatarView action={{ onClick: action('onClick') }} name="Test Name" />
|
|
298
|
+
|
|
299
|
+
<AvatarView action={{ href: '#' }} name="Test Name" />
|
|
300
|
+
|
|
301
|
+
<AvatarView
|
|
302
|
+
action={{ onClick: action('onClick') }}
|
|
303
|
+
badge={{ flagCode: 'EU' }}
|
|
304
|
+
name="Test Name"
|
|
305
|
+
/>
|
|
306
|
+
|
|
307
|
+
<AvatarView action={{ href: '#' }} badge={{ flagCode: 'EU' }} name="Test Name" />
|
|
308
|
+
|
|
309
|
+
<AvatarView action={{ onClick: action('onClick') }}>
|
|
310
|
+
<Leaf />
|
|
311
|
+
</AvatarView>
|
|
312
|
+
|
|
313
|
+
<AvatarView action={{ href: '#' }}>
|
|
314
|
+
<Leaf />
|
|
315
|
+
</AvatarView>
|
|
316
|
+
|
|
317
|
+
<AvatarView action={{ onClick: action('onClick') }} badge={{ flagCode: 'EU' }}>
|
|
318
|
+
<Leaf />
|
|
319
|
+
</AvatarView>
|
|
320
|
+
|
|
321
|
+
<AvatarView action={{ href: '#' }} badge={{ flagCode: 'EU' }}>
|
|
322
|
+
<Leaf />
|
|
323
|
+
</AvatarView>
|
|
324
|
+
</div>
|
|
325
|
+
);
|
|
326
|
+
},
|
|
327
|
+
},
|
|
328
|
+
{ variants: ['light', 'dark'] },
|
|
329
|
+
);
|
|
330
|
+
|
|
331
|
+
export const Images: Story = storyConfig(
|
|
332
|
+
{
|
|
333
|
+
render: () => {
|
|
334
|
+
return (
|
|
335
|
+
<div
|
|
336
|
+
style={{
|
|
337
|
+
gap: '1em',
|
|
338
|
+
display: 'grid',
|
|
339
|
+
justifyContent: 'space-between',
|
|
340
|
+
gridTemplate: 'auto auto / repeat(7, min-content)',
|
|
341
|
+
}}
|
|
342
|
+
>
|
|
343
|
+
{/* interactive image */}
|
|
344
|
+
{sizes.map((size) => (
|
|
345
|
+
<AvatarView
|
|
346
|
+
key={size}
|
|
347
|
+
size={size}
|
|
348
|
+
action={{ onClick: action('onClick') }}
|
|
349
|
+
imgSrc="../avatar-square-dude.webp"
|
|
350
|
+
name="Test Name"
|
|
351
|
+
type="business"
|
|
352
|
+
/>
|
|
353
|
+
))}
|
|
354
|
+
{/* non interactive image */}
|
|
355
|
+
{sizes.map((size) => (
|
|
356
|
+
<AvatarView
|
|
357
|
+
key={size}
|
|
358
|
+
size={size}
|
|
359
|
+
imgSrc="../avatar-square-dude.webp"
|
|
360
|
+
name="Test Name"
|
|
361
|
+
type="business"
|
|
362
|
+
/>
|
|
363
|
+
))}
|
|
364
|
+
{/* Flag as an image + interactive */}
|
|
365
|
+
{sizes.map((size) => (
|
|
366
|
+
<AvatarView key={size} size={size} action={{ onClick: action('onClick') }}>
|
|
367
|
+
<Flag code="JPY" intrinsicSize={size} />
|
|
368
|
+
</AvatarView>
|
|
369
|
+
))}
|
|
370
|
+
{/* Flag as an image + non interactive */}
|
|
371
|
+
{sizes.map((size) => (
|
|
372
|
+
<AvatarView key={size} size={size}>
|
|
373
|
+
<Flag code="JPY" intrinsicSize={size} />
|
|
374
|
+
</AvatarView>
|
|
375
|
+
))}
|
|
376
|
+
{/* Custom image + interactive */}
|
|
377
|
+
{sizes.map((size) => (
|
|
378
|
+
<AvatarView
|
|
379
|
+
key={size}
|
|
380
|
+
imgSrc="../avatar-rectangle-fox.webp"
|
|
381
|
+
size={size}
|
|
382
|
+
action={{ onClick: action('onClick') }}
|
|
383
|
+
/>
|
|
384
|
+
))}
|
|
385
|
+
{/* Custom image + non interactive */}
|
|
386
|
+
{sizes.map((size) => (
|
|
387
|
+
<AvatarView key={size} size={size} imgSrc="../avatar-rectangle-fox.webp" />
|
|
388
|
+
))}
|
|
389
|
+
</div>
|
|
390
|
+
);
|
|
391
|
+
},
|
|
392
|
+
},
|
|
393
|
+
{ variants: ['light', 'dark'] },
|
|
394
|
+
);
|
|
395
|
+
|
|
396
|
+
export const Profiles: Story = storyConfig(
|
|
397
|
+
{
|
|
398
|
+
render: () => {
|
|
399
|
+
return (
|
|
400
|
+
<div
|
|
401
|
+
style={{
|
|
402
|
+
gap: '1em',
|
|
403
|
+
display: 'grid',
|
|
404
|
+
justifyContent: 'space-between',
|
|
405
|
+
gridTemplate: 'auto auto / repeat(7, min-content)',
|
|
406
|
+
}}
|
|
407
|
+
>
|
|
408
|
+
{sizes.map((size) => (
|
|
409
|
+
<AvatarView
|
|
410
|
+
key={size}
|
|
411
|
+
size={size}
|
|
412
|
+
imgSrc="../avatar-square-dude.webp"
|
|
413
|
+
name="Test Name"
|
|
414
|
+
type="business"
|
|
415
|
+
/>
|
|
416
|
+
))}
|
|
417
|
+
|
|
418
|
+
{sizes.map((size) => (
|
|
419
|
+
<AvatarView
|
|
420
|
+
key={size}
|
|
421
|
+
size={size}
|
|
422
|
+
action={{ onClick: action('onClick') }}
|
|
423
|
+
imgSrc="../avatar-square-dude.webp"
|
|
424
|
+
name="Test Name"
|
|
425
|
+
type="business"
|
|
426
|
+
/>
|
|
427
|
+
))}
|
|
428
|
+
|
|
429
|
+
{sizes.map((size) => (
|
|
430
|
+
<AvatarView key={size} size={size} name="Test Name" />
|
|
431
|
+
))}
|
|
432
|
+
|
|
433
|
+
{sizes.map((size) => (
|
|
434
|
+
<AvatarView
|
|
435
|
+
key={size}
|
|
436
|
+
size={size}
|
|
437
|
+
action={{ onClick: action('onClick') }}
|
|
438
|
+
name="Test Name"
|
|
439
|
+
/>
|
|
440
|
+
))}
|
|
441
|
+
|
|
442
|
+
{sizes.map((size) => (
|
|
443
|
+
<AvatarView key={size} size={size} type="business" />
|
|
444
|
+
))}
|
|
445
|
+
|
|
446
|
+
{sizes.map((size) => (
|
|
447
|
+
<AvatarView
|
|
448
|
+
key={size}
|
|
449
|
+
size={size}
|
|
450
|
+
action={{ onClick: action('onClick') }}
|
|
451
|
+
type="business"
|
|
452
|
+
/>
|
|
453
|
+
))}
|
|
454
|
+
|
|
455
|
+
{sizes.map((size) => (
|
|
456
|
+
<AvatarView key={size} size={size} />
|
|
457
|
+
))}
|
|
458
|
+
|
|
459
|
+
{sizes.map((size) => (
|
|
460
|
+
<AvatarView key={size} size={size} action={{ onClick: action('onClick') }} />
|
|
461
|
+
))}
|
|
462
|
+
</div>
|
|
463
|
+
);
|
|
464
|
+
},
|
|
465
|
+
},
|
|
466
|
+
{ variants: ['light', 'dark'] },
|
|
467
|
+
);
|
|
468
|
+
|
|
469
|
+
export const ProfileBrokenImageFallback: Story = {
|
|
470
|
+
render: () => (
|
|
471
|
+
<>
|
|
472
|
+
<AvatarView imgSrc="../img-wrong-url.lol" />
|
|
473
|
+
<AvatarView imgSrc="../img-wrong-url.lol" type="business" />
|
|
474
|
+
<AvatarView imgSrc="../img-wrong-url.lol" type="business" name="D D" />
|
|
475
|
+
</>
|
|
476
|
+
),
|
|
477
|
+
};
|
|
478
|
+
|
|
479
|
+
export const EdgeInstaces: Story = {
|
|
480
|
+
render: () => {
|
|
481
|
+
const css = `.custom-variant {
|
|
482
|
+
border: 1px dashed var(--color-border-neutral);
|
|
483
|
+
}`;
|
|
484
|
+
return (
|
|
485
|
+
<div
|
|
486
|
+
style={{
|
|
487
|
+
gap: '1em',
|
|
488
|
+
display: 'grid',
|
|
489
|
+
justifyContent: 'space-between',
|
|
490
|
+
gridTemplate: 'auto auto / repeat(2, min-content)',
|
|
491
|
+
}}
|
|
492
|
+
>
|
|
493
|
+
<style>{css}</style>
|
|
494
|
+
{/* <Body>- Custom colors</Body> */}
|
|
495
|
+
<AvatarView
|
|
496
|
+
action={{ onClick: action('onClick') }}
|
|
497
|
+
badge={{ flagCode: 'EU' }}
|
|
498
|
+
style={{ backgroundColor: 'var(--color-bright-orange)' }}
|
|
499
|
+
>
|
|
500
|
+
<Money />
|
|
501
|
+
</AvatarView>
|
|
502
|
+
<AvatarView
|
|
503
|
+
badge={{ flagCode: 'EU' }}
|
|
504
|
+
style={{ backgroundColor: 'var(--color-bright-orange)', border: 'none' }}
|
|
505
|
+
>
|
|
506
|
+
<Money />
|
|
507
|
+
</AvatarView>
|
|
508
|
+
{/* <Body>- Add example with dashed avatar as in shared balances</Body> */}
|
|
509
|
+
<AvatarView action={{ onClick: action('onClick') }} className="custom-variant">
|
|
510
|
+
<PlusCircle />
|
|
511
|
+
</AvatarView>
|
|
512
|
+
<AvatarView action={{ href: '#' }} className="custom-variant">
|
|
513
|
+
<PlusCircle />
|
|
514
|
+
</AvatarView>
|
|
515
|
+
<AvatarView action={{ href: '#' }} className="custom-variant">
|
|
516
|
+
{null}
|
|
517
|
+
</AvatarView>
|
|
518
|
+
{/* <Body> - Add example custom backgrounds as in account summary (https://wise.com/account-summary)</Body> */}
|
|
519
|
+
<AvatarView style={{ backgroundColor: 'rgb(203, 217, 195)' }}>
|
|
520
|
+
<span style={{ color: 'rgb(22, 51, 0)' }}>
|
|
521
|
+
<Graph />
|
|
522
|
+
</span>
|
|
523
|
+
</AvatarView>
|
|
524
|
+
<AvatarView
|
|
525
|
+
action={{ onClick: action('onClikc') }}
|
|
526
|
+
style={{ backgroundColor: 'rgb(203, 217, 195)' }}
|
|
527
|
+
>
|
|
528
|
+
<span style={{ color: 'rgb(22, 51, 0)' }}>
|
|
529
|
+
<Graph />
|
|
530
|
+
</span>
|
|
531
|
+
</AvatarView>
|
|
532
|
+
<AvatarView style={{ backgroundColor: 'rgb(22, 51, 0)' }}>
|
|
533
|
+
<span style={{ color: 'rgb(203, 217, 195)' }}>
|
|
534
|
+
<Rewards />
|
|
535
|
+
</span>
|
|
536
|
+
</AvatarView>
|
|
537
|
+
<AvatarView
|
|
538
|
+
action={{ onClick: action('onClikc') }}
|
|
539
|
+
style={{ backgroundColor: 'rgb(22, 51, 0)' }}
|
|
540
|
+
>
|
|
541
|
+
<span style={{ color: 'rgb(203, 217, 195)' }}>
|
|
542
|
+
<Rewards />
|
|
543
|
+
</span>
|
|
544
|
+
</AvatarView>
|
|
545
|
+
{/* <Body>- Add example Wise Sand + custom background from hash</Body> */}
|
|
546
|
+
<AvatarView
|
|
547
|
+
badge={{ flagCode: 'EU' }}
|
|
548
|
+
style={{ backgroundColor: getBrandColorFromSeed(profileName1) }}
|
|
549
|
+
>
|
|
550
|
+
<Display>{getInitials(profileName1)}</Display>
|
|
551
|
+
</AvatarView>
|
|
552
|
+
<AvatarView style={{ backgroundColor: getBrandColorFromSeed(profileName1) }}>
|
|
553
|
+
<Display>{getInitials(profileName1)}</Display>
|
|
554
|
+
</AvatarView>
|
|
555
|
+
<AvatarView
|
|
556
|
+
action={{ onClick: action('onClick') }}
|
|
557
|
+
style={{ backgroundColor: getBrandColorFromSeed(profileName2) }}
|
|
558
|
+
>
|
|
559
|
+
<Display>{getInitials(profileName1)}</Display>
|
|
560
|
+
</AvatarView>
|
|
561
|
+
<AvatarView
|
|
562
|
+
action={{ href: '#' }}
|
|
563
|
+
badge={{ flagCode: 'EU' }}
|
|
564
|
+
style={{ backgroundColor: getBrandColorFromSeed(profileName2) }}
|
|
565
|
+
>
|
|
566
|
+
<Display>{getInitials(profileName1)}</Display>
|
|
567
|
+
</AvatarView>
|
|
568
|
+
<AvatarView>9+</AvatarView>
|
|
569
|
+
<AvatarView action={{ href: '#' }}>5+</AvatarView>
|
|
570
|
+
</div>
|
|
571
|
+
);
|
|
572
|
+
},
|
|
573
|
+
};
|