@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.
- package/build/Snackbar/Snackbar.js +97 -101
- package/build/Snackbar/Snackbar.js.map +1 -1
- package/build/Snackbar/Snackbar.mjs +98 -102
- package/build/Snackbar/Snackbar.mjs.map +1 -1
- package/build/types/Carousel/_stories/constants.d.ts +25 -0
- package/build/types/Carousel/_stories/constants.d.ts.map +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/Snackbar/Snackbar.d.ts +1 -15
- package/build/types/Snackbar/Snackbar.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/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/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 +1 -1
- 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/Inputs/InputGroup/_stories/InputGroup.test.story.tsx +4 -2
- package/src/Inputs/SelectInput/_stories/SelectInput.rtl.test.story.tsx +106 -77
- package/src/InstructionsList/_stories/InstructionsList.test.story.tsx +43 -16
- 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 +14 -2
- package/src/Nudge/_stories/Nudge.test.story.tsx +70 -21
- package/src/Popover/_stories/Popover.rtl.test.story.tsx +92 -49
- 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.tsx +90 -88
- 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/Tooltip/_stories/Tooltip.rtl.test.story.tsx +68 -25
- package/src/Typeahead/_stories/Typeahead.rtl.test.story.tsx +3 -3
- 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 +76 -40
- package/src/common/BottomSheet/_stories/BottomSheet.test.story.tsx +38 -20
- package/src/common/Panel/_stories/Panel.rtl.test.story.tsx +135 -51
|
@@ -2,7 +2,7 @@ import type { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
|
2
2
|
import { userEvent } from 'storybook/test';
|
|
3
3
|
import { useState } from 'react';
|
|
4
4
|
|
|
5
|
-
import { withRTLDiff } from '../../../.storybook/decorators/RtlDiffDecorator';
|
|
5
|
+
import { useRtlDiffI18n, withRTLDiff } from '../../../.storybook/decorators/RtlDiffDecorator';
|
|
6
6
|
import { withVariantConfig } from '../../../.storybook/helpers';
|
|
7
7
|
import Chips, { type ChipValue } from '../Chips';
|
|
8
8
|
|
|
@@ -143,40 +143,55 @@ export const Zoom400: Story = {
|
|
|
143
143
|
...withVariantConfig(['400%']),
|
|
144
144
|
};
|
|
145
145
|
|
|
146
|
-
const categoryChips = [
|
|
147
|
-
{ value: 'all', label: 'All' },
|
|
148
|
-
{ value: 'accounting', label: 'Accounting' },
|
|
149
|
-
{ value: 'payroll', label: 'Payroll' },
|
|
150
|
-
{ value: 'payments', label: 'Payments' },
|
|
151
|
-
];
|
|
152
|
-
|
|
153
|
-
const amountChips = [
|
|
154
|
-
{ value: 100, label: '100 GBP' },
|
|
155
|
-
{ value: 200, label: '200 GBP' },
|
|
156
|
-
{ value: 300, label: '300 GBP' },
|
|
157
|
-
{ value: 500, label: '500 GBP+' },
|
|
158
|
-
];
|
|
159
|
-
|
|
160
146
|
export const RTLDiff: Story = {
|
|
161
|
-
render: () =>
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
{
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
147
|
+
render: () => {
|
|
148
|
+
const i18n = useRtlDiffI18n();
|
|
149
|
+
const categoryChips = [
|
|
150
|
+
{ value: 'all', label: i18n.all },
|
|
151
|
+
{ value: 'accounting', label: i18n.accounting },
|
|
152
|
+
{ value: 'payroll', label: i18n.payroll },
|
|
153
|
+
{ value: 'payments', label: i18n.payments },
|
|
154
|
+
];
|
|
155
|
+
const amountChips = [
|
|
156
|
+
{ value: 100, label: i18n.amount100 },
|
|
157
|
+
{ value: 200, label: i18n.amount200 },
|
|
158
|
+
{ value: 300, label: i18n.amount300 },
|
|
159
|
+
{ value: 500, label: i18n.amount500Plus },
|
|
160
|
+
];
|
|
161
|
+
|
|
162
|
+
return (
|
|
163
|
+
<>
|
|
164
|
+
{/* Choice mode: chip row order reverses in RTL */}
|
|
165
|
+
<Chips
|
|
166
|
+
chips={amountChips}
|
|
167
|
+
selected={300}
|
|
168
|
+
multiple={false}
|
|
169
|
+
aria-label={i18n.transferAmount}
|
|
170
|
+
onChange={() => undefined}
|
|
171
|
+
/>
|
|
172
|
+
{/* Filter mode: selected chips show close button on trailing end */}
|
|
173
|
+
<Chips
|
|
174
|
+
chips={categoryChips}
|
|
175
|
+
selected={['accounting', 'payments']}
|
|
176
|
+
multiple
|
|
177
|
+
aria-label={i18n.categoryFilter}
|
|
178
|
+
onChange={() => undefined}
|
|
179
|
+
/>
|
|
180
|
+
</>
|
|
181
|
+
);
|
|
182
|
+
},
|
|
183
|
+
...withRTLDiff({
|
|
184
|
+
i18n: {
|
|
185
|
+
all: { en: 'All', ar: 'الكل' },
|
|
186
|
+
accounting: { en: 'Accounting', ar: 'المحاسبة' },
|
|
187
|
+
payroll: { en: 'Payroll', ar: 'الرواتب' },
|
|
188
|
+
payments: { en: 'Payments', ar: 'المدفوعات' },
|
|
189
|
+
amount100: { en: '100 GBP', ar: '100 جنيه إسترليني' },
|
|
190
|
+
amount200: { en: '200 GBP', ar: '200 جنيه إسترليني' },
|
|
191
|
+
amount300: { en: '300 GBP', ar: '300 جنيه إسترليني' },
|
|
192
|
+
amount500Plus: { en: '500 GBP+', ar: '+500 جنيه إسترليني' },
|
|
193
|
+
transferAmount: { en: 'Transfer amount', ar: 'مبلغ التحويل' },
|
|
194
|
+
categoryFilter: { en: 'Category filter', ar: 'تصفية الفئات' },
|
|
195
|
+
},
|
|
196
|
+
}),
|
|
182
197
|
};
|
|
@@ -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
|
};
|
|
@@ -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
|
};
|