@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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CriticalBanner.d.ts","sourceRoot":"","sources":["../../../../src/prompt/CriticalBanner/CriticalBanner.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAmB,MAAM,OAAO,CAAC;AAMnD,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAmB,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAE3E,OAAO,EAAqB,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAKxE,MAAM,MAAM,mBAAmB,GAAG;IAChC,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,WAAW,EAAE,SAAS,CAAC;IACvB,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,MAAM,CAAC,EAAE,IAAI,CAAC,WAAW,EAAE,SAAS,GAAG,MAAM,GAAG,QAAQ,CAAC,GAAG;QAC1D,KAAK,EAAE,WAAW,CAAC,UAAU,CAAC,CAAC;KAChC,CAAC;IACF,eAAe,CAAC,EAAE,IAAI,CAAC,WAAW,EAAE,SAAS,GAAG,MAAM,GAAG,QAAQ,CAAC,GAAG;QACnE,KAAK,EAAE,WAAW,CAAC,UAAU,CAAC,CAAC;KAChC,CAAC;IACF,SAAS,CAAC,EAAE,OAAO,CAAC,oBAAoB,CAAC,WAAW,CAAC,EAAE,aAAa,CAAC,CAAC;IACtE;;;;;;;OAOG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;CACvB,GAAG,IAAI,CAAC,oBAAoB,EAAE,IAAI,GAAG,WAAW,GAAG,aAAa,CAAC,CAAC;AAEnE;;;;;GAKG;AACH,eAAO,MAAM,cAAc,GAAI,4IAY5B,mBAAmB,
|
|
1
|
+
{"version":3,"file":"CriticalBanner.d.ts","sourceRoot":"","sources":["../../../../src/prompt/CriticalBanner/CriticalBanner.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAmB,MAAM,OAAO,CAAC;AAMnD,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAmB,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAE3E,OAAO,EAAqB,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAKxE,MAAM,MAAM,mBAAmB,GAAG;IAChC,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,WAAW,EAAE,SAAS,CAAC;IACvB,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,MAAM,CAAC,EAAE,IAAI,CAAC,WAAW,EAAE,SAAS,GAAG,MAAM,GAAG,QAAQ,CAAC,GAAG;QAC1D,KAAK,EAAE,WAAW,CAAC,UAAU,CAAC,CAAC;KAChC,CAAC;IACF,eAAe,CAAC,EAAE,IAAI,CAAC,WAAW,EAAE,SAAS,GAAG,MAAM,GAAG,QAAQ,CAAC,GAAG;QACnE,KAAK,EAAE,WAAW,CAAC,UAAU,CAAC,CAAC;KAChC,CAAC;IACF,SAAS,CAAC,EAAE,OAAO,CAAC,oBAAoB,CAAC,WAAW,CAAC,EAAE,aAAa,CAAC,CAAC;IACtE;;;;;;;OAOG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;CACvB,GAAG,IAAI,CAAC,oBAAoB,EAAE,IAAI,GAAG,WAAW,GAAG,aAAa,CAAC,CAAC;AAEnE;;;;;GAKG;AACH,eAAO,MAAM,cAAc,GAAI,4IAY5B,mBAAmB,gCA8HrB,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React, { useState } from 'react';
|
|
2
2
|
import { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
3
3
|
import { FastFlag as FastFlagIcon, CardWise as CardWiseIcon } from '@transferwise/icons';
|
|
4
|
+
import { createSandboxStory, globalScope } from '../../.storybook/components/sandbox/SandboxEditor';
|
|
4
5
|
|
|
5
6
|
import { Scroll, Size } from '../common';
|
|
6
7
|
import Modal from '../modal';
|
|
@@ -89,6 +90,30 @@ const meta: Meta<typeof Accordion> = {
|
|
|
89
90
|
export default meta;
|
|
90
91
|
type Story = StoryObj<typeof Accordion>;
|
|
91
92
|
|
|
93
|
+
export const Sandbox = createSandboxStory({
|
|
94
|
+
code: `<Accordion
|
|
95
|
+
indexOpen={1}
|
|
96
|
+
items={[
|
|
97
|
+
{
|
|
98
|
+
title: 'Item 1',
|
|
99
|
+
content: 'I can be text',
|
|
100
|
+
icon: <Freeze size={24} />,
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
title: 'Item 2 with icon',
|
|
104
|
+
content: <span>I can be a node</span>,
|
|
105
|
+
icon: <HappyEmoji size={24} />,
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
title: 'Item 3',
|
|
109
|
+
content: 'I can be text',
|
|
110
|
+
icon: <New size={24} />,
|
|
111
|
+
},
|
|
112
|
+
]}
|
|
113
|
+
/>`,
|
|
114
|
+
scope: globalScope,
|
|
115
|
+
});
|
|
116
|
+
|
|
92
117
|
export const Default: Story = {
|
|
93
118
|
args: {
|
|
94
119
|
indexOpen: 0,
|
|
@@ -3,6 +3,7 @@ import { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
|
3
3
|
import AvatarLayout, { AvatarLayoutProps } from '.';
|
|
4
4
|
import { Freeze } from '@transferwise/icons';
|
|
5
5
|
import { Flag } from '@wise/art';
|
|
6
|
+
import { createSandboxStory, globalScope } from '../../.storybook/components/sandbox/SandboxEditor';
|
|
6
7
|
import Body from '../body';
|
|
7
8
|
import SentimentSurface from '../sentimentSurface';
|
|
8
9
|
|
|
@@ -13,6 +14,15 @@ export default {
|
|
|
13
14
|
|
|
14
15
|
type Story = StoryObj<typeof AvatarLayout>;
|
|
15
16
|
|
|
17
|
+
export const Sandbox = createSandboxStory({
|
|
18
|
+
code: `<AvatarLayout
|
|
19
|
+
size={48}
|
|
20
|
+
orientation="diagonal"
|
|
21
|
+
avatars={[{ asset: <Flag code="br" /> }, { asset: <Flag code="jp" /> }]}
|
|
22
|
+
/>`,
|
|
23
|
+
scope: globalScope,
|
|
24
|
+
});
|
|
25
|
+
|
|
16
26
|
const sizes: AvatarLayoutProps['size'][] = [16, 24, 32, 40, 48, 56, 72, 88, 96];
|
|
17
27
|
|
|
18
28
|
export const Diagonal: Story = {
|
|
@@ -17,6 +17,7 @@ import {
|
|
|
17
17
|
} from '@transferwise/icons';
|
|
18
18
|
import AvatarView, { AvatarViewProps } from '.';
|
|
19
19
|
import { Flag } from '@wise/art';
|
|
20
|
+
import { createSandboxStory, globalScope } from '../../.storybook/components/sandbox/SandboxEditor';
|
|
20
21
|
import { ProfileType } from '../common';
|
|
21
22
|
import Body from '../body';
|
|
22
23
|
import SentimentSurface from '../sentimentSurface';
|
|
@@ -28,6 +29,13 @@ export default {
|
|
|
28
29
|
|
|
29
30
|
type Story = StoryObj<typeof AvatarView>;
|
|
30
31
|
|
|
32
|
+
export const Sandbox = createSandboxStory({
|
|
33
|
+
code: `<AvatarView size={48} badge={{ flagCode: 'GBP' }}>
|
|
34
|
+
<Freeze />
|
|
35
|
+
</AvatarView>`,
|
|
36
|
+
scope: globalScope,
|
|
37
|
+
});
|
|
38
|
+
|
|
31
39
|
const profileName1 = 'Wolter White';
|
|
32
40
|
const profileName2 = 'Tyler Durden';
|
|
33
41
|
const sizes: AvatarViewProps['size'][] = [16, 24, 32, 40, 48, 56, 72, 88, 96];
|
package/src/body/Body.story.tsx
CHANGED
|
@@ -2,12 +2,23 @@ import { Typography } from '../common/propsValues/typography';
|
|
|
2
2
|
import Title from '../title';
|
|
3
3
|
|
|
4
4
|
import Body from './Body';
|
|
5
|
+
import {
|
|
6
|
+
createSandboxStory,
|
|
7
|
+
globalScope,
|
|
8
|
+
} from '../../.storybook/components/sandbox/SandboxEditor';
|
|
5
9
|
|
|
6
10
|
export default {
|
|
7
11
|
title: 'Typography/Body',
|
|
8
12
|
component: Body,
|
|
9
13
|
};
|
|
10
14
|
|
|
15
|
+
export const Sandbox = createSandboxStory({
|
|
16
|
+
code: `<Body type="body-default">
|
|
17
|
+
We're building the world's most international account.
|
|
18
|
+
</Body>`,
|
|
19
|
+
scope: globalScope,
|
|
20
|
+
});
|
|
21
|
+
|
|
11
22
|
export const Basic = () => {
|
|
12
23
|
return (
|
|
13
24
|
<>
|
|
@@ -126,3 +137,4 @@ export const Basic = () => {
|
|
|
126
137
|
</>
|
|
127
138
|
);
|
|
128
139
|
};
|
|
140
|
+
|
|
@@ -322,7 +322,13 @@ export const Playground: StoryObj<PreviewStoryArgs> = {
|
|
|
322
322
|
};
|
|
323
323
|
|
|
324
324
|
export const Sandbox = createSandboxStory({
|
|
325
|
-
code: `<Button
|
|
325
|
+
code: `<Button
|
|
326
|
+
v2
|
|
327
|
+
priority="primary"
|
|
328
|
+
sentiment="default"
|
|
329
|
+
size="md"
|
|
330
|
+
addonEnd={{ type: 'icon', value: <ArrowRight /> }}
|
|
331
|
+
>
|
|
326
332
|
Click me
|
|
327
333
|
</Button>`,
|
|
328
334
|
scope: globalScope,
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { useState } from 'react';
|
|
2
2
|
import { StoryObj } from '@storybook/react-webpack5';
|
|
3
3
|
import { userEvent, within } from 'storybook/test';
|
|
4
|
+
import {
|
|
5
|
+
createSandboxStory,
|
|
6
|
+
globalScope,
|
|
7
|
+
} from '../../.storybook/components/sandbox/SandboxEditor';
|
|
4
8
|
import Calendar, { type CalendarProps } from './Calendar';
|
|
5
9
|
import Modal from '../modal';
|
|
6
10
|
import Button from '../button';
|
|
@@ -9,13 +13,6 @@ import Button from '../button';
|
|
|
9
13
|
export default {
|
|
10
14
|
component: Calendar,
|
|
11
15
|
title: 'Forms/Calendar',
|
|
12
|
-
decorators: [
|
|
13
|
-
(Story: React.ComponentType) => (
|
|
14
|
-
<div style={{ maxWidth: 500, margin: '0 auto' }}>
|
|
15
|
-
<Story />
|
|
16
|
-
</div>
|
|
17
|
-
),
|
|
18
|
-
],
|
|
19
16
|
argTypes: {
|
|
20
17
|
monthFormat: { control: 'select', options: ['long', 'short'] },
|
|
21
18
|
min: { control: 'date' },
|
|
@@ -31,6 +28,21 @@ theFuture.setUTCDate(epoch.getUTCDate() + 10);
|
|
|
31
28
|
const thePast = new Date(epoch);
|
|
32
29
|
thePast.setUTCDate(epoch.getUTCDate() - 10);
|
|
33
30
|
|
|
31
|
+
export const Sandbox = createSandboxStory({
|
|
32
|
+
code: `const App = () => {
|
|
33
|
+
const [value, setValue] = React.useState(new Date('2024-06-15'));
|
|
34
|
+
|
|
35
|
+
return (
|
|
36
|
+
<Calendar
|
|
37
|
+
monthFormat="long"
|
|
38
|
+
value={value}
|
|
39
|
+
onChange={(date) => setValue(date)}
|
|
40
|
+
/>
|
|
41
|
+
);
|
|
42
|
+
};`,
|
|
43
|
+
scope: { ...globalScope, Calendar },
|
|
44
|
+
});
|
|
45
|
+
|
|
34
46
|
export const Basic: Story = {
|
|
35
47
|
render: (args: CalendarProps) => {
|
|
36
48
|
const [value, setValue] = useState<Date | null>(epoch);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Args } from '@storybook/react-webpack5';
|
|
2
2
|
import { Illustration } from '@wise/art';
|
|
3
|
+
import { createSandboxStory, globalScope } from '../../.storybook/components/sandbox/SandboxEditor';
|
|
3
4
|
|
|
4
5
|
import Display from '../display';
|
|
5
6
|
|
|
@@ -53,6 +54,40 @@ const carouselCards: CarouselCard[] = [
|
|
|
53
54
|
},
|
|
54
55
|
];
|
|
55
56
|
|
|
57
|
+
export const Sandbox = createSandboxStory({
|
|
58
|
+
code: `const App = () => {
|
|
59
|
+
const cards = [
|
|
60
|
+
{
|
|
61
|
+
id: 'card-1',
|
|
62
|
+
type: 'button',
|
|
63
|
+
onClick: console.log,
|
|
64
|
+
content: (
|
|
65
|
+
<div className="d-flex p-a-1 flex-column align-items-center">
|
|
66
|
+
<Illustration disablePadding name="globe" size="small" alt="" />
|
|
67
|
+
</div>
|
|
68
|
+
),
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
id: 'card-2',
|
|
72
|
+
type: 'promo',
|
|
73
|
+
href: '#',
|
|
74
|
+
title: 'Wise',
|
|
75
|
+
description: 'The best way to move money internationally',
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
id: 'card-3',
|
|
79
|
+
type: 'anchor',
|
|
80
|
+
href: '#',
|
|
81
|
+
hrefTarget: '_blank',
|
|
82
|
+
content: <Display type="display-small">Get Quick Pay</Display>,
|
|
83
|
+
},
|
|
84
|
+
];
|
|
85
|
+
|
|
86
|
+
return <Carousel header="Carousel heading" cards={cards} />;
|
|
87
|
+
};`,
|
|
88
|
+
scope: globalScope,
|
|
89
|
+
});
|
|
90
|
+
|
|
56
91
|
export const CarouselDefault = {
|
|
57
92
|
render: (args: Args) => {
|
|
58
93
|
return <Carousel header="Pretty nifty stuff" cards={carouselCards} {...args} />;
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
2
2
|
import { fn } from 'storybook/test';
|
|
3
3
|
|
|
4
|
+
import {
|
|
5
|
+
createSandboxStory,
|
|
6
|
+
globalScope,
|
|
7
|
+
} from '../../.storybook/components/sandbox/SandboxEditor';
|
|
4
8
|
import { Field } from '../field/Field';
|
|
5
9
|
|
|
6
10
|
import Checkbox from './Checkbox';
|
|
@@ -19,6 +23,22 @@ export default meta;
|
|
|
19
23
|
|
|
20
24
|
type Story = StoryObj<typeof Checkbox>;
|
|
21
25
|
|
|
26
|
+
export const Sandbox = createSandboxStory({
|
|
27
|
+
code: `const App = () => {
|
|
28
|
+
const [checked, setChecked] = React.useState(false);
|
|
29
|
+
|
|
30
|
+
return (
|
|
31
|
+
<Checkbox
|
|
32
|
+
label="I agree to the terms and conditions"
|
|
33
|
+
secondary="Please read before accepting"
|
|
34
|
+
checked={checked}
|
|
35
|
+
onChange={() => setChecked((prev) => !prev)}
|
|
36
|
+
/>
|
|
37
|
+
);
|
|
38
|
+
};`,
|
|
39
|
+
scope: globalScope,
|
|
40
|
+
});
|
|
41
|
+
|
|
22
42
|
export const Basic: Story = {};
|
|
23
43
|
|
|
24
44
|
export const Multiple: Story = {
|
|
@@ -3,6 +3,7 @@ import { fn } from 'storybook/test';
|
|
|
3
3
|
import { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
4
4
|
|
|
5
5
|
import { storySourceWithoutNoise } from '../../.storybook/helpers';
|
|
6
|
+
import { createSandboxStory, globalScope } from '../../.storybook/components/sandbox/SandboxEditor';
|
|
6
7
|
import CheckboxButton, { type CheckboxButtonProps } from './CheckboxButton';
|
|
7
8
|
import { Label } from '../label/Label';
|
|
8
9
|
|
|
@@ -89,6 +90,21 @@ export const Playground: Story = storySourceWithoutNoise({
|
|
|
89
90
|
},
|
|
90
91
|
});
|
|
91
92
|
|
|
93
|
+
export const Sandbox = createSandboxStory({
|
|
94
|
+
code: `const App = () => {
|
|
95
|
+
const [checked, setChecked] = React.useState(true);
|
|
96
|
+
|
|
97
|
+
return (
|
|
98
|
+
<CheckboxButton
|
|
99
|
+
aria-label="Toggle email updates"
|
|
100
|
+
checked={checked}
|
|
101
|
+
onChange={(event) => setChecked(event.currentTarget.checked)}
|
|
102
|
+
/>
|
|
103
|
+
);
|
|
104
|
+
};`,
|
|
105
|
+
scope: globalScope,
|
|
106
|
+
});
|
|
107
|
+
|
|
92
108
|
/** Disabled state — checked and unchecked. */
|
|
93
109
|
export const Disabled: Story = {
|
|
94
110
|
decorators: [withColumnLayout],
|
|
@@ -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 Chevron from './Chevron';
|
|
4
5
|
|
|
@@ -9,6 +10,11 @@ export default {
|
|
|
9
10
|
|
|
10
11
|
type Story = StoryObj<typeof Chevron>;
|
|
11
12
|
|
|
13
|
+
export const Sandbox = createSandboxStory({
|
|
14
|
+
code: `<Chevron orientation="bottom" size="md" />`,
|
|
15
|
+
scope: {Chevron},
|
|
16
|
+
});
|
|
17
|
+
|
|
12
18
|
export const Basic: Story = {
|
|
13
19
|
args: {
|
|
14
20
|
orientation: 'top',
|
|
@@ -4,6 +4,7 @@ import { useState } from 'react';
|
|
|
4
4
|
|
|
5
5
|
import Chips, { type ChipValue, type ChipsProps } from './Chips';
|
|
6
6
|
import { storySourceWithoutNoise } from '../../.storybook/helpers';
|
|
7
|
+
import { createSandboxStory, globalScope } from '../../.storybook/components/sandbox/SandboxEditor';
|
|
7
8
|
|
|
8
9
|
/**
|
|
9
10
|
* Can be used for making a <a href="?path=/story/actions-chips--choice">choice</a>, or as a <a href="?path=/story/actions-chips--filter">filter</a> with multiple options.
|
|
@@ -91,6 +92,28 @@ export const Playground: Story = storySourceWithoutNoise<typeof Chips>({
|
|
|
91
92
|
},
|
|
92
93
|
});
|
|
93
94
|
|
|
95
|
+
export const Sandbox = createSandboxStory({
|
|
96
|
+
code: `const App = () => {
|
|
97
|
+
const [selected, setSelected] = React.useState('accounting');
|
|
98
|
+
|
|
99
|
+
return (
|
|
100
|
+
<Chips
|
|
101
|
+
chips={[
|
|
102
|
+
{ value: 'all', label: 'All' },
|
|
103
|
+
{ value: 'accounting', label: 'Accounting' },
|
|
104
|
+
{ value: 'payroll', label: 'Payroll' },
|
|
105
|
+
{ value: 'reporting', label: 'Reporting' },
|
|
106
|
+
{ value: 'payments', label: 'Payments' },
|
|
107
|
+
]}
|
|
108
|
+
selected={selected}
|
|
109
|
+
onChange={({ selectedValue }) => setSelected(selectedValue)}
|
|
110
|
+
aria-label="Category filter"
|
|
111
|
+
/>
|
|
112
|
+
);
|
|
113
|
+
};`,
|
|
114
|
+
scope: globalScope,
|
|
115
|
+
});
|
|
116
|
+
|
|
94
117
|
/**
|
|
95
118
|
* The user can select any number of chips with the selected prop as an array (`multiple` prop set to `true`). <br />
|
|
96
119
|
* <a href="https://docs.wise.design/components/chip#filter-chips" target="_blank">Design documentation</a>
|
|
@@ -2,6 +2,7 @@ import * as Icons from '@transferwise/icons';
|
|
|
2
2
|
|
|
3
3
|
import { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
4
4
|
import { fn } from 'storybook/test';
|
|
5
|
+
import { createSandboxStory, globalScope } from '../../.storybook/components/sandbox/SandboxEditor';
|
|
5
6
|
import CircularButton, { CircularButtonProps } from './CircularButton';
|
|
6
7
|
import Title from '../title';
|
|
7
8
|
import SentimentSurface from '../sentimentSurface';
|
|
@@ -42,6 +43,18 @@ type Story = StoryObj<typeof CircularButton>;
|
|
|
42
43
|
/** Explore all props via the controls panel. */
|
|
43
44
|
export const Playground: Story = {};
|
|
44
45
|
|
|
46
|
+
export const Sandbox = createSandboxStory({
|
|
47
|
+
code: `<CircularButton
|
|
48
|
+
icon={<Freeze />}
|
|
49
|
+
priority="primary"
|
|
50
|
+
type="default"
|
|
51
|
+
onClick={() => console.log('clicked')}
|
|
52
|
+
>
|
|
53
|
+
Freeze card
|
|
54
|
+
</CircularButton>`,
|
|
55
|
+
scope: globalScope,
|
|
56
|
+
});
|
|
57
|
+
|
|
45
58
|
/**
|
|
46
59
|
* Priorities set a visual hierarchy amongst the buttons displayed on the
|
|
47
60
|
* screen to help more important buttons to take precedence over others. <br />
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
2
|
+
import {
|
|
3
|
+
createSandboxStory,
|
|
4
|
+
globalScope,
|
|
5
|
+
} from '../../../.storybook/components/sandbox/SandboxEditor';
|
|
2
6
|
|
|
3
7
|
import { lorem10 } from '../../test-utils';
|
|
4
8
|
import Title from '../../title';
|
|
@@ -14,6 +18,14 @@ const meta: Meta<typeof BaseCard> = {
|
|
|
14
18
|
export default meta;
|
|
15
19
|
type Story = StoryObj<typeof BaseCard>;
|
|
16
20
|
|
|
21
|
+
export const Sandbox = createSandboxStory({
|
|
22
|
+
code: `<BaseCard onDismiss={() => console.log('dismissed')}>
|
|
23
|
+
<Title type="title-section">Money without borders</Title>
|
|
24
|
+
<Body>Send money abroad with low fees and the real exchange rate.</Body>
|
|
25
|
+
</BaseCard>`,
|
|
26
|
+
scope: globalScope,
|
|
27
|
+
});
|
|
28
|
+
|
|
17
29
|
export const Default: Story = {
|
|
18
30
|
args: {
|
|
19
31
|
children: (
|
|
@@ -2,6 +2,10 @@ import { action } from 'storybook/actions';
|
|
|
2
2
|
import { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
3
3
|
import { FastFlag } from '@transferwise/icons';
|
|
4
4
|
import { useState } from 'react';
|
|
5
|
+
import {
|
|
6
|
+
createSandboxStory,
|
|
7
|
+
globalScope,
|
|
8
|
+
} from '../../../.storybook/components/sandbox/SandboxEditor';
|
|
5
9
|
import Button from '../../button';
|
|
6
10
|
import { lorem10 } from '../../test-utils';
|
|
7
11
|
import Title from '../../title/Title';
|
|
@@ -38,6 +42,23 @@ export default {
|
|
|
38
42
|
|
|
39
43
|
type Story = StoryObj<typeof BottomSheet>;
|
|
40
44
|
|
|
45
|
+
export const Sandbox = createSandboxStory({
|
|
46
|
+
code: `const App = () => {
|
|
47
|
+
const [open, setOpen] = React.useState(false);
|
|
48
|
+
|
|
49
|
+
return (
|
|
50
|
+
<>
|
|
51
|
+
<Button v2 onClick={() => setOpen(true)}>Open BottomSheet</Button>
|
|
52
|
+
<BottomSheet open={open} onClose={() => setOpen(false)}>
|
|
53
|
+
<h2 className="p-x-2">Manage your card</h2>
|
|
54
|
+
<p className="p-x-2">Select an action to manage your card settings.</p>
|
|
55
|
+
</BottomSheet>
|
|
56
|
+
</>
|
|
57
|
+
);
|
|
58
|
+
};`,
|
|
59
|
+
scope: globalScope,
|
|
60
|
+
});
|
|
61
|
+
|
|
41
62
|
export const Basic: Story = {
|
|
42
63
|
args: {
|
|
43
64
|
children: (
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
2
2
|
import Circle from './Circle';
|
|
3
3
|
import { Person } from '@transferwise/icons';
|
|
4
|
+
import {
|
|
5
|
+
createSandboxStory,
|
|
6
|
+
globalScope,
|
|
7
|
+
} from '../../../.storybook/components/sandbox/SandboxEditor';
|
|
4
8
|
import { CircleProps } from '.';
|
|
5
9
|
import Body from '../../body';
|
|
6
10
|
import { withVariantConfig } from '../../../.storybook/helpers';
|
|
@@ -13,6 +17,13 @@ export default {
|
|
|
13
17
|
|
|
14
18
|
type Story = StoryObj<typeof Circle>;
|
|
15
19
|
|
|
20
|
+
export const Sandbox = createSandboxStory({
|
|
21
|
+
code: `<Circle size={40} className="bg-neutral">
|
|
22
|
+
<Person size={16} />
|
|
23
|
+
</Circle>`,
|
|
24
|
+
scope: { ...globalScope, Circle },
|
|
25
|
+
});
|
|
26
|
+
|
|
16
27
|
export const Basic: Story = {
|
|
17
28
|
args: {
|
|
18
29
|
children: 'NP',
|
|
@@ -4,6 +4,10 @@ import Body from '../body';
|
|
|
4
4
|
import Title from '../title';
|
|
5
5
|
|
|
6
6
|
import Container from './Container';
|
|
7
|
+
import {
|
|
8
|
+
createSandboxStory,
|
|
9
|
+
globalScope,
|
|
10
|
+
} from '../../.storybook/components/sandbox/SandboxEditor';
|
|
7
11
|
|
|
8
12
|
export default {
|
|
9
13
|
component: Container,
|
|
@@ -74,6 +78,14 @@ export const Playground: Story = {
|
|
|
74
78
|
),
|
|
75
79
|
};
|
|
76
80
|
|
|
81
|
+
export const Sandbox = createSandboxStory({
|
|
82
|
+
code: `<Container size="standard">
|
|
83
|
+
<Title type="title-section">Page content</Title>
|
|
84
|
+
<Body>This content is constrained by the Container width.</Body>
|
|
85
|
+
</Container>`,
|
|
86
|
+
scope: globalScope,
|
|
87
|
+
});
|
|
88
|
+
|
|
77
89
|
/**
|
|
78
90
|
* Four sizes control the maximum width of the container. <br />
|
|
79
91
|
* `fluid` fills the full viewport, `standard` caps at 1160px, `narrow` at 840px, and `compact` at
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
2
2
|
import { fn } from 'storybook/test';
|
|
3
3
|
|
|
4
|
+
import {
|
|
5
|
+
createSandboxStory,
|
|
6
|
+
globalScope,
|
|
7
|
+
} from '../../.storybook/components/sandbox/SandboxEditor';
|
|
4
8
|
import { DateInput } from '..';
|
|
5
9
|
|
|
6
10
|
const meta: Meta<typeof DateInput> = {
|
|
@@ -12,6 +16,22 @@ export default meta;
|
|
|
12
16
|
|
|
13
17
|
type Story = StoryObj<typeof meta>;
|
|
14
18
|
|
|
19
|
+
export const Sandbox = createSandboxStory({
|
|
20
|
+
code: `const App = () => {
|
|
21
|
+
const [value, setValue] = React.useState({ day: 15, month: 5, year: 1990 });
|
|
22
|
+
|
|
23
|
+
return (
|
|
24
|
+
<Field label="Date of birth">
|
|
25
|
+
<DateInput
|
|
26
|
+
value={value}
|
|
27
|
+
onChange={(newValue) => setValue(newValue)}
|
|
28
|
+
/>
|
|
29
|
+
</Field>
|
|
30
|
+
);
|
|
31
|
+
};`,
|
|
32
|
+
scope: globalScope,
|
|
33
|
+
});
|
|
34
|
+
|
|
15
35
|
export const Basic: Story = {
|
|
16
36
|
args: {
|
|
17
37
|
onChange: fn(),
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { useState } from 'react';
|
|
2
2
|
import { StoryObj } from '@storybook/react-webpack5';
|
|
3
|
+
import {
|
|
4
|
+
createSandboxStory,
|
|
5
|
+
globalScope,
|
|
6
|
+
} from '../../.storybook/components/sandbox/SandboxEditor';
|
|
3
7
|
import { Field } from '..';
|
|
4
8
|
import { Size } from '../common';
|
|
5
9
|
import DateLookup, { type DateLookupProps } from './DateLookup';
|
|
@@ -28,6 +32,25 @@ theFuture.setUTCDate(epoch.getUTCDate() + 10);
|
|
|
28
32
|
const thePast = new Date(epoch);
|
|
29
33
|
thePast.setUTCDate(epoch.getUTCDate() - 10);
|
|
30
34
|
|
|
35
|
+
export const Sandbox = createSandboxStory({
|
|
36
|
+
code: `const App = () => {
|
|
37
|
+
const [value, setValue] = React.useState(new Date('2024-06-15'));
|
|
38
|
+
|
|
39
|
+
return (
|
|
40
|
+
<DateLookup
|
|
41
|
+
size="md"
|
|
42
|
+
label="Select a date"
|
|
43
|
+
monthFormat="long"
|
|
44
|
+
placeholder="Choose date"
|
|
45
|
+
clearable
|
|
46
|
+
value={value}
|
|
47
|
+
onChange={(date) => setValue(date)}
|
|
48
|
+
/>
|
|
49
|
+
);
|
|
50
|
+
};`,
|
|
51
|
+
scope: globalScope,
|
|
52
|
+
});
|
|
53
|
+
|
|
31
54
|
export const Basic: Story = {
|
|
32
55
|
render: (args: DateLookupProps) => {
|
|
33
56
|
const [value, setValue] = useState<Date | null>(epoch);
|
|
@@ -3,6 +3,10 @@ import { fn } from 'storybook/test';
|
|
|
3
3
|
import { Size } from '../common';
|
|
4
4
|
import AvatarView from '../avatarView';
|
|
5
5
|
import Decision, { DecisionPresentation, DecisionType } from '.';
|
|
6
|
+
import {
|
|
7
|
+
createSandboxStory,
|
|
8
|
+
globalScope,
|
|
9
|
+
} from '../../.storybook/components/sandbox/SandboxEditor';
|
|
6
10
|
|
|
7
11
|
export default {
|
|
8
12
|
component: Decision,
|
|
@@ -14,6 +18,38 @@ export default {
|
|
|
14
18
|
},
|
|
15
19
|
};
|
|
16
20
|
|
|
21
|
+
export const Sandbox = createSandboxStory({
|
|
22
|
+
code: `<Decision
|
|
23
|
+
presentation="LIST_BLOCK"
|
|
24
|
+
type="NAVIGATION"
|
|
25
|
+
size="md"
|
|
26
|
+
showMediaCircleInList
|
|
27
|
+
options={[
|
|
28
|
+
{
|
|
29
|
+
title: 'Send money',
|
|
30
|
+
description: 'Fast international transfers at the real exchange rate.',
|
|
31
|
+
href: '#',
|
|
32
|
+
'aria-label': 'Send money',
|
|
33
|
+
media: {
|
|
34
|
+
block: <Illustration name="globe" alt="" disablePadding />,
|
|
35
|
+
list: <AvatarView profileName="Alice Smith" />,
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
title: 'Receive money',
|
|
40
|
+
description: 'Get paid from abroad with your account details.',
|
|
41
|
+
href: '#',
|
|
42
|
+
'aria-label': 'Receive money',
|
|
43
|
+
media: {
|
|
44
|
+
block: <Illustration name="confetti" alt="" disablePadding />,
|
|
45
|
+
list: <AvatarView profileName="Bob Jones" />,
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
]}
|
|
49
|
+
/>`,
|
|
50
|
+
scope: globalScope,
|
|
51
|
+
});
|
|
52
|
+
|
|
17
53
|
export const Basic = function Render() {
|
|
18
54
|
return (
|
|
19
55
|
<Decision
|
|
@@ -6,6 +6,10 @@ import DefinitionList, { type DefinitionListLayout } from './DefinitionList';
|
|
|
6
6
|
import { lorem10 } from '../test-utils';
|
|
7
7
|
import Section from '../section';
|
|
8
8
|
import Header from '../header';
|
|
9
|
+
import {
|
|
10
|
+
createSandboxStory,
|
|
11
|
+
globalScope,
|
|
12
|
+
} from '../../.storybook/components/sandbox/SandboxEditor';
|
|
9
13
|
|
|
10
14
|
export default {
|
|
11
15
|
component: DefinitionList,
|
|
@@ -38,6 +42,18 @@ const definitions = [
|
|
|
38
42
|
},
|
|
39
43
|
];
|
|
40
44
|
|
|
45
|
+
export const Sandbox = createSandboxStory({
|
|
46
|
+
code: `<DefinitionList
|
|
47
|
+
layout="VERTICAL_TWO_COLUMN"
|
|
48
|
+
definitions={[
|
|
49
|
+
{ title: 'Name', value: 'Alice Smith', key: 'name' },
|
|
50
|
+
{ title: 'Amount', value: '1,234.56 GBP', key: 'amount' },
|
|
51
|
+
{ title: 'Status', value: 'Completed', key: 'status' },
|
|
52
|
+
]}
|
|
53
|
+
/>`,
|
|
54
|
+
scope: globalScope,
|
|
55
|
+
});
|
|
56
|
+
|
|
41
57
|
export const Basic = () => {
|
|
42
58
|
return layouts.map((layout) => (
|
|
43
59
|
<Section key={layout}>
|