@transferwise/components 46.158.0 → 46.159.1
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/FlowNavigation/FlowNavigation.js +5 -14
- package/build/FlowNavigation/FlowNavigation.js.map +1 -1
- package/build/FlowNavigation/FlowNavigation.mjs +5 -14
- package/build/FlowNavigation/FlowNavigation.mjs.map +1 -1
- package/build/_deprecated/OverlayHeader/OverlayHeader.js +6 -41
- package/build/_deprecated/OverlayHeader/OverlayHeader.js.map +1 -1
- package/build/_deprecated/OverlayHeader/OverlayHeader.mjs +6 -41
- package/build/_deprecated/OverlayHeader/OverlayHeader.mjs.map +1 -1
- package/build/i18n/cs.json +5 -0
- package/build/i18n/cs.json.js +5 -0
- package/build/i18n/cs.json.js.map +1 -1
- package/build/i18n/cs.json.mjs +5 -0
- package/build/i18n/cs.json.mjs.map +1 -1
- package/build/i18n/de.json +5 -0
- package/build/i18n/de.json.js +5 -0
- package/build/i18n/de.json.js.map +1 -1
- package/build/i18n/de.json.mjs +5 -0
- package/build/i18n/de.json.mjs.map +1 -1
- package/build/i18n/es.json +5 -0
- package/build/i18n/es.json.js +5 -0
- package/build/i18n/es.json.js.map +1 -1
- package/build/i18n/es.json.mjs +5 -0
- package/build/i18n/es.json.mjs.map +1 -1
- package/build/i18n/fr.json +5 -0
- package/build/i18n/fr.json.js +5 -0
- package/build/i18n/fr.json.js.map +1 -1
- package/build/i18n/fr.json.mjs +5 -0
- package/build/i18n/fr.json.mjs.map +1 -1
- package/build/i18n/hu.json +5 -0
- package/build/i18n/hu.json.js +5 -0
- package/build/i18n/hu.json.js.map +1 -1
- package/build/i18n/hu.json.mjs +5 -0
- package/build/i18n/hu.json.mjs.map +1 -1
- package/build/i18n/id.json +5 -0
- package/build/i18n/id.json.js +5 -0
- package/build/i18n/id.json.js.map +1 -1
- package/build/i18n/id.json.mjs +5 -0
- package/build/i18n/id.json.mjs.map +1 -1
- package/build/i18n/it.json +5 -0
- package/build/i18n/it.json.js +5 -0
- package/build/i18n/it.json.js.map +1 -1
- package/build/i18n/it.json.mjs +5 -0
- package/build/i18n/it.json.mjs.map +1 -1
- package/build/i18n/ja.json +5 -0
- package/build/i18n/ja.json.js +5 -0
- package/build/i18n/ja.json.js.map +1 -1
- package/build/i18n/ja.json.mjs +5 -0
- package/build/i18n/ja.json.mjs.map +1 -1
- package/build/i18n/nl.json +5 -0
- package/build/i18n/nl.json.js +5 -0
- package/build/i18n/nl.json.js.map +1 -1
- package/build/i18n/nl.json.mjs +5 -0
- package/build/i18n/nl.json.mjs.map +1 -1
- package/build/i18n/pl.json +5 -0
- package/build/i18n/pl.json.js +5 -0
- package/build/i18n/pl.json.js.map +1 -1
- package/build/i18n/pl.json.mjs +5 -0
- package/build/i18n/pl.json.mjs.map +1 -1
- package/build/i18n/pt.json +5 -0
- package/build/i18n/pt.json.js +5 -0
- package/build/i18n/pt.json.js.map +1 -1
- package/build/i18n/pt.json.mjs +5 -0
- package/build/i18n/pt.json.mjs.map +1 -1
- package/build/i18n/ro.json +5 -0
- package/build/i18n/ro.json.js +5 -0
- package/build/i18n/ro.json.js.map +1 -1
- package/build/i18n/ro.json.mjs +5 -0
- package/build/i18n/ro.json.mjs.map +1 -1
- package/build/i18n/ru.json +5 -0
- package/build/i18n/ru.json.js +5 -0
- package/build/i18n/ru.json.js.map +1 -1
- package/build/i18n/ru.json.mjs +5 -0
- package/build/i18n/ru.json.mjs.map +1 -1
- package/build/i18n/th.json +5 -0
- package/build/i18n/th.json.js +5 -0
- package/build/i18n/th.json.js.map +1 -1
- package/build/i18n/th.json.mjs +5 -0
- package/build/i18n/th.json.mjs.map +1 -1
- package/build/i18n/uk.json +5 -0
- package/build/i18n/uk.json.js +5 -0
- package/build/i18n/uk.json.js.map +1 -1
- package/build/i18n/uk.json.mjs +5 -0
- package/build/i18n/uk.json.mjs.map +1 -1
- package/build/i18n/zh-HK.json +5 -0
- package/build/i18n/zh-HK.json.js +5 -0
- package/build/i18n/zh-HK.json.js.map +1 -1
- package/build/i18n/zh-HK.json.mjs +5 -0
- package/build/i18n/zh-HK.json.mjs.map +1 -1
- package/build/main.css +19 -4145
- package/build/styles/FlowNavigation/FlowNavigation.css +7 -13
- package/build/styles/ListItem/ListItem.css +1 -0
- package/build/styles/PocketSurface/PocketSurface.css +2 -11
- package/build/styles/SentimentSurface/SentimentSurface.css +0 -23
- package/build/styles/css/neptune.css +0 -2821
- package/build/styles/main.css +19 -4145
- package/build/styles/styles/less/neptune.css +0 -2821
- package/build/types/FlowNavigation/FlowNavigation.d.ts +2 -9
- package/build/types/FlowNavigation/FlowNavigation.d.ts.map +1 -1
- package/build/types/ListItem/_stories/variants/helpers.d.ts.map +1 -1
- package/build/types/_deprecated/OverlayHeader/OverlayHeader.d.ts.map +1 -1
- package/package.json +10 -10
- package/src/Accordion/_stories/Accordion.test.story.tsx +71 -0
- package/src/AvatarLayout/_stories/AvatarLayout.test.story.tsx +64 -0
- package/src/AvatarView/_stories/AvatarView.test.story.tsx +151 -0
- package/src/Button/LegacyButton/_stories/LegacyButton.test.story.tsx +22 -0
- package/src/Button/_stories/Button.test.story.tsx +65 -0
- package/src/Calendar/_stories/Calendar.test.story.tsx +73 -24
- package/src/Carousel/_stories/Carousel.test.story.tsx +59 -0
- package/src/Checkbox/_stories/Checkbox.test.story.tsx +20 -0
- package/src/CheckboxButton/_stories/CheckboxButton.test.story.tsx +17 -37
- package/src/Chevron/_stories/Chevron.test.story.tsx +26 -0
- package/src/Chips/_stories/Chips.test.story.tsx +39 -34
- package/src/CircularButton/_stories/CircularButton.test.story.tsx +0 -68
- package/src/DateInput/_stories/DateInput.test.story.tsx +13 -0
- package/src/DateLookup/_stories/DateLookup.rtl.test.story.tsx +88 -0
- package/src/Decision/_stories/Decision.test.story.tsx +79 -0
- package/src/DefinitionList/_stories/DefinitionList.test.story.tsx +54 -1
- package/src/Drawer/_stories/Drawer.rtl.test.story.tsx +58 -0
- package/src/ExpressiveMoneyInput/_stories/ExpressiveMoneyInput.rtl.test.story.tsx +118 -0
- package/src/Field/_stories/Field.test.story.tsx +46 -0
- package/src/FlowNavigation/FlowNavigation.css +7 -13
- package/src/FlowNavigation/FlowNavigation.less +6 -15
- package/src/FlowNavigation/FlowNavigation.tsx +6 -27
- package/src/FlowNavigation/_stories/FlowNavigation.story.tsx +0 -86
- package/src/FlowNavigation/_stories/FlowNavigation.test.story.tsx +44 -0
- package/src/Header/_stories/Header.test.story.tsx +27 -0
- package/src/Info/_stories/Info.rtl.test.story.tsx +64 -0
- package/src/Inputs/SelectInput/_stories/SelectInput.rtl.test.story.tsx +135 -0
- package/src/Inputs/_stories/InputGroup.test.story.tsx +69 -0
- package/src/Inputs/_stories/SearchInput.test.story.tsx +32 -0
- package/src/Inputs/_stories/TextArea.test.story.tsx +27 -0
- package/src/InstructionsList/_stories/InstructionsList.test.story.tsx +30 -0
- package/src/Label/_stories/Label.test.story.tsx +36 -0
- package/src/Link/_stories/Link.test.story.tsx +26 -0
- package/src/ListItem/ListItem.css +1 -0
- package/src/ListItem/_stories/{variants/ListItem.rtl.test.story.tsx → ListItem.rtl.test.story.tsx} +6 -10
- package/src/ListItem/_stories/variants/helpers.tsx +2 -6
- package/src/Logo/_stories/Logo.test.story.tsx +44 -0
- package/src/Modal/_stories/Modal.rtl.test.story.tsx +59 -0
- package/src/MoneyInput/_stories/MoneyInput.rtl.test.story.tsx +88 -0
- package/src/Nudge/_stories/Nudge.test.story.tsx +37 -0
- package/src/PhoneNumberInput/_stories/PhoneNumberInput.test.story.tsx +44 -0
- package/src/PocketSurface/PocketSurface.css +2 -11
- package/src/PocketSurface/PocketSurface.less +1 -1
- package/src/Popover/_stories/Popover.rtl.test.story.tsx +96 -0
- package/src/Progress/_stories/Progress.test.story.tsx +27 -0
- package/src/ProgressBar/_stories/ProgressBar.test.story.tsx +33 -0
- package/src/PromoCard/_stories/PromoCard.test.story.tsx +42 -0
- package/src/PromoCard/_stories/PromoCardGroup.test.story.tsx +51 -0
- package/src/Prompt/ActionPrompt/_stories/ActionPrompt.test.story.tsx +42 -1
- package/src/Prompt/CriticalBanner/_stories/CriticalBanner.test.story.tsx +34 -31
- package/src/Prompt/InfoPrompt/_stories/InfoPrompt.test.story.tsx +25 -0
- package/src/Prompt/InlinePrompt/_stories/InlinePrompt.test.story.tsx +27 -0
- package/src/Radio/_stories/Radio.test.story.tsx +61 -0
- package/src/RadioGroup/_stories/RadioGroup.test.story.tsx +56 -0
- package/src/Section/_stories/Section.test.story.tsx +29 -0
- package/src/SegmentedControl/_stories/SegmentedControl.test.story.tsx +45 -0
- package/src/SentimentSurface/SentimentSurface.css +0 -23
- package/src/SlidingPanel/_stories/SlidingPanel.rtl.test.story.tsx +70 -0
- package/src/Snackbar/_stories/Snackbar.rtl.test.story.tsx +45 -0
- package/src/Snackbar/_stories/Snackbar.test.story.tsx +0 -31
- package/src/Stepper/_stories/Stepper.test.story.tsx +17 -0
- package/src/Switch/_stories/Switch.test.story.tsx +20 -26
- package/src/Table/_stories/Table.test.story.tsx +104 -0
- package/src/Tabs/_stories/Tabs.test.story.tsx +72 -0
- package/src/TextareaWithDisplayFormat/_stories/TextareaWithDisplayFormat.test.story.tsx +48 -0
- package/src/Tooltip/_stories/Tooltip.rtl.test.story.tsx +79 -0
- package/src/Typeahead/_stories/Typeahead.rtl.test.story.tsx +90 -0
- package/src/Upload/_stories/Upload.rtl.test.story.tsx +53 -0
- package/src/UploadInput/_stories/UploadInput.test.story.tsx +47 -0
- package/src/_deprecated/Alert/_stories/Alert.test.story.tsx +28 -1
- package/src/_deprecated/Card/_stories/Card.test.story.tsx +38 -0
- package/src/_deprecated/CriticalBanner/_stories/CriticalCommsBanner.test.story.tsx +18 -0
- package/src/_deprecated/InlineAlert/_stories/InlineAlert.test.story.tsx +26 -0
- package/src/_deprecated/OverlayHeader/OverlayHeader.tsx +2 -21
- package/src/_deprecated/OverlayHeader/_stories/OverlayHeader.test.story.tsx +42 -0
- package/src/_deprecated/Select/_stories/Select.rtl.test.story.tsx +71 -0
- package/src/common/BottomSheet/_stories/BottomSheet.test.story.tsx +23 -0
- package/src/common/Panel/_stories/Panel.story.tsx +107 -36
- package/src/i18n/cs.json +5 -0
- package/src/i18n/de.json +5 -0
- package/src/i18n/es.json +5 -0
- package/src/i18n/fr.json +5 -0
- package/src/i18n/hu.json +5 -0
- package/src/i18n/id.json +5 -0
- package/src/i18n/it.json +5 -0
- package/src/i18n/ja.json +5 -0
- package/src/i18n/nl.json +5 -0
- package/src/i18n/pl.json +5 -0
- package/src/i18n/pt.json +5 -0
- package/src/i18n/ro.json +5 -0
- package/src/i18n/ru.json +5 -0
- package/src/i18n/th.json +5 -0
- package/src/i18n/uk.json +5 -0
- package/src/i18n/zh-HK.json +5 -0
- package/src/main.css +19 -4145
- package/src/main.less +0 -1
- package/src/styles/less/neptune.css +0 -2821
- package/build/styles/_deprecated/OverlayHeader/OverlayHeader.css +0 -15
- package/src/_deprecated/OverlayHeader/OverlayHeader.css +0 -15
- package/src/_deprecated/OverlayHeader/OverlayHeader.less +0 -24
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
2
|
+
import { userEvent, within } from 'storybook/test';
|
|
3
|
+
import { Flag } from '@wise/art';
|
|
4
|
+
|
|
5
|
+
import { withRTLDiff } from '../../../../.storybook/decorators/RtlDiffDecorator';
|
|
6
|
+
import { SelectInput, SelectInputOptionContent } from '..';
|
|
7
|
+
|
|
8
|
+
export default {
|
|
9
|
+
component: SelectInput,
|
|
10
|
+
title: 'Forms/SelectInput/Tests/RTL Diff',
|
|
11
|
+
tags: ['!autodocs', '!manifest'],
|
|
12
|
+
} satisfies Meta<typeof SelectInput>;
|
|
13
|
+
|
|
14
|
+
type Story = StoryObj<typeof SelectInput>;
|
|
15
|
+
|
|
16
|
+
interface RtlCurrency {
|
|
17
|
+
code: string;
|
|
18
|
+
name: string;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const rtlCurrencies: RtlCurrency[] = [
|
|
22
|
+
{ code: 'USD', name: 'United States Dollar' },
|
|
23
|
+
{ code: 'EUR', name: 'Euro' },
|
|
24
|
+
{ code: 'GBP', name: 'British pound' },
|
|
25
|
+
];
|
|
26
|
+
|
|
27
|
+
export const TriggerVariants: Story = {
|
|
28
|
+
render: () => (
|
|
29
|
+
<>
|
|
30
|
+
{/* sm — chevron position flips in RTL */}
|
|
31
|
+
<SelectInput
|
|
32
|
+
size="sm"
|
|
33
|
+
placeholder="Select currency"
|
|
34
|
+
items={rtlCurrencies.map((currency) => ({ type: 'option', value: currency }))}
|
|
35
|
+
renderValue={(currency) => <SelectInputOptionContent title={currency.code} />}
|
|
36
|
+
/>
|
|
37
|
+
|
|
38
|
+
{/* md — chevron position flips in RTL */}
|
|
39
|
+
<SelectInput
|
|
40
|
+
size="md"
|
|
41
|
+
placeholder="Select currency"
|
|
42
|
+
items={rtlCurrencies.map((currency) => ({ type: 'option', value: currency }))}
|
|
43
|
+
renderValue={(currency) => <SelectInputOptionContent title={currency.code} />}
|
|
44
|
+
/>
|
|
45
|
+
|
|
46
|
+
{/* lg with value and leading icon — icon side and chevron flip in RTL */}
|
|
47
|
+
<SelectInput
|
|
48
|
+
size="lg"
|
|
49
|
+
placeholder="Select currency"
|
|
50
|
+
defaultValue={rtlCurrencies[0]}
|
|
51
|
+
items={rtlCurrencies.map((currency) => ({ type: 'option', value: currency }))}
|
|
52
|
+
renderValue={(currency) => (
|
|
53
|
+
<SelectInputOptionContent
|
|
54
|
+
title={currency.code}
|
|
55
|
+
note={currency.name}
|
|
56
|
+
icon={<Flag code={currency.code} intrinsicSize={24} />}
|
|
57
|
+
/>
|
|
58
|
+
)}
|
|
59
|
+
/>
|
|
60
|
+
|
|
61
|
+
{/* multiple — selected values on leading side, chevron on trailing side, both flip in RTL */}
|
|
62
|
+
<SelectInput
|
|
63
|
+
size="lg"
|
|
64
|
+
multiple
|
|
65
|
+
placeholder="Choose currencies"
|
|
66
|
+
defaultValue={[rtlCurrencies[0], rtlCurrencies[1]]}
|
|
67
|
+
items={rtlCurrencies.map((currency) => ({ type: 'option', value: currency }))}
|
|
68
|
+
renderValue={(currency, withinTrigger) =>
|
|
69
|
+
withinTrigger ? (
|
|
70
|
+
currency.code
|
|
71
|
+
) : (
|
|
72
|
+
<SelectInputOptionContent title={currency.code} note={currency.name} />
|
|
73
|
+
)
|
|
74
|
+
}
|
|
75
|
+
/>
|
|
76
|
+
</>
|
|
77
|
+
),
|
|
78
|
+
...withRTLDiff(),
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
const otherCurrencies: RtlCurrency[] = [
|
|
82
|
+
{ code: 'CAD', name: 'Canadian dollar' },
|
|
83
|
+
{ code: 'AUD', name: 'Australian dollar' },
|
|
84
|
+
{ code: 'JPY', name: 'Japanese yen' },
|
|
85
|
+
];
|
|
86
|
+
|
|
87
|
+
const groupedItems = [
|
|
88
|
+
{
|
|
89
|
+
type: 'group' as const,
|
|
90
|
+
label: 'Popular currencies',
|
|
91
|
+
options: rtlCurrencies.map((currency) => ({
|
|
92
|
+
type: 'option' as const,
|
|
93
|
+
value: currency,
|
|
94
|
+
filterMatchers: [currency.code, currency.name],
|
|
95
|
+
})),
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
type: 'group' as const,
|
|
99
|
+
label: 'All currencies',
|
|
100
|
+
options: [...rtlCurrencies, ...otherCurrencies]
|
|
101
|
+
.sort((a, b) => a.code.localeCompare(b.code))
|
|
102
|
+
.map((currency) => ({
|
|
103
|
+
type: 'option' as const,
|
|
104
|
+
value: currency,
|
|
105
|
+
filterMatchers: [currency.code, currency.name],
|
|
106
|
+
})),
|
|
107
|
+
},
|
|
108
|
+
];
|
|
109
|
+
|
|
110
|
+
export const OpenDropdown: Story = {
|
|
111
|
+
render: () => (
|
|
112
|
+
<SelectInput
|
|
113
|
+
size="lg"
|
|
114
|
+
filterable
|
|
115
|
+
filterPlaceholder="Type a currency / country"
|
|
116
|
+
placeholder="Select currency"
|
|
117
|
+
defaultValue={rtlCurrencies[0]}
|
|
118
|
+
items={groupedItems}
|
|
119
|
+
renderValue={(currency, withinTrigger) => (
|
|
120
|
+
<SelectInputOptionContent
|
|
121
|
+
title={currency.code}
|
|
122
|
+
note={withinTrigger ? undefined : currency.name}
|
|
123
|
+
icon={<Flag code={currency.code} intrinsicSize={24} />}
|
|
124
|
+
/>
|
|
125
|
+
)}
|
|
126
|
+
/>
|
|
127
|
+
),
|
|
128
|
+
play: async ({ canvasElement }) => {
|
|
129
|
+
const canvas = within(canvasElement);
|
|
130
|
+
const trigger = canvas.queryByRole('combobox');
|
|
131
|
+
if (!trigger) return;
|
|
132
|
+
await userEvent.click(trigger);
|
|
133
|
+
},
|
|
134
|
+
...withRTLDiff({ renderAs: 'iframe', width: '80%' }),
|
|
135
|
+
};
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
2
|
+
import { Search } from '@transferwise/icons';
|
|
3
|
+
|
|
4
|
+
import { withRTLDiff } from '../../../.storybook/decorators/RtlDiffDecorator';
|
|
5
|
+
import Button from '../../Button';
|
|
6
|
+
import { Input } from '../Input/Input';
|
|
7
|
+
import { InputGroup } from '../InputGroup/InputGroup';
|
|
8
|
+
|
|
9
|
+
export default {
|
|
10
|
+
component: InputGroup,
|
|
11
|
+
title: 'Forms/InputGroup/Tests',
|
|
12
|
+
tags: ['!autodocs', '!manifest'],
|
|
13
|
+
} satisfies Meta<typeof InputGroup>;
|
|
14
|
+
|
|
15
|
+
type Story = StoryObj<typeof InputGroup>;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* InputGroup positions addons at the logical start or end of an input.
|
|
19
|
+
* In RTL mode the start and end sides are mirrored, so an addonStart icon
|
|
20
|
+
* should appear on the right and an addonEnd button should appear on the left.
|
|
21
|
+
* All three placement combinations are included to verify each case.
|
|
22
|
+
*/
|
|
23
|
+
export const RTLDiff: Story = {
|
|
24
|
+
render: () => (
|
|
25
|
+
<>
|
|
26
|
+
<InputGroup
|
|
27
|
+
addonStart={{
|
|
28
|
+
content: <Search size={24} />,
|
|
29
|
+
initialContentWidth: 24,
|
|
30
|
+
}}
|
|
31
|
+
>
|
|
32
|
+
<Input placeholder="addonStart only" />
|
|
33
|
+
</InputGroup>
|
|
34
|
+
|
|
35
|
+
<InputGroup
|
|
36
|
+
addonEnd={{
|
|
37
|
+
content: (
|
|
38
|
+
<Button v2 size="sm">
|
|
39
|
+
Copy
|
|
40
|
+
</Button>
|
|
41
|
+
),
|
|
42
|
+
interactive: true,
|
|
43
|
+
padding: 'sm',
|
|
44
|
+
}}
|
|
45
|
+
>
|
|
46
|
+
<Input placeholder="addonEnd only" />
|
|
47
|
+
</InputGroup>
|
|
48
|
+
|
|
49
|
+
<InputGroup
|
|
50
|
+
addonStart={{
|
|
51
|
+
content: <Search size={24} />,
|
|
52
|
+
initialContentWidth: 24,
|
|
53
|
+
}}
|
|
54
|
+
addonEnd={{
|
|
55
|
+
content: (
|
|
56
|
+
<Button v2 size="sm">
|
|
57
|
+
Clear
|
|
58
|
+
</Button>
|
|
59
|
+
),
|
|
60
|
+
interactive: true,
|
|
61
|
+
padding: 'sm',
|
|
62
|
+
}}
|
|
63
|
+
>
|
|
64
|
+
<Input placeholder="addonStart and addonEnd" />
|
|
65
|
+
</InputGroup>
|
|
66
|
+
</>
|
|
67
|
+
),
|
|
68
|
+
...withRTLDiff(),
|
|
69
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
2
|
+
|
|
3
|
+
import { withRTLDiff } from '../../../.storybook/decorators/RtlDiffDecorator';
|
|
4
|
+
import { Size } from '../../common';
|
|
5
|
+
import { SearchInput } from '../SearchInput/SearchInput';
|
|
6
|
+
|
|
7
|
+
export default {
|
|
8
|
+
component: SearchInput,
|
|
9
|
+
title: 'Forms/SearchInput/Tests',
|
|
10
|
+
tags: ['!autodocs', '!manifest'],
|
|
11
|
+
} satisfies Meta<typeof SearchInput>;
|
|
12
|
+
|
|
13
|
+
type Story = StoryObj<typeof SearchInput>;
|
|
14
|
+
|
|
15
|
+
export const RTLDiff: Story = {
|
|
16
|
+
render: () => (
|
|
17
|
+
<>
|
|
18
|
+
{/* sm — search icon (addonStart) position flips to trailing side in RTL */}
|
|
19
|
+
<SearchInput size={Size.SMALL} shape="pill" placeholder="Search" />
|
|
20
|
+
|
|
21
|
+
{/* md — search icon (addonStart) position flips to trailing side in RTL */}
|
|
22
|
+
<SearchInput size={Size.MEDIUM} shape="pill" placeholder="Search" />
|
|
23
|
+
|
|
24
|
+
{/* sm rectangle — icon flip with rectangle shape */}
|
|
25
|
+
<SearchInput size={Size.SMALL} shape="rectangle" placeholder="Search" />
|
|
26
|
+
|
|
27
|
+
{/* md rectangle — icon flip with rectangle shape */}
|
|
28
|
+
<SearchInput size={Size.MEDIUM} shape="rectangle" placeholder="Search" />
|
|
29
|
+
</>
|
|
30
|
+
),
|
|
31
|
+
...withRTLDiff(),
|
|
32
|
+
};
|
|
@@ -2,7 +2,9 @@ import { useState } from 'react';
|
|
|
2
2
|
import { userEvent, within } from 'storybook/test';
|
|
3
3
|
import { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
4
4
|
|
|
5
|
+
import { withRTLDiff } from '../../../.storybook/decorators/RtlDiffDecorator';
|
|
5
6
|
import Field from '../../Field';
|
|
7
|
+
import { Sentiment } from '../../common';
|
|
6
8
|
import { TextArea } from '../TextArea/TextArea';
|
|
7
9
|
|
|
8
10
|
const meta: Meta<typeof TextArea> = {
|
|
@@ -140,3 +142,28 @@ export const CJKTypingBlocked: Story = {
|
|
|
140
142
|
await userEvent.paste('吉𣘺吉𣘺吉𣘺');
|
|
141
143
|
},
|
|
142
144
|
};
|
|
145
|
+
|
|
146
|
+
export const RTLDiff: Story = {
|
|
147
|
+
render: () => (
|
|
148
|
+
<>
|
|
149
|
+
<Field label="Message" required={false}>
|
|
150
|
+
<TextArea placeholder="Type something..." />
|
|
151
|
+
</Field>
|
|
152
|
+
<Field label="Message" required={false}>
|
|
153
|
+
<TextArea value="This is some entered text content in the textarea field." readOnly />
|
|
154
|
+
</Field>
|
|
155
|
+
<Field
|
|
156
|
+
label="Message"
|
|
157
|
+
required={false}
|
|
158
|
+
sentiment={Sentiment.NEGATIVE}
|
|
159
|
+
message="This field has an error message"
|
|
160
|
+
>
|
|
161
|
+
<TextArea value="Invalid input text" readOnly />
|
|
162
|
+
</Field>
|
|
163
|
+
<Field label="Message with character count" required={false}>
|
|
164
|
+
<TextArea maxLength={200} value="Text with a character counter displayed below." readOnly />
|
|
165
|
+
</Field>
|
|
166
|
+
</>
|
|
167
|
+
),
|
|
168
|
+
...withRTLDiff(),
|
|
169
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
2
|
+
|
|
3
|
+
import { withRTLDiff } from '../../../.storybook/decorators/RtlDiffDecorator';
|
|
4
|
+
import InstructionsList from '..';
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
component: InstructionsList,
|
|
8
|
+
title: 'Typography/InstructionsList/Tests',
|
|
9
|
+
tags: ['!autodocs', '!manifest'],
|
|
10
|
+
} satisfies Meta<typeof InstructionsList>;
|
|
11
|
+
|
|
12
|
+
type Story = StoryObj<typeof InstructionsList>;
|
|
13
|
+
|
|
14
|
+
export const RTLDiff: Story = {
|
|
15
|
+
render: () => (
|
|
16
|
+
<>
|
|
17
|
+
<InstructionsList
|
|
18
|
+
dos={['Do an initial money transfer', 'Invite at least 3 friends to join']}
|
|
19
|
+
donts={['Paying extra hidden fees for transfers', 'Use bad exchange rate']}
|
|
20
|
+
sort="dosFirst"
|
|
21
|
+
/>
|
|
22
|
+
<InstructionsList
|
|
23
|
+
dos={['Complete your profile verification']}
|
|
24
|
+
donts={['Share your login credentials with others']}
|
|
25
|
+
sort="dontsFirst"
|
|
26
|
+
/>
|
|
27
|
+
</>
|
|
28
|
+
),
|
|
29
|
+
...withRTLDiff(),
|
|
30
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
2
|
+
import { withRTLDiff } from '../../../.storybook/decorators/RtlDiffDecorator';
|
|
3
|
+
import Info from '../../Info';
|
|
4
|
+
import Label from '..';
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
component: Label,
|
|
8
|
+
title: 'Forms/Label/Tests',
|
|
9
|
+
tags: ['!autodocs', '!manifest'],
|
|
10
|
+
} satisfies Meta<typeof Label>;
|
|
11
|
+
|
|
12
|
+
type Story = StoryObj<typeof Label>;
|
|
13
|
+
|
|
14
|
+
export const RTLDiff: Story = {
|
|
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(),
|
|
36
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
2
|
+
import { withRTLDiff } from '../../../.storybook/decorators/RtlDiffDecorator';
|
|
3
|
+
import Link from '..';
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
component: Link,
|
|
7
|
+
title: 'Typography/Link/Tests',
|
|
8
|
+
tags: ['!autodocs', '!manifest'],
|
|
9
|
+
} satisfies Meta<typeof Link>;
|
|
10
|
+
|
|
11
|
+
type Story = StoryObj<typeof Link>;
|
|
12
|
+
|
|
13
|
+
export const RTLDiff: Story = {
|
|
14
|
+
render: () => (
|
|
15
|
+
<>
|
|
16
|
+
<Link href="#" target="_blank">
|
|
17
|
+
External link with navigate-away icon
|
|
18
|
+
</Link>
|
|
19
|
+
<br />
|
|
20
|
+
<Link href="#" target="_blank" type="link-large">
|
|
21
|
+
Large external link with navigate-away icon
|
|
22
|
+
</Link>
|
|
23
|
+
</>
|
|
24
|
+
),
|
|
25
|
+
...withRTLDiff(),
|
|
26
|
+
};
|
|
@@ -619,6 +619,7 @@
|
|
|
619
619
|
.wds-list-item-spotlight-inactive {
|
|
620
620
|
background-color: rgba(134, 167, 189, 0.025);
|
|
621
621
|
}
|
|
622
|
+
|
|
622
623
|
@supports (color: color-mix(in lch, red, blue)) {
|
|
623
624
|
.wds-list-item-spotlight-inactive {
|
|
624
625
|
background-color: color-mix(in srgb, var(--color-background-neutral) 25%, transparent);
|
package/src/ListItem/_stories/{variants/ListItem.rtl.test.story.tsx → ListItem.rtl.test.story.tsx}
RENAMED
|
@@ -1,22 +1,18 @@
|
|
|
1
1
|
import { Meta } from '@storybook/react-webpack5';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import { withRTLDiff } from '../../../.storybook/decorators/RtlDiffDecorator';
|
|
3
|
+
import { ListItem, type ListItemProps } from '../ListItem';
|
|
4
|
+
import { VariantStory } from './variants/helpers';
|
|
5
5
|
|
|
6
6
|
export default {
|
|
7
7
|
component: ListItem,
|
|
8
|
-
title: 'Content/ListItem/Tests/
|
|
8
|
+
title: 'Content/ListItem/Tests/RTL Diff',
|
|
9
9
|
tags: ['!autodocs', '!manifest'],
|
|
10
|
-
|
|
11
|
-
controls: { disable: true },
|
|
12
|
-
actions: { disable: true },
|
|
13
|
-
knobs: { disable: true },
|
|
14
|
-
},
|
|
10
|
+
...withRTLDiff({ width: 'stretch' }),
|
|
15
11
|
} satisfies Meta<ListItemProps>;
|
|
16
12
|
|
|
17
13
|
const Default = {
|
|
18
14
|
...VariantStory,
|
|
19
|
-
|
|
15
|
+
parameters: { variants: [] },
|
|
20
16
|
args: { variant: 'rtl' },
|
|
21
17
|
};
|
|
22
18
|
|
|
@@ -141,12 +141,8 @@ export const VariantStory: VariantStory = {
|
|
|
141
141
|
|
|
142
142
|
return (
|
|
143
143
|
<List>
|
|
144
|
-
{instances.map((instance) => (
|
|
145
|
-
<ListItem
|
|
146
|
-
key={`${variant}-${controlType}-${JSON.stringify(instance)}`}
|
|
147
|
-
control={control}
|
|
148
|
-
{...instance}
|
|
149
|
-
/>
|
|
144
|
+
{instances.map((instance, index) => (
|
|
145
|
+
<ListItem key={`${variant}-${controlType}-${index}`} control={control} {...instance} />
|
|
150
146
|
))}
|
|
151
147
|
</List>
|
|
152
148
|
);
|
|
@@ -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 Logo, { LogoType } from '..';
|
|
4
5
|
import { LogoFormat } from '../Logo';
|
|
5
6
|
import type { LogoSize } from '../Logo';
|
|
@@ -93,3 +94,46 @@ export const Sizes = () => (
|
|
|
93
94
|
)}
|
|
94
95
|
</div>
|
|
95
96
|
);
|
|
97
|
+
|
|
98
|
+
const rtlSizes: LogoSize[] = [16, 20, 24, 36];
|
|
99
|
+
|
|
100
|
+
export const RTLDiff: Story = {
|
|
101
|
+
render: () => (
|
|
102
|
+
<>
|
|
103
|
+
<div
|
|
104
|
+
style={{
|
|
105
|
+
display: 'grid',
|
|
106
|
+
gridTemplateColumns: `repeat(${rtlSizes.length}, min-content)`,
|
|
107
|
+
gap: '1rem',
|
|
108
|
+
alignItems: 'center',
|
|
109
|
+
}}
|
|
110
|
+
>
|
|
111
|
+
{rtlSizes.map((size) => (
|
|
112
|
+
<Logo key={`compact-${size}`} size={size} display="compact" />
|
|
113
|
+
))}
|
|
114
|
+
</div>
|
|
115
|
+
|
|
116
|
+
<div
|
|
117
|
+
style={{
|
|
118
|
+
display: 'grid',
|
|
119
|
+
gridTemplateColumns: `repeat(${rtlSizes.length}, min-content)`,
|
|
120
|
+
gap: '1rem',
|
|
121
|
+
alignItems: 'center',
|
|
122
|
+
}}
|
|
123
|
+
>
|
|
124
|
+
{rtlSizes.map((size) => (
|
|
125
|
+
<Logo key={`full-${size}`} size={size} display="full" />
|
|
126
|
+
))}
|
|
127
|
+
</div>
|
|
128
|
+
|
|
129
|
+
{Object.values(LogoType).map((type) => (
|
|
130
|
+
<Logo key={`primary-${type}`} type={type} format="primary-lockup" display="full" />
|
|
131
|
+
))}
|
|
132
|
+
|
|
133
|
+
{Object.values(LogoType).map((type) => (
|
|
134
|
+
<Logo key={`secondary-${type}`} type={type} format="secondary-lockup" display="full" />
|
|
135
|
+
))}
|
|
136
|
+
</>
|
|
137
|
+
),
|
|
138
|
+
...withRTLDiff(),
|
|
139
|
+
};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
2
|
+
|
|
3
|
+
import { withRTLDiff } from '../../../.storybook/decorators/RtlDiffDecorator';
|
|
4
|
+
import { Button, Modal } from '../..';
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
component: Modal,
|
|
8
|
+
title: 'Dialogs/Modal/Tests/RTL Diff',
|
|
9
|
+
tags: ['!autodocs', '!manifest'],
|
|
10
|
+
} satisfies Meta<typeof Modal>;
|
|
11
|
+
|
|
12
|
+
type Story = StoryObj<typeof Modal>;
|
|
13
|
+
|
|
14
|
+
const iframeDiff = withRTLDiff({ renderAs: 'iframe' });
|
|
15
|
+
|
|
16
|
+
export const WithTitleAndFooter: Story = {
|
|
17
|
+
render: () => (
|
|
18
|
+
<Modal
|
|
19
|
+
open
|
|
20
|
+
title="Modal title"
|
|
21
|
+
body="Body content for the modal dialog."
|
|
22
|
+
footer={
|
|
23
|
+
<Button v2 block>
|
|
24
|
+
Confirm
|
|
25
|
+
</Button>
|
|
26
|
+
}
|
|
27
|
+
onClose={() => {}}
|
|
28
|
+
/>
|
|
29
|
+
),
|
|
30
|
+
...iframeDiff,
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export const WithoutFooter: Story = {
|
|
34
|
+
render: () => (
|
|
35
|
+
<Modal
|
|
36
|
+
open
|
|
37
|
+
title="Modal without footer"
|
|
38
|
+
body="Body content without a footer."
|
|
39
|
+
onClose={() => {}}
|
|
40
|
+
/>
|
|
41
|
+
),
|
|
42
|
+
...iframeDiff,
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export const WithoutTitle: Story = {
|
|
46
|
+
render: () => (
|
|
47
|
+
<Modal
|
|
48
|
+
open
|
|
49
|
+
body="Body content without a title."
|
|
50
|
+
footer={
|
|
51
|
+
<Button v2 block>
|
|
52
|
+
Done
|
|
53
|
+
</Button>
|
|
54
|
+
}
|
|
55
|
+
onClose={() => {}}
|
|
56
|
+
/>
|
|
57
|
+
),
|
|
58
|
+
...iframeDiff,
|
|
59
|
+
};
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
2
|
+
import { userEvent, within } from 'storybook/test';
|
|
3
|
+
|
|
4
|
+
import { withRTLDiff } from '../../../.storybook/decorators/RtlDiffDecorator';
|
|
5
|
+
import Field from '../../Field/Field';
|
|
6
|
+
import MoneyInput from '..';
|
|
7
|
+
|
|
8
|
+
export default {
|
|
9
|
+
component: MoneyInput,
|
|
10
|
+
title: 'Forms/MoneyInput/Tests/RTL Diff',
|
|
11
|
+
tags: ['!autodocs', '!manifest'],
|
|
12
|
+
} satisfies Meta<typeof MoneyInput>;
|
|
13
|
+
|
|
14
|
+
type Story = StoryObj<typeof MoneyInput>;
|
|
15
|
+
|
|
16
|
+
const eurCurrency = {
|
|
17
|
+
value: 'EUR',
|
|
18
|
+
label: 'EUR',
|
|
19
|
+
note: 'Euro',
|
|
20
|
+
currency: 'eur',
|
|
21
|
+
} as const;
|
|
22
|
+
|
|
23
|
+
const gbpCurrency = {
|
|
24
|
+
value: 'GBP',
|
|
25
|
+
label: 'GBP',
|
|
26
|
+
note: 'British pound',
|
|
27
|
+
currency: 'gbp',
|
|
28
|
+
} as const;
|
|
29
|
+
|
|
30
|
+
const multipleCurrencies = [eurCurrency, gbpCurrency] as const;
|
|
31
|
+
|
|
32
|
+
const sharedProps = {
|
|
33
|
+
amount: 1000,
|
|
34
|
+
id: 'money-input',
|
|
35
|
+
onAmountChange: () => {},
|
|
36
|
+
onCurrencyChange: () => {},
|
|
37
|
+
} as const;
|
|
38
|
+
|
|
39
|
+
export const TriggerVariants: Story = {
|
|
40
|
+
render: () => (
|
|
41
|
+
<>
|
|
42
|
+
<Field label="Single currency — large (flag + code)">
|
|
43
|
+
<MoneyInput {...sharedProps} size="lg" currencies={[]} selectedCurrency={eurCurrency} />
|
|
44
|
+
</Field>
|
|
45
|
+
<Field label="Single currency — medium (flag + code)">
|
|
46
|
+
<MoneyInput {...sharedProps} size="md" currencies={[]} selectedCurrency={eurCurrency} />
|
|
47
|
+
</Field>
|
|
48
|
+
<Field label="Single currency — small (code only)">
|
|
49
|
+
<MoneyInput {...sharedProps} size="sm" currencies={[]} selectedCurrency={eurCurrency} />
|
|
50
|
+
</Field>
|
|
51
|
+
<Field label="Multiple currencies — large (select trigger with flag)">
|
|
52
|
+
<MoneyInput
|
|
53
|
+
{...sharedProps}
|
|
54
|
+
size="lg"
|
|
55
|
+
currencies={multipleCurrencies}
|
|
56
|
+
selectedCurrency={eurCurrency}
|
|
57
|
+
/>
|
|
58
|
+
</Field>
|
|
59
|
+
<Field label="Multiple currencies — small (select trigger without flag)">
|
|
60
|
+
<MoneyInput
|
|
61
|
+
{...sharedProps}
|
|
62
|
+
size="sm"
|
|
63
|
+
currencies={multipleCurrencies}
|
|
64
|
+
selectedCurrency={eurCurrency}
|
|
65
|
+
/>
|
|
66
|
+
</Field>
|
|
67
|
+
</>
|
|
68
|
+
),
|
|
69
|
+
...withRTLDiff(),
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
export const OpenDropdown: Story = {
|
|
73
|
+
render: () => (
|
|
74
|
+
<MoneyInput
|
|
75
|
+
{...sharedProps}
|
|
76
|
+
size="lg"
|
|
77
|
+
currencies={multipleCurrencies}
|
|
78
|
+
selectedCurrency={eurCurrency}
|
|
79
|
+
/>
|
|
80
|
+
),
|
|
81
|
+
play: async ({ canvasElement }) => {
|
|
82
|
+
const canvas = within(canvasElement);
|
|
83
|
+
const trigger = canvas.queryByRole('combobox');
|
|
84
|
+
if (!trigger) return;
|
|
85
|
+
await userEvent.click(trigger);
|
|
86
|
+
},
|
|
87
|
+
...withRTLDiff({ renderAs: 'iframe', width: '80%' }),
|
|
88
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
2
|
+
import { withRTLDiff } from '../../../.storybook/decorators/RtlDiffDecorator';
|
|
3
|
+
import Nudge from '../Nudge';
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
component: Nudge,
|
|
7
|
+
title: 'Prompts/Nudge/Tests',
|
|
8
|
+
tags: ['!autodocs', '!manifest'],
|
|
9
|
+
} satisfies Meta<typeof Nudge>;
|
|
10
|
+
|
|
11
|
+
type Story = StoryObj<typeof Nudge>;
|
|
12
|
+
|
|
13
|
+
export const RTLDiff: Story = {
|
|
14
|
+
render: () => (
|
|
15
|
+
<>
|
|
16
|
+
<Nudge
|
|
17
|
+
mediaName="globe"
|
|
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"
|
|
27
|
+
action={{ text: 'Learn more', href: '#' }}
|
|
28
|
+
onDismiss={() => {}}
|
|
29
|
+
/>
|
|
30
|
+
<div style={{ marginTop: 16 }} />
|
|
31
|
+
<Nudge title="Without media, with dismiss" link="Link" href="#" onDismiss={() => {}} />
|
|
32
|
+
<div style={{ marginTop: 16 }} />
|
|
33
|
+
<Nudge title="Without media, no dismiss" link="Link" href="#" />
|
|
34
|
+
</>
|
|
35
|
+
),
|
|
36
|
+
...withRTLDiff(),
|
|
37
|
+
};
|