@transferwise/components 46.165.0 → 46.165.1
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/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 +1 -15
- package/build/types/Snackbar/Snackbar.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/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 +91 -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/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
|
@@ -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
|
-
|
|
137
|
-
|
|
138
|
-
title=
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
title=
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
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
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
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({
|
|
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
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
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({
|
|
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
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
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({
|
|
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
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
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({
|
|
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
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
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({
|
|
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
|
};
|
|
@@ -73,12 +73,12 @@ export const RTLDiff: StoryObj<typeof InputWithDisplayFormat> = {
|
|
|
73
73
|
width: 'stretch',
|
|
74
74
|
i18n: {
|
|
75
75
|
value: {
|
|
76
|
-
|
|
77
|
-
|
|
76
|
+
en: 'XKQMRTBWJNFL',
|
|
77
|
+
ar: 'خكقمرتبوجنفل',
|
|
78
78
|
},
|
|
79
79
|
placeholder: {
|
|
80
|
-
|
|
81
|
-
|
|
80
|
+
en: 'Enter code',
|
|
81
|
+
ar: 'أدخل الرمز',
|
|
82
82
|
},
|
|
83
83
|
},
|
|
84
84
|
}),
|
|
@@ -39,7 +39,7 @@ export const RTLDiff: Story = {
|
|
|
39
39
|
addonEnd={{
|
|
40
40
|
content: (
|
|
41
41
|
<Button v2 size="sm">
|
|
42
|
-
|
|
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
|
-
|
|
60
|
+
{i18n.clear}
|
|
61
61
|
</Button>
|
|
62
62
|
),
|
|
63
63
|
interactive: true,
|
|
@@ -70,11 +70,12 @@ export const RTLDiff: Story = {
|
|
|
70
70
|
);
|
|
71
71
|
},
|
|
72
72
|
...withRTLDiff({
|
|
73
|
-
i18n:{
|
|
74
|
-
placeholder_both: {
|
|
75
|
-
placeholder_start: {
|
|
76
|
-
placeholder_end: {
|
|
77
|
-
|
|
78
|
-
|
|
73
|
+
i18n: {
|
|
74
|
+
placeholder_both: { en: 'addonStart and addonEnd', ar: 'البادئة والنهاية' },
|
|
75
|
+
placeholder_start: { en: 'addonStart only', ar: 'البادئة فقط' },
|
|
76
|
+
placeholder_end: { en: 'addonEnd only', ar: 'النهاية فقط' },
|
|
77
|
+
copy: { en: 'Copy', ar: 'نسخ' },
|
|
78
|
+
clear: { en: 'Clear', ar: 'مسح' },
|
|
79
|
+
},
|
|
79
80
|
}),
|
|
80
81
|
};
|
|
@@ -18,94 +18,116 @@ interface RtlCurrency {
|
|
|
18
18
|
name: string;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
{ code: '
|
|
24
|
-
{ code: '
|
|
21
|
+
/** Currency codes stay Latin — only the full names are localised. */
|
|
22
|
+
const getRtlCurrencies = (i18n: Record<string, string>): RtlCurrency[] => [
|
|
23
|
+
{ code: 'USD', name: i18n.usDollar },
|
|
24
|
+
{ code: 'EUR', name: i18n.euro },
|
|
25
|
+
{ code: 'GBP', name: i18n.britishPound },
|
|
25
26
|
];
|
|
26
27
|
|
|
28
|
+
const currencyNames = {
|
|
29
|
+
usDollar: { en: 'United States Dollar', ar: 'الدولار الأمريكي' },
|
|
30
|
+
euro: { en: 'Euro', ar: 'اليورو' },
|
|
31
|
+
britishPound: { en: 'British pound', ar: 'الجنيه الإسترليني' },
|
|
32
|
+
};
|
|
33
|
+
|
|
27
34
|
export const TriggerVariants: Story = {
|
|
28
|
-
render: () =>
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
<SelectInput
|
|
32
|
-
size="sm"
|
|
33
|
-
placeholder="Select currency"
|
|
34
|
-
items={rtlCurrencies.map((currency) => ({ type: 'option', value: currency }))}
|
|
35
|
-
renderValue={(currency) => <SelectInputOptionContent title={currency.code} />}
|
|
36
|
-
/>
|
|
35
|
+
render: () => {
|
|
36
|
+
const i18n = useRtlDiffI18n();
|
|
37
|
+
const rtlCurrencies = getRtlCurrencies(i18n);
|
|
37
38
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
39
|
+
return (
|
|
40
|
+
<>
|
|
41
|
+
{/* sm — chevron position flips in RTL */}
|
|
42
|
+
<SelectInput
|
|
43
|
+
size="sm"
|
|
44
|
+
placeholder={i18n.selectCurrency}
|
|
45
|
+
items={rtlCurrencies.map((currency) => ({ type: 'option', value: currency }))}
|
|
46
|
+
renderValue={(currency) => <SelectInputOptionContent title={currency.code} />}
|
|
47
|
+
/>
|
|
45
48
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
<SelectInputOptionContent
|
|
54
|
-
title={currency.code}
|
|
55
|
-
note={currency.name}
|
|
56
|
-
icon={<Flag code={currency.code} intrinsicSize={24} />}
|
|
57
|
-
/>
|
|
58
|
-
)}
|
|
59
|
-
/>
|
|
49
|
+
{/* md — chevron position flips in RTL */}
|
|
50
|
+
<SelectInput
|
|
51
|
+
size="md"
|
|
52
|
+
placeholder={i18n.selectCurrency}
|
|
53
|
+
items={rtlCurrencies.map((currency) => ({ type: 'option', value: currency }))}
|
|
54
|
+
renderValue={(currency) => <SelectInputOptionContent title={currency.code} />}
|
|
55
|
+
/>
|
|
60
56
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
)
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
57
|
+
{/* lg with value and leading icon — icon side and chevron flip in RTL */}
|
|
58
|
+
<SelectInput
|
|
59
|
+
size="lg"
|
|
60
|
+
placeholder={i18n.selectCurrency}
|
|
61
|
+
defaultValue={rtlCurrencies[0]}
|
|
62
|
+
items={rtlCurrencies.map((currency) => ({ type: 'option', value: currency }))}
|
|
63
|
+
renderValue={(currency) => (
|
|
64
|
+
<SelectInputOptionContent
|
|
65
|
+
title={currency.code}
|
|
66
|
+
note={currency.name}
|
|
67
|
+
icon={<Flag code={currency.code} intrinsicSize={24} />}
|
|
68
|
+
/>
|
|
69
|
+
)}
|
|
70
|
+
/>
|
|
71
|
+
|
|
72
|
+
{/* multiple — selected values on leading side, chevron on trailing side, both flip in RTL */}
|
|
73
|
+
<SelectInput
|
|
74
|
+
size="lg"
|
|
75
|
+
multiple
|
|
76
|
+
placeholder={i18n.chooseCurrencies}
|
|
77
|
+
defaultValue={[rtlCurrencies[0], rtlCurrencies[1]]}
|
|
78
|
+
items={rtlCurrencies.map((currency) => ({ type: 'option', value: currency }))}
|
|
79
|
+
renderValue={(currency, withinTrigger) =>
|
|
80
|
+
withinTrigger ? (
|
|
81
|
+
currency.code
|
|
82
|
+
) : (
|
|
83
|
+
<SelectInputOptionContent title={currency.code} note={currency.name} />
|
|
84
|
+
)
|
|
85
|
+
}
|
|
86
|
+
/>
|
|
87
|
+
</>
|
|
88
|
+
);
|
|
89
|
+
},
|
|
90
|
+
...withRTLDiff({
|
|
91
|
+
i18n: {
|
|
92
|
+
...currencyNames,
|
|
93
|
+
selectCurrency: { en: 'Select currency', ar: 'اختر العملة' },
|
|
94
|
+
chooseCurrencies: { en: 'Choose currencies', ar: 'اختر العملات' },
|
|
95
|
+
},
|
|
96
|
+
}),
|
|
79
97
|
};
|
|
80
98
|
|
|
81
|
-
const
|
|
82
|
-
{ code: 'CAD', name:
|
|
83
|
-
{ code: 'AUD', name:
|
|
84
|
-
{ code: 'JPY', name:
|
|
99
|
+
const getOtherCurrencies = (i18n: Record<string, string>): RtlCurrency[] => [
|
|
100
|
+
{ code: 'CAD', name: i18n.canadianDollar },
|
|
101
|
+
{ code: 'AUD', name: i18n.australianDollar },
|
|
102
|
+
{ code: 'JPY', name: i18n.japaneseYen },
|
|
85
103
|
];
|
|
86
104
|
|
|
87
|
-
const
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
type: '
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
})),
|
|
96
|
-
},
|
|
97
|
-
{
|
|
98
|
-
type: 'group' as const,
|
|
99
|
-
label: 'All currencies',
|
|
100
|
-
options: [...rtlCurrencies, ...otherCurrencies]
|
|
101
|
-
.sort((a, b) => a.code.localeCompare(b.code))
|
|
102
|
-
.map((currency) => ({
|
|
105
|
+
const getGroupedItems = (i18n: Record<string, string>) => {
|
|
106
|
+
const rtlCurrencies = getRtlCurrencies(i18n);
|
|
107
|
+
|
|
108
|
+
return [
|
|
109
|
+
{
|
|
110
|
+
type: 'group' as const,
|
|
111
|
+
label: i18n.popularCurrencies,
|
|
112
|
+
options: rtlCurrencies.map((currency) => ({
|
|
103
113
|
type: 'option' as const,
|
|
104
114
|
value: currency,
|
|
105
115
|
filterMatchers: [currency.code, currency.name],
|
|
106
116
|
})),
|
|
107
|
-
|
|
108
|
-
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
type: 'group' as const,
|
|
120
|
+
label: i18n.allCurrencies,
|
|
121
|
+
options: [...rtlCurrencies, ...getOtherCurrencies(i18n)]
|
|
122
|
+
.sort((a, b) => a.code.localeCompare(b.code))
|
|
123
|
+
.map((currency) => ({
|
|
124
|
+
type: 'option' as const,
|
|
125
|
+
value: currency,
|
|
126
|
+
filterMatchers: [currency.code, currency.name],
|
|
127
|
+
})),
|
|
128
|
+
},
|
|
129
|
+
];
|
|
130
|
+
};
|
|
109
131
|
|
|
110
132
|
export const OpenDropdown: Story = {
|
|
111
133
|
render: () => {
|
|
@@ -115,9 +137,9 @@ export const OpenDropdown: Story = {
|
|
|
115
137
|
size="lg"
|
|
116
138
|
filterable
|
|
117
139
|
filterPlaceholder={i18n.filterPlaceholder}
|
|
118
|
-
placeholder=
|
|
119
|
-
defaultValue={
|
|
120
|
-
items={
|
|
140
|
+
placeholder={i18n.selectCurrency}
|
|
141
|
+
defaultValue={getRtlCurrencies(i18n)[0]}
|
|
142
|
+
items={getGroupedItems(i18n)}
|
|
121
143
|
renderValue={(currency, withinTrigger) => (
|
|
122
144
|
<SelectInputOptionContent
|
|
123
145
|
title={currency.code}
|
|
@@ -138,10 +160,17 @@ export const OpenDropdown: Story = {
|
|
|
138
160
|
renderAs: 'iframe',
|
|
139
161
|
width: '80%',
|
|
140
162
|
i18n: {
|
|
163
|
+
...currencyNames,
|
|
141
164
|
filterPlaceholder: {
|
|
142
|
-
|
|
143
|
-
|
|
165
|
+
en: 'Type a currency / country',
|
|
166
|
+
ar: 'اكتب عملة / دولة',
|
|
144
167
|
},
|
|
168
|
+
selectCurrency: { en: 'Select currency', ar: 'اختر العملة' },
|
|
169
|
+
popularCurrencies: { en: 'Popular currencies', ar: 'العملات الشائعة' },
|
|
170
|
+
allCurrencies: { en: 'All currencies', ar: 'جميع العملات' },
|
|
171
|
+
canadianDollar: { en: 'Canadian dollar', ar: 'الدولار الكندي' },
|
|
172
|
+
australianDollar: { en: 'Australian dollar', ar: 'الدولار الأسترالي' },
|
|
173
|
+
japaneseYen: { en: 'Japanese yen', ar: 'الين الياباني' },
|
|
145
174
|
},
|
|
146
175
|
}),
|
|
147
176
|
};
|
|
@@ -170,23 +170,23 @@ export const RTLDiff: Story = {
|
|
|
170
170
|
...withRTLDiff({
|
|
171
171
|
width: 'stretch',
|
|
172
172
|
i18n: {
|
|
173
|
-
placeholder: {
|
|
173
|
+
placeholder: { en: 'Translated placeholder...', ar: 'نص بديل مترجم...' },
|
|
174
174
|
value_en: {
|
|
175
|
-
|
|
176
|
-
|
|
175
|
+
en: 'This is LTR text content in the RTL textarea field, showing the input adapting to the content rather than page setting.',
|
|
176
|
+
ar: 'This is LTR text content in the RTL textarea field, showing the input adapting to the content rather than page setting.',
|
|
177
177
|
},
|
|
178
178
|
value_ar: {
|
|
179
|
-
|
|
180
|
-
|
|
179
|
+
en: 'This is some entered text content in the textarea field.',
|
|
180
|
+
ar: 'هذا هو بعض المحتوى النصي المدخل في حقل منطقة النص.',
|
|
181
181
|
},
|
|
182
182
|
errorMessage: {
|
|
183
|
-
|
|
184
|
-
|
|
183
|
+
en: 'This field has an error message',
|
|
184
|
+
ar: 'هذا الحقل يحتوي على رسالة خطأ',
|
|
185
185
|
},
|
|
186
|
-
invalidInputText: {
|
|
186
|
+
invalidInputText: { en: 'Invalid input text', ar: 'نص الإدخال غير صالح' },
|
|
187
187
|
characterCounter: {
|
|
188
|
-
|
|
189
|
-
|
|
188
|
+
en: 'Text with a character counter displayed below.',
|
|
189
|
+
ar: 'نص مع عداد أحرف معروض أدناه.',
|
|
190
190
|
},
|
|
191
191
|
},
|
|
192
192
|
}),
|
|
@@ -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 InstructionsList from '..';
|
|
5
5
|
|
|
6
6
|
export default {
|
|
@@ -12,19 +12,46 @@ export default {
|
|
|
12
12
|
type Story = StoryObj<typeof InstructionsList>;
|
|
13
13
|
|
|
14
14
|
export const RTLDiff: Story = {
|
|
15
|
-
render: () =>
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
15
|
+
render: () => {
|
|
16
|
+
const i18n = useRtlDiffI18n();
|
|
17
|
+
return (
|
|
18
|
+
<>
|
|
19
|
+
<InstructionsList
|
|
20
|
+
dos={[i18n.initialTransfer, i18n.inviteFriends]}
|
|
21
|
+
donts={[i18n.hiddenFees, i18n.badExchangeRate]}
|
|
22
|
+
sort="dosFirst"
|
|
23
|
+
/>
|
|
24
|
+
<InstructionsList
|
|
25
|
+
dos={[i18n.verifyProfile]}
|
|
26
|
+
donts={[i18n.shareCredentials]}
|
|
27
|
+
sort="dontsFirst"
|
|
28
|
+
/>
|
|
29
|
+
</>
|
|
30
|
+
);
|
|
31
|
+
},
|
|
32
|
+
...withRTLDiff({
|
|
33
|
+
i18n: {
|
|
34
|
+
initialTransfer: {
|
|
35
|
+
en: 'Do an initial money transfer',
|
|
36
|
+
ar: 'قم بإجراء تحويل أموال أولي',
|
|
37
|
+
},
|
|
38
|
+
inviteFriends: {
|
|
39
|
+
en: 'Invite at least 3 friends to join',
|
|
40
|
+
ar: 'ادعُ 3 أصدقاء على الأقل للانضمام',
|
|
41
|
+
},
|
|
42
|
+
hiddenFees: {
|
|
43
|
+
en: 'Paying extra hidden fees for transfers',
|
|
44
|
+
ar: 'دفع رسوم خفية إضافية على التحويلات',
|
|
45
|
+
},
|
|
46
|
+
badExchangeRate: { en: 'Use bad exchange rate', ar: 'استخدام سعر صرف سيئ' },
|
|
47
|
+
verifyProfile: {
|
|
48
|
+
en: 'Complete your profile verification',
|
|
49
|
+
ar: 'أكمل التحقق من ملفك الشخصي',
|
|
50
|
+
},
|
|
51
|
+
shareCredentials: {
|
|
52
|
+
en: 'Share your login credentials with others',
|
|
53
|
+
ar: 'مشاركة بيانات تسجيل دخولك مع الآخرين',
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
}),
|
|
30
57
|
};
|