@transferwise/components 0.0.0-experimental-5ff6475 → 0.0.0-experimental-f16de49
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/Calendar/Calendar.js +9 -3
- package/build/Calendar/Calendar.js.map +1 -1
- package/build/Calendar/Calendar.mjs +9 -3
- package/build/Calendar/Calendar.mjs.map +1 -1
- package/build/Carousel/Carousel.js +17 -10
- package/build/Carousel/Carousel.js.map +1 -1
- package/build/Carousel/Carousel.mjs +17 -10
- package/build/Carousel/Carousel.mjs.map +1 -1
- package/build/SegmentedControl/SegmentedControl.js +2 -9
- package/build/SegmentedControl/SegmentedControl.js.map +1 -1
- package/build/SegmentedControl/SegmentedControl.mjs +2 -9
- package/build/SegmentedControl/SegmentedControl.mjs.map +1 -1
- package/build/Tooltip/Tooltip.js +6 -1
- package/build/Tooltip/Tooltip.js.map +1 -1
- package/build/Tooltip/Tooltip.mjs +6 -1
- package/build/Tooltip/Tooltip.mjs.map +1 -1
- package/build/main.css +10 -28
- package/build/styles/AvatarLayout/AvatarLayout.css +9 -26
- package/build/styles/SegmentedControl/SegmentedControl.css +1 -2
- package/build/styles/main.css +10 -28
- package/build/types/Calendar/Calendar.d.ts.map +1 -1
- package/build/types/Carousel/Carousel.d.ts.map +1 -1
- package/build/types/Carousel/_stories/constants.d.ts +3 -0
- package/build/types/Carousel/_stories/constants.d.ts.map +1 -0
- package/build/types/SegmentedControl/SegmentedControl.d.ts.map +1 -1
- package/build/types/Tooltip/Tooltip.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/AvatarLayout/AvatarLayout.css +9 -26
- package/src/AvatarLayout/AvatarLayout.less +22 -46
- package/src/AvatarLayout/_stories/AvatarLayout.test.story.tsx +42 -17
- package/src/Calendar/Calendar.test.tsx +82 -0
- package/src/Calendar/Calendar.tsx +6 -3
- package/src/Carousel/Carousel.tsx +13 -10
- package/src/Carousel/_stories/Carousel.story.tsx +12 -52
- package/src/Carousel/_stories/Carousel.test.story.tsx +7 -43
- package/src/Carousel/_stories/constants.tsx +46 -0
- package/src/DateLookup/_stories/DateLookup.rtl.test.story.tsx +48 -59
- package/src/Field/_stories/Field.test.story.tsx +37 -48
- package/src/FlowNavigation/_stories/FlowNavigation.test.story.tsx +44 -0
- package/src/Label/_stories/Label.test.story.tsx +22 -35
- package/src/Popover/_stories/Popover.rtl.test.story.tsx +50 -40
- package/src/SegmentedControl/SegmentedControl.css +1 -2
- package/src/SegmentedControl/SegmentedControl.less +2 -4
- package/src/SegmentedControl/SegmentedControl.tsx +2 -8
- package/src/SegmentedControl/_stories/SegmentedControl.test.story.tsx +8 -16
- package/src/Tooltip/Tooltip.test.tsx +51 -0
- package/src/Tooltip/Tooltip.tsx +6 -1
- package/src/Tooltip/_stories/Tooltip.rtl.test.story.tsx +16 -34
- package/src/main.css +10 -28
- package/src/FlowNavigation/_stories/FlowNavigation.rtl.test.story.tsx +0 -78
|
@@ -1,60 +1,27 @@
|
|
|
1
1
|
import type { Args } from '@storybook/react-webpack5';
|
|
2
|
-
|
|
2
|
+
|
|
3
3
|
import {
|
|
4
4
|
createSandboxStory,
|
|
5
5
|
globalScope,
|
|
6
6
|
} from '../../../.storybook/components/sandbox/SandboxEditor';
|
|
7
|
-
|
|
8
|
-
import
|
|
9
|
-
import Carousel, { type CarouselCard } from '..';
|
|
7
|
+
import Carousel from '..';
|
|
8
|
+
import { stubbedCarouselCards } from './constants';
|
|
10
9
|
|
|
11
10
|
export default {
|
|
11
|
+
args: {
|
|
12
|
+
cards: stubbedCarouselCards,
|
|
13
|
+
header: 'Carousel title',
|
|
14
|
+
},
|
|
12
15
|
component: Carousel,
|
|
13
16
|
title: 'Navigation/Carousel',
|
|
14
17
|
};
|
|
15
18
|
|
|
16
|
-
const
|
|
17
|
-
{
|
|
18
|
-
|
|
19
|
-
type: 'button',
|
|
20
|
-
onClick: () => {
|
|
21
|
-
console.log('Clicked on button');
|
|
22
|
-
},
|
|
23
|
-
content: (
|
|
24
|
-
<div className="d-flex p-a-1 p-t-0 flex-column align-items-center">
|
|
25
|
-
<div style={{ position: 'absolute' }}>
|
|
26
|
-
<Illustration disablePadding name="globe" size="small" alt="" />
|
|
27
|
-
</div>
|
|
28
|
-
<div style={{ position: 'absolute', zIndex: '2', bottom: '8px', left: '16px' }}>
|
|
29
|
-
<Display type="display-small">Here there, everywhere</Display>
|
|
30
|
-
</div>
|
|
31
|
-
</div>
|
|
32
|
-
),
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
id: 'YOUR_WEBSITE',
|
|
36
|
-
type: 'promo',
|
|
37
|
-
onClick: () => {
|
|
38
|
-
console.log('hi');
|
|
39
|
-
},
|
|
40
|
-
href: 'http://wise.com',
|
|
41
|
-
title: 'Wise',
|
|
42
|
-
description: 'The best way to move money internationally',
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
id: 'SHOP_OR_STALL',
|
|
46
|
-
type: 'anchor',
|
|
47
|
-
href: 'https://wise.com',
|
|
48
|
-
hrefTarget: '_blank',
|
|
49
|
-
onClick: () => {},
|
|
50
|
-
styles: {
|
|
51
|
-
backgroundImage:
|
|
52
|
-
'url(https://wise.com/public-resources/assets/team-page/tapestry/team_member_tapestry_01.jpg)',
|
|
53
|
-
backgroundSize: 'cover',
|
|
54
|
-
},
|
|
55
|
-
content: <Display type="display-small">Get Quick Pay</Display>,
|
|
19
|
+
export const Playground = {
|
|
20
|
+
render: (args: Args) => {
|
|
21
|
+
return <Carousel header="Pretty nifty stuff" cards={stubbedCarouselCards} {...args} />;
|
|
56
22
|
},
|
|
57
|
-
|
|
23
|
+
args: {},
|
|
24
|
+
};
|
|
58
25
|
|
|
59
26
|
export const Sandbox = createSandboxStory({
|
|
60
27
|
code: `const App = () => {
|
|
@@ -89,10 +56,3 @@ export const Sandbox = createSandboxStory({
|
|
|
89
56
|
};`,
|
|
90
57
|
scope: globalScope,
|
|
91
58
|
});
|
|
92
|
-
|
|
93
|
-
export const CarouselDefault = {
|
|
94
|
-
render: (args: Args) => {
|
|
95
|
-
return <Carousel header="Pretty nifty stuff" cards={carouselCards} {...args} />;
|
|
96
|
-
},
|
|
97
|
-
args: {},
|
|
98
|
-
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
2
2
|
|
|
3
3
|
import { withRTLDiff } from '../../../.storybook/decorators/RtlDiffDecorator';
|
|
4
|
-
import
|
|
5
|
-
import
|
|
4
|
+
import Carousel from '..';
|
|
5
|
+
import { stubbedCarouselCards } from './constants';
|
|
6
6
|
|
|
7
7
|
export default {
|
|
8
8
|
component: Carousel,
|
|
@@ -12,48 +12,12 @@ export default {
|
|
|
12
12
|
|
|
13
13
|
type Story = StoryObj<typeof Carousel>;
|
|
14
14
|
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
type: 'button',
|
|
19
|
-
content: (
|
|
20
|
-
<div className="d-flex p-a-1 flex-column align-items-center">
|
|
21
|
-
<Display type="display-small">Card one</Display>
|
|
22
|
-
</div>
|
|
23
|
-
),
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
id: 'card-2',
|
|
27
|
-
type: 'promo',
|
|
28
|
-
href: '#',
|
|
29
|
-
title: 'Promo card',
|
|
30
|
-
description: 'Description for promo card',
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
id: 'card-3',
|
|
34
|
-
type: 'anchor',
|
|
35
|
-
href: '#',
|
|
36
|
-
hrefTarget: '_blank',
|
|
37
|
-
content: <Display type="display-small">Anchor card</Display>,
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
id: 'card-4',
|
|
41
|
-
type: 'button',
|
|
42
|
-
content: (
|
|
43
|
-
<div className="d-flex p-a-1 flex-column align-items-center">
|
|
44
|
-
<Display type="display-small">Card four</Display>
|
|
45
|
-
</div>
|
|
46
|
-
),
|
|
47
|
-
},
|
|
48
|
-
{
|
|
49
|
-
id: 'card-5',
|
|
50
|
-
type: 'anchor',
|
|
51
|
-
href: '#',
|
|
52
|
-
content: <Display type="display-small">Card five</Display>,
|
|
53
|
-
},
|
|
15
|
+
const manyCards = [
|
|
16
|
+
...stubbedCarouselCards,
|
|
17
|
+
...stubbedCarouselCards.map((card) => ({ ...card, id: `${card.id}_2` })),
|
|
54
18
|
];
|
|
55
19
|
|
|
56
20
|
export const RTLDiff: Story = {
|
|
57
|
-
render: () => <Carousel header="
|
|
58
|
-
...withRTLDiff(),
|
|
21
|
+
render: () => <Carousel cards={manyCards} header="Pretty nifty stuff" />,
|
|
22
|
+
...withRTLDiff({ width: 'stretch' }),
|
|
59
23
|
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { Illustration } from '@wise/art';
|
|
2
|
+
import Display from '../../Display';
|
|
3
|
+
import type { CarouselCard } from '../Carousel';
|
|
4
|
+
|
|
5
|
+
export const stubbedCarouselCards: CarouselCard[] = [
|
|
6
|
+
{
|
|
7
|
+
id: 'YOUR_INVOICE',
|
|
8
|
+
type: 'button',
|
|
9
|
+
onClick: () => {
|
|
10
|
+
console.log('Clicked on button');
|
|
11
|
+
},
|
|
12
|
+
content: (
|
|
13
|
+
<div className="d-flex p-a-1 p-t-0 flex-column align-items-center">
|
|
14
|
+
<div style={{ position: 'absolute' }}>
|
|
15
|
+
<Illustration disablePadding name="globe" size="small" alt="" />
|
|
16
|
+
</div>
|
|
17
|
+
<div style={{ position: 'absolute', zIndex: '2', bottom: '8px', left: '16px' }}>
|
|
18
|
+
<Display type="display-small">Here there, everywhere</Display>
|
|
19
|
+
</div>
|
|
20
|
+
</div>
|
|
21
|
+
),
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
id: 'YOUR_WEBSITE',
|
|
25
|
+
type: 'promo',
|
|
26
|
+
onClick: () => {
|
|
27
|
+
console.log('hi');
|
|
28
|
+
},
|
|
29
|
+
href: 'http://wise.com',
|
|
30
|
+
title: 'Wise',
|
|
31
|
+
description: 'The best way to move money internationally',
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
id: 'SHOP_OR_STALL',
|
|
35
|
+
type: 'anchor',
|
|
36
|
+
href: 'https://wise.com',
|
|
37
|
+
hrefTarget: '_blank',
|
|
38
|
+
onClick: () => {},
|
|
39
|
+
styles: {
|
|
40
|
+
backgroundImage:
|
|
41
|
+
'url(https://wise.com/public-resources/assets/team-page/tapestry/team_member_tapestry_01.jpg)',
|
|
42
|
+
backgroundSize: 'cover',
|
|
43
|
+
},
|
|
44
|
+
content: <Display type="display-small">Get Quick Pay</Display>,
|
|
45
|
+
},
|
|
46
|
+
];
|
|
@@ -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 {
|
|
4
|
+
import { withRTLDiff } from '../../../.storybook/decorators/RtlDiffDecorator';
|
|
5
5
|
import DateLookup from '..';
|
|
6
6
|
|
|
7
7
|
export default {
|
|
@@ -14,47 +14,39 @@ type Story = StoryObj<typeof DateLookup>;
|
|
|
14
14
|
|
|
15
15
|
const selectedDate = new Date(2024, 5, 14);
|
|
16
16
|
|
|
17
|
-
const i18nConfig = {
|
|
18
|
-
label: { ltr: 'Select date', rtl: 'اختر التاريخ' },
|
|
19
|
-
placeholder: { ltr: 'Choose a date', rtl: 'اختر تاريخًا' },
|
|
20
|
-
};
|
|
21
|
-
|
|
22
17
|
export const TriggerVariants: Story = {
|
|
23
|
-
render: () =>
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
);
|
|
56
|
-
},
|
|
57
|
-
...withRTLDiff({ renderAs: 'iframe', i18n: i18nConfig }),
|
|
18
|
+
render: () => (
|
|
19
|
+
<>
|
|
20
|
+
<DateLookup
|
|
21
|
+
label="Select date"
|
|
22
|
+
placeholder="Choose a date"
|
|
23
|
+
value={selectedDate}
|
|
24
|
+
onChange={() => {}}
|
|
25
|
+
/>
|
|
26
|
+
<DateLookup
|
|
27
|
+
label="Select date"
|
|
28
|
+
placeholder="Choose a date"
|
|
29
|
+
value={selectedDate}
|
|
30
|
+
clearable
|
|
31
|
+
onChange={() => {}}
|
|
32
|
+
/>
|
|
33
|
+
<DateLookup
|
|
34
|
+
label="Select date"
|
|
35
|
+
placeholder="Choose a date"
|
|
36
|
+
size="sm"
|
|
37
|
+
value={selectedDate}
|
|
38
|
+
onChange={() => {}}
|
|
39
|
+
/>
|
|
40
|
+
<DateLookup
|
|
41
|
+
label="Select date"
|
|
42
|
+
placeholder="Choose a date"
|
|
43
|
+
size="lg"
|
|
44
|
+
value={selectedDate}
|
|
45
|
+
onChange={() => {}}
|
|
46
|
+
/>
|
|
47
|
+
</>
|
|
48
|
+
),
|
|
49
|
+
...withRTLDiff(),
|
|
58
50
|
};
|
|
59
51
|
|
|
60
52
|
const containerStyle: React.CSSProperties = {
|
|
@@ -67,19 +59,16 @@ const containerStyle: React.CSSProperties = {
|
|
|
67
59
|
};
|
|
68
60
|
|
|
69
61
|
export const OpenCalendarPanel: Story = {
|
|
70
|
-
render: () =>
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
</div>
|
|
81
|
-
);
|
|
82
|
-
},
|
|
62
|
+
render: () => (
|
|
63
|
+
<div style={containerStyle}>
|
|
64
|
+
<DateLookup
|
|
65
|
+
label="Select date"
|
|
66
|
+
placeholder="Choose a date"
|
|
67
|
+
value={selectedDate}
|
|
68
|
+
onChange={() => {}}
|
|
69
|
+
/>
|
|
70
|
+
</div>
|
|
71
|
+
),
|
|
83
72
|
play: async ({ canvasElement }: { canvasElement: HTMLElement }) => {
|
|
84
73
|
const canvas = within(canvasElement);
|
|
85
74
|
const trigger = canvas.queryByRole('button');
|
|
@@ -88,12 +77,12 @@ export const OpenCalendarPanel: Story = {
|
|
|
88
77
|
// Suppress focus ring on calendar cells — FocusScope traps focus inside the panel
|
|
89
78
|
// and the autofocus cycle causes the selected date's ring to flicker between iframes.
|
|
90
79
|
const style = canvasElement.ownerDocument.createElement('style');
|
|
91
|
-
style.textContent = `
|
|
92
|
-
.np-panel__content *:focus {
|
|
93
|
-
outline: none !important;
|
|
94
|
-
box-shadow: none !important;
|
|
80
|
+
style.textContent = `
|
|
81
|
+
.np-panel__content *:focus {
|
|
82
|
+
outline: none !important;
|
|
83
|
+
box-shadow: none !important;
|
|
95
84
|
}`;
|
|
96
85
|
canvasElement.ownerDocument.head.appendChild(style);
|
|
97
86
|
},
|
|
98
|
-
...withRTLDiff({ renderAs: 'iframe'
|
|
87
|
+
...withRTLDiff({ renderAs: 'iframe' }),
|
|
99
88
|
};
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { useState } from 'react';
|
|
2
2
|
import { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
3
|
-
import {
|
|
3
|
+
import { 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';
|
|
6
7
|
import Field, { FieldProps } from '..';
|
|
7
8
|
import { Sentiment } from '../../common';
|
|
8
9
|
|
|
@@ -58,56 +59,44 @@ export const DeprecatedProps: Story = {
|
|
|
58
59
|
};
|
|
59
60
|
|
|
60
61
|
export const RTLDiff: Story = {
|
|
61
|
-
render: () =>
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
<
|
|
66
|
-
|
|
67
|
-
</Field>
|
|
62
|
+
render: () => (
|
|
63
|
+
<>
|
|
64
|
+
{/* Required label (default) — label text aligns to start */}
|
|
65
|
+
<Field label="Required field">
|
|
66
|
+
<Input defaultValue="Input value" />
|
|
67
|
+
</Field>
|
|
68
68
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
69
|
+
{/* Optional label — "(optional)" suffix uses directional margin-left */}
|
|
70
|
+
<Field label="Optional field" required={false}>
|
|
71
|
+
<Input defaultValue="Input value" />
|
|
72
|
+
</Field>
|
|
72
73
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
74
|
+
{/* Label + description + message — full vertical layout with directional icon */}
|
|
75
|
+
<Field
|
|
76
|
+
label="Field with description and message"
|
|
77
|
+
required={false}
|
|
78
|
+
description={lorem10}
|
|
79
|
+
message="This is a validation message"
|
|
80
|
+
sentiment="negative"
|
|
81
|
+
>
|
|
82
|
+
<Input defaultValue="Input value" />
|
|
83
|
+
</Field>
|
|
82
84
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
85
|
+
{/* Message only (no label) — InlinePrompt icon+text layout visible */}
|
|
86
|
+
<Field message="A helpful message" sentiment="positive">
|
|
87
|
+
<Input defaultValue="Input value" />
|
|
88
|
+
</Field>
|
|
86
89
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
+
{/* Loading message — spinner replaces icon but layout structure is identical */}
|
|
91
|
+
<Field label="Field with loading message" message="Saving…" messageLoading>
|
|
92
|
+
<Input defaultValue="Input value" />
|
|
93
|
+
</Field>
|
|
90
94
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
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
|
-
}),
|
|
95
|
+
{/* Textarea with char counter — counter uses text-align:right + margin-left:auto */}
|
|
96
|
+
<Field label="Textarea with char counter" required={false} description="Max 100 characters">
|
|
97
|
+
<TextArea maxLength={100} defaultValue="Textarea value" />
|
|
98
|
+
</Field>
|
|
99
|
+
</>
|
|
100
|
+
),
|
|
101
|
+
...withRTLDiff(),
|
|
113
102
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
2
2
|
|
|
3
|
+
import { withRTLDiff } from '../../../.storybook/decorators/RtlDiffDecorator';
|
|
3
4
|
import AvatarView from '../../AvatarView';
|
|
4
5
|
import { ProfileType } from '../../common';
|
|
5
6
|
import Logo from '../../Logo';
|
|
@@ -76,3 +77,46 @@ export const LongLabel: Story = {
|
|
|
76
77
|
/>
|
|
77
78
|
),
|
|
78
79
|
};
|
|
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
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
2
|
-
import {
|
|
2
|
+
import { withRTLDiff } from '../../../.storybook/decorators/RtlDiffDecorator';
|
|
3
3
|
import Info from '../../Info';
|
|
4
4
|
import Label from '..';
|
|
5
5
|
|
|
@@ -12,38 +12,25 @@ 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
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
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
|
-
}),
|
|
15
|
+
render: () => (
|
|
16
|
+
<>
|
|
17
|
+
<Label>Plain label text</Label>
|
|
18
|
+
<Label>
|
|
19
|
+
<Label.Optional>Label with optional marker</Label.Optional>
|
|
20
|
+
</Label>
|
|
21
|
+
<Label>
|
|
22
|
+
<div>
|
|
23
|
+
Label with info icon{' '}
|
|
24
|
+
<Info content="Helpful tooltip content" aria-label="More information" />
|
|
25
|
+
</div>
|
|
26
|
+
</Label>
|
|
27
|
+
<Label>
|
|
28
|
+
<Label.Optional>
|
|
29
|
+
Label with optional and info icon{' '}
|
|
30
|
+
<Info content="Helpful tooltip content" aria-label="More information" />
|
|
31
|
+
</Label.Optional>
|
|
32
|
+
</Label>
|
|
33
|
+
</>
|
|
34
|
+
),
|
|
35
|
+
...withRTLDiff(),
|
|
49
36
|
};
|