@transferwise/components 46.71.3 → 46.71.5
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 +7 -2
- package/build/avatar/Avatar.js.map +1 -1
- package/build/avatar/Avatar.mjs +7 -2
- package/build/avatar/Avatar.mjs.map +1 -1
- package/build/badge/Badge.js +13 -2
- package/build/badge/Badge.js.map +1 -1
- package/build/badge/Badge.mjs +13 -2
- package/build/badge/Badge.mjs.map +1 -1
- package/build/circularButton/CircularButton.js +10 -2
- package/build/circularButton/CircularButton.js.map +1 -1
- package/build/circularButton/CircularButton.mjs +10 -2
- package/build/circularButton/CircularButton.mjs.map +1 -1
- package/build/common/circle/Circle.js +29 -0
- package/build/common/circle/Circle.js.map +1 -0
- package/build/common/circle/Circle.mjs +27 -0
- package/build/common/circle/Circle.mjs.map +1 -0
- package/build/common/polymorphicWithOverrides/PolymorphicWithOverrides.js +5 -4
- package/build/common/polymorphicWithOverrides/PolymorphicWithOverrides.js.map +1 -1
- package/build/common/polymorphicWithOverrides/PolymorphicWithOverrides.mjs +5 -4
- package/build/common/polymorphicWithOverrides/PolymorphicWithOverrides.mjs.map +1 -1
- package/build/inputs/SelectInput.js +5 -1
- package/build/inputs/SelectInput.js.map +1 -1
- package/build/inputs/SelectInput.mjs +5 -1
- package/build/inputs/SelectInput.mjs.map +1 -1
- package/build/main.css +7 -114
- package/build/moneyInput/MoneyInput.js +1 -1
- package/build/moneyInput/MoneyInput.js.map +1 -1
- package/build/moneyInput/MoneyInput.mjs +1 -1
- package/build/moneyInput/MoneyInput.mjs.map +1 -1
- package/build/statusIcon/StatusIcon.js +16 -3
- package/build/statusIcon/StatusIcon.js.map +1 -1
- package/build/statusIcon/StatusIcon.mjs +16 -3
- package/build/statusIcon/StatusIcon.mjs.map +1 -1
- package/build/styles/avatar/Avatar.css +0 -29
- package/build/styles/badge/Badge.css +0 -10
- package/build/styles/circularButton/CircularButton.css +0 -37
- package/build/styles/common/circle/Circle.css +7 -0
- package/build/styles/main.css +7 -114
- package/build/styles/statusIcon/StatusIcon.css +0 -33
- package/build/types/avatar/Avatar.d.ts.map +1 -1
- package/build/types/badge/Badge.d.ts +9 -2
- package/build/types/badge/Badge.d.ts.map +1 -1
- package/build/types/circularButton/CircularButton.d.ts.map +1 -1
- package/build/types/common/circle/Circle.d.ts +34 -0
- package/build/types/common/circle/Circle.d.ts.map +1 -0
- package/build/types/common/circle/index.d.ts +3 -0
- package/build/types/common/circle/index.d.ts.map +1 -0
- package/build/types/common/polymorphicWithOverrides/PolymorphicWithOverrides.d.ts.map +1 -1
- package/build/types/inputs/SelectInput.d.ts.map +1 -1
- package/build/types/statusIcon/StatusIcon.d.ts +1 -1
- package/build/types/statusIcon/StatusIcon.d.ts.map +1 -1
- package/package.json +5 -5
- package/src/alert/Alert.spec.tsx +3 -1
- package/src/avatar/Avatar.css +0 -29
- package/src/avatar/Avatar.less +0 -12
- package/src/avatar/Avatar.tsx +9 -4
- package/src/avatarWrapper/AvatarWrapper.spec.tsx +3 -1
- package/src/avatarWrapper/__snapshots__/AvatarWrapper.spec.tsx.snap +22 -11
- package/src/badge/Badge.css +0 -10
- package/src/badge/Badge.less +0 -13
- package/src/badge/Badge.tsx +23 -3
- package/src/checkbox/Checkbox.spec.tsx +3 -1
- package/src/circularButton/CircularButton.css +0 -37
- package/src/circularButton/CircularButton.less +0 -27
- package/src/circularButton/CircularButton.spec.tsx +3 -1
- package/src/circularButton/CircularButton.tsx +10 -3
- package/src/circularButton/__snapshots__/CircularButton.spec.tsx.snap +20 -10
- package/src/common/circle/Circle.css +7 -0
- package/src/common/circle/Circle.less +6 -0
- package/src/common/circle/Circle.story.tsx +86 -0
- package/src/common/circle/Circle.tsx +46 -0
- package/src/common/circle/index.ts +2 -0
- package/src/common/polymorphicWithOverrides/PolymorphicWithOverrides.tsx +10 -6
- package/src/flowNavigation/__snapshots__/FlowNavigation.spec.js.snap +8 -4
- package/src/inlineAlert/InlineAlert.spec.tsx +3 -1
- package/src/inputs/SelectInput.story.tsx +2 -2
- package/src/inputs/SelectInput.tsx +6 -2
- package/src/main.css +7 -114
- package/src/main.less +1 -0
- package/src/moneyInput/MoneyInput.rtl.spec.tsx +1 -1
- package/src/moneyInput/MoneyInput.tsx +1 -1
- package/src/overlayHeader/__snapshots__/OverlayHeader.spec.tsx.snap +4 -2
- package/src/radio/__snapshots__/Radio.rtl.spec.tsx.snap +4 -2
- package/src/statusIcon/StatusIcon.css +0 -33
- package/src/statusIcon/StatusIcon.less +0 -24
- package/src/statusIcon/StatusIcon.spec.tsx +5 -3
- package/src/statusIcon/StatusIcon.tsx +17 -6
- package/src/summary/Summary.spec.tsx +3 -1
- package/src/typeahead/Typeahead.spec.js +3 -0
- package/src/upload/Upload.spec.js +3 -0
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { Info, Alert, Cross, Check, ClockBorderless } from '@transferwise/icons';
|
|
2
2
|
import { clsx } from 'clsx';
|
|
3
3
|
|
|
4
|
-
import { SizeSmall, SizeMedium, SizeLarge, Sentiment } from '../common';
|
|
4
|
+
import { SizeSmall, SizeMedium, SizeLarge, Sentiment, Size, Breakpoint } from '../common';
|
|
5
|
+
import Circle, { CircleProps } from '../common/circle';
|
|
6
|
+
import { useMedia } from '../common/hooks/useMedia';
|
|
5
7
|
|
|
6
8
|
export type StatusIconProps = {
|
|
7
9
|
sentiment: `${Sentiment}`;
|
|
@@ -19,17 +21,26 @@ const iconTypeMap = {
|
|
|
19
21
|
success: Check,
|
|
20
22
|
} satisfies Record<`${Sentiment}`, React.ElementType>;
|
|
21
23
|
|
|
22
|
-
const
|
|
24
|
+
const mapLegacySize = {
|
|
25
|
+
[String(Size.SMALL)]: 16,
|
|
26
|
+
[String(Size.MEDIUM)]: 40,
|
|
27
|
+
[String(Size.LARGE)]: 48,
|
|
28
|
+
} satisfies Record<string, CircleProps['size']>;
|
|
29
|
+
|
|
30
|
+
const StatusIcon = ({ sentiment = 'neutral', size: sizeProp = 'md' }: StatusIconProps) => {
|
|
23
31
|
const Icon = iconTypeMap[sentiment];
|
|
24
32
|
const iconColor = sentiment === 'warning' || sentiment === 'pending' ? 'dark' : 'light';
|
|
25
|
-
|
|
33
|
+
const isTinyViewport = useMedia(`(max-width: ${Breakpoint.ZOOM_400}px)`);
|
|
34
|
+
const size = sizeProp === Size.SMALL && isTinyViewport ? 32 : mapLegacySize[sizeProp];
|
|
26
35
|
return (
|
|
27
|
-
<
|
|
36
|
+
<Circle
|
|
37
|
+
as="span"
|
|
38
|
+
size={size}
|
|
28
39
|
data-testid="status-icon"
|
|
29
|
-
className={clsx('status-circle', `status-circle-${
|
|
40
|
+
className={clsx('status-circle', `status-circle-${sizeProp}`, sentiment)}
|
|
30
41
|
>
|
|
31
42
|
<Icon className={clsx('status-icon', iconColor)} />
|
|
32
|
-
</
|
|
43
|
+
</Circle>
|
|
33
44
|
);
|
|
34
45
|
};
|
|
35
46
|
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { Status } from '../common';
|
|
2
|
-
import { render, fireEvent, screen } from '../test-utils';
|
|
2
|
+
import { render, fireEvent, screen, mockMatchMedia } from '../test-utils';
|
|
3
3
|
|
|
4
4
|
import Summary from './Summary';
|
|
5
5
|
|
|
6
|
+
mockMatchMedia();
|
|
7
|
+
|
|
6
8
|
describe('Summary', () => {
|
|
7
9
|
describe('action', () => {
|
|
8
10
|
const onClickStub = jest.fn();
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { mount } from 'enzyme';
|
|
2
2
|
import doTimes from 'lodash.times';
|
|
3
|
+
import { mockMatchMedia } from '../test-utils';
|
|
3
4
|
|
|
4
5
|
import { InlineAlert } from '..';
|
|
5
6
|
import { Sentiment } from '../common';
|
|
@@ -7,6 +8,8 @@ import { fakeEvent, fakeKeyDownEventForKey } from '../common/fakeEvents';
|
|
|
7
8
|
|
|
8
9
|
import Typeahead from './Typeahead';
|
|
9
10
|
|
|
11
|
+
mockMatchMedia();
|
|
12
|
+
|
|
10
13
|
const defaultLocale = 'en-GB';
|
|
11
14
|
jest.mock('react-intl', () => {
|
|
12
15
|
const mockedIntl = {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { shallow, mount } from 'enzyme';
|
|
2
2
|
import { act } from 'react';
|
|
3
|
+
import { mockMatchMedia } from '../test-utils';
|
|
3
4
|
|
|
4
5
|
import { ANIMATION_DURATION_IN_MS } from '../processIndicator';
|
|
5
6
|
|
|
@@ -7,6 +8,8 @@ import { CompleteStep, UploadImageStep, ProcessingStep } from './steps';
|
|
|
7
8
|
|
|
8
9
|
import Upload from '.';
|
|
9
10
|
|
|
11
|
+
mockMatchMedia();
|
|
12
|
+
|
|
10
13
|
jest.mock('./utils/postData', () => ({
|
|
11
14
|
postData: async () => 'ServerResponse',
|
|
12
15
|
}));
|