@transferwise/components 0.0.0-experimental-d11e9c5 → 0.0.0-experimental-6a7bc4f
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/avatarView/AvatarView.js +31 -24
- package/build/avatarView/AvatarView.js.map +1 -1
- package/build/avatarView/AvatarView.mjs +30 -23
- package/build/avatarView/AvatarView.mjs.map +1 -1
- package/build/badge/Badge.js +13 -3
- package/build/badge/Badge.js.map +1 -1
- package/build/badge/Badge.mjs +12 -2
- package/build/badge/Badge.mjs.map +1 -1
- package/build/badge/BadgeAssets.js +6 -31
- package/build/badge/BadgeAssets.js.map +1 -1
- package/build/badge/BadgeAssets.mjs +1 -26
- package/build/badge/BadgeAssets.mjs.map +1 -1
- package/build/index.js +112 -112
- package/build/index.mjs +24 -24
- package/build/types/avatarView/AvatarView.d.ts +11 -4
- package/build/types/avatarView/AvatarView.d.ts.map +1 -1
- package/build/types/badge/Badge.d.ts +4 -3
- package/build/types/badge/Badge.d.ts.map +1 -1
- package/build/types/badge/BadgeAssets.d.ts +2 -3
- package/build/types/badge/BadgeAssets.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/avatarView/AvatarView.story.tsx +57 -0
- package/src/avatarView/AvatarView.tsx +44 -24
- package/src/badge/Badge.tsx +12 -5
- package/src/badge/BadgeAssets.tsx +3 -7
- package/src/decision/Decision.story.tsx +9 -9
package/src/badge/Badge.tsx
CHANGED
|
@@ -11,11 +11,12 @@ import {
|
|
|
11
11
|
ThemeLight,
|
|
12
12
|
CommonProps,
|
|
13
13
|
} from '../common';
|
|
14
|
+
import { BadgeAssetsProps } from '.';
|
|
14
15
|
|
|
15
16
|
/**
|
|
16
|
-
* @deprecated Use `
|
|
17
|
+
* @deprecated Use `16` or `24` instead.
|
|
17
18
|
*/
|
|
18
|
-
type DeprecatedSizes = SizeMedium;
|
|
19
|
+
type DeprecatedSizes = SizeSmall | SizeMedium | SizeLarge;
|
|
19
20
|
|
|
20
21
|
export type BadgeProps = {
|
|
21
22
|
badge: ReactNode;
|
|
@@ -23,12 +24,19 @@ export type BadgeProps = {
|
|
|
23
24
|
/**
|
|
24
25
|
* `md` is deprecated, it will fallback to `sm` instead.
|
|
25
26
|
*/
|
|
26
|
-
size?:
|
|
27
|
+
size?: DeprecatedSizes | BadgeAssetsProps['size'];
|
|
27
28
|
border?: ThemeDark | ThemeLight;
|
|
28
29
|
'aria-label'?: string;
|
|
29
30
|
style?: React.CSSProperties;
|
|
30
31
|
} & CommonProps;
|
|
31
32
|
|
|
33
|
+
const mapLegacySize = {
|
|
34
|
+
16: Size.SMALL,
|
|
35
|
+
24: Size.LARGE,
|
|
36
|
+
// medium is no longer exists, so we map it to small
|
|
37
|
+
[String(Size.MEDIUM)]: Size.SMALL,
|
|
38
|
+
};
|
|
39
|
+
|
|
32
40
|
// Note: Badge component is not deprecated, we want stop it's direct usage on consumer side.
|
|
33
41
|
// Deprecation notice will hint consumers to migrate. Eventually the component will become internal.
|
|
34
42
|
/**
|
|
@@ -43,8 +51,7 @@ const Badge = ({
|
|
|
43
51
|
children,
|
|
44
52
|
style,
|
|
45
53
|
}: BadgeProps) => {
|
|
46
|
-
|
|
47
|
-
const size = sizeProp === Size.MEDIUM ? Size.SMALL : sizeProp;
|
|
54
|
+
const size = mapLegacySize[sizeProp] ?? sizeProp;
|
|
48
55
|
const classes: string = clsx(
|
|
49
56
|
'tw-badge',
|
|
50
57
|
{
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import StatusIcon, { StatusIconProps } from '../statusIcon';
|
|
2
2
|
import { Flag } from '@wise/art';
|
|
3
|
-
import Circle
|
|
3
|
+
import Circle from '../common/circle';
|
|
4
4
|
import Image from '../image';
|
|
5
|
-
import type { BadgeProps } from './Badge';
|
|
6
5
|
import { Plus } from '@transferwise/icons';
|
|
7
|
-
import { Size } from '../common';
|
|
8
6
|
|
|
9
7
|
export type Props = {
|
|
10
8
|
status?: StatusIconProps['sentiment'];
|
|
@@ -12,7 +10,7 @@ export type Props = {
|
|
|
12
10
|
imgSrc?: string;
|
|
13
11
|
icon?: React.ReactNode;
|
|
14
12
|
type?: 'action' | 'reference';
|
|
15
|
-
size?:
|
|
13
|
+
size?: 16 | 24;
|
|
16
14
|
};
|
|
17
15
|
|
|
18
16
|
/**
|
|
@@ -24,10 +22,8 @@ export default function BadgeAssets({
|
|
|
24
22
|
imgSrc,
|
|
25
23
|
icon = null,
|
|
26
24
|
type = 'action',
|
|
27
|
-
size
|
|
25
|
+
size,
|
|
28
26
|
}: Props) {
|
|
29
|
-
// map to old size (sm, lg) to new ones (numeric)
|
|
30
|
-
const size: CircleProps['size'] = sizeProp === Size.LARGE ? 24 : 16;
|
|
31
27
|
if (status) {
|
|
32
28
|
return <StatusIcon sentiment={status} size={size} />;
|
|
33
29
|
}
|
|
@@ -33,7 +33,7 @@ export const Basic = () => {
|
|
|
33
33
|
disabled,
|
|
34
34
|
media: {
|
|
35
35
|
block: <Illustration name="globe" alt="" disablePadding />,
|
|
36
|
-
list: <AvatarView name="
|
|
36
|
+
list: <AvatarView name="Hank Miller" />,
|
|
37
37
|
},
|
|
38
38
|
'aria-label': 'Click to see something',
|
|
39
39
|
title: 'Hank Miller',
|
|
@@ -46,7 +46,7 @@ export const Basic = () => {
|
|
|
46
46
|
href: '#href2',
|
|
47
47
|
media: {
|
|
48
48
|
block: <Illustration name="confetti" alt="" disablePadding />,
|
|
49
|
-
list: <AvatarView name="
|
|
49
|
+
list: <AvatarView name="Hank Miller" />,
|
|
50
50
|
},
|
|
51
51
|
'aria-label': 'Click here to send money to Hank Miller.',
|
|
52
52
|
title: 'Hank Miller',
|
|
@@ -101,7 +101,7 @@ export const grid = () => {
|
|
|
101
101
|
alt=""
|
|
102
102
|
/>
|
|
103
103
|
),
|
|
104
|
-
list: <AvatarView name="
|
|
104
|
+
list: <AvatarView name="Hank Miller" />,
|
|
105
105
|
},
|
|
106
106
|
'aria-label': 'Click to see something',
|
|
107
107
|
title: 'Hank Miller',
|
|
@@ -119,7 +119,7 @@ export const grid = () => {
|
|
|
119
119
|
alt=""
|
|
120
120
|
/>
|
|
121
121
|
),
|
|
122
|
-
list: <AvatarView name="
|
|
122
|
+
list: <AvatarView name="Hank Miller" />,
|
|
123
123
|
},
|
|
124
124
|
'aria-label': 'Click here to send money to Hank Miller.',
|
|
125
125
|
title: 'Hank Miller',
|
|
@@ -136,7 +136,7 @@ export const grid = () => {
|
|
|
136
136
|
alt=""
|
|
137
137
|
/>
|
|
138
138
|
),
|
|
139
|
-
list: <AvatarView name="
|
|
139
|
+
list: <AvatarView name="Hank Miller" />,
|
|
140
140
|
},
|
|
141
141
|
'aria-label': 'Click here to send money to Hank Miller.',
|
|
142
142
|
disabled,
|
|
@@ -155,7 +155,7 @@ export const grid = () => {
|
|
|
155
155
|
alt=""
|
|
156
156
|
/>
|
|
157
157
|
),
|
|
158
|
-
list: <AvatarView name="
|
|
158
|
+
list: <AvatarView name="Hank Miller" />,
|
|
159
159
|
},
|
|
160
160
|
'aria-label': 'Click here to send money to Hank Miller.',
|
|
161
161
|
title: 'Hank Miller',
|
|
@@ -173,7 +173,7 @@ export const grid = () => {
|
|
|
173
173
|
alt=""
|
|
174
174
|
/>
|
|
175
175
|
),
|
|
176
|
-
list: <AvatarView name="
|
|
176
|
+
list: <AvatarView name="Hank Miller" />,
|
|
177
177
|
},
|
|
178
178
|
'aria-label': 'Click here to send money to Hank Miller.',
|
|
179
179
|
title: 'Hank Miller',
|
|
@@ -191,7 +191,7 @@ export const grid = () => {
|
|
|
191
191
|
alt=""
|
|
192
192
|
/>
|
|
193
193
|
),
|
|
194
|
-
list: <AvatarView name="
|
|
194
|
+
list: <AvatarView name="Hank Miller" />,
|
|
195
195
|
},
|
|
196
196
|
'aria-label': 'Click here to send money to Hank Miller.',
|
|
197
197
|
title: 'Hank Miller',
|
|
@@ -209,7 +209,7 @@ export const grid = () => {
|
|
|
209
209
|
alt=""
|
|
210
210
|
/>
|
|
211
211
|
),
|
|
212
|
-
list: <AvatarView name="
|
|
212
|
+
list: <AvatarView name="Hank Miller" />,
|
|
213
213
|
},
|
|
214
214
|
'aria-label': 'Click here to send money to Hank Miller.',
|
|
215
215
|
title: 'Hank Miller',
|