@transferwise/components 0.0.0-experimental-102c421 → 0.0.0-experimental-151e673
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/ProcessIndicator/ProcessIndicator.js +1 -1
- package/build/ProcessIndicator/ProcessIndicator.js.map +1 -1
- package/build/ProcessIndicator/ProcessIndicator.mjs +1 -1
- package/build/ProcessIndicator/ProcessIndicator.mjs.map +1 -1
- package/build/SegmentedControl/SegmentedControl.js +9 -2
- package/build/SegmentedControl/SegmentedControl.js.map +1 -1
- package/build/SegmentedControl/SegmentedControl.mjs +9 -2
- package/build/SegmentedControl/SegmentedControl.mjs.map +1 -1
- package/build/main.css +54 -62
- package/build/styles/AvatarLayout/AvatarLayout.css +26 -9
- package/build/styles/AvatarView/AvatarView.css +0 -8
- package/build/styles/AvatarView/Dot/Dot.css +0 -8
- package/build/styles/CheckboxButton/CheckboxButton.css +0 -3
- package/build/styles/SegmentedControl/SegmentedControl.css +2 -1
- package/build/styles/SlidingPanel/SlidingPanel.css +0 -8
- package/build/styles/UploadInput/UploadItem/UploadItem.css +5 -4
- package/build/styles/_deprecated/Badge/Badge.css +2 -4
- package/build/styles/css/accordion.css +0 -3
- package/build/styles/css/buttons.css +7 -1
- package/build/styles/css/chevron.css +0 -3
- package/build/styles/css/neptune.css +19 -25
- package/build/styles/css/process.css +9 -15
- package/build/styles/css/tick.css +3 -6
- package/build/styles/main.css +54 -62
- package/build/styles/styles/less/accordion.css +0 -3
- package/build/styles/styles/less/buttons.css +7 -1
- package/build/styles/styles/less/chevron.css +0 -3
- package/build/styles/styles/less/neptune.css +19 -25
- package/build/styles/styles/less/process.css +9 -15
- package/build/styles/styles/less/tick.css +3 -6
- package/build/types/SegmentedControl/SegmentedControl.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/AvatarLayout/AvatarLayout.css +26 -9
- package/src/AvatarLayout/AvatarLayout.less +46 -22
- package/src/AvatarLayout/_stories/AvatarLayout.test.story.tsx +17 -42
- package/src/AvatarView/AvatarView.css +0 -8
- package/src/AvatarView/Dot/Dot.css +0 -8
- package/src/AvatarView/Dot/Dot.less +1 -7
- package/src/Button/_stories/Button.test.story.tsx +1 -1
- package/src/Checkbox/_stories/Checkbox.story.tsx +1 -1
- package/src/Checkbox/_stories/Checkbox.test.story.tsx +2 -3
- package/src/CheckboxButton/CheckboxButton.css +0 -3
- package/src/CheckboxButton/CheckboxButton.less +0 -4
- package/src/Chevron/_stories/Chevron.test.story.tsx +2 -2
- package/src/Field/_stories/Field.test.story.tsx +48 -37
- package/src/FlowNavigation/_stories/FlowNavigation.rtl.test.story.tsx +78 -0
- package/src/FlowNavigation/_stories/FlowNavigation.test.story.tsx +0 -44
- package/src/Header/_stories/Header.test.story.tsx +1 -1
- package/src/Info/_stories/Info.rtl.test.story.tsx +10 -35
- package/src/Info/_stories/Info.story.tsx +1 -1
- package/src/Inputs/SelectInput/_stories/SelectInput.test.story.tsx +1 -1
- package/src/Label/_stories/Label.test.story.tsx +35 -22
- package/src/ListItem/_stories/subcomponents.tsx +1 -1
- package/src/MoneyInput/_stories/MoneyInput.rtl.test.story.tsx +1 -1
- package/src/Nudge/_stories/Nudge.test.story.tsx +12 -29
- package/src/PhoneNumberInput/_stories/{PhoneNumberInput.rtl.test.story.tsx → PhoneNumberInput.test.story.tsx} +10 -18
- package/src/Popover/_stories/Popover.rtl.test.story.tsx +40 -50
- package/src/ProcessIndicator/ProcessIndicator.tsx +1 -1
- package/src/ProgressBar/_stories/ProgressBar.test.story.tsx +19 -33
- package/src/SegmentedControl/SegmentedControl.css +2 -1
- package/src/SegmentedControl/SegmentedControl.less +4 -2
- package/src/SegmentedControl/SegmentedControl.tsx +8 -2
- package/src/SegmentedControl/_stories/SegmentedControl.test.story.tsx +16 -8
- package/src/SlidingPanel/SlidingPanel.css +0 -8
- package/src/SlidingPanel/SlidingPanel.less +0 -6
- package/src/SlidingPanel/_stories/SlidingPanel.rtl.test.story.tsx +3 -4
- package/src/Snackbar/_stories/Snackbar.rtl.test.story.tsx +16 -14
- package/src/Snackbar/_stories/Snackbar.story.tsx +1 -1
- package/src/Snackbar/_stories/Snackbar.test.story.tsx +1 -1
- package/src/StatusIcon/_stories/StatusIcon.test.story.tsx +4 -12
- package/src/UploadInput/UploadItem/UploadItem.css +5 -4
- package/src/UploadInput/UploadItem/UploadItem.less +6 -7
- package/src/UploadInput/_stories/UploadInput.test.story.tsx +1 -1
- package/src/_deprecated/Badge/Badge.css +2 -4
- package/src/_deprecated/Badge/Badge.less +14 -7
- package/src/_deprecated/CriticalBanner/_stories/CriticalCommsBanner.test.story.tsx +16 -0
- package/src/_deprecated/OverlayHeader/_stories/OverlayHeader.test.story.tsx +0 -15
- package/src/main.css +54 -62
- package/src/styles/less/accordion.css +0 -3
- package/src/styles/less/buttons.css +7 -1
- package/src/styles/less/buttons.less +11 -3
- package/src/styles/less/chevron.css +0 -3
- package/src/styles/less/chevron.less +0 -4
- package/src/styles/less/neptune.css +19 -25
- package/src/styles/less/process.css +9 -15
- package/src/styles/less/process.less +6 -13
- package/src/styles/less/tick.css +3 -6
- package/src/styles/less/tick.less +3 -7
- package/src/Loader/_stories/Loader.test.story.tsx +0 -23
- package/src/ProcessIndicator/_stories/ProcessIndicator.test.story.tsx +0 -32
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { useState } from 'react';
|
|
2
2
|
import { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
3
|
-
import { withRTLDiff } from '../../../.storybook/decorators/RtlDiffDecorator';
|
|
3
|
+
import { useRtlDiffI18n, withRTLDiff } from '../../../.storybook/decorators/RtlDiffDecorator';
|
|
4
4
|
import { Input } from '../../Inputs/Input/Input';
|
|
5
5
|
import { TextArea } from '../../Inputs/TextArea/TextArea';
|
|
6
|
-
import { lorem10 } from '../../test-utils';
|
|
7
6
|
import Field, { FieldProps } from '..';
|
|
8
7
|
import { Sentiment } from '../../common';
|
|
9
8
|
|
|
@@ -59,44 +58,56 @@ export const DeprecatedProps: Story = {
|
|
|
59
58
|
};
|
|
60
59
|
|
|
61
60
|
export const RTLDiff: Story = {
|
|
62
|
-
render: () =>
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
<
|
|
67
|
-
|
|
61
|
+
render: () => {
|
|
62
|
+
const i18n = useRtlDiffI18n();
|
|
63
|
+
return (
|
|
64
|
+
<>
|
|
65
|
+
<Field label={i18n.requiredLabel}>
|
|
66
|
+
<Input defaultValue={i18n.inputValue} />
|
|
67
|
+
</Field>
|
|
68
68
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
</Field>
|
|
69
|
+
<Field label={i18n.optionalLabel} required={false}>
|
|
70
|
+
<Input defaultValue={i18n.inputValue} />
|
|
71
|
+
</Field>
|
|
73
72
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
</Field>
|
|
73
|
+
<Field
|
|
74
|
+
label={i18n.descriptionLabel}
|
|
75
|
+
required={false}
|
|
76
|
+
description={i18n.description}
|
|
77
|
+
message={i18n.validationMessage}
|
|
78
|
+
sentiment="negative"
|
|
79
|
+
>
|
|
80
|
+
<Input defaultValue={i18n.inputValue} />
|
|
81
|
+
</Field>
|
|
84
82
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
</Field>
|
|
83
|
+
<Field message={i18n.helpfulMessage} sentiment="positive">
|
|
84
|
+
<Input defaultValue={i18n.inputValue} />
|
|
85
|
+
</Field>
|
|
89
86
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
</Field>
|
|
87
|
+
<Field label={i18n.loadingLabel} message={i18n.savingMessage} messageLoading>
|
|
88
|
+
<Input defaultValue={i18n.inputValue} />
|
|
89
|
+
</Field>
|
|
94
90
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
...withRTLDiff(
|
|
91
|
+
<Field label={i18n.textareaLabel} required={false} description={i18n.maxChars}>
|
|
92
|
+
<TextArea maxLength={100} defaultValue={i18n.textareaValue} />
|
|
93
|
+
</Field>
|
|
94
|
+
</>
|
|
95
|
+
);
|
|
96
|
+
},
|
|
97
|
+
...withRTLDiff({
|
|
98
|
+
i18n: {
|
|
99
|
+
requiredLabel: { ltr: 'Required field', rtl: 'حقل مطلوب' },
|
|
100
|
+
optionalLabel: { ltr: 'Optional field', rtl: 'حقل اختياري' },
|
|
101
|
+
descriptionLabel: { ltr: 'Field with description and message', rtl: 'حقل مع وصف ورسالة' },
|
|
102
|
+
description: { ltr: 'A short description of the field', rtl: 'وصف قصير للحقل' },
|
|
103
|
+
validationMessage: { ltr: 'This is a validation message', rtl: 'هذه رسالة تحقق' },
|
|
104
|
+
helpfulMessage: { ltr: 'A helpful message', rtl: 'رسالة مفيدة' },
|
|
105
|
+
loadingLabel: { ltr: 'Field with loading message', rtl: 'حقل مع رسالة تحميل' },
|
|
106
|
+
savingMessage: { ltr: 'Saving…', rtl: 'جارٍ الحفظ…' },
|
|
107
|
+
textareaLabel: { ltr: 'Textarea with char counter', rtl: 'حقل نص مع عداد الأحرف' },
|
|
108
|
+
maxChars: { ltr: 'Max 100 characters', rtl: 'الحد الأقصى 100 حرف' },
|
|
109
|
+
inputValue: { ltr: 'Input value', rtl: 'قيمة الإدخال' },
|
|
110
|
+
textareaValue: { ltr: 'Textarea value', rtl: 'قيمة حقل النص' },
|
|
111
|
+
},
|
|
112
|
+
}),
|
|
102
113
|
};
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
2
|
+
|
|
3
|
+
import { withRTLDiff } from '../../../.storybook/decorators/RtlDiffDecorator';
|
|
4
|
+
import AvatarView from '../../AvatarView';
|
|
5
|
+
import { ProfileType } from '../../common';
|
|
6
|
+
import Logo from '../../Logo';
|
|
7
|
+
|
|
8
|
+
import FlowNavigation from '../FlowNavigation';
|
|
9
|
+
|
|
10
|
+
const noop = () => {};
|
|
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
|
+
const meta: Meta<typeof FlowNavigation> = {
|
|
20
|
+
component: FlowNavigation,
|
|
21
|
+
title: 'Navigation/FlowNavigation/Tests/RTL Diff',
|
|
22
|
+
tags: ['!autodocs', '!manifest'],
|
|
23
|
+
parameters: {
|
|
24
|
+
padding: '0',
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
export default meta;
|
|
28
|
+
|
|
29
|
+
type Story = StoryObj<typeof FlowNavigation>;
|
|
30
|
+
|
|
31
|
+
export const Desktop: Story = {
|
|
32
|
+
render: () => (
|
|
33
|
+
<>
|
|
34
|
+
<FlowNavigation
|
|
35
|
+
activeStep={2}
|
|
36
|
+
avatar={<AvatarView profileType={ProfileType.PERSONAL} />}
|
|
37
|
+
logo={<Logo />}
|
|
38
|
+
steps={steps}
|
|
39
|
+
onClose={noop}
|
|
40
|
+
onGoBack={noop}
|
|
41
|
+
/>
|
|
42
|
+
<FlowNavigation
|
|
43
|
+
avatar={<AvatarView profileType={ProfileType.PERSONAL} />}
|
|
44
|
+
logo={<Logo />}
|
|
45
|
+
onClose={noop}
|
|
46
|
+
/>
|
|
47
|
+
<FlowNavigation
|
|
48
|
+
done
|
|
49
|
+
avatar={<AvatarView profileType={ProfileType.PERSONAL} />}
|
|
50
|
+
logo={<Logo />}
|
|
51
|
+
steps={steps}
|
|
52
|
+
onClose={noop}
|
|
53
|
+
/>
|
|
54
|
+
</>
|
|
55
|
+
),
|
|
56
|
+
...withRTLDiff(),
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
export const Mobile: Story = {
|
|
60
|
+
render: () => (
|
|
61
|
+
<>
|
|
62
|
+
<FlowNavigation
|
|
63
|
+
activeStep={2}
|
|
64
|
+
avatar={<AvatarView profileType={ProfileType.PERSONAL} />}
|
|
65
|
+
logo={<Logo />}
|
|
66
|
+
steps={steps}
|
|
67
|
+
onClose={noop}
|
|
68
|
+
onGoBack={noop}
|
|
69
|
+
/>
|
|
70
|
+
<FlowNavigation
|
|
71
|
+
avatar={<AvatarView profileType={ProfileType.PERSONAL} />}
|
|
72
|
+
logo={<Logo />}
|
|
73
|
+
onClose={noop}
|
|
74
|
+
/>
|
|
75
|
+
</>
|
|
76
|
+
),
|
|
77
|
+
...withRTLDiff({ viewport: 'largeMobile' }),
|
|
78
|
+
};
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
2
2
|
|
|
3
|
-
import { withRTLDiff } from '../../../.storybook/decorators/RtlDiffDecorator';
|
|
4
3
|
import AvatarView from '../../AvatarView';
|
|
5
4
|
import { ProfileType } from '../../common';
|
|
6
5
|
import Logo from '../../Logo';
|
|
@@ -77,46 +76,3 @@ export const LongLabel: Story = {
|
|
|
77
76
|
/>
|
|
78
77
|
),
|
|
79
78
|
};
|
|
80
|
-
|
|
81
|
-
const rtlSteps = [
|
|
82
|
-
{ label: 'Amount', hoverLabel: '100 GBP', onClick: noop },
|
|
83
|
-
{ label: 'You', hoverLabel: 'Elena Durante', onClick: noop },
|
|
84
|
-
{ label: 'Review', onClick: noop },
|
|
85
|
-
{ label: 'Pay', onClick: noop },
|
|
86
|
-
];
|
|
87
|
-
|
|
88
|
-
/**
|
|
89
|
-
* FlowNavigation has directional layout: back button on inline-start,
|
|
90
|
-
* close button and avatar on inline-end, and a stepper progress bar that
|
|
91
|
-
* flows in the reading direction. All of these flip in RTL.
|
|
92
|
-
*/
|
|
93
|
-
export const RTLDiff: Story = {
|
|
94
|
-
render: () => (
|
|
95
|
-
<>
|
|
96
|
-
{/* With stepper, back button, close button, and avatar */}
|
|
97
|
-
<FlowNavigation
|
|
98
|
-
activeStep={2}
|
|
99
|
-
avatar={<AvatarView profileType={ProfileType.PERSONAL} />}
|
|
100
|
-
logo={<Logo />}
|
|
101
|
-
steps={rtlSteps}
|
|
102
|
-
onClose={noop}
|
|
103
|
-
onGoBack={noop}
|
|
104
|
-
/>
|
|
105
|
-
{/* Without stepper — logo left, close button right */}
|
|
106
|
-
<FlowNavigation
|
|
107
|
-
avatar={<AvatarView profileType={ProfileType.PERSONAL} />}
|
|
108
|
-
logo={<Logo />}
|
|
109
|
-
onClose={noop}
|
|
110
|
-
/>
|
|
111
|
-
{/* Done state — no stepper, logo and close button only */}
|
|
112
|
-
<FlowNavigation
|
|
113
|
-
done
|
|
114
|
-
avatar={<AvatarView profileType={ProfileType.PERSONAL} />}
|
|
115
|
-
logo={<Logo />}
|
|
116
|
-
steps={rtlSteps}
|
|
117
|
-
onClose={noop}
|
|
118
|
-
/>
|
|
119
|
-
</>
|
|
120
|
-
),
|
|
121
|
-
...withRTLDiff(),
|
|
122
|
-
};
|
|
@@ -86,7 +86,7 @@ export const SectionTrailingSpaceWithAction: Story = {
|
|
|
86
86
|
};
|
|
87
87
|
|
|
88
88
|
export const AllVariants: Story = {
|
|
89
|
-
...withVariantConfig(['default', 'dark', 'bright-green', 'forest-green'], {
|
|
89
|
+
...withVariantConfig(['default', 'dark', 'bright-green', 'forest-green', 'rtl'], {
|
|
90
90
|
parameters: {
|
|
91
91
|
padding: '0',
|
|
92
92
|
},
|
|
@@ -12,6 +12,8 @@ export default {
|
|
|
12
12
|
|
|
13
13
|
type Story = StoryObj<typeof Info>;
|
|
14
14
|
|
|
15
|
+
const iframeDiff = withRTLDiff({ renderAs: 'iframe' });
|
|
16
|
+
|
|
15
17
|
const openInfo = async ({ canvasElement }: { canvasElement: HTMLElement }) => {
|
|
16
18
|
const canvas = within(canvasElement);
|
|
17
19
|
const button = canvas.queryByRole('button');
|
|
@@ -19,60 +21,32 @@ const openInfo = async ({ canvasElement }: { canvasElement: HTMLElement }) => {
|
|
|
19
21
|
await userEvent.click(button);
|
|
20
22
|
};
|
|
21
23
|
|
|
22
|
-
export const
|
|
23
|
-
render: () => (
|
|
24
|
-
<Info
|
|
25
|
-
aria-label="Info trigger"
|
|
26
|
-
title="Information"
|
|
27
|
-
content="This is some descriptive content inside the info component."
|
|
28
|
-
presentation="POPOVER"
|
|
29
|
-
preferredPlacement="top"
|
|
30
|
-
/>
|
|
31
|
-
),
|
|
32
|
-
play: openInfo,
|
|
33
|
-
...withRTLDiff({ renderAs: 'iframe', hAlign: 'center', vAlign: 'bottom' }),
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
export const PlacementRight: Story = {
|
|
37
|
-
render: () => (
|
|
38
|
-
<Info
|
|
39
|
-
aria-label="Info trigger"
|
|
40
|
-
title="Information"
|
|
41
|
-
content="This is some descriptive content inside the info component."
|
|
42
|
-
presentation="POPOVER"
|
|
43
|
-
preferredPlacement="right"
|
|
44
|
-
/>
|
|
45
|
-
),
|
|
46
|
-
play: openInfo,
|
|
47
|
-
...withRTLDiff({ renderAs: 'iframe', hAlign: 'left', vAlign: 'center' }),
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
export const PlacementBottom: Story = {
|
|
24
|
+
export const Popover: Story = {
|
|
51
25
|
render: () => (
|
|
52
26
|
<Info
|
|
53
27
|
aria-label="Info trigger"
|
|
54
28
|
title="Information"
|
|
55
29
|
content="This is some descriptive content inside the info component."
|
|
56
30
|
presentation="POPOVER"
|
|
57
|
-
|
|
31
|
+
size="sm"
|
|
58
32
|
/>
|
|
59
33
|
),
|
|
60
34
|
play: openInfo,
|
|
61
|
-
...
|
|
35
|
+
...iframeDiff,
|
|
62
36
|
};
|
|
63
37
|
|
|
64
|
-
export const
|
|
38
|
+
export const PopoverLarge: Story = {
|
|
65
39
|
render: () => (
|
|
66
40
|
<Info
|
|
67
41
|
aria-label="Info trigger"
|
|
68
42
|
title="Information"
|
|
69
43
|
content="This is some descriptive content inside the info component."
|
|
70
44
|
presentation="POPOVER"
|
|
71
|
-
|
|
45
|
+
size="lg"
|
|
72
46
|
/>
|
|
73
47
|
),
|
|
74
48
|
play: openInfo,
|
|
75
|
-
...
|
|
49
|
+
...iframeDiff,
|
|
76
50
|
};
|
|
77
51
|
|
|
78
52
|
export const Modal: Story = {
|
|
@@ -82,8 +56,9 @@ export const Modal: Story = {
|
|
|
82
56
|
title="Information"
|
|
83
57
|
content="This is some descriptive content inside the info component."
|
|
84
58
|
presentation="MODAL"
|
|
59
|
+
size="sm"
|
|
85
60
|
/>
|
|
86
61
|
),
|
|
87
62
|
play: openInfo,
|
|
88
|
-
...
|
|
63
|
+
...iframeDiff,
|
|
89
64
|
};
|
|
@@ -166,7 +166,7 @@ export const Variants: Story<TestCurrency> = {
|
|
|
166
166
|
</div>
|
|
167
167
|
);
|
|
168
168
|
},
|
|
169
|
-
...withVariantConfig(['default', 'dark', 'bright-green', 'forest-green']),
|
|
169
|
+
...withVariantConfig(['default', 'dark', 'bright-green', 'forest-green', 'rtl']),
|
|
170
170
|
};
|
|
171
171
|
|
|
172
172
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
2
|
-
import { withRTLDiff } from '../../../.storybook/decorators/RtlDiffDecorator';
|
|
2
|
+
import { useRtlDiffI18n, withRTLDiff } from '../../../.storybook/decorators/RtlDiffDecorator';
|
|
3
3
|
import Info from '../../Info';
|
|
4
4
|
import Label from '..';
|
|
5
5
|
|
|
@@ -12,25 +12,38 @@ export default {
|
|
|
12
12
|
type Story = StoryObj<typeof Label>;
|
|
13
13
|
|
|
14
14
|
export const RTLDiff: Story = {
|
|
15
|
-
render: () =>
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
<Label.
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
<
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
<Label
|
|
29
|
-
Label
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
15
|
+
render: () => {
|
|
16
|
+
const i18n = useRtlDiffI18n();
|
|
17
|
+
return (
|
|
18
|
+
<>
|
|
19
|
+
<Label>{i18n.plain}</Label>
|
|
20
|
+
<Label>
|
|
21
|
+
<Label.Optional>{i18n.optional}</Label.Optional>
|
|
22
|
+
</Label>
|
|
23
|
+
<Label>
|
|
24
|
+
<div>
|
|
25
|
+
{i18n.withInfo} <Info content={i18n.tooltip} aria-label={i18n.moreInfo} />
|
|
26
|
+
</div>
|
|
27
|
+
</Label>
|
|
28
|
+
<Label>
|
|
29
|
+
<Label.Optional>
|
|
30
|
+
{i18n.optionalWithInfo} <Info content={i18n.tooltip} aria-label={i18n.moreInfo} />
|
|
31
|
+
</Label.Optional>
|
|
32
|
+
</Label>
|
|
33
|
+
</>
|
|
34
|
+
);
|
|
35
|
+
},
|
|
36
|
+
...withRTLDiff({
|
|
37
|
+
i18n: {
|
|
38
|
+
plain: { ltr: 'Plain label text', rtl: 'نص التسمية العادي' },
|
|
39
|
+
optional: { ltr: 'Label with optional marker', rtl: 'تسمية مع علامة اختيارية' },
|
|
40
|
+
withInfo: { ltr: 'Label with info icon', rtl: 'تسمية مع أيقونة معلومات' },
|
|
41
|
+
optionalWithInfo: {
|
|
42
|
+
ltr: 'Label with optional and info icon',
|
|
43
|
+
rtl: 'تسمية مع اختيارية وأيقونة معلومات',
|
|
44
|
+
},
|
|
45
|
+
tooltip: { ltr: 'Helpful tooltip content', rtl: 'محتوى تلميح مفيد' },
|
|
46
|
+
moreInfo: { ltr: 'More information', rtl: 'مزيد من المعلومات' },
|
|
47
|
+
},
|
|
48
|
+
}),
|
|
36
49
|
};
|
|
@@ -60,7 +60,7 @@ export const SB_LIST_ITEM_CONTROLS: Record<SB_ListItem_ControlType, ReactNode> =
|
|
|
60
60
|
),
|
|
61
61
|
navigation: <ListItem.Navigation href="https://wise.com" />,
|
|
62
62
|
navigationAsButton: <ListItem.Navigation onClick={fn()} />,
|
|
63
|
-
checkbox: <ListItem.Checkbox
|
|
63
|
+
checkbox: <ListItem.Checkbox onChange={() => {}} />,
|
|
64
64
|
radio: <ListItem.Radio name="radio" value={Math.random().toString()} onChange={() => {}} />,
|
|
65
65
|
switch: <ListItem.Switch onClick={() => {}} />,
|
|
66
66
|
iconButton: (
|
|
@@ -10,45 +10,28 @@ export default {
|
|
|
10
10
|
|
|
11
11
|
type Story = StoryObj<typeof Nudge>;
|
|
12
12
|
|
|
13
|
-
const MEDIA_NAMES = [
|
|
14
|
-
'globe',
|
|
15
|
-
'lock',
|
|
16
|
-
'wallet',
|
|
17
|
-
'gear',
|
|
18
|
-
'invite-letter',
|
|
19
|
-
'personal-card',
|
|
20
|
-
'business-card',
|
|
21
|
-
'heart',
|
|
22
|
-
'multi-currency',
|
|
23
|
-
'shopping-bag',
|
|
24
|
-
'flower',
|
|
25
|
-
'gift-box',
|
|
26
|
-
'backpack',
|
|
27
|
-
'documents',
|
|
28
|
-
] as const;
|
|
29
|
-
|
|
30
13
|
export const RTLDiff: Story = {
|
|
31
14
|
render: () => (
|
|
32
15
|
<>
|
|
33
|
-
{MEDIA_NAMES.map((mediaName) => (
|
|
34
|
-
<Nudge
|
|
35
|
-
key={mediaName}
|
|
36
|
-
mediaName={mediaName}
|
|
37
|
-
title={mediaName}
|
|
38
|
-
link="Link"
|
|
39
|
-
href="#"
|
|
40
|
-
onDismiss={() => {}}
|
|
41
|
-
/>
|
|
42
|
-
))}
|
|
43
16
|
<Nudge
|
|
44
17
|
mediaName="globe"
|
|
45
|
-
title="With
|
|
18
|
+
title="With media and dismiss"
|
|
19
|
+
link="Link"
|
|
20
|
+
href="#"
|
|
21
|
+
onDismiss={() => {}}
|
|
22
|
+
/>
|
|
23
|
+
<div style={{ marginTop: 16 }} />
|
|
24
|
+
<Nudge
|
|
25
|
+
mediaName="globe"
|
|
26
|
+
title="With media, action, and dismiss"
|
|
46
27
|
action={{ text: 'Learn more', href: '#' }}
|
|
47
28
|
onDismiss={() => {}}
|
|
48
29
|
/>
|
|
30
|
+
<div style={{ marginTop: 16 }} />
|
|
49
31
|
<Nudge title="Without media, with dismiss" link="Link" href="#" onDismiss={() => {}} />
|
|
32
|
+
<div style={{ marginTop: 16 }} />
|
|
50
33
|
<Nudge title="Without media, no dismiss" link="Link" href="#" />
|
|
51
34
|
</>
|
|
52
35
|
),
|
|
53
|
-
...withRTLDiff(
|
|
36
|
+
...withRTLDiff(),
|
|
54
37
|
};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
2
|
-
import { userEvent, within } from 'storybook/test';
|
|
3
2
|
|
|
4
3
|
import { withRTLDiff } from '../../../.storybook/decorators/RtlDiffDecorator';
|
|
5
4
|
import Field from '../../Field/Field';
|
|
@@ -7,13 +6,21 @@ import PhoneNumberInput from '..';
|
|
|
7
6
|
|
|
8
7
|
export default {
|
|
9
8
|
component: PhoneNumberInput,
|
|
10
|
-
title: 'Forms/PhoneNumberInput/Tests
|
|
9
|
+
title: 'Forms/PhoneNumberInput/Tests',
|
|
11
10
|
tags: ['!autodocs', '!manifest'],
|
|
12
11
|
} satisfies Meta<typeof PhoneNumberInput>;
|
|
13
12
|
|
|
14
13
|
type Story = StoryObj<typeof PhoneNumberInput>;
|
|
15
14
|
|
|
16
|
-
|
|
15
|
+
/**
|
|
16
|
+
* The country code selector sits on the inline-start side of the phone number input.
|
|
17
|
+
* In RTL the two elements should swap sides — the selector moves to the right and
|
|
18
|
+
* the text field moves to the left. This diff verifies the flex row reverses correctly.
|
|
19
|
+
*
|
|
20
|
+
* Size variants are included because the size prop changes the input-group class and
|
|
21
|
+
* may affect spacing between the two sub-inputs.
|
|
22
|
+
*/
|
|
23
|
+
export const RTLDiff: Story = {
|
|
17
24
|
render: () => (
|
|
18
25
|
<>
|
|
19
26
|
<Field label="Default (md)">
|
|
@@ -35,18 +42,3 @@ export const Sizes: Story = {
|
|
|
35
42
|
),
|
|
36
43
|
...withRTLDiff(),
|
|
37
44
|
};
|
|
38
|
-
|
|
39
|
-
export const DropdownOpen: Story = {
|
|
40
|
-
render: () => (
|
|
41
|
-
<Field label="Phone number">
|
|
42
|
-
<PhoneNumberInput onChange={() => {}} />
|
|
43
|
-
</Field>
|
|
44
|
-
),
|
|
45
|
-
play: async ({ canvasElement }) => {
|
|
46
|
-
const canvas = within(canvasElement);
|
|
47
|
-
const trigger = canvas.queryByRole('combobox');
|
|
48
|
-
if (!trigger) return;
|
|
49
|
-
await userEvent.click(trigger);
|
|
50
|
-
},
|
|
51
|
-
...withRTLDiff({ renderAs: 'iframe', hAlign: 'center' }),
|
|
52
|
-
};
|
|
@@ -14,16 +14,6 @@ export default {
|
|
|
14
14
|
|
|
15
15
|
type Story = StoryObj<typeof Popover>;
|
|
16
16
|
|
|
17
|
-
const iframeDiff = withRTLDiff({ renderAs: 'iframe' });
|
|
18
|
-
|
|
19
|
-
const containerStyle: React.CSSProperties = {
|
|
20
|
-
display: 'flex',
|
|
21
|
-
justifyContent: 'center',
|
|
22
|
-
alignItems: 'center',
|
|
23
|
-
minHeight: '24rem',
|
|
24
|
-
width: '100%',
|
|
25
|
-
};
|
|
26
|
-
|
|
27
17
|
const clickTrigger = async ({ canvasElement }: { canvasElement: HTMLElement }) => {
|
|
28
18
|
const canvas = within(canvasElement);
|
|
29
19
|
const trigger = canvas.queryByRole('button');
|
|
@@ -33,64 +23,64 @@ const clickTrigger = async ({ canvasElement }: { canvasElement: HTMLElement }) =
|
|
|
33
23
|
|
|
34
24
|
export const PlacementRight: Story = {
|
|
35
25
|
render: () => (
|
|
36
|
-
<
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
>
|
|
42
|
-
|
|
43
|
-
</
|
|
44
|
-
</
|
|
26
|
+
<Popover
|
|
27
|
+
preferredPlacement={Position.RIGHT}
|
|
28
|
+
title="Guaranteed rate"
|
|
29
|
+
content="You'll get this rate as long as we receive your 10 EUR within the next 51 hours."
|
|
30
|
+
>
|
|
31
|
+
<Button size="sm" v2>
|
|
32
|
+
right
|
|
33
|
+
</Button>
|
|
34
|
+
</Popover>
|
|
45
35
|
),
|
|
46
36
|
play: clickTrigger,
|
|
47
|
-
...
|
|
37
|
+
...withRTLDiff({ renderAs: 'iframe', hAlign: 'left', vAlign: 'center' }),
|
|
48
38
|
};
|
|
49
39
|
|
|
50
40
|
export const PlacementLeft: Story = {
|
|
51
41
|
render: () => (
|
|
52
|
-
<
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
>
|
|
58
|
-
|
|
59
|
-
</
|
|
60
|
-
</
|
|
42
|
+
<Popover
|
|
43
|
+
preferredPlacement={Position.LEFT}
|
|
44
|
+
title="Guaranteed rate"
|
|
45
|
+
content="You'll get this rate as long as we receive your 10 EUR within the next 51 hours."
|
|
46
|
+
>
|
|
47
|
+
<Button size="sm" v2>
|
|
48
|
+
left
|
|
49
|
+
</Button>
|
|
50
|
+
</Popover>
|
|
61
51
|
),
|
|
62
52
|
play: clickTrigger,
|
|
63
|
-
...
|
|
53
|
+
...withRTLDiff({ renderAs: 'iframe', hAlign: 'right', vAlign: 'center' }),
|
|
64
54
|
};
|
|
65
55
|
|
|
66
56
|
export const PlacementTop: Story = {
|
|
67
57
|
render: () => (
|
|
68
|
-
<
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
>
|
|
74
|
-
|
|
75
|
-
</
|
|
76
|
-
</
|
|
58
|
+
<Popover
|
|
59
|
+
preferredPlacement={Position.TOP}
|
|
60
|
+
title="Guaranteed rate"
|
|
61
|
+
content="You'll get this rate as long as we receive your 10 EUR within the next 51 hours."
|
|
62
|
+
>
|
|
63
|
+
<Button size="sm" v2>
|
|
64
|
+
top
|
|
65
|
+
</Button>
|
|
66
|
+
</Popover>
|
|
77
67
|
),
|
|
78
68
|
play: clickTrigger,
|
|
79
|
-
...
|
|
69
|
+
...withRTLDiff({ renderAs: 'iframe', vAlign: 'bottom', hAlign: 'center' }),
|
|
80
70
|
};
|
|
81
71
|
|
|
82
72
|
export const PlacementBottom: Story = {
|
|
83
73
|
render: () => (
|
|
84
|
-
<
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
>
|
|
90
|
-
|
|
91
|
-
</
|
|
92
|
-
</
|
|
74
|
+
<Popover
|
|
75
|
+
preferredPlacement={Position.BOTTOM}
|
|
76
|
+
title="Guaranteed rate"
|
|
77
|
+
content="You'll get this rate as long as we receive your 10 EUR within the next 51 hours."
|
|
78
|
+
>
|
|
79
|
+
<Button size="sm" v2>
|
|
80
|
+
bottom
|
|
81
|
+
</Button>
|
|
82
|
+
</Popover>
|
|
93
83
|
),
|
|
94
84
|
play: clickTrigger,
|
|
95
|
-
...
|
|
85
|
+
...withRTLDiff({ renderAs: 'iframe', hAlign: 'center' }),
|
|
96
86
|
};
|