@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
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
2
2
|
import { FastFlag as FastFlagIcon } from '@transferwise/icons';
|
|
3
3
|
|
|
4
|
-
import { withRTLDiff } from '../../../../.storybook/decorators/RtlDiffDecorator';
|
|
4
|
+
import { useRtlDiffI18n, withRTLDiff } from '../../../../.storybook/decorators/RtlDiffDecorator';
|
|
5
5
|
import Card from '..';
|
|
6
6
|
|
|
7
7
|
export default {
|
|
@@ -13,26 +13,50 @@ export default {
|
|
|
13
13
|
type Story = StoryObj<typeof Card>;
|
|
14
14
|
|
|
15
15
|
export const RTLDiff: Story = {
|
|
16
|
-
render: () =>
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
title=
|
|
21
|
-
details=
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
16
|
+
render: () => {
|
|
17
|
+
const i18n = useRtlDiffI18n();
|
|
18
|
+
return (
|
|
19
|
+
<>
|
|
20
|
+
<Card title={i18n.basicTitle} details={i18n.basicDetails} />
|
|
21
|
+
<Card title={i18n.withIconTitle} details={i18n.withIconDetails} icon={<FastFlagIcon />} />
|
|
22
|
+
<Card
|
|
23
|
+
title={i18n.expandedWithIconTitle}
|
|
24
|
+
details={i18n.expandedWithIconDetails}
|
|
25
|
+
icon={<FastFlagIcon />}
|
|
26
|
+
isExpanded
|
|
27
|
+
>
|
|
28
|
+
{i18n.expandedWithIconContent}
|
|
29
|
+
</Card>
|
|
30
|
+
<Card title={i18n.expandedNoIconTitle} details={i18n.expandedNoIconDetails} isExpanded>
|
|
31
|
+
{i18n.expandedNoIconContent}
|
|
32
|
+
</Card>
|
|
33
|
+
</>
|
|
34
|
+
);
|
|
35
|
+
},
|
|
36
|
+
...withRTLDiff({
|
|
37
|
+
i18n: {
|
|
38
|
+
basicTitle: { en: 'Basic card', ar: 'بطاقة أساسية' },
|
|
39
|
+
basicDetails: { en: 'Some details about this card', ar: 'بعض التفاصيل عن هذه البطاقة' },
|
|
40
|
+
withIconTitle: { en: 'Card with icon', ar: 'بطاقة مع أيقونة' },
|
|
41
|
+
withIconDetails: {
|
|
42
|
+
en: 'Details with an icon on the side',
|
|
43
|
+
ar: 'تفاصيل مع أيقونة على الجانب',
|
|
44
|
+
},
|
|
45
|
+
expandedWithIconTitle: { en: 'Expanded card with icon', ar: 'بطاقة موسّعة مع أيقونة' },
|
|
46
|
+
expandedWithIconDetails: {
|
|
47
|
+
en: 'Expanded card showing content area',
|
|
48
|
+
ar: 'بطاقة موسّعة تُظهر منطقة المحتوى',
|
|
49
|
+
},
|
|
50
|
+
expandedWithIconContent: {
|
|
51
|
+
en: 'Expanded content with padding affected by icon presence.',
|
|
52
|
+
ar: 'محتوى موسّع بمساحة داخلية تتأثر بوجود الأيقونة.',
|
|
53
|
+
},
|
|
54
|
+
expandedNoIconTitle: { en: 'Expanded card without icon', ar: 'بطاقة موسّعة بدون أيقونة' },
|
|
55
|
+
expandedNoIconDetails: { en: 'No icon variant', ar: 'نسخة بدون أيقونة' },
|
|
56
|
+
expandedNoIconContent: {
|
|
57
|
+
en: 'Expanded content without icon padding.',
|
|
58
|
+
ar: 'محتوى موسّع بدون مساحة داخلية للأيقونة.',
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
}),
|
|
38
62
|
};
|
|
@@ -2,7 +2,7 @@ import { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
|
2
2
|
|
|
3
3
|
import CriticalCommsBanner from '..';
|
|
4
4
|
import { withVariantConfig } from '../../../../.storybook/helpers';
|
|
5
|
-
import { withRTLDiff } from '../../../../.storybook/decorators/RtlDiffDecorator';
|
|
5
|
+
import { useRtlDiffI18n, withRTLDiff } from '../../../../.storybook/decorators/RtlDiffDecorator';
|
|
6
6
|
|
|
7
7
|
export default {
|
|
8
8
|
component: CriticalCommsBanner,
|
|
@@ -70,18 +70,24 @@ export const WithoutAction: Story = {
|
|
|
70
70
|
};
|
|
71
71
|
|
|
72
72
|
export const RTLDiff: Story = {
|
|
73
|
-
render: () =>
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
subtitle=
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
...withRTLDiff(
|
|
73
|
+
render: () => {
|
|
74
|
+
const i18n = useRtlDiffI18n();
|
|
75
|
+
return (
|
|
76
|
+
<>
|
|
77
|
+
<CriticalCommsBanner
|
|
78
|
+
title={i18n.title}
|
|
79
|
+
subtitle={i18n.subtitle}
|
|
80
|
+
action={{ label: i18n.actionLabel, href: 'https://wise.com' }}
|
|
81
|
+
/>
|
|
82
|
+
<CriticalCommsBanner title={i18n.title} subtitle={i18n.subtitle} />
|
|
83
|
+
</>
|
|
84
|
+
);
|
|
85
|
+
},
|
|
86
|
+
...withRTLDiff({
|
|
87
|
+
i18n: {
|
|
88
|
+
title: { en: 'Your account is overdrawn', ar: 'حسابك مكشوف' },
|
|
89
|
+
subtitle: { en: 'Add money within the next 30 days', ar: 'أضف أموالًا خلال 30 يومًا' },
|
|
90
|
+
actionLabel: { en: 'Take action', ar: 'اتخذ إجراءً' },
|
|
91
|
+
},
|
|
92
|
+
}),
|
|
87
93
|
};
|
|
@@ -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 InlineAlert from '..';
|
|
5
5
|
|
|
6
6
|
export default {
|
|
@@ -12,15 +12,26 @@ export default {
|
|
|
12
12
|
type Story = StoryObj<typeof InlineAlert>;
|
|
13
13
|
|
|
14
14
|
export const RTLDiff: Story = {
|
|
15
|
-
render: () =>
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
15
|
+
render: () => {
|
|
16
|
+
const i18n = useRtlDiffI18n();
|
|
17
|
+
return (
|
|
18
|
+
<>
|
|
19
|
+
<InlineAlert type="neutral">{i18n.neutral}</InlineAlert>
|
|
20
|
+
<InlineAlert type="warning">{i18n.warning}</InlineAlert>
|
|
21
|
+
<InlineAlert type="negative">{i18n.negative}</InlineAlert>
|
|
22
|
+
<InlineAlert type="positive">{i18n.positive}</InlineAlert>
|
|
23
|
+
</>
|
|
24
|
+
);
|
|
25
|
+
},
|
|
26
|
+
...withRTLDiff({
|
|
27
|
+
i18n: {
|
|
28
|
+
neutral: { en: 'Neutral alert without icon', ar: 'تنبيه عادي بدون أيقونة' },
|
|
29
|
+
warning: { en: 'Warning alert with icon', ar: 'تنبيه تحذيري مع أيقونة' },
|
|
30
|
+
negative: { en: 'Negative alert with icon', ar: 'تنبيه سلبي مع أيقونة' },
|
|
31
|
+
positive: {
|
|
32
|
+
en: 'Positive alert with icon and longer content that may wrap to multiple lines',
|
|
33
|
+
ar: 'تنبيه إيجابي مع أيقونة ومحتوى أطول قد يمتد على عدة أسطر',
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
}),
|
|
26
37
|
};
|
|
@@ -2,7 +2,7 @@ import type { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
|
2
2
|
import { userEvent, within } from 'storybook/test';
|
|
3
3
|
import { Person } from '@transferwise/icons';
|
|
4
4
|
|
|
5
|
-
import { withRTLDiff } from '../../../../.storybook/decorators/RtlDiffDecorator';
|
|
5
|
+
import { useRtlDiffI18n, withRTLDiff } from '../../../../.storybook/decorators/RtlDiffDecorator';
|
|
6
6
|
import Select from '..';
|
|
7
7
|
|
|
8
8
|
export default {
|
|
@@ -13,54 +13,82 @@ export default {
|
|
|
13
13
|
|
|
14
14
|
type Story = StoryObj<typeof Select>;
|
|
15
15
|
|
|
16
|
-
const
|
|
17
|
-
{ header:
|
|
18
|
-
{ value: 'gbp', label:
|
|
19
|
-
{ value: 'eur', label:
|
|
20
|
-
{ value: 'usd', label:
|
|
16
|
+
const getOptions = (i18n: Record<string, string>) => [
|
|
17
|
+
{ header: i18n.popularHeader },
|
|
18
|
+
{ value: 'gbp', label: i18n.britishPound, currency: 'gbp', icon: <Person /> },
|
|
19
|
+
{ value: 'eur', label: i18n.euro, currency: 'eur', icon: <Person /> },
|
|
20
|
+
{ value: 'usd', label: i18n.usDollar, currency: 'usd', note: i18n.usDollarNote },
|
|
21
21
|
{ separator: true },
|
|
22
|
-
{ header:
|
|
23
|
-
{ value: 'cad', label:
|
|
24
|
-
{ value: 'aud', label:
|
|
22
|
+
{ header: i18n.otherHeader },
|
|
23
|
+
{ value: 'cad', label: i18n.canadianDollar, currency: 'cad' },
|
|
24
|
+
{ value: 'aud', label: i18n.australianDollar, currency: 'aud' },
|
|
25
25
|
];
|
|
26
26
|
|
|
27
|
-
const
|
|
27
|
+
const getSelected = (i18n: Record<string, string>) => ({
|
|
28
|
+
value: 'gbp',
|
|
29
|
+
label: i18n.britishPound,
|
|
30
|
+
currency: 'gbp',
|
|
31
|
+
icon: <Person />,
|
|
32
|
+
});
|
|
28
33
|
|
|
29
34
|
export const TriggerVariants: Story = {
|
|
30
|
-
render: () =>
|
|
31
|
-
|
|
35
|
+
render: () => {
|
|
36
|
+
const i18n = useRtlDiffI18n();
|
|
37
|
+
return (
|
|
38
|
+
<>
|
|
39
|
+
<Select
|
|
40
|
+
size="lg"
|
|
41
|
+
placeholder={i18n.placeholder}
|
|
42
|
+
selected={getSelected(i18n)}
|
|
43
|
+
options={getOptions(i18n)}
|
|
44
|
+
onChange={() => {}}
|
|
45
|
+
/>
|
|
46
|
+
<Select
|
|
47
|
+
size="md"
|
|
48
|
+
placeholder={i18n.placeholder}
|
|
49
|
+
selected={getSelected(i18n)}
|
|
50
|
+
options={getOptions(i18n)}
|
|
51
|
+
onChange={() => {}}
|
|
52
|
+
/>
|
|
53
|
+
<Select
|
|
54
|
+
size="sm"
|
|
55
|
+
placeholder={i18n.placeholder}
|
|
56
|
+
options={getOptions(i18n)}
|
|
57
|
+
onChange={() => {}}
|
|
58
|
+
/>
|
|
59
|
+
</>
|
|
60
|
+
);
|
|
61
|
+
},
|
|
62
|
+
...withRTLDiff({
|
|
63
|
+
i18n: {
|
|
64
|
+
placeholder: { en: 'Select currency', ar: 'اختر العملة' },
|
|
65
|
+
popularHeader: { en: 'Popular', ar: 'الأكثر شيوعًا' },
|
|
66
|
+
britishPound: { en: 'British pound', ar: 'الجنيه الإسترليني' },
|
|
67
|
+
euro: { en: 'Euro', ar: 'اليورو' },
|
|
68
|
+
usDollar: { en: 'US Dollar', ar: 'الدولار الأمريكي' },
|
|
69
|
+
usDollarNote: { en: 'United States dollar', ar: 'دولار الولايات المتحدة' },
|
|
70
|
+
otherHeader: { en: 'Other', ar: 'أخرى' },
|
|
71
|
+
canadianDollar: { en: 'Canadian dollar', ar: 'الدولار الكندي' },
|
|
72
|
+
australianDollar: { en: 'Australian dollar', ar: 'الدولار الأسترالي' },
|
|
73
|
+
},
|
|
74
|
+
}),
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
export const OpenDropdown: Story = {
|
|
78
|
+
render: () => {
|
|
79
|
+
const i18n = useRtlDiffI18n();
|
|
80
|
+
return (
|
|
32
81
|
<Select
|
|
33
82
|
size="lg"
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
<Select
|
|
40
|
-
size="md"
|
|
41
|
-
placeholder="Select currency"
|
|
42
|
-
selected={selected}
|
|
43
|
-
options={options}
|
|
83
|
+
search
|
|
84
|
+
searchPlaceholder={i18n.searchPlaceholder}
|
|
85
|
+
placeholder={i18n.placeholder}
|
|
86
|
+
selected={getSelected(i18n)}
|
|
87
|
+
options={getOptions(i18n)}
|
|
44
88
|
onChange={() => {}}
|
|
45
89
|
/>
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
),
|
|
49
|
-
...withRTLDiff(),
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
export const OpenDropdown: Story = {
|
|
53
|
-
render: () => (
|
|
54
|
-
<Select
|
|
55
|
-
size="lg"
|
|
56
|
-
search
|
|
57
|
-
searchPlaceholder="Type a currency"
|
|
58
|
-
placeholder="Select currency"
|
|
59
|
-
selected={selected}
|
|
60
|
-
options={options}
|
|
61
|
-
onChange={() => {}}
|
|
62
|
-
/>
|
|
63
|
-
),
|
|
90
|
+
);
|
|
91
|
+
},
|
|
64
92
|
play: async ({ canvasElement }) => {
|
|
65
93
|
const canvas = within(canvasElement);
|
|
66
94
|
const trigger = canvas.queryByRole('button');
|
|
@@ -73,6 +101,14 @@ export const OpenDropdown: Story = {
|
|
|
73
101
|
i18n: {
|
|
74
102
|
searchPlaceholder: { en: 'Type a currency', ar: 'اكتب عملة' },
|
|
75
103
|
placeholder: { en: 'Select currency', ar: 'اختر العملة' },
|
|
104
|
+
popularHeader: { en: 'Popular', ar: 'الأكثر شيوعًا' },
|
|
105
|
+
britishPound: { en: 'British pound', ar: 'الجنيه الإسترليني' },
|
|
106
|
+
euro: { en: 'Euro', ar: 'اليورو' },
|
|
107
|
+
usDollar: { en: 'US Dollar', ar: 'الدولار الأمريكي' },
|
|
108
|
+
usDollarNote: { en: 'United States dollar', ar: 'دولار الولايات المتحدة' },
|
|
109
|
+
otherHeader: { en: 'Other', ar: 'أخرى' },
|
|
110
|
+
canadianDollar: { en: 'Canadian dollar', ar: 'الدولار الكندي' },
|
|
111
|
+
australianDollar: { en: 'Australian dollar', ar: 'الدولار الأسترالي' },
|
|
76
112
|
},
|
|
77
113
|
}),
|
|
78
114
|
};
|
|
@@ -12,7 +12,7 @@ import Title from '../../../Title';
|
|
|
12
12
|
import ListItem from '../../../ListItem';
|
|
13
13
|
import BottomSheet from '../BottomSheet';
|
|
14
14
|
import { withVariantConfig } from '../../../../.storybook/helpers';
|
|
15
|
-
import { withRTLDiff } from '../../../../.storybook/decorators/RtlDiffDecorator';
|
|
15
|
+
import { useRtlDiffI18n, withRTLDiff } from '../../../../.storybook/decorators/RtlDiffDecorator';
|
|
16
16
|
|
|
17
17
|
const wait = async (duration = 500) =>
|
|
18
18
|
new Promise<void>((resolve) => {
|
|
@@ -229,23 +229,41 @@ export const WithOverflowContentZoom400: Story = {
|
|
|
229
229
|
};
|
|
230
230
|
|
|
231
231
|
export const RTLDiff: Story = {
|
|
232
|
-
render: () =>
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
{
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
<ListItem.
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
232
|
+
render: () => {
|
|
233
|
+
const i18n = useRtlDiffI18n();
|
|
234
|
+
return (
|
|
235
|
+
<BottomSheet open aria-label={i18n.sheetLabel}>
|
|
236
|
+
<Title type={Typography.TITLE_SECTION}>{i18n.title}</Title>
|
|
237
|
+
{i18n.body}
|
|
238
|
+
<br />
|
|
239
|
+
<br />
|
|
240
|
+
<ListItem
|
|
241
|
+
title={i18n.listItemTitle}
|
|
242
|
+
subtitle={i18n.listItemSubtitle}
|
|
243
|
+
control={<ListItem.Navigation href="#" />}
|
|
244
|
+
media={
|
|
245
|
+
<ListItem.AvatarView>
|
|
246
|
+
<FastFlag />
|
|
247
|
+
</ListItem.AvatarView>
|
|
248
|
+
}
|
|
249
|
+
/>
|
|
250
|
+
</BottomSheet>
|
|
251
|
+
);
|
|
252
|
+
},
|
|
253
|
+
...withRTLDiff({
|
|
254
|
+
renderAs: 'iframe',
|
|
255
|
+
i18n: {
|
|
256
|
+
sheetLabel: { en: 'Manage your card', ar: 'إدارة بطاقتك' },
|
|
257
|
+
title: { en: 'Money without borders', ar: 'أموال بلا حدود' },
|
|
258
|
+
body: {
|
|
259
|
+
en: lorem10,
|
|
260
|
+
ar: 'نص تجريبي يُستخدم لعرض شكل التصميم النهائي قبل إضافة المحتوى الفعلي.',
|
|
261
|
+
},
|
|
262
|
+
listItemTitle: { en: 'List item', ar: 'عنصر القائمة' },
|
|
263
|
+
listItemSubtitle: {
|
|
264
|
+
en: 'Button and icon are vertically centered.',
|
|
265
|
+
ar: 'الزر والأيقونة متمركزان عموديًا.',
|
|
266
|
+
},
|
|
267
|
+
},
|
|
268
|
+
}),
|
|
251
269
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
2
2
|
import { useRef } from 'react';
|
|
3
|
-
import { withRTLDiff } from '../../../../.storybook/decorators/RtlDiffDecorator';
|
|
3
|
+
import { useRtlDiffI18n, withRTLDiff } from '../../../../.storybook/decorators/RtlDiffDecorator';
|
|
4
4
|
import Button from '../../../Button';
|
|
5
5
|
import { Position } from '../../PropsValues/position';
|
|
6
6
|
import Panel from '../Panel';
|
|
@@ -20,6 +20,7 @@ function PanelStory({
|
|
|
20
20
|
position: Parameters<typeof Panel>[0]['position'];
|
|
21
21
|
label: string;
|
|
22
22
|
}) {
|
|
23
|
+
const i18n = useRtlDiffI18n();
|
|
23
24
|
const anchorRef = useRef<HTMLButtonElement>(null);
|
|
24
25
|
const margin =
|
|
25
26
|
position?.startsWith('bottom') || position?.startsWith('top') ? '3.5rem 0' : '2.5rem 0';
|
|
@@ -34,10 +35,10 @@ function PanelStory({
|
|
|
34
35
|
position={position}
|
|
35
36
|
anchorRef={anchorRef}
|
|
36
37
|
arrow
|
|
37
|
-
aria-label={
|
|
38
|
+
aria-label={`${i18n.panelAriaLabelPrefix} ${label}`}
|
|
38
39
|
>
|
|
39
40
|
<div style={{ padding: '16px', maxWidth: '200px' }}>
|
|
40
|
-
|
|
41
|
+
{i18n.panelContentPrefix} <strong>{label}</strong>
|
|
41
42
|
</div>
|
|
42
43
|
</Panel>
|
|
43
44
|
</>
|
|
@@ -45,66 +46,149 @@ function PanelStory({
|
|
|
45
46
|
}
|
|
46
47
|
|
|
47
48
|
export const Top: Story = {
|
|
48
|
-
render: () =>
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
49
|
+
render: () => {
|
|
50
|
+
const i18n = useRtlDiffI18n();
|
|
51
|
+
return (
|
|
52
|
+
<>
|
|
53
|
+
<PanelStory position={Position.TOP_LEFT} label={i18n.topLeft} />
|
|
54
|
+
<PanelStory position={Position.TOP} label={i18n.top} />
|
|
55
|
+
<PanelStory position={Position.TOP_RIGHT} label={i18n.topRight} />
|
|
56
|
+
</>
|
|
57
|
+
);
|
|
58
|
+
},
|
|
59
|
+
...withRTLDiff({
|
|
60
|
+
renderAs: 'iframe',
|
|
61
|
+
hAlign: 'center',
|
|
62
|
+
vAlign: 'bottom',
|
|
63
|
+
i18n: {
|
|
64
|
+
panelAriaLabelPrefix: { en: 'Panel positioned', ar: 'لوحة موضوعة عند' },
|
|
65
|
+
panelContentPrefix: { en: 'Panel content positioned at', ar: 'محتوى اللوحة موضوع عند' },
|
|
66
|
+
topLeft: { en: 'top-left', ar: 'أعلى اليسار' },
|
|
67
|
+
top: { en: 'top', ar: 'أعلى' },
|
|
68
|
+
topRight: { en: 'top-right', ar: 'أعلى اليمين' },
|
|
69
|
+
},
|
|
70
|
+
}),
|
|
56
71
|
};
|
|
57
72
|
|
|
58
73
|
export const Right: Story = {
|
|
59
|
-
render: () =>
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
74
|
+
render: () => {
|
|
75
|
+
const i18n = useRtlDiffI18n();
|
|
76
|
+
return (
|
|
77
|
+
<>
|
|
78
|
+
<PanelStory position={Position.RIGHT_TOP} label={i18n.rightTop} />
|
|
79
|
+
<PanelStory position={Position.RIGHT} label={i18n.right} />
|
|
80
|
+
<PanelStory position={Position.RIGHT_BOTTOM} label={i18n.rightBottom} />
|
|
81
|
+
</>
|
|
82
|
+
);
|
|
83
|
+
},
|
|
84
|
+
...withRTLDiff({
|
|
85
|
+
renderAs: 'iframe',
|
|
86
|
+
hAlign: 'left',
|
|
87
|
+
vAlign: 'center',
|
|
88
|
+
i18n: {
|
|
89
|
+
panelAriaLabelPrefix: { en: 'Panel positioned', ar: 'لوحة موضوعة عند' },
|
|
90
|
+
panelContentPrefix: { en: 'Panel content positioned at', ar: 'محتوى اللوحة موضوع عند' },
|
|
91
|
+
rightTop: { en: 'right-top', ar: 'اليمين أعلى' },
|
|
92
|
+
right: { en: 'right', ar: 'اليمين' },
|
|
93
|
+
rightBottom: { en: 'right-bottom', ar: 'اليمين أسفل' },
|
|
94
|
+
},
|
|
95
|
+
}),
|
|
67
96
|
};
|
|
68
97
|
export const RightFlipped: Story = {
|
|
69
|
-
render: () =>
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
98
|
+
render: () => {
|
|
99
|
+
const i18n = useRtlDiffI18n();
|
|
100
|
+
return (
|
|
101
|
+
<>
|
|
102
|
+
<PanelStory position={Position.RIGHT_TOP} label={i18n.rightTop} />
|
|
103
|
+
<PanelStory position={Position.RIGHT} label={i18n.right} />
|
|
104
|
+
<PanelStory position={Position.RIGHT_BOTTOM} label={i18n.rightBottom} />
|
|
105
|
+
</>
|
|
106
|
+
);
|
|
107
|
+
},
|
|
108
|
+
...withRTLDiff({
|
|
109
|
+
renderAs: 'iframe',
|
|
110
|
+
hAlign: 'right',
|
|
111
|
+
vAlign: 'center',
|
|
112
|
+
i18n: {
|
|
113
|
+
panelAriaLabelPrefix: { en: 'Panel positioned', ar: 'لوحة موضوعة عند' },
|
|
114
|
+
panelContentPrefix: { en: 'Panel content positioned at', ar: 'محتوى اللوحة موضوع عند' },
|
|
115
|
+
rightTop: { en: 'right-top', ar: 'اليمين أعلى' },
|
|
116
|
+
right: { en: 'right', ar: 'اليمين' },
|
|
117
|
+
rightBottom: { en: 'right-bottom', ar: 'اليمين أسفل' },
|
|
118
|
+
},
|
|
119
|
+
}),
|
|
77
120
|
};
|
|
78
121
|
|
|
79
122
|
export const Bottom: Story = {
|
|
80
|
-
render: () =>
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
123
|
+
render: () => {
|
|
124
|
+
const i18n = useRtlDiffI18n();
|
|
125
|
+
return (
|
|
126
|
+
<>
|
|
127
|
+
<PanelStory position={Position.BOTTOM_LEFT} label={i18n.bottomLeft} />
|
|
128
|
+
<PanelStory position={Position.BOTTOM} label={i18n.bottom} />
|
|
129
|
+
<PanelStory position={Position.BOTTOM_RIGHT} label={i18n.bottomRight} />
|
|
130
|
+
</>
|
|
131
|
+
);
|
|
132
|
+
},
|
|
133
|
+
...withRTLDiff({
|
|
134
|
+
renderAs: 'iframe',
|
|
135
|
+
hAlign: 'center',
|
|
136
|
+
i18n: {
|
|
137
|
+
panelAriaLabelPrefix: { en: 'Panel positioned', ar: 'لوحة موضوعة عند' },
|
|
138
|
+
panelContentPrefix: { en: 'Panel content positioned at', ar: 'محتوى اللوحة موضوع عند' },
|
|
139
|
+
bottomLeft: { en: 'bottom-left', ar: 'أسفل اليسار' },
|
|
140
|
+
bottom: { en: 'bottom', ar: 'أسفل' },
|
|
141
|
+
bottomRight: { en: 'bottom-right', ar: 'أسفل اليمين' },
|
|
142
|
+
},
|
|
143
|
+
}),
|
|
88
144
|
};
|
|
89
145
|
|
|
90
146
|
export const Left: Story = {
|
|
91
|
-
render: () =>
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
147
|
+
render: () => {
|
|
148
|
+
const i18n = useRtlDiffI18n();
|
|
149
|
+
return (
|
|
150
|
+
<>
|
|
151
|
+
<PanelStory position={Position.LEFT_TOP} label={i18n.leftTop} />
|
|
152
|
+
<PanelStory position={Position.LEFT} label={i18n.left} />
|
|
153
|
+
<PanelStory position={Position.LEFT_BOTTOM} label={i18n.leftBottom} />
|
|
154
|
+
</>
|
|
155
|
+
);
|
|
156
|
+
},
|
|
157
|
+
...withRTLDiff({
|
|
158
|
+
renderAs: 'iframe',
|
|
159
|
+
hAlign: 'right',
|
|
160
|
+
vAlign: 'center',
|
|
161
|
+
i18n: {
|
|
162
|
+
panelAriaLabelPrefix: { en: 'Panel positioned', ar: 'لوحة موضوعة عند' },
|
|
163
|
+
panelContentPrefix: { en: 'Panel content positioned at', ar: 'محتوى اللوحة موضوع عند' },
|
|
164
|
+
leftTop: { en: 'left-top', ar: 'اليسار أعلى' },
|
|
165
|
+
left: { en: 'left', ar: 'اليسار' },
|
|
166
|
+
leftBottom: { en: 'left-bottom', ar: 'اليسار أسفل' },
|
|
167
|
+
},
|
|
168
|
+
}),
|
|
99
169
|
};
|
|
100
170
|
|
|
101
171
|
export const LeftFlipped: Story = {
|
|
102
|
-
render: () =>
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
172
|
+
render: () => {
|
|
173
|
+
const i18n = useRtlDiffI18n();
|
|
174
|
+
return (
|
|
175
|
+
<>
|
|
176
|
+
<PanelStory position={Position.LEFT_TOP} label={i18n.leftTop} />
|
|
177
|
+
<PanelStory position={Position.LEFT} label={i18n.left} />
|
|
178
|
+
<PanelStory position={Position.LEFT_BOTTOM} label={i18n.leftBottom} />
|
|
179
|
+
</>
|
|
180
|
+
);
|
|
181
|
+
},
|
|
182
|
+
...withRTLDiff({
|
|
183
|
+
renderAs: 'iframe',
|
|
184
|
+
hAlign: 'left',
|
|
185
|
+
vAlign: 'center',
|
|
186
|
+
i18n: {
|
|
187
|
+
panelAriaLabelPrefix: { en: 'Panel positioned', ar: 'لوحة موضوعة عند' },
|
|
188
|
+
panelContentPrefix: { en: 'Panel content positioned at', ar: 'محتوى اللوحة موضوع عند' },
|
|
189
|
+
leftTop: { en: 'left-top', ar: 'اليسار أعلى' },
|
|
190
|
+
left: { en: 'left', ar: 'اليسار' },
|
|
191
|
+
leftBottom: { en: 'left-bottom', ar: 'اليسار أسفل' },
|
|
192
|
+
},
|
|
193
|
+
}),
|
|
110
194
|
};
|