@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.
- package/build/Snackbar/Snackbar.js +98 -101
- package/build/Snackbar/Snackbar.js.map +1 -1
- package/build/Snackbar/Snackbar.mjs +99 -102
- package/build/Snackbar/Snackbar.mjs.map +1 -1
- package/build/Snackbar/SnackbarProvider.js +2 -6
- package/build/Snackbar/SnackbarProvider.js.map +1 -1
- package/build/Snackbar/SnackbarProvider.mjs +2 -6
- package/build/Snackbar/SnackbarProvider.mjs.map +1 -1
- package/build/index.js +0 -2
- package/build/index.js.map +1 -1
- package/build/index.mjs +0 -1
- package/build/index.mjs.map +1 -1
- package/build/types/Body/Body.d.ts +2 -2
- package/build/types/Carousel/_stories/constants.d.ts +25 -0
- package/build/types/Carousel/_stories/constants.d.ts.map +1 -1
- package/build/types/IconButton/IconButton.d.ts +1 -1
- package/build/types/ListItem/_stories/variants/helpers.d.ts +38 -1
- package/build/types/ListItem/_stories/variants/helpers.d.ts.map +1 -1
- package/build/types/MoneyInput/MoneyInput.d.ts +1 -1
- package/build/types/MoneyInput/MoneyInput.d.ts.map +1 -1
- package/build/types/Snackbar/Snackbar.d.ts +2 -16
- package/build/types/Snackbar/Snackbar.d.ts.map +1 -1
- package/build/types/Snackbar/SnackbarProvider.d.ts.map +1 -1
- package/build/types/Title/Title.d.ts +2 -2
- package/build/types/Upload/Steps/UploadImageStep/UploadImageStep.d.ts +1 -1
- package/build/types/UploadInput/UploadItem/UploadItemLink.d.ts +1 -1
- package/build/types/index.d.ts +0 -1
- package/build/types/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/Accordion/_stories/Accordion.test.story.tsx +74 -48
- package/src/AvatarLayout/_stories/AvatarLayout.test.story.tsx +46 -30
- package/src/Button/LegacyButton/_stories/LegacyButton.test.story.tsx +29 -19
- package/src/Button/_stories/Button.test.story.tsx +96 -62
- package/src/Calendar/_stories/Calendar.test.story.tsx +34 -21
- package/src/Carousel/_stories/Carousel.test.story.tsx +18 -8
- package/src/Carousel/_stories/constants.tsx +29 -4
- package/src/Checkbox/_stories/Checkbox.test.story.tsx +22 -13
- package/src/CheckboxButton/_stories/CheckboxButton.test.story.tsx +23 -14
- package/src/Chips/_stories/Chips.test.story.tsx +51 -36
- package/src/DateInput/_stories/DateInput.rtl.test.story.tsx +62 -12
- package/src/DateLookup/_stories/DateLookup.rtl.test.story.tsx +2 -2
- package/src/Decision/_stories/Decision.test.story.tsx +74 -58
- package/src/DefinitionList/_stories/DefinitionList.test.story.tsx +58 -42
- package/src/Drawer/_stories/Drawer.rtl.test.story.tsx +65 -38
- package/src/ExpressiveMoneyInput/_stories/ExpressiveMoneyInput.rtl.test.story.tsx +107 -74
- package/src/Field/_stories/Field.test.story.tsx +18 -18
- package/src/FlowNavigation/_stories/FlowNavigation.rtl.test.story.tsx +81 -51
- package/src/Header/_stories/Header.test.story.tsx +30 -18
- package/src/Info/_stories/Info.rtl.test.story.tsx +124 -50
- package/src/InputWithDisplayFormat/_stories/InputWithDisplayFormat.test.story.tsx +4 -4
- package/src/Inputs/InputGroup/_stories/InputGroup.test.story.tsx +9 -8
- package/src/Inputs/SearchInput/_stories/SearchInput.test.story.tsx +5 -3
- package/src/Inputs/SelectInput/_stories/SelectInput.rtl.test.story.tsx +108 -79
- package/src/Inputs/TextArea/_stories/TextArea.test.story.tsx +10 -10
- package/src/InstructionsList/_stories/InstructionsList.test.story.tsx +43 -16
- package/src/Label/_stories/Label.test.story.tsx +7 -7
- package/src/Link/_stories/Link.test.story.tsx +27 -13
- package/src/ListItem/_stories/ListItem.rtl.test.story.tsx +126 -6
- package/src/ListItem/_stories/variants/helpers.tsx +174 -126
- package/src/Loader/_stories/Loader.test.story.tsx +17 -10
- package/src/Modal/_stories/Modal.rtl.test.story.tsx +58 -39
- package/src/MoneyInput/_stories/MoneyInput.rtl.test.story.tsx +21 -3
- package/src/Nudge/_stories/Nudge.test.story.tsx +70 -21
- package/src/PhoneNumberInput/_stories/PhoneNumberInput.rtl.test.story.tsx +1 -1
- package/src/Popover/_stories/Popover.rtl.test.story.tsx +92 -49
- package/src/ProgressBar/_stories/ProgressBar.test.story.tsx +6 -6
- package/src/PromoCard/_stories/PromoCard.test.story.tsx +53 -29
- package/src/PromoCard/_stories/PromoCardGroup.test.story.tsx +60 -36
- package/src/Prompt/ActionPrompt/_stories/ActionPrompt.test.story.tsx +74 -38
- package/src/Prompt/CriticalBanner/_stories/CriticalBanner.test.story.tsx +68 -31
- package/src/Prompt/InfoPrompt/_stories/InfoPrompt.test.story.tsx +52 -22
- package/src/Prompt/InlinePrompt/_stories/InlinePrompt.test.story.tsx +36 -21
- package/src/Radio/_stories/Radio.test.story.tsx +60 -46
- package/src/RadioGroup/_stories/RadioGroup.test.story.tsx +70 -51
- package/src/Section/_stories/Section.test.story.tsx +30 -14
- package/src/SegmentedControl/_stories/SegmentedControl.test.story.tsx +38 -15
- package/src/SlidingPanel/_stories/SlidingPanel.rtl.test.story.tsx +58 -34
- package/src/Snackbar/Snackbar.test.tsx +16 -0
- package/src/Snackbar/Snackbar.tsx +93 -90
- package/src/Snackbar/SnackbarProvider.tsx +4 -10
- package/src/Snackbar/_stories/Snackbar.rtl.test.story.tsx +24 -12
- package/src/Stepper/_stories/Stepper.test.story.tsx +27 -9
- package/src/Switch/_stories/Switch.test.story.tsx +20 -12
- package/src/Table/_stories/Table.test.story.tsx +107 -86
- package/src/Tabs/_stories/Tabs.test.story.tsx +92 -52
- package/src/Tag/_stories/Tag.test.story.tsx +27 -16
- package/src/TextareaWithDisplayFormat/_stories/TextareaWithDisplayFormat.test.story.tsx +4 -4
- package/src/Tooltip/_stories/Tooltip.rtl.test.story.tsx +68 -25
- package/src/Typeahead/_stories/Typeahead.rtl.test.story.tsx +4 -4
- package/src/Upload/_stories/Upload.rtl.test.story.tsx +49 -26
- package/src/UploadInput/_stories/UploadInput.test.story.tsx +63 -41
- package/src/_deprecated/Alert/_stories/Alert.test.story.tsx +45 -24
- package/src/_deprecated/Card/_stories/Card.test.story.tsx +47 -23
- package/src/_deprecated/CriticalBanner/_stories/CriticalCommsBanner.test.story.tsx +21 -15
- package/src/_deprecated/InlineAlert/_stories/InlineAlert.test.story.tsx +23 -12
- package/src/_deprecated/Select/_stories/Select.rtl.test.story.tsx +78 -42
- package/src/common/BottomSheet/_stories/BottomSheet.test.story.tsx +38 -20
- package/src/common/Panel/_stories/Panel.rtl.test.story.tsx +135 -51
- 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
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
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: () =>
|
|
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({
|
|
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: {
|
|
19
|
-
placeholder: {
|
|
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
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
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
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
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
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
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
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
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
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
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
|
};
|