@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,6 +1,6 @@
1
1
  import type { Meta, StoryObj } from '@storybook/react-webpack5';
2
2
  import { fn, userEvent, within } from 'storybook/test';
3
- import { withRTLDiff } from '../../../.storybook/decorators/RtlDiffDecorator';
3
+ import { useRtlDiffI18n, withRTLDiff } from '../../../.storybook/decorators/RtlDiffDecorator';
4
4
  import ExpressiveMoneyInput from '..';
5
5
  import { Rewards } from '@transferwise/icons';
6
6
 
@@ -24,95 +24,128 @@ const currencySelectorOptions = [
24
24
  ];
25
25
 
26
26
  export const TriggerVariants: Story = {
27
- render: () => (
28
- <>
29
- {/* Currency selector on leading side — flips in RTL */}
30
- <ExpressiveMoneyInput
31
- label="You send"
32
- currency="GBP"
33
- amount={1234.56}
34
- currencySelector={{
35
- options: currencySelectorOptions,
36
- onChange: fn(),
37
- onSearchChange: fn(),
38
- onOpen: fn(),
39
- }}
40
- onAmountChange={fn()}
41
- />
27
+ render: () => {
28
+ const i18n = useRtlDiffI18n();
29
+ return (
30
+ <>
31
+ {/* Currency selector on leading side — flips in RTL */}
32
+ <ExpressiveMoneyInput
33
+ label={i18n.youSend}
34
+ currency="GBP"
35
+ amount={1234.56}
36
+ currencySelector={{
37
+ options: currencySelectorOptions,
38
+ onChange: fn(),
39
+ onSearchChange: fn(),
40
+ onOpen: fn(),
41
+ }}
42
+ onAmountChange={fn()}
43
+ />
42
44
 
43
- {/* Chevron on trailing side — flips in RTL */}
44
- <ExpressiveMoneyInput
45
- label="You send"
46
- currency="EUR"
47
- amount={0}
48
- showChevron
49
- currencySelector={{
50
- options: currencySelectorOptions,
51
- onChange: fn(),
52
- onSearchChange: fn(),
53
- onOpen: fn(),
54
- }}
55
- onAmountChange={fn()}
56
- />
45
+ {/* Chevron on trailing side — flips in RTL */}
46
+ <ExpressiveMoneyInput
47
+ label={i18n.youSend}
48
+ currency="EUR"
49
+ amount={0}
50
+ showChevron
51
+ currencySelector={{
52
+ options: currencySelectorOptions,
53
+ onChange: fn(),
54
+ onSearchChange: fn(),
55
+ onOpen: fn(),
56
+ }}
57
+ onAmountChange={fn()}
58
+ />
57
59
 
58
- {/* InlinePrompt with media icon — icon on leading end of prompt */}
59
- <ExpressiveMoneyInput
60
- label="You send"
61
- currency="USD"
62
- amount={500}
63
- currencySelector={{
64
- options: currencySelectorOptions,
65
- onChange: fn(),
66
- onSearchChange: fn(),
67
- onOpen: fn(),
68
- }}
69
- inlinePrompt={{
70
- message: 'Great rate available',
71
- sentiment: 'positive',
72
- media: <Rewards />,
73
- }}
74
- onAmountChange={fn()}
75
- />
60
+ {/* InlinePrompt with media icon — icon on leading end of prompt */}
61
+ <ExpressiveMoneyInput
62
+ label={i18n.youSend}
63
+ currency="USD"
64
+ amount={500}
65
+ currencySelector={{
66
+ options: currencySelectorOptions,
67
+ onChange: fn(),
68
+ onSearchChange: fn(),
69
+ onOpen: fn(),
70
+ }}
71
+ inlinePrompt={{
72
+ message: i18n.greatRate,
73
+ sentiment: 'positive',
74
+ media: <Rewards />,
75
+ }}
76
+ onAmountChange={fn()}
77
+ />
76
78
 
77
- {/* Secondary avatar addon in currency selector */}
79
+ {/* Secondary avatar addon in currency selector */}
80
+ <ExpressiveMoneyInput
81
+ label={i18n.youSend}
82
+ currency="GBP"
83
+ amount={750}
84
+ currencySelector={{
85
+ options: currencySelectorOptions,
86
+ addons: [{ profileName: i18n.profileName }],
87
+ onChange: fn(),
88
+ onSearchChange: fn(),
89
+ onOpen: fn(),
90
+ }}
91
+ onAmountChange={fn()}
92
+ />
93
+ </>
94
+ );
95
+ },
96
+ ...withRTLDiff({
97
+ renderAs: 'iframe',
98
+ width: 'stretch',
99
+ i18n: {
100
+ youSend: { en: 'You send', ar: 'أنت ترسل' },
101
+ greatRate: { en: 'Great rate available', ar: 'سعر تحويل رائع متاح' },
102
+ profileName: { en: 'Mikkael Jordan', ar: 'ميكائيل جوردان' },
103
+ },
104
+ }),
105
+ };
106
+
107
+ export const OpenDropdown: Story = {
108
+ render: () => {
109
+ const i18n = useRtlDiffI18n();
110
+ return (
78
111
  <ExpressiveMoneyInput
79
- label="You send"
112
+ label={i18n.youSend}
80
113
  currency="GBP"
81
- amount={750}
114
+ amount={1234.56}
82
115
  currencySelector={{
83
- options: currencySelectorOptions,
84
- addons: [{ profileName: 'Mikkael Jordan' }],
116
+ options: [
117
+ {
118
+ title: i18n.popularGroup,
119
+ currencies: [
120
+ { code: 'GBP', label: i18n.britishPound, keywords: ['british'] },
121
+ { code: 'EUR', label: i18n.euro, keywords: ['euro'] },
122
+ { code: 'USD', label: i18n.usDollar, keywords: ['dollar'] },
123
+ ],
124
+ },
125
+ ],
85
126
  onChange: fn(),
86
127
  onSearchChange: fn(),
87
128
  onOpen: fn(),
88
129
  }}
89
130
  onAmountChange={fn()}
90
131
  />
91
- </>
92
- ),
93
- ...withRTLDiff({ renderAs: 'iframe', width: 'stretch' }),
94
- };
95
-
96
- export const OpenDropdown: Story = {
97
- render: () => (
98
- <ExpressiveMoneyInput
99
- label="You send"
100
- currency="GBP"
101
- amount={1234.56}
102
- currencySelector={{
103
- options: currencySelectorOptions,
104
- onChange: fn(),
105
- onSearchChange: fn(),
106
- onOpen: fn(),
107
- }}
108
- onAmountChange={fn()}
109
- />
110
- ),
132
+ );
133
+ },
111
134
  play: async ({ canvasElement }) => {
112
135
  const canvas = within(canvasElement);
113
136
  const trigger = canvas.queryByRole('combobox');
114
137
  if (!trigger) return;
115
138
  await userEvent.click(trigger);
116
139
  },
117
- ...withRTLDiff({ renderAs: 'iframe', width: '80%' }),
140
+ ...withRTLDiff({
141
+ renderAs: 'iframe',
142
+ width: '80%',
143
+ i18n: {
144
+ youSend: { en: 'You send', ar: 'أنت ترسل' },
145
+ popularGroup: { en: 'Popular', ar: 'الأكثر شيوعًا' },
146
+ britishPound: { en: 'British Pound', ar: 'الجنيه الإسترليني' },
147
+ euro: { en: 'Euro', ar: 'اليورو' },
148
+ usDollar: { en: 'US Dollar', ar: 'الدولار الأمريكي' },
149
+ },
150
+ }),
118
151
  };
@@ -121,7 +121,7 @@ export const RTLDiff: Story = {
121
121
  },
122
122
  value_ar: {
123
123
  en: 'localised value',
124
- ar: 'قيمة مُكيَّفة محلياً',
124
+ ar: 'قيمة مُكيَّفة محليًا',
125
125
  },
126
126
  requiredLabel: { en: 'Required field', ar: 'حقل مطلوب' },
127
127
  optionalLabel: { en: 'Optional field', ar: 'حقل اختياري' },
@@ -1,6 +1,6 @@
1
1
  import { 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 AvatarView from '../../AvatarView';
5
5
  import { ProfileType } from '../../common';
6
6
  import Logo from '../../Logo';
@@ -9,13 +9,6 @@ import FlowNavigation from '../FlowNavigation';
9
9
 
10
10
  const noop = () => {};
11
11
 
12
- const steps = [
13
- { label: 'Amount', hoverLabel: '100 GBP', onClick: noop },
14
- { label: 'You', hoverLabel: 'Elena Durante', onClick: noop },
15
- { label: 'Review', onClick: noop },
16
- { label: 'Pay', onClick: noop },
17
- ];
18
-
19
12
  const meta: Meta<typeof FlowNavigation> = {
20
13
  component: FlowNavigation,
21
14
  title: 'Navigation/FlowNavigation/Tests/RTL Diff',
@@ -29,50 +22,87 @@ export default meta;
29
22
  type Story = StoryObj<typeof FlowNavigation>;
30
23
 
31
24
  export const Desktop: Story = {
32
- render: () => (
33
- <>
34
- <FlowNavigation
35
- activeStep={2}
36
- avatar={<AvatarView profileType={ProfileType.PERSONAL} />}
37
- logo={<Logo />}
38
- steps={steps}
39
- onClose={noop}
40
- onGoBack={noop}
41
- />
42
- <FlowNavigation
43
- avatar={<AvatarView profileType={ProfileType.PERSONAL} />}
44
- logo={<Logo />}
45
- onClose={noop}
46
- />
47
- <FlowNavigation
48
- done
49
- avatar={<AvatarView profileType={ProfileType.PERSONAL} />}
50
- logo={<Logo />}
51
- steps={steps}
52
- onClose={noop}
53
- />
54
- </>
55
- ),
56
- ...withRTLDiff(),
25
+ render: () => {
26
+ const i18n = useRtlDiffI18n();
27
+ const steps = [
28
+ { label: i18n.amount, hoverLabel: i18n.amountValue, onClick: noop },
29
+ { label: i18n.you, hoverLabel: i18n.recipientName, onClick: noop },
30
+ { label: i18n.review, onClick: noop },
31
+ { label: i18n.pay, onClick: noop },
32
+ ];
33
+ return (
34
+ <>
35
+ <FlowNavigation
36
+ activeStep={2}
37
+ avatar={<AvatarView profileType={ProfileType.PERSONAL} />}
38
+ logo={<Logo />}
39
+ steps={steps}
40
+ onClose={noop}
41
+ onGoBack={noop}
42
+ />
43
+ <FlowNavigation
44
+ avatar={<AvatarView profileType={ProfileType.PERSONAL} />}
45
+ logo={<Logo />}
46
+ onClose={noop}
47
+ />
48
+ <FlowNavigation
49
+ done
50
+ avatar={<AvatarView profileType={ProfileType.PERSONAL} />}
51
+ logo={<Logo />}
52
+ steps={steps}
53
+ onClose={noop}
54
+ />
55
+ </>
56
+ );
57
+ },
58
+ ...withRTLDiff({
59
+ i18n: {
60
+ amount: { en: 'Amount', ar: 'المبلغ' },
61
+ amountValue: { en: '100 GBP', ar: '100 جنيه إسترليني' },
62
+ you: { en: 'You', ar: 'بياناتك' },
63
+ recipientName: { en: 'Elena Durante', ar: 'إيلينا دورانتي' },
64
+ review: { en: 'Review', ar: 'المراجعة' },
65
+ pay: { en: 'Pay', ar: 'الدفع' },
66
+ },
67
+ }),
57
68
  };
58
69
 
59
70
  export const Mobile: Story = {
60
- render: () => (
61
- <>
62
- <FlowNavigation
63
- activeStep={2}
64
- avatar={<AvatarView profileType={ProfileType.PERSONAL} />}
65
- logo={<Logo />}
66
- steps={steps}
67
- onClose={noop}
68
- onGoBack={noop}
69
- />
70
- <FlowNavigation
71
- avatar={<AvatarView profileType={ProfileType.PERSONAL} />}
72
- logo={<Logo />}
73
- onClose={noop}
74
- />
75
- </>
76
- ),
77
- ...withRTLDiff({ viewport: 'largeMobile' }),
71
+ render: () => {
72
+ const i18n = useRtlDiffI18n();
73
+ const steps = [
74
+ { label: i18n.amount, hoverLabel: i18n.amountValue, onClick: noop },
75
+ { label: i18n.you, hoverLabel: i18n.recipientName, onClick: noop },
76
+ { label: i18n.review, onClick: noop },
77
+ { label: i18n.pay, onClick: noop },
78
+ ];
79
+ return (
80
+ <>
81
+ <FlowNavigation
82
+ activeStep={2}
83
+ avatar={<AvatarView profileType={ProfileType.PERSONAL} />}
84
+ logo={<Logo />}
85
+ steps={steps}
86
+ onClose={noop}
87
+ onGoBack={noop}
88
+ />
89
+ <FlowNavigation
90
+ avatar={<AvatarView profileType={ProfileType.PERSONAL} />}
91
+ logo={<Logo />}
92
+ onClose={noop}
93
+ />
94
+ </>
95
+ );
96
+ },
97
+ ...withRTLDiff({
98
+ viewport: 'largeMobile',
99
+ i18n: {
100
+ amount: { en: 'Amount', ar: 'المبلغ' },
101
+ amountValue: { en: '100 GBP', ar: '100 جنيه إسترليني' },
102
+ you: { en: 'You', ar: 'بياناتك' },
103
+ recipientName: { en: 'Elena Durante', ar: 'إيلينا دورانتي' },
104
+ review: { en: 'Review', ar: 'المراجعة' },
105
+ pay: { en: 'Pay', ar: 'الدفع' },
106
+ },
107
+ }),
78
108
  };
@@ -1,5 +1,5 @@
1
1
  import { Meta, StoryObj } from '@storybook/react-webpack5';
2
- import { withRTLDiff } from '../../../.storybook/decorators/RtlDiffDecorator';
2
+ import { useRtlDiffI18n, withRTLDiff } from '../../../.storybook/decorators/RtlDiffDecorator';
3
3
  import Header, { type HeaderProps } from '../Header';
4
4
  import { withVariantConfig } from '../../../.storybook/helpers';
5
5
 
@@ -131,21 +131,33 @@ export const AllVariants: Story = {
131
131
  * difference.
132
132
  */
133
133
  export const RTLDiff: Story = {
134
- render: () => (
135
- <>
136
- <Header title="Group level without action" level="group" />
137
- <Header
138
- title="Group level with action"
139
- level="group"
140
- action={{ 'aria-label': 'View all', text: 'View all', href: '#' }}
141
- />
142
- <Header title="Section level without action" level="section" />
143
- <Header
144
- title="Section level with action"
145
- level="section"
146
- action={{ 'aria-label': 'Learn more', text: 'Learn more', href: '#' }}
147
- />
148
- </>
149
- ),
150
- ...withRTLDiff(),
134
+ render: () => {
135
+ const i18n = useRtlDiffI18n();
136
+ return (
137
+ <>
138
+ <Header title={i18n.groupWithoutAction} level="group" />
139
+ <Header
140
+ title={i18n.groupWithAction}
141
+ level="group"
142
+ action={{ 'aria-label': i18n.viewAll, text: i18n.viewAll, href: '#' }}
143
+ />
144
+ <Header title={i18n.sectionWithoutAction} level="section" />
145
+ <Header
146
+ title={i18n.sectionWithAction}
147
+ level="section"
148
+ action={{ 'aria-label': i18n.learnMore, text: i18n.learnMore, href: '#' }}
149
+ />
150
+ </>
151
+ );
152
+ },
153
+ ...withRTLDiff({
154
+ i18n: {
155
+ groupWithoutAction: { en: 'Group level without action', ar: 'مستوى المجموعة بدون إجراء' },
156
+ groupWithAction: { en: 'Group level with action', ar: 'مستوى المجموعة مع إجراء' },
157
+ sectionWithoutAction: { en: 'Section level without action', ar: 'مستوى القسم بدون إجراء' },
158
+ sectionWithAction: { en: 'Section level with action', ar: 'مستوى القسم مع إجراء' },
159
+ viewAll: { en: 'View all', ar: 'عرض الكل' },
160
+ learnMore: { en: 'Learn more', ar: 'اعرف المزيد' },
161
+ },
162
+ }),
151
163
  };
@@ -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 Info from '..';
6
6
 
7
7
  export default {
@@ -20,70 +20,144 @@ const openInfo = async ({ canvasElement }: { canvasElement: HTMLElement }) => {
20
20
  };
21
21
 
22
22
  export const PlacementTop: Story = {
23
- render: () => (
24
- <Info
25
- aria-label="Info trigger"
26
- title="Information"
27
- content="This is some descriptive content inside the info component."
28
- presentation="POPOVER"
29
- preferredPlacement="top"
30
- />
31
- ),
23
+ render: () => {
24
+ const i18n = useRtlDiffI18n();
25
+ return (
26
+ <Info
27
+ aria-label={i18n.trigger}
28
+ title={i18n.title}
29
+ content={i18n.content}
30
+ presentation="POPOVER"
31
+ preferredPlacement="top"
32
+ />
33
+ );
34
+ },
32
35
  play: openInfo,
33
- ...withRTLDiff({ renderAs: 'iframe', hAlign: 'center', vAlign: 'bottom' }),
36
+ ...withRTLDiff({
37
+ renderAs: 'iframe',
38
+ hAlign: 'center',
39
+ vAlign: 'bottom',
40
+ i18n: {
41
+ trigger: { en: 'Info trigger', ar: 'زر المعلومات' },
42
+ title: { en: 'Information', ar: 'معلومات' },
43
+ content: {
44
+ en: 'This is some descriptive content inside the info component.',
45
+ ar: 'هذا محتوى وصفي داخل مكوّن المعلومات.',
46
+ },
47
+ },
48
+ }),
34
49
  };
35
50
 
36
51
  export const PlacementRight: Story = {
37
- render: () => (
38
- <Info
39
- aria-label="Info trigger"
40
- title="Information"
41
- content="This is some descriptive content inside the info component."
42
- presentation="POPOVER"
43
- preferredPlacement="right"
44
- />
45
- ),
52
+ render: () => {
53
+ const i18n = useRtlDiffI18n();
54
+ return (
55
+ <Info
56
+ aria-label={i18n.trigger}
57
+ title={i18n.title}
58
+ content={i18n.content}
59
+ presentation="POPOVER"
60
+ preferredPlacement="right"
61
+ />
62
+ );
63
+ },
46
64
  play: openInfo,
47
- ...withRTLDiff({ renderAs: 'iframe', hAlign: 'left', vAlign: 'center' }),
65
+ ...withRTLDiff({
66
+ renderAs: 'iframe',
67
+ hAlign: 'left',
68
+ vAlign: 'center',
69
+ i18n: {
70
+ trigger: { en: 'Info trigger', ar: 'زر المعلومات' },
71
+ title: { en: 'Information', ar: 'معلومات' },
72
+ content: {
73
+ en: 'This is some descriptive content inside the info component.',
74
+ ar: 'هذا محتوى وصفي داخل مكوّن المعلومات.',
75
+ },
76
+ },
77
+ }),
48
78
  };
49
79
 
50
80
  export const PlacementBottom: Story = {
51
- render: () => (
52
- <Info
53
- aria-label="Info trigger"
54
- title="Information"
55
- content="This is some descriptive content inside the info component."
56
- presentation="POPOVER"
57
- preferredPlacement="bottom"
58
- />
59
- ),
81
+ render: () => {
82
+ const i18n = useRtlDiffI18n();
83
+ return (
84
+ <Info
85
+ aria-label={i18n.trigger}
86
+ title={i18n.title}
87
+ content={i18n.content}
88
+ presentation="POPOVER"
89
+ preferredPlacement="bottom"
90
+ />
91
+ );
92
+ },
60
93
  play: openInfo,
61
- ...withRTLDiff({ renderAs: 'iframe', hAlign: 'center' }),
94
+ ...withRTLDiff({
95
+ renderAs: 'iframe',
96
+ hAlign: 'center',
97
+ i18n: {
98
+ trigger: { en: 'Info trigger', ar: 'زر المعلومات' },
99
+ title: { en: 'Information', ar: 'معلومات' },
100
+ content: {
101
+ en: 'This is some descriptive content inside the info component.',
102
+ ar: 'هذا محتوى وصفي داخل مكوّن المعلومات.',
103
+ },
104
+ },
105
+ }),
62
106
  };
63
107
 
64
108
  export const PlacementLeft: Story = {
65
- render: () => (
66
- <Info
67
- aria-label="Info trigger"
68
- title="Information"
69
- content="This is some descriptive content inside the info component."
70
- presentation="POPOVER"
71
- preferredPlacement="left"
72
- />
73
- ),
109
+ render: () => {
110
+ const i18n = useRtlDiffI18n();
111
+ return (
112
+ <Info
113
+ aria-label={i18n.trigger}
114
+ title={i18n.title}
115
+ content={i18n.content}
116
+ presentation="POPOVER"
117
+ preferredPlacement="left"
118
+ />
119
+ );
120
+ },
74
121
  play: openInfo,
75
- ...withRTLDiff({ renderAs: 'iframe', hAlign: 'right', vAlign: 'center' }),
122
+ ...withRTLDiff({
123
+ renderAs: 'iframe',
124
+ hAlign: 'right',
125
+ vAlign: 'center',
126
+ i18n: {
127
+ trigger: { en: 'Info trigger', ar: 'زر المعلومات' },
128
+ title: { en: 'Information', ar: 'معلومات' },
129
+ content: {
130
+ en: 'This is some descriptive content inside the info component.',
131
+ ar: 'هذا محتوى وصفي داخل مكوّن المعلومات.',
132
+ },
133
+ },
134
+ }),
76
135
  };
77
136
 
78
137
  export const Modal: Story = {
79
- render: () => (
80
- <Info
81
- aria-label="Info trigger"
82
- title="Information"
83
- content="This is some descriptive content inside the info component."
84
- presentation="MODAL"
85
- />
86
- ),
138
+ render: () => {
139
+ const i18n = useRtlDiffI18n();
140
+ return (
141
+ <Info
142
+ aria-label={i18n.trigger}
143
+ title={i18n.title}
144
+ content={i18n.content}
145
+ presentation="MODAL"
146
+ />
147
+ );
148
+ },
87
149
  play: openInfo,
88
- ...withRTLDiff({ renderAs: 'iframe', hAlign: 'center', vAlign: 'center' }),
150
+ ...withRTLDiff({
151
+ renderAs: 'iframe',
152
+ hAlign: 'center',
153
+ vAlign: 'center',
154
+ i18n: {
155
+ trigger: { en: 'Info trigger', ar: 'زر المعلومات' },
156
+ title: { en: 'Information', ar: 'معلومات' },
157
+ content: {
158
+ en: 'This is some descriptive content inside the info component.',
159
+ ar: 'هذا محتوى وصفي داخل مكوّن المعلومات.',
160
+ },
161
+ },
162
+ }),
89
163
  };
@@ -39,7 +39,7 @@ export const RTLDiff: Story = {
39
39
  addonEnd={{
40
40
  content: (
41
41
  <Button v2 size="sm">
42
- Copy
42
+ {i18n.copy}
43
43
  </Button>
44
44
  ),
45
45
  interactive: true,
@@ -57,7 +57,7 @@ export const RTLDiff: Story = {
57
57
  addonEnd={{
58
58
  content: (
59
59
  <Button v2 size="sm">
60
- Clear
60
+ {i18n.clear}
61
61
  </Button>
62
62
  ),
63
63
  interactive: true,
@@ -74,6 +74,8 @@ export const RTLDiff: Story = {
74
74
  placeholder_both: { en: 'addonStart and addonEnd', ar: 'البادئة والنهاية' },
75
75
  placeholder_start: { en: 'addonStart only', ar: 'البادئة فقط' },
76
76
  placeholder_end: { en: 'addonEnd only', ar: 'النهاية فقط' },
77
+ copy: { en: 'Copy', ar: 'نسخ' },
78
+ clear: { en: 'Clear', ar: 'مسح' },
77
79
  },
78
80
  }),
79
81
  };