@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,6 +1,6 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
2
2
|
import { fn, userEvent, within } from 'storybook/test';
|
|
3
|
-
import { withRTLDiff } from '../../../.storybook/decorators/RtlDiffDecorator';
|
|
3
|
+
import { useRtlDiffI18n, withRTLDiff } from '../../../.storybook/decorators/RtlDiffDecorator';
|
|
4
4
|
import ExpressiveMoneyInput from '..';
|
|
5
5
|
import { Rewards } from '@transferwise/icons';
|
|
6
6
|
|
|
@@ -24,95 +24,128 @@ const currencySelectorOptions = [
|
|
|
24
24
|
];
|
|
25
25
|
|
|
26
26
|
export const TriggerVariants: Story = {
|
|
27
|
-
render: () =>
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
27
|
+
render: () => {
|
|
28
|
+
const i18n = useRtlDiffI18n();
|
|
29
|
+
return (
|
|
30
|
+
<>
|
|
31
|
+
{/* Currency selector on leading side — flips in RTL */}
|
|
32
|
+
<ExpressiveMoneyInput
|
|
33
|
+
label={i18n.youSend}
|
|
34
|
+
currency="GBP"
|
|
35
|
+
amount={1234.56}
|
|
36
|
+
currencySelector={{
|
|
37
|
+
options: currencySelectorOptions,
|
|
38
|
+
onChange: fn(),
|
|
39
|
+
onSearchChange: fn(),
|
|
40
|
+
onOpen: fn(),
|
|
41
|
+
}}
|
|
42
|
+
onAmountChange={fn()}
|
|
43
|
+
/>
|
|
42
44
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
45
|
+
{/* Chevron on trailing side — flips in RTL */}
|
|
46
|
+
<ExpressiveMoneyInput
|
|
47
|
+
label={i18n.youSend}
|
|
48
|
+
currency="EUR"
|
|
49
|
+
amount={0}
|
|
50
|
+
showChevron
|
|
51
|
+
currencySelector={{
|
|
52
|
+
options: currencySelectorOptions,
|
|
53
|
+
onChange: fn(),
|
|
54
|
+
onSearchChange: fn(),
|
|
55
|
+
onOpen: fn(),
|
|
56
|
+
}}
|
|
57
|
+
onAmountChange={fn()}
|
|
58
|
+
/>
|
|
57
59
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
60
|
+
{/* InlinePrompt with media icon — icon on leading end of prompt */}
|
|
61
|
+
<ExpressiveMoneyInput
|
|
62
|
+
label={i18n.youSend}
|
|
63
|
+
currency="USD"
|
|
64
|
+
amount={500}
|
|
65
|
+
currencySelector={{
|
|
66
|
+
options: currencySelectorOptions,
|
|
67
|
+
onChange: fn(),
|
|
68
|
+
onSearchChange: fn(),
|
|
69
|
+
onOpen: fn(),
|
|
70
|
+
}}
|
|
71
|
+
inlinePrompt={{
|
|
72
|
+
message: i18n.greatRate,
|
|
73
|
+
sentiment: 'positive',
|
|
74
|
+
media: <Rewards />,
|
|
75
|
+
}}
|
|
76
|
+
onAmountChange={fn()}
|
|
77
|
+
/>
|
|
76
78
|
|
|
77
|
-
|
|
79
|
+
{/* Secondary avatar addon in currency selector */}
|
|
80
|
+
<ExpressiveMoneyInput
|
|
81
|
+
label={i18n.youSend}
|
|
82
|
+
currency="GBP"
|
|
83
|
+
amount={750}
|
|
84
|
+
currencySelector={{
|
|
85
|
+
options: currencySelectorOptions,
|
|
86
|
+
addons: [{ profileName: i18n.profileName }],
|
|
87
|
+
onChange: fn(),
|
|
88
|
+
onSearchChange: fn(),
|
|
89
|
+
onOpen: fn(),
|
|
90
|
+
}}
|
|
91
|
+
onAmountChange={fn()}
|
|
92
|
+
/>
|
|
93
|
+
</>
|
|
94
|
+
);
|
|
95
|
+
},
|
|
96
|
+
...withRTLDiff({
|
|
97
|
+
renderAs: 'iframe',
|
|
98
|
+
width: 'stretch',
|
|
99
|
+
i18n: {
|
|
100
|
+
youSend: { en: 'You send', ar: 'أنت ترسل' },
|
|
101
|
+
greatRate: { en: 'Great rate available', ar: 'سعر تحويل رائع متاح' },
|
|
102
|
+
profileName: { en: 'Mikkael Jordan', ar: 'ميكائيل جوردان' },
|
|
103
|
+
},
|
|
104
|
+
}),
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
export const OpenDropdown: Story = {
|
|
108
|
+
render: () => {
|
|
109
|
+
const i18n = useRtlDiffI18n();
|
|
110
|
+
return (
|
|
78
111
|
<ExpressiveMoneyInput
|
|
79
|
-
label=
|
|
112
|
+
label={i18n.youSend}
|
|
80
113
|
currency="GBP"
|
|
81
|
-
amount={
|
|
114
|
+
amount={1234.56}
|
|
82
115
|
currencySelector={{
|
|
83
|
-
options:
|
|
84
|
-
|
|
116
|
+
options: [
|
|
117
|
+
{
|
|
118
|
+
title: i18n.popularGroup,
|
|
119
|
+
currencies: [
|
|
120
|
+
{ code: 'GBP', label: i18n.britishPound, keywords: ['british'] },
|
|
121
|
+
{ code: 'EUR', label: i18n.euro, keywords: ['euro'] },
|
|
122
|
+
{ code: 'USD', label: i18n.usDollar, keywords: ['dollar'] },
|
|
123
|
+
],
|
|
124
|
+
},
|
|
125
|
+
],
|
|
85
126
|
onChange: fn(),
|
|
86
127
|
onSearchChange: fn(),
|
|
87
128
|
onOpen: fn(),
|
|
88
129
|
}}
|
|
89
130
|
onAmountChange={fn()}
|
|
90
131
|
/>
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
...withRTLDiff({ renderAs: 'iframe', width: 'stretch' }),
|
|
94
|
-
};
|
|
95
|
-
|
|
96
|
-
export const OpenDropdown: Story = {
|
|
97
|
-
render: () => (
|
|
98
|
-
<ExpressiveMoneyInput
|
|
99
|
-
label="You send"
|
|
100
|
-
currency="GBP"
|
|
101
|
-
amount={1234.56}
|
|
102
|
-
currencySelector={{
|
|
103
|
-
options: currencySelectorOptions,
|
|
104
|
-
onChange: fn(),
|
|
105
|
-
onSearchChange: fn(),
|
|
106
|
-
onOpen: fn(),
|
|
107
|
-
}}
|
|
108
|
-
onAmountChange={fn()}
|
|
109
|
-
/>
|
|
110
|
-
),
|
|
132
|
+
);
|
|
133
|
+
},
|
|
111
134
|
play: async ({ canvasElement }) => {
|
|
112
135
|
const canvas = within(canvasElement);
|
|
113
136
|
const trigger = canvas.queryByRole('combobox');
|
|
114
137
|
if (!trigger) return;
|
|
115
138
|
await userEvent.click(trigger);
|
|
116
139
|
},
|
|
117
|
-
...withRTLDiff({
|
|
140
|
+
...withRTLDiff({
|
|
141
|
+
renderAs: 'iframe',
|
|
142
|
+
width: '80%',
|
|
143
|
+
i18n: {
|
|
144
|
+
youSend: { en: 'You send', ar: 'أنت ترسل' },
|
|
145
|
+
popularGroup: { en: 'Popular', ar: 'الأكثر شيوعًا' },
|
|
146
|
+
britishPound: { en: 'British Pound', ar: 'الجنيه الإسترليني' },
|
|
147
|
+
euro: { en: 'Euro', ar: 'اليورو' },
|
|
148
|
+
usDollar: { en: 'US Dollar', ar: 'الدولار الأمريكي' },
|
|
149
|
+
},
|
|
150
|
+
}),
|
|
118
151
|
};
|
|
@@ -121,7 +121,7 @@ export const RTLDiff: Story = {
|
|
|
121
121
|
},
|
|
122
122
|
value_ar: {
|
|
123
123
|
en: 'localised value',
|
|
124
|
-
ar: 'قيمة مُكيَّفة
|
|
124
|
+
ar: 'قيمة مُكيَّفة محليًا',
|
|
125
125
|
},
|
|
126
126
|
requiredLabel: { en: 'Required field', ar: 'حقل مطلوب' },
|
|
127
127
|
optionalLabel: { en: 'Optional field', ar: 'حقل اختياري' },
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { 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 AvatarView from '../../AvatarView';
|
|
5
5
|
import { ProfileType } from '../../common';
|
|
6
6
|
import Logo from '../../Logo';
|
|
@@ -9,13 +9,6 @@ import FlowNavigation from '../FlowNavigation';
|
|
|
9
9
|
|
|
10
10
|
const noop = () => {};
|
|
11
11
|
|
|
12
|
-
const steps = [
|
|
13
|
-
{ label: 'Amount', hoverLabel: '100 GBP', onClick: noop },
|
|
14
|
-
{ label: 'You', hoverLabel: 'Elena Durante', onClick: noop },
|
|
15
|
-
{ label: 'Review', onClick: noop },
|
|
16
|
-
{ label: 'Pay', onClick: noop },
|
|
17
|
-
];
|
|
18
|
-
|
|
19
12
|
const meta: Meta<typeof FlowNavigation> = {
|
|
20
13
|
component: FlowNavigation,
|
|
21
14
|
title: 'Navigation/FlowNavigation/Tests/RTL Diff',
|
|
@@ -29,50 +22,87 @@ export default meta;
|
|
|
29
22
|
type Story = StoryObj<typeof FlowNavigation>;
|
|
30
23
|
|
|
31
24
|
export const Desktop: Story = {
|
|
32
|
-
render: () =>
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
25
|
+
render: () => {
|
|
26
|
+
const i18n = useRtlDiffI18n();
|
|
27
|
+
const steps = [
|
|
28
|
+
{ label: i18n.amount, hoverLabel: i18n.amountValue, onClick: noop },
|
|
29
|
+
{ label: i18n.you, hoverLabel: i18n.recipientName, onClick: noop },
|
|
30
|
+
{ label: i18n.review, onClick: noop },
|
|
31
|
+
{ label: i18n.pay, onClick: noop },
|
|
32
|
+
];
|
|
33
|
+
return (
|
|
34
|
+
<>
|
|
35
|
+
<FlowNavigation
|
|
36
|
+
activeStep={2}
|
|
37
|
+
avatar={<AvatarView profileType={ProfileType.PERSONAL} />}
|
|
38
|
+
logo={<Logo />}
|
|
39
|
+
steps={steps}
|
|
40
|
+
onClose={noop}
|
|
41
|
+
onGoBack={noop}
|
|
42
|
+
/>
|
|
43
|
+
<FlowNavigation
|
|
44
|
+
avatar={<AvatarView profileType={ProfileType.PERSONAL} />}
|
|
45
|
+
logo={<Logo />}
|
|
46
|
+
onClose={noop}
|
|
47
|
+
/>
|
|
48
|
+
<FlowNavigation
|
|
49
|
+
done
|
|
50
|
+
avatar={<AvatarView profileType={ProfileType.PERSONAL} />}
|
|
51
|
+
logo={<Logo />}
|
|
52
|
+
steps={steps}
|
|
53
|
+
onClose={noop}
|
|
54
|
+
/>
|
|
55
|
+
</>
|
|
56
|
+
);
|
|
57
|
+
},
|
|
58
|
+
...withRTLDiff({
|
|
59
|
+
i18n: {
|
|
60
|
+
amount: { en: 'Amount', ar: 'المبلغ' },
|
|
61
|
+
amountValue: { en: '100 GBP', ar: '100 جنيه إسترليني' },
|
|
62
|
+
you: { en: 'You', ar: 'بياناتك' },
|
|
63
|
+
recipientName: { en: 'Elena Durante', ar: 'إيلينا دورانتي' },
|
|
64
|
+
review: { en: 'Review', ar: 'المراجعة' },
|
|
65
|
+
pay: { en: 'Pay', ar: 'الدفع' },
|
|
66
|
+
},
|
|
67
|
+
}),
|
|
57
68
|
};
|
|
58
69
|
|
|
59
70
|
export const Mobile: Story = {
|
|
60
|
-
render: () =>
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
71
|
+
render: () => {
|
|
72
|
+
const i18n = useRtlDiffI18n();
|
|
73
|
+
const steps = [
|
|
74
|
+
{ label: i18n.amount, hoverLabel: i18n.amountValue, onClick: noop },
|
|
75
|
+
{ label: i18n.you, hoverLabel: i18n.recipientName, onClick: noop },
|
|
76
|
+
{ label: i18n.review, onClick: noop },
|
|
77
|
+
{ label: i18n.pay, onClick: noop },
|
|
78
|
+
];
|
|
79
|
+
return (
|
|
80
|
+
<>
|
|
81
|
+
<FlowNavigation
|
|
82
|
+
activeStep={2}
|
|
83
|
+
avatar={<AvatarView profileType={ProfileType.PERSONAL} />}
|
|
84
|
+
logo={<Logo />}
|
|
85
|
+
steps={steps}
|
|
86
|
+
onClose={noop}
|
|
87
|
+
onGoBack={noop}
|
|
88
|
+
/>
|
|
89
|
+
<FlowNavigation
|
|
90
|
+
avatar={<AvatarView profileType={ProfileType.PERSONAL} />}
|
|
91
|
+
logo={<Logo />}
|
|
92
|
+
onClose={noop}
|
|
93
|
+
/>
|
|
94
|
+
</>
|
|
95
|
+
);
|
|
96
|
+
},
|
|
97
|
+
...withRTLDiff({
|
|
98
|
+
viewport: 'largeMobile',
|
|
99
|
+
i18n: {
|
|
100
|
+
amount: { en: 'Amount', ar: 'المبلغ' },
|
|
101
|
+
amountValue: { en: '100 GBP', ar: '100 جنيه إسترليني' },
|
|
102
|
+
you: { en: 'You', ar: 'بياناتك' },
|
|
103
|
+
recipientName: { en: 'Elena Durante', ar: 'إيلينا دورانتي' },
|
|
104
|
+
review: { en: 'Review', ar: 'المراجعة' },
|
|
105
|
+
pay: { en: 'Pay', ar: 'الدفع' },
|
|
106
|
+
},
|
|
107
|
+
}),
|
|
78
108
|
};
|
|
@@ -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
|
};
|
|
@@ -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,
|
|
@@ -74,6 +74,8 @@ export const RTLDiff: Story = {
|
|
|
74
74
|
placeholder_both: { en: 'addonStart and addonEnd', ar: 'البادئة والنهاية' },
|
|
75
75
|
placeholder_start: { en: 'addonStart only', ar: 'البادئة فقط' },
|
|
76
76
|
placeholder_end: { en: 'addonEnd only', ar: 'النهاية فقط' },
|
|
77
|
+
copy: { en: 'Copy', ar: 'نسخ' },
|
|
78
|
+
clear: { en: 'Clear', ar: 'مسح' },
|
|
77
79
|
},
|
|
78
80
|
}),
|
|
79
81
|
};
|