@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,4 +1,5 @@
|
|
|
1
1
|
import { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
2
|
+
import { createSandboxStory, globalScope } from '../../.storybook/components/sandbox/SandboxEditor';
|
|
2
3
|
import Table from './Table';
|
|
3
4
|
import { TableHeaderType } from './TableHeader';
|
|
4
5
|
import { TableRowType, TableRowClickableType } from './TableRow';
|
|
@@ -356,6 +357,37 @@ const tableData = {
|
|
|
356
357
|
] satisfies TableRowType[] | TableRowClickableType[],
|
|
357
358
|
};
|
|
358
359
|
|
|
360
|
+
export const Sandbox = createSandboxStory({
|
|
361
|
+
code: `<Table
|
|
362
|
+
data={{
|
|
363
|
+
headers: [
|
|
364
|
+
{ header: 'Employee', width: '200px' },
|
|
365
|
+
{ header: 'Location' },
|
|
366
|
+
{ header: 'Payment', alignment: 'right' },
|
|
367
|
+
],
|
|
368
|
+
rows: [
|
|
369
|
+
{
|
|
370
|
+
id: 0,
|
|
371
|
+
cells: [
|
|
372
|
+
{ cell: { type: 'leading', primaryText: 'Bob Brown', secondaryText: 'Engineer', avatar: { profileName: 'Bob Brown' } } },
|
|
373
|
+
{ cell: { type: 'text', text: 'FR, Paris' } },
|
|
374
|
+
{ cell: { type: 'currency', primaryCurrency: { amount: 12345.67, currency: 'eur' } }, alignment: 'right' },
|
|
375
|
+
],
|
|
376
|
+
},
|
|
377
|
+
{
|
|
378
|
+
id: 1,
|
|
379
|
+
cells: [
|
|
380
|
+
{ cell: { type: 'leading', primaryText: 'Jane Smith', secondaryText: 'Designer', avatar: { profileName: 'Jane Smith' } } },
|
|
381
|
+
{ cell: { type: 'text', text: 'UK, London' } },
|
|
382
|
+
{ cell: { type: 'currency', primaryCurrency: { amount: 34567.89, currency: 'gbp' } }, alignment: 'right' },
|
|
383
|
+
],
|
|
384
|
+
},
|
|
385
|
+
],
|
|
386
|
+
}}
|
|
387
|
+
/>`,
|
|
388
|
+
scope: globalScope,
|
|
389
|
+
});
|
|
390
|
+
|
|
359
391
|
export const Basic: Story = {
|
|
360
392
|
args: {
|
|
361
393
|
data: tableData,
|
package/src/tabs/Tabs.story.tsx
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { useState } from 'react';
|
|
2
|
+
import { createSandboxStory, globalScope } from '../../.storybook/components/sandbox/SandboxEditor';
|
|
2
3
|
|
|
3
4
|
import { Width } from '../common';
|
|
4
5
|
|
|
@@ -9,6 +10,36 @@ export default {
|
|
|
9
10
|
title: 'Navigation/Tabs',
|
|
10
11
|
};
|
|
11
12
|
|
|
13
|
+
export const Sandbox = createSandboxStory({
|
|
14
|
+
code: `const App = () => {
|
|
15
|
+
const [selected, setSelected] = React.useState(0);
|
|
16
|
+
|
|
17
|
+
return (
|
|
18
|
+
<Tabs
|
|
19
|
+
name="tabs-sandbox"
|
|
20
|
+
tabs={[
|
|
21
|
+
{
|
|
22
|
+
title: 'First tab',
|
|
23
|
+
content: <div className="p-a-2">Content for the first tab.</div>,
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
title: 'Second tab',
|
|
27
|
+
content: <div className="p-a-2">Content for the second tab.</div>,
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
title: 'Third tab',
|
|
31
|
+
disabled: true,
|
|
32
|
+
content: <div className="p-a-2">This tab is disabled.</div>,
|
|
33
|
+
},
|
|
34
|
+
]}
|
|
35
|
+
selected={selected}
|
|
36
|
+
onTabSelect={(index) => setSelected(index)}
|
|
37
|
+
/>
|
|
38
|
+
);
|
|
39
|
+
};`,
|
|
40
|
+
scope: globalScope,
|
|
41
|
+
});
|
|
42
|
+
|
|
12
43
|
export const Basic = () => {
|
|
13
44
|
const [selected, setSelected] = useState(0);
|
|
14
45
|
return (
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { StoryObj } from '@storybook/react-webpack5';
|
|
2
2
|
import { userEvent, within } from 'storybook/test';
|
|
3
3
|
|
|
4
|
+
import {
|
|
5
|
+
createSandboxStory,
|
|
6
|
+
globalScope,
|
|
7
|
+
} from '../../.storybook/components/sandbox/SandboxEditor';
|
|
4
8
|
import TextareaWithDisplayFormat from './TextareaWithDisplayFormat';
|
|
5
9
|
import { Field } from '../field/Field';
|
|
6
10
|
|
|
@@ -11,6 +15,25 @@ export default {
|
|
|
11
15
|
|
|
12
16
|
type Story = StoryObj<typeof TextareaWithDisplayFormat>;
|
|
13
17
|
|
|
18
|
+
export const Sandbox = createSandboxStory({
|
|
19
|
+
code: `const App = () => {
|
|
20
|
+
const [value, setValue] = React.useState('');
|
|
21
|
+
|
|
22
|
+
return (
|
|
23
|
+
<Field label="Gift card code" id="gift-card">
|
|
24
|
+
<TextareaWithDisplayFormat
|
|
25
|
+
id="gift-card"
|
|
26
|
+
value={value}
|
|
27
|
+
maxLength={16}
|
|
28
|
+
displayPattern="**** - **** - ****"
|
|
29
|
+
onChange={(event) => setValue(event.target.value)}
|
|
30
|
+
/>
|
|
31
|
+
</Field>
|
|
32
|
+
);
|
|
33
|
+
};`,
|
|
34
|
+
scope: globalScope,
|
|
35
|
+
});
|
|
36
|
+
|
|
14
37
|
export const Basic: Story = {
|
|
15
38
|
render: () => {
|
|
16
39
|
const label = 'Textarea with display format';
|
package/src/tile/Tile.story.tsx
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
2
2
|
import { action } from 'storybook/actions';
|
|
3
|
+
import { createSandboxStory, globalScope } from '../../.storybook/components/sandbox/SandboxEditor';
|
|
3
4
|
import { Size } from '../common';
|
|
4
5
|
import AvatarView from '../avatarView';
|
|
5
6
|
import Tile from '.';
|
|
@@ -43,6 +44,18 @@ export default meta;
|
|
|
43
44
|
|
|
44
45
|
type Story = StoryObj<typeof Tile>;
|
|
45
46
|
|
|
47
|
+
export const Sandbox = createSandboxStory({
|
|
48
|
+
code: `<Tile
|
|
49
|
+
media={<AvatarView profileName="Hank Miller" />}
|
|
50
|
+
title="Hank Miller"
|
|
51
|
+
description="Click here to send money to Mr. Miller"
|
|
52
|
+
href="#"
|
|
53
|
+
size={Size.MEDIUM}
|
|
54
|
+
onClick={() => console.log('clicked')}
|
|
55
|
+
/>`,
|
|
56
|
+
scope: { ...globalScope, Tile },
|
|
57
|
+
});
|
|
58
|
+
|
|
46
59
|
export const WithImage: Story = {};
|
|
47
60
|
|
|
48
61
|
export const WithAvatar: Story = {
|
|
@@ -1,12 +1,23 @@
|
|
|
1
1
|
import { Typography } from '../common/propsValues/typography';
|
|
2
2
|
|
|
3
3
|
import Title from './Title';
|
|
4
|
+
import {
|
|
5
|
+
createSandboxStory,
|
|
6
|
+
globalScope,
|
|
7
|
+
} from '../../.storybook/components/sandbox/SandboxEditor';
|
|
4
8
|
|
|
5
9
|
export default {
|
|
6
10
|
component: Title,
|
|
7
11
|
title: 'Typography/Title',
|
|
8
12
|
};
|
|
9
13
|
|
|
14
|
+
export const Sandbox = createSandboxStory({
|
|
15
|
+
code: `<Title type="title-group">
|
|
16
|
+
Group Title
|
|
17
|
+
</Title>`,
|
|
18
|
+
scope: globalScope,
|
|
19
|
+
});
|
|
20
|
+
|
|
10
21
|
export const Basic = () => {
|
|
11
22
|
return (
|
|
12
23
|
<>
|
|
@@ -26,3 +37,4 @@ export const Basic = () => {
|
|
|
26
37
|
</>
|
|
27
38
|
);
|
|
28
39
|
};
|
|
40
|
+
|
|
@@ -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 Button from '../button';
|
|
3
4
|
import Tooltip from './Tooltip';
|
|
4
5
|
|
|
@@ -20,4 +21,11 @@ export default {
|
|
|
20
21
|
|
|
21
22
|
type Story = StoryObj<typeof Tooltip>;
|
|
22
23
|
|
|
24
|
+
export const Sandbox = createSandboxStory({
|
|
25
|
+
code: `<Tooltip label="Hey I'm the tooltip text — edit me!" position="bottom">
|
|
26
|
+
<Button v2 size="md">Hover me</Button>
|
|
27
|
+
</Tooltip>`,
|
|
28
|
+
scope: globalScope,
|
|
29
|
+
});
|
|
30
|
+
|
|
23
31
|
export const Basic: Story = {};
|
|
@@ -3,6 +3,10 @@ import { Search as SearchIcon } from '@transferwise/icons';
|
|
|
3
3
|
import { userEvent, within, fn } from 'storybook/test';
|
|
4
4
|
import { useState } from 'react';
|
|
5
5
|
|
|
6
|
+
import {
|
|
7
|
+
createSandboxStory,
|
|
8
|
+
globalScope,
|
|
9
|
+
} from '../../.storybook/components/sandbox/SandboxEditor';
|
|
6
10
|
import { Sentiment, Size } from '../common';
|
|
7
11
|
import { Input } from '../inputs/Input';
|
|
8
12
|
import { Field } from '../field/Field';
|
|
@@ -73,6 +77,35 @@ const meta: Meta<typeof Typeahead> = {
|
|
|
73
77
|
};
|
|
74
78
|
export default meta;
|
|
75
79
|
|
|
80
|
+
export const Sandbox = createSandboxStory({
|
|
81
|
+
code: `const App = () => {
|
|
82
|
+
const [options, setOptions] = React.useState([
|
|
83
|
+
{ label: 'British pound', note: 'GBP' },
|
|
84
|
+
{ label: 'Euro', note: 'EUR' },
|
|
85
|
+
{ label: 'US Dollar', note: 'USD' },
|
|
86
|
+
{ label: 'Japanese yen', note: 'JPY' },
|
|
87
|
+
{ label: 'Australian dollar', note: 'AUD' },
|
|
88
|
+
]);
|
|
89
|
+
|
|
90
|
+
return (
|
|
91
|
+
<Field label="Select a currency" id="typeahead-sandbox">
|
|
92
|
+
<Typeahead
|
|
93
|
+
id="typeahead-sandbox"
|
|
94
|
+
name="currency"
|
|
95
|
+
placeholder="Search currencies..."
|
|
96
|
+
clearable
|
|
97
|
+
addon={<Search size={24} />}
|
|
98
|
+
options={options}
|
|
99
|
+
onSearch={() => {
|
|
100
|
+
setTimeout(() => setOptions(options), 1000);
|
|
101
|
+
}}
|
|
102
|
+
/>
|
|
103
|
+
</Field>
|
|
104
|
+
);
|
|
105
|
+
};`,
|
|
106
|
+
scope: globalScope,
|
|
107
|
+
});
|
|
108
|
+
|
|
76
109
|
export const Basic: Story = {
|
|
77
110
|
render: function Render(args) {
|
|
78
111
|
const [options, setOptions] = useState([
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import type { 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 Upload from '.';
|
|
5
9
|
import { MAX_SIZE_DEFAULT } from './Upload';
|
|
6
10
|
|
|
@@ -138,6 +142,26 @@ const meta = {
|
|
|
138
142
|
export default meta;
|
|
139
143
|
type Story = StoryObj<typeof meta>;
|
|
140
144
|
|
|
145
|
+
export const Sandbox = createSandboxStory({
|
|
146
|
+
code: `<Upload
|
|
147
|
+
usAccept="image/*"
|
|
148
|
+
usLabel="Front of your ID document"
|
|
149
|
+
usPlaceholder="Drag and drop file less than 5MB"
|
|
150
|
+
usButtonText="Or Select File"
|
|
151
|
+
usDropMessage="Drop file to start upload"
|
|
152
|
+
size="md"
|
|
153
|
+
httpOptions={{
|
|
154
|
+
url: 'https://httpbin.org/post',
|
|
155
|
+
method: 'POST',
|
|
156
|
+
}}
|
|
157
|
+
onStart={(file) => console.log('Upload started', file.name)}
|
|
158
|
+
onSuccess={(response, fileName) => console.log('Upload complete', fileName)}
|
|
159
|
+
onFailure={(error) => console.log('Upload failed', error)}
|
|
160
|
+
onCancel={() => console.log('Upload cancelled')}
|
|
161
|
+
/>`,
|
|
162
|
+
scope: { ...globalScope, Upload },
|
|
163
|
+
});
|
|
164
|
+
|
|
141
165
|
export const Basic: Story = {
|
|
142
166
|
args: {
|
|
143
167
|
usAccept: 'image/*',
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { StoryFn, Meta } from '@storybook/react-webpack5';
|
|
2
2
|
|
|
3
|
+
import {
|
|
4
|
+
createSandboxStory,
|
|
5
|
+
globalScope,
|
|
6
|
+
} from '../../.storybook/components/sandbox/SandboxEditor';
|
|
3
7
|
import { Field } from '../field/Field';
|
|
4
8
|
|
|
5
9
|
import UploadInput, { UploadInputProps } from './UploadInput';
|
|
@@ -38,6 +42,33 @@ const props = {
|
|
|
38
42
|
},
|
|
39
43
|
};
|
|
40
44
|
|
|
45
|
+
export const Sandbox = createSandboxStory({
|
|
46
|
+
code: `const App = () => {
|
|
47
|
+
const onUploadFile = () => {
|
|
48
|
+
return new Promise((resolve) => {
|
|
49
|
+
setTimeout(() => resolve({ id: Math.round(Math.random() * 10000), url: '#' }), 2000);
|
|
50
|
+
});
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
const onDeleteFile = () => {
|
|
54
|
+
return new Promise((resolve) => {
|
|
55
|
+
setTimeout(() => resolve(), 1000);
|
|
56
|
+
});
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
return (
|
|
60
|
+
<Field label="Upload documents">
|
|
61
|
+
<UploadInput
|
|
62
|
+
multiple
|
|
63
|
+
onUploadFile={onUploadFile}
|
|
64
|
+
onDeleteFile={onDeleteFile}
|
|
65
|
+
/>
|
|
66
|
+
</Field>
|
|
67
|
+
);
|
|
68
|
+
};`,
|
|
69
|
+
scope: globalScope,
|
|
70
|
+
});
|
|
71
|
+
|
|
41
72
|
const Template: Story = (args: UploadInputProps) => <UploadInput {...args} />;
|
|
42
73
|
|
|
43
74
|
export const SingleFile: Story = Template.bind({});
|