@transferwise/components 46.147.0 → 46.148.1
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/container/Container.js.map +1 -1
- package/build/container/Container.mjs.map +1 -1
- package/build/main.css +63 -6
- package/build/prompt/CriticalBanner/CriticalBanner.js +81 -68
- package/build/prompt/CriticalBanner/CriticalBanner.js.map +1 -1
- package/build/prompt/CriticalBanner/CriticalBanner.mjs +82 -69
- package/build/prompt/CriticalBanner/CriticalBanner.mjs.map +1 -1
- package/build/prompt/PrimitivePrompt/PrimitivePrompt.js.map +1 -1
- package/build/prompt/PrimitivePrompt/PrimitivePrompt.mjs.map +1 -1
- package/build/styles/main.css +63 -6
- package/build/styles/prompt/ActionPrompt/ActionPrompt.css +2 -1
- package/build/styles/prompt/CriticalBanner/CriticalBanner.css +50 -1
- package/build/styles/prompt/InfoPrompt/InfoPrompt.css +2 -1
- package/build/styles/prompt/InlinePrompt/InlinePrompt.css +2 -1
- package/build/styles/prompt/PrimitivePrompt/PrimitivePrompt.css +2 -2
- package/build/types/container/Container.d.ts +2 -2
- package/build/types/container/Container.d.ts.map +1 -1
- package/build/types/iconButton/IconButton.d.ts +1 -1
- package/build/types/prompt/CriticalBanner/CriticalBanner.d.ts.map +1 -1
- package/build/types/prompt/PrimitivePrompt/PrimitivePrompt.d.ts +1 -1
- package/build/types/prompt/PrimitivePrompt/PrimitivePrompt.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/container/Container.tsx +2 -2
- 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 +63 -6
- 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.css +2 -1
- package/src/prompt/ActionPrompt/ActionPrompt.less +2 -1
- 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 +50 -1
- package/src/prompt/CriticalBanner/CriticalBanner.less +74 -1
- package/src/prompt/CriticalBanner/CriticalBanner.story.tsx +181 -170
- 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 +96 -84
- package/src/prompt/CriticalBanner/CriticalBanner.vars.less +1 -0
- package/src/prompt/InfoPrompt/InfoPrompt.css +2 -1
- package/src/prompt/InfoPrompt/InfoPrompt.less +2 -1
- package/src/prompt/InfoPrompt/InfoPrompt.story.tsx +30 -0
- package/src/prompt/InlinePrompt/InlinePrompt.css +2 -1
- package/src/prompt/InlinePrompt/InlinePrompt.less +2 -1
- package/src/prompt/InlinePrompt/InlinePrompt.story.tsx +14 -0
- package/src/prompt/PrimitivePrompt/PrimitivePrompt.css +2 -2
- package/src/prompt/PrimitivePrompt/PrimitivePrompt.less +1 -1
- package/src/prompt/PrimitivePrompt/PrimitivePrompt.tsx +1 -1
- 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
|
@@ -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',
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
2
2
|
|
|
3
3
|
import Money from './Money';
|
|
4
|
+
import { createSandboxStory } from '../../.storybook/components/sandbox/SandboxEditor';
|
|
4
5
|
|
|
5
6
|
export default {
|
|
6
7
|
component: Money,
|
|
@@ -9,9 +10,15 @@ export default {
|
|
|
9
10
|
|
|
10
11
|
type Story = StoryObj<typeof Money>;
|
|
11
12
|
|
|
13
|
+
export const Sandbox = createSandboxStory({
|
|
14
|
+
code: `<Money amount={1234.56} currency="GBP" />`,
|
|
15
|
+
scope: { Money },
|
|
16
|
+
});
|
|
17
|
+
|
|
12
18
|
export const Basic: Story = {
|
|
13
19
|
args: {
|
|
14
20
|
amount: 1234.5678,
|
|
15
21
|
currency: 'GBP',
|
|
16
22
|
},
|
|
17
23
|
};
|
|
24
|
+
|
|
@@ -3,6 +3,10 @@ import { within, userEvent, expect } from 'storybook/test';
|
|
|
3
3
|
import { Padlock } from '@transferwise/icons';
|
|
4
4
|
import { useState } from 'react';
|
|
5
5
|
|
|
6
|
+
import {
|
|
7
|
+
createSandboxStory,
|
|
8
|
+
globalScope,
|
|
9
|
+
} from '../../.storybook/components/sandbox/SandboxEditor';
|
|
6
10
|
import MoneyInput, { CurrencyOptionItem } from '.';
|
|
7
11
|
import { Field } from '../field/Field';
|
|
8
12
|
import translations from '../i18n/en.json';
|
|
@@ -108,6 +112,36 @@ const exampleBalanceCurrency = {
|
|
|
108
112
|
},
|
|
109
113
|
} as const;
|
|
110
114
|
|
|
115
|
+
export const Sandbox = createSandboxStory({
|
|
116
|
+
code: `const App = () => {
|
|
117
|
+
const currencies = [
|
|
118
|
+
{ header: 'Popular currencies' },
|
|
119
|
+
{ value: 'EUR', label: 'EUR', note: 'Euro', currency: 'eur', searchable: 'Spain, Germany' },
|
|
120
|
+
{ value: 'GBP', label: 'GBP', note: 'British pound', currency: 'gbp', searchable: 'England' },
|
|
121
|
+
{ value: 'USD', label: 'USD', note: 'US dollar', currency: 'usd', searchable: 'United States' },
|
|
122
|
+
];
|
|
123
|
+
|
|
124
|
+
const [selectedCurrency, setSelectedCurrency] = React.useState(currencies[1]);
|
|
125
|
+
const [amount, setAmount] = React.useState(1000);
|
|
126
|
+
|
|
127
|
+
return (
|
|
128
|
+
<Field label="Amount" id="money-input">
|
|
129
|
+
<MoneyInput
|
|
130
|
+
id="money-input"
|
|
131
|
+
size="lg"
|
|
132
|
+
amount={amount}
|
|
133
|
+
currencies={currencies}
|
|
134
|
+
selectedCurrency={selectedCurrency}
|
|
135
|
+
searchPlaceholder="Type a currency or country"
|
|
136
|
+
onAmountChange={(value) => setAmount(value)}
|
|
137
|
+
onCurrencyChange={(value) => setSelectedCurrency(value)}
|
|
138
|
+
/>
|
|
139
|
+
</Field>
|
|
140
|
+
);
|
|
141
|
+
};`,
|
|
142
|
+
scope: globalScope,
|
|
143
|
+
});
|
|
144
|
+
|
|
111
145
|
export const SingleCurrency: Story = {
|
|
112
146
|
args: {
|
|
113
147
|
currencies: [],
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { action } from 'storybook/actions';
|
|
2
2
|
import { Assets } from '@wise/art';
|
|
3
|
+
import { createSandboxStory, globalScope } from '../../.storybook/components/sandbox/SandboxEditor';
|
|
3
4
|
|
|
4
5
|
import { Nudge } from '..';
|
|
5
6
|
|
|
@@ -8,6 +9,22 @@ export default {
|
|
|
8
9
|
title: 'Prompts/Nudge',
|
|
9
10
|
};
|
|
10
11
|
|
|
12
|
+
export const Sandbox = createSandboxStory({
|
|
13
|
+
code: `<Nudge
|
|
14
|
+
mediaName="globe"
|
|
15
|
+
title="Get special rewards when you spend from a new balance"
|
|
16
|
+
link="Add balance"
|
|
17
|
+
href="#"
|
|
18
|
+
action={{
|
|
19
|
+
'aria-label': 'Learn more about rewards',
|
|
20
|
+
text: 'Learn more',
|
|
21
|
+
href: '#',
|
|
22
|
+
}}
|
|
23
|
+
onDismiss={() => console.log('dismissed')}
|
|
24
|
+
/>`,
|
|
25
|
+
scope: globalScope,
|
|
26
|
+
});
|
|
27
|
+
|
|
11
28
|
export const Default = () => {
|
|
12
29
|
return (
|
|
13
30
|
<div className="d-flex flex-column">
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
2
2
|
import { action } from 'storybook/actions';
|
|
3
3
|
import { Person, Briefcase as BriefcaseIcon } from '@transferwise/icons';
|
|
4
|
+
import { createSandboxStory, globalScope } from '../../.storybook/components/sandbox/SandboxEditor';
|
|
4
5
|
import AvatarView from '../avatarView';
|
|
5
6
|
import { ProfileType } from '../common';
|
|
6
7
|
import Logo from '../logo';
|
|
@@ -31,6 +32,15 @@ const avatarProfiles = {
|
|
|
31
32
|
Profile: <Person size="24" />,
|
|
32
33
|
};
|
|
33
34
|
|
|
35
|
+
export const Sandbox = createSandboxStory({
|
|
36
|
+
code: `<OverlayHeader
|
|
37
|
+
avatar={<AvatarView profileType={ProfileType.BUSINESS} />}
|
|
38
|
+
logo={<Logo />}
|
|
39
|
+
onClose={() => console.log('Close clicked')}
|
|
40
|
+
/>`,
|
|
41
|
+
scope: globalScope,
|
|
42
|
+
});
|
|
43
|
+
|
|
34
44
|
export const Basic: StoryObj<StoryArgs> = {
|
|
35
45
|
render: (args) => (
|
|
36
46
|
<OverlayHeader
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import type { Meta, StoryObj } 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
|
import PhoneNumberInput from './PhoneNumberInput';
|
|
5
9
|
|
|
@@ -12,6 +16,25 @@ 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('+447573135343');
|
|
22
|
+
|
|
23
|
+
return (
|
|
24
|
+
<Field label="Phone number">
|
|
25
|
+
<PhoneNumberInput
|
|
26
|
+
initialValue="+447573135343"
|
|
27
|
+
size="md"
|
|
28
|
+
placeholder="Enter phone number"
|
|
29
|
+
searchPlaceholder="Search country"
|
|
30
|
+
onChange={console.log}
|
|
31
|
+
/>
|
|
32
|
+
</Field>
|
|
33
|
+
);
|
|
34
|
+
};`,
|
|
35
|
+
scope: globalScope,
|
|
36
|
+
});
|
|
37
|
+
|
|
15
38
|
export const Basic = {
|
|
16
39
|
args: {
|
|
17
40
|
searchPlaceholder: 'searchPlaceholder',
|
|
@@ -5,6 +5,7 @@ import { Position } from '../common';
|
|
|
5
5
|
|
|
6
6
|
import Popover from './Popover';
|
|
7
7
|
import { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
8
|
+
import { createSandboxStory, globalScope } from '../../.storybook/components/sandbox/SandboxEditor';
|
|
8
9
|
|
|
9
10
|
type Story = StoryObj<typeof Popover>;
|
|
10
11
|
|
|
@@ -44,6 +45,17 @@ export default {
|
|
|
44
45
|
},
|
|
45
46
|
} satisfies Meta<typeof Popover>;
|
|
46
47
|
|
|
48
|
+
export const Sandbox = createSandboxStory({
|
|
49
|
+
code: `<Popover
|
|
50
|
+
content="You'll get this rate as long as we receive your 10 EUR within the next 51 hours."
|
|
51
|
+
preferredPlacement="bottom"
|
|
52
|
+
title="Guaranteed rate"
|
|
53
|
+
>
|
|
54
|
+
<Button v2 size="md">Click here to Open Popover!</Button>
|
|
55
|
+
</Popover>`,
|
|
56
|
+
scope: globalScope,
|
|
57
|
+
});
|
|
58
|
+
|
|
47
59
|
export const Basic: Story = {};
|
|
48
60
|
|
|
49
61
|
/**
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
2
2
|
import { fn } from 'storybook/test';
|
|
3
|
+
import {
|
|
4
|
+
createSandboxStory,
|
|
5
|
+
globalScope,
|
|
6
|
+
} from '../../../../.storybook/components/sandbox/SandboxEditor';
|
|
3
7
|
import PrimitiveAnchor from '..';
|
|
4
8
|
|
|
5
9
|
const meta: Meta<typeof PrimitiveAnchor> = {
|
|
@@ -21,6 +25,13 @@ export default meta;
|
|
|
21
25
|
|
|
22
26
|
type Story = StoryObj<typeof PrimitiveAnchor>;
|
|
23
27
|
|
|
28
|
+
export const Sandbox = createSandboxStory({
|
|
29
|
+
code: `<PrimitiveAnchor href="https://example.com" target="_blank">
|
|
30
|
+
Click me
|
|
31
|
+
</PrimitiveAnchor>`,
|
|
32
|
+
scope: { ...globalScope, PrimitiveAnchor },
|
|
33
|
+
});
|
|
34
|
+
|
|
24
35
|
export const Basic: Story = {};
|
|
25
36
|
|
|
26
37
|
export const WithLongName: Story = {
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
2
2
|
import { fn } from 'storybook/test';
|
|
3
|
+
import {
|
|
4
|
+
createSandboxStory,
|
|
5
|
+
globalScope,
|
|
6
|
+
} from '../../../../.storybook/components/sandbox/SandboxEditor';
|
|
3
7
|
import PrimitiveButton from '..';
|
|
4
8
|
|
|
5
9
|
const meta: Meta<typeof PrimitiveButton> = {
|
|
@@ -20,6 +24,13 @@ export default meta;
|
|
|
20
24
|
|
|
21
25
|
type Story = StoryObj<typeof PrimitiveButton>;
|
|
22
26
|
|
|
27
|
+
export const Sandbox = createSandboxStory({
|
|
28
|
+
code: `<PrimitiveButton onClick={() => console.log('clicked')}>
|
|
29
|
+
Button text
|
|
30
|
+
</PrimitiveButton>`,
|
|
31
|
+
scope: { ...globalScope, PrimitiveButton },
|
|
32
|
+
});
|
|
33
|
+
|
|
23
34
|
export const Basic: Story = {};
|
|
24
35
|
|
|
25
36
|
export const WithLongName: Story = {
|
|
@@ -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 { Size, Status } from '../common';
|
|
4
5
|
|
|
@@ -11,6 +12,15 @@ export default {
|
|
|
11
12
|
|
|
12
13
|
type Story = StoryObj<typeof ProcessIndicator>;
|
|
13
14
|
|
|
15
|
+
export const Sandbox = createSandboxStory({
|
|
16
|
+
code: `<ProcessIndicator
|
|
17
|
+
status={Status.PROCESSING}
|
|
18
|
+
size={Size.EXTRA_SMALL}
|
|
19
|
+
onAnimationCompleted={(status) => console.log(status)}
|
|
20
|
+
/>`,
|
|
21
|
+
scope: { ProcessIndicator },
|
|
22
|
+
});
|
|
23
|
+
|
|
14
24
|
export const Basic: Story = {
|
|
15
25
|
args: {
|
|
16
26
|
size: Size.EXTRA_SMALL,
|
|
@@ -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 Progress from './Progress';
|
|
4
5
|
|
|
@@ -9,6 +10,11 @@ export default {
|
|
|
9
10
|
|
|
10
11
|
type Story = StoryObj<typeof Progress>;
|
|
11
12
|
|
|
13
|
+
export const Sandbox = createSandboxStory({
|
|
14
|
+
code: `<Progress progress={{ value: 50, max: 100 }} />`,
|
|
15
|
+
scope: { Progress },
|
|
16
|
+
});
|
|
17
|
+
|
|
12
18
|
export const Basic: Story = {
|
|
13
19
|
args: {
|
|
14
20
|
progress: { value: 50, max: 100 },
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
2
|
+
import { createSandboxStory, globalScope } from '../../.storybook/components/sandbox/SandboxEditor';
|
|
2
3
|
|
|
3
4
|
import ProgressBar from './ProgressBar';
|
|
4
5
|
import Info from '../info';
|
|
@@ -10,6 +11,17 @@ export default {
|
|
|
10
11
|
|
|
11
12
|
type Story = StoryObj<typeof ProgressBar>;
|
|
12
13
|
|
|
14
|
+
export const Sandbox = createSandboxStory({
|
|
15
|
+
code: `<ProgressBar
|
|
16
|
+
title="Send 5,550 GBP"
|
|
17
|
+
description="You have 3 days to reach your goal."
|
|
18
|
+
id="progress-bar-sandbox"
|
|
19
|
+
progress={{ value: 50, max: 100 }}
|
|
20
|
+
textEnd="200 GBP to go"
|
|
21
|
+
/>`,
|
|
22
|
+
scope: globalScope,
|
|
23
|
+
});
|
|
24
|
+
|
|
13
25
|
export const Basic: Story = {
|
|
14
26
|
args: {
|
|
15
27
|
description: 'You have 3 days to reach your goal.',
|
|
@@ -2,6 +2,10 @@ import type { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
|
2
2
|
import { StarFill } from '@transferwise/icons';
|
|
3
3
|
|
|
4
4
|
import PromoCard, { type PromoCardCheckedProps, type PromoCardLinkProps } from './PromoCard';
|
|
5
|
+
import {
|
|
6
|
+
createSandboxStory,
|
|
7
|
+
globalScope,
|
|
8
|
+
} from '../../.storybook/components/sandbox/SandboxEditor';
|
|
5
9
|
|
|
6
10
|
const meta: Meta<typeof PromoCard> = {
|
|
7
11
|
component: PromoCard,
|
|
@@ -15,6 +19,17 @@ const meta: Meta<typeof PromoCard> = {
|
|
|
15
19
|
export default meta;
|
|
16
20
|
type Story = StoryObj<typeof PromoCard>;
|
|
17
21
|
|
|
22
|
+
export const Sandbox = createSandboxStory({
|
|
23
|
+
code: `<PromoCard
|
|
24
|
+
title="Digital"
|
|
25
|
+
description="A card that lives online and works anywhere. Easy, secure, and always on hand."
|
|
26
|
+
indicatorLabel="Free"
|
|
27
|
+
imageSource="https://wise.com/web-art/assets/illustrations/digital-card-2-medium@2x.webp"
|
|
28
|
+
href="#"
|
|
29
|
+
/>`,
|
|
30
|
+
scope: globalScope,
|
|
31
|
+
});
|
|
32
|
+
|
|
18
33
|
export const Default: Story = {
|
|
19
34
|
args: {
|
|
20
35
|
description: 'A card that lives online and works anywhere. Easy, secure, and always on hand.',
|
|
@@ -2,6 +2,10 @@ import { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
|
2
2
|
|
|
3
3
|
import PromoCard from './PromoCard';
|
|
4
4
|
import PromoCardGroup from './PromoCardGroup';
|
|
5
|
+
import {
|
|
6
|
+
createSandboxStory,
|
|
7
|
+
globalScope,
|
|
8
|
+
} from '../../.storybook/components/sandbox/SandboxEditor';
|
|
5
9
|
|
|
6
10
|
const PromoCards = () => {
|
|
7
11
|
return (
|
|
@@ -48,6 +52,30 @@ const meta: Meta<typeof PromoCardGroup> = {
|
|
|
48
52
|
export default meta;
|
|
49
53
|
type Story = StoryObj<typeof PromoCardGroup>;
|
|
50
54
|
|
|
55
|
+
export const Sandbox = createSandboxStory({
|
|
56
|
+
code: `<PromoCardGroup name="card-selection">
|
|
57
|
+
<PromoCard
|
|
58
|
+
title="Digital"
|
|
59
|
+
description="A card that lives online and works anywhere."
|
|
60
|
+
type="radio"
|
|
61
|
+
value="digital"
|
|
62
|
+
id="digital"
|
|
63
|
+
indicatorLabel="Free"
|
|
64
|
+
imageSource="https://wise.com/web-art/assets/illustrations/digital-card-2-medium@2x.webp"
|
|
65
|
+
/>
|
|
66
|
+
<PromoCard
|
|
67
|
+
title="Standard"
|
|
68
|
+
description="Spend and withdraw money around the world."
|
|
69
|
+
type="radio"
|
|
70
|
+
value="standard"
|
|
71
|
+
id="standard"
|
|
72
|
+
indicatorLabel="7 GBP"
|
|
73
|
+
imageSource="https://wise.com/web-art/assets/illustrations/personal-card-medium@2x.webp"
|
|
74
|
+
/>
|
|
75
|
+
</PromoCardGroup>`,
|
|
76
|
+
scope: globalScope,
|
|
77
|
+
});
|
|
78
|
+
|
|
51
79
|
export const Default: Story = {
|
|
52
80
|
args: {
|
|
53
81
|
children: <PromoCards />,
|
|
@@ -2,6 +2,10 @@ import { ReactElement, useState } from 'react';
|
|
|
2
2
|
import { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
3
3
|
import { fn } from 'storybook/test';
|
|
4
4
|
import { Bank, Star, Suitcase, Briefcase } from '@transferwise/icons';
|
|
5
|
+
import {
|
|
6
|
+
createSandboxStory,
|
|
7
|
+
globalScope,
|
|
8
|
+
} from '../../../.storybook/components/sandbox/SandboxEditor';
|
|
5
9
|
import { lorem10, lorem20 } from '../../test-utils';
|
|
6
10
|
import Button from '../../button';
|
|
7
11
|
import Title from '../../title';
|
|
@@ -186,6 +190,33 @@ export const Playground: StoryObj<PreviewStoryArgs> = {
|
|
|
186
190
|
},
|
|
187
191
|
};
|
|
188
192
|
|
|
193
|
+
export const Sandbox = createSandboxStory({
|
|
194
|
+
code: `const App = () => {
|
|
195
|
+
const [dismissed, setDismissed] = React.useState(false);
|
|
196
|
+
|
|
197
|
+
if (dismissed) {
|
|
198
|
+
return (
|
|
199
|
+
<Button v2 size="md" onClick={() => setDismissed(false)}>
|
|
200
|
+
Show prompt again
|
|
201
|
+
</Button>
|
|
202
|
+
);
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
return (
|
|
206
|
+
<ActionPrompt
|
|
207
|
+
sentiment="neutral"
|
|
208
|
+
title="Action Required"
|
|
209
|
+
description="Please complete the following action to continue."
|
|
210
|
+
media={{ avatar: { asset: <Bank /> } }}
|
|
211
|
+
action={{ label: 'Continue', onClick: () => console.log('action clicked') }}
|
|
212
|
+
actionSecondary={{ label: 'Cancel', onClick: () => console.log('cancel clicked') }}
|
|
213
|
+
onDismiss={() => setDismissed(true)}
|
|
214
|
+
/>
|
|
215
|
+
);
|
|
216
|
+
};`,
|
|
217
|
+
scope: globalScope,
|
|
218
|
+
});
|
|
219
|
+
|
|
189
220
|
/**
|
|
190
221
|
* ActionPrompt supports multiple sentiments to communicate different types of messages:
|
|
191
222
|
* - `neutral` (default): General prompts
|
|
@@ -64,6 +64,15 @@ Screen readers announce the banner content whenever:
|
|
|
64
64
|
- The user toggles between collapsed and expanded states
|
|
65
65
|
- The content (title, description, or action labels) changes
|
|
66
66
|
|
|
67
|
+
## Reduced Motion
|
|
68
|
+
|
|
69
|
+
`CriticalBanner` respects the user's reduced motion preference. When reduced motion is on, the component does not show:
|
|
70
|
+
|
|
71
|
+
- the entry animation that reveals the banner from above when it first appears
|
|
72
|
+
- the collapse and expand animation used when the user toggles the banner content
|
|
73
|
+
|
|
74
|
+
The same content is still rendered and announced. Reduced motion only removes the visual movement.
|
|
75
|
+
|
|
67
76
|
## Media
|
|
68
77
|
|
|
69
78
|
Custom media icons should include their own accessibility attributes. Use the `title` prop on icons to provide accessible names for screen readers:
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
.wds-critical-banner {
|
|
2
|
-
--Prompt-padding: var(--
|
|
2
|
+
--Prompt-padding-x: var(--wds-container-padding-inline);
|
|
3
|
+
--Prompt-padding-y: var(--size-16);
|
|
3
4
|
--Prompt-actions-gap: var(--size-8);
|
|
4
5
|
--Prompt-gap: var(--size-10) var(--size-16);
|
|
5
6
|
--Prompt-border-radius: 0;
|
|
6
7
|
container-type: inline-size;
|
|
8
|
+
position: relative;
|
|
7
9
|
--critical-banner-easing: cubic-bezier(0.9, 0, 0.7, 1);
|
|
8
10
|
--critical-banner-duration: 150ms;
|
|
9
11
|
/* Override PrimitivePrompt's --screen-sm-max actions behaviour:
|
|
@@ -124,6 +126,48 @@
|
|
|
124
126
|
min-width: fit-content;
|
|
125
127
|
}
|
|
126
128
|
}
|
|
129
|
+
.wds-critical-banner-overhang-query {
|
|
130
|
+
container-name: critical-banner-overhang;
|
|
131
|
+
container-type: inline-size;
|
|
132
|
+
inline-size: 100%;
|
|
133
|
+
}
|
|
134
|
+
.wds-critical-banner__entry-mask {
|
|
135
|
+
display: grid;
|
|
136
|
+
grid-template-rows: 0fr;
|
|
137
|
+
overflow: hidden;
|
|
138
|
+
animation: wds-critical-banner-reveal-height 400ms cubic-bezier(0.3, 0, 0.1, 1) 500ms both;
|
|
139
|
+
}
|
|
140
|
+
@container critical-banner-overhang (max-width: 600px) {
|
|
141
|
+
.wds-critical-banner__entry-mask {
|
|
142
|
+
--critical-banner-mobile-overhang-size: 32px;
|
|
143
|
+
}
|
|
144
|
+
.wds-critical-banner__entry-mask .wds-critical-banner-overhang {
|
|
145
|
+
margin-bottom: var(--critical-banner-mobile-overhang-size);
|
|
146
|
+
}
|
|
147
|
+
.wds-critical-banner__entry-mask .wds-critical-banner-overhang::after {
|
|
148
|
+
content: "";
|
|
149
|
+
position: absolute;
|
|
150
|
+
right: 0;
|
|
151
|
+
bottom: calc(-1 * var(--critical-banner-mobile-overhang-size));
|
|
152
|
+
left: 0;
|
|
153
|
+
height: var(--critical-banner-mobile-overhang-size);
|
|
154
|
+
pointer-events: none;
|
|
155
|
+
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;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
.wds-critical-banner__entry-track {
|
|
159
|
+
min-height: 0;
|
|
160
|
+
}
|
|
161
|
+
@keyframes wds-critical-banner-reveal-height {
|
|
162
|
+
from {
|
|
163
|
+
grid-template-rows: 0fr;
|
|
164
|
+
overflow: hidden;
|
|
165
|
+
}
|
|
166
|
+
to {
|
|
167
|
+
grid-template-rows: 1fr;
|
|
168
|
+
overflow: visible;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
127
171
|
@media (prefers-reduced-motion: reduce) {
|
|
128
172
|
.wds-critical-banner__description,
|
|
129
173
|
.wds-critical-banner__title,
|
|
@@ -131,4 +175,9 @@
|
|
|
131
175
|
.wds-critical-banner__toggle {
|
|
132
176
|
transition: none !important;
|
|
133
177
|
}
|
|
178
|
+
.wds-critical-banner__entry-mask {
|
|
179
|
+
animation: none;
|
|
180
|
+
grid-template-rows: 1fr;
|
|
181
|
+
overflow: visible;
|
|
182
|
+
}
|
|
134
183
|
}
|
|
@@ -2,11 +2,13 @@
|
|
|
2
2
|
@import (reference) "./CriticalBanner.vars.less";
|
|
3
3
|
|
|
4
4
|
.wds-critical-banner {
|
|
5
|
-
--Prompt-padding: var(--
|
|
5
|
+
--Prompt-padding-x: var(--wds-container-padding-inline);
|
|
6
|
+
--Prompt-padding-y: var(--size-16);
|
|
6
7
|
--Prompt-actions-gap: var(--size-8);
|
|
7
8
|
--Prompt-gap: var(--size-10) var(--size-16);
|
|
8
9
|
--Prompt-border-radius: 0;
|
|
9
10
|
container-type: inline-size;
|
|
11
|
+
position: relative;
|
|
10
12
|
|
|
11
13
|
// Animation variables
|
|
12
14
|
--critical-banner-easing: cubic-bezier(0.9, 0, 0.7, 1);
|
|
@@ -144,6 +146,71 @@
|
|
|
144
146
|
}
|
|
145
147
|
}
|
|
146
148
|
|
|
149
|
+
// Entry animation: after a 500ms delay, reveal the already-positioned banner
|
|
150
|
+
// over 400ms. The mask clips only during the reveal, then becomes visible so the
|
|
151
|
+
// overhang and actions are not clipped after the animation.
|
|
152
|
+
.wds-critical-banner-overhang-query {
|
|
153
|
+
container-name: critical-banner-overhang;
|
|
154
|
+
container-type: inline-size;
|
|
155
|
+
inline-size: 100%;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
.wds-critical-banner__entry-mask {
|
|
159
|
+
display: grid;
|
|
160
|
+
grid-template-rows: 0fr;
|
|
161
|
+
overflow: hidden;
|
|
162
|
+
animation: wds-critical-banner-reveal-height 400ms cubic-bezier(0.3, 0, 0.1, 1) 500ms both;
|
|
163
|
+
|
|
164
|
+
@container critical-banner-overhang (max-width: @wds-critical-banner-mobile-overhang-max) {
|
|
165
|
+
--critical-banner-mobile-overhang-size: 32px;
|
|
166
|
+
|
|
167
|
+
.wds-critical-banner-overhang {
|
|
168
|
+
margin-bottom: var(--critical-banner-mobile-overhang-size);
|
|
169
|
+
|
|
170
|
+
&::after {
|
|
171
|
+
content: "";
|
|
172
|
+
position: absolute;
|
|
173
|
+
right: 0;
|
|
174
|
+
bottom: calc(-1 * var(--critical-banner-mobile-overhang-size));
|
|
175
|
+
left: 0;
|
|
176
|
+
height: var(--critical-banner-mobile-overhang-size);
|
|
177
|
+
pointer-events: none;
|
|
178
|
+
background:
|
|
179
|
+
radial-gradient(
|
|
180
|
+
circle at 100% 100%,
|
|
181
|
+
transparent var(--critical-banner-mobile-overhang-size),
|
|
182
|
+
var(--color-sentiment-background-surface) var(--critical-banner-mobile-overhang-size)
|
|
183
|
+
)
|
|
184
|
+
0 0 / var(--critical-banner-mobile-overhang-size)
|
|
185
|
+
var(--critical-banner-mobile-overhang-size) no-repeat,
|
|
186
|
+
radial-gradient(
|
|
187
|
+
circle at 0% 100%,
|
|
188
|
+
transparent var(--critical-banner-mobile-overhang-size),
|
|
189
|
+
var(--color-sentiment-background-surface) var(--critical-banner-mobile-overhang-size)
|
|
190
|
+
)
|
|
191
|
+
100% 0 / var(--critical-banner-mobile-overhang-size)
|
|
192
|
+
var(--critical-banner-mobile-overhang-size) no-repeat;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
.wds-critical-banner__entry-track {
|
|
199
|
+
min-height: 0;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
@keyframes wds-critical-banner-reveal-height {
|
|
203
|
+
from {
|
|
204
|
+
grid-template-rows: 0fr;
|
|
205
|
+
overflow: hidden;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
to {
|
|
209
|
+
grid-template-rows: 1fr;
|
|
210
|
+
overflow: visible;
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
|
|
147
214
|
// Reduced motion support
|
|
148
215
|
@media (prefers-reduced-motion: reduce) {
|
|
149
216
|
.wds-critical-banner__description,
|
|
@@ -152,4 +219,10 @@
|
|
|
152
219
|
.wds-critical-banner__toggle {
|
|
153
220
|
transition: none !important;
|
|
154
221
|
}
|
|
222
|
+
|
|
223
|
+
.wds-critical-banner__entry-mask {
|
|
224
|
+
animation: none;
|
|
225
|
+
grid-template-rows: 1fr;
|
|
226
|
+
overflow: visible;
|
|
227
|
+
}
|
|
155
228
|
}
|