@transferwise/components 46.100.1 → 46.100.2
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/avatarLayout/AvatarLayout.js +1 -1
- package/build/avatarLayout/AvatarLayout.js.map +1 -1
- package/build/avatarLayout/AvatarLayout.mjs +1 -1
- package/build/avatarLayout/AvatarLayout.mjs.map +1 -1
- package/build/dateLookup/DateLookup.js +3 -2
- package/build/dateLookup/DateLookup.js.map +1 -1
- package/build/dateLookup/DateLookup.mjs +3 -2
- package/build/dateLookup/DateLookup.mjs.map +1 -1
- package/build/main.css +4 -94
- package/build/styles/accordion/Accordion.css +27 -16
- package/build/styles/avatar/Avatar.css +95 -50
- package/build/styles/inputs/Input.css +37 -21
- package/build/styles/inputs/TextArea.css +35 -20
- package/build/styles/loader/Loader.css +4 -90
- package/build/styles/main.css +4 -94
- package/build/styles/popover/Popover.css +19 -12
- package/build/styles/select/Select.css +131 -68
- package/build/styles/switch/Switch.css +27 -16
- package/build/styles/tile/Tile.css +31 -18
- package/build/types/dateLookup/DateLookup.d.ts +2 -2
- package/build/types/dateLookup/DateLookup.d.ts.map +1 -1
- package/build/types/test-utils/story-config.d.ts +2 -3
- package/build/types/test-utils/story-config.d.ts.map +1 -1
- package/package.json +20 -28
- package/src/accordion/Accordion.css +27 -16
- package/src/accordion/Accordion.story.tsx +1 -1
- package/src/actionButton/ActionButton.story.tsx +3 -2
- package/src/actionOption/ActionOption.story.tsx +2 -2
- package/src/alert/Alert.story.tsx +2 -2
- package/src/alert/Alert.tests.story.tsx +2 -2
- package/src/avatar/Avatar.css +95 -50
- package/src/avatar/Avatar.spec.tsx +1 -1
- package/src/avatar/Avatar.story.tsx +3 -2
- package/src/avatarLayout/AvatarLayout.story.tsx +1 -1
- package/src/avatarLayout/AvatarLayout.tsx +1 -1
- package/src/avatarView/AvatarView.story.tsx +1 -1
- package/src/avatarWrapper/AvatarWrapper.story.tsx +3 -2
- package/src/badge/Badge.story.tsx +49 -28
- package/src/button/Button.accessibility.docs.mdx +1 -1
- package/src/button/Button.story.tsx +2 -2
- package/src/button/Button.tests.story.tsx +2 -2
- package/src/button/LegacyButton.story.tsx +3 -2
- package/src/card/Card.story.tsx +2 -2
- package/src/carousel/Carousel.story.tsx +1 -1
- package/src/checkbox/Checkbox.story.tsx +2 -2
- package/src/checkboxButton/CheckboxButton.story.tsx +2 -2
- package/src/checkboxOption/CheckboxOption.story.tsx +35 -29
- package/src/chevron/Chevron.story.tsx +1 -1
- package/src/chips/Chips.story.tsx +1 -1
- package/src/circularButton/CircularButton.story.tsx +1 -1
- package/src/circularButton/CircularButton.tests.story.tsx +1 -1
- package/src/common/bottomSheet/BottomSheet.story.tsx +2 -2
- package/src/common/card/Card.story.tsx +1 -1
- package/src/common/circle/Circle.story.tsx +2 -2
- package/src/common/locale/index.spec.ts +28 -16
- package/src/common/responsivePanel/ResponsivePanel.spec.js +8 -29
- package/src/criticalBanner/CriticalCommsBanner.story.tsx +1 -1
- package/src/dateInput/DateInput.story.tsx +2 -2
- package/src/dateInput/DateInput.tests.story.tsx +2 -2
- package/src/dateLookup/DateLookup.spec.tsx +5 -5
- package/src/dateLookup/DateLookup.story.tsx +43 -71
- package/src/dateLookup/DateLookup.tests.story.tsx +3 -3
- package/src/dateLookup/DateLookup.tsx +4 -1
- package/src/decision/Decision.story.tsx +24 -49
- package/src/definitionList/DefinitionList.story.tsx +1 -1
- package/src/dimmer/Dimmer.story.tsx +2 -2
- package/src/divider/Divider.accessibility.docs.mdx +1 -1
- package/src/divider/Divider.story.tsx +1 -1
- package/src/drawer/Drawer.story.tsx +13 -7
- package/src/dropFade/DropFade.story.tsx +1 -1
- package/src/emphasis/Emphasis.spec.tsx +8 -8
- package/src/emphasis/Emphasis.story.tsx +1 -1
- package/src/field/Field.story.tsx +3 -3
- package/src/flowNavigation/FlowNavigation.story.tsx +305 -260
- package/src/iconButton/IconButton.story.tsx +2 -2
- package/src/image/Image.story.tsx +27 -54
- package/src/info/Info.story.tsx +2 -2
- package/src/inlineAlert/InlineAlert.story.tsx +1 -1
- package/src/inputWithDisplayFormat/InputWithDisplayFormat.story.tsx +2 -2
- package/src/inputs/Input.css +37 -21
- package/src/inputs/InputGroup.story.tsx +1 -1
- package/src/inputs/SearchInput.story.tsx +1 -1
- package/src/inputs/SelectInput.docs.mdx +1 -1
- package/src/inputs/SelectInput.story.tsx +2 -2
- package/src/inputs/TextArea.css +35 -20
- package/src/instructionsList/InstructionsList.story.tsx +2 -2
- package/src/legacylistItem/LegacyListItem.story.tsx +1 -1
- package/src/loader/Loader.css +4 -90
- package/src/loader/Loader.story.tsx +1 -1
- package/src/logo/Logo.story.tsx +1 -1
- package/src/main.css +4 -94
- package/src/markdown/Markdown.story.tsx +1 -1
- package/src/modal/Modal.story.tsx +2 -2
- package/src/money/Money.story.tsx +1 -1
- package/src/moneyInput/MoneyInput.docs.mdx +1 -1
- package/src/moneyInput/MoneyInput.spec.tsx +8 -5
- package/src/moneyInput/MoneyInput.story.tsx +2 -2
- package/src/moneyInput/currencyFormatting.spec.ts +1 -1
- package/src/navigationOption/NavigationOption.story.tsx +265 -226
- package/src/nudge/Nudge.story.tsx +1 -1
- package/src/overlayHeader/OverlayHeader.story.tsx +32 -24
- package/src/phoneNumberInput/PhoneNumberInput.story.tsx +1 -1
- package/src/phoneNumberInput/utils/setDefaultPrefix/setDefaultPrefix.spec.ts +6 -3
- package/src/popover/Popover.css +19 -12
- package/src/popover/Popover.story.tsx +2 -2
- package/src/primitives/PrimitiveAnchor/stories/PrimitiveAnchor.story.tsx +2 -2
- package/src/primitives/PrimitiveAnchor/stories/PrimitiveAnchor.tests.story.tsx +2 -2
- package/src/primitives/PrimitiveButton/stories/PrimitiveButton.story.tsx +2 -2
- package/src/primitives/PrimitiveButton/stories/PrimitiveButton.tests.story.tsx +2 -2
- package/src/processIndicator/ProcessIndicator.story.tsx +1 -1
- package/src/progress/Progress.story.tsx +1 -1
- package/src/progressBar/ProgressBar.story.tsx +1 -1
- package/src/promoCard/PromoCard.story.tsx +1 -1
- package/src/promoCard/PromoCardGroup.story.tsx +1 -1
- package/src/provider/Provider.spec.tsx +2 -2
- package/src/provider/Provider.story.tsx +1 -1
- package/src/provider/direction/DirectionProvider.spec.tsx +1 -1
- package/src/provider/language/LanguageProvider.spec.tsx +1 -1
- package/src/provider/theme/ThemeProvider.story.tsx +1 -1
- package/src/radio/Radio.story.tsx +59 -42
- package/src/radioGroup/RadioGroup.story.tsx +2 -2
- package/src/radioOption/RadioOption.story.tsx +73 -38
- package/src/segmentedControl/SegmentedControl.story.tsx +1 -1
- package/src/select/Select.css +131 -68
- package/src/select/Select.story.tsx +385 -397
- package/src/slidingPanel/SlidingPanel.story.tsx +30 -13
- package/src/snackbar/Snackbar.story.tsx +50 -36
- package/src/snackbar/Snackbar.tests.story.tsx +3 -2
- package/src/statusIcon/StatusIcon.docs.mdx +1 -1
- package/src/statusIcon/StatusIcon.spec.tsx +8 -5
- package/src/statusIcon/StatusIcon.story.tsx +1 -1
- package/src/stepper/Stepper.story.tsx +2 -2
- package/src/stepper/Stepper.tests.story.tsx +2 -2
- package/src/sticky/Sticky.story.tsx +1 -1
- package/src/summary/Summary.story.tsx +18 -17
- package/src/switch/Switch.css +27 -16
- package/src/switch/Switch.story.tsx +2 -2
- package/src/switchOption/SwitchOption.story.tsx +1 -1
- package/src/table/Table.story.tsx +1 -1
- package/src/test-utils/story-config.ts +9 -6
- package/src/textareaWithDisplayFormat/TextareaWithDisplayFormat.story.tsx +2 -2
- package/src/tile/Tile.css +31 -18
- package/src/tile/Tile.story.tsx +43 -43
- package/src/tooltip/Tooltip.story.tsx +2 -2
- package/src/typeahead/Typeahead.story.tsx +2 -2
- package/src/upload/Upload.story.tsx +2 -2
- package/src/upload/Upload.tests.story.tsx +2 -2
- package/src/upload/utils/isTypeValid/isTypeValid.spec.ts +3 -1
- package/src/uploadInput/UploadInput.story.tsx +1 -1
- package/src/uploadInput/UploadInput.tests.story.tsx +3 -3
- package/src/withId/withId.docs.mdx +1 -1
- package/src/withId/withId.story.tsx +1 -1
- package/src/common/responsivePanel/__snapshots__/ResponsivePanel.spec.js.snap +0 -21
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* eslint-disable react/jsx-key */
|
|
2
|
-
import { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
3
3
|
import AvatarLayout, { AvatarLayoutProps } from '.';
|
|
4
4
|
import { Freeze, Graph, Plane, Rewards } from '@transferwise/icons';
|
|
5
5
|
import { Flag } from '@wise/art';
|
|
@@ -84,7 +84,7 @@ export default function AvatarLayout({
|
|
|
84
84
|
const DIAGONAL_LAYOUT_STYLE_CONFIG = {
|
|
85
85
|
// Diagonal layout doesn't support 16 size
|
|
86
86
|
16: { avatarSize: undefined, offset: undefined, fontSize: undefined, iconSize: undefined },
|
|
87
|
-
24: { avatarSize:
|
|
87
|
+
24: { avatarSize: 16, offset: 2.5, fontSize: 8, iconSize: 11.25 },
|
|
88
88
|
32: { avatarSize: 20, offset: 2.5, fontSize: 12, iconSize: 15 },
|
|
89
89
|
40: { avatarSize: 24, offset: 4.5, fontSize: 12, iconSize: 18 },
|
|
90
90
|
48: { avatarSize: 30, offset: 3.5, fontSize: 14, iconSize: 16.87 },
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Meta, StoryObj } from '@storybook/react';
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
2
2
|
|
|
3
3
|
import { ProfileType, Sentiment, Status } from '../common';
|
|
4
4
|
|
|
@@ -9,7 +9,8 @@ import AvatarWrapper from './AvatarWrapper';
|
|
|
9
9
|
*/
|
|
10
10
|
export default {
|
|
11
11
|
component: AvatarWrapper,
|
|
12
|
-
title: 'Content/AvatarWrapper
|
|
12
|
+
title: 'Content/AvatarWrapper',
|
|
13
|
+
tags: ['deprecated'],
|
|
13
14
|
} satisfies Meta<typeof AvatarWrapper>;
|
|
14
15
|
|
|
15
16
|
type Story = StoryObj<typeof AvatarWrapper>;
|
|
@@ -1,20 +1,42 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { Meta } from '@storybook/react-webpack5';
|
|
3
2
|
import { default as AvatarComponent, AvatarType } from '../avatar';
|
|
4
3
|
import { Size, Theme } from '../common';
|
|
5
|
-
|
|
6
|
-
import Badge from './Badge';
|
|
4
|
+
import Badge, { type BadgeProps } from './Badge';
|
|
7
5
|
|
|
8
6
|
/**
|
|
9
7
|
* @deprecated use **`<AvatarView badge={..} />`** components instead
|
|
10
8
|
*/
|
|
11
|
-
|
|
9
|
+
const meta: Meta<typeof Badge> = {
|
|
12
10
|
component: Badge,
|
|
13
|
-
title: 'Content/Badge
|
|
14
|
-
|
|
11
|
+
title: 'Content/Badge',
|
|
12
|
+
tags: ['deprecated'],
|
|
15
13
|
};
|
|
16
14
|
|
|
17
|
-
export
|
|
15
|
+
export default meta;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Used for showing multiple components within a Canvas.
|
|
19
|
+
* @decorator
|
|
20
|
+
*/
|
|
21
|
+
const withComponentGrid =
|
|
22
|
+
(maxWidth = 'auto') =>
|
|
23
|
+
(Story: any) => (
|
|
24
|
+
<div
|
|
25
|
+
style={{
|
|
26
|
+
width: '100%',
|
|
27
|
+
placeItems: 'center',
|
|
28
|
+
justifyContent: 'center',
|
|
29
|
+
display: 'flex',
|
|
30
|
+
flexWrap: 'wrap',
|
|
31
|
+
gap: '2rem',
|
|
32
|
+
maxWidth,
|
|
33
|
+
}}
|
|
34
|
+
>
|
|
35
|
+
<Story />
|
|
36
|
+
</div>
|
|
37
|
+
);
|
|
38
|
+
|
|
39
|
+
const ExampleBadgeStyle = {
|
|
18
40
|
background: 'var(--color-content-positive)',
|
|
19
41
|
width: '100%',
|
|
20
42
|
height: '100%',
|
|
@@ -25,47 +47,46 @@ export const ExampleBadgeCss = {
|
|
|
25
47
|
alignItems: 'center',
|
|
26
48
|
};
|
|
27
49
|
|
|
28
|
-
export const
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
50
|
+
export const LegacyAvatarWithBadge = {
|
|
51
|
+
decorators: [withComponentGrid()],
|
|
52
|
+
parameters: {
|
|
53
|
+
docs: {
|
|
54
|
+
source: { type: 'dynamic' },
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
render: () => {
|
|
58
|
+
return (
|
|
59
|
+
<>
|
|
35
60
|
<Badge
|
|
36
|
-
badge={<div style={
|
|
37
|
-
border={
|
|
61
|
+
badge={<div style={ExampleBadgeStyle}>B</div>}
|
|
62
|
+
border={Theme.LIGHT}
|
|
38
63
|
size={Size.LARGE}
|
|
39
64
|
>
|
|
40
65
|
<AvatarComponent type={AvatarType.INITIALS} size={Size.LARGE}>
|
|
41
66
|
AA
|
|
42
67
|
</AvatarComponent>
|
|
43
68
|
</Badge>
|
|
44
|
-
</div>
|
|
45
69
|
|
|
46
|
-
<div style={{ display: 'inline', margin: 8 }}>
|
|
47
70
|
<Badge
|
|
48
|
-
badge={<div style={
|
|
49
|
-
border={
|
|
71
|
+
badge={<div style={ExampleBadgeStyle}>B</div>}
|
|
72
|
+
border={Theme.LIGHT}
|
|
50
73
|
size={Size.MEDIUM}
|
|
51
74
|
>
|
|
52
75
|
<AvatarComponent type={AvatarType.INITIALS} size={Size.MEDIUM}>
|
|
53
76
|
AA
|
|
54
77
|
</AvatarComponent>
|
|
55
78
|
</Badge>
|
|
56
|
-
</div>
|
|
57
79
|
|
|
58
|
-
<div style={{ display: 'inline', margin: 8 }}>
|
|
59
80
|
<Badge
|
|
60
|
-
badge={<div style={
|
|
61
|
-
border={
|
|
81
|
+
badge={<div style={ExampleBadgeStyle}>B</div>}
|
|
82
|
+
border={Theme.LIGHT}
|
|
62
83
|
size={Size.SMALL}
|
|
63
84
|
>
|
|
64
85
|
<AvatarComponent type={AvatarType.INITIALS} size={Size.MEDIUM}>
|
|
65
86
|
AA
|
|
66
87
|
</AvatarComponent>
|
|
67
88
|
</Badge>
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
89
|
+
</>
|
|
90
|
+
);
|
|
91
|
+
},
|
|
71
92
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Meta, StoryObj } from '@storybook/react';
|
|
2
|
-
import { fn } from '
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
2
|
+
import { fn } from 'storybook/test';
|
|
3
3
|
import { Freeze, ArrowRight, ChevronRight } from '@transferwise/icons';
|
|
4
4
|
import { Flag } from '@wise/art';
|
|
5
5
|
import Button from './Button.resolver';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Meta } from '@storybook/react';
|
|
1
|
+
import { Meta } from '@storybook/react-webpack5';
|
|
2
2
|
import Button from './Button.resolver';
|
|
3
|
-
import { expect, userEvent, within } from '
|
|
3
|
+
import { expect, userEvent, within } from 'storybook/test';
|
|
4
4
|
import { storyConfig } from '../test-utils';
|
|
5
5
|
|
|
6
6
|
const meta: Meta<typeof Button> = {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Meta, StoryObj } from '@storybook/react';
|
|
2
|
-
import { userEvent, within, fn, expect } from '
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
2
|
+
import { userEvent, within, fn, expect } from 'storybook/test';
|
|
3
3
|
import { useState } from 'react';
|
|
4
4
|
|
|
5
5
|
import Button from '.';
|
|
@@ -25,6 +25,7 @@ const withContainer = (Story: any) => (
|
|
|
25
25
|
const meta: Meta<typeof LegacyButton> = {
|
|
26
26
|
component: LegacyButton,
|
|
27
27
|
title: 'Actions/Button/Legacy Button',
|
|
28
|
+
tags: ['deprecated'],
|
|
28
29
|
args: {
|
|
29
30
|
size: undefined,
|
|
30
31
|
priority: undefined,
|
package/src/card/Card.story.tsx
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Meta, StoryObj } from '@storybook/react';
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
2
2
|
import { FastFlag as FastFlagIcon } from '@transferwise/icons';
|
|
3
3
|
import { useState } from 'react';
|
|
4
|
-
import { fn } from '
|
|
4
|
+
import { fn } from 'storybook/test';
|
|
5
5
|
|
|
6
6
|
import Card from '.';
|
|
7
7
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Meta, StoryObj } from '@storybook/react';
|
|
2
|
-
import { fn } from '
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
2
|
+
import { fn } from 'storybook/test';
|
|
3
3
|
|
|
4
4
|
import { Field } from '../field/Field';
|
|
5
5
|
import { lorem10, storyConfig } from '../test-utils';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { action } from '
|
|
2
|
-
import { Meta, StoryObj } from '@storybook/react';
|
|
1
|
+
import { action } from 'storybook/actions';
|
|
2
|
+
import { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
3
3
|
import { useState } from 'react';
|
|
4
4
|
|
|
5
5
|
import CheckboxButton from './CheckboxButton';
|
|
@@ -1,66 +1,72 @@
|
|
|
1
|
-
import { action } from '@storybook/addon-actions';
|
|
2
|
-
import { boolean, text } from '@storybook/addon-knobs';
|
|
3
|
-
import { Meta } from '@storybook/react';
|
|
4
|
-
import { FastFlag as FastFlagIcon } from '@transferwise/icons';
|
|
5
1
|
import { useState } from 'react';
|
|
6
|
-
|
|
2
|
+
import { action } from 'storybook/actions';
|
|
3
|
+
import { Meta } from '@storybook/react-webpack5';
|
|
4
|
+
import { FastFlag } from '@transferwise/icons';
|
|
7
5
|
import { Nudge, Title, Typography } from '..';
|
|
8
|
-
|
|
9
|
-
import CheckboxOption from './CheckboxOption';
|
|
6
|
+
import CheckboxOption, { type CheckboxOptionProps } from './CheckboxOption';
|
|
10
7
|
|
|
11
8
|
const meta: Meta<typeof CheckboxOption> = {
|
|
12
9
|
component: CheckboxOption,
|
|
13
10
|
title: 'Option/CheckboxOption',
|
|
11
|
+
parameters: {
|
|
12
|
+
docs: {
|
|
13
|
+
source: { type: 'dynamic' },
|
|
14
|
+
},
|
|
15
|
+
},
|
|
14
16
|
};
|
|
15
17
|
|
|
16
18
|
export default meta;
|
|
17
19
|
|
|
18
|
-
const
|
|
20
|
+
const commonArgs = {
|
|
21
|
+
disabled: false,
|
|
22
|
+
title: 'Checkbox option',
|
|
23
|
+
content: 'Normally, the button and icon are vertically centered.',
|
|
24
|
+
showMediaAtAllSizes: false,
|
|
25
|
+
isContainerAligned: false,
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
const renderTemplate = (args: Partial<CheckboxOptionProps> = commonArgs) => {
|
|
29
|
+
const mergedArgs = { ...commonArgs, ...args };
|
|
19
30
|
const [checked, setChecked] = useState(true);
|
|
20
|
-
const content = text('content', 'Normally, the button and icon are vertically centered.');
|
|
21
|
-
const title = text('title', 'Checkbox option');
|
|
22
|
-
const disabled = boolean('disabled', false);
|
|
23
|
-
const showMediaAtAllSizes = boolean('showMediaAtAllSizes', false);
|
|
24
|
-
const isContainerAligned = boolean('isContainerAligned', false);
|
|
25
31
|
|
|
26
32
|
return (
|
|
27
33
|
<CheckboxOption
|
|
28
34
|
id="checkbox-option"
|
|
29
35
|
name="checkbox-option"
|
|
30
36
|
checked={checked}
|
|
31
|
-
disabled={disabled}
|
|
32
|
-
title={title}
|
|
33
|
-
content={content}
|
|
34
|
-
media={<
|
|
35
|
-
showMediaAtAllSizes={showMediaAtAllSizes}
|
|
36
|
-
isContainerAligned={isContainerAligned}
|
|
37
|
+
disabled={mergedArgs.disabled}
|
|
38
|
+
title={mergedArgs.title}
|
|
39
|
+
content={mergedArgs.content}
|
|
40
|
+
media={<FastFlag />}
|
|
41
|
+
showMediaAtAllSizes={mergedArgs.showMediaAtAllSizes}
|
|
42
|
+
isContainerAligned={mergedArgs.isContainerAligned}
|
|
37
43
|
onChange={(newValue) => setChecked(newValue)}
|
|
38
44
|
/>
|
|
39
45
|
);
|
|
40
46
|
};
|
|
41
47
|
|
|
42
|
-
export const Basic = () => {
|
|
43
|
-
return
|
|
48
|
+
export const Basic = (args: CheckboxOptionProps) => {
|
|
49
|
+
return renderTemplate(args);
|
|
44
50
|
};
|
|
45
51
|
|
|
46
|
-
export const Multiple = () => {
|
|
52
|
+
export const Multiple = (args: CheckboxOptionProps) => {
|
|
47
53
|
return (
|
|
48
54
|
<>
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
55
|
+
{renderTemplate(args)}
|
|
56
|
+
{renderTemplate(args)}
|
|
57
|
+
{renderTemplate(args)}
|
|
52
58
|
</>
|
|
53
59
|
);
|
|
54
60
|
};
|
|
55
61
|
|
|
56
|
-
export const WithContainerContent = () => (
|
|
62
|
+
export const WithContainerContent = (args: CheckboxOptionProps) => (
|
|
57
63
|
<>
|
|
58
64
|
<Title type={Typography.TITLE_SUBSECTION} className="m-b-1">
|
|
59
65
|
Choose how to pay
|
|
60
66
|
</Title>
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
67
|
+
{renderTemplate(args)}
|
|
68
|
+
{renderTemplate(args)}
|
|
69
|
+
{renderTemplate(args)}
|
|
64
70
|
<div>
|
|
65
71
|
<Nudge
|
|
66
72
|
className="m-t-2"
|
|
@@ -2,7 +2,7 @@ import * as Icons from '@transferwise/icons';
|
|
|
2
2
|
|
|
3
3
|
import { ControlType, Priority } from '../common';
|
|
4
4
|
|
|
5
|
-
import { Meta, StoryObj } from '@storybook/react';
|
|
5
|
+
import { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
6
6
|
import CircularButton from './CircularButton';
|
|
7
7
|
import { storyConfig } from '../test-utils';
|
|
8
8
|
import Title from '../title';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { action } from '
|
|
2
|
-
import { Meta, StoryObj } from '@storybook/react';
|
|
1
|
+
import { action } from 'storybook/actions';
|
|
2
|
+
import { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
3
3
|
import { FastFlag } from '@transferwise/icons';
|
|
4
4
|
import { useState } from 'react';
|
|
5
5
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Meta, StoryObj } from '@storybook/react';
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
2
2
|
import { storyConfig } from '../../test-utils';
|
|
3
3
|
import Circle from './Circle';
|
|
4
4
|
import { Profile } from '@transferwise/icons';
|
|
5
|
-
import { action } from '
|
|
5
|
+
import { action } from 'storybook/actions';
|
|
6
6
|
import { CircleProps } from '.';
|
|
7
7
|
import Body from '../../body';
|
|
8
8
|
|
|
@@ -24,17 +24,20 @@ describe('locale utils', () => {
|
|
|
24
24
|
['zh_HK', 'zh'],
|
|
25
25
|
['ja-JP', 'ja'],
|
|
26
26
|
['zhHK', null],
|
|
27
|
-
[null
|
|
28
|
-
[undefined
|
|
27
|
+
[null, null],
|
|
28
|
+
[undefined, null],
|
|
29
29
|
['', null],
|
|
30
30
|
[' ', null],
|
|
31
31
|
['ar-dz', null],
|
|
32
32
|
['ar-iq', null],
|
|
33
33
|
['zh-tw', 'zh'],
|
|
34
34
|
['nl-nl', 'nl'],
|
|
35
|
-
])(
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
])(
|
|
36
|
+
'locale "%s" -> language "%s"',
|
|
37
|
+
(locale: string | null | undefined, expectedValue: string | null) => {
|
|
38
|
+
expect(getLangFromLocale(locale!)).toBe(expectedValue);
|
|
39
|
+
},
|
|
40
|
+
);
|
|
38
41
|
});
|
|
39
42
|
|
|
40
43
|
describe('adjustLocale', () => {
|
|
@@ -51,17 +54,20 @@ describe('locale utils', () => {
|
|
|
51
54
|
['zh_HK', 'zh-HK'],
|
|
52
55
|
['ja-JP', 'ja-JP'],
|
|
53
56
|
['zhHK', null],
|
|
54
|
-
[null
|
|
55
|
-
[undefined
|
|
57
|
+
[null, null],
|
|
58
|
+
[undefined, null],
|
|
56
59
|
['', null],
|
|
57
60
|
[' ', null],
|
|
58
61
|
['ar-dz', 'ar-DZ'],
|
|
59
62
|
['ar-iq', 'ar-IQ'],
|
|
60
63
|
['zh-tw', 'zh-TW'],
|
|
61
64
|
['nl-nl', 'nl-NL'],
|
|
62
|
-
])(
|
|
63
|
-
|
|
64
|
-
|
|
65
|
+
])(
|
|
66
|
+
'locale "%s" -> language "%s"',
|
|
67
|
+
(locale: string | null | undefined, expectedValue: string | null) => {
|
|
68
|
+
expect(adjustLocale(locale!)).toBe(expectedValue);
|
|
69
|
+
},
|
|
70
|
+
);
|
|
65
71
|
});
|
|
66
72
|
|
|
67
73
|
describe('getCountryFromLocale', () => {
|
|
@@ -75,9 +81,12 @@ describe('locale utils', () => {
|
|
|
75
81
|
['es_ES', 'ES'],
|
|
76
82
|
['es_E', null],
|
|
77
83
|
['es-E', null],
|
|
78
|
-
])(
|
|
79
|
-
|
|
80
|
-
|
|
84
|
+
])(
|
|
85
|
+
'given an "%s" as a locale value it should return "%s"',
|
|
86
|
+
(locale: string, expectedValue: string | null) => {
|
|
87
|
+
expect(getCountryFromLocale(locale)).toBe(expectedValue);
|
|
88
|
+
},
|
|
89
|
+
);
|
|
81
90
|
});
|
|
82
91
|
|
|
83
92
|
describe('getDirectionFromLocale', () => {
|
|
@@ -87,8 +96,11 @@ describe('locale utils', () => {
|
|
|
87
96
|
['ar-AE', 'rtl'],
|
|
88
97
|
['ar_AE', 'rtl'],
|
|
89
98
|
['he', 'rtl'],
|
|
90
|
-
])(
|
|
91
|
-
|
|
92
|
-
|
|
99
|
+
])(
|
|
100
|
+
'given an "%s" as a locale value it should return "%s"',
|
|
101
|
+
(locale: string, expectedValue: string) => {
|
|
102
|
+
expect(getDirectionFromLocale(locale)).toBe(expectedValue);
|
|
103
|
+
},
|
|
104
|
+
);
|
|
93
105
|
});
|
|
94
106
|
});
|
|
@@ -1,32 +1,11 @@
|
|
|
1
1
|
import { Breakpoint, Position } from '..';
|
|
2
|
-
import { mockMatchMedia, render } from '../../test-utils';
|
|
2
|
+
import { mockMatchMedia, render, screen } from '../../test-utils';
|
|
3
|
+
import React, { forwardRef } from 'react';
|
|
3
4
|
|
|
4
5
|
import ResponsivePanel from './ResponsivePanel';
|
|
5
6
|
|
|
6
7
|
mockMatchMedia();
|
|
7
8
|
|
|
8
|
-
jest.mock('../bottomSheet', () => {
|
|
9
|
-
const { forwardRef } = require('react');
|
|
10
|
-
return forwardRef(({ open, children }, reference) =>
|
|
11
|
-
open ? (
|
|
12
|
-
<div ref={reference} className="np-bottom-sheet">
|
|
13
|
-
{children}
|
|
14
|
-
</div>
|
|
15
|
-
) : null,
|
|
16
|
-
);
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
jest.mock('../panel', () => {
|
|
20
|
-
const { forwardRef } = require('react');
|
|
21
|
-
return forwardRef(({ open, children }, reference) =>
|
|
22
|
-
open ? (
|
|
23
|
-
<div ref={reference} className="np-panel np-panel--open">
|
|
24
|
-
{children}
|
|
25
|
-
</div>
|
|
26
|
-
) : null,
|
|
27
|
-
);
|
|
28
|
-
});
|
|
29
|
-
|
|
30
9
|
describe('ResponsivePanel', () => {
|
|
31
10
|
const props = {
|
|
32
11
|
arrow: true,
|
|
@@ -45,13 +24,13 @@ describe('ResponsivePanel', () => {
|
|
|
45
24
|
|
|
46
25
|
describe('on desktop', () => {
|
|
47
26
|
it('renders Panel', async () => {
|
|
48
|
-
|
|
27
|
+
render(
|
|
49
28
|
<ResponsivePanel {...props} intialOpen>
|
|
50
29
|
children
|
|
51
30
|
</ResponsivePanel>,
|
|
52
|
-
)
|
|
31
|
+
);
|
|
53
32
|
|
|
54
|
-
expect(
|
|
33
|
+
expect(screen.getByRole('dialog')).not.toHaveAttribute('aria-modal');
|
|
55
34
|
});
|
|
56
35
|
});
|
|
57
36
|
|
|
@@ -61,13 +40,13 @@ describe('ResponsivePanel', () => {
|
|
|
61
40
|
});
|
|
62
41
|
|
|
63
42
|
it('renders bottomSheet', async () => {
|
|
64
|
-
|
|
43
|
+
render(
|
|
65
44
|
<ResponsivePanel {...props} open>
|
|
66
45
|
children
|
|
67
46
|
</ResponsivePanel>,
|
|
68
|
-
)
|
|
47
|
+
);
|
|
69
48
|
|
|
70
|
-
expect(
|
|
49
|
+
expect(screen.getByRole('dialog')).toHaveAttribute('aria-modal');
|
|
71
50
|
});
|
|
72
51
|
});
|
|
73
52
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Meta, StoryObj } from '@storybook/react';
|
|
2
|
-
import { userEvent, within, fn } from '
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
2
|
+
import { userEvent, within, fn } from 'storybook/test';
|
|
3
3
|
|
|
4
4
|
import { DateInput, Field } from '..';
|
|
5
5
|
import { lorem10, storyConfig } from '../test-utils';
|
|
@@ -42,9 +42,9 @@ describe('DateLookup', () => {
|
|
|
42
42
|
expect(button).toHaveAttribute('aria-haspopup');
|
|
43
43
|
});
|
|
44
44
|
|
|
45
|
-
it.each([' ', '{Enter}', '{ArrowDown}', '{ArrowUp}', '{ArrowRight}', '{ArrowLeft}'])(
|
|
45
|
+
it.each([' ', '{Enter}', '{ArrowDown}', '{ArrowUp}', '{ArrowRight}', '{ArrowLeft}'] as const)(
|
|
46
46
|
"opens with '%s' and closes with '{Escape}'",
|
|
47
|
-
async (text) => {
|
|
47
|
+
async (text: string) => {
|
|
48
48
|
render(<DateLookup value={initialValue} onChange={() => {}} />);
|
|
49
49
|
|
|
50
50
|
await user.tab();
|
|
@@ -94,7 +94,7 @@ describe('DateLookup', () => {
|
|
|
94
94
|
['{ArrowRight}', +1],
|
|
95
95
|
['{ArrowUp}', -7],
|
|
96
96
|
['{ArrowDown}', +7],
|
|
97
|
-
])("handles '%s' to step %d day(s)", async (text, step) => {
|
|
97
|
+
])("handles '%s' to step %d day(s)", async (text: string, step: number) => {
|
|
98
98
|
const handleChange = jest.fn();
|
|
99
99
|
await setupAndOpenWithMouse({ onChange: handleChange });
|
|
100
100
|
|
|
@@ -121,7 +121,7 @@ describe('DateLookup', () => {
|
|
|
121
121
|
['{ArrowRight}', +1],
|
|
122
122
|
['{ArrowUp}', -4],
|
|
123
123
|
['{ArrowDown}', +4],
|
|
124
|
-
])("handles '%s' to step %d year(s)", async (text, step) => {
|
|
124
|
+
])("handles '%s' to step %d year(s)", async (text: string, step: number) => {
|
|
125
125
|
const handleChange = jest.fn();
|
|
126
126
|
await setupAndOpenWithMouse({ onChange: handleChange });
|
|
127
127
|
|
|
@@ -153,7 +153,7 @@ describe('DateLookup', () => {
|
|
|
153
153
|
['{ArrowRight}', +1],
|
|
154
154
|
['{ArrowUp}', -4],
|
|
155
155
|
['{ArrowDown}', +4],
|
|
156
|
-
])("handles '%s' to step %d month(s)", async (text, step) => {
|
|
156
|
+
])("handles '%s' to step %d month(s)", async (text: string, step: number) => {
|
|
157
157
|
const handleChange = jest.fn();
|
|
158
158
|
await setupAndOpenWithMouse({ onChange: handleChange });
|
|
159
159
|
|