@transferwise/components 46.165.0 → 46.165.2

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 (99) hide show
  1. package/build/Snackbar/Snackbar.js +98 -101
  2. package/build/Snackbar/Snackbar.js.map +1 -1
  3. package/build/Snackbar/Snackbar.mjs +99 -102
  4. package/build/Snackbar/Snackbar.mjs.map +1 -1
  5. package/build/Snackbar/SnackbarProvider.js +2 -6
  6. package/build/Snackbar/SnackbarProvider.js.map +1 -1
  7. package/build/Snackbar/SnackbarProvider.mjs +2 -6
  8. package/build/Snackbar/SnackbarProvider.mjs.map +1 -1
  9. package/build/index.js +0 -2
  10. package/build/index.js.map +1 -1
  11. package/build/index.mjs +0 -1
  12. package/build/index.mjs.map +1 -1
  13. package/build/types/Body/Body.d.ts +2 -2
  14. package/build/types/Carousel/_stories/constants.d.ts +25 -0
  15. package/build/types/Carousel/_stories/constants.d.ts.map +1 -1
  16. package/build/types/IconButton/IconButton.d.ts +1 -1
  17. package/build/types/ListItem/_stories/variants/helpers.d.ts +38 -1
  18. package/build/types/ListItem/_stories/variants/helpers.d.ts.map +1 -1
  19. package/build/types/MoneyInput/MoneyInput.d.ts +1 -1
  20. package/build/types/MoneyInput/MoneyInput.d.ts.map +1 -1
  21. package/build/types/Snackbar/Snackbar.d.ts +2 -16
  22. package/build/types/Snackbar/Snackbar.d.ts.map +1 -1
  23. package/build/types/Snackbar/SnackbarProvider.d.ts.map +1 -1
  24. package/build/types/Title/Title.d.ts +2 -2
  25. package/build/types/Upload/Steps/UploadImageStep/UploadImageStep.d.ts +1 -1
  26. package/build/types/UploadInput/UploadItem/UploadItemLink.d.ts +1 -1
  27. package/build/types/index.d.ts +0 -1
  28. package/build/types/index.d.ts.map +1 -1
  29. package/package.json +1 -1
  30. package/src/Accordion/_stories/Accordion.test.story.tsx +74 -48
  31. package/src/AvatarLayout/_stories/AvatarLayout.test.story.tsx +46 -30
  32. package/src/Button/LegacyButton/_stories/LegacyButton.test.story.tsx +29 -19
  33. package/src/Button/_stories/Button.test.story.tsx +96 -62
  34. package/src/Calendar/_stories/Calendar.test.story.tsx +34 -21
  35. package/src/Carousel/_stories/Carousel.test.story.tsx +18 -8
  36. package/src/Carousel/_stories/constants.tsx +29 -4
  37. package/src/Checkbox/_stories/Checkbox.test.story.tsx +22 -13
  38. package/src/CheckboxButton/_stories/CheckboxButton.test.story.tsx +23 -14
  39. package/src/Chips/_stories/Chips.test.story.tsx +51 -36
  40. package/src/DateInput/_stories/DateInput.rtl.test.story.tsx +62 -12
  41. package/src/DateLookup/_stories/DateLookup.rtl.test.story.tsx +2 -2
  42. package/src/Decision/_stories/Decision.test.story.tsx +74 -58
  43. package/src/DefinitionList/_stories/DefinitionList.test.story.tsx +58 -42
  44. package/src/Drawer/_stories/Drawer.rtl.test.story.tsx +65 -38
  45. package/src/ExpressiveMoneyInput/_stories/ExpressiveMoneyInput.rtl.test.story.tsx +107 -74
  46. package/src/Field/_stories/Field.test.story.tsx +18 -18
  47. package/src/FlowNavigation/_stories/FlowNavigation.rtl.test.story.tsx +81 -51
  48. package/src/Header/_stories/Header.test.story.tsx +30 -18
  49. package/src/Info/_stories/Info.rtl.test.story.tsx +124 -50
  50. package/src/InputWithDisplayFormat/_stories/InputWithDisplayFormat.test.story.tsx +4 -4
  51. package/src/Inputs/InputGroup/_stories/InputGroup.test.story.tsx +9 -8
  52. package/src/Inputs/SearchInput/_stories/SearchInput.test.story.tsx +5 -3
  53. package/src/Inputs/SelectInput/_stories/SelectInput.rtl.test.story.tsx +108 -79
  54. package/src/Inputs/TextArea/_stories/TextArea.test.story.tsx +10 -10
  55. package/src/InstructionsList/_stories/InstructionsList.test.story.tsx +43 -16
  56. package/src/Label/_stories/Label.test.story.tsx +7 -7
  57. package/src/Link/_stories/Link.test.story.tsx +27 -13
  58. package/src/ListItem/_stories/ListItem.rtl.test.story.tsx +126 -6
  59. package/src/ListItem/_stories/variants/helpers.tsx +174 -126
  60. package/src/Loader/_stories/Loader.test.story.tsx +17 -10
  61. package/src/Modal/_stories/Modal.rtl.test.story.tsx +58 -39
  62. package/src/MoneyInput/_stories/MoneyInput.rtl.test.story.tsx +21 -3
  63. package/src/Nudge/_stories/Nudge.test.story.tsx +70 -21
  64. package/src/PhoneNumberInput/_stories/PhoneNumberInput.rtl.test.story.tsx +1 -1
  65. package/src/Popover/_stories/Popover.rtl.test.story.tsx +92 -49
  66. package/src/ProgressBar/_stories/ProgressBar.test.story.tsx +6 -6
  67. package/src/PromoCard/_stories/PromoCard.test.story.tsx +53 -29
  68. package/src/PromoCard/_stories/PromoCardGroup.test.story.tsx +60 -36
  69. package/src/Prompt/ActionPrompt/_stories/ActionPrompt.test.story.tsx +74 -38
  70. package/src/Prompt/CriticalBanner/_stories/CriticalBanner.test.story.tsx +68 -31
  71. package/src/Prompt/InfoPrompt/_stories/InfoPrompt.test.story.tsx +52 -22
  72. package/src/Prompt/InlinePrompt/_stories/InlinePrompt.test.story.tsx +36 -21
  73. package/src/Radio/_stories/Radio.test.story.tsx +60 -46
  74. package/src/RadioGroup/_stories/RadioGroup.test.story.tsx +70 -51
  75. package/src/Section/_stories/Section.test.story.tsx +30 -14
  76. package/src/SegmentedControl/_stories/SegmentedControl.test.story.tsx +38 -15
  77. package/src/SlidingPanel/_stories/SlidingPanel.rtl.test.story.tsx +58 -34
  78. package/src/Snackbar/Snackbar.test.tsx +16 -0
  79. package/src/Snackbar/Snackbar.tsx +93 -90
  80. package/src/Snackbar/SnackbarProvider.tsx +4 -10
  81. package/src/Snackbar/_stories/Snackbar.rtl.test.story.tsx +24 -12
  82. package/src/Stepper/_stories/Stepper.test.story.tsx +27 -9
  83. package/src/Switch/_stories/Switch.test.story.tsx +20 -12
  84. package/src/Table/_stories/Table.test.story.tsx +107 -86
  85. package/src/Tabs/_stories/Tabs.test.story.tsx +92 -52
  86. package/src/Tag/_stories/Tag.test.story.tsx +27 -16
  87. package/src/TextareaWithDisplayFormat/_stories/TextareaWithDisplayFormat.test.story.tsx +4 -4
  88. package/src/Tooltip/_stories/Tooltip.rtl.test.story.tsx +68 -25
  89. package/src/Typeahead/_stories/Typeahead.rtl.test.story.tsx +4 -4
  90. package/src/Upload/_stories/Upload.rtl.test.story.tsx +49 -26
  91. package/src/UploadInput/_stories/UploadInput.test.story.tsx +63 -41
  92. package/src/_deprecated/Alert/_stories/Alert.test.story.tsx +45 -24
  93. package/src/_deprecated/Card/_stories/Card.test.story.tsx +47 -23
  94. package/src/_deprecated/CriticalBanner/_stories/CriticalCommsBanner.test.story.tsx +21 -15
  95. package/src/_deprecated/InlineAlert/_stories/InlineAlert.test.story.tsx +23 -12
  96. package/src/_deprecated/Select/_stories/Select.rtl.test.story.tsx +78 -42
  97. package/src/common/BottomSheet/_stories/BottomSheet.test.story.tsx +38 -20
  98. package/src/common/Panel/_stories/Panel.rtl.test.story.tsx +135 -51
  99. package/src/index.ts +0 -1
@@ -29,6 +29,15 @@ const gbpCurrency = {
29
29
 
30
30
  const multipleCurrencies = [eurCurrency, gbpCurrency] as const;
31
31
 
32
+ /**
33
+ * `note` holds the currency's full name and renders only in the open dropdown, so only
34
+ * OpenDropdown needs the localised variants.
35
+ */
36
+ const getLocalisedCurrencies = (i18n: Record<string, string>) => [
37
+ { ...eurCurrency, note: i18n.euro },
38
+ { ...gbpCurrency, note: i18n.britishPound },
39
+ ];
40
+
32
41
  const sharedProps = {
33
42
  amount: 1000,
34
43
  id: 'money-input',
@@ -72,12 +81,13 @@ export const TriggerVariants: Story = {
72
81
  export const OpenDropdown: Story = {
73
82
  render: () => {
74
83
  const i18n = useRtlDiffI18n();
84
+ const currencies = getLocalisedCurrencies(i18n);
75
85
  return (
76
86
  <MoneyInput
77
87
  {...sharedProps}
78
88
  size="lg"
79
- currencies={multipleCurrencies}
80
- selectedCurrency={eurCurrency}
89
+ currencies={currencies}
90
+ selectedCurrency={currencies[0]}
81
91
  searchPlaceholder={i18n.searchPlaceholder}
82
92
  />
83
93
  );
@@ -88,5 +98,13 @@ export const OpenDropdown: Story = {
88
98
  if (!trigger) return;
89
99
  await userEvent.click(trigger);
90
100
  },
91
- ...withRTLDiff({ renderAs: 'iframe', width: '40%', i18n: { searchPlaceholder: { ltr: 'Search currencies or countries', rtl: 'ابحث عن العملات أو الدول' } } }),
101
+ ...withRTLDiff({
102
+ renderAs: 'iframe',
103
+ width: '40%',
104
+ i18n: {
105
+ searchPlaceholder: { en: 'Search currencies or countries', ar: 'ابحث عن العملات أو الدول' },
106
+ euro: { en: 'Euro', ar: 'اليورو' },
107
+ britishPound: { en: 'British pound', ar: 'الجنيه الإسترليني' },
108
+ },
109
+ }),
92
110
  };
@@ -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 Nudge from '../Nudge';
4
4
 
5
5
  export default {
@@ -28,27 +28,76 @@ const MEDIA_NAMES = [
28
28
  ] as const;
29
29
 
30
30
  export const RTLDiff: Story = {
31
- render: () => (
32
- <>
33
- {MEDIA_NAMES.map((mediaName) => (
31
+ render: () => {
32
+ const i18n = useRtlDiffI18n();
33
+ const mediaTitles: Record<(typeof MEDIA_NAMES)[number], string> = {
34
+ globe: i18n.globe,
35
+ lock: i18n.lock,
36
+ wallet: i18n.wallet,
37
+ gear: i18n.gear,
38
+ 'invite-letter': i18n.inviteLetter,
39
+ 'personal-card': i18n.personalCard,
40
+ 'business-card': i18n.businessCard,
41
+ heart: i18n.heart,
42
+ 'multi-currency': i18n.multiCurrency,
43
+ 'shopping-bag': i18n.shoppingBag,
44
+ flower: i18n.flower,
45
+ 'gift-box': i18n.giftBox,
46
+ backpack: i18n.backpack,
47
+ documents: i18n.documents,
48
+ };
49
+
50
+ return (
51
+ <>
52
+ {MEDIA_NAMES.map((mediaName) => (
53
+ <Nudge
54
+ key={mediaName}
55
+ mediaName={mediaName}
56
+ title={mediaTitles[mediaName]}
57
+ link={i18n.link}
58
+ href="#"
59
+ onDismiss={() => {}}
60
+ />
61
+ ))}
34
62
  <Nudge
35
- key={mediaName}
36
- mediaName={mediaName}
37
- title={mediaName}
38
- link="Link"
39
- href="#"
63
+ mediaName="globe"
64
+ title={i18n.withAction}
65
+ action={{ text: i18n.learnMore, href: '#' }}
40
66
  onDismiss={() => {}}
41
67
  />
42
- ))}
43
- <Nudge
44
- mediaName="globe"
45
- title="With action"
46
- action={{ text: 'Learn more', href: '#' }}
47
- onDismiss={() => {}}
48
- />
49
- <Nudge title="Without media, with dismiss" link="Link" href="#" onDismiss={() => {}} />
50
- <Nudge title="Without media, no dismiss" link="Link" href="#" />
51
- </>
52
- ),
53
- ...withRTLDiff({ width: 'stretch' }),
68
+ <Nudge title={i18n.withDismiss} link={i18n.link} href="#" onDismiss={() => {}} />
69
+ <Nudge title={i18n.withoutDismiss} link={i18n.link} href="#" />
70
+ </>
71
+ );
72
+ },
73
+ ...withRTLDiff({
74
+ width: 'stretch',
75
+ i18n: {
76
+ globe: { en: 'globe', ar: 'الكرة الأرضية' },
77
+ lock: { en: 'lock', ar: 'قفل' },
78
+ wallet: { en: 'wallet', ar: 'محفظة' },
79
+ gear: { en: 'gear', ar: 'ترس' },
80
+ inviteLetter: { en: 'invite-letter', ar: 'رسالة دعوة' },
81
+ personalCard: { en: 'personal-card', ar: 'بطاقة شخصية' },
82
+ businessCard: { en: 'business-card', ar: 'بطاقة تجارية' },
83
+ heart: { en: 'heart', ar: 'قلب' },
84
+ multiCurrency: { en: 'multi-currency', ar: 'عملات متعددة' },
85
+ shoppingBag: { en: 'shopping-bag', ar: 'حقيبة تسوق' },
86
+ flower: { en: 'flower', ar: 'زهرة' },
87
+ giftBox: { en: 'gift-box', ar: 'علبة هدايا' },
88
+ backpack: { en: 'backpack', ar: 'حقيبة ظهر' },
89
+ documents: { en: 'documents', ar: 'مستندات' },
90
+ link: { en: 'Link', ar: 'رابط' },
91
+ withAction: { en: 'With action', ar: 'مع إجراء' },
92
+ learnMore: { en: 'Learn more', ar: 'اعرف المزيد' },
93
+ withDismiss: {
94
+ en: 'Without media, with dismiss',
95
+ ar: 'بدون وسائط، مع إمكانية الإغلاق',
96
+ },
97
+ withoutDismiss: {
98
+ en: 'Without media, no dismiss',
99
+ ar: 'بدون وسائط، بدون إمكانية الإغلاق',
100
+ },
101
+ },
102
+ }),
54
103
  };
@@ -55,6 +55,6 @@ export const DropdownOpen: Story = {
55
55
  ...withRTLDiff({
56
56
  renderAs: 'iframe',
57
57
  hAlign: 'center',
58
- i18n: { searchPlaceholder: { ltr: 'Country code', rtl: 'رمز الدولة' } },
58
+ i18n: { searchPlaceholder: { en: 'Country code', ar: 'رمز الدولة' } },
59
59
  }),
60
60
  };
@@ -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
  };
@@ -34,14 +34,14 @@ export const RTLDiff: Story = {
34
34
  },
35
35
  ...withRTLDiff({
36
36
  i18n: {
37
- title1: { ltr: 'Send 5,550 GBP', rtl: 'أرسل ٥٬٥٥٠ جنيه إسترليني' },
37
+ title1: { en: 'Send 5,550 GBP', ar: 'أرسل ٥٬٥٥٠ جنيه إسترليني' },
38
38
  description: {
39
- ltr: 'You have 3 days to reach your goal.',
40
- rtl: 'لديك ٣ أيام للوصول إلى هدفك.',
39
+ en: 'You have 3 days to reach your goal.',
40
+ ar: 'لديك ٣ أيام للوصول إلى هدفك.',
41
41
  },
42
- textEnd1: { ltr: '200 GBP to go', rtl: '٢٠٠ جنيه إسترليني متبقي' },
43
- title2: { ltr: 'Total limit', rtl: 'الحد الإجمالي' },
44
- textEnd2: { ltr: '200 GBP remaining', rtl: '٢٠٠ جنيه إسترليني متبقي' },
42
+ textEnd1: { en: '200 GBP to go', ar: '٢٠٠ جنيه إسترليني متبقي' },
43
+ title2: { en: 'Total limit', ar: 'الحد الإجمالي' },
44
+ textEnd2: { en: '200 GBP remaining', ar: '٢٠٠ جنيه إسترليني متبقي' },
45
45
  },
46
46
  }),
47
47
  };
@@ -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
  };