@transferwise/components 46.146.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 +66 -0
- package/build/nudge/Nudge.js.map +1 -1
- package/build/nudge/Nudge.mjs.map +1 -1
- 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 +66 -0
- package/build/styles/nudge/Nudge.css +11 -0
- package/build/styles/prompt/CriticalBanner/CriticalBanner.css +48 -0
- package/build/types/nudge/Nudge.d.ts +1 -1
- package/build/types/nudge/Nudge.d.ts.map +1 -1
- package/build/types/prompt/CriticalBanner/CriticalBanner.d.ts.map +1 -1
- package/package.json +23 -19
- 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 +66 -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.css +11 -0
- package/src/nudge/Nudge.less +4 -0
- package/src/nudge/Nudge.story.tsx +26 -0
- package/src/nudge/Nudge.tsx +2 -1
- 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
|
@@ -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',
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createSandboxStory,
|
|
3
|
+
globalScope,
|
|
4
|
+
} from '../../.storybook/components/sandbox/SandboxEditor';
|
|
1
5
|
import Info from '../info';
|
|
2
6
|
import { Label } from './Label';
|
|
3
7
|
|
|
@@ -6,6 +10,19 @@ export default {
|
|
|
6
10
|
title: 'Forms/Label',
|
|
7
11
|
};
|
|
8
12
|
|
|
13
|
+
export const Sandbox = createSandboxStory({
|
|
14
|
+
code: `<>
|
|
15
|
+
<Label>
|
|
16
|
+
<Label.Optional>
|
|
17
|
+
Field with Info{' '}
|
|
18
|
+
<Info content="Helpful tooltip content" aria-label="More information" />
|
|
19
|
+
</Label.Optional>
|
|
20
|
+
</Label>
|
|
21
|
+
<Label.Description className="m-b-2">This is a field description</Label.Description>
|
|
22
|
+
</>`,
|
|
23
|
+
scope: { ...globalScope, Info },
|
|
24
|
+
});
|
|
25
|
+
|
|
9
26
|
export const Basic = () => {
|
|
10
27
|
return (
|
|
11
28
|
<>
|
package/src/link/Link.story.tsx
CHANGED
|
@@ -4,12 +4,23 @@ import Title from '../title/Title';
|
|
|
4
4
|
|
|
5
5
|
import SentimentSurface from '../sentimentSurface';
|
|
6
6
|
import Link from '.';
|
|
7
|
+
import {
|
|
8
|
+
createSandboxStory,
|
|
9
|
+
globalScope,
|
|
10
|
+
} from '../../.storybook/components/sandbox/SandboxEditor';
|
|
7
11
|
|
|
8
12
|
export default {
|
|
9
13
|
component: Link,
|
|
10
14
|
title: 'Typography/Link',
|
|
11
15
|
};
|
|
12
16
|
|
|
17
|
+
export const Sandbox = createSandboxStory({
|
|
18
|
+
code: `<Link type="link-default" href="#">
|
|
19
|
+
Learn more about international transfers
|
|
20
|
+
</Link>`,
|
|
21
|
+
scope: { ...globalScope, Link },
|
|
22
|
+
});
|
|
23
|
+
|
|
13
24
|
export const Basic = () => {
|
|
14
25
|
return (
|
|
15
26
|
<>
|
package/src/list/List.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 ListItem from '../listItem';
|
|
3
4
|
import List from './List';
|
|
4
5
|
|
|
@@ -10,6 +11,24 @@ export default {
|
|
|
10
11
|
|
|
11
12
|
type Story = StoryObj<typeof List>;
|
|
12
13
|
|
|
14
|
+
export const Sandbox = createSandboxStory({
|
|
15
|
+
code: `<List>
|
|
16
|
+
<ListItem
|
|
17
|
+
title="First item"
|
|
18
|
+
subtitle="This is the first item."
|
|
19
|
+
media={<ListItem.AvatarView />}
|
|
20
|
+
control={<ListItem.Navigation onClick={() => console.log('navigate')} />}
|
|
21
|
+
/>
|
|
22
|
+
<ListItem
|
|
23
|
+
title="Second item"
|
|
24
|
+
subtitle="This is the second item."
|
|
25
|
+
media={<ListItem.AvatarView />}
|
|
26
|
+
control={<ListItem.Navigation onClick={() => console.log('navigate')} />}
|
|
27
|
+
/>
|
|
28
|
+
</List>`,
|
|
29
|
+
scope: { ...globalScope, List },
|
|
30
|
+
});
|
|
31
|
+
|
|
13
32
|
export const Basic: Story = {
|
|
14
33
|
render: (args) => (
|
|
15
34
|
<List {...args}>
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { useState } from 'react';
|
|
2
2
|
import { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
3
3
|
import { MultiCurrency, Plus } from '@transferwise/icons';
|
|
4
|
+
import {
|
|
5
|
+
createSandboxStory,
|
|
6
|
+
globalScope,
|
|
7
|
+
} from '../../../.storybook/components/sandbox/SandboxEditor';
|
|
4
8
|
import { lorem5, lorem10 } from '../../test-utils';
|
|
5
9
|
import Emphasis from '../../emphasis';
|
|
6
10
|
import Link from '../../link';
|
|
@@ -270,6 +274,22 @@ export const Playground: StoryObj<PreviewStoryArgs> = {
|
|
|
270
274
|
decorators: [withoutKey],
|
|
271
275
|
};
|
|
272
276
|
|
|
277
|
+
export const Sandbox = createSandboxStory({
|
|
278
|
+
code: `<List>
|
|
279
|
+
<ListItem
|
|
280
|
+
title="List item title"
|
|
281
|
+
subtitle="Subtitle goes here"
|
|
282
|
+
additionalInfo={<ListItem.AdditionalInfo>Which is augmented with additional info.</ListItem.AdditionalInfo>}
|
|
283
|
+
control={<ListItem.Button onClick={() => {}}>Click me</ListItem.Button>}
|
|
284
|
+
media={<ListItem.AvatarView><Briefcase /></ListItem.AvatarView>}
|
|
285
|
+
prompt={<ListItem.Prompt sentiment="positive">Finally, there is a prompt{' '}<Link href="https://wise.com" rel="noreferrer" target="_blank">referencing some details</Link>{' '}for your convenience.</ListItem.Prompt>}
|
|
286
|
+
valueSubtitle="100 USD"
|
|
287
|
+
valueTitle="100 GBP"
|
|
288
|
+
/>
|
|
289
|
+
</List>`,
|
|
290
|
+
scope: { ...globalScope, List, Link },
|
|
291
|
+
});
|
|
292
|
+
|
|
273
293
|
export const Responsiveness: StoryObj<PreviewStoryArgs> = {
|
|
274
294
|
parameters: {
|
|
275
295
|
docs: {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
2
|
+
import { createSandboxStory } from '../../.storybook/components/sandbox/SandboxEditor';
|
|
2
3
|
|
|
3
4
|
import Loader from './Loader';
|
|
4
5
|
|
|
@@ -24,4 +25,9 @@ export default {
|
|
|
24
25
|
|
|
25
26
|
type Story = StoryObj<typeof Loader>;
|
|
26
27
|
|
|
28
|
+
export const Sandbox = createSandboxStory({
|
|
29
|
+
code: `<Loader size="md" label="Sending your money" />`,
|
|
30
|
+
scope: { Loader },
|
|
31
|
+
});
|
|
32
|
+
|
|
27
33
|
export const Basic: Story = {};
|
package/src/logo/Logo.story.tsx
CHANGED
|
@@ -2,6 +2,7 @@ import { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
|
2
2
|
|
|
3
3
|
import Logo, { LogoType, LogoDisplay, LogoFormat } from './Logo';
|
|
4
4
|
import type { LogoSize } from './Logo';
|
|
5
|
+
import { createSandboxStory } from '../../.storybook/components/sandbox/SandboxEditor';
|
|
5
6
|
import { withVariantConfig } from '../../.storybook/helpers';
|
|
6
7
|
import Body from '../body';
|
|
7
8
|
|
|
@@ -51,6 +52,11 @@ export const Playground: Story = {
|
|
|
51
52
|
render: (args) => <Logo {...args} />,
|
|
52
53
|
};
|
|
53
54
|
|
|
55
|
+
export const Sandbox = createSandboxStory({
|
|
56
|
+
code: `<Logo type="WISE" format="primary-lockup" size={24} />`,
|
|
57
|
+
scope: { Logo },
|
|
58
|
+
});
|
|
59
|
+
|
|
54
60
|
/**
|
|
55
61
|
* The three logo types: standard Wise, Wise Business, and Wise Platform.
|
|
56
62
|
*/
|
package/src/main.css
CHANGED
|
@@ -31290,6 +31290,19 @@ html:not([dir="rtl"]) .np-navigation-option {
|
|
|
31290
31290
|
margin-right: -22px;
|
|
31291
31291
|
}
|
|
31292
31292
|
|
|
31293
|
+
.wds-nudge-media-documents {
|
|
31294
|
+
margin-left: -8px;
|
|
31295
|
+
margin-top: 22px;
|
|
31296
|
+
position: absolute;
|
|
31297
|
+
width: 120px;
|
|
31298
|
+
}
|
|
31299
|
+
|
|
31300
|
+
[dir="rtl"] .wds-nudge-media-documents {
|
|
31301
|
+
transform: scaleX(-1);
|
|
31302
|
+
margin-left: 0;
|
|
31303
|
+
margin-right: -8px;
|
|
31304
|
+
}
|
|
31305
|
+
|
|
31293
31306
|
.wds-nudge-container {
|
|
31294
31307
|
align-items: stretch;
|
|
31295
31308
|
display: flex;
|
|
@@ -31922,6 +31935,7 @@ html:not([dir="rtl"]) .np-navigation-option {
|
|
|
31922
31935
|
--Prompt-gap: var(--size-10) var(--size-16);
|
|
31923
31936
|
--Prompt-border-radius: 0;
|
|
31924
31937
|
container-type: inline-size;
|
|
31938
|
+
position: relative;
|
|
31925
31939
|
--critical-banner-easing: cubic-bezier(0.9, 0, 0.7, 1);
|
|
31926
31940
|
--critical-banner-duration: 150ms;
|
|
31927
31941
|
/* Override PrimitivePrompt's --screen-sm-max actions behaviour:
|
|
@@ -32062,6 +32076,53 @@ html:not([dir="rtl"]) .np-navigation-option {
|
|
|
32062
32076
|
}
|
|
32063
32077
|
}
|
|
32064
32078
|
|
|
32079
|
+
.wds-critical-banner-overhang-query {
|
|
32080
|
+
container-name: critical-banner-overhang;
|
|
32081
|
+
container-type: inline-size;
|
|
32082
|
+
inline-size: 100%;
|
|
32083
|
+
}
|
|
32084
|
+
|
|
32085
|
+
.wds-critical-banner__entry-mask {
|
|
32086
|
+
display: grid;
|
|
32087
|
+
grid-template-rows: 0fr;
|
|
32088
|
+
overflow: hidden;
|
|
32089
|
+
animation: wds-critical-banner-reveal-height 400ms cubic-bezier(0.3, 0, 0.1, 1) 500ms both;
|
|
32090
|
+
}
|
|
32091
|
+
|
|
32092
|
+
@container critical-banner-overhang (max-width: 600px) {
|
|
32093
|
+
.wds-critical-banner__entry-mask {
|
|
32094
|
+
--critical-banner-mobile-overhang-size: 32px;
|
|
32095
|
+
}
|
|
32096
|
+
.wds-critical-banner__entry-mask .wds-critical-banner-overhang {
|
|
32097
|
+
margin-bottom: var(--critical-banner-mobile-overhang-size);
|
|
32098
|
+
}
|
|
32099
|
+
.wds-critical-banner__entry-mask .wds-critical-banner-overhang::after {
|
|
32100
|
+
content: "";
|
|
32101
|
+
position: absolute;
|
|
32102
|
+
right: 0;
|
|
32103
|
+
bottom: calc(-1 * var(--critical-banner-mobile-overhang-size));
|
|
32104
|
+
left: 0;
|
|
32105
|
+
height: var(--critical-banner-mobile-overhang-size);
|
|
32106
|
+
pointer-events: none;
|
|
32107
|
+
background: radial-gradient(circle at 100% 100%, transparent var(--critical-banner-mobile-overhang-size), var(--color-sentiment-background-surface) var(--critical-banner-mobile-overhang-size)) 0 0 / var(--critical-banner-mobile-overhang-size) var(--critical-banner-mobile-overhang-size) no-repeat, radial-gradient(circle at 0% 100%, transparent var(--critical-banner-mobile-overhang-size), var(--color-sentiment-background-surface) var(--critical-banner-mobile-overhang-size)) 100% 0 / var(--critical-banner-mobile-overhang-size) var(--critical-banner-mobile-overhang-size) no-repeat;
|
|
32108
|
+
}
|
|
32109
|
+
}
|
|
32110
|
+
|
|
32111
|
+
.wds-critical-banner__entry-track {
|
|
32112
|
+
min-height: 0;
|
|
32113
|
+
}
|
|
32114
|
+
|
|
32115
|
+
@keyframes wds-critical-banner-reveal-height {
|
|
32116
|
+
from {
|
|
32117
|
+
grid-template-rows: 0fr;
|
|
32118
|
+
overflow: hidden;
|
|
32119
|
+
}
|
|
32120
|
+
to {
|
|
32121
|
+
grid-template-rows: 1fr;
|
|
32122
|
+
overflow: visible;
|
|
32123
|
+
}
|
|
32124
|
+
}
|
|
32125
|
+
|
|
32065
32126
|
@media (prefers-reduced-motion: reduce) {
|
|
32066
32127
|
.wds-critical-banner__description,
|
|
32067
32128
|
.wds-critical-banner__title,
|
|
@@ -32069,6 +32130,11 @@ html:not([dir="rtl"]) .np-navigation-option {
|
|
|
32069
32130
|
.wds-critical-banner__toggle {
|
|
32070
32131
|
transition: none !important;
|
|
32071
32132
|
}
|
|
32133
|
+
.wds-critical-banner__entry-mask {
|
|
32134
|
+
animation: none;
|
|
32135
|
+
grid-template-rows: 1fr;
|
|
32136
|
+
overflow: visible;
|
|
32137
|
+
}
|
|
32072
32138
|
}
|
|
32073
32139
|
|
|
32074
32140
|
.wds-expander-toggle {
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
2
2
|
|
|
3
3
|
import Markdown from './Markdown';
|
|
4
|
+
import {
|
|
5
|
+
createSandboxStory,
|
|
6
|
+
globalScope,
|
|
7
|
+
} from '../../.storybook/components/sandbox/SandboxEditor';
|
|
4
8
|
|
|
5
9
|
export default {
|
|
6
10
|
component: Markdown,
|
|
@@ -9,6 +13,18 @@ export default {
|
|
|
9
13
|
|
|
10
14
|
type Story = StoryObj<typeof Markdown>;
|
|
11
15
|
|
|
16
|
+
export const Sandbox = createSandboxStory({
|
|
17
|
+
code: `<Markdown>{\`# Heading
|
|
18
|
+
|
|
19
|
+
Some **bold** and *italic* text.
|
|
20
|
+
|
|
21
|
+
1. First item
|
|
22
|
+
2. Second item
|
|
23
|
+
- Nested item
|
|
24
|
+
\`}</Markdown>`,
|
|
25
|
+
scope: globalScope,
|
|
26
|
+
});
|
|
27
|
+
|
|
12
28
|
export const Basic: Story = {
|
|
13
29
|
args: {
|
|
14
30
|
children: `# Heading
|
|
@@ -18,3 +34,4 @@ export const Basic: Story = {
|
|
|
18
34
|
- sublist`,
|
|
19
35
|
},
|
|
20
36
|
};
|
|
37
|
+
|
|
@@ -6,6 +6,7 @@ import { useState } from 'react';
|
|
|
6
6
|
import { Button, Modal, ModalProps } from '..';
|
|
7
7
|
import { CommonProps, Scroll } from '../common';
|
|
8
8
|
import { lorem10, lorem100, lorem1000 } from '../test-utils';
|
|
9
|
+
import { createSandboxStory, globalScope } from '../../.storybook/components/sandbox/SandboxEditor';
|
|
9
10
|
|
|
10
11
|
export default {
|
|
11
12
|
component: Modal,
|
|
@@ -60,6 +61,28 @@ const StoryContent = ({ args, screenMode, viewMode }: StoryContentProps) => {
|
|
|
60
61
|
);
|
|
61
62
|
};
|
|
62
63
|
|
|
64
|
+
export const Sandbox = createSandboxStory({
|
|
65
|
+
code: `const App = () => {
|
|
66
|
+
const [open, setOpen] = React.useState(false);
|
|
67
|
+
|
|
68
|
+
return (
|
|
69
|
+
<>
|
|
70
|
+
<Button v2 onClick={() => setOpen(true)}>Open Modal</Button>
|
|
71
|
+
<Modal
|
|
72
|
+
title="Confirm action"
|
|
73
|
+
body="Are you sure you want to proceed? This action cannot be undone."
|
|
74
|
+
open={open}
|
|
75
|
+
onClose={() => setOpen(false)}
|
|
76
|
+
footer={
|
|
77
|
+
<Button v2 block onClick={() => setOpen(false)}>Confirm</Button>
|
|
78
|
+
}
|
|
79
|
+
/>
|
|
80
|
+
</>
|
|
81
|
+
);
|
|
82
|
+
};`,
|
|
83
|
+
scope: globalScope,
|
|
84
|
+
});
|
|
85
|
+
|
|
63
86
|
export const Basic: Story = {
|
|
64
87
|
args: {
|
|
65
88
|
title: 'Title',
|