@transferwise/components 0.0.0-experimental-99bbbb3 → 0.0.0-experimental-20085a3

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 (88) hide show
  1. package/build/i18n/id.json +0 -5
  2. package/build/i18n/id.json.js +0 -5
  3. package/build/i18n/id.json.js.map +1 -1
  4. package/build/i18n/id.json.mjs +0 -5
  5. package/build/i18n/id.json.mjs.map +1 -1
  6. package/build/types/Body/Body.d.ts +2 -2
  7. package/build/types/IconButton/IconButton.d.ts +1 -1
  8. package/build/types/ListItem/_stories/variants/helpers.d.ts.map +1 -1
  9. package/build/types/MoneyInput/MoneyInput.d.ts +1 -1
  10. package/build/types/MoneyInput/MoneyInput.d.ts.map +1 -1
  11. package/build/types/Title/Title.d.ts +2 -2
  12. package/build/types/Upload/Steps/UploadImageStep/UploadImageStep.d.ts +1 -1
  13. package/build/types/UploadInput/UploadItem/UploadItemLink.d.ts +1 -1
  14. package/package.json +1 -1
  15. package/src/Accordion/_stories/Accordion.rtl.test.story.tsx +71 -0
  16. package/src/AvatarLayout/_stories/AvatarLayout.rtl.test.story.tsx +77 -0
  17. package/src/AvatarView/_stories/AvatarView.rtl.test.story.tsx +162 -0
  18. package/src/Button/LegacyButton/_stories/LegacyButton.rtl.test.story.tsx +32 -0
  19. package/src/Button/_stories/Button.rtl.test.story.tsx +87 -0
  20. package/src/Calendar/_stories/Calendar.rtl.test.story.tsx +52 -0
  21. package/src/Calendar/_stories/Calendar.test.story.tsx +28 -24
  22. package/src/Carousel/_stories/Carousel.rtl.test.story.tsx +61 -0
  23. package/src/Checkbox/_stories/Checkbox.rtl.test.story.tsx +31 -0
  24. package/src/CheckboxButton/_stories/CheckboxButton.rtl.test.story.tsx +27 -0
  25. package/src/CheckboxButton/_stories/CheckboxButton.test.story.tsx +0 -37
  26. package/src/Chevron/_stories/Chevron.rtl.test.story.tsx +26 -0
  27. package/src/Chips/_stories/Chips.rtl.test.story.tsx +49 -0
  28. package/src/Chips/_stories/Chips.test.story.tsx +0 -34
  29. package/src/CircularButton/_stories/CircularButton.test.story.tsx +0 -68
  30. package/src/DateInput/_stories/DateInput.rtl.test.story.tsx +25 -0
  31. package/src/DateLookup/_stories/DateLookup.rtl.test.story.tsx +88 -0
  32. package/src/Decision/_stories/Decision.rtl.test.story.tsx +79 -0
  33. package/src/DefinitionList/_stories/DefinitionList.rtl.test.story.tsx +63 -0
  34. package/src/Drawer/_stories/Drawer.rtl.test.story.tsx +58 -0
  35. package/src/ExpressiveMoneyInput/_stories/ExpressiveMoneyInput.rtl.test.story.tsx +118 -0
  36. package/src/Field/_stories/Field.rtl.test.story.tsx +58 -0
  37. package/src/FlowNavigation/_stories/FlowNavigation.rtl.test.story.tsx +70 -0
  38. package/src/Header/_stories/Header.rtl.test.story.tsx +37 -0
  39. package/src/Info/_stories/Info.rtl.test.story.tsx +64 -0
  40. package/src/Inputs/SelectInput/_stories/SelectInput.rtl.test.story.tsx +135 -0
  41. package/src/Inputs/_stories/InputGroup.rtl.test.story.tsx +69 -0
  42. package/src/Inputs/_stories/SearchInput.rtl.test.story.tsx +32 -0
  43. package/src/Inputs/_stories/TextArea.rtl.test.story.tsx +38 -0
  44. package/src/InstructionsList/_stories/InstructionsList.rtl.test.story.tsx +30 -0
  45. package/src/Label/_stories/Label.rtl.test.story.tsx +36 -0
  46. package/src/Link/_stories/Link.rtl.test.story.tsx +26 -0
  47. package/src/ListItem/_stories/{variants/ListItem.rtl.test.story.tsx → ListItem.rtl.test.story.tsx} +6 -10
  48. package/src/ListItem/_stories/variants/helpers.tsx +2 -6
  49. package/src/Logo/_stories/Logo.rtl.test.story.tsx +56 -0
  50. package/src/Modal/_stories/Modal.rtl.test.story.tsx +59 -0
  51. package/src/MoneyInput/_stories/MoneyInput.rtl.test.story.tsx +88 -0
  52. package/src/Nudge/_stories/Nudge.rtl.test.story.tsx +37 -0
  53. package/src/PhoneNumberInput/_stories/PhoneNumberInput.rtl.test.story.tsx +44 -0
  54. package/src/Popover/_stories/Popover.rtl.test.story.tsx +96 -0
  55. package/src/Progress/_stories/Progress.rtl.test.story.tsx +27 -0
  56. package/src/ProgressBar/_stories/ProgressBar.rtl.test.story.tsx +33 -0
  57. package/src/PromoCard/_stories/PromoCard.rtl.test.story.tsx +42 -0
  58. package/src/PromoCard/_stories/PromoCardGroup.rtl.test.story.tsx +51 -0
  59. package/src/Prompt/ActionPrompt/_stories/ActionPrompt.rtl.test.story.tsx +53 -0
  60. package/src/Prompt/CriticalBanner/_stories/CriticalBanner.rtl.test.story.tsx +46 -0
  61. package/src/Prompt/CriticalBanner/_stories/CriticalBanner.test.story.tsx +0 -30
  62. package/src/Prompt/InfoPrompt/_stories/InfoPrompt.rtl.test.story.tsx +36 -0
  63. package/src/Prompt/InlinePrompt/_stories/InlinePrompt.rtl.test.story.tsx +38 -0
  64. package/src/Radio/_stories/Radio.rtl.test.story.tsx +61 -0
  65. package/src/RadioGroup/_stories/RadioGroup.rtl.test.story.tsx +66 -0
  66. package/src/Section/_stories/Section.rtl.test.story.tsx +29 -0
  67. package/src/SegmentedControl/_stories/SegmentedControl.rtl.test.story.tsx +45 -0
  68. package/src/SlidingPanel/_stories/SlidingPanel.rtl.test.story.tsx +70 -0
  69. package/src/Snackbar/_stories/Snackbar.rtl.test.story.tsx +45 -0
  70. package/src/Snackbar/_stories/Snackbar.test.story.tsx +0 -31
  71. package/src/Stepper/_stories/Stepper.rtl.test.story.tsx +24 -0
  72. package/src/Switch/_stories/Switch.rtl.test.story.tsx +32 -0
  73. package/src/Switch/_stories/Switch.test.story.tsx +0 -26
  74. package/src/Table/_stories/Table.rtl.test.story.tsx +104 -0
  75. package/src/Tabs/_stories/Tabs.rtl.test.story.tsx +72 -0
  76. package/src/TextareaWithDisplayFormat/_stories/TextareaWithDisplayFormat.rtl.test.story.tsx +48 -0
  77. package/src/Tooltip/_stories/Tooltip.rtl.test.story.tsx +79 -0
  78. package/src/Typeahead/_stories/Typeahead.rtl.test.story.tsx +90 -0
  79. package/src/Upload/_stories/Upload.rtl.test.story.tsx +53 -0
  80. package/src/UploadInput/_stories/UploadInput.rtl.test.story.tsx +59 -0
  81. package/src/_deprecated/Alert/_stories/Alert.rtl.test.story.tsx +37 -0
  82. package/src/_deprecated/Card/_stories/Card.rtl.test.story.tsx +38 -0
  83. package/src/_deprecated/CriticalBanner/_stories/CriticalCommsBanner.rtl.test.story.tsx +28 -0
  84. package/src/_deprecated/InlineAlert/_stories/InlineAlert.rtl.test.story.tsx +26 -0
  85. package/src/_deprecated/OverlayHeader/_stories/OverlayHeader.rtl.test.story.tsx +42 -0
  86. package/src/_deprecated/Select/_stories/Select.rtl.test.story.tsx +71 -0
  87. package/src/common/BottomSheet/_stories/BottomSheet.rtl.test.story.tsx +39 -0
  88. package/src/i18n/id.json +0 -5
@@ -0,0 +1,32 @@
1
+ import type { Meta, StoryObj } from '@storybook/react-webpack5';
2
+
3
+ import { withRTLDiff } from '../../../.storybook/decorators/RtlDiffDecorator';
4
+ import { Size } from '../../common';
5
+ import { SearchInput } from '../SearchInput/SearchInput';
6
+
7
+ export default {
8
+ component: SearchInput,
9
+ title: 'Forms/SearchInput/Tests',
10
+ tags: ['!autodocs', '!manifest'],
11
+ } satisfies Meta<typeof SearchInput>;
12
+
13
+ type Story = StoryObj<typeof SearchInput>;
14
+
15
+ export const RTLDiff: Story = {
16
+ render: () => (
17
+ <>
18
+ {/* sm — search icon (addonStart) position flips to trailing side in RTL */}
19
+ <SearchInput size={Size.SMALL} shape="pill" placeholder="Search" />
20
+
21
+ {/* md — search icon (addonStart) position flips to trailing side in RTL */}
22
+ <SearchInput size={Size.MEDIUM} shape="pill" placeholder="Search" />
23
+
24
+ {/* sm rectangle — icon flip with rectangle shape */}
25
+ <SearchInput size={Size.SMALL} shape="rectangle" placeholder="Search" />
26
+
27
+ {/* md rectangle — icon flip with rectangle shape */}
28
+ <SearchInput size={Size.MEDIUM} shape="rectangle" placeholder="Search" />
29
+ </>
30
+ ),
31
+ ...withRTLDiff(),
32
+ };
@@ -0,0 +1,38 @@
1
+ import type { Meta, StoryObj } from '@storybook/react-webpack5';
2
+ import { withRTLDiff } from '../../../.storybook/decorators/RtlDiffDecorator';
3
+ import Field from '../../Field';
4
+ import { Sentiment } from '../../common';
5
+ import { TextArea } from '../TextArea/TextArea';
6
+
7
+ export default {
8
+ component: TextArea,
9
+ title: 'Forms/TextArea/Tests',
10
+ tags: ['!autodocs', '!manifest'],
11
+ } satisfies Meta<typeof TextArea>;
12
+
13
+ type Story = StoryObj<typeof TextArea>;
14
+
15
+ export const RTLDiff: Story = {
16
+ render: () => (
17
+ <>
18
+ <Field label="Message" required={false}>
19
+ <TextArea placeholder="Type something..." />
20
+ </Field>
21
+ <Field label="Message" required={false}>
22
+ <TextArea value="This is some entered text content in the textarea field." readOnly />
23
+ </Field>
24
+ <Field
25
+ label="Message"
26
+ required={false}
27
+ sentiment={Sentiment.NEGATIVE}
28
+ message="This field has an error message"
29
+ >
30
+ <TextArea value="Invalid input text" readOnly />
31
+ </Field>
32
+ <Field label="Message with character count" required={false}>
33
+ <TextArea maxLength={200} value="Text with a character counter displayed below." readOnly />
34
+ </Field>
35
+ </>
36
+ ),
37
+ ...withRTLDiff(),
38
+ };
@@ -0,0 +1,30 @@
1
+ import type { Meta, StoryObj } from '@storybook/react-webpack5';
2
+
3
+ import { withRTLDiff } from '../../../.storybook/decorators/RtlDiffDecorator';
4
+ import InstructionsList from '..';
5
+
6
+ export default {
7
+ component: InstructionsList,
8
+ title: 'Typography/InstructionsList/Tests',
9
+ tags: ['!autodocs', '!manifest'],
10
+ } satisfies Meta<typeof InstructionsList>;
11
+
12
+ type Story = StoryObj<typeof InstructionsList>;
13
+
14
+ export const RTLDiff: Story = {
15
+ render: () => (
16
+ <>
17
+ <InstructionsList
18
+ dos={['Do an initial money transfer', 'Invite at least 3 friends to join']}
19
+ donts={['Paying extra hidden fees for transfers', 'Use bad exchange rate']}
20
+ sort="dosFirst"
21
+ />
22
+ <InstructionsList
23
+ dos={['Complete your profile verification']}
24
+ donts={['Share your login credentials with others']}
25
+ sort="dontsFirst"
26
+ />
27
+ </>
28
+ ),
29
+ ...withRTLDiff(),
30
+ };
@@ -0,0 +1,36 @@
1
+ import type { Meta, StoryObj } from '@storybook/react-webpack5';
2
+ import { withRTLDiff } from '../../../.storybook/decorators/RtlDiffDecorator';
3
+ import Info from '../../Info';
4
+ import Label from '..';
5
+
6
+ export default {
7
+ component: Label,
8
+ title: 'Forms/Label/Tests',
9
+ tags: ['!autodocs', '!manifest'],
10
+ } satisfies Meta<typeof Label>;
11
+
12
+ type Story = StoryObj<typeof Label>;
13
+
14
+ export const RTLDiff: Story = {
15
+ render: () => (
16
+ <>
17
+ <Label>Plain label text</Label>
18
+ <Label>
19
+ <Label.Optional>Label with optional marker</Label.Optional>
20
+ </Label>
21
+ <Label>
22
+ <div>
23
+ Label with info icon{' '}
24
+ <Info content="Helpful tooltip content" aria-label="More information" />
25
+ </div>
26
+ </Label>
27
+ <Label>
28
+ <Label.Optional>
29
+ Label with optional and info icon{' '}
30
+ <Info content="Helpful tooltip content" aria-label="More information" />
31
+ </Label.Optional>
32
+ </Label>
33
+ </>
34
+ ),
35
+ ...withRTLDiff(),
36
+ };
@@ -0,0 +1,26 @@
1
+ import type { Meta, StoryObj } from '@storybook/react-webpack5';
2
+ import { withRTLDiff } from '../../../.storybook/decorators/RtlDiffDecorator';
3
+ import Link from '..';
4
+
5
+ export default {
6
+ component: Link,
7
+ title: 'Typography/Link/Tests',
8
+ tags: ['!autodocs', '!manifest'],
9
+ } satisfies Meta<typeof Link>;
10
+
11
+ type Story = StoryObj<typeof Link>;
12
+
13
+ export const RTLDiff: Story = {
14
+ render: () => (
15
+ <>
16
+ <Link href="#" target="_blank">
17
+ External link with navigate-away icon
18
+ </Link>
19
+ <br />
20
+ <Link href="#" target="_blank" type="link-large">
21
+ Large external link with navigate-away icon
22
+ </Link>
23
+ </>
24
+ ),
25
+ ...withRTLDiff(),
26
+ };
@@ -1,22 +1,18 @@
1
1
  import { Meta } from '@storybook/react-webpack5';
2
- import { ListItem, type ListItemProps } from '../../ListItem';
3
- import { VariantStory } from './helpers';
4
- import { withVariantConfig } from '../../../../.storybook/helpers';
2
+ import { withRTLDiff } from '../../../.storybook/decorators/RtlDiffDecorator';
3
+ import { ListItem, type ListItemProps } from '../ListItem';
4
+ import { VariantStory } from './variants/helpers';
5
5
 
6
6
  export default {
7
7
  component: ListItem,
8
- title: 'Content/ListItem/Tests/variants/rtl',
8
+ title: 'Content/ListItem/Tests/RTL Diff',
9
9
  tags: ['!autodocs', '!manifest'],
10
- parameters: {
11
- controls: { disable: true },
12
- actions: { disable: true },
13
- knobs: { disable: true },
14
- },
10
+ ...withRTLDiff({ width: 'stretch' }),
15
11
  } satisfies Meta<ListItemProps>;
16
12
 
17
13
  const Default = {
18
14
  ...VariantStory,
19
- ...withVariantConfig(['rtl'], VariantStory),
15
+ parameters: { variants: [] },
20
16
  args: { variant: 'rtl' },
21
17
  };
22
18
 
@@ -141,12 +141,8 @@ export const VariantStory: VariantStory = {
141
141
 
142
142
  return (
143
143
  <List>
144
- {instances.map((instance) => (
145
- <ListItem
146
- key={`${variant}-${controlType}-${JSON.stringify(instance)}`}
147
- control={control}
148
- {...instance}
149
- />
144
+ {instances.map((instance, index) => (
145
+ <ListItem key={`${variant}-${controlType}-${index}`} control={control} {...instance} />
150
146
  ))}
151
147
  </List>
152
148
  );
@@ -0,0 +1,56 @@
1
+ import type { Meta, StoryObj } from '@storybook/react-webpack5';
2
+
3
+ import { withRTLDiff } from '../../../.storybook/decorators/RtlDiffDecorator';
4
+ import Logo, { LogoType } from '..';
5
+ import type { LogoSize } from '..';
6
+
7
+ export default {
8
+ component: Logo,
9
+ title: 'Content/Logo/Tests',
10
+ tags: ['!autodocs', '!manifest'],
11
+ } satisfies Meta<typeof Logo>;
12
+
13
+ type Story = StoryObj<typeof Logo>;
14
+
15
+ const sizes: LogoSize[] = [16, 20, 24, 36];
16
+
17
+ export const RTLDiff: Story = {
18
+ render: () => (
19
+ <>
20
+ <div
21
+ style={{
22
+ display: 'grid',
23
+ gridTemplateColumns: `repeat(${sizes.length}, min-content)`,
24
+ gap: '1rem',
25
+ alignItems: 'center',
26
+ }}
27
+ >
28
+ {sizes.map((size) => (
29
+ <Logo key={`compact-${size}`} size={size} display="compact" />
30
+ ))}
31
+ </div>
32
+
33
+ <div
34
+ style={{
35
+ display: 'grid',
36
+ gridTemplateColumns: `repeat(${sizes.length}, min-content)`,
37
+ gap: '1rem',
38
+ alignItems: 'center',
39
+ }}
40
+ >
41
+ {sizes.map((size) => (
42
+ <Logo key={`full-${size}`} size={size} display="full" />
43
+ ))}
44
+ </div>
45
+
46
+ {Object.values(LogoType).map((type) => (
47
+ <Logo key={`primary-${type}`} type={type} format="primary-lockup" display="full" />
48
+ ))}
49
+
50
+ {Object.values(LogoType).map((type) => (
51
+ <Logo key={`secondary-${type}`} type={type} format="secondary-lockup" display="full" />
52
+ ))}
53
+ </>
54
+ ),
55
+ ...withRTLDiff(),
56
+ };
@@ -0,0 +1,59 @@
1
+ import type { Meta, StoryObj } from '@storybook/react-webpack5';
2
+
3
+ import { withRTLDiff } from '../../../.storybook/decorators/RtlDiffDecorator';
4
+ import { Button, Modal } from '../..';
5
+
6
+ export default {
7
+ component: Modal,
8
+ title: 'Dialogs/Modal/Tests/RTL Diff',
9
+ tags: ['!autodocs', '!manifest'],
10
+ } satisfies Meta<typeof Modal>;
11
+
12
+ type Story = StoryObj<typeof Modal>;
13
+
14
+ const iframeDiff = withRTLDiff({ renderAs: 'iframe' });
15
+
16
+ export const WithTitleAndFooter: Story = {
17
+ render: () => (
18
+ <Modal
19
+ open
20
+ title="Modal title"
21
+ body="Body content for the modal dialog."
22
+ footer={
23
+ <Button v2 block>
24
+ Confirm
25
+ </Button>
26
+ }
27
+ onClose={() => {}}
28
+ />
29
+ ),
30
+ ...iframeDiff,
31
+ };
32
+
33
+ export const WithoutFooter: Story = {
34
+ render: () => (
35
+ <Modal
36
+ open
37
+ title="Modal without footer"
38
+ body="Body content without a footer."
39
+ onClose={() => {}}
40
+ />
41
+ ),
42
+ ...iframeDiff,
43
+ };
44
+
45
+ export const WithoutTitle: Story = {
46
+ render: () => (
47
+ <Modal
48
+ open
49
+ body="Body content without a title."
50
+ footer={
51
+ <Button v2 block>
52
+ Done
53
+ </Button>
54
+ }
55
+ onClose={() => {}}
56
+ />
57
+ ),
58
+ ...iframeDiff,
59
+ };
@@ -0,0 +1,88 @@
1
+ import type { Meta, StoryObj } from '@storybook/react-webpack5';
2
+ import { userEvent, within } from 'storybook/test';
3
+
4
+ import { withRTLDiff } from '../../../.storybook/decorators/RtlDiffDecorator';
5
+ import Field from '../../Field/Field';
6
+ import MoneyInput from '..';
7
+
8
+ export default {
9
+ component: MoneyInput,
10
+ title: 'Forms/MoneyInput/Tests/RTL Diff',
11
+ tags: ['!autodocs', '!manifest'],
12
+ } satisfies Meta<typeof MoneyInput>;
13
+
14
+ type Story = StoryObj<typeof MoneyInput>;
15
+
16
+ const eurCurrency = {
17
+ value: 'EUR',
18
+ label: 'EUR',
19
+ note: 'Euro',
20
+ currency: 'eur',
21
+ } as const;
22
+
23
+ const gbpCurrency = {
24
+ value: 'GBP',
25
+ label: 'GBP',
26
+ note: 'British pound',
27
+ currency: 'gbp',
28
+ } as const;
29
+
30
+ const multipleCurrencies = [eurCurrency, gbpCurrency] as const;
31
+
32
+ const sharedProps = {
33
+ amount: 1000,
34
+ id: 'money-input',
35
+ onAmountChange: () => {},
36
+ onCurrencyChange: () => {},
37
+ } as const;
38
+
39
+ export const TriggerVariants: Story = {
40
+ render: () => (
41
+ <>
42
+ <Field label="Single currency — large (flag + code)">
43
+ <MoneyInput {...sharedProps} size="lg" currencies={[]} selectedCurrency={eurCurrency} />
44
+ </Field>
45
+ <Field label="Single currency — medium (flag + code)">
46
+ <MoneyInput {...sharedProps} size="md" currencies={[]} selectedCurrency={eurCurrency} />
47
+ </Field>
48
+ <Field label="Single currency — small (code only)">
49
+ <MoneyInput {...sharedProps} size="sm" currencies={[]} selectedCurrency={eurCurrency} />
50
+ </Field>
51
+ <Field label="Multiple currencies — large (select trigger with flag)">
52
+ <MoneyInput
53
+ {...sharedProps}
54
+ size="lg"
55
+ currencies={multipleCurrencies}
56
+ selectedCurrency={eurCurrency}
57
+ />
58
+ </Field>
59
+ <Field label="Multiple currencies — small (select trigger without flag)">
60
+ <MoneyInput
61
+ {...sharedProps}
62
+ size="sm"
63
+ currencies={multipleCurrencies}
64
+ selectedCurrency={eurCurrency}
65
+ />
66
+ </Field>
67
+ </>
68
+ ),
69
+ ...withRTLDiff(),
70
+ };
71
+
72
+ export const OpenDropdown: Story = {
73
+ render: () => (
74
+ <MoneyInput
75
+ {...sharedProps}
76
+ size="lg"
77
+ currencies={multipleCurrencies}
78
+ selectedCurrency={eurCurrency}
79
+ />
80
+ ),
81
+ play: async ({ canvasElement }) => {
82
+ const canvas = within(canvasElement);
83
+ const trigger = canvas.queryByRole('combobox');
84
+ if (!trigger) return;
85
+ await userEvent.click(trigger);
86
+ },
87
+ ...withRTLDiff({ renderAs: 'iframe', width: '80%' }),
88
+ };
@@ -0,0 +1,37 @@
1
+ import type { Meta, StoryObj } from '@storybook/react-webpack5';
2
+ import { withRTLDiff } from '../../../.storybook/decorators/RtlDiffDecorator';
3
+ import Nudge from '../Nudge';
4
+
5
+ export default {
6
+ component: Nudge,
7
+ title: 'Prompts/Nudge/Tests',
8
+ tags: ['!autodocs', '!manifest'],
9
+ } satisfies Meta<typeof Nudge>;
10
+
11
+ type Story = StoryObj<typeof Nudge>;
12
+
13
+ export const RTLDiff: Story = {
14
+ render: () => (
15
+ <>
16
+ <Nudge
17
+ mediaName="globe"
18
+ title="With media and dismiss"
19
+ link="Link"
20
+ href="#"
21
+ onDismiss={() => {}}
22
+ />
23
+ <div style={{ marginTop: 16 }} />
24
+ <Nudge
25
+ mediaName="globe"
26
+ title="With media, action, and dismiss"
27
+ action={{ text: 'Learn more', href: '#' }}
28
+ onDismiss={() => {}}
29
+ />
30
+ <div style={{ marginTop: 16 }} />
31
+ <Nudge title="Without media, with dismiss" link="Link" href="#" onDismiss={() => {}} />
32
+ <div style={{ marginTop: 16 }} />
33
+ <Nudge title="Without media, no dismiss" link="Link" href="#" />
34
+ </>
35
+ ),
36
+ ...withRTLDiff(),
37
+ };
@@ -0,0 +1,44 @@
1
+ import type { Meta, StoryObj } from '@storybook/react-webpack5';
2
+
3
+ import { withRTLDiff } from '../../../.storybook/decorators/RtlDiffDecorator';
4
+ import Field from '../../Field/Field';
5
+ import PhoneNumberInput from '..';
6
+
7
+ export default {
8
+ component: PhoneNumberInput,
9
+ title: 'Forms/PhoneNumberInput/Tests',
10
+ tags: ['!autodocs', '!manifest'],
11
+ } satisfies Meta<typeof PhoneNumberInput>;
12
+
13
+ type Story = StoryObj<typeof PhoneNumberInput>;
14
+
15
+ /**
16
+ * The country code selector sits on the inline-start side of the phone number input.
17
+ * In RTL the two elements should swap sides — the selector moves to the right and
18
+ * the text field moves to the left. This diff verifies the flex row reverses correctly.
19
+ *
20
+ * Size variants are included because the size prop changes the input-group class and
21
+ * may affect spacing between the two sub-inputs.
22
+ */
23
+ export const RTLDiff: Story = {
24
+ render: () => (
25
+ <>
26
+ <Field label="Default (md)">
27
+ <PhoneNumberInput onChange={() => {}} />
28
+ </Field>
29
+
30
+ <Field label="Small (sm)">
31
+ <PhoneNumberInput size="sm" onChange={() => {}} />
32
+ </Field>
33
+
34
+ <Field label="Large (lg)">
35
+ <PhoneNumberInput size="lg" onChange={() => {}} />
36
+ </Field>
37
+
38
+ <Field label="With initial value">
39
+ <PhoneNumberInput initialValue="+447573135343" onChange={() => {}} />
40
+ </Field>
41
+ </>
42
+ ),
43
+ ...withRTLDiff(),
44
+ };
@@ -0,0 +1,96 @@
1
+ import type { Meta, StoryObj } from '@storybook/react-webpack5';
2
+ import { userEvent, within } from 'storybook/test';
3
+
4
+ import { withRTLDiff } from '../../../.storybook/decorators/RtlDiffDecorator';
5
+ import Button from '../../Button';
6
+ import { Position } from '../../common';
7
+ import Popover from '..';
8
+
9
+ export default {
10
+ component: Popover,
11
+ title: 'Dialogs/Popover/Tests/RTL Diff',
12
+ tags: ['!autodocs', '!manifest'],
13
+ } satisfies Meta<typeof Popover>;
14
+
15
+ type Story = StoryObj<typeof Popover>;
16
+
17
+ const iframeDiff = withRTLDiff({ renderAs: 'iframe' });
18
+
19
+ const containerStyle: React.CSSProperties = {
20
+ display: 'flex',
21
+ justifyContent: 'center',
22
+ alignItems: 'center',
23
+ minHeight: '24rem',
24
+ width: '100%',
25
+ };
26
+
27
+ const clickTrigger = async ({ canvasElement }: { canvasElement: HTMLElement }) => {
28
+ const canvas = within(canvasElement);
29
+ const trigger = canvas.queryByRole('button');
30
+ if (!trigger) return;
31
+ await userEvent.click(trigger);
32
+ };
33
+
34
+ export const PlacementRight: Story = {
35
+ render: () => (
36
+ <div style={containerStyle}>
37
+ <Popover
38
+ preferredPlacement={Position.RIGHT}
39
+ title="Guaranteed rate"
40
+ content="You'll get this rate as long as we receive your 10 EUR within the next 51 hours."
41
+ >
42
+ <Button v2>Placement right</Button>
43
+ </Popover>
44
+ </div>
45
+ ),
46
+ play: clickTrigger,
47
+ ...iframeDiff,
48
+ };
49
+
50
+ export const PlacementLeft: Story = {
51
+ render: () => (
52
+ <div style={containerStyle}>
53
+ <Popover
54
+ preferredPlacement={Position.LEFT}
55
+ title="Guaranteed rate"
56
+ content="You'll get this rate as long as we receive your 10 EUR within the next 51 hours."
57
+ >
58
+ <Button v2>Placement left</Button>
59
+ </Popover>
60
+ </div>
61
+ ),
62
+ play: clickTrigger,
63
+ ...iframeDiff,
64
+ };
65
+
66
+ export const PlacementTop: Story = {
67
+ render: () => (
68
+ <div style={containerStyle}>
69
+ <Popover
70
+ preferredPlacement={Position.TOP}
71
+ title="Guaranteed rate"
72
+ content="You'll get this rate as long as we receive your 10 EUR within the next 51 hours."
73
+ >
74
+ <Button v2>Placement top</Button>
75
+ </Popover>
76
+ </div>
77
+ ),
78
+ play: clickTrigger,
79
+ ...iframeDiff,
80
+ };
81
+
82
+ export const PlacementBottom: Story = {
83
+ render: () => (
84
+ <div style={containerStyle}>
85
+ <Popover
86
+ preferredPlacement={Position.BOTTOM}
87
+ title="Guaranteed rate"
88
+ content="You'll get this rate as long as we receive your 10 EUR within the next 51 hours."
89
+ >
90
+ <Button v2>Placement bottom</Button>
91
+ </Popover>
92
+ </div>
93
+ ),
94
+ play: clickTrigger,
95
+ ...iframeDiff,
96
+ };
@@ -0,0 +1,27 @@
1
+ import type { Meta, StoryObj } from '@storybook/react-webpack5';
2
+
3
+ import { withRTLDiff } from '../../../.storybook/decorators/RtlDiffDecorator';
4
+ import Progress from '..';
5
+
6
+ export default {
7
+ component: Progress,
8
+ title: 'Other/Progress/Tests',
9
+ tags: ['!autodocs', '!manifest'],
10
+ } satisfies Meta<typeof Progress>;
11
+
12
+ type Story = StoryObj<typeof Progress>;
13
+
14
+ /**
15
+ * The native <progress> element fills in the inline direction,
16
+ * so partial progress flips from left-to-right to right-to-left in RTL.
17
+ */
18
+ export const RTLDiff: Story = {
19
+ render: () => (
20
+ <>
21
+ <Progress id="progress-quarter" progress={{ value: 25, max: 100 }} />
22
+ <Progress id="progress-half" progress={{ value: 50, max: 100 }} />
23
+ <Progress id="progress-three-quarters" progress={{ value: 75, max: 100 }} />
24
+ </>
25
+ ),
26
+ ...withRTLDiff(),
27
+ };
@@ -0,0 +1,33 @@
1
+ import type { Meta, StoryObj } from '@storybook/react-webpack5';
2
+
3
+ import { withRTLDiff } from '../../../.storybook/decorators/RtlDiffDecorator';
4
+ import ProgressBar from '..';
5
+
6
+ export default {
7
+ component: ProgressBar,
8
+ title: 'Content/ProgressBar/Tests',
9
+ tags: ['!autodocs', '!manifest'],
10
+ } satisfies Meta<typeof ProgressBar>;
11
+
12
+ type Story = StoryObj<typeof ProgressBar>;
13
+
14
+ export const RTLDiff: Story = {
15
+ render: () => (
16
+ <>
17
+ <ProgressBar
18
+ id="progress-bar-with-description"
19
+ title="Send 5,550 GBP"
20
+ description="You have 3 days to reach your goal."
21
+ progress={{ value: 50, max: 100 }}
22
+ textEnd="200 GBP to go"
23
+ />
24
+ <ProgressBar
25
+ id="progress-bar-without-description"
26
+ title="Total limit"
27
+ progress={{ value: 800, max: 1000 }}
28
+ textEnd="200 GBP remaining"
29
+ />
30
+ </>
31
+ ),
32
+ ...withRTLDiff(),
33
+ };