@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
@@ -1,7 +1,7 @@
1
1
  import type { Meta, StoryObj } from '@storybook/react-webpack5';
2
2
  import { fn, 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 DateInput from '..';
6
6
 
7
7
  export default {
@@ -13,24 +13,74 @@ export default {
13
13
  type Story = StoryObj<typeof DateInput>;
14
14
 
15
15
  export const Sizes: Story = {
16
- render: () => (
17
- <>
18
- <DateInput size="sm" onChange={fn()} />
19
- <DateInput size="md" onChange={fn()} />
20
- <DateInput size="lg" onChange={fn()} />
21
- <DateInput mode="month-year" onChange={fn()} />
22
- </>
23
- ),
24
- ...withRTLDiff({ renderAs: 'iframe' }),
16
+ render: () => {
17
+ const i18n = useRtlDiffI18n();
18
+ return (
19
+ <>
20
+ <DateInput
21
+ size="sm"
22
+ dayLabel={i18n.dayLabel}
23
+ monthLabel={i18n.monthLabel}
24
+ yearLabel={i18n.yearLabel}
25
+ onChange={fn()}
26
+ />
27
+ <DateInput
28
+ size="md"
29
+ dayLabel={i18n.dayLabel}
30
+ monthLabel={i18n.monthLabel}
31
+ yearLabel={i18n.yearLabel}
32
+ onChange={fn()}
33
+ />
34
+ <DateInput
35
+ size="lg"
36
+ dayLabel={i18n.dayLabel}
37
+ monthLabel={i18n.monthLabel}
38
+ yearLabel={i18n.yearLabel}
39
+ onChange={fn()}
40
+ />
41
+ <DateInput
42
+ mode="month-year"
43
+ monthLabel={i18n.monthLabel}
44
+ yearLabel={i18n.yearLabel}
45
+ onChange={fn()}
46
+ />
47
+ </>
48
+ );
49
+ },
50
+ ...withRTLDiff({
51
+ renderAs: 'iframe',
52
+ i18n: {
53
+ dayLabel: { en: 'Day', ar: 'اليوم' },
54
+ monthLabel: { en: 'Month', ar: 'الشهر' },
55
+ yearLabel: { en: 'Year', ar: 'السنة' },
56
+ },
57
+ }),
25
58
  };
26
59
 
27
60
  export const OpenDropdown: Story = {
28
- render: () => <DateInput onChange={() => {}} />,
61
+ render: () => {
62
+ const i18n = useRtlDiffI18n();
63
+ return (
64
+ <DateInput
65
+ dayLabel={i18n.dayLabel}
66
+ monthLabel={i18n.monthLabel}
67
+ yearLabel={i18n.yearLabel}
68
+ onChange={() => {}}
69
+ />
70
+ );
71
+ },
29
72
  play: async ({ canvasElement }) => {
30
73
  const canvas = within(canvasElement);
31
74
  const trigger = canvas.queryByRole('combobox');
32
75
  if (!trigger) return;
33
76
  await userEvent.click(trigger);
34
77
  },
35
- ...withRTLDiff({ renderAs: 'iframe' }),
78
+ ...withRTLDiff({
79
+ renderAs: 'iframe',
80
+ i18n: {
81
+ dayLabel: { en: 'Day', ar: 'اليوم' },
82
+ monthLabel: { en: 'Month', ar: 'الشهر' },
83
+ yearLabel: { en: 'Year', ar: 'السنة' },
84
+ },
85
+ }),
36
86
  };
@@ -15,8 +15,8 @@ type Story = StoryObj<typeof DateLookup>;
15
15
  const selectedDate = new Date(2024, 5, 14);
16
16
 
17
17
  const i18nConfig = {
18
- label: { ltr: 'Select date', rtl: 'اختر التاريخ' },
19
- placeholder: { ltr: 'Choose a date', rtl: 'اختر تاريخًا' },
18
+ label: { en: 'Select date', ar: 'اختر التاريخ' },
19
+ placeholder: { en: 'Choose a date', ar: 'اختر تاريخًا' },
20
20
  };
21
21
 
22
22
  export const TriggerVariants: Story = {
@@ -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 { Size } from '../../common';
5
5
  import Decision, { DecisionPresentation, DecisionType } from '..';
6
6
  import AvatarView from '../../AvatarView';
@@ -13,67 +13,83 @@ export default {
13
13
 
14
14
  type Story = StoryObj<typeof Decision>;
15
15
 
16
- const options = [
17
- {
18
- title: 'Send money',
19
- description: 'Fast international transfers.',
20
- href: '#',
21
- 'aria-label': 'Send money',
22
- media: {
23
- block: <img src="https://wise.com/public-resources/assets/illustrations/globe.svg" alt="" />,
24
- list: <AvatarView profileName="Alice Smith" />,
25
- },
26
- },
27
- {
28
- title: 'Receive money',
29
- description: 'Get paid from abroad.',
30
- href: '#',
31
- 'aria-label': 'Receive money',
32
- media: {
33
- block: <img src="https://wise.com/public-resources/assets/illustrations/globe.svg" alt="" />,
34
- list: <AvatarView profileName="Alice Smith" />,
35
- },
36
- },
37
- ];
38
-
39
16
  /**
40
17
  * NavigationOption renders media on the inline-start side and a chevron on the
41
18
  * inline-end side; these flip in RTL. The LIST_BLOCK and LIST_BLOCK_GRID
42
19
  * presentations use flex-row layout that also reverses direction in RTL.
43
20
  */
44
21
  export const RTLDiff: Story = {
45
- render: () => (
46
- <>
47
- <Decision
48
- options={options}
49
- presentation={DecisionPresentation.LIST}
50
- type={DecisionType.NAVIGATION}
51
- />
52
- <Decision
53
- options={options}
54
- presentation={DecisionPresentation.LIST}
55
- type={DecisionType.NAVIGATION}
56
- isContainerAligned
57
- />
58
- <Decision
59
- options={options}
60
- presentation={DecisionPresentation.LIST_BLOCK}
61
- type={DecisionType.NAVIGATION}
62
- size={Size.MEDIUM}
63
- />
64
- <Decision
65
- options={options}
66
- presentation={DecisionPresentation.LIST_BLOCK}
67
- type={DecisionType.NAVIGATION}
68
- size={Size.SMALL}
69
- />
70
- <Decision
71
- options={[...options, ...options]}
72
- presentation={DecisionPresentation.LIST_BLOCK_GRID}
73
- type={DecisionType.NAVIGATION}
74
- size={Size.MEDIUM}
75
- />
76
- </>
77
- ),
78
- ...withRTLDiff(),
22
+ render: () => {
23
+ const i18n = useRtlDiffI18n();
24
+
25
+ const options = [
26
+ {
27
+ title: i18n.sendTitle,
28
+ description: i18n.sendDescription,
29
+ href: '#',
30
+ 'aria-label': i18n.sendTitle,
31
+ media: {
32
+ block: (
33
+ <img src="https://wise.com/public-resources/assets/illustrations/globe.svg" alt="" />
34
+ ),
35
+ list: <AvatarView profileName={i18n.profileName} />,
36
+ },
37
+ },
38
+ {
39
+ title: i18n.receiveTitle,
40
+ description: i18n.receiveDescription,
41
+ href: '#',
42
+ 'aria-label': i18n.receiveTitle,
43
+ media: {
44
+ block: (
45
+ <img src="https://wise.com/public-resources/assets/illustrations/globe.svg" alt="" />
46
+ ),
47
+ list: <AvatarView profileName={i18n.profileName} />,
48
+ },
49
+ },
50
+ ];
51
+
52
+ return (
53
+ <>
54
+ <Decision
55
+ options={options}
56
+ presentation={DecisionPresentation.LIST}
57
+ type={DecisionType.NAVIGATION}
58
+ />
59
+ <Decision
60
+ options={options}
61
+ presentation={DecisionPresentation.LIST}
62
+ type={DecisionType.NAVIGATION}
63
+ isContainerAligned
64
+ />
65
+ <Decision
66
+ options={options}
67
+ presentation={DecisionPresentation.LIST_BLOCK}
68
+ type={DecisionType.NAVIGATION}
69
+ size={Size.MEDIUM}
70
+ />
71
+ <Decision
72
+ options={options}
73
+ presentation={DecisionPresentation.LIST_BLOCK}
74
+ type={DecisionType.NAVIGATION}
75
+ size={Size.SMALL}
76
+ />
77
+ <Decision
78
+ options={[...options, ...options]}
79
+ presentation={DecisionPresentation.LIST_BLOCK_GRID}
80
+ type={DecisionType.NAVIGATION}
81
+ size={Size.MEDIUM}
82
+ />
83
+ </>
84
+ );
85
+ },
86
+ ...withRTLDiff({
87
+ i18n: {
88
+ sendTitle: { en: 'Send money', ar: 'إرسال الأموال' },
89
+ sendDescription: { en: 'Fast international transfers.', ar: 'تحويلات دولية سريعة.' },
90
+ receiveTitle: { en: 'Receive money', ar: 'استلام الأموال' },
91
+ receiveDescription: { en: 'Get paid from abroad.', ar: 'استلم أموالك من الخارج.' },
92
+ profileName: { en: 'Alice Smith', ar: 'أليس سميث' },
93
+ },
94
+ }),
79
95
  };
@@ -1,7 +1,7 @@
1
1
  import type { Meta, StoryObj } from '@storybook/react-webpack5';
2
2
  import { expect } from 'storybook/test';
3
3
 
4
- import { withRTLDiff } from '../../../.storybook/decorators/RtlDiffDecorator';
4
+ import { useRtlDiffI18n, withRTLDiff } from '../../../.storybook/decorators/RtlDiffDecorator';
5
5
  import { Layout } from '../../common';
6
6
 
7
7
  import DefinitionList, { type DefinitionListDefinition, type DefinitionListLayout } from '..';
@@ -168,28 +168,6 @@ export const HORIZONTAL_RIGHT_ALIGNED: Story = {
168
168
  play: verifySharedColumnBoundary,
169
169
  };
170
170
 
171
- const rtlDefinitions: DefinitionListDefinition[] = [
172
- { key: 'name', title: 'Full name', value: 'Alice Smith' },
173
- { key: 'amount', title: 'Amount sent', value: '1,234.56 GBP' },
174
- { key: 'status', title: 'Transfer status', value: 'Completed successfully' },
175
- ];
176
-
177
- const rtlDefinitionsWithAction: DefinitionListDefinition[] = [
178
- { key: 'name', title: 'Full name', value: 'Alice Smith' },
179
- {
180
- key: 'amount',
181
- title: 'Amount sent',
182
- value: '1,234.56 GBP',
183
- action: { label: 'Edit' },
184
- },
185
- {
186
- key: 'status',
187
- title: 'Transfer status',
188
- value: 'Completed successfully',
189
- action: { label: 'View details' },
190
- },
191
- ];
192
-
193
171
  const layouts: DefinitionListLayout[] = [
194
172
  'VERTICAL_TWO_COLUMN',
195
173
  'VERTICAL_ONE_COLUMN',
@@ -199,23 +177,61 @@ const layouts: DefinitionListLayout[] = [
199
177
  ];
200
178
 
201
179
  export const RTLDiff: Story = {
202
- render: () => (
203
- <div style={{ display: 'flex', flexDirection: 'column', gap: 'var(--size-48)' }}>
204
- {layouts.map((layout) => (
205
- <section key={layout}>
206
- <h3 style={{ fontSize: 14, margin: '0 0 var(--size-8)' }}>{layout}</h3>
207
- <DefinitionList layout={layout} definitions={rtlDefinitions} />
208
- </section>
209
- ))}
210
- {layouts.map((layout) => (
211
- <section key={`${layout}-action`}>
212
- <h3 style={{ fontSize: 14, margin: '0 0 var(--size-8)' }}>
213
- {layout} with action buttons
214
- </h3>
215
- <DefinitionList layout={layout} definitions={rtlDefinitionsWithAction} />
216
- </section>
217
- ))}
218
- </div>
219
- ),
220
- ...withRTLDiff(),
180
+ render: () => {
181
+ const i18n = useRtlDiffI18n();
182
+
183
+ const rtlDefinitions: DefinitionListDefinition[] = [
184
+ { key: 'name', title: i18n.fullName, value: i18n.customerName },
185
+ { key: 'amount', title: i18n.amountSent, value: i18n.amountValue },
186
+ { key: 'status', title: i18n.transferStatus, value: i18n.statusValue },
187
+ ];
188
+
189
+ const rtlDefinitionsWithAction: DefinitionListDefinition[] = [
190
+ { key: 'name', title: i18n.fullName, value: i18n.customerName },
191
+ {
192
+ key: 'amount',
193
+ title: i18n.amountSent,
194
+ value: i18n.amountValue,
195
+ action: { label: i18n.editAction },
196
+ },
197
+ {
198
+ key: 'status',
199
+ title: i18n.transferStatus,
200
+ value: i18n.statusValue,
201
+ action: { label: i18n.viewDetailsAction },
202
+ },
203
+ ];
204
+
205
+ return (
206
+ <div style={{ display: 'flex', flexDirection: 'column', gap: 'var(--size-48)' }}>
207
+ {layouts.map((layout) => (
208
+ <section key={layout}>
209
+ <h3 style={{ fontSize: 14, margin: '0 0 var(--size-8)' }}>{layout}</h3>
210
+ <DefinitionList layout={layout} definitions={rtlDefinitions} />
211
+ </section>
212
+ ))}
213
+ {layouts.map((layout) => (
214
+ <section key={`${layout}-action`}>
215
+ <h3 style={{ fontSize: 14, margin: '0 0 var(--size-8)' }}>
216
+ {layout} {i18n.withActionButtons}
217
+ </h3>
218
+ <DefinitionList layout={layout} definitions={rtlDefinitionsWithAction} />
219
+ </section>
220
+ ))}
221
+ </div>
222
+ );
223
+ },
224
+ ...withRTLDiff({
225
+ i18n: {
226
+ fullName: { en: 'Full name', ar: 'الاسم الكامل' },
227
+ customerName: { en: 'Alice Smith', ar: 'أليس سميث' },
228
+ amountSent: { en: 'Amount sent', ar: 'المبلغ المُرسل' },
229
+ amountValue: { en: '1,234.56 GBP', ar: '1,234.56 جنيه إسترليني' },
230
+ transferStatus: { en: 'Transfer status', ar: 'حالة التحويل' },
231
+ statusValue: { en: 'Completed successfully', ar: 'اكتمل بنجاح' },
232
+ editAction: { en: 'Edit', ar: 'تعديل' },
233
+ viewDetailsAction: { en: 'View details', ar: 'عرض التفاصيل' },
234
+ withActionButtons: { en: 'with action buttons', ar: 'مع أزرار الإجراءات' },
235
+ },
236
+ }),
221
237
  };
@@ -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 Drawer from '..';
5
5
 
6
6
  export default {
@@ -11,48 +11,75 @@ export default {
11
11
 
12
12
  type Story = StoryObj<typeof Drawer>;
13
13
 
14
- const iframeDiff = withRTLDiff({ renderAs: 'iframe' });
15
-
16
14
  export const PositionRight: Story = {
17
- render: () => (
18
- <Drawer
19
- open
20
- position="right"
21
- headerTitle="Drawer title"
22
- footerContent={<button type="button">Done</button>}
23
- onClose={() => {}}
24
- >
25
- <p>Drawer body content.</p>
26
- </Drawer>
27
- ),
28
- ...iframeDiff,
15
+ render: () => {
16
+ const i18n = useRtlDiffI18n();
17
+ return (
18
+ <Drawer
19
+ open
20
+ position="right"
21
+ headerTitle={i18n.title}
22
+ footerContent={<button type="button">{i18n.done}</button>}
23
+ onClose={() => {}}
24
+ >
25
+ <p>{i18n.body}</p>
26
+ </Drawer>
27
+ );
28
+ },
29
+ ...withRTLDiff({
30
+ renderAs: 'iframe',
31
+ i18n: {
32
+ title: { en: 'Drawer title', ar: 'عنوان اللوحة' },
33
+ done: { en: 'Done', ar: 'تم' },
34
+ body: { en: 'Drawer body content.', ar: 'محتوى اللوحة الجانبية.' },
35
+ },
36
+ }),
29
37
  };
30
38
 
31
39
  export const PositionLeft: Story = {
32
- render: () => (
33
- <Drawer
34
- open
35
- position="left"
36
- headerTitle="Left drawer title"
37
- footerContent={<button type="button">Done</button>}
38
- onClose={() => {}}
39
- >
40
- <p>Left drawer body content.</p>
41
- </Drawer>
42
- ),
43
- ...iframeDiff,
40
+ render: () => {
41
+ const i18n = useRtlDiffI18n();
42
+ return (
43
+ <Drawer
44
+ open
45
+ position="left"
46
+ headerTitle={i18n.title}
47
+ footerContent={<button type="button">{i18n.done}</button>}
48
+ onClose={() => {}}
49
+ >
50
+ <p>{i18n.body}</p>
51
+ </Drawer>
52
+ );
53
+ },
54
+ ...withRTLDiff({
55
+ renderAs: 'iframe',
56
+ i18n: {
57
+ title: { en: 'Left drawer title', ar: 'عنوان اللوحة اليسرى' },
58
+ done: { en: 'Done', ar: 'تم' },
59
+ body: { en: 'Left drawer body content.', ar: 'محتوى اللوحة اليسرى.' },
60
+ },
61
+ }),
44
62
  };
45
63
 
46
64
  export const WithoutTitle: Story = {
47
- render: () => (
48
- <Drawer
49
- open
50
- position="right"
51
- footerContent={<button type="button">Done</button>}
52
- onClose={() => {}}
53
- >
54
- <p>No title drawer content.</p>
55
- </Drawer>
56
- ),
57
- ...iframeDiff,
65
+ render: () => {
66
+ const i18n = useRtlDiffI18n();
67
+ return (
68
+ <Drawer
69
+ open
70
+ position="right"
71
+ footerContent={<button type="button">{i18n.done}</button>}
72
+ onClose={() => {}}
73
+ >
74
+ <p>{i18n.body}</p>
75
+ </Drawer>
76
+ );
77
+ },
78
+ ...withRTLDiff({
79
+ renderAs: 'iframe',
80
+ i18n: {
81
+ done: { en: 'Done', ar: 'تم' },
82
+ body: { en: 'No title drawer content.', ar: 'محتوى لوحة بدون عنوان.' },
83
+ },
84
+ }),
58
85
  };