@transferwise/components 0.0.0-experimental-eec707b → 0.0.0-experimental-dc27730
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/index.esm.js +29 -90
- package/build/index.esm.js.map +1 -1
- package/build/index.js +32 -93
- package/build/index.js.map +1 -1
- package/build/types/avatarWrapper/AvatarWrapper.d.ts +18 -28
- package/build/types/avatarWrapper/AvatarWrapper.d.ts.map +1 -1
- package/build/types/avatarWrapper/index.d.ts +1 -1
- package/build/types/avatarWrapper/index.d.ts.map +1 -1
- package/build/types/badge/Badge.d.ts +2 -2
- package/build/types/badge/Badge.d.ts.map +1 -1
- package/build/types/badge/index.d.ts +2 -1
- package/build/types/badge/index.d.ts.map +1 -1
- package/build/types/common/index.d.ts +1 -1
- package/build/types/common/propsValues/profileType.d.ts +2 -0
- package/build/types/common/propsValues/profileType.d.ts.map +1 -1
- package/build/types/common/propsValues/sentiment.d.ts +1 -0
- package/build/types/common/propsValues/sentiment.d.ts.map +1 -1
- package/build/types/image/Image.d.ts +17 -21
- package/build/types/image/Image.d.ts.map +1 -1
- package/build/types/image/index.d.ts +1 -1
- package/build/types/image/index.d.ts.map +1 -1
- package/build/types/inlineAlert/InlineAlert.d.ts +12 -15
- package/build/types/inlineAlert/InlineAlert.d.ts.map +1 -1
- package/build/types/inlineAlert/index.d.ts +1 -1
- package/build/types/inlineAlert/index.d.ts.map +1 -1
- package/build/types/promoCard/PromoCard.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/avatarWrapper/AvatarWrapper.spec.tsx +105 -0
- package/src/avatarWrapper/AvatarWrapper.story.tsx +1 -41
- package/src/avatarWrapper/{AvatarWrapper.js → AvatarWrapper.tsx} +25 -56
- package/src/avatarWrapper/__snapshots__/{AvatarWrapper.spec.js.snap → AvatarWrapper.spec.tsx.snap} +76 -76
- package/src/badge/Badge.tsx +2 -2
- package/src/badge/index.ts +2 -0
- package/src/common/index.js +1 -1
- package/src/common/propsValues/profileType.ts +3 -0
- package/src/common/propsValues/sentiment.ts +10 -0
- package/src/image/{Image.spec.js → Image.spec.tsx} +5 -5
- package/src/image/{Image.story.js → Image.story.tsx} +3 -3
- package/src/image/Image.tsx +65 -0
- package/src/inlineAlert/{InlineAlert.story.js → InlineAlert.story.tsx} +3 -2
- package/src/inlineAlert/InlineAlert.tsx +59 -0
- package/src/promoCard/PromoCard.tsx +1 -6
- package/src/promoCard/__snapshots__/PromoCardGroup.spec.tsx.snap +2 -2
- package/src/avatarWrapper/AvatarWrapper.spec.js +0 -81
- package/src/badge/index.js +0 -1
- package/src/image/Image.js +0 -78
- package/src/inlineAlert/InlineAlert.js +0 -62
- /package/src/avatarWrapper/{index.js → index.ts} +0 -0
- /package/src/image/{index.js → index.ts} +0 -0
- /package/src/inlineAlert/{InlineAlert.spec.js → InlineAlert.spec.tsx} +0 -0
- /package/src/inlineAlert/{index.js → index.ts} +0 -0
|
@@ -1,28 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
badgeStatusIcon?: AvatarWrapperBadgeStatusIcon;
|
|
20
|
-
name?: string;
|
|
21
|
-
avatarProps?: AvatarWrapperAvatarProps;
|
|
22
|
-
badgeProps?: AvatarWrapperBadgeProps;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
declare const AvatarWrapper: React.FC<AvatarWrapperProps>;
|
|
26
|
-
|
|
27
|
-
export default AvatarWrapper;
|
|
28
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { AvatarProps } from '../avatar';
|
|
3
|
+
import { BadgeProps } from '../badge';
|
|
4
|
+
import { ProfileTypePersonal, ProfileTypeBusiness, Sentiment } from '../common';
|
|
5
|
+
export interface AvatarWrapperProps {
|
|
6
|
+
url?: string;
|
|
7
|
+
profileType?: ProfileTypeBusiness | ProfileTypePersonal;
|
|
8
|
+
profileId?: string;
|
|
9
|
+
badgeUrl?: string;
|
|
10
|
+
badgeAltText?: string;
|
|
11
|
+
badgeStatusIcon?: Sentiment;
|
|
12
|
+
name?: string;
|
|
13
|
+
avatarProps?: AvatarProps;
|
|
14
|
+
badgeProps?: BadgeProps;
|
|
15
|
+
}
|
|
16
|
+
declare const AvatarWrapper: ({ url, profileType, profileId, badgeUrl, badgeAltText, badgeStatusIcon, name, avatarProps, badgeProps, }: AvatarWrapperProps) => import("react").JSX.Element;
|
|
17
|
+
export default AvatarWrapper;
|
|
18
|
+
//# sourceMappingURL=AvatarWrapper.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AvatarWrapper.d.ts","sourceRoot":"","sources":["../../../src/avatarWrapper/AvatarWrapper.
|
|
1
|
+
{"version":3,"file":"AvatarWrapper.d.ts","sourceRoot":"","sources":["../../../src/avatarWrapper/AvatarWrapper.tsx"],"names":[],"mappings":";AAGA,OAAe,EAAE,WAAW,EAAc,MAAM,WAAW,CAAC;AAC5D,OAAc,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAe,mBAAmB,EAAE,mBAAmB,EAAQ,SAAS,EAAE,MAAM,WAAW,CAAC;AA4BnG,MAAM,WAAW,kBAAkB;IACjC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,mBAAmB,GAAG,mBAAmB,CAAC;IACxD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,eAAe,CAAC,EAAE,SAAS,CAAC;IAC5B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,UAAU,CAAC,EAAE,UAAU,CAAC;CACzB;AAED,QAAA,MAAM,aAAa,6GAUhB,kBAAkB,gCA+CpB,CAAC;AAgBF,eAAe,aAAa,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/avatarWrapper/index.
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/avatarWrapper/index.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,MAAM,iBAAiB,CAAC;AAE5C,eAAe,aAAa,CAAC"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { ReactElement, ReactNode } from 'react';
|
|
2
2
|
import { SizeSmall, SizeMedium, SizeLarge, ThemeDark, ThemeLight, CommonProps } from '../common';
|
|
3
|
-
type
|
|
3
|
+
export type BadgeProps = {
|
|
4
4
|
badge: ReactNode;
|
|
5
5
|
children: ReactNode;
|
|
6
6
|
size?: SizeSmall | SizeMedium | SizeLarge;
|
|
7
7
|
border?: ThemeDark | ThemeLight;
|
|
8
8
|
} & CommonProps;
|
|
9
|
-
declare const Badge: ({ badge, className, size, border, children, }:
|
|
9
|
+
declare const Badge: ({ badge, className, size, border, children, }: BadgeProps) => ReactElement;
|
|
10
10
|
export default Badge;
|
|
11
11
|
//# sourceMappingURL=Badge.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Badge.d.ts","sourceRoot":"","sources":["../../../src/badge/Badge.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEhD,OAAO,EAGL,SAAS,EACT,UAAU,EACV,SAAS,EACT,SAAS,EACT,UAAU,EACV,WAAW,EACZ,MAAM,WAAW,CAAC;AAEnB,
|
|
1
|
+
{"version":3,"file":"Badge.d.ts","sourceRoot":"","sources":["../../../src/badge/Badge.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEhD,OAAO,EAGL,SAAS,EACT,UAAU,EACV,SAAS,EACT,SAAS,EACT,UAAU,EACV,WAAW,EACZ,MAAM,WAAW,CAAC;AAEnB,MAAM,MAAM,UAAU,GAAG;IACvB,KAAK,EAAE,SAAS,CAAC;IACjB,QAAQ,EAAE,SAAS,CAAC;IACpB,IAAI,CAAC,EAAE,SAAS,GAAG,UAAU,GAAG,SAAS,CAAC;IAC1C,MAAM,CAAC,EAAE,SAAS,GAAG,UAAU,CAAC;CACjC,GAAG,WAAW,CAAC;AAEhB,QAAA,MAAM,KAAK,kDAMR,UAAU,KAAG,YAgBf,CAAC;AAEF,eAAe,KAAK,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/badge/index.
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/badge/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,YAAY,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -8,6 +8,7 @@ export * from "./propsValues/typography";
|
|
|
8
8
|
export * from "./propsValues/width";
|
|
9
9
|
export * from "./propsValues/position";
|
|
10
10
|
export * from "./propsValues/status";
|
|
11
|
+
export * from "./propsValues/profileType";
|
|
11
12
|
export * from "./propsValues/scroll";
|
|
12
13
|
export * from "./locale";
|
|
13
14
|
export * from "./commonProps";
|
|
@@ -17,7 +18,6 @@ export { DateMode } from "./propsValues/dateMode";
|
|
|
17
18
|
export { MonthFormat } from "./propsValues/monthFormat";
|
|
18
19
|
export { Layout } from "./propsValues/layouts";
|
|
19
20
|
export { Sentiment } from "./propsValues/sentiment";
|
|
20
|
-
export { ProfileType } from "./propsValues/profileType";
|
|
21
21
|
export { Variant } from "./propsValues/variant";
|
|
22
22
|
export { MarkdownNodeType } from "./propsValues/markdownNodeType";
|
|
23
23
|
export { FileType } from "./fileType";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"profileType.d.ts","sourceRoot":"","sources":["../../../../src/common/propsValues/profileType.ts"],"names":[],"mappings":"AAAA,oBAAY,WAAW;IACrB,QAAQ,aAAa;IACrB,QAAQ,aAAa;CACtB"}
|
|
1
|
+
{"version":3,"file":"profileType.d.ts","sourceRoot":"","sources":["../../../../src/common/propsValues/profileType.ts"],"names":[],"mappings":"AAAA,oBAAY,WAAW;IACrB,QAAQ,aAAa;IACrB,QAAQ,aAAa;CACtB;AAED,MAAM,MAAM,mBAAmB,GAAG,UAAU,CAAC;AAC7C,MAAM,MAAM,mBAAmB,GAAG,UAAU,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sentiment.d.ts","sourceRoot":"","sources":["../../../../src/common/propsValues/sentiment.ts"],"names":[],"mappings":"AAAA,oBAAY,SAAS;IACnB,QAAQ,aAAa;IACrB,OAAO,YAAY;IACnB,QAAQ,aAAa;IACrB,OAAO,YAAY;IACnB,OAAO,YAAY;IAEnB;;OAEG;IACH,IAAI,SAAS;IACb;;OAEG;IACH,KAAK,UAAU;IACf;;OAEG;IACH,OAAO,YAAY;CACpB"}
|
|
1
|
+
{"version":3,"file":"sentiment.d.ts","sourceRoot":"","sources":["../../../../src/common/propsValues/sentiment.ts"],"names":[],"mappings":"AAAA,oBAAY,SAAS;IACnB,QAAQ,aAAa;IACrB,OAAO,YAAY;IACnB,QAAQ,aAAa;IACrB,OAAO,YAAY;IACnB,OAAO,YAAY;IAEnB;;OAEG;IACH,IAAI,SAAS;IACb;;OAEG;IACH,KAAK,UAAU;IACf;;OAEG;IACH,OAAO,YAAY;CACpB;AAED,MAAM,MAAM,eAAe,GACvB,UAAU,GACV,SAAS,GACT,UAAU,GACV,SAAS,GACT,SAAS,GACT,MAAM,GACN,OAAO,GACP,SAAS,CAAC"}
|
|
@@ -1,21 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
declare const Image: React.FC<ImageProps>;
|
|
19
|
-
|
|
20
|
-
export default Image;
|
|
21
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export interface ImageProps {
|
|
3
|
+
alt: string;
|
|
4
|
+
src: string;
|
|
5
|
+
id?: string;
|
|
6
|
+
onLoad?: () => void;
|
|
7
|
+
onError?: () => void;
|
|
8
|
+
className?: string;
|
|
9
|
+
loading?: 'lazy' | 'eager';
|
|
10
|
+
stretch?: boolean;
|
|
11
|
+
role?: string;
|
|
12
|
+
shrink?: boolean;
|
|
13
|
+
}
|
|
14
|
+
export declare const EmptyTransparentImage = "data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==";
|
|
15
|
+
declare const Image: ({ id, src, alt, onLoad, onError, className, loading, stretch, role, shrink, }: ImageProps) => import("react").JSX.Element;
|
|
16
|
+
export default Image;
|
|
17
|
+
//# sourceMappingURL=Image.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Image.d.ts","sourceRoot":"","sources":["../../../src/image/Image.
|
|
1
|
+
{"version":3,"file":"Image.d.ts","sourceRoot":"","sources":["../../../src/image/Image.tsx"],"names":[],"mappings":";AAKA,MAAM,WAAW,UAAU;IACzB,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAC3B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,eAAO,MAAM,qBAAqB,+EAC4C,CAAC;AAE/E,QAAA,MAAM,KAAK,kFAWR,UAAU,gCA8BZ,CAAC;AAEF,eAAe,KAAK,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { default } from
|
|
1
|
+
export { default } from './Image';
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/image/index.
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/image/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -1,15 +1,12 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
className?: string;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
export default InlineAlert;
|
|
15
|
-
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { Sentiment } from '../common';
|
|
3
|
+
import { SentimentString } from '../common/propsValues/sentiment';
|
|
4
|
+
export interface InlineAlertProps {
|
|
5
|
+
id?: string;
|
|
6
|
+
type?: Sentiment | SentimentString;
|
|
7
|
+
className?: string;
|
|
8
|
+
children: ReactNode;
|
|
9
|
+
}
|
|
10
|
+
declare const InlineAlert: ({ id, type, className, children }: InlineAlertProps) => import("react").JSX.Element;
|
|
11
|
+
export default InlineAlert;
|
|
12
|
+
//# sourceMappingURL=InlineAlert.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InlineAlert.d.ts","sourceRoot":"","sources":["../../../src/inlineAlert/InlineAlert.
|
|
1
|
+
{"version":3,"file":"InlineAlert.d.ts","sourceRoot":"","sources":["../../../src/inlineAlert/InlineAlert.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGlC,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAElE,MAAM,WAAW,gBAAgB;IAC/B,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,SAAS,GAAG,eAAe,CAAC;IACnC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,SAAS,CAAC;CACrB;AAOD,QAAA,MAAM,WAAW,sCAA2D,gBAAgB,gCAmC3F,CAAC;AAEF,eAAe,WAAW,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { default } from
|
|
1
|
+
export { default } from './InlineAlert';
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/inlineAlert/index.
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/inlineAlert/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PromoCard.d.ts","sourceRoot":"","sources":["../../../src/promoCard/PromoCard.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAsE,MAAM,OAAO,CAAC;AAW3F,MAAM,MAAM,aAAa,GAAG,KAAK,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;AACxD,MAAM,MAAM,UAAU,GAAG,QAAQ,GAAG,SAAS,GAAG,OAAO,GAAG,MAAM,CAAC;AACjE,MAAM,MAAM,YAAY,GACpB,EAAE,GACF,WAAW,GACX,QAAQ,GACR,UAAU,GACV,UAAU,GAC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CAAC,EAAE,KAAK,CAAC;CACf;AAED,MAAM,WAAW,qBAAsB,SAAQ,oBAAoB;IACjE,6DAA6D;IAC7D,cAAc,CAAC,EAAE,OAAO,CAAC;IAEzB,uDAAuD;IACvD,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB,6DAA6D;IAC7D,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB,iDAAiD;IACjD,SAAS,CAAC,EAAE,aAAa,CAAC;IAE1B,gEAAgE;IAChE,IAAI,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC;IAE5B,wEAAwE;IACxE,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,6BAA6B;IAC7B,QAAQ,CAAC,EAAE,KAAK,CAAC;IACjB,IAAI,CAAC,EAAE,KAAK,CAAC;IACb,QAAQ,CAAC,EAAE,KAAK,CAAC;IACjB,GAAG,CAAC,EAAE,KAAK,CAAC;IACZ,MAAM,CAAC,EAAE,KAAK,CAAC;CAChB;AAED,MAAM,MAAM,cAAc,GAAG,kBAAkB,GAAG,qBAAqB,CAAC;AAExE,MAAM,MAAM,oBAAoB,GAAG,CACjC,KAAK,EAAE,kBAAkB,GAAG,qBAAqB,KAC9C,GAAG,CAAC,OAAO,CAAC;;AA0MjB,wBAAqC"}
|
package/package.json
CHANGED
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { BadgeProps } from '../badge';
|
|
2
|
+
import { Sentiment } from '../common';
|
|
3
|
+
import { Size, ProfileType } from '../common';
|
|
4
|
+
import { render, screen } from '../test-utils';
|
|
5
|
+
|
|
6
|
+
import AvatarWrapper from '.';
|
|
7
|
+
|
|
8
|
+
const name = 'Elizabeth Alexandra Mary Windsor';
|
|
9
|
+
|
|
10
|
+
describe('FlowNavigationAvatar', () => {
|
|
11
|
+
describe('with a name', () => {
|
|
12
|
+
it('shows the initials for a long name', () => {
|
|
13
|
+
render(<AvatarWrapper name={name} />);
|
|
14
|
+
|
|
15
|
+
expect(screen.getByText('EW')).toBeInTheDocument();
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
it('shows the first letter for a mononym', () => {
|
|
19
|
+
render(<AvatarWrapper name="Zichaleangeol" />);
|
|
20
|
+
|
|
21
|
+
expect(screen.getByText('Z')).toBeInTheDocument();
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
describe('AND profileType', () => {
|
|
25
|
+
describe('FlowNavigationAvatar', () => {
|
|
26
|
+
describe('with a name', () => {
|
|
27
|
+
it('shows the initials for a long name', () => {
|
|
28
|
+
render(<AvatarWrapper name={name} />);
|
|
29
|
+
|
|
30
|
+
expect(screen.getByText('EW')).toBeInTheDocument();
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
it('shows the first letter for a mononym', () => {
|
|
34
|
+
render(<AvatarWrapper name="Michelangelo" />);
|
|
35
|
+
|
|
36
|
+
expect(screen.getByText('M')).toBeInTheDocument();
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
describe('AND profileType', () => {
|
|
40
|
+
it('renders as BUSINESS profile type with an icon', () => {
|
|
41
|
+
const { container } = render(
|
|
42
|
+
<AvatarWrapper name={name} profileType={ProfileType.BUSINESS} />,
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
expect(container.firstChild).toMatchSnapshot();
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
it('renders as PERSONAL profile type with an icon', () => {
|
|
49
|
+
const { container } = render(
|
|
50
|
+
<AvatarWrapper name={name} profileType={ProfileType.PERSONAL} />,
|
|
51
|
+
);
|
|
52
|
+
|
|
53
|
+
expect(container.firstChild).toMatchSnapshot();
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
describe('AND avatar url', () => {
|
|
57
|
+
it('renders the image', () => {
|
|
58
|
+
const { container } = render(
|
|
59
|
+
<AvatarWrapper
|
|
60
|
+
url="https://wise.com"
|
|
61
|
+
name={name}
|
|
62
|
+
profileType={ProfileType.BUSINESS}
|
|
63
|
+
avatarProps={{ theme: 'dark' }}
|
|
64
|
+
/>,
|
|
65
|
+
);
|
|
66
|
+
|
|
67
|
+
expect(container.firstChild).toMatchSnapshot();
|
|
68
|
+
});
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
describe('with nothing passed', () => {
|
|
75
|
+
it('renders a personal icon', () => {
|
|
76
|
+
const { container } = render(<AvatarWrapper />);
|
|
77
|
+
|
|
78
|
+
expect(container.firstChild).toMatchSnapshot();
|
|
79
|
+
});
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
describe('with a badge url passed', () => {
|
|
83
|
+
it('renders the badge', () => {
|
|
84
|
+
const { container } = render(
|
|
85
|
+
<AvatarWrapper
|
|
86
|
+
badgeUrl="https://badge.com"
|
|
87
|
+
badgeAltText="badge alt text"
|
|
88
|
+
badgeProps={{ size: Size.LARGE } as BadgeProps}
|
|
89
|
+
/>,
|
|
90
|
+
);
|
|
91
|
+
|
|
92
|
+
expect(container.firstChild).toMatchSnapshot();
|
|
93
|
+
});
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
describe('with a badge status icon passed', () => {
|
|
97
|
+
it('renders the badge', () => {
|
|
98
|
+
const { container } = render(<AvatarWrapper badgeStatusIcon={Sentiment.POSITIVE} />);
|
|
99
|
+
|
|
100
|
+
expect(container.firstChild).toMatchSnapshot();
|
|
101
|
+
});
|
|
102
|
+
});
|
|
103
|
+
});
|
|
104
|
+
});
|
|
105
|
+
});
|
|
@@ -9,50 +9,10 @@ import AvatarWrapper from './AvatarWrapper';
|
|
|
9
9
|
export default {
|
|
10
10
|
component: AvatarWrapper,
|
|
11
11
|
title: 'Content/AvatarWrapper',
|
|
12
|
-
argTypes: {
|
|
13
|
-
profileType: {
|
|
14
|
-
type: {
|
|
15
|
-
name: 'enum',
|
|
16
|
-
value: Object.keys(ProfileType),
|
|
17
|
-
},
|
|
18
|
-
},
|
|
19
|
-
badgeStatusIcon: {
|
|
20
|
-
type: {
|
|
21
|
-
name: 'enum',
|
|
22
|
-
value: [
|
|
23
|
-
Sentiment.POSITIVE,
|
|
24
|
-
Sentiment.NEGATIVE,
|
|
25
|
-
Sentiment.NEUTRAL,
|
|
26
|
-
Sentiment.WARNING,
|
|
27
|
-
Sentiment.PENDING,
|
|
28
|
-
],
|
|
29
|
-
},
|
|
30
|
-
},
|
|
31
|
-
},
|
|
32
|
-
tags: ['autodocs'],
|
|
33
12
|
} satisfies Meta<typeof AvatarWrapper>;
|
|
34
13
|
|
|
35
14
|
type Story = StoryObj<typeof AvatarWrapper>;
|
|
36
15
|
|
|
37
|
-
export const WithBadgeUrl: Story = {
|
|
38
|
-
args: {
|
|
39
|
-
badgeUrl: 'https://wise.com/public-resources/assets/brand/fast_flag_badge_personal.svg',
|
|
40
|
-
avatarProps: {
|
|
41
|
-
outlined: true,
|
|
42
|
-
},
|
|
43
|
-
},
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
export const WithBadgeStatus: Story = {
|
|
47
|
-
args: {
|
|
48
|
-
profileType: ProfileType.BUSINESS,
|
|
49
|
-
badgeStatusIcon: Sentiment.PENDING,
|
|
50
|
-
avatarProps: {
|
|
51
|
-
outlined: false,
|
|
52
|
-
},
|
|
53
|
-
},
|
|
54
|
-
};
|
|
55
|
-
|
|
56
16
|
export const All: Story = {
|
|
57
17
|
args: {
|
|
58
18
|
avatarProps: { outlined: true },
|
|
@@ -85,7 +45,7 @@ export const All: Story = {
|
|
|
85
45
|
</div>
|
|
86
46
|
Initials
|
|
87
47
|
<div>
|
|
88
|
-
<AvatarWrapper name="
|
|
48
|
+
<AvatarWrapper name="Any Aname" avatarProps={avatarProps} />
|
|
89
49
|
</div>
|
|
90
50
|
Default
|
|
91
51
|
<div>
|
|
@@ -1,13 +1,19 @@
|
|
|
1
1
|
import { Person as ProfileIcon, Briefcase as BriefcaseIcon } from '@transferwise/icons';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
2
|
import { useState, useEffect } from 'react';
|
|
4
3
|
|
|
5
|
-
import Avatar, { AvatarType } from '../avatar';
|
|
6
|
-
import Badge from '../badge';
|
|
7
|
-
import { ProfileType, Size, Sentiment } from '../common';
|
|
4
|
+
import Avatar, { AvatarProps, AvatarType } from '../avatar';
|
|
5
|
+
import Badge, { BadgeProps } from '../badge';
|
|
6
|
+
import { ProfileType, ProfileTypePersonal, ProfileTypeBusiness, Size, Sentiment } from '../common';
|
|
8
7
|
import StatusIcon from '../statusIcon/StatusIcon';
|
|
9
8
|
|
|
10
|
-
|
|
9
|
+
interface OptionalBadgeProps {
|
|
10
|
+
url?: string;
|
|
11
|
+
altText?: string;
|
|
12
|
+
statusIcon?: Sentiment;
|
|
13
|
+
children: React.ReactNode;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const OptionalBadge = ({ url, altText, statusIcon, children, ...rest }: OptionalBadgeProps) => {
|
|
11
17
|
if (url) {
|
|
12
18
|
return (
|
|
13
19
|
<Badge badge={<img src={url} alt={altText} />} {...rest}>
|
|
@@ -22,27 +28,20 @@ const OptionalBadge = ({ url, altText, statusIcon, children, ...rest }) => {
|
|
|
22
28
|
</Badge>
|
|
23
29
|
);
|
|
24
30
|
}
|
|
25
|
-
return children
|
|
31
|
+
return <>{children}</>;
|
|
26
32
|
};
|
|
27
33
|
|
|
28
|
-
|
|
29
|
-
url
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
OptionalBadge.defaultProps = {
|
|
42
|
-
url: undefined,
|
|
43
|
-
altText: undefined,
|
|
44
|
-
statusIcon: undefined,
|
|
45
|
-
};
|
|
34
|
+
export interface AvatarWrapperProps {
|
|
35
|
+
url?: string;
|
|
36
|
+
profileType?: ProfileTypeBusiness | ProfileTypePersonal;
|
|
37
|
+
profileId?: string;
|
|
38
|
+
badgeUrl?: string;
|
|
39
|
+
badgeAltText?: string;
|
|
40
|
+
badgeStatusIcon?: Sentiment;
|
|
41
|
+
name?: string;
|
|
42
|
+
avatarProps?: AvatarProps;
|
|
43
|
+
badgeProps?: BadgeProps;
|
|
44
|
+
}
|
|
46
45
|
|
|
47
46
|
const AvatarWrapper = ({
|
|
48
47
|
url,
|
|
@@ -54,7 +53,7 @@ const AvatarWrapper = ({
|
|
|
54
53
|
name,
|
|
55
54
|
avatarProps,
|
|
56
55
|
badgeProps,
|
|
57
|
-
}) => {
|
|
56
|
+
}: AvatarWrapperProps) => {
|
|
58
57
|
const [hasImageLoadError, setImageLoadError] = useState(false);
|
|
59
58
|
const isBusinessProfile = profileType === ProfileType.BUSINESS;
|
|
60
59
|
|
|
@@ -103,7 +102,7 @@ const AvatarWrapper = ({
|
|
|
103
102
|
);
|
|
104
103
|
};
|
|
105
104
|
|
|
106
|
-
function getInitials(name) {
|
|
105
|
+
function getInitials(name: string) {
|
|
107
106
|
const allInitials = name
|
|
108
107
|
.split(' ')
|
|
109
108
|
.map((part) => part[0])
|
|
@@ -117,34 +116,4 @@ function getInitials(name) {
|
|
|
117
116
|
return allInitials[0] + allInitials.slice(-1);
|
|
118
117
|
}
|
|
119
118
|
|
|
120
|
-
AvatarWrapper.defaultProps = {
|
|
121
|
-
url: undefined,
|
|
122
|
-
profileType: undefined,
|
|
123
|
-
profileId: undefined,
|
|
124
|
-
badgeUrl: undefined,
|
|
125
|
-
badgeAltText: undefined,
|
|
126
|
-
badgeStatusIcon: undefined,
|
|
127
|
-
name: undefined,
|
|
128
|
-
avatarProps: {},
|
|
129
|
-
badgeProps: {},
|
|
130
|
-
};
|
|
131
|
-
|
|
132
|
-
AvatarWrapper.propTypes = {
|
|
133
|
-
url: PropTypes.string,
|
|
134
|
-
profileType: PropTypes.oneOf([ProfileType.PERSONAL, ProfileType.BUSINESS]),
|
|
135
|
-
profileId: PropTypes.number,
|
|
136
|
-
badgeUrl: PropTypes.string,
|
|
137
|
-
badgeAltText: PropTypes.string,
|
|
138
|
-
badgeStatusIcon: PropTypes.oneOf([
|
|
139
|
-
Sentiment.POSITIVE,
|
|
140
|
-
Sentiment.NEGATIVE,
|
|
141
|
-
Sentiment.NEUTRAL,
|
|
142
|
-
Sentiment.WARNING,
|
|
143
|
-
Sentiment.PENDING,
|
|
144
|
-
]),
|
|
145
|
-
name: PropTypes.string,
|
|
146
|
-
avatarProps: PropTypes.shape({}),
|
|
147
|
-
badgeProps: PropTypes.shape({}),
|
|
148
|
-
};
|
|
149
|
-
|
|
150
119
|
export default AvatarWrapper;
|