@transferwise/components 0.0.0-experimental-e94d625 → 0.0.0-experimental-8e1de95

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 (69) hide show
  1. package/build/Snackbar/Snackbar.js +97 -101
  2. package/build/Snackbar/Snackbar.js.map +1 -1
  3. package/build/Snackbar/Snackbar.mjs +98 -102
  4. package/build/Snackbar/Snackbar.mjs.map +1 -1
  5. package/build/types/Carousel/_stories/constants.d.ts +25 -0
  6. package/build/types/Carousel/_stories/constants.d.ts.map +1 -1
  7. package/build/types/ListItem/_stories/variants/helpers.d.ts +38 -1
  8. package/build/types/ListItem/_stories/variants/helpers.d.ts.map +1 -1
  9. package/build/types/Snackbar/Snackbar.d.ts +1 -15
  10. package/build/types/Snackbar/Snackbar.d.ts.map +1 -1
  11. package/package.json +1 -1
  12. package/src/Accordion/_stories/Accordion.test.story.tsx +74 -48
  13. package/src/AvatarLayout/_stories/AvatarLayout.test.story.tsx +46 -30
  14. package/src/Button/LegacyButton/_stories/LegacyButton.test.story.tsx +29 -19
  15. package/src/Calendar/_stories/Calendar.test.story.tsx +34 -21
  16. package/src/Carousel/_stories/Carousel.test.story.tsx +18 -8
  17. package/src/Carousel/_stories/constants.tsx +29 -4
  18. package/src/Checkbox/_stories/Checkbox.test.story.tsx +22 -13
  19. package/src/CheckboxButton/_stories/CheckboxButton.test.story.tsx +23 -14
  20. package/src/Chips/_stories/Chips.test.story.tsx +51 -36
  21. package/src/DateInput/_stories/DateInput.rtl.test.story.tsx +62 -12
  22. package/src/Decision/_stories/Decision.test.story.tsx +74 -58
  23. package/src/DefinitionList/_stories/DefinitionList.test.story.tsx +58 -42
  24. package/src/Drawer/_stories/Drawer.rtl.test.story.tsx +65 -38
  25. package/src/ExpressiveMoneyInput/_stories/ExpressiveMoneyInput.rtl.test.story.tsx +107 -74
  26. package/src/Field/_stories/Field.test.story.tsx +1 -1
  27. package/src/FlowNavigation/_stories/FlowNavigation.rtl.test.story.tsx +81 -51
  28. package/src/Header/_stories/Header.test.story.tsx +30 -18
  29. package/src/Info/_stories/Info.rtl.test.story.tsx +124 -50
  30. package/src/Inputs/InputGroup/_stories/InputGroup.test.story.tsx +4 -2
  31. package/src/Inputs/SelectInput/_stories/SelectInput.rtl.test.story.tsx +106 -77
  32. package/src/InstructionsList/_stories/InstructionsList.test.story.tsx +43 -16
  33. package/src/Link/_stories/Link.test.story.tsx +27 -13
  34. package/src/ListItem/_stories/ListItem.rtl.test.story.tsx +126 -6
  35. package/src/ListItem/_stories/variants/helpers.tsx +174 -126
  36. package/src/Loader/_stories/Loader.test.story.tsx +17 -10
  37. package/src/Modal/_stories/Modal.rtl.test.story.tsx +58 -39
  38. package/src/MoneyInput/_stories/MoneyInput.rtl.test.story.tsx +14 -2
  39. package/src/Nudge/_stories/Nudge.test.story.tsx +70 -21
  40. package/src/Popover/_stories/Popover.rtl.test.story.tsx +92 -49
  41. package/src/PromoCard/_stories/PromoCard.test.story.tsx +53 -29
  42. package/src/PromoCard/_stories/PromoCardGroup.test.story.tsx +60 -36
  43. package/src/Prompt/ActionPrompt/_stories/ActionPrompt.test.story.tsx +74 -38
  44. package/src/Prompt/CriticalBanner/_stories/CriticalBanner.test.story.tsx +68 -31
  45. package/src/Prompt/InfoPrompt/_stories/InfoPrompt.test.story.tsx +52 -22
  46. package/src/Prompt/InlinePrompt/_stories/InlinePrompt.test.story.tsx +36 -21
  47. package/src/Radio/_stories/Radio.test.story.tsx +60 -46
  48. package/src/RadioGroup/_stories/RadioGroup.test.story.tsx +70 -51
  49. package/src/Section/_stories/Section.test.story.tsx +30 -14
  50. package/src/SegmentedControl/_stories/SegmentedControl.test.story.tsx +38 -15
  51. package/src/SlidingPanel/_stories/SlidingPanel.rtl.test.story.tsx +58 -34
  52. package/src/Snackbar/Snackbar.tsx +90 -88
  53. package/src/Snackbar/_stories/Snackbar.rtl.test.story.tsx +24 -12
  54. package/src/Stepper/_stories/Stepper.test.story.tsx +27 -9
  55. package/src/Switch/_stories/Switch.test.story.tsx +20 -12
  56. package/src/Table/_stories/Table.test.story.tsx +107 -86
  57. package/src/Tabs/_stories/Tabs.test.story.tsx +92 -52
  58. package/src/Tag/_stories/Tag.test.story.tsx +27 -16
  59. package/src/Tooltip/_stories/Tooltip.rtl.test.story.tsx +68 -25
  60. package/src/Typeahead/_stories/Typeahead.rtl.test.story.tsx +3 -3
  61. package/src/Upload/_stories/Upload.rtl.test.story.tsx +49 -26
  62. package/src/UploadInput/_stories/UploadInput.test.story.tsx +63 -41
  63. package/src/_deprecated/Alert/_stories/Alert.test.story.tsx +45 -24
  64. package/src/_deprecated/Card/_stories/Card.test.story.tsx +47 -23
  65. package/src/_deprecated/CriticalBanner/_stories/CriticalCommsBanner.test.story.tsx +21 -15
  66. package/src/_deprecated/InlineAlert/_stories/InlineAlert.test.story.tsx +23 -12
  67. package/src/_deprecated/Select/_stories/Select.rtl.test.story.tsx +76 -40
  68. package/src/common/BottomSheet/_stories/BottomSheet.test.story.tsx +38 -20
  69. package/src/common/Panel/_stories/Panel.rtl.test.story.tsx +135 -51
@@ -1,7 +1,7 @@
1
1
  import type { Meta, StoryObj } from '@storybook/react-webpack5';
2
2
  import { userEvent, within } from 'storybook/test';
3
3
 
4
- import { withRTLDiff } from '../../../.storybook/decorators/RtlDiffDecorator';
4
+ import { useRtlDiffI18n, withRTLDiff } from '../../../.storybook/decorators/RtlDiffDecorator';
5
5
  import Button from '../../Button';
6
6
  import { Position } from '../../common';
7
7
  import Popover from '..';
@@ -22,65 +22,108 @@ const clickTrigger = async ({ canvasElement }: { canvasElement: HTMLElement }) =
22
22
  };
23
23
 
24
24
  export const PlacementRight: Story = {
25
- render: () => (
26
- <Popover
27
- preferredPlacement={Position.RIGHT}
28
- title="Guaranteed rate"
29
- content="You'll get this rate as long as we receive your 10 EUR within the next 51 hours."
30
- >
31
- <Button size="sm" v2>
32
- right
33
- </Button>
34
- </Popover>
35
- ),
25
+ render: () => {
26
+ const i18n = useRtlDiffI18n();
27
+ return (
28
+ <Popover preferredPlacement={Position.RIGHT} title={i18n.title} content={i18n.content}>
29
+ <Button size="sm" v2>
30
+ {i18n.trigger}
31
+ </Button>
32
+ </Popover>
33
+ );
34
+ },
36
35
  play: clickTrigger,
37
- ...withRTLDiff({ renderAs: 'iframe', hAlign: 'left', vAlign: 'center' }),
36
+ ...withRTLDiff({
37
+ renderAs: 'iframe',
38
+ hAlign: 'left',
39
+ vAlign: 'center',
40
+ i18n: {
41
+ title: { en: 'Guaranteed rate', ar: 'سعر مضمون' },
42
+ content: {
43
+ en: "You'll get this rate as long as we receive your 10 EUR within the next 51 hours.",
44
+ ar: 'ستحصل على هذا السعر إذا استلمنا مبلغ 10 يورو خلال 51 ساعة القادمة.',
45
+ },
46
+ trigger: { en: 'right', ar: 'اليمين' },
47
+ },
48
+ }),
38
49
  };
39
50
 
40
51
  export const PlacementLeft: Story = {
41
- render: () => (
42
- <Popover
43
- preferredPlacement={Position.LEFT}
44
- title="Guaranteed rate"
45
- content="You'll get this rate as long as we receive your 10 EUR within the next 51 hours."
46
- >
47
- <Button size="sm" v2>
48
- left
49
- </Button>
50
- </Popover>
51
- ),
52
+ render: () => {
53
+ const i18n = useRtlDiffI18n();
54
+ return (
55
+ <Popover preferredPlacement={Position.LEFT} title={i18n.title} content={i18n.content}>
56
+ <Button size="sm" v2>
57
+ {i18n.trigger}
58
+ </Button>
59
+ </Popover>
60
+ );
61
+ },
52
62
  play: clickTrigger,
53
- ...withRTLDiff({ renderAs: 'iframe', hAlign: 'right', vAlign: 'center' }),
63
+ ...withRTLDiff({
64
+ renderAs: 'iframe',
65
+ hAlign: 'right',
66
+ vAlign: 'center',
67
+ i18n: {
68
+ title: { en: 'Guaranteed rate', ar: 'سعر مضمون' },
69
+ content: {
70
+ en: "You'll get this rate as long as we receive your 10 EUR within the next 51 hours.",
71
+ ar: 'ستحصل على هذا السعر إذا استلمنا مبلغ 10 يورو خلال 51 ساعة القادمة.',
72
+ },
73
+ trigger: { en: 'left', ar: 'اليسار' },
74
+ },
75
+ }),
54
76
  };
55
77
 
56
78
  export const PlacementTop: Story = {
57
- render: () => (
58
- <Popover
59
- preferredPlacement={Position.TOP}
60
- title="Guaranteed rate"
61
- content="You'll get this rate as long as we receive your 10 EUR within the next 51 hours."
62
- >
63
- <Button size="sm" v2>
64
- top
65
- </Button>
66
- </Popover>
67
- ),
79
+ render: () => {
80
+ const i18n = useRtlDiffI18n();
81
+ return (
82
+ <Popover preferredPlacement={Position.TOP} title={i18n.title} content={i18n.content}>
83
+ <Button size="sm" v2>
84
+ {i18n.trigger}
85
+ </Button>
86
+ </Popover>
87
+ );
88
+ },
68
89
  play: clickTrigger,
69
- ...withRTLDiff({ renderAs: 'iframe', vAlign: 'bottom', hAlign: 'center' }),
90
+ ...withRTLDiff({
91
+ renderAs: 'iframe',
92
+ vAlign: 'bottom',
93
+ hAlign: 'center',
94
+ i18n: {
95
+ title: { en: 'Guaranteed rate', ar: 'سعر مضمون' },
96
+ content: {
97
+ en: "You'll get this rate as long as we receive your 10 EUR within the next 51 hours.",
98
+ ar: 'ستحصل على هذا السعر إذا استلمنا مبلغ 10 يورو خلال 51 ساعة القادمة.',
99
+ },
100
+ trigger: { en: 'top', ar: 'أعلى' },
101
+ },
102
+ }),
70
103
  };
71
104
 
72
105
  export const PlacementBottom: Story = {
73
- render: () => (
74
- <Popover
75
- preferredPlacement={Position.BOTTOM}
76
- title="Guaranteed rate"
77
- content="You'll get this rate as long as we receive your 10 EUR within the next 51 hours."
78
- >
79
- <Button size="sm" v2>
80
- bottom
81
- </Button>
82
- </Popover>
83
- ),
106
+ render: () => {
107
+ const i18n = useRtlDiffI18n();
108
+ return (
109
+ <Popover preferredPlacement={Position.BOTTOM} title={i18n.title} content={i18n.content}>
110
+ <Button size="sm" v2>
111
+ {i18n.trigger}
112
+ </Button>
113
+ </Popover>
114
+ );
115
+ },
84
116
  play: clickTrigger,
85
- ...withRTLDiff({ renderAs: 'iframe', hAlign: 'center' }),
117
+ ...withRTLDiff({
118
+ renderAs: 'iframe',
119
+ hAlign: 'center',
120
+ i18n: {
121
+ title: { en: 'Guaranteed rate', ar: 'سعر مضمون' },
122
+ content: {
123
+ en: "You'll get this rate as long as we receive your 10 EUR within the next 51 hours.",
124
+ ar: 'ستحصل على هذا السعر إذا استلمنا مبلغ 10 يورو خلال 51 ساعة القادمة.',
125
+ },
126
+ trigger: { en: 'bottom', ar: 'أسفل' },
127
+ },
128
+ }),
86
129
  };
@@ -1,5 +1,5 @@
1
1
  import type { Meta, StoryObj } from '@storybook/react-webpack5';
2
- import { withRTLDiff } from '../../../.storybook/decorators/RtlDiffDecorator';
2
+ import { useRtlDiffI18n, withRTLDiff } from '../../../.storybook/decorators/RtlDiffDecorator';
3
3
  import PromoCard from '..';
4
4
 
5
5
  export default {
@@ -11,32 +11,56 @@ export default {
11
11
  type Story = StoryObj<typeof PromoCard>;
12
12
 
13
13
  export const RTLDiff: Story = {
14
- render: () => (
15
- <>
16
- <PromoCard
17
- title="Link with arrow"
18
- description="Indicator arrow icon flips in RTL."
19
- href="#"
20
- indicatorLabel="Free"
21
- imageSource="https://wise.com/web-art/assets/illustrations/digital-card-2-medium@2x.webp"
22
- />
23
- <PromoCard
24
- title="Checkbox checked"
25
- description="Check icon positioned at the end."
26
- type="checkbox"
27
- defaultChecked
28
- indicatorLabel="Selected"
29
- imageSource="https://wise.com/web-art/assets/illustrations/digital-card-2-medium@2x.webp"
30
- />
31
- <PromoCard
32
- title="Download indicator"
33
- description="Download icon in the indicator area."
34
- href="#"
35
- download="file.pdf"
36
- indicatorLabel="Download"
37
- imageSource="https://wise.com/web-art/assets/illustrations/digital-card-2-medium@2x.webp"
38
- />
39
- </>
40
- ),
41
- ...withRTLDiff(),
14
+ render: () => {
15
+ const i18n = useRtlDiffI18n();
16
+ return (
17
+ <>
18
+ <PromoCard
19
+ title={i18n.linkTitle}
20
+ description={i18n.linkDescription}
21
+ href="#"
22
+ indicatorLabel={i18n.linkIndicator}
23
+ imageSource="https://wise.com/web-art/assets/illustrations/digital-card-2-medium@2x.webp"
24
+ />
25
+ <PromoCard
26
+ title={i18n.checkboxTitle}
27
+ description={i18n.checkboxDescription}
28
+ type="checkbox"
29
+ defaultChecked
30
+ indicatorLabel={i18n.checkboxIndicator}
31
+ imageSource="https://wise.com/web-art/assets/illustrations/digital-card-2-medium@2x.webp"
32
+ />
33
+ <PromoCard
34
+ title={i18n.downloadTitle}
35
+ description={i18n.downloadDescription}
36
+ href="#"
37
+ download="file.pdf"
38
+ indicatorLabel={i18n.downloadIndicator}
39
+ imageSource="https://wise.com/web-art/assets/illustrations/digital-card-2-medium@2x.webp"
40
+ />
41
+ </>
42
+ );
43
+ },
44
+ ...withRTLDiff({
45
+ i18n: {
46
+ linkTitle: { en: 'Link with arrow', ar: 'رابط مع سهم' },
47
+ linkDescription: {
48
+ en: 'Indicator arrow icon flips in RTL.',
49
+ ar: 'ينعكس سهم المؤشر في الاتجاه من اليمين إلى اليسار.',
50
+ },
51
+ linkIndicator: { en: 'Free', ar: 'مجانًا' },
52
+ checkboxTitle: { en: 'Checkbox checked', ar: 'مربع اختيار محدد' },
53
+ checkboxDescription: {
54
+ en: 'Check icon positioned at the end.',
55
+ ar: 'أيقونة الاختيار في نهاية البطاقة.',
56
+ },
57
+ checkboxIndicator: { en: 'Selected', ar: 'محدد' },
58
+ downloadTitle: { en: 'Download indicator', ar: 'مؤشر التنزيل' },
59
+ downloadDescription: {
60
+ en: 'Download icon in the indicator area.',
61
+ ar: 'أيقونة التنزيل في منطقة المؤشر.',
62
+ },
63
+ downloadIndicator: { en: 'Download', ar: 'تنزيل' },
64
+ },
65
+ }),
42
66
  };
@@ -1,6 +1,6 @@
1
1
  import type { Meta, StoryObj } from '@storybook/react-webpack5';
2
2
 
3
- import { withRTLDiff } from '../../../.storybook/decorators/RtlDiffDecorator';
3
+ import { useRtlDiffI18n, withRTLDiff } from '../../../.storybook/decorators/RtlDiffDecorator';
4
4
  import PromoCard from '../PromoCard';
5
5
  import PromoCardGroup from '../CardGroup/PromoCardGroup';
6
6
 
@@ -13,39 +13,63 @@ export default {
13
13
  type Story = StoryObj<typeof PromoCardGroup>;
14
14
 
15
15
  export const RTLDiff: Story = {
16
- render: () => (
17
- <PromoCardGroup>
18
- <PromoCard
19
- title="Digital"
20
- description="A card that lives online and works anywhere."
21
- type="radio"
22
- value="digital"
23
- id="digital"
24
- indicatorLabel="Free"
25
- imageAlt=""
26
- imageSource="https://wise.com/web-art/assets/illustrations/digital-card-2-medium@2x.webp"
27
- />
28
- <PromoCard
29
- title="Standard"
30
- description="Spend and withdraw money around the world."
31
- type="radio"
32
- value="standard"
33
- id="standard"
34
- indicatorLabel="7 GBP"
35
- imageAlt=""
36
- imageSource="https://wise.com/web-art/assets/illustrations/personal-card-medium@2x.webp"
37
- />
38
- <PromoCard
39
- title="Eco"
40
- description="A debit card made to biodegrade."
41
- type="radio"
42
- value="eco"
43
- id="eco"
44
- indicatorLabel="9 GBP"
45
- imageAlt=""
46
- imageSource="https://wise.com/web-art/assets/illustrations/eco-card-medium@2x.webp"
47
- />
48
- </PromoCardGroup>
49
- ),
50
- ...withRTLDiff(),
16
+ render: () => {
17
+ const i18n = useRtlDiffI18n();
18
+ return (
19
+ <PromoCardGroup>
20
+ <PromoCard
21
+ title={i18n.digitalTitle}
22
+ description={i18n.digitalDescription}
23
+ type="radio"
24
+ value="digital"
25
+ id="digital"
26
+ indicatorLabel={i18n.digitalIndicator}
27
+ imageAlt=""
28
+ imageSource="https://wise.com/web-art/assets/illustrations/digital-card-2-medium@2x.webp"
29
+ />
30
+ <PromoCard
31
+ title={i18n.standardTitle}
32
+ description={i18n.standardDescription}
33
+ type="radio"
34
+ value="standard"
35
+ id="standard"
36
+ indicatorLabel={i18n.standardIndicator}
37
+ imageAlt=""
38
+ imageSource="https://wise.com/web-art/assets/illustrations/personal-card-medium@2x.webp"
39
+ />
40
+ <PromoCard
41
+ title={i18n.ecoTitle}
42
+ description={i18n.ecoDescription}
43
+ type="radio"
44
+ value="eco"
45
+ id="eco"
46
+ indicatorLabel={i18n.ecoIndicator}
47
+ imageAlt=""
48
+ imageSource="https://wise.com/web-art/assets/illustrations/eco-card-medium@2x.webp"
49
+ />
50
+ </PromoCardGroup>
51
+ );
52
+ },
53
+ ...withRTLDiff({
54
+ i18n: {
55
+ digitalTitle: { en: 'Digital', ar: 'رقمية' },
56
+ digitalDescription: {
57
+ en: 'A card that lives online and works anywhere.',
58
+ ar: 'بطاقة تعمل عبر الإنترنت في أي مكان.',
59
+ },
60
+ digitalIndicator: { en: 'Free', ar: 'مجانًا' },
61
+ standardTitle: { en: 'Standard', ar: 'عادية' },
62
+ standardDescription: {
63
+ en: 'Spend and withdraw money around the world.',
64
+ ar: 'أنفق أموالك واسحبها في جميع أنحاء العالم.',
65
+ },
66
+ standardIndicator: { en: '7 GBP', ar: '7 جنيه إسترليني' },
67
+ ecoTitle: { en: 'Eco', ar: 'صديقة للبيئة' },
68
+ ecoDescription: {
69
+ en: 'A debit card made to biodegrade.',
70
+ ar: 'بطاقة خصم مصممة لتتحلل طبيعيًا.',
71
+ },
72
+ ecoIndicator: { en: '9 GBP', ar: '9 جنيه إسترليني' },
73
+ },
74
+ }),
51
75
  };
@@ -6,7 +6,7 @@ import { ActionPrompt } from '../ActionPrompt';
6
6
  import { Body, Title } from '../../..';
7
7
  import { StoryObj } from '@storybook/react-webpack5';
8
8
  import { allModes } from '../../../../.storybook/modes';
9
- import { withRTLDiff } from '../../../../.storybook/decorators/RtlDiffDecorator';
9
+ import { useRtlDiffI18n, withRTLDiff } from '../../../../.storybook/decorators/RtlDiffDecorator';
10
10
  import { withVariantConfig } from '../../../../.storybook/helpers';
11
11
  import { lorem10 } from '../../../test-utils';
12
12
 
@@ -275,41 +275,77 @@ export const Responsiveness: Story = {
275
275
  };
276
276
 
277
277
  export const RTLDiff: Story = {
278
- render: () => (
279
- <>
280
- <ActionPrompt
281
- title="Default status icon"
282
- description="No media provided, uses default sentiment icon."
283
- action={{ label: 'Continue' }}
284
- />
285
- <ActionPrompt
286
- title="Custom image"
287
- description="Media with a custom image source."
288
- media={{ imgSrc: '../../wise-card.svg' }}
289
- action={{ label: 'View card' }}
290
- />
291
- <ActionPrompt
292
- title="Avatar with icon"
293
- description="Media with an avatar containing a custom icon."
294
- media={{ avatar: { asset: <Bank /> } }}
295
- action={{ label: 'Connect bank' }}
296
- />
297
- <ActionPrompt
298
- title="Primary and secondary actions"
299
- description="Both action buttons present."
300
- media={{ avatar: { asset: <Bank /> } }}
301
- action={{ label: 'Confirm' }}
302
- actionSecondary={{ label: 'Cancel' }}
303
- />
304
- <ActionPrompt
305
- title="Dismissible with two actions"
306
- description="Close button and both action buttons."
307
- media={{ avatar: { asset: <Bank /> } }}
308
- action={{ label: 'Confirm' }}
309
- actionSecondary={{ label: 'Cancel' }}
310
- onDismiss={() => {}}
311
- />
312
- </>
313
- ),
314
- ...withRTLDiff(),
278
+ render: () => {
279
+ const i18n = useRtlDiffI18n();
280
+ return (
281
+ <>
282
+ <ActionPrompt
283
+ title={i18n.defaultIconTitle}
284
+ description={i18n.defaultIconDescription}
285
+ action={{ label: i18n.continueAction }}
286
+ />
287
+ <ActionPrompt
288
+ title={i18n.customImageTitle}
289
+ description={i18n.customImageDescription}
290
+ media={{ imgSrc: '../../wise-card.svg' }}
291
+ action={{ label: i18n.viewCardAction }}
292
+ />
293
+ <ActionPrompt
294
+ title={i18n.avatarIconTitle}
295
+ description={i18n.avatarIconDescription}
296
+ media={{ avatar: { asset: <Bank /> } }}
297
+ action={{ label: i18n.connectBankAction }}
298
+ />
299
+ <ActionPrompt
300
+ title={i18n.twoActionsTitle}
301
+ description={i18n.twoActionsDescription}
302
+ media={{ avatar: { asset: <Bank /> } }}
303
+ action={{ label: i18n.confirmAction }}
304
+ actionSecondary={{ label: i18n.cancelAction }}
305
+ />
306
+ <ActionPrompt
307
+ title={i18n.dismissibleTitle}
308
+ description={i18n.dismissibleDescription}
309
+ media={{ avatar: { asset: <Bank /> } }}
310
+ action={{ label: i18n.confirmAction }}
311
+ actionSecondary={{ label: i18n.cancelAction }}
312
+ onDismiss={() => {}}
313
+ />
314
+ </>
315
+ );
316
+ },
317
+ ...withRTLDiff({
318
+ i18n: {
319
+ defaultIconTitle: { en: 'Default status icon', ar: 'أيقونة الحالة الافتراضية' },
320
+ defaultIconDescription: {
321
+ en: 'No media provided, uses default sentiment icon.',
322
+ ar: 'لا توجد وسائط، يتم استخدام أيقونة الحالة الافتراضية.',
323
+ },
324
+ continueAction: { en: 'Continue', ar: 'متابعة' },
325
+ customImageTitle: { en: 'Custom image', ar: 'صورة مخصصة' },
326
+ customImageDescription: {
327
+ en: 'Media with a custom image source.',
328
+ ar: 'وسائط مع مصدر صورة مخصص.',
329
+ },
330
+ viewCardAction: { en: 'View card', ar: 'عرض البطاقة' },
331
+ avatarIconTitle: { en: 'Avatar with icon', ar: 'صورة رمزية مع أيقونة' },
332
+ avatarIconDescription: {
333
+ en: 'Media with an avatar containing a custom icon.',
334
+ ar: 'وسائط مع صورة رمزية تحتوي على أيقونة مخصصة.',
335
+ },
336
+ connectBankAction: { en: 'Connect bank', ar: 'ربط البنك' },
337
+ twoActionsTitle: { en: 'Primary and secondary actions', ar: 'إجراءات أساسية وثانوية' },
338
+ twoActionsDescription: {
339
+ en: 'Both action buttons present.',
340
+ ar: 'زرّا الإجراء موجودان معًا.',
341
+ },
342
+ confirmAction: { en: 'Confirm', ar: 'تأكيد' },
343
+ cancelAction: { en: 'Cancel', ar: 'إلغاء' },
344
+ dismissibleTitle: { en: 'Dismissible with two actions', ar: 'قابل للإغلاق مع إجراءين' },
345
+ dismissibleDescription: {
346
+ en: 'Close button and both action buttons.',
347
+ ar: 'زر الإغلاق وزرّا الإجراء.',
348
+ },
349
+ },
350
+ }),
315
351
  };
@@ -3,7 +3,7 @@ import { Meta, StoryObj } from '@storybook/react-webpack5';
3
3
  import { expect, fn, userEvent, waitFor, within } from 'storybook/test';
4
4
  import { Bank } from '@transferwise/icons';
5
5
  import Button from '../../../Button';
6
- import { withRTLDiff } from '../../../../.storybook/decorators/RtlDiffDecorator';
6
+ import { useRtlDiffI18n, withRTLDiff } from '../../../../.storybook/decorators/RtlDiffDecorator';
7
7
  import { withVariantConfig } from '../../../../.storybook/helpers';
8
8
  import { CriticalBanner } from '../CriticalBanner';
9
9
 
@@ -482,34 +482,71 @@ export const UncontrolledStateInteraction: Story = {
482
482
  };
483
483
 
484
484
  export const RTLDiff: Story = {
485
- render: () => (
486
- <>
487
- <CriticalBanner title="Title only" description="Description without actions or media." />
488
- <CriticalBanner
489
- title="With primary action"
490
- description="Banner with a single action button."
491
- action={{ label: 'Verify now' }}
492
- />
493
- <CriticalBanner
494
- title="With both actions"
495
- description="Banner with primary and secondary actions."
496
- action={{ label: 'Verify now' }}
497
- actionSecondary={{ label: 'Learn more' }}
498
- />
499
- <CriticalBanner
500
- title="With media image"
501
- description="Banner with a custom image."
502
- media={{ imgSrc: '../../wise-card.svg', 'aria-label': 'Wise card' }}
503
- action={{ label: 'Take action' }}
504
- />
505
- <CriticalBanner
506
- title="With avatar media"
507
- description="Banner with an avatar icon."
508
- media={{ avatar: { asset: <Bank /> } }}
509
- action={{ label: 'Connect bank' }}
510
- actionSecondary={{ label: 'Learn more' }}
511
- />
512
- </>
513
- ),
514
- ...withRTLDiff({ renderAs: 'iframe' }),
485
+ render: () => {
486
+ const i18n = useRtlDiffI18n();
487
+ return (
488
+ <>
489
+ <CriticalBanner title={i18n.titleOnly} description={i18n.titleOnlyDescription} />
490
+ <CriticalBanner
491
+ title={i18n.withPrimaryAction}
492
+ description={i18n.withPrimaryActionDescription}
493
+ action={{ label: i18n.verifyNow }}
494
+ />
495
+ <CriticalBanner
496
+ title={i18n.withBothActions}
497
+ description={i18n.withBothActionsDescription}
498
+ action={{ label: i18n.verifyNow }}
499
+ actionSecondary={{ label: i18n.learnMore }}
500
+ />
501
+ <CriticalBanner
502
+ title={i18n.withMediaImage}
503
+ description={i18n.withMediaImageDescription}
504
+ media={{ imgSrc: '../../wise-card.svg', 'aria-label': i18n.cardImage }}
505
+ action={{ label: i18n.takeAction }}
506
+ />
507
+ <CriticalBanner
508
+ title={i18n.withAvatarMedia}
509
+ description={i18n.withAvatarMediaDescription}
510
+ media={{ avatar: { asset: <Bank /> } }}
511
+ action={{ label: i18n.connectBank }}
512
+ actionSecondary={{ label: i18n.learnMore }}
513
+ />
514
+ </>
515
+ );
516
+ },
517
+ ...withRTLDiff({
518
+ renderAs: 'iframe',
519
+ i18n: {
520
+ titleOnly: { en: 'Title only', ar: 'العنوان فقط' },
521
+ titleOnlyDescription: {
522
+ en: 'Description without actions or media.',
523
+ ar: 'وصف بدون إجراءات أو وسائط.',
524
+ },
525
+ withPrimaryAction: { en: 'With primary action', ar: 'مع إجراء رئيسي' },
526
+ withPrimaryActionDescription: {
527
+ en: 'Banner with a single action button.',
528
+ ar: 'لافتة تحتوي على زر إجراء واحد.',
529
+ },
530
+ withBothActions: { en: 'With both actions', ar: 'مع كلا الإجراءين' },
531
+ withBothActionsDescription: {
532
+ en: 'Banner with primary and secondary actions.',
533
+ ar: 'لافتة تحتوي على إجراء رئيسي وإجراء ثانوي.',
534
+ },
535
+ withMediaImage: { en: 'With media image', ar: 'مع صورة' },
536
+ withMediaImageDescription: {
537
+ en: 'Banner with a custom image.',
538
+ ar: 'لافتة تحتوي على صورة مخصصة.',
539
+ },
540
+ withAvatarMedia: { en: 'With avatar media', ar: 'مع صورة رمزية' },
541
+ withAvatarMediaDescription: {
542
+ en: 'Banner with an avatar icon.',
543
+ ar: 'لافتة تحتوي على أيقونة رمزية.',
544
+ },
545
+ verifyNow: { en: 'Verify now', ar: 'تحقّق الآن' },
546
+ learnMore: { en: 'Learn more', ar: 'اعرف المزيد' },
547
+ takeAction: { en: 'Take action', ar: 'اتخذ إجراءً' },
548
+ connectBank: { en: 'Connect bank', ar: 'ربط البنك' },
549
+ cardImage: { en: 'Wise card', ar: 'بطاقة Wise' },
550
+ },
551
+ }),
515
552
  };