@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.
Files changed (101) hide show
  1. package/build/main.css +53 -0
  2. package/build/prompt/CriticalBanner/CriticalBanner.js +78 -68
  3. package/build/prompt/CriticalBanner/CriticalBanner.js.map +1 -1
  4. package/build/prompt/CriticalBanner/CriticalBanner.mjs +79 -69
  5. package/build/prompt/CriticalBanner/CriticalBanner.mjs.map +1 -1
  6. package/build/styles/main.css +53 -0
  7. package/build/styles/prompt/CriticalBanner/CriticalBanner.css +48 -0
  8. package/build/types/prompt/CriticalBanner/CriticalBanner.d.ts.map +1 -1
  9. package/package.json +1 -1
  10. package/src/accordion/Accordion.story.tsx +25 -0
  11. package/src/avatarLayout/AvatarLayout.story.tsx +10 -0
  12. package/src/avatarView/AvatarView.story.tsx +8 -0
  13. package/src/body/Body.story.tsx +12 -0
  14. package/src/button/_stories/Button.story.tsx +7 -1
  15. package/src/calendar/Calendar.story.tsx +19 -7
  16. package/src/carousel/Carousel.story.tsx +35 -0
  17. package/src/checkbox/Checkbox.story.tsx +20 -0
  18. package/src/checkboxButton/CheckboxButton.story.tsx +16 -0
  19. package/src/chevron/Chevron.story.tsx +6 -0
  20. package/src/chips/Chips.story.tsx +23 -0
  21. package/src/circularButton/CircularButton.story.tsx +13 -0
  22. package/src/common/baseCard/BaseCard.story.tsx +12 -0
  23. package/src/common/bottomSheet/BottomSheet.story.tsx +21 -0
  24. package/src/common/circle/Circle.story.tsx +11 -0
  25. package/src/container/Container.story.tsx +12 -0
  26. package/src/dateInput/DateInput.story.tsx +20 -0
  27. package/src/dateLookup/DateLookup.story.tsx +23 -0
  28. package/src/decision/Decision.story.tsx +36 -0
  29. package/src/definitionList/DefinitionList.story.tsx +16 -0
  30. package/src/dimmer/Dimmer.story.tsx +24 -0
  31. package/src/display/Display.story.tsx +11 -0
  32. package/src/divider/Divider.story.tsx +6 -0
  33. package/src/drawer/Drawer.story.tsx +25 -0
  34. package/src/dropFade/DropFade.story.tsx +27 -0
  35. package/src/emphasis/Emphasis.story.tsx +10 -0
  36. package/src/expressiveMoneyInput/ExpressiveMoneyInput.story.tsx +37 -0
  37. package/src/field/Field.story.tsx +16 -0
  38. package/src/flowNavigation/FlowNavigation.story.tsx +25 -0
  39. package/src/header/Header.story.tsx +17 -0
  40. package/src/iconButton/IconButton.story.tsx +14 -0
  41. package/src/image/Image.story.tsx +11 -0
  42. package/src/info/Info.story.tsx +10 -0
  43. package/src/inputWithDisplayFormat/InputWithDisplayFormat.story.tsx +23 -0
  44. package/src/inputs/InputGroup.story.tsx +37 -0
  45. package/src/inputs/SearchInput.story.tsx +22 -0
  46. package/src/inputs/SelectInput/_stories/SelectInput.story.tsx +42 -0
  47. package/src/inputs/TextArea.story.tsx +22 -0
  48. package/src/instructionsList/InstructionsList.story.tsx +19 -0
  49. package/src/label/Label.story.tsx +17 -0
  50. package/src/link/Link.story.tsx +11 -0
  51. package/src/list/List.story.tsx +19 -0
  52. package/src/listItem/_stories/ListItem.story.tsx +20 -0
  53. package/src/loader/Loader.story.tsx +6 -0
  54. package/src/logo/Logo.story.tsx +6 -0
  55. package/src/main.css +53 -0
  56. package/src/markdown/Markdown.story.tsx +17 -0
  57. package/src/modal/Modal.story.tsx +23 -0
  58. package/src/money/Money.story.tsx +7 -0
  59. package/src/moneyInput/MoneyInput.story.tsx +34 -0
  60. package/src/nudge/Nudge.story.tsx +17 -0
  61. package/src/overlayHeader/OverlayHeader.story.tsx +10 -0
  62. package/src/phoneNumberInput/PhoneNumberInput.story.tsx +23 -0
  63. package/src/popover/Popover.story.tsx +12 -0
  64. package/src/primitives/PrimitiveAnchor/stories/PrimitiveAnchor.story.tsx +11 -0
  65. package/src/primitives/PrimitiveButton/stories/PrimitiveButton.story.tsx +11 -0
  66. package/src/processIndicator/ProcessIndicator.story.tsx +10 -0
  67. package/src/progress/Progress.story.tsx +6 -0
  68. package/src/progressBar/ProgressBar.story.tsx +12 -0
  69. package/src/promoCard/PromoCard.story.tsx +15 -0
  70. package/src/promoCard/PromoCardGroup.story.tsx +28 -0
  71. package/src/prompt/ActionPrompt/ActionPrompt.story.tsx +31 -0
  72. package/src/prompt/CriticalBanner/CriticalBanner.accessibility.docs.mdx +9 -0
  73. package/src/prompt/CriticalBanner/CriticalBanner.css +48 -0
  74. package/src/prompt/CriticalBanner/CriticalBanner.less +72 -0
  75. package/src/prompt/CriticalBanner/CriticalBanner.story.tsx +180 -169
  76. package/src/prompt/CriticalBanner/CriticalBanner.test.story.tsx +25 -6
  77. package/src/prompt/CriticalBanner/CriticalBanner.test.tsx +37 -0
  78. package/src/prompt/CriticalBanner/CriticalBanner.tsx +92 -83
  79. package/src/prompt/CriticalBanner/CriticalBanner.vars.less +1 -0
  80. package/src/prompt/InfoPrompt/InfoPrompt.story.tsx +30 -0
  81. package/src/prompt/InlinePrompt/InlinePrompt.story.tsx +14 -0
  82. package/src/radio/Radio.story.tsx +34 -0
  83. package/src/radioGroup/RadioGroup.story.tsx +26 -0
  84. package/src/section/Section.story.tsx +15 -0
  85. package/src/segmentedControl/SegmentedControl.story.tsx +27 -0
  86. package/src/sentimentSurface/SentimentSurface.story.tsx +11 -0
  87. package/src/slidingPanel/SlidingPanel.story.tsx +19 -0
  88. package/src/snackbar/Snackbar.story.tsx +24 -0
  89. package/src/statusIcon/StatusIcon.story.tsx +6 -0
  90. package/src/stepper/Stepper.story.tsx +30 -0
  91. package/src/sticky/Sticky.story.tsx +22 -1
  92. package/src/switch/Switch.story.tsx +17 -0
  93. package/src/table/Table.story.tsx +32 -0
  94. package/src/tabs/Tabs.story.tsx +31 -0
  95. package/src/textareaWithDisplayFormat/TextareaWithDisplayFormat.story.tsx +23 -0
  96. package/src/tile/Tile.story.tsx +13 -0
  97. package/src/title/Title.story.tsx +12 -0
  98. package/src/tooltip/Tooltip.story.tsx +8 -0
  99. package/src/typeahead/Typeahead.story.tsx +33 -0
  100. package/src/upload/Upload.story.tsx +24 -0
  101. package/src/uploadInput/UploadInput.story.tsx +31 -0
@@ -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
  <>
@@ -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
  <>
@@ -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 = {};
@@ -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
@@ -31935,6 +31935,7 @@ html:not([dir="rtl"]) .np-navigation-option {
31935
31935
  --Prompt-gap: var(--size-10) var(--size-16);
31936
31936
  --Prompt-border-radius: 0;
31937
31937
  container-type: inline-size;
31938
+ position: relative;
31938
31939
  --critical-banner-easing: cubic-bezier(0.9, 0, 0.7, 1);
31939
31940
  --critical-banner-duration: 150ms;
31940
31941
  /* Override PrimitivePrompt's --screen-sm-max actions behaviour:
@@ -32075,6 +32076,53 @@ html:not([dir="rtl"]) .np-navigation-option {
32075
32076
  }
32076
32077
  }
32077
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
+
32078
32126
  @media (prefers-reduced-motion: reduce) {
32079
32127
  .wds-critical-banner__description,
32080
32128
  .wds-critical-banner__title,
@@ -32082,6 +32130,11 @@ html:not([dir="rtl"]) .np-navigation-option {
32082
32130
  .wds-critical-banner__toggle {
32083
32131
  transition: none !important;
32084
32132
  }
32133
+ .wds-critical-banner__entry-mask {
32134
+ animation: none;
32135
+ grid-template-rows: 1fr;
32136
+ overflow: visible;
32137
+ }
32085
32138
  }
32086
32139
 
32087
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',
@@ -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 />,