@transferwise/components 46.147.0 → 46.148.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/main.css +53 -0
- package/build/prompt/CriticalBanner/CriticalBanner.js +78 -68
- package/build/prompt/CriticalBanner/CriticalBanner.js.map +1 -1
- package/build/prompt/CriticalBanner/CriticalBanner.mjs +79 -69
- package/build/prompt/CriticalBanner/CriticalBanner.mjs.map +1 -1
- package/build/styles/main.css +53 -0
- package/build/styles/prompt/CriticalBanner/CriticalBanner.css +48 -0
- package/build/types/prompt/CriticalBanner/CriticalBanner.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/accordion/Accordion.story.tsx +25 -0
- package/src/avatarLayout/AvatarLayout.story.tsx +10 -0
- package/src/avatarView/AvatarView.story.tsx +8 -0
- package/src/body/Body.story.tsx +12 -0
- package/src/button/_stories/Button.story.tsx +7 -1
- package/src/calendar/Calendar.story.tsx +19 -7
- package/src/carousel/Carousel.story.tsx +35 -0
- package/src/checkbox/Checkbox.story.tsx +20 -0
- package/src/checkboxButton/CheckboxButton.story.tsx +16 -0
- package/src/chevron/Chevron.story.tsx +6 -0
- package/src/chips/Chips.story.tsx +23 -0
- package/src/circularButton/CircularButton.story.tsx +13 -0
- package/src/common/baseCard/BaseCard.story.tsx +12 -0
- package/src/common/bottomSheet/BottomSheet.story.tsx +21 -0
- package/src/common/circle/Circle.story.tsx +11 -0
- package/src/container/Container.story.tsx +12 -0
- package/src/dateInput/DateInput.story.tsx +20 -0
- package/src/dateLookup/DateLookup.story.tsx +23 -0
- package/src/decision/Decision.story.tsx +36 -0
- package/src/definitionList/DefinitionList.story.tsx +16 -0
- package/src/dimmer/Dimmer.story.tsx +24 -0
- package/src/display/Display.story.tsx +11 -0
- package/src/divider/Divider.story.tsx +6 -0
- package/src/drawer/Drawer.story.tsx +25 -0
- package/src/dropFade/DropFade.story.tsx +27 -0
- package/src/emphasis/Emphasis.story.tsx +10 -0
- package/src/expressiveMoneyInput/ExpressiveMoneyInput.story.tsx +37 -0
- package/src/field/Field.story.tsx +16 -0
- package/src/flowNavigation/FlowNavigation.story.tsx +25 -0
- package/src/header/Header.story.tsx +17 -0
- package/src/iconButton/IconButton.story.tsx +14 -0
- package/src/image/Image.story.tsx +11 -0
- package/src/info/Info.story.tsx +10 -0
- package/src/inputWithDisplayFormat/InputWithDisplayFormat.story.tsx +23 -0
- package/src/inputs/InputGroup.story.tsx +37 -0
- package/src/inputs/SearchInput.story.tsx +22 -0
- package/src/inputs/SelectInput/_stories/SelectInput.story.tsx +42 -0
- package/src/inputs/TextArea.story.tsx +22 -0
- package/src/instructionsList/InstructionsList.story.tsx +19 -0
- package/src/label/Label.story.tsx +17 -0
- package/src/link/Link.story.tsx +11 -0
- package/src/list/List.story.tsx +19 -0
- package/src/listItem/_stories/ListItem.story.tsx +20 -0
- package/src/loader/Loader.story.tsx +6 -0
- package/src/logo/Logo.story.tsx +6 -0
- package/src/main.css +53 -0
- package/src/markdown/Markdown.story.tsx +17 -0
- package/src/modal/Modal.story.tsx +23 -0
- package/src/money/Money.story.tsx +7 -0
- package/src/moneyInput/MoneyInput.story.tsx +34 -0
- package/src/nudge/Nudge.story.tsx +17 -0
- package/src/overlayHeader/OverlayHeader.story.tsx +10 -0
- package/src/phoneNumberInput/PhoneNumberInput.story.tsx +23 -0
- package/src/popover/Popover.story.tsx +12 -0
- package/src/primitives/PrimitiveAnchor/stories/PrimitiveAnchor.story.tsx +11 -0
- package/src/primitives/PrimitiveButton/stories/PrimitiveButton.story.tsx +11 -0
- package/src/processIndicator/ProcessIndicator.story.tsx +10 -0
- package/src/progress/Progress.story.tsx +6 -0
- package/src/progressBar/ProgressBar.story.tsx +12 -0
- package/src/promoCard/PromoCard.story.tsx +15 -0
- package/src/promoCard/PromoCardGroup.story.tsx +28 -0
- package/src/prompt/ActionPrompt/ActionPrompt.story.tsx +31 -0
- package/src/prompt/CriticalBanner/CriticalBanner.accessibility.docs.mdx +9 -0
- package/src/prompt/CriticalBanner/CriticalBanner.css +48 -0
- package/src/prompt/CriticalBanner/CriticalBanner.less +72 -0
- package/src/prompt/CriticalBanner/CriticalBanner.story.tsx +180 -169
- package/src/prompt/CriticalBanner/CriticalBanner.test.story.tsx +25 -6
- package/src/prompt/CriticalBanner/CriticalBanner.test.tsx +37 -0
- package/src/prompt/CriticalBanner/CriticalBanner.tsx +92 -83
- package/src/prompt/CriticalBanner/CriticalBanner.vars.less +1 -0
- package/src/prompt/InfoPrompt/InfoPrompt.story.tsx +30 -0
- package/src/prompt/InlinePrompt/InlinePrompt.story.tsx +14 -0
- package/src/radio/Radio.story.tsx +34 -0
- package/src/radioGroup/RadioGroup.story.tsx +26 -0
- package/src/section/Section.story.tsx +15 -0
- package/src/segmentedControl/SegmentedControl.story.tsx +27 -0
- package/src/sentimentSurface/SentimentSurface.story.tsx +11 -0
- package/src/slidingPanel/SlidingPanel.story.tsx +19 -0
- package/src/snackbar/Snackbar.story.tsx +24 -0
- package/src/statusIcon/StatusIcon.story.tsx +6 -0
- package/src/stepper/Stepper.story.tsx +30 -0
- package/src/sticky/Sticky.story.tsx +22 -1
- package/src/switch/Switch.story.tsx +17 -0
- package/src/table/Table.story.tsx +32 -0
- package/src/tabs/Tabs.story.tsx +31 -0
- package/src/textareaWithDisplayFormat/TextareaWithDisplayFormat.story.tsx +23 -0
- package/src/tile/Tile.story.tsx +13 -0
- package/src/title/Title.story.tsx +12 -0
- package/src/tooltip/Tooltip.story.tsx +8 -0
- package/src/typeahead/Typeahead.story.tsx +33 -0
- package/src/upload/Upload.story.tsx +24 -0
- package/src/uploadInput/UploadInput.story.tsx +31 -0
|
@@ -3,6 +3,10 @@ import { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
|
3
3
|
import { useState } from 'react';
|
|
4
4
|
|
|
5
5
|
import { Button, Dimmer } from '..';
|
|
6
|
+
import {
|
|
7
|
+
createSandboxStory,
|
|
8
|
+
globalScope,
|
|
9
|
+
} from '../../.storybook/components/sandbox/SandboxEditor';
|
|
6
10
|
|
|
7
11
|
export default {
|
|
8
12
|
component: Dimmer,
|
|
@@ -16,6 +20,25 @@ export default {
|
|
|
16
20
|
|
|
17
21
|
type Story = StoryObj<typeof Dimmer>;
|
|
18
22
|
|
|
23
|
+
export const Sandbox = createSandboxStory({
|
|
24
|
+
code: `const App = () => {
|
|
25
|
+
const [open, setOpen] = React.useState(false);
|
|
26
|
+
|
|
27
|
+
return (
|
|
28
|
+
<>
|
|
29
|
+
<Button v2 size="md" onClick={() => setOpen(true)}>
|
|
30
|
+
Open dimmer
|
|
31
|
+
</Button>
|
|
32
|
+
<Dimmer
|
|
33
|
+
open={open}
|
|
34
|
+
onClose={() => setOpen(false)}
|
|
35
|
+
/>
|
|
36
|
+
</>
|
|
37
|
+
);
|
|
38
|
+
};`,
|
|
39
|
+
scope: globalScope,
|
|
40
|
+
});
|
|
41
|
+
|
|
19
42
|
export const Basic: Story = {
|
|
20
43
|
render: (args) => {
|
|
21
44
|
const [open, setOpen] = useState(false);
|
|
@@ -37,3 +60,4 @@ export const Basic: Story = {
|
|
|
37
60
|
);
|
|
38
61
|
},
|
|
39
62
|
};
|
|
63
|
+
|
|
@@ -3,12 +3,23 @@ import Money from '../money/Money';
|
|
|
3
3
|
import Title from '../title/Title';
|
|
4
4
|
|
|
5
5
|
import Display from './Display';
|
|
6
|
+
import {
|
|
7
|
+
createSandboxStory,
|
|
8
|
+
globalScope,
|
|
9
|
+
} from '../../.storybook/components/sandbox/SandboxEditor';
|
|
6
10
|
|
|
7
11
|
export default {
|
|
8
12
|
title: 'Typography/Display',
|
|
9
13
|
component: Display,
|
|
10
14
|
};
|
|
11
15
|
|
|
16
|
+
export const Sandbox = createSandboxStory({
|
|
17
|
+
code: `<Display type="display-large">
|
|
18
|
+
The world's most international account
|
|
19
|
+
</Display>`,
|
|
20
|
+
scope: globalScope,
|
|
21
|
+
});
|
|
22
|
+
|
|
12
23
|
export const Basic = () => {
|
|
13
24
|
const EN = 'compounding without subscription compounding without subscription'; // Made for hyphenation testing
|
|
14
25
|
const DE = 'äöüßabcdefghijklmnopqrstuvwxyz';
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
2
2
|
import Divider from './Divider';
|
|
3
|
+
import { createSandboxStory } from '../../.storybook/components/sandbox/SandboxEditor';
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* Wraps stories with a container (e.g., centered or padded).
|
|
@@ -86,6 +87,11 @@ export const Playground: Story = {
|
|
|
86
87
|
},
|
|
87
88
|
};
|
|
88
89
|
|
|
90
|
+
export const Sandbox = createSandboxStory({
|
|
91
|
+
code: `<Divider level="section" />`,
|
|
92
|
+
scope: { Divider },
|
|
93
|
+
});
|
|
94
|
+
|
|
89
95
|
/**
|
|
90
96
|
* There are three different types of divider – `section`, `subsection`, and `content` –
|
|
91
97
|
* each designed to visually separate or group content. <br />
|
|
@@ -3,6 +3,7 @@ import { Position, Priority } from '../common';
|
|
|
3
3
|
import { Section, Button, Input, Modal, type DrawerProps, Body } from '..';
|
|
4
4
|
import Drawer from './Drawer';
|
|
5
5
|
import { lorem10, lorem20, lorem40, lorem5 } from '../test-utils';
|
|
6
|
+
import { createSandboxStory, globalScope } from '../../.storybook/components/sandbox/SandboxEditor';
|
|
6
7
|
|
|
7
8
|
export default {
|
|
8
9
|
component: Drawer,
|
|
@@ -15,6 +16,30 @@ export default {
|
|
|
15
16
|
},
|
|
16
17
|
};
|
|
17
18
|
|
|
19
|
+
export const Sandbox = createSandboxStory({
|
|
20
|
+
code: `const App = () => {
|
|
21
|
+
const [open, setOpen] = React.useState(false);
|
|
22
|
+
|
|
23
|
+
return (
|
|
24
|
+
<>
|
|
25
|
+
<Button v2 onClick={() => setOpen(true)}>Open drawer</Button>
|
|
26
|
+
<Drawer
|
|
27
|
+
open={open}
|
|
28
|
+
position="right"
|
|
29
|
+
headerTitle="Drawer title"
|
|
30
|
+
onClose={() => setOpen(false)}
|
|
31
|
+
footerContent={
|
|
32
|
+
<Button v2 block onClick={() => setOpen(false)}>Done</Button>
|
|
33
|
+
}
|
|
34
|
+
>
|
|
35
|
+
<p>Drawer content goes here.</p>
|
|
36
|
+
</Drawer>
|
|
37
|
+
</>
|
|
38
|
+
);
|
|
39
|
+
};`,
|
|
40
|
+
scope: globalScope,
|
|
41
|
+
});
|
|
42
|
+
|
|
18
43
|
export const Basic = {
|
|
19
44
|
args: {
|
|
20
45
|
position: Position.RIGHT,
|
|
@@ -2,6 +2,7 @@ import { action } from 'storybook/actions';
|
|
|
2
2
|
import { useState } from 'react';
|
|
3
3
|
|
|
4
4
|
import { Button, Nudge } from '..';
|
|
5
|
+
import { createSandboxStory, globalScope } from '../../.storybook/components/sandbox/SandboxEditor';
|
|
5
6
|
|
|
6
7
|
import DropFade from './DropFade';
|
|
7
8
|
|
|
@@ -10,6 +11,32 @@ export default {
|
|
|
10
11
|
component: DropFade,
|
|
11
12
|
};
|
|
12
13
|
|
|
14
|
+
export const Sandbox = createSandboxStory({
|
|
15
|
+
code: `const App = () => {
|
|
16
|
+
const [show, setShow] = React.useState(false);
|
|
17
|
+
|
|
18
|
+
return (
|
|
19
|
+
<>
|
|
20
|
+
<DropFade show={show}>
|
|
21
|
+
<div>
|
|
22
|
+
<Nudge
|
|
23
|
+
mediaName="globe"
|
|
24
|
+
title="Did you know it's cool to be Wise?"
|
|
25
|
+
link="Get Wise"
|
|
26
|
+
href="https://wise.com"
|
|
27
|
+
onDismiss={() => setShow(false)}
|
|
28
|
+
/>
|
|
29
|
+
</div>
|
|
30
|
+
</DropFade>
|
|
31
|
+
<Button v2 className="m-t-3" block onClick={() => setShow(!show)}>
|
|
32
|
+
Toggle DropFade
|
|
33
|
+
</Button>
|
|
34
|
+
</>
|
|
35
|
+
);
|
|
36
|
+
};`,
|
|
37
|
+
scope: globalScope,
|
|
38
|
+
});
|
|
39
|
+
|
|
13
40
|
export const Basic = () => {
|
|
14
41
|
const [open, setOpen] = useState(false);
|
|
15
42
|
return (
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
2
2
|
|
|
3
3
|
import Emphasis from './Emphasis';
|
|
4
|
+
import {
|
|
5
|
+
createSandboxStory,
|
|
6
|
+
globalScope,
|
|
7
|
+
} from '../../.storybook/components/sandbox/SandboxEditor';
|
|
4
8
|
|
|
5
9
|
export default {
|
|
6
10
|
component: Emphasis,
|
|
@@ -9,6 +13,11 @@ export default {
|
|
|
9
13
|
|
|
10
14
|
type Story = StoryObj<typeof Emphasis>;
|
|
11
15
|
|
|
16
|
+
export const Sandbox = createSandboxStory({
|
|
17
|
+
code: `<Emphasis text="This is <important>important</important> and this is <positive>positive</positive>." />`,
|
|
18
|
+
scope: globalScope,
|
|
19
|
+
});
|
|
20
|
+
|
|
12
21
|
export const Basic: Story = {
|
|
13
22
|
args: {
|
|
14
23
|
text:
|
|
@@ -19,3 +28,4 @@ export const Basic: Story = {
|
|
|
19
28
|
'<script>alert("nice try!")</script>',
|
|
20
29
|
},
|
|
21
30
|
};
|
|
31
|
+
|
|
@@ -3,6 +3,10 @@ import { Meta, StoryObj, Decorator } from '@storybook/react-webpack5';
|
|
|
3
3
|
import { fn } from 'storybook/test';
|
|
4
4
|
import { Flag } from '@wise/art';
|
|
5
5
|
import { Rewards, Tags } from '@transferwise/icons';
|
|
6
|
+
import {
|
|
7
|
+
createSandboxStory,
|
|
8
|
+
globalScope,
|
|
9
|
+
} from '../../.storybook/components/sandbox/SandboxEditor';
|
|
6
10
|
import { storySourceWithoutNoise } from '../../.storybook/helpers';
|
|
7
11
|
import { lorem10, lorem5 } from '../test-utils';
|
|
8
12
|
import { Sentiment } from '../common';
|
|
@@ -81,6 +85,39 @@ export const Playground: Story = {
|
|
|
81
85
|
render: (args: ExpressiveMoneyInputProps) => <ExpressiveMoneyInput {...args} />,
|
|
82
86
|
};
|
|
83
87
|
|
|
88
|
+
export const Sandbox = createSandboxStory({
|
|
89
|
+
code: `const App = () => {
|
|
90
|
+
const [amount, setAmount] = React.useState(1234.56);
|
|
91
|
+
const [currency, setCurrency] = React.useState('GBP');
|
|
92
|
+
|
|
93
|
+
return (
|
|
94
|
+
<ExpressiveMoneyInput
|
|
95
|
+
label="You send"
|
|
96
|
+
amount={amount}
|
|
97
|
+
currency={currency}
|
|
98
|
+
onAmountChange={(value) => setAmount(value)}
|
|
99
|
+
currencySelector={{
|
|
100
|
+
options: [
|
|
101
|
+
{
|
|
102
|
+
title: 'Popular',
|
|
103
|
+
currencies: [
|
|
104
|
+
{ code: 'GBP', label: 'British pound', keywords: ['british'] },
|
|
105
|
+
{ code: 'EUR', label: 'Euro', keywords: ['euro'] },
|
|
106
|
+
{ code: 'USD', label: 'US Dollar', keywords: ['dollar'] },
|
|
107
|
+
],
|
|
108
|
+
},
|
|
109
|
+
],
|
|
110
|
+
onChange: (selected) => setCurrency(selected.code),
|
|
111
|
+
onSearchChange: () => {},
|
|
112
|
+
onOpen: () => {},
|
|
113
|
+
}}
|
|
114
|
+
inlinePrompt={{ message: 'Low cost transfer', sentiment: 'positive' }}
|
|
115
|
+
/>
|
|
116
|
+
);
|
|
117
|
+
};`,
|
|
118
|
+
scope: globalScope,
|
|
119
|
+
});
|
|
120
|
+
|
|
84
121
|
export const WithInitialAmount = {
|
|
85
122
|
args: {
|
|
86
123
|
amount: 1500,
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { useState } from 'react';
|
|
2
2
|
import { action } from 'storybook/actions';
|
|
3
3
|
|
|
4
|
+
import {
|
|
5
|
+
createSandboxStory,
|
|
6
|
+
globalScope,
|
|
7
|
+
} from '../../.storybook/components/sandbox/SandboxEditor';
|
|
4
8
|
import { Input } from '../inputs/Input';
|
|
5
9
|
import { Field, FieldProps } from './Field';
|
|
6
10
|
import { Sentiment } from '../common';
|
|
@@ -21,6 +25,18 @@ export default {
|
|
|
21
25
|
},
|
|
22
26
|
};
|
|
23
27
|
|
|
28
|
+
export const Sandbox = createSandboxStory({
|
|
29
|
+
code: `<Field
|
|
30
|
+
label="Email address"
|
|
31
|
+
description="We'll send confirmation here"
|
|
32
|
+
message="Please enter a valid email"
|
|
33
|
+
sentiment="negative"
|
|
34
|
+
>
|
|
35
|
+
<Input placeholder="you@example.com" />
|
|
36
|
+
</Field>`,
|
|
37
|
+
scope: globalScope,
|
|
38
|
+
});
|
|
39
|
+
|
|
24
40
|
export const Basic = (args: FieldProps) => {
|
|
25
41
|
const [value, setValue] = useState<string | undefined>('This is some text');
|
|
26
42
|
return (
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
2
2
|
import { Breakpoint } from '@transferwise/neptune-tokens';
|
|
3
3
|
import { useState } from 'react';
|
|
4
|
+
import { createSandboxStory, globalScope } from '../../.storybook/components/sandbox/SandboxEditor';
|
|
4
5
|
import AvatarView from '../avatarView';
|
|
5
6
|
import Body from '../body';
|
|
6
7
|
import Button from '../button';
|
|
@@ -54,6 +55,30 @@ const viewports = [
|
|
|
54
55
|
Breakpoint.LARGE + 10,
|
|
55
56
|
];
|
|
56
57
|
|
|
58
|
+
export const Sandbox = createSandboxStory({
|
|
59
|
+
code: `const App = () => {
|
|
60
|
+
const [activeStep, setActiveStep] = React.useState(0);
|
|
61
|
+
|
|
62
|
+
return (
|
|
63
|
+
<FlowNavigation
|
|
64
|
+
avatar={<AvatarView profileType={ProfileType.PERSONAL} />}
|
|
65
|
+
logo={<Logo />}
|
|
66
|
+
activeStep={activeStep}
|
|
67
|
+
onClose={() => console.log('close')}
|
|
68
|
+
onGoBack={() => setActiveStep((prev) => (prev > 0 ? prev - 1 : 0))}
|
|
69
|
+
steps={[
|
|
70
|
+
{ label: 'Amount', hoverLabel: '100 GBP', onClick: () => setActiveStep(0) },
|
|
71
|
+
{ label: 'You', hoverLabel: 'Elena Durante', onClick: () => setActiveStep(1) },
|
|
72
|
+
{ label: 'Recipient', hoverLabel: 'Daniele Tomboro', onClick: () => setActiveStep(2) },
|
|
73
|
+
{ label: 'Review', onClick: () => setActiveStep(3) },
|
|
74
|
+
{ label: 'Pay', onClick: () => setActiveStep(4) },
|
|
75
|
+
]}
|
|
76
|
+
/>
|
|
77
|
+
);
|
|
78
|
+
};`,
|
|
79
|
+
scope: globalScope,
|
|
80
|
+
});
|
|
81
|
+
|
|
57
82
|
export const Variants: Story = {
|
|
58
83
|
args: {
|
|
59
84
|
profileType: ProfileType.PERSONAL,
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
2
2
|
import Header, { HeaderProps } from './Header';
|
|
3
|
+
import {
|
|
4
|
+
createSandboxStory,
|
|
5
|
+
globalScope,
|
|
6
|
+
} from '../../.storybook/components/sandbox/SandboxEditor';
|
|
3
7
|
|
|
4
8
|
const withContainer = (Story: any) => (
|
|
5
9
|
<div style={{ display: 'flex', justifyContent: 'center' }}>
|
|
@@ -83,6 +87,19 @@ export const Playground: Story = {
|
|
|
83
87
|
},
|
|
84
88
|
};
|
|
85
89
|
|
|
90
|
+
export const Sandbox = createSandboxStory({
|
|
91
|
+
code: `<Header
|
|
92
|
+
title="Section header"
|
|
93
|
+
level="group"
|
|
94
|
+
action={{
|
|
95
|
+
'aria-label': 'View all',
|
|
96
|
+
text: 'View all',
|
|
97
|
+
href: '#',
|
|
98
|
+
}}
|
|
99
|
+
/>`,
|
|
100
|
+
scope: globalScope,
|
|
101
|
+
});
|
|
102
|
+
|
|
86
103
|
/**
|
|
87
104
|
* Demonstrates a `Header` with an associated action.
|
|
88
105
|
*/
|
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
Freeze,
|
|
14
14
|
} from '@transferwise/icons';
|
|
15
15
|
import { fn } from 'storybook/test';
|
|
16
|
+
import { createSandboxStory, globalScope } from '../../.storybook/components/sandbox/SandboxEditor';
|
|
16
17
|
import IconButton, { Props } from './IconButton';
|
|
17
18
|
import SentimentSurface from '../sentimentSurface';
|
|
18
19
|
|
|
@@ -61,6 +62,19 @@ export const Playground: Story = {
|
|
|
61
62
|
),
|
|
62
63
|
};
|
|
63
64
|
|
|
65
|
+
export const Sandbox = createSandboxStory({
|
|
66
|
+
code: `<IconButton
|
|
67
|
+
size={48}
|
|
68
|
+
priority="primary"
|
|
69
|
+
type="default"
|
|
70
|
+
aria-label="Add item"
|
|
71
|
+
onClick={() => console.log('clicked')}
|
|
72
|
+
>
|
|
73
|
+
<Plus />
|
|
74
|
+
</IconButton>`,
|
|
75
|
+
scope: globalScope,
|
|
76
|
+
});
|
|
77
|
+
|
|
64
78
|
/**
|
|
65
79
|
* Priorities set a visual hierarchy amongst the buttons displayed on the
|
|
66
80
|
* screen to help more important buttons to take precedence over others. <br />
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { action } from 'storybook/actions';
|
|
2
|
+
import { createSandboxStory } from '../../.storybook/components/sandbox/SandboxEditor';
|
|
2
3
|
import Image, { type ImageProps } from './Image';
|
|
3
4
|
|
|
4
5
|
const meta = {
|
|
@@ -16,6 +17,16 @@ const meta = {
|
|
|
16
17
|
};
|
|
17
18
|
export default meta;
|
|
18
19
|
|
|
20
|
+
export const Sandbox = createSandboxStory({
|
|
21
|
+
code: `<Image
|
|
22
|
+
alt="Wise illustration"
|
|
23
|
+
src="https://wise.com/web-art/assets/illustrations/bell-small@1x.webp"
|
|
24
|
+
loading="lazy"
|
|
25
|
+
stretch={false}
|
|
26
|
+
/>`,
|
|
27
|
+
scope: { Image },
|
|
28
|
+
});
|
|
29
|
+
|
|
19
30
|
export const Basic = {
|
|
20
31
|
render: (args: ImageProps) => (
|
|
21
32
|
<>
|
package/src/info/Info.story.tsx
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
2
|
+
import { createSandboxStory, globalScope } from '../../.storybook/components/sandbox/SandboxEditor';
|
|
2
3
|
import { lorem10 } from '../test-utils';
|
|
3
4
|
import Info from '.';
|
|
4
5
|
import { withVariantConfig } from '../../.storybook/helpers';
|
|
@@ -22,6 +23,15 @@ export default meta;
|
|
|
22
23
|
|
|
23
24
|
type Story = StoryObj<typeof meta>;
|
|
24
25
|
|
|
26
|
+
export const Sandbox = createSandboxStory({
|
|
27
|
+
code: `<Info
|
|
28
|
+
aria-label="Click here for more details"
|
|
29
|
+
title="Fast transfer hint"
|
|
30
|
+
content="Your address has been verified, no more actions are required."
|
|
31
|
+
/>`,
|
|
32
|
+
scope: { ...globalScope, Info },
|
|
33
|
+
});
|
|
34
|
+
|
|
25
35
|
export const Basic: Story = {
|
|
26
36
|
...withVariantConfig(['default', 'dark', 'rtl']),
|
|
27
37
|
};
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { userEvent, within, fn } from 'storybook/test';
|
|
2
2
|
|
|
3
|
+
import {
|
|
4
|
+
createSandboxStory,
|
|
5
|
+
globalScope,
|
|
6
|
+
} from '../../.storybook/components/sandbox/SandboxEditor';
|
|
3
7
|
import InputWithDisplayFormat, { InputWithDisplayFormatProps } from '.';
|
|
4
8
|
import { Field, FieldProps } from '../field/Field';
|
|
5
9
|
import { Meta, type StoryObj } from '@storybook/react-webpack5';
|
|
@@ -24,6 +28,25 @@ const meta: Meta<typeof InputWithDisplayFormat> = {
|
|
|
24
28
|
} satisfies Meta<typeof InputWithDisplayFormat>;
|
|
25
29
|
export default meta;
|
|
26
30
|
|
|
31
|
+
export const Sandbox = createSandboxStory({
|
|
32
|
+
code: `const App = () => {
|
|
33
|
+
const [value, setValue] = React.useState('');
|
|
34
|
+
|
|
35
|
+
return (
|
|
36
|
+
<Field label="Sort Code" id="sort-code">
|
|
37
|
+
<InputWithDisplayFormat
|
|
38
|
+
id="sort-code"
|
|
39
|
+
placeholder="**-**-**"
|
|
40
|
+
displayPattern="**-**-**"
|
|
41
|
+
value={value}
|
|
42
|
+
onChange={(event) => setValue(event.target.value)}
|
|
43
|
+
/>
|
|
44
|
+
</Field>
|
|
45
|
+
);
|
|
46
|
+
};`,
|
|
47
|
+
scope: globalScope,
|
|
48
|
+
});
|
|
49
|
+
|
|
27
50
|
export const Basic: Story = {
|
|
28
51
|
args: {
|
|
29
52
|
label: 'Sort Code',
|
|
@@ -2,6 +2,10 @@ import type { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
|
2
2
|
import { Search } from '@transferwise/icons';
|
|
3
3
|
import { useRef, useState } from 'react';
|
|
4
4
|
|
|
5
|
+
import {
|
|
6
|
+
createSandboxStory,
|
|
7
|
+
globalScope,
|
|
8
|
+
} from '../../.storybook/components/sandbox/SandboxEditor';
|
|
5
9
|
import { Button } from '..';
|
|
6
10
|
import { Field } from '../field/Field';
|
|
7
11
|
|
|
@@ -18,6 +22,39 @@ export default {
|
|
|
18
22
|
|
|
19
23
|
type Story = StoryObj<typeof InputGroup>;
|
|
20
24
|
|
|
25
|
+
export const Sandbox = createSandboxStory({
|
|
26
|
+
code: `const App = () => {
|
|
27
|
+
const [value, setValue] = React.useState('');
|
|
28
|
+
|
|
29
|
+
return (
|
|
30
|
+
<Field label="Search">
|
|
31
|
+
<InputGroup
|
|
32
|
+
addonStart={{
|
|
33
|
+
content: <Search size={24} />,
|
|
34
|
+
initialContentWidth: 24,
|
|
35
|
+
}}
|
|
36
|
+
addonEnd={{
|
|
37
|
+
content: (
|
|
38
|
+
<Button v2 size="sm" onClick={() => setValue('')}>
|
|
39
|
+
Clear
|
|
40
|
+
</Button>
|
|
41
|
+
),
|
|
42
|
+
interactive: true,
|
|
43
|
+
padding: 'sm',
|
|
44
|
+
}}
|
|
45
|
+
>
|
|
46
|
+
<Input
|
|
47
|
+
placeholder="Search by name..."
|
|
48
|
+
value={value}
|
|
49
|
+
onChange={(event) => setValue(event.target.value)}
|
|
50
|
+
/>
|
|
51
|
+
</InputGroup>
|
|
52
|
+
</Field>
|
|
53
|
+
);
|
|
54
|
+
};`,
|
|
55
|
+
scope: globalScope,
|
|
56
|
+
});
|
|
57
|
+
|
|
21
58
|
export const WithPrefix: Story = {
|
|
22
59
|
render: (args) => <InputGroupWithPrefix {...args} />,
|
|
23
60
|
args: {
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
2
2
|
import { useState } from 'react';
|
|
3
3
|
|
|
4
|
+
import {
|
|
5
|
+
createSandboxStory,
|
|
6
|
+
globalScope,
|
|
7
|
+
} from '../../.storybook/components/sandbox/SandboxEditor';
|
|
4
8
|
import { Size } from '../common';
|
|
5
9
|
import { Field } from '../field/Field';
|
|
6
10
|
|
|
@@ -13,6 +17,24 @@ export default {
|
|
|
13
17
|
|
|
14
18
|
type Story = StoryObj<typeof SearchInput>;
|
|
15
19
|
|
|
20
|
+
export const Sandbox = createSandboxStory({
|
|
21
|
+
code: `const App = () => {
|
|
22
|
+
const [value, setValue] = React.useState('');
|
|
23
|
+
|
|
24
|
+
return (
|
|
25
|
+
<Field label="Search">
|
|
26
|
+
<SearchInput
|
|
27
|
+
size="md"
|
|
28
|
+
shape="pill"
|
|
29
|
+
value={value}
|
|
30
|
+
onChange={(event) => setValue(event.currentTarget.value)}
|
|
31
|
+
/>
|
|
32
|
+
</Field>
|
|
33
|
+
);
|
|
34
|
+
};`,
|
|
35
|
+
scope: globalScope,
|
|
36
|
+
});
|
|
37
|
+
|
|
16
38
|
export const Basic: Story = {
|
|
17
39
|
render: (args) => <SearchInputBasic {...args} />,
|
|
18
40
|
args: {
|
|
@@ -5,6 +5,10 @@ import { Flag } from '@wise/art';
|
|
|
5
5
|
import { clsx } from 'clsx';
|
|
6
6
|
import { useState } from 'react';
|
|
7
7
|
|
|
8
|
+
import {
|
|
9
|
+
createSandboxStory,
|
|
10
|
+
globalScope,
|
|
11
|
+
} from '../../../../.storybook/components/sandbox/SandboxEditor';
|
|
8
12
|
import Button from '../../../button';
|
|
9
13
|
import { getMonthNames } from '../../../common/dateUtils';
|
|
10
14
|
import Drawer from '../../../drawer';
|
|
@@ -307,6 +311,44 @@ export const Playground: StoryObj<PlaygroundArgs> = {
|
|
|
307
311
|
},
|
|
308
312
|
};
|
|
309
313
|
|
|
314
|
+
export const Sandbox = createSandboxStory({
|
|
315
|
+
code: `const App = () => {
|
|
316
|
+
const months = [
|
|
317
|
+
{ id: 1, name: 'January' },
|
|
318
|
+
{ id: 2, name: 'February' },
|
|
319
|
+
{ id: 3, name: 'March' },
|
|
320
|
+
{ id: 4, name: 'April' },
|
|
321
|
+
{ id: 5, name: 'May' },
|
|
322
|
+
{ id: 6, name: 'June' },
|
|
323
|
+
];
|
|
324
|
+
|
|
325
|
+
const [selected, setSelected] = React.useState(undefined);
|
|
326
|
+
|
|
327
|
+
return (
|
|
328
|
+
<Field label="Select a month">
|
|
329
|
+
<SelectInput
|
|
330
|
+
size="lg"
|
|
331
|
+
filterable
|
|
332
|
+
filterPlaceholder="Type a month name"
|
|
333
|
+
placeholder="Choose a month"
|
|
334
|
+
items={months.map((month) => ({
|
|
335
|
+
type: 'option',
|
|
336
|
+
value: month,
|
|
337
|
+
filterMatchers: [month.name],
|
|
338
|
+
}))}
|
|
339
|
+
renderValue={(month) => (
|
|
340
|
+
<SelectInputOptionContent title={month.name} />
|
|
341
|
+
)}
|
|
342
|
+
value={selected}
|
|
343
|
+
onChange={(month) => setSelected(month)}
|
|
344
|
+
onClear={() => setSelected(undefined)}
|
|
345
|
+
/>
|
|
346
|
+
</Field>
|
|
347
|
+
);
|
|
348
|
+
};`,
|
|
349
|
+
scope: globalScope,
|
|
350
|
+
});
|
|
351
|
+
|
|
310
352
|
/**
|
|
311
353
|
* The simplest usage: a flat list of options with no icons or grouping.
|
|
312
354
|
* `renderValue` controls what is shown in both the trigger and each dropdown row.
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { useEffect, useState } from 'react';
|
|
2
2
|
import { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
3
3
|
|
|
4
|
+
import {
|
|
5
|
+
createSandboxStory,
|
|
6
|
+
globalScope,
|
|
7
|
+
} from '../../.storybook/components/sandbox/SandboxEditor';
|
|
4
8
|
import { Field } from '../field/Field';
|
|
5
9
|
import { Sentiment } from '../common';
|
|
6
10
|
import { TextArea } from './TextArea';
|
|
@@ -54,6 +58,24 @@ export const Playground: Story = {
|
|
|
54
58
|
},
|
|
55
59
|
};
|
|
56
60
|
|
|
61
|
+
export const Sandbox = createSandboxStory({
|
|
62
|
+
code: `const App = () => {
|
|
63
|
+
const [value, setValue] = React.useState('');
|
|
64
|
+
|
|
65
|
+
return (
|
|
66
|
+
<Field label="Message" required={false}>
|
|
67
|
+
<TextArea
|
|
68
|
+
maxLength={200}
|
|
69
|
+
placeholder="Type something..."
|
|
70
|
+
value={value}
|
|
71
|
+
onChange={({ target }) => setValue(target.value)}
|
|
72
|
+
/>
|
|
73
|
+
</Field>
|
|
74
|
+
);
|
|
75
|
+
};`,
|
|
76
|
+
scope: globalScope,
|
|
77
|
+
});
|
|
78
|
+
|
|
57
79
|
export const Basic: Story = {
|
|
58
80
|
render: () => {
|
|
59
81
|
const [value, setValue] = useState('');
|
|
@@ -4,6 +4,10 @@ import { fn } from 'storybook/test';
|
|
|
4
4
|
import Link from '../link';
|
|
5
5
|
|
|
6
6
|
import InstructionsList, { InstructionsListProps } from './InstructionsList';
|
|
7
|
+
import {
|
|
8
|
+
createSandboxStory,
|
|
9
|
+
globalScope,
|
|
10
|
+
} from '../../.storybook/components/sandbox/SandboxEditor';
|
|
7
11
|
|
|
8
12
|
export default {
|
|
9
13
|
component: InstructionsList,
|
|
@@ -13,6 +17,21 @@ export default {
|
|
|
13
17
|
|
|
14
18
|
type Story = StoryObj<typeof InstructionsList>;
|
|
15
19
|
|
|
20
|
+
export const Sandbox = createSandboxStory({
|
|
21
|
+
code: `<InstructionsList
|
|
22
|
+
sort="dosFirst"
|
|
23
|
+
dos={[
|
|
24
|
+
'Do an initial money transfer',
|
|
25
|
+
'Invite at least 3 friends',
|
|
26
|
+
]}
|
|
27
|
+
donts={[
|
|
28
|
+
'Paying extra hidden fees for transfers',
|
|
29
|
+
'Use bad exchange rate',
|
|
30
|
+
]}
|
|
31
|
+
/>`,
|
|
32
|
+
scope: globalScope,
|
|
33
|
+
});
|
|
34
|
+
|
|
16
35
|
export const Basic: Story = {
|
|
17
36
|
args: {
|
|
18
37
|
sort: 'dosFirst',
|