@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
|
@@ -4,7 +4,7 @@ import { useState } from 'react';
|
|
|
4
4
|
|
|
5
5
|
import Button from '../..';
|
|
6
6
|
import LegacyButton from '../LegacyButton';
|
|
7
|
-
import { withRTLDiff } from '../../../../.storybook/decorators/RtlDiffDecorator';
|
|
7
|
+
import { useRtlDiffI18n, withRTLDiff } from '../../../../.storybook/decorators/RtlDiffDecorator';
|
|
8
8
|
|
|
9
9
|
LegacyButton.displayName = 'Button';
|
|
10
10
|
|
|
@@ -38,22 +38,32 @@ export const Focused: Story = {
|
|
|
38
38
|
};
|
|
39
39
|
|
|
40
40
|
export const RTLDiff: Story = {
|
|
41
|
-
render: () =>
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
41
|
+
render: () => {
|
|
42
|
+
const i18n = useRtlDiffI18n();
|
|
43
|
+
return (
|
|
44
|
+
<>
|
|
45
|
+
{/* default (inline) layout */}
|
|
46
|
+
<LegacyButton>{i18n.defaultButton}</LegacyButton>
|
|
47
|
+
|
|
48
|
+
{/* block layout — full width */}
|
|
49
|
+
<LegacyButton block>{i18n.blockButton}</LegacyButton>
|
|
50
|
+
|
|
51
|
+
{/* loading state — appends ProcessIndicator inside button */}
|
|
52
|
+
<LegacyButton loading>{i18n.loadingButton}</LegacyButton>
|
|
53
|
+
|
|
54
|
+
{/* loading + block combined */}
|
|
55
|
+
<LegacyButton loading block>
|
|
56
|
+
{i18n.loadingBlockButton}
|
|
57
|
+
</LegacyButton>
|
|
58
|
+
</>
|
|
59
|
+
);
|
|
60
|
+
},
|
|
61
|
+
...withRTLDiff({
|
|
62
|
+
i18n: {
|
|
63
|
+
defaultButton: { en: 'Default button', ar: 'زر افتراضي' },
|
|
64
|
+
blockButton: { en: 'Block button', ar: 'زر بعرض كامل' },
|
|
65
|
+
loadingButton: { en: 'Loading button', ar: 'زر قيد التحميل' },
|
|
66
|
+
loadingBlockButton: { en: 'Loading block button', ar: 'زر بعرض كامل قيد التحميل' },
|
|
67
|
+
},
|
|
68
|
+
}),
|
|
59
69
|
};
|
|
@@ -5,7 +5,7 @@ import { expect, userEvent, within } from 'storybook/test';
|
|
|
5
5
|
import Button from '../Button.resolver';
|
|
6
6
|
import { ButtonPriority } from '../Button.types';
|
|
7
7
|
import { withVariantConfig } from '../../../.storybook/helpers';
|
|
8
|
-
import { withRTLDiff } from '../../../.storybook/decorators/RtlDiffDecorator';
|
|
8
|
+
import { useRtlDiffI18n, withRTLDiff } from '../../../.storybook/decorators/RtlDiffDecorator';
|
|
9
9
|
|
|
10
10
|
const meta: Meta<typeof Button> = {
|
|
11
11
|
component: Button,
|
|
@@ -167,66 +167,100 @@ export const AccessibilityAddons: Story = {
|
|
|
167
167
|
},
|
|
168
168
|
};
|
|
169
169
|
|
|
170
|
+
type RTLDiffLabels = {
|
|
171
|
+
startIcon: string;
|
|
172
|
+
endIcon: string;
|
|
173
|
+
bothIcons: string;
|
|
174
|
+
avatarStart: string;
|
|
175
|
+
doubleAvatar: string;
|
|
176
|
+
smStartIcon: string;
|
|
177
|
+
smEndIcon: string;
|
|
178
|
+
smBothIcons: string;
|
|
179
|
+
loading: string;
|
|
180
|
+
blockWithStartIcon: string;
|
|
181
|
+
};
|
|
182
|
+
|
|
170
183
|
export const RTLDiff: Story = {
|
|
171
|
-
render: () =>
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
184
|
+
render: () => {
|
|
185
|
+
const i18n = useRtlDiffI18n<RTLDiffLabels>();
|
|
186
|
+
|
|
187
|
+
return (
|
|
188
|
+
<>
|
|
189
|
+
<Button v2 size="md" addonStart={{ type: 'icon', value: <Freeze /> }}>
|
|
190
|
+
{i18n.startIcon}
|
|
191
|
+
</Button>
|
|
192
|
+
|
|
193
|
+
<Button v2 size="md" addonEnd={{ type: 'icon', value: <ArrowEnd /> }}>
|
|
194
|
+
{i18n.endIcon}
|
|
195
|
+
</Button>
|
|
196
|
+
|
|
197
|
+
<Button
|
|
198
|
+
v2
|
|
199
|
+
size="md"
|
|
200
|
+
addonStart={{ type: 'icon', value: <Freeze /> }}
|
|
201
|
+
addonEnd={{ type: 'icon', value: <ArrowEnd /> }}
|
|
202
|
+
>
|
|
203
|
+
{i18n.bothIcons}
|
|
204
|
+
</Button>
|
|
205
|
+
|
|
206
|
+
<Button
|
|
207
|
+
v2
|
|
208
|
+
size="md"
|
|
209
|
+
addonStart={{ type: 'avatar', value: [{ asset: <Flag code="pl" /> }] }}
|
|
210
|
+
>
|
|
211
|
+
{i18n.avatarStart}
|
|
212
|
+
</Button>
|
|
213
|
+
|
|
214
|
+
<Button
|
|
215
|
+
v2
|
|
216
|
+
size="md"
|
|
217
|
+
addonStart={{
|
|
218
|
+
type: 'avatar',
|
|
219
|
+
value: [{ asset: <Flag code="gb" /> }, { asset: <Flag code="br" /> }],
|
|
220
|
+
}}
|
|
221
|
+
>
|
|
222
|
+
{i18n.doubleAvatar}
|
|
223
|
+
</Button>
|
|
224
|
+
|
|
225
|
+
<Button v2 size="sm" addonStart={{ type: 'icon', value: <Freeze /> }}>
|
|
226
|
+
{i18n.smStartIcon}
|
|
227
|
+
</Button>
|
|
228
|
+
|
|
229
|
+
<Button v2 size="sm" addonEnd={{ type: 'icon', value: <ArrowEnd /> }}>
|
|
230
|
+
{i18n.smEndIcon}
|
|
231
|
+
</Button>
|
|
232
|
+
|
|
233
|
+
<Button
|
|
234
|
+
v2
|
|
235
|
+
size="sm"
|
|
236
|
+
addonStart={{ type: 'icon', value: <Freeze /> }}
|
|
237
|
+
addonEnd={{ type: 'icon', value: <ArrowEnd /> }}
|
|
238
|
+
>
|
|
239
|
+
{i18n.smBothIcons}
|
|
240
|
+
</Button>
|
|
241
|
+
|
|
242
|
+
<Button v2 size="md" loading addonEnd={{ type: 'icon', value: <ArrowEnd /> }}>
|
|
243
|
+
{i18n.loading}
|
|
244
|
+
</Button>
|
|
245
|
+
|
|
246
|
+
<Button v2 size="md" block addonStart={{ type: 'icon', value: <Freeze /> }}>
|
|
247
|
+
{i18n.blockWithStartIcon}
|
|
248
|
+
</Button>
|
|
249
|
+
</>
|
|
250
|
+
);
|
|
251
|
+
},
|
|
252
|
+
...withRTLDiff({
|
|
253
|
+
i18n: {
|
|
254
|
+
startIcon: { en: 'Start icon', ar: 'أيقونة البداية' },
|
|
255
|
+
endIcon: { en: 'End icon', ar: 'أيقونة النهاية' },
|
|
256
|
+
bothIcons: { en: 'Both icons', ar: 'كلتا الأيقونتين' },
|
|
257
|
+
avatarStart: { en: 'Avatar start', ar: 'صورة رمزية في البداية' },
|
|
258
|
+
doubleAvatar: { en: 'Double avatar', ar: 'صورتان رمزيتان' },
|
|
259
|
+
smStartIcon: { en: 'Sm start icon', ar: 'أيقونة بداية صغيرة' },
|
|
260
|
+
smEndIcon: { en: 'Sm end icon', ar: 'أيقونة نهاية صغيرة' },
|
|
261
|
+
smBothIcons: { en: 'Sm both icons', ar: 'كلتا الأيقونتين صغيرة' },
|
|
262
|
+
loading: { en: 'Loading', ar: 'جارٍ التحميل' },
|
|
263
|
+
blockWithStartIcon: { en: 'Block with start icon', ar: 'زر بعرض كامل مع أيقونة البداية' },
|
|
264
|
+
},
|
|
265
|
+
}),
|
|
232
266
|
};
|
|
@@ -3,7 +3,11 @@ import { expect, waitFor, within, userEvent } from 'storybook/test';
|
|
|
3
3
|
|
|
4
4
|
import Calendar from '../Calendar';
|
|
5
5
|
import type { DisabledRules } from '../Calendar.types';
|
|
6
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
forEachColumn,
|
|
8
|
+
useRtlDiffI18n,
|
|
9
|
+
withRTLDiff,
|
|
10
|
+
} from '../../../.storybook/decorators/RtlDiffDecorator';
|
|
7
11
|
|
|
8
12
|
export default {
|
|
9
13
|
component: Calendar,
|
|
@@ -125,28 +129,30 @@ const maxDate = new Date(2024, 9, 31);
|
|
|
125
129
|
const disabledRulesRtl = {
|
|
126
130
|
weekdays: ['sat', 'sun'] as ('sat' | 'sun')[],
|
|
127
131
|
dates: [new Date(2024, 5, 10)],
|
|
128
|
-
reason: 'Weekends and specific dates are unavailable.',
|
|
129
132
|
};
|
|
130
133
|
|
|
131
134
|
export const RTLDiff: Story = {
|
|
132
|
-
render: () =>
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
135
|
+
render: () => {
|
|
136
|
+
const i18n = useRtlDiffI18n();
|
|
137
|
+
return (
|
|
138
|
+
<>
|
|
139
|
+
<div data-testid="day-view">
|
|
140
|
+
<Calendar
|
|
141
|
+
value={selectedDate}
|
|
142
|
+
min={minDate}
|
|
143
|
+
max={maxDate}
|
|
144
|
+
disabledRules={{ ...disabledRulesRtl, reason: i18n.disabledReason }}
|
|
145
|
+
/>
|
|
146
|
+
</div>
|
|
147
|
+
<div data-testid="month-view">
|
|
148
|
+
<Calendar value={selectedDate} min={minDate} max={maxDate} />
|
|
149
|
+
</div>
|
|
150
|
+
<div data-testid="year-view">
|
|
151
|
+
<Calendar value={selectedDate} min={minDate} max={maxDate} />
|
|
152
|
+
</div>
|
|
153
|
+
</>
|
|
154
|
+
);
|
|
155
|
+
},
|
|
150
156
|
play: async ({ canvasElement }) => {
|
|
151
157
|
await forEachColumn(canvasElement, async (column) => {
|
|
152
158
|
const monthContainer = column.querySelector('[data-testid="month-view"]')!;
|
|
@@ -159,5 +165,12 @@ export const RTLDiff: Story = {
|
|
|
159
165
|
await userEvent.click(yearScope.getByRole('button', { name: /year view/iu }));
|
|
160
166
|
});
|
|
161
167
|
},
|
|
162
|
-
...withRTLDiff(
|
|
168
|
+
...withRTLDiff({
|
|
169
|
+
i18n: {
|
|
170
|
+
disabledReason: {
|
|
171
|
+
en: 'Weekends and specific dates are unavailable.',
|
|
172
|
+
ar: 'عطلات نهاية الأسبوع وتواريخ محددة غير متاحة.',
|
|
173
|
+
},
|
|
174
|
+
},
|
|
175
|
+
}),
|
|
163
176
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
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 Carousel from '..';
|
|
5
|
-
import {
|
|
5
|
+
import { carouselCardsI18n, getStubbedCarouselCards } from './constants';
|
|
6
6
|
|
|
7
7
|
export default {
|
|
8
8
|
component: Carousel,
|
|
@@ -12,12 +12,22 @@ export default {
|
|
|
12
12
|
|
|
13
13
|
type Story = StoryObj<typeof Carousel>;
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
];
|
|
15
|
+
/** Doubled so the track overflows and both scroll buttons render. */
|
|
16
|
+
const getManyCards = (i18n: Record<string, string>) => {
|
|
17
|
+
const cards = getStubbedCarouselCards(i18n);
|
|
18
|
+
return [...cards, ...cards.map((card) => ({ ...card, id: `${card.id}_2` }))];
|
|
19
|
+
};
|
|
19
20
|
|
|
20
21
|
export const RTLDiff: Story = {
|
|
21
|
-
render: () =>
|
|
22
|
-
|
|
22
|
+
render: () => {
|
|
23
|
+
const i18n = useRtlDiffI18n();
|
|
24
|
+
return <Carousel cards={getManyCards(i18n)} header={i18n.header} />;
|
|
25
|
+
},
|
|
26
|
+
...withRTLDiff({
|
|
27
|
+
width: 'stretch',
|
|
28
|
+
i18n: {
|
|
29
|
+
header: { en: 'Pretty nifty stuff', ar: 'أشياء رائعة حقًا' },
|
|
30
|
+
...carouselCardsI18n,
|
|
31
|
+
},
|
|
32
|
+
}),
|
|
23
33
|
};
|
|
@@ -2,7 +2,26 @@ import { Illustration } from '@wise/art';
|
|
|
2
2
|
import Display from '../../Display';
|
|
3
3
|
import type { CarouselCard } from '../Carousel';
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
/**
|
|
6
|
+
* Every string the stubbed cards render, shaped as a `withRTLDiff({ i18n })` map so the RTL diff
|
|
7
|
+
* can spread it — that call site is what type-checks the shape against `I18nMap`. The type is not
|
|
8
|
+
* imported here: this file is part of the Rollup build, which cannot emit declarations that
|
|
9
|
+
* reference `.storybook/`. The promo card's `Wise` title is a brand name and stays in Latin script.
|
|
10
|
+
*/
|
|
11
|
+
export const carouselCardsI18n = {
|
|
12
|
+
globeCardTitle: { en: 'Here there, everywhere', ar: 'هنا وهناك وفي كل مكان' },
|
|
13
|
+
promoDescription: {
|
|
14
|
+
en: 'The best way to move money internationally',
|
|
15
|
+
ar: 'أفضل طريقة لتحويل الأموال دوليًا',
|
|
16
|
+
},
|
|
17
|
+
quickPayCardTitle: { en: 'Get Quick Pay', ar: 'احصل على الدفع السريع' },
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Takes copy already resolved for one language — exactly what `useRtlDiffI18n()` returns — so the
|
|
22
|
+
* same fixture serves the single-direction stories and the RTL diff.
|
|
23
|
+
*/
|
|
24
|
+
export const getStubbedCarouselCards = (i18n: Record<string, string>): CarouselCard[] => [
|
|
6
25
|
{
|
|
7
26
|
id: 'YOUR_INVOICE',
|
|
8
27
|
type: 'button',
|
|
@@ -15,7 +34,7 @@ export const stubbedCarouselCards: CarouselCard[] = [
|
|
|
15
34
|
<Illustration disablePadding name="globe" size="small" alt="" />
|
|
16
35
|
</div>
|
|
17
36
|
<div style={{ position: 'absolute', zIndex: '2', bottom: '8px', left: '16px' }}>
|
|
18
|
-
<Display type="display-small">
|
|
37
|
+
<Display type="display-small">{i18n.globeCardTitle}</Display>
|
|
19
38
|
</div>
|
|
20
39
|
</div>
|
|
21
40
|
),
|
|
@@ -28,7 +47,7 @@ export const stubbedCarouselCards: CarouselCard[] = [
|
|
|
28
47
|
},
|
|
29
48
|
href: 'http://wise.com',
|
|
30
49
|
title: 'Wise',
|
|
31
|
-
description:
|
|
50
|
+
description: i18n.promoDescription,
|
|
32
51
|
},
|
|
33
52
|
{
|
|
34
53
|
id: 'SHOP_OR_STALL',
|
|
@@ -41,6 +60,12 @@ export const stubbedCarouselCards: CarouselCard[] = [
|
|
|
41
60
|
'url(https://wise.com/public-resources/assets/team-page/tapestry/team_member_tapestry_01.jpg)',
|
|
42
61
|
backgroundSize: 'cover',
|
|
43
62
|
},
|
|
44
|
-
content: <Display type="display-small">
|
|
63
|
+
content: <Display type="display-small">{i18n.quickPayCardTitle}</Display>,
|
|
45
64
|
},
|
|
46
65
|
];
|
|
66
|
+
|
|
67
|
+
const englishCopy = Object.fromEntries(
|
|
68
|
+
Object.entries(carouselCardsI18n).map(([key, entry]) => [key, entry.en]),
|
|
69
|
+
);
|
|
70
|
+
|
|
71
|
+
export const stubbedCarouselCards = getStubbedCarouselCards(englishCopy);
|
|
@@ -2,7 +2,7 @@ import { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
|
2
2
|
import { fn } from 'storybook/test';
|
|
3
3
|
import { lorem10 } from '../../test-utils';
|
|
4
4
|
import Checkbox from '../Checkbox';
|
|
5
|
-
import { withRTLDiff } from '../../../.storybook/decorators/RtlDiffDecorator';
|
|
5
|
+
import { useRtlDiffI18n, withRTLDiff } from '../../../.storybook/decorators/RtlDiffDecorator';
|
|
6
6
|
import { withVariantConfig } from '../../../.storybook/helpers';
|
|
7
7
|
|
|
8
8
|
const meta: Meta<typeof Checkbox> = {
|
|
@@ -39,16 +39,25 @@ export const MultipleMobile: Story = {
|
|
|
39
39
|
* so both single-line and two-line layouts are verified here.
|
|
40
40
|
*/
|
|
41
41
|
export const RTLDiff: Story = {
|
|
42
|
-
render: () =>
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
checked
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
42
|
+
render: () => {
|
|
43
|
+
const i18n = useRtlDiffI18n();
|
|
44
|
+
return (
|
|
45
|
+
<>
|
|
46
|
+
<Checkbox checked label={i18n.labelOnly} onChange={() => {}} />
|
|
47
|
+
<Checkbox
|
|
48
|
+
checked
|
|
49
|
+
label={i18n.withSecondary}
|
|
50
|
+
secondary={i18n.secondaryDescription}
|
|
51
|
+
onChange={() => {}}
|
|
52
|
+
/>
|
|
53
|
+
</>
|
|
54
|
+
);
|
|
55
|
+
},
|
|
56
|
+
...withRTLDiff({
|
|
57
|
+
i18n: {
|
|
58
|
+
labelOnly: { en: 'Label only', ar: 'التسمية فقط' },
|
|
59
|
+
withSecondary: { en: 'Label with secondary', ar: 'تسمية مع وصف ثانوي' },
|
|
60
|
+
secondaryDescription: { en: 'Secondary description text', ar: 'نص الوصف الثانوي' },
|
|
61
|
+
},
|
|
62
|
+
}),
|
|
54
63
|
};
|
|
@@ -2,7 +2,7 @@ import React, { useState } from 'react';
|
|
|
2
2
|
import type { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
3
3
|
import { expect, userEvent, within } from 'storybook/test';
|
|
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 CheckboxButton from '../CheckboxButton';
|
|
8
8
|
|
|
@@ -200,17 +200,26 @@ export const Zoom400: Story = {
|
|
|
200
200
|
};
|
|
201
201
|
|
|
202
202
|
export const RTLDiff: Story = {
|
|
203
|
-
render: () =>
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
aria-label=
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
203
|
+
render: () => {
|
|
204
|
+
const i18n = useRtlDiffI18n();
|
|
205
|
+
return (
|
|
206
|
+
<>
|
|
207
|
+
<CheckboxButton aria-label={i18n.unchecked} checked={false} onChange={() => {}} />
|
|
208
|
+
<CheckboxButton aria-label={i18n.checked} checked onChange={() => {}} />
|
|
209
|
+
<CheckboxButton
|
|
210
|
+
aria-label={i18n.indeterminate}
|
|
211
|
+
checked={false}
|
|
212
|
+
indeterminate
|
|
213
|
+
onChange={() => {}}
|
|
214
|
+
/>
|
|
215
|
+
</>
|
|
216
|
+
);
|
|
217
|
+
},
|
|
218
|
+
...withRTLDiff({
|
|
219
|
+
i18n: {
|
|
220
|
+
unchecked: { en: 'Unchecked', ar: 'غير محدد' },
|
|
221
|
+
checked: { en: 'Checked', ar: 'محدد' },
|
|
222
|
+
indeterminate: { en: 'Indeterminate', ar: 'محدد جزئيًا' },
|
|
223
|
+
},
|
|
224
|
+
}),
|
|
216
225
|
};
|
|
@@ -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
|
};
|