@transferwise/components 46.100.1 → 46.101.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/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/i18n/en.json +2 -0
- package/build/i18n/en.json.js +2 -0
- package/build/i18n/en.json.js.map +1 -1
- package/build/i18n/en.json.mjs +2 -0
- package/build/i18n/en.json.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/index.d.ts +4 -0
- package/build/types/test-utils/index.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/build/types/upload/Upload.d.ts +6 -2
- package/build/types/upload/Upload.d.ts.map +1 -1
- package/build/types/upload/Upload.messages.d.ts +8 -0
- package/build/types/upload/Upload.messages.d.ts.map +1 -1
- package/build/types/uploadInput/UploadInput.d.ts +1 -1
- package/build/types/uploadInput/uploadButton/UploadButton.d.ts +4 -2
- package/build/types/uploadInput/uploadButton/UploadButton.d.ts.map +1 -1
- package/build/upload/Upload.js +16 -9
- package/build/upload/Upload.js.map +1 -1
- package/build/upload/Upload.messages.js +6 -0
- package/build/upload/Upload.messages.js.map +1 -1
- package/build/upload/Upload.messages.mjs +6 -0
- package/build/upload/Upload.messages.mjs.map +1 -1
- package/build/upload/Upload.mjs +16 -9
- package/build/upload/Upload.mjs.map +1 -1
- package/build/uploadInput/UploadInput.js +1 -1
- package/build/uploadInput/UploadInput.js.map +1 -1
- package/build/uploadInput/UploadInput.mjs +1 -1
- package/build/uploadInput/UploadInput.mjs.map +1 -1
- package/build/uploadInput/uploadButton/UploadButton.js +7 -4
- package/build/uploadInput/uploadButton/UploadButton.js.map +1 -1
- package/build/uploadInput/uploadButton/UploadButton.mjs +7 -4
- package/build/uploadInput/uploadButton/UploadButton.mjs.map +1 -1
- package/package.json +19 -27
- 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/i18n/en.json +2 -0
- 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.messages.ts +8 -0
- package/src/upload/Upload.spec.tsx +6 -0
- package/src/upload/Upload.story.tsx +120 -5
- package/src/upload/Upload.tests.story.tsx +5 -3
- package/src/upload/Upload.tsx +24 -15
- 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 +10 -3
- package/src/uploadInput/UploadInput.tsx +2 -2
- package/src/uploadInput/uploadButton/UploadButton.spec.tsx +6 -0
- package/src/uploadInput/uploadButton/UploadButton.tsx +12 -6
- 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,275 +1,314 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { action } from '
|
|
3
|
-
import {
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
2
|
+
import { action } from 'storybook/actions';
|
|
3
|
+
import { Illustration, Assets, Flag } from '@wise/art';
|
|
4
4
|
import {
|
|
5
5
|
FastFlag as FastFlagIcon,
|
|
6
6
|
Bank as BankIcon,
|
|
7
|
-
PlusCircle,
|
|
8
7
|
Profile,
|
|
9
8
|
UpwardGraph as UpwardGraphIcon,
|
|
10
9
|
FastFlag,
|
|
11
10
|
} from '@transferwise/icons';
|
|
12
|
-
import {
|
|
13
|
-
|
|
14
|
-
import { Nudge, Header, Title, Typography, AvatarView } from '..';
|
|
15
|
-
|
|
11
|
+
import type { AvatarViewBadgeProps } from '../avatarView/AvatarView';
|
|
12
|
+
import { Nudge, Header, Title, Typography, AvatarView, type NavigationOptionProps } from '..';
|
|
16
13
|
import NavigationOption from './NavigationOption';
|
|
14
|
+
import { fn } from 'storybook/test';
|
|
15
|
+
|
|
16
|
+
type StoryArgs = NavigationOptionProps & { hasTitleOnly?: boolean };
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
const meta: Meta<StoryArgs> = {
|
|
19
19
|
component: NavigationOption,
|
|
20
20
|
title: 'Option/NavigationOption',
|
|
21
|
+
tags: ['autodocs'],
|
|
22
|
+
argTypes: {
|
|
23
|
+
href: { control: 'text' },
|
|
24
|
+
title: { control: 'text' },
|
|
25
|
+
content: { control: 'text' },
|
|
26
|
+
complex: { control: 'boolean' },
|
|
27
|
+
disabled: { control: 'boolean' },
|
|
28
|
+
showMediaAtAllSizes: { control: 'boolean' },
|
|
29
|
+
showMediaCircle: { control: 'boolean' },
|
|
30
|
+
isContainerAligned: { control: 'boolean' },
|
|
31
|
+
className: { control: 'text' },
|
|
32
|
+
hasTitleOnly: { control: 'boolean' },
|
|
33
|
+
media: { control: false },
|
|
34
|
+
},
|
|
21
35
|
};
|
|
36
|
+
export default meta;
|
|
22
37
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
className?: string;
|
|
33
|
-
hasTitleOnly?: boolean;
|
|
34
|
-
media?: ReactNode;
|
|
38
|
+
const defaultArgs = {
|
|
39
|
+
title: 'Navigation option',
|
|
40
|
+
content: 'Button and icon are vertically centered.',
|
|
41
|
+
complex: false,
|
|
42
|
+
disabled: false,
|
|
43
|
+
showMediaAtAllSizes: false,
|
|
44
|
+
showMediaCircle: true,
|
|
45
|
+
isContainerAligned: false,
|
|
46
|
+
hasTitleOnly: false,
|
|
35
47
|
};
|
|
36
48
|
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
const complex = boolean('complex', props.complex ?? false);
|
|
42
|
-
const disabled = boolean('disabled', props.disabled ?? false);
|
|
43
|
-
const showMediaAtAllSizes = boolean('showMediaAtAllSizes', props.showMediaAtAllSizes ?? false);
|
|
44
|
-
const showMediaCircle = props.showMediaCircle ?? boolean('showMediaCircle', true);
|
|
45
|
-
const isContainerAligned = boolean('isContainerAligned', false);
|
|
46
|
-
const className = text('className', props.className ?? '');
|
|
49
|
+
const badgeProps: AvatarViewBadgeProps = {
|
|
50
|
+
icon: <FastFlag />,
|
|
51
|
+
type: 'action',
|
|
52
|
+
};
|
|
47
53
|
|
|
48
|
-
|
|
54
|
+
export const Basic: StoryObj<StoryArgs> = {
|
|
55
|
+
render: ({ hasTitleOnly, ...args }: StoryArgs) => (
|
|
49
56
|
<NavigationOption
|
|
50
|
-
|
|
51
|
-
disabled={disabled}
|
|
57
|
+
{...args}
|
|
52
58
|
id="navigation-option"
|
|
53
59
|
name="navigation-option"
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
media={props.media || <FastFlagIcon />}
|
|
58
|
-
showMediaAtAllSizes={showMediaAtAllSizes}
|
|
59
|
-
isContainerAligned={isContainerAligned}
|
|
60
|
-
showMediaCircle={showMediaCircle}
|
|
61
|
-
className={className}
|
|
62
|
-
onClick={action('clicked')}
|
|
60
|
+
content={hasTitleOnly ? null : args.content}
|
|
61
|
+
media={args.media || <FastFlagIcon />}
|
|
62
|
+
onClick={fn()}
|
|
63
63
|
/>
|
|
64
|
-
)
|
|
64
|
+
),
|
|
65
|
+
args: { ...defaultArgs },
|
|
65
66
|
};
|
|
66
67
|
|
|
67
|
-
export const
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
68
|
+
export const Variants: StoryObj<StoryArgs> = {
|
|
69
|
+
render: ({ hasTitleOnly, ...args }: StoryArgs) => (
|
|
70
|
+
<div>
|
|
71
|
+
<div className="m-b-2">
|
|
72
|
+
<div className="title-4 m-b-1">Has Title Only</div>
|
|
73
|
+
<NavigationOption
|
|
74
|
+
{...args}
|
|
75
|
+
content={null}
|
|
76
|
+
media={args.media || <FastFlagIcon />}
|
|
77
|
+
onClick={fn()}
|
|
78
|
+
/>
|
|
79
|
+
</div>
|
|
80
|
+
<div className="m-b-2">
|
|
81
|
+
<div className="title-4 m-b-1">Full Content</div>
|
|
82
|
+
<NavigationOption
|
|
83
|
+
{...args}
|
|
84
|
+
content={hasTitleOnly ? null : args.content}
|
|
85
|
+
media={args.media || <FastFlagIcon />}
|
|
86
|
+
onClick={fn()}
|
|
87
|
+
/>
|
|
88
|
+
</div>
|
|
89
|
+
<div className="m-b-2">
|
|
90
|
+
<div className="title-4 m-b-1">With Icon</div>
|
|
91
|
+
<NavigationOption
|
|
92
|
+
{...args}
|
|
93
|
+
media={<BankIcon size={24} />}
|
|
94
|
+
content={hasTitleOnly ? null : args.content}
|
|
95
|
+
onClick={fn()}
|
|
96
|
+
/>
|
|
97
|
+
</div>
|
|
98
|
+
<div className="m-b-2">
|
|
99
|
+
<div className="title-4 m-b-1">With Icon Avatar</div>
|
|
100
|
+
<NavigationOption
|
|
101
|
+
{...args}
|
|
102
|
+
showMediaCircle={false}
|
|
103
|
+
media={
|
|
104
|
+
<AvatarView badge={{ type: 'reference' }}>
|
|
105
|
+
<Profile />
|
|
106
|
+
</AvatarView>
|
|
107
|
+
}
|
|
108
|
+
content={hasTitleOnly ? null : args.content}
|
|
109
|
+
onClick={fn()}
|
|
110
|
+
/>
|
|
111
|
+
</div>
|
|
112
|
+
<div className="m-b-2">
|
|
113
|
+
<div className="title-4 m-b-1">With Contact Avatar</div>
|
|
114
|
+
<NavigationOption
|
|
115
|
+
{...args}
|
|
116
|
+
showMediaCircle={false}
|
|
117
|
+
media={<AvatarView badge={badgeProps} profileName="Spencer Penn" />}
|
|
118
|
+
content={hasTitleOnly ? null : args.content}
|
|
119
|
+
onClick={fn()}
|
|
120
|
+
/>
|
|
121
|
+
</div>
|
|
122
|
+
<div className="m-t-4 m-b-2">
|
|
123
|
+
<div className="title-4 m-b-1">Not recommended usage</div>
|
|
124
|
+
<p>
|
|
125
|
+
Rendering an Avatar on top of showMediaCircle causes the Avatar background-colour and the
|
|
126
|
+
circle background-colour to overlap which also causes clipping issues with the Badge
|
|
127
|
+
component.
|
|
128
|
+
</p>
|
|
129
|
+
<NavigationOption
|
|
130
|
+
{...args}
|
|
131
|
+
showMediaCircle
|
|
132
|
+
media={<AvatarView badge={badgeProps} profileName="Spencer Penn" />}
|
|
133
|
+
content={hasTitleOnly ? null : args.content}
|
|
134
|
+
onClick={fn()}
|
|
135
|
+
/>
|
|
136
|
+
</div>
|
|
82
137
|
</div>
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
}
|
|
138
|
+
),
|
|
139
|
+
args: { ...defaultArgs },
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
export const Multiple: StoryObj<StoryArgs> = {
|
|
143
|
+
render: ({ hasTitleOnly, ...args }: StoryArgs) => (
|
|
144
|
+
<div>
|
|
145
|
+
<NavigationOption
|
|
146
|
+
{...args}
|
|
147
|
+
content={hasTitleOnly ? null : args.content}
|
|
148
|
+
media={args.media || <FastFlagIcon />}
|
|
149
|
+
onClick={fn()}
|
|
92
150
|
/>
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
media={
|
|
99
|
-
<AvatarView
|
|
100
|
-
badge={{
|
|
101
|
-
icon: <FastFlag />,
|
|
102
|
-
type: 'action',
|
|
103
|
-
}}
|
|
104
|
-
profileName="Spencer Penn"
|
|
105
|
-
/>
|
|
106
|
-
}
|
|
151
|
+
<NavigationOption
|
|
152
|
+
{...args}
|
|
153
|
+
content={hasTitleOnly ? null : args.content}
|
|
154
|
+
media={args.media || <FastFlagIcon />}
|
|
155
|
+
onClick={fn()}
|
|
107
156
|
/>
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
circle background-colour to overlap which also causes clipping issues with the Badge
|
|
114
|
-
component.
|
|
115
|
-
</p>
|
|
116
|
-
<Template
|
|
117
|
-
showMediaCircle
|
|
118
|
-
media={
|
|
119
|
-
<AvatarView
|
|
120
|
-
badge={{
|
|
121
|
-
icon: <FastFlag />,
|
|
122
|
-
type: 'action',
|
|
123
|
-
}}
|
|
124
|
-
profileName="Spencer Penn"
|
|
125
|
-
/>
|
|
126
|
-
}
|
|
157
|
+
<NavigationOption
|
|
158
|
+
{...args}
|
|
159
|
+
content={hasTitleOnly ? null : args.content}
|
|
160
|
+
media={args.media || <FastFlagIcon />}
|
|
161
|
+
onClick={fn()}
|
|
127
162
|
/>
|
|
128
163
|
</div>
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
export const Multiple = () => (
|
|
133
|
-
<>
|
|
134
|
-
<Template />
|
|
135
|
-
<Template />
|
|
136
|
-
<Template />
|
|
137
|
-
</>
|
|
138
|
-
);
|
|
164
|
+
),
|
|
165
|
+
args: { ...defaultArgs },
|
|
166
|
+
};
|
|
139
167
|
|
|
140
|
-
export const WithIllustration =
|
|
141
|
-
|
|
142
|
-
<
|
|
168
|
+
export const WithIllustration: StoryObj<StoryArgs> = {
|
|
169
|
+
render: ({ hasTitleOnly, ...args }: StoryArgs) => (
|
|
170
|
+
<NavigationOption
|
|
171
|
+
{...args}
|
|
143
172
|
media={<Illustration name={Assets.GLOBE} disablePadding alt="" />}
|
|
144
173
|
showMediaCircle={false}
|
|
174
|
+
content={hasTitleOnly ? null : args.content}
|
|
175
|
+
onClick={fn()}
|
|
145
176
|
/>
|
|
146
|
-
)
|
|
177
|
+
),
|
|
178
|
+
args: { ...defaultArgs },
|
|
147
179
|
};
|
|
148
180
|
|
|
149
|
-
export const WithContainerContent =
|
|
150
|
-
|
|
151
|
-
<Title type={Typography.TITLE_SUBSECTION} className="m-b-1">
|
|
152
|
-
Choose how to pay
|
|
153
|
-
</Title>
|
|
154
|
-
<Template />
|
|
155
|
-
<Template />
|
|
156
|
-
<Template />
|
|
181
|
+
export const WithContainerContent: StoryObj<StoryArgs> = {
|
|
182
|
+
render: ({ hasTitleOnly, ...args }: StoryArgs) => (
|
|
157
183
|
<div>
|
|
158
|
-
<
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
184
|
+
<Title type={Typography.TITLE_SUBSECTION} className="m-b-1">
|
|
185
|
+
Choose how to pay
|
|
186
|
+
</Title>
|
|
187
|
+
<NavigationOption
|
|
188
|
+
{...args}
|
|
189
|
+
content={hasTitleOnly ? null : args.content}
|
|
190
|
+
media={args.media || <FastFlagIcon />}
|
|
191
|
+
onClick={fn()}
|
|
166
192
|
/>
|
|
193
|
+
<NavigationOption
|
|
194
|
+
{...args}
|
|
195
|
+
content={hasTitleOnly ? null : args.content}
|
|
196
|
+
media={args.media || <FastFlagIcon />}
|
|
197
|
+
onClick={fn()}
|
|
198
|
+
/>
|
|
199
|
+
<NavigationOption
|
|
200
|
+
{...args}
|
|
201
|
+
content={hasTitleOnly ? null : args.content}
|
|
202
|
+
media={args.media || <FastFlagIcon />}
|
|
203
|
+
onClick={fn()}
|
|
204
|
+
/>
|
|
205
|
+
<div>
|
|
206
|
+
<Nudge
|
|
207
|
+
className="m-t-2"
|
|
208
|
+
mediaName="globe"
|
|
209
|
+
title="Text that is no longer than two lines."
|
|
210
|
+
link="Link"
|
|
211
|
+
href="#"
|
|
212
|
+
onClick={action('action clicked')}
|
|
213
|
+
onDismiss={action('dismissed')}
|
|
214
|
+
/>
|
|
215
|
+
</div>
|
|
167
216
|
</div>
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
const NavigationOptionTemplate = (props: TemplateTypes) => {
|
|
172
|
-
const {
|
|
173
|
-
href,
|
|
174
|
-
title,
|
|
175
|
-
content,
|
|
176
|
-
complex,
|
|
177
|
-
disabled,
|
|
178
|
-
showMediaAtAllSizes,
|
|
179
|
-
showMediaCircle,
|
|
180
|
-
isContainerAligned,
|
|
181
|
-
className,
|
|
182
|
-
} = props;
|
|
183
|
-
|
|
184
|
-
return (
|
|
185
|
-
<NavigationOption
|
|
186
|
-
complex={complex}
|
|
187
|
-
disabled={disabled}
|
|
188
|
-
id="navigation-option"
|
|
189
|
-
name="navigation-option"
|
|
190
|
-
href={href}
|
|
191
|
-
title={title}
|
|
192
|
-
content={props.hasTitleOnly ? null : content}
|
|
193
|
-
media={props.media || <FastFlagIcon />}
|
|
194
|
-
showMediaAtAllSizes={showMediaAtAllSizes}
|
|
195
|
-
isContainerAligned={isContainerAligned}
|
|
196
|
-
showMediaCircle={showMediaCircle}
|
|
197
|
-
className={className}
|
|
198
|
-
onClick={action('clicked')}
|
|
199
|
-
/>
|
|
200
|
-
);
|
|
217
|
+
),
|
|
218
|
+
args: { ...defaultArgs },
|
|
201
219
|
};
|
|
202
220
|
|
|
203
|
-
export const BalanceContent =
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
<AvatarView>
|
|
210
|
-
<Flag code="GBP" />
|
|
211
|
-
</AvatarView>
|
|
212
|
-
}
|
|
213
|
-
/>
|
|
214
|
-
);
|
|
215
|
-
|
|
216
|
-
export const NewContactContent = () => (
|
|
217
|
-
<NavigationOptionTemplate
|
|
218
|
-
title="New Contact"
|
|
219
|
-
showMediaCircle={false}
|
|
220
|
-
media={
|
|
221
|
-
<AvatarView badge={{ type: 'reference' }}>
|
|
222
|
-
<Profile size="24" />
|
|
223
|
-
</AvatarView>
|
|
224
|
-
}
|
|
225
|
-
/>
|
|
226
|
-
);
|
|
227
|
-
|
|
228
|
-
export const ExistingContactContent = () => (
|
|
229
|
-
<NavigationOptionTemplate
|
|
230
|
-
title="Wise Customer"
|
|
231
|
-
content="EUR account ending in 1111"
|
|
232
|
-
showMediaCircle={false}
|
|
233
|
-
media={<AvatarView profileName="Walter Smith" badge={{ flagCode: 'EUR' }} />}
|
|
234
|
-
/>
|
|
235
|
-
);
|
|
236
|
-
|
|
237
|
-
export const CardContent = () => (
|
|
238
|
-
<NavigationOptionTemplate
|
|
239
|
-
title="Digital card •••• 2123"
|
|
240
|
-
content="Test card"
|
|
241
|
-
showMediaCircle={false}
|
|
242
|
-
media={
|
|
243
|
-
<img
|
|
244
|
-
src="https://wise.com/public-resources/assets/spend/card/asset//digital_card_2023.png"
|
|
245
|
-
alt=""
|
|
246
|
-
/>
|
|
247
|
-
}
|
|
248
|
-
/>
|
|
249
|
-
);
|
|
250
|
-
|
|
251
|
-
export const ManageAccountContent = () => (
|
|
252
|
-
<>
|
|
253
|
-
<Header title="Balances" />
|
|
254
|
-
<NavigationOptionTemplate
|
|
255
|
-
title="Account details"
|
|
256
|
-
content="View and share your account details to get paid."
|
|
221
|
+
export const BalanceContent: StoryObj<StoryArgs> = {
|
|
222
|
+
render: ({ hasTitleOnly, ...args }: StoryArgs) => (
|
|
223
|
+
<NavigationOption
|
|
224
|
+
{...args}
|
|
225
|
+
title="100 GBP available"
|
|
226
|
+
content="British pound"
|
|
257
227
|
showMediaCircle={false}
|
|
258
228
|
media={
|
|
259
229
|
<AvatarView>
|
|
260
|
-
<
|
|
230
|
+
<Flag code="GBP" />
|
|
261
231
|
</AvatarView>
|
|
262
232
|
}
|
|
233
|
+
onClick={fn()}
|
|
263
234
|
/>
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
235
|
+
),
|
|
236
|
+
args: { ...defaultArgs },
|
|
237
|
+
};
|
|
238
|
+
|
|
239
|
+
export const NewContactContent: StoryObj<StoryArgs> = {
|
|
240
|
+
render: ({ hasTitleOnly, ...args }: StoryArgs) => (
|
|
241
|
+
<NavigationOption
|
|
242
|
+
{...args}
|
|
243
|
+
title="New Contact"
|
|
267
244
|
showMediaCircle={false}
|
|
268
245
|
media={
|
|
269
|
-
<AvatarView>
|
|
270
|
-
<
|
|
246
|
+
<AvatarView badge={{ type: 'reference' }}>
|
|
247
|
+
<Profile size="24" />
|
|
271
248
|
</AvatarView>
|
|
272
249
|
}
|
|
250
|
+
onClick={fn()}
|
|
273
251
|
/>
|
|
274
|
-
|
|
275
|
-
|
|
252
|
+
),
|
|
253
|
+
args: { ...defaultArgs },
|
|
254
|
+
};
|
|
255
|
+
|
|
256
|
+
export const ExistingContactContent: StoryObj<StoryArgs> = {
|
|
257
|
+
render: ({ hasTitleOnly, ...args }: StoryArgs) => (
|
|
258
|
+
<NavigationOption
|
|
259
|
+
{...args}
|
|
260
|
+
title="Wise Customer"
|
|
261
|
+
content="EUR account ending in 1111"
|
|
262
|
+
showMediaCircle={false}
|
|
263
|
+
media={<AvatarView profileName="Walter Smith" badge={{ flagCode: 'EUR' }} />}
|
|
264
|
+
onClick={fn()}
|
|
265
|
+
/>
|
|
266
|
+
),
|
|
267
|
+
args: { ...defaultArgs },
|
|
268
|
+
};
|
|
269
|
+
|
|
270
|
+
export const CardContent: StoryObj<StoryArgs> = {
|
|
271
|
+
render: ({ hasTitleOnly, ...args }: StoryArgs) => (
|
|
272
|
+
<NavigationOption
|
|
273
|
+
{...args}
|
|
274
|
+
title="Digital card •••• 2123"
|
|
275
|
+
content="Expires 12/27"
|
|
276
|
+
showMediaCircle={false}
|
|
277
|
+
media={<UpwardGraphIcon size={24} />}
|
|
278
|
+
onClick={fn()}
|
|
279
|
+
/>
|
|
280
|
+
),
|
|
281
|
+
args: { ...defaultArgs },
|
|
282
|
+
};
|
|
283
|
+
|
|
284
|
+
export const ManageAccountContent: StoryObj<StoryArgs> = {
|
|
285
|
+
render: ({ hasTitleOnly, ...args }: StoryArgs) => (
|
|
286
|
+
<div>
|
|
287
|
+
<Header title="Balances" />
|
|
288
|
+
<NavigationOption
|
|
289
|
+
{...args}
|
|
290
|
+
title="Account details"
|
|
291
|
+
content="View and share your account details to get paid."
|
|
292
|
+
showMediaCircle={false}
|
|
293
|
+
media={
|
|
294
|
+
<AvatarView>
|
|
295
|
+
<BankIcon />
|
|
296
|
+
</AvatarView>
|
|
297
|
+
}
|
|
298
|
+
onClick={fn()}
|
|
299
|
+
/>
|
|
300
|
+
<NavigationOption
|
|
301
|
+
{...args}
|
|
302
|
+
title="Auto Conversions"
|
|
303
|
+
content="Convert money between your balances at your desired exchange rate."
|
|
304
|
+
showMediaCircle={false}
|
|
305
|
+
media={
|
|
306
|
+
<AvatarView>
|
|
307
|
+
<UpwardGraphIcon size={24} />
|
|
308
|
+
</AvatarView>
|
|
309
|
+
}
|
|
310
|
+
onClick={fn()}
|
|
311
|
+
/>
|
|
312
|
+
</div>
|
|
313
|
+
),
|
|
314
|
+
};
|
|
@@ -1,17 +1,29 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
2
|
+
import { action } from 'storybook/actions';
|
|
3
3
|
import { Person as ProfileIcon, Briefcase as BriefcaseIcon } from '@transferwise/icons';
|
|
4
|
-
|
|
5
4
|
import AvatarView from '../avatarView';
|
|
6
5
|
import { ProfileType } from '../common';
|
|
7
6
|
import Logo from '../logo';
|
|
8
7
|
|
|
9
|
-
import OverlayHeader from './OverlayHeader';
|
|
8
|
+
import OverlayHeader, { OverlayHeaderProps } from './OverlayHeader';
|
|
9
|
+
|
|
10
|
+
interface CustomControls {
|
|
11
|
+
avatarType?: keyof typeof avatarProfiles;
|
|
12
|
+
avatarURL?: string;
|
|
13
|
+
profileType?: ProfileType;
|
|
14
|
+
}
|
|
15
|
+
export type StoryArgs = OverlayHeaderProps & CustomControls;
|
|
10
16
|
|
|
11
|
-
|
|
17
|
+
const meta: Meta<StoryArgs> = {
|
|
12
18
|
component: OverlayHeader,
|
|
13
19
|
title: 'Navigation/OverlayHeader',
|
|
20
|
+
argTypes: {
|
|
21
|
+
avatarType: { control: 'select', options: ['', 'Business', 'Profile'] },
|
|
22
|
+
avatarURL: { control: 'text' },
|
|
23
|
+
profileType: { control: 'select', options: [ProfileType.PERSONAL, ProfileType.BUSINESS] },
|
|
24
|
+
},
|
|
14
25
|
};
|
|
26
|
+
export default meta;
|
|
15
27
|
|
|
16
28
|
const avatarProfiles = {
|
|
17
29
|
'': null,
|
|
@@ -19,33 +31,29 @@ const avatarProfiles = {
|
|
|
19
31
|
Profile: <ProfileIcon size="24" />,
|
|
20
32
|
};
|
|
21
33
|
|
|
22
|
-
export const Basic =
|
|
23
|
-
|
|
24
|
-
'avatar',
|
|
25
|
-
Object.keys(avatarProfiles) as (keyof typeof avatarProfiles)[],
|
|
26
|
-
'Profile',
|
|
27
|
-
);
|
|
28
|
-
return (
|
|
34
|
+
export const Basic: StoryObj<StoryArgs> = {
|
|
35
|
+
render: (args) => (
|
|
29
36
|
<OverlayHeader
|
|
30
37
|
logo={<Logo />}
|
|
31
|
-
avatar={<AvatarView>{avatarProfiles[
|
|
38
|
+
avatar={<AvatarView>{avatarProfiles[args.avatarType ?? '']}</AvatarView>}
|
|
32
39
|
onClose={action('Close clicked')}
|
|
33
40
|
/>
|
|
34
|
-
)
|
|
41
|
+
),
|
|
42
|
+
args: {
|
|
43
|
+
avatarType: 'Profile',
|
|
44
|
+
},
|
|
35
45
|
};
|
|
36
46
|
|
|
37
|
-
export const WithAvatarWrapper =
|
|
38
|
-
|
|
39
|
-
const profileType = select(
|
|
40
|
-
'profileType',
|
|
41
|
-
[ProfileType.PERSONAL, ProfileType.BUSINESS],
|
|
42
|
-
undefined,
|
|
43
|
-
);
|
|
44
|
-
return (
|
|
47
|
+
export const WithAvatarWrapper: StoryObj<StoryArgs> = {
|
|
48
|
+
render: (args) => (
|
|
45
49
|
<OverlayHeader
|
|
46
50
|
logo={<Logo />}
|
|
47
|
-
avatar={<AvatarView imgSrc={avatarURL} profileType={profileType} />}
|
|
51
|
+
avatar={<AvatarView imgSrc={args.avatarURL} profileType={args.profileType} />}
|
|
48
52
|
onClose={action('Close clicked')}
|
|
49
53
|
/>
|
|
50
|
-
)
|
|
54
|
+
),
|
|
55
|
+
args: {
|
|
56
|
+
avatarURL: '../tapestry-01.png',
|
|
57
|
+
profileType: ProfileType.PERSONAL,
|
|
58
|
+
},
|
|
51
59
|
};
|
|
@@ -12,9 +12,12 @@ describe('setDefaultPrefix', () => {
|
|
|
12
12
|
['ar', '+54'],
|
|
13
13
|
['it-IT', '+39'],
|
|
14
14
|
['it', '+39'],
|
|
15
|
-
])(
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
])(
|
|
16
|
+
'should return right prefix when locale is passed ("%s" -> "%s")',
|
|
17
|
+
(locale: string, expectedValue: string) => {
|
|
18
|
+
expect(setDefaultPrefix(locale)).toBe(expectedValue);
|
|
19
|
+
},
|
|
20
|
+
);
|
|
18
21
|
|
|
19
22
|
it('should return right prefix when valid locale is passed', () => {
|
|
20
23
|
expect(setDefaultPrefix('it-IT')).toBe('+39');
|