@transferwise/components 46.77.0 → 46.78.0
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 +2 -7
- package/build/avatar/Avatar.js.map +1 -1
- package/build/avatar/Avatar.mjs +2 -7
- package/build/avatar/Avatar.mjs.map +1 -1
- package/build/badge/Badge.js +1 -10
- package/build/badge/Badge.js.map +1 -1
- package/build/badge/Badge.mjs +1 -10
- package/build/badge/Badge.mjs.map +1 -1
- package/build/circularButton/CircularButton.js +1 -1
- package/build/circularButton/CircularButton.js.map +1 -1
- package/build/circularButton/CircularButton.mjs +1 -1
- package/build/circularButton/CircularButton.mjs.map +1 -1
- package/build/common/circle/Circle.js +15 -2
- package/build/common/circle/Circle.js.map +1 -1
- package/build/common/circle/Circle.mjs +15 -2
- package/build/common/circle/Circle.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/main.css +46 -22
- package/build/statusIcon/StatusIcon.js +4 -4
- package/build/statusIcon/StatusIcon.js.map +1 -1
- package/build/statusIcon/StatusIcon.mjs +4 -4
- package/build/statusIcon/StatusIcon.mjs.map +1 -1
- package/build/styles/avatar/Avatar.css +29 -0
- package/build/styles/badge/Badge.css +6 -0
- package/build/styles/circularButton/CircularButton.css +2 -2
- package/build/styles/common/circle/Circle.css +4 -0
- package/build/styles/main.css +46 -22
- package/build/styles/statusIcon/StatusIcon.css +0 -20
- package/build/types/avatar/Avatar.d.ts.map +1 -1
- package/build/types/badge/Badge.d.ts.map +1 -1
- package/build/types/common/circle/Circle.d.ts +1 -1
- package/build/types/common/circle/Circle.d.ts.map +1 -1
- package/build/types/statusIcon/StatusIcon.d.ts +7 -3
- package/build/types/statusIcon/StatusIcon.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/avatar/Avatar.css +29 -0
- package/src/avatar/Avatar.less +12 -0
- package/src/avatar/Avatar.tsx +4 -8
- package/src/avatarWrapper/__snapshots__/AvatarWrapper.spec.tsx.snap +11 -22
- package/src/badge/Badge.css +6 -0
- package/src/badge/Badge.less +6 -0
- package/src/badge/Badge.tsx +1 -11
- package/src/circularButton/CircularButton.css +2 -2
- package/src/circularButton/CircularButton.less +1 -1
- package/src/circularButton/CircularButton.story.tsx +3 -0
- package/src/circularButton/CircularButton.tsx +1 -1
- package/src/circularButton/__snapshots__/CircularButton.spec.tsx.snap +10 -10
- package/src/common/circle/Circle.css +4 -0
- package/src/common/circle/Circle.less +6 -0
- package/src/common/circle/Circle.story.tsx +2 -2
- package/src/common/circle/Circle.tsx +25 -2
- package/src/flowNavigation/__snapshots__/FlowNavigation.spec.js.snap +4 -8
- 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/main.css +46 -22
- package/src/overlayHeader/__snapshots__/OverlayHeader.spec.tsx.snap +2 -4
- package/src/promoCard/PromoCard.spec.tsx +1 -1
- package/src/radio/__snapshots__/Radio.rtl.spec.tsx.snap +2 -4
- package/src/statusIcon/StatusIcon.css +0 -20
- package/src/statusIcon/StatusIcon.less +0 -17
- package/src/statusIcon/StatusIcon.spec.tsx +2 -21
- package/src/statusIcon/StatusIcon.story.tsx +32 -1
- package/src/statusIcon/StatusIcon.tsx +11 -10
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
.status-icon > svg {
|
|
2
|
-
height: 32px;
|
|
3
|
-
height: var(--size-32);
|
|
4
|
-
width: 32px;
|
|
5
|
-
width: var(--size-32);
|
|
6
|
-
}
|
|
7
1
|
.status-circle .light {
|
|
8
2
|
color: var(--color-contrast);
|
|
9
3
|
}
|
|
@@ -19,20 +13,6 @@
|
|
|
19
13
|
.np-theme-personal .status-circle.pending .status-icon {
|
|
20
14
|
color: var(--color-dark);
|
|
21
15
|
}
|
|
22
|
-
.status-circle-sm .status-icon > svg {
|
|
23
|
-
height: 14px;
|
|
24
|
-
height: var(--size-14);
|
|
25
|
-
width: 14px;
|
|
26
|
-
width: var(--size-14);
|
|
27
|
-
}
|
|
28
|
-
@media (max-width: 320px) {
|
|
29
|
-
.status-circle-sm .status-icon > svg {
|
|
30
|
-
width: 24px;
|
|
31
|
-
width: var(--size-24);
|
|
32
|
-
height: 24px;
|
|
33
|
-
height: var(--size-24);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
16
|
.status-circle.negative,
|
|
37
17
|
.status-circle.error {
|
|
38
18
|
background-color: var(--color-sentiment-negative);
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
.status-icon > svg {
|
|
2
|
-
height: var(--size-32);
|
|
3
|
-
width: var(--size-32);
|
|
4
|
-
}
|
|
5
|
-
|
|
6
1
|
.status-circle {
|
|
7
2
|
.light {
|
|
8
3
|
color: var(--color-contrast);
|
|
@@ -22,18 +17,6 @@
|
|
|
22
17
|
}
|
|
23
18
|
}
|
|
24
19
|
}
|
|
25
|
-
|
|
26
|
-
&-sm {
|
|
27
|
-
.status-icon > svg {
|
|
28
|
-
height: var(--size-14);
|
|
29
|
-
width: var(--size-14);
|
|
30
|
-
|
|
31
|
-
@media (--screen-400-zoom) {
|
|
32
|
-
width: var(--size-24);
|
|
33
|
-
height: var(--size-24);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
20
|
}
|
|
38
21
|
|
|
39
22
|
.status-circle.negative,
|
|
@@ -1,16 +1,12 @@
|
|
|
1
1
|
import { Sentiment, Size } from '../common';
|
|
2
2
|
import { render, cleanup, screen, mockMatchMedia } from '../test-utils';
|
|
3
3
|
|
|
4
|
-
import StatusIcon, { StatusIconProps } from '.';
|
|
4
|
+
import StatusIcon, { type StatusIconProps } from '.';
|
|
5
5
|
|
|
6
6
|
mockMatchMedia();
|
|
7
7
|
|
|
8
8
|
describe('StatusIcon', () => {
|
|
9
|
-
const renderStatusIcon = (props?: {
|
|
10
|
-
sentiment?: StatusIconProps['sentiment'];
|
|
11
|
-
size?: StatusIconProps['size'];
|
|
12
|
-
iconLabel?: StatusIconProps['iconLabel'];
|
|
13
|
-
}) => {
|
|
9
|
+
const renderStatusIcon = (props?: StatusIconProps) => {
|
|
14
10
|
return render(
|
|
15
11
|
<StatusIcon
|
|
16
12
|
sentiment={props?.sentiment || Sentiment.NEUTRAL}
|
|
@@ -27,23 +23,8 @@ describe('StatusIcon', () => {
|
|
|
27
23
|
|
|
28
24
|
expect(screen.getByTestId('status-icon')).toHaveClass('neutral');
|
|
29
25
|
expect(screen.getByTestId('status-icon')).toHaveClass('status-circle');
|
|
30
|
-
expect(screen.getByTestId('status-icon')).toHaveClass('status-circle-md');
|
|
31
26
|
});
|
|
32
27
|
|
|
33
|
-
it.each([
|
|
34
|
-
[Size.SMALL as const, 'status-circle-sm'],
|
|
35
|
-
[Size.MEDIUM as const, 'status-circle-md'],
|
|
36
|
-
[Size.LARGE as const, 'status-circle-lg'],
|
|
37
|
-
])(
|
|
38
|
-
"if prop 'size' equals '%s' is passed, renders the status icon with class '%s'",
|
|
39
|
-
(size, expectedClass) => {
|
|
40
|
-
renderStatusIcon({ size });
|
|
41
|
-
|
|
42
|
-
expect(screen.getByTestId('status-icon')).toHaveClass(expectedClass);
|
|
43
|
-
cleanup();
|
|
44
|
-
},
|
|
45
|
-
);
|
|
46
|
-
|
|
47
28
|
it.each([
|
|
48
29
|
[Sentiment.NEGATIVE, Sentiment.NEGATIVE],
|
|
49
30
|
[Sentiment.NEUTRAL, Sentiment.NEUTRAL],
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Meta, StoryObj } from '@storybook/react';
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { Sentiment, Size } from '../common';
|
|
4
4
|
|
|
5
5
|
import StatusIcon from './StatusIcon';
|
|
6
6
|
|
|
@@ -29,6 +29,37 @@ export const Presentational: Story = {
|
|
|
29
29
|
};
|
|
30
30
|
|
|
31
31
|
export const Variants: Story = {
|
|
32
|
+
render: () => (
|
|
33
|
+
<span style={{ display: 'flex', justifyContent: 'space-between', maxWidth: '400px' }}>
|
|
34
|
+
{[
|
|
35
|
+
Sentiment.POSITIVE,
|
|
36
|
+
Sentiment.NEGATIVE,
|
|
37
|
+
Sentiment.WARNING,
|
|
38
|
+
Sentiment.NEUTRAL,
|
|
39
|
+
Sentiment.PENDING,
|
|
40
|
+
].map((sentiment) => {
|
|
41
|
+
return (
|
|
42
|
+
<span
|
|
43
|
+
key={sentiment}
|
|
44
|
+
style={{
|
|
45
|
+
display: 'flex',
|
|
46
|
+
justifyContent: 'space-between',
|
|
47
|
+
flexDirection: 'column',
|
|
48
|
+
minHeight: '150px',
|
|
49
|
+
alignItems: 'center',
|
|
50
|
+
}}
|
|
51
|
+
>
|
|
52
|
+
{([16, 24, 32, 40, 48, 56, 72] as const).map((size) => {
|
|
53
|
+
return <StatusIcon key={size} size={size} sentiment={sentiment} />;
|
|
54
|
+
})}
|
|
55
|
+
</span>
|
|
56
|
+
);
|
|
57
|
+
})}
|
|
58
|
+
</span>
|
|
59
|
+
),
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
export const LegacySizes: Story = {
|
|
32
63
|
render: () => (
|
|
33
64
|
<span style={{ display: 'flex', justifyContent: 'space-between', maxWidth: '400px' }}>
|
|
34
65
|
{[
|
|
@@ -8,9 +8,14 @@ import { useMedia } from '../common/hooks/useMedia';
|
|
|
8
8
|
|
|
9
9
|
import messages from './StatusIcon.messages';
|
|
10
10
|
|
|
11
|
+
/**
|
|
12
|
+
* @deprecated use `16 | 24 | 32 | 40 | 48 | 56 | 72` component instead
|
|
13
|
+
*/
|
|
14
|
+
type LegacySizes = SizeSmall | SizeMedium | SizeLarge;
|
|
15
|
+
|
|
11
16
|
export type StatusIconProps = {
|
|
12
|
-
sentiment
|
|
13
|
-
size
|
|
17
|
+
sentiment?: `${Sentiment}`;
|
|
18
|
+
size?: LegacySizes | 16 | 24 | 32 | 40 | 48 | 56 | 72;
|
|
14
19
|
/**
|
|
15
20
|
* Override for the sentiment's-derived, default, accessible
|
|
16
21
|
* name announced by the screen readers. <br />
|
|
@@ -25,11 +30,7 @@ const mapLegacySize = {
|
|
|
25
30
|
[String(Size.LARGE)]: 48,
|
|
26
31
|
} satisfies Record<string, CircleProps['size']>;
|
|
27
32
|
|
|
28
|
-
const StatusIcon = ({
|
|
29
|
-
sentiment = 'neutral',
|
|
30
|
-
size: sizeProp = 'md',
|
|
31
|
-
iconLabel,
|
|
32
|
-
}: StatusIconProps) => {
|
|
33
|
+
const StatusIcon = ({ sentiment = 'neutral', size: sizeProp = 40, iconLabel }: StatusIconProps) => {
|
|
33
34
|
const intl = useIntl();
|
|
34
35
|
|
|
35
36
|
const iconMetaBySentiment: Record<
|
|
@@ -77,13 +78,13 @@ const StatusIcon = ({
|
|
|
77
78
|
|
|
78
79
|
const iconColor = sentiment === 'warning' || sentiment === 'pending' ? 'dark' : 'light';
|
|
79
80
|
const isTinyViewport = useMedia(`(max-width: ${Breakpoint.ZOOM_400}px)`);
|
|
80
|
-
const size = sizeProp
|
|
81
|
+
const size = mapLegacySize[sizeProp] ?? sizeProp;
|
|
81
82
|
return (
|
|
82
83
|
<Circle
|
|
83
84
|
as="span"
|
|
84
|
-
size={size}
|
|
85
|
+
size={isTinyViewport && size < 40 ? 32 : size}
|
|
85
86
|
data-testid="status-icon"
|
|
86
|
-
className={clsx('status-circle',
|
|
87
|
+
className={clsx('status-circle', sentiment)}
|
|
87
88
|
>
|
|
88
89
|
<Icon
|
|
89
90
|
className={clsx('status-icon', iconColor)}
|