@transferwise/components 46.159.0 → 46.159.2
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/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 +4 -4104
- 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-addons.css +1841 -0
- package/build/styles/css/neptune-core.css +2092 -0
- package/build/styles/css/neptune.css +0 -2821
- package/build/styles/main.css +4 -4104
- package/build/styles/styles/less/neptune-addons.css +1841 -0
- package/build/styles/styles/less/neptune-core.css +2092 -0
- package/build/styles/styles/less/neptune.css +0 -2821
- package/build/types/ListItem/_stories/variants/helpers.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/AnimatedLabel/AnimatedLabel.less +0 -1
- 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/_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/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 +4 -4104
- package/src/styles/less/alerts.less +1 -2
- package/src/styles/less/neptune-addons.css +1841 -0
- package/src/styles/less/neptune-addons.less +4 -0
- package/src/styles/less/neptune-core.css +2092 -0
- package/src/styles/less/neptune-core.less +4 -0
- package/src/styles/less/neptune.bundle.less +11 -11
- package/src/styles/less/neptune.css +0 -2821
|
@@ -2,6 +2,7 @@ import { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
|
2
2
|
import { fn } from 'storybook/test';
|
|
3
3
|
import { lorem10 } from '../../test-utils';
|
|
4
4
|
import Checkbox from '../Checkbox';
|
|
5
|
+
import { withRTLDiff } from '../../../.storybook/decorators/RtlDiffDecorator';
|
|
5
6
|
import { withVariantConfig } from '../../../.storybook/helpers';
|
|
6
7
|
|
|
7
8
|
const meta: Meta<typeof Checkbox> = {
|
|
@@ -31,3 +32,22 @@ export const MultipleMobile: Story = {
|
|
|
31
32
|
},
|
|
32
33
|
...withVariantConfig(['default', 'dark', 'rtl', 'mobile']),
|
|
33
34
|
};
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* The checkbox indicator sits to the start of the label: in LTR it appears on the left,
|
|
38
|
+
* in RTL it should appear on the right. The secondary line wraps under the label text,
|
|
39
|
+
* so both single-line and two-line layouts are verified here.
|
|
40
|
+
*/
|
|
41
|
+
export const RTLDiff: Story = {
|
|
42
|
+
render: () => (
|
|
43
|
+
<>
|
|
44
|
+
<Checkbox label="Label only" onChange={() => {}} />
|
|
45
|
+
<Checkbox
|
|
46
|
+
label="Label with secondary"
|
|
47
|
+
secondary="Secondary description text"
|
|
48
|
+
onChange={() => {}}
|
|
49
|
+
/>
|
|
50
|
+
</>
|
|
51
|
+
),
|
|
52
|
+
...withRTLDiff(),
|
|
53
|
+
};
|
|
@@ -2,6 +2,7 @@ import React, { useState } from 'react';
|
|
|
2
2
|
import type { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
3
3
|
import { expect, userEvent, within } from 'storybook/test';
|
|
4
4
|
|
|
5
|
+
import { withRTLDiff } from '../../../.storybook/decorators/RtlDiffDecorator';
|
|
5
6
|
import { withVariantConfig } from '../../../.storybook/helpers';
|
|
6
7
|
import CheckboxButton from '../CheckboxButton';
|
|
7
8
|
|
|
@@ -181,43 +182,6 @@ export const KeyboardInteraction: Story = {
|
|
|
181
182
|
},
|
|
182
183
|
};
|
|
183
184
|
|
|
184
|
-
/** Base checkbox states in right-to-left layout. */
|
|
185
|
-
export const RTL: Story = {
|
|
186
|
-
render: function Render() {
|
|
187
|
-
const [unchecked, setUnchecked] = useState(false);
|
|
188
|
-
const [checked, setChecked] = useState(true);
|
|
189
|
-
const [indeterminate, setIndeterminate] = useState(false);
|
|
190
|
-
return (
|
|
191
|
-
<div style={{ display: 'flex', gap: '16px', alignItems: 'center', padding: '16px' }}>
|
|
192
|
-
<CheckboxButton
|
|
193
|
-
aria-label="Unchecked"
|
|
194
|
-
checked={unchecked}
|
|
195
|
-
onChange={() => setUnchecked((v) => !v)}
|
|
196
|
-
/>
|
|
197
|
-
<CheckboxButton
|
|
198
|
-
aria-label="Checked"
|
|
199
|
-
checked={checked}
|
|
200
|
-
onChange={() => setChecked((v) => !v)}
|
|
201
|
-
/>
|
|
202
|
-
<CheckboxButton
|
|
203
|
-
aria-label="Indeterminate"
|
|
204
|
-
checked={indeterminate}
|
|
205
|
-
indeterminate
|
|
206
|
-
onChange={() => setIndeterminate((v) => !v)}
|
|
207
|
-
/>
|
|
208
|
-
<CheckboxButton
|
|
209
|
-
aria-label="Disabled unchecked"
|
|
210
|
-
checked={false}
|
|
211
|
-
disabled
|
|
212
|
-
onChange={() => {}}
|
|
213
|
-
/>
|
|
214
|
-
<CheckboxButton aria-label="Disabled checked" checked disabled onChange={() => {}} />
|
|
215
|
-
</div>
|
|
216
|
-
);
|
|
217
|
-
},
|
|
218
|
-
...withVariantConfig(['rtl']),
|
|
219
|
-
};
|
|
220
|
-
|
|
221
185
|
/** Checkbox states at 400% zoom for accessibility testing. */
|
|
222
186
|
export const Zoom400: Story = {
|
|
223
187
|
render: () => (
|
|
@@ -234,3 +198,19 @@ export const Zoom400: Story = {
|
|
|
234
198
|
),
|
|
235
199
|
...withVariantConfig(['400%']),
|
|
236
200
|
};
|
|
201
|
+
|
|
202
|
+
export const RTLDiff: Story = {
|
|
203
|
+
render: () => (
|
|
204
|
+
<>
|
|
205
|
+
<CheckboxButton aria-label="Unchecked" checked={false} onChange={() => {}} />
|
|
206
|
+
<CheckboxButton aria-label="Checked" checked onChange={() => {}} />
|
|
207
|
+
<CheckboxButton
|
|
208
|
+
aria-label="Indeterminate"
|
|
209
|
+
checked={false}
|
|
210
|
+
indeterminate
|
|
211
|
+
onChange={() => {}}
|
|
212
|
+
/>
|
|
213
|
+
</>
|
|
214
|
+
),
|
|
215
|
+
...withRTLDiff(),
|
|
216
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
2
|
+
|
|
3
|
+
import { withRTLDiff } from '../../../.storybook/decorators/RtlDiffDecorator';
|
|
4
|
+
import Chevron from '..';
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
component: Chevron,
|
|
8
|
+
title: 'Other/Chevron/Tests',
|
|
9
|
+
tags: ['!autodocs', '!manifest'],
|
|
10
|
+
} satisfies Meta<typeof Chevron>;
|
|
11
|
+
|
|
12
|
+
type Story = StoryObj<typeof Chevron>;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Chevrons pointing left or right should mirror their direction in RTL mode.
|
|
16
|
+
* A left-pointing chevron in LTR becomes right-pointing in RTL and vice versa.
|
|
17
|
+
*/
|
|
18
|
+
export const RTLDiff: Story = {
|
|
19
|
+
render: () => (
|
|
20
|
+
<div style={{ display: 'flex', gap: '16px', alignItems: 'center' }}>
|
|
21
|
+
<Chevron orientation="left" size="md" />
|
|
22
|
+
<Chevron orientation="right" size="md" />
|
|
23
|
+
</div>
|
|
24
|
+
),
|
|
25
|
+
...withRTLDiff(),
|
|
26
|
+
};
|
|
@@ -2,6 +2,7 @@ import type { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
|
2
2
|
import { userEvent } from 'storybook/test';
|
|
3
3
|
import { useState } from 'react';
|
|
4
4
|
|
|
5
|
+
import { withRTLDiff } from '../../../.storybook/decorators/RtlDiffDecorator';
|
|
5
6
|
import { withVariantConfig } from '../../../.storybook/helpers';
|
|
6
7
|
import Chips, { type ChipValue } from '../Chips';
|
|
7
8
|
|
|
@@ -121,40 +122,6 @@ export const FilterKeyboardInteraction: Story = {
|
|
|
121
122
|
},
|
|
122
123
|
};
|
|
123
124
|
|
|
124
|
-
/** Filter and choice chips in right-to-left layout. */
|
|
125
|
-
export const RTL: Story = {
|
|
126
|
-
render: function Render() {
|
|
127
|
-
const [filterSelected, setFilterSelected] = useState<readonly ChipValue[]>([
|
|
128
|
-
'accounting',
|
|
129
|
-
'payments',
|
|
130
|
-
]);
|
|
131
|
-
const [choiceSelected, setChoiceSelected] = useState<ChipValue>(300);
|
|
132
|
-
|
|
133
|
-
return (
|
|
134
|
-
<div style={{ display: 'flex', flexDirection: 'column', gap: '16px' }}>
|
|
135
|
-
<Chips
|
|
136
|
-
chips={filterChips}
|
|
137
|
-
multiple
|
|
138
|
-
selected={filterSelected}
|
|
139
|
-
aria-label="Category filter"
|
|
140
|
-
onChange={({ selectedValue, isEnabled }) => {
|
|
141
|
-
setFilterSelected((prev) =>
|
|
142
|
-
isEnabled ? [...prev, selectedValue] : prev.filter((v) => v !== selectedValue),
|
|
143
|
-
);
|
|
144
|
-
}}
|
|
145
|
-
/>
|
|
146
|
-
<Chips
|
|
147
|
-
chips={choiceChips}
|
|
148
|
-
selected={choiceSelected}
|
|
149
|
-
aria-label="Transfer amount"
|
|
150
|
-
onChange={({ selectedValue }) => setChoiceSelected(selectedValue)}
|
|
151
|
-
/>
|
|
152
|
-
</div>
|
|
153
|
-
);
|
|
154
|
-
},
|
|
155
|
-
...withVariantConfig(['rtl']),
|
|
156
|
-
};
|
|
157
|
-
|
|
158
125
|
/** Filter chips at 400% zoom for accessibility testing. */
|
|
159
126
|
export const Zoom400: Story = {
|
|
160
127
|
render: function Render() {
|
|
@@ -175,3 +142,41 @@ export const Zoom400: Story = {
|
|
|
175
142
|
},
|
|
176
143
|
...withVariantConfig(['400%']),
|
|
177
144
|
};
|
|
145
|
+
|
|
146
|
+
const categoryChips = [
|
|
147
|
+
{ value: 'all', label: 'All' },
|
|
148
|
+
{ value: 'accounting', label: 'Accounting' },
|
|
149
|
+
{ value: 'payroll', label: 'Payroll' },
|
|
150
|
+
{ value: 'payments', label: 'Payments' },
|
|
151
|
+
];
|
|
152
|
+
|
|
153
|
+
const amountChips = [
|
|
154
|
+
{ value: 100, label: '100 GBP' },
|
|
155
|
+
{ value: 200, label: '200 GBP' },
|
|
156
|
+
{ value: 300, label: '300 GBP' },
|
|
157
|
+
{ value: 500, label: '500 GBP+' },
|
|
158
|
+
];
|
|
159
|
+
|
|
160
|
+
export const RTLDiff: Story = {
|
|
161
|
+
render: () => (
|
|
162
|
+
<>
|
|
163
|
+
{/* Choice mode: chip row order reverses in RTL */}
|
|
164
|
+
<Chips
|
|
165
|
+
chips={amountChips}
|
|
166
|
+
selected={300}
|
|
167
|
+
multiple={false}
|
|
168
|
+
aria-label="Transfer amount"
|
|
169
|
+
onChange={() => undefined}
|
|
170
|
+
/>
|
|
171
|
+
{/* Filter mode: selected chips show close button on trailing end */}
|
|
172
|
+
<Chips
|
|
173
|
+
chips={categoryChips}
|
|
174
|
+
selected={['accounting', 'payments']}
|
|
175
|
+
multiple
|
|
176
|
+
aria-label="Category filter"
|
|
177
|
+
onChange={() => undefined}
|
|
178
|
+
/>
|
|
179
|
+
</>
|
|
180
|
+
),
|
|
181
|
+
...withRTLDiff(),
|
|
182
|
+
};
|
|
@@ -2,7 +2,6 @@ import { Freeze, Plus, Send, Convert, Card } from '@transferwise/icons';
|
|
|
2
2
|
|
|
3
3
|
import { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
4
4
|
import { expect, fn, userEvent, within } from 'storybook/test';
|
|
5
|
-
import { useState } from 'react';
|
|
6
5
|
import CircularButton from '../CircularButton';
|
|
7
6
|
import Title from '../../Title';
|
|
8
7
|
import Body from '../../Body';
|
|
@@ -135,73 +134,6 @@ export const KeyboardInteraction: Story = {
|
|
|
135
134
|
},
|
|
136
135
|
};
|
|
137
136
|
|
|
138
|
-
/** Base variants in right-to-left layout. */
|
|
139
|
-
export const RTL: Story = {
|
|
140
|
-
render: function Render() {
|
|
141
|
-
const [clicks, setClicks] = useState(0);
|
|
142
|
-
const rowStyle = {
|
|
143
|
-
display: 'grid',
|
|
144
|
-
gridTemplateColumns: 'repeat(4, minmax(0, 100px))',
|
|
145
|
-
gap: '16px',
|
|
146
|
-
textAlign: 'center' as const,
|
|
147
|
-
};
|
|
148
|
-
|
|
149
|
-
return (
|
|
150
|
-
<div style={{ display: 'flex', flexDirection: 'column', gap: '24px', padding: '16px' }}>
|
|
151
|
-
<div style={rowStyle}>
|
|
152
|
-
<CircularButton
|
|
153
|
-
priority="primary"
|
|
154
|
-
type="default"
|
|
155
|
-
icon={<Send />}
|
|
156
|
-
onClick={() => setClicks((c) => c + 1)}
|
|
157
|
-
>
|
|
158
|
-
Primary
|
|
159
|
-
</CircularButton>
|
|
160
|
-
<CircularButton
|
|
161
|
-
priority="secondary"
|
|
162
|
-
type="default"
|
|
163
|
-
icon={<Plus />}
|
|
164
|
-
onClick={() => setClicks((c) => c + 1)}
|
|
165
|
-
>
|
|
166
|
-
Secondary
|
|
167
|
-
</CircularButton>
|
|
168
|
-
<CircularButton disabled priority="primary" type="default" icon={<Card />}>
|
|
169
|
-
Primary disabled
|
|
170
|
-
</CircularButton>
|
|
171
|
-
<CircularButton disabled priority="secondary" type="default" icon={<Card />}>
|
|
172
|
-
Secondary disabled
|
|
173
|
-
</CircularButton>
|
|
174
|
-
</div>
|
|
175
|
-
<div style={rowStyle}>
|
|
176
|
-
<CircularButton
|
|
177
|
-
priority="primary"
|
|
178
|
-
type="negative"
|
|
179
|
-
icon={<Send />}
|
|
180
|
-
onClick={() => setClicks((c) => c + 1)}
|
|
181
|
-
>
|
|
182
|
-
Primary
|
|
183
|
-
</CircularButton>
|
|
184
|
-
<CircularButton
|
|
185
|
-
priority="secondary"
|
|
186
|
-
type="negative"
|
|
187
|
-
icon={<Convert />}
|
|
188
|
-
onClick={() => setClicks((c) => c + 1)}
|
|
189
|
-
>
|
|
190
|
-
Secondary
|
|
191
|
-
</CircularButton>
|
|
192
|
-
<CircularButton disabled priority="primary" type="negative" icon={<Card />}>
|
|
193
|
-
Primary disabled
|
|
194
|
-
</CircularButton>
|
|
195
|
-
<CircularButton disabled priority="secondary" type="negative" icon={<Card />}>
|
|
196
|
-
Secondary disabled
|
|
197
|
-
</CircularButton>
|
|
198
|
-
</div>
|
|
199
|
-
</div>
|
|
200
|
-
);
|
|
201
|
-
},
|
|
202
|
-
...withVariantConfig(['rtl']),
|
|
203
|
-
};
|
|
204
|
-
|
|
205
137
|
/** Long labels are centered beneath the icon. */
|
|
206
138
|
export const CenteredText: Story = {
|
|
207
139
|
render: () => {
|
|
@@ -6,6 +6,7 @@ import { lorem10 } from '../../test-utils';
|
|
|
6
6
|
|
|
7
7
|
import Provider from '../../Provider';
|
|
8
8
|
import translations from '../../i18n';
|
|
9
|
+
import { withRTLDiff } from '../../../.storybook/decorators/RtlDiffDecorator';
|
|
9
10
|
import { withVariantConfig } from '../../../.storybook/helpers';
|
|
10
11
|
|
|
11
12
|
const meta: Meta<typeof DateInput> = {
|
|
@@ -230,3 +231,15 @@ export const InputErrorMobile: Story = {
|
|
|
230
231
|
...InputError,
|
|
231
232
|
...withVariantConfig(['mobile'], InputError),
|
|
232
233
|
};
|
|
234
|
+
|
|
235
|
+
export const RTLDiff: Story = {
|
|
236
|
+
render: () => (
|
|
237
|
+
<>
|
|
238
|
+
<DateInput size="sm" onChange={fn()} />
|
|
239
|
+
<DateInput size="md" onChange={fn()} />
|
|
240
|
+
<DateInput size="lg" onChange={fn()} />
|
|
241
|
+
<DateInput mode="month-year" onChange={fn()} />
|
|
242
|
+
</>
|
|
243
|
+
),
|
|
244
|
+
...withRTLDiff(),
|
|
245
|
+
};
|
|
@@ -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 DateLookup from '..';
|
|
6
|
+
|
|
7
|
+
export default {
|
|
8
|
+
component: DateLookup,
|
|
9
|
+
title: 'Forms/DateLookup/Tests/RTL Diff',
|
|
10
|
+
tags: ['!autodocs', '!manifest'],
|
|
11
|
+
} satisfies Meta<typeof DateLookup>;
|
|
12
|
+
|
|
13
|
+
type Story = StoryObj<typeof DateLookup>;
|
|
14
|
+
|
|
15
|
+
const selectedDate = new Date(2024, 5, 14);
|
|
16
|
+
|
|
17
|
+
export const TriggerVariants: Story = {
|
|
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(),
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
const containerStyle: React.CSSProperties = {
|
|
53
|
+
display: 'flex',
|
|
54
|
+
justifyContent: 'center',
|
|
55
|
+
alignItems: 'flex-start',
|
|
56
|
+
minHeight: '24rem',
|
|
57
|
+
paddingTop: '2rem',
|
|
58
|
+
width: '100%',
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
export const OpenCalendarPanel: Story = {
|
|
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
|
+
),
|
|
72
|
+
play: async ({ canvasElement }: { canvasElement: HTMLElement }) => {
|
|
73
|
+
const canvas = within(canvasElement);
|
|
74
|
+
const trigger = canvas.queryByRole('button');
|
|
75
|
+
if (!trigger) return;
|
|
76
|
+
await userEvent.click(trigger);
|
|
77
|
+
// Suppress focus ring on calendar cells — FocusScope traps focus inside the panel
|
|
78
|
+
// and the autofocus cycle causes the selected date's ring to flicker between iframes.
|
|
79
|
+
const style = canvasElement.ownerDocument.createElement('style');
|
|
80
|
+
style.textContent = `
|
|
81
|
+
.np-panel__content *:focus {
|
|
82
|
+
outline: none !important;
|
|
83
|
+
box-shadow: none !important;
|
|
84
|
+
}`;
|
|
85
|
+
canvasElement.ownerDocument.head.appendChild(style);
|
|
86
|
+
},
|
|
87
|
+
...withRTLDiff({ renderAs: 'iframe' }),
|
|
88
|
+
};
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
2
|
+
|
|
3
|
+
import { withRTLDiff } from '../../../.storybook/decorators/RtlDiffDecorator';
|
|
4
|
+
import { Size } from '../../common';
|
|
5
|
+
import Decision, { DecisionPresentation, DecisionType } from '..';
|
|
6
|
+
import AvatarView from '../../AvatarView';
|
|
7
|
+
|
|
8
|
+
export default {
|
|
9
|
+
component: Decision,
|
|
10
|
+
title: 'Layouts/Decision/Tests',
|
|
11
|
+
tags: ['!autodocs', '!manifest'],
|
|
12
|
+
} satisfies Meta<typeof Decision>;
|
|
13
|
+
|
|
14
|
+
type Story = StoryObj<typeof Decision>;
|
|
15
|
+
|
|
16
|
+
const options = [
|
|
17
|
+
{
|
|
18
|
+
title: 'Send money',
|
|
19
|
+
description: 'Fast international transfers.',
|
|
20
|
+
href: '#',
|
|
21
|
+
'aria-label': 'Send money',
|
|
22
|
+
media: {
|
|
23
|
+
block: <img src="https://wise.com/public-resources/assets/illustrations/globe.svg" alt="" />,
|
|
24
|
+
list: <AvatarView profileName="Alice Smith" />,
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
title: 'Receive money',
|
|
29
|
+
description: 'Get paid from abroad.',
|
|
30
|
+
href: '#',
|
|
31
|
+
'aria-label': 'Receive money',
|
|
32
|
+
media: {
|
|
33
|
+
block: <img src="https://wise.com/public-resources/assets/illustrations/globe.svg" alt="" />,
|
|
34
|
+
list: <AvatarView profileName="Alice Smith" />,
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
];
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* NavigationOption renders media on the inline-start side and a chevron on the
|
|
41
|
+
* inline-end side; these flip in RTL. The LIST_BLOCK and LIST_BLOCK_GRID
|
|
42
|
+
* presentations use flex-row layout that also reverses direction in RTL.
|
|
43
|
+
*/
|
|
44
|
+
export const RTLDiff: Story = {
|
|
45
|
+
render: () => (
|
|
46
|
+
<>
|
|
47
|
+
<Decision
|
|
48
|
+
options={options}
|
|
49
|
+
presentation={DecisionPresentation.LIST}
|
|
50
|
+
type={DecisionType.NAVIGATION}
|
|
51
|
+
/>
|
|
52
|
+
<Decision
|
|
53
|
+
options={options}
|
|
54
|
+
presentation={DecisionPresentation.LIST}
|
|
55
|
+
type={DecisionType.NAVIGATION}
|
|
56
|
+
isContainerAligned
|
|
57
|
+
/>
|
|
58
|
+
<Decision
|
|
59
|
+
options={options}
|
|
60
|
+
presentation={DecisionPresentation.LIST_BLOCK}
|
|
61
|
+
type={DecisionType.NAVIGATION}
|
|
62
|
+
size={Size.MEDIUM}
|
|
63
|
+
/>
|
|
64
|
+
<Decision
|
|
65
|
+
options={options}
|
|
66
|
+
presentation={DecisionPresentation.LIST_BLOCK}
|
|
67
|
+
type={DecisionType.NAVIGATION}
|
|
68
|
+
size={Size.SMALL}
|
|
69
|
+
/>
|
|
70
|
+
<Decision
|
|
71
|
+
options={[...options, ...options]}
|
|
72
|
+
presentation={DecisionPresentation.LIST_BLOCK_GRID}
|
|
73
|
+
type={DecisionType.NAVIGATION}
|
|
74
|
+
size={Size.MEDIUM}
|
|
75
|
+
/>
|
|
76
|
+
</>
|
|
77
|
+
),
|
|
78
|
+
...withRTLDiff(),
|
|
79
|
+
};
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
2
2
|
import { expect } from 'storybook/test';
|
|
3
3
|
|
|
4
|
+
import { withRTLDiff } from '../../../.storybook/decorators/RtlDiffDecorator';
|
|
4
5
|
import { Layout } from '../../common';
|
|
5
6
|
|
|
6
|
-
import DefinitionList, { type DefinitionListDefinition } from '..';
|
|
7
|
+
import DefinitionList, { type DefinitionListDefinition, type DefinitionListLayout } from '..';
|
|
7
8
|
|
|
8
9
|
const longValues = {
|
|
9
10
|
amount: '1,234,567.89 GBP from your Wise Business account ending in 4821',
|
|
@@ -166,3 +167,55 @@ export const HORIZONTAL_RIGHT_ALIGNED: Story = {
|
|
|
166
167
|
),
|
|
167
168
|
play: verifySharedColumnBoundary,
|
|
168
169
|
};
|
|
170
|
+
|
|
171
|
+
const rtlDefinitions: DefinitionListDefinition[] = [
|
|
172
|
+
{ key: 'name', title: 'Full name', value: 'Alice Smith' },
|
|
173
|
+
{ key: 'amount', title: 'Amount sent', value: '1,234.56 GBP' },
|
|
174
|
+
{ key: 'status', title: 'Transfer status', value: 'Completed successfully' },
|
|
175
|
+
];
|
|
176
|
+
|
|
177
|
+
const rtlDefinitionsWithAction: DefinitionListDefinition[] = [
|
|
178
|
+
{ key: 'name', title: 'Full name', value: 'Alice Smith' },
|
|
179
|
+
{
|
|
180
|
+
key: 'amount',
|
|
181
|
+
title: 'Amount sent',
|
|
182
|
+
value: '1,234.56 GBP',
|
|
183
|
+
action: { label: 'Edit' },
|
|
184
|
+
},
|
|
185
|
+
{
|
|
186
|
+
key: 'status',
|
|
187
|
+
title: 'Transfer status',
|
|
188
|
+
value: 'Completed successfully',
|
|
189
|
+
action: { label: 'View details' },
|
|
190
|
+
},
|
|
191
|
+
];
|
|
192
|
+
|
|
193
|
+
const layouts: DefinitionListLayout[] = [
|
|
194
|
+
'VERTICAL_TWO_COLUMN',
|
|
195
|
+
'VERTICAL_ONE_COLUMN',
|
|
196
|
+
'HORIZONTAL_JUSTIFIED',
|
|
197
|
+
'HORIZONTAL_LEFT_ALIGNED',
|
|
198
|
+
'HORIZONTAL_RIGHT_ALIGNED',
|
|
199
|
+
];
|
|
200
|
+
|
|
201
|
+
export const RTLDiff: Story = {
|
|
202
|
+
render: () => (
|
|
203
|
+
<div style={{ display: 'flex', flexDirection: 'column', gap: 'var(--size-48)' }}>
|
|
204
|
+
{layouts.map((layout) => (
|
|
205
|
+
<section key={layout}>
|
|
206
|
+
<h3 style={{ fontSize: 14, margin: '0 0 var(--size-8)' }}>{layout}</h3>
|
|
207
|
+
<DefinitionList layout={layout} definitions={rtlDefinitions} />
|
|
208
|
+
</section>
|
|
209
|
+
))}
|
|
210
|
+
{layouts.map((layout) => (
|
|
211
|
+
<section key={`${layout}-action`}>
|
|
212
|
+
<h3 style={{ fontSize: 14, margin: '0 0 var(--size-8)' }}>
|
|
213
|
+
{layout} with action buttons
|
|
214
|
+
</h3>
|
|
215
|
+
<DefinitionList layout={layout} definitions={rtlDefinitionsWithAction} />
|
|
216
|
+
</section>
|
|
217
|
+
))}
|
|
218
|
+
</div>
|
|
219
|
+
),
|
|
220
|
+
...withRTLDiff(),
|
|
221
|
+
};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
2
|
+
|
|
3
|
+
import { withRTLDiff } from '../../../.storybook/decorators/RtlDiffDecorator';
|
|
4
|
+
import Drawer from '..';
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
component: Drawer,
|
|
8
|
+
title: 'Dialogs/Drawer/Tests/RTL Diff',
|
|
9
|
+
tags: ['!autodocs', '!manifest'],
|
|
10
|
+
} satisfies Meta<typeof Drawer>;
|
|
11
|
+
|
|
12
|
+
type Story = StoryObj<typeof Drawer>;
|
|
13
|
+
|
|
14
|
+
const iframeDiff = withRTLDiff({ renderAs: 'iframe' });
|
|
15
|
+
|
|
16
|
+
export const PositionRight: Story = {
|
|
17
|
+
render: () => (
|
|
18
|
+
<Drawer
|
|
19
|
+
open
|
|
20
|
+
position="right"
|
|
21
|
+
headerTitle="Drawer title"
|
|
22
|
+
footerContent={<button type="button">Done</button>}
|
|
23
|
+
onClose={() => {}}
|
|
24
|
+
>
|
|
25
|
+
<p>Drawer body content.</p>
|
|
26
|
+
</Drawer>
|
|
27
|
+
),
|
|
28
|
+
...iframeDiff,
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export const PositionLeft: Story = {
|
|
32
|
+
render: () => (
|
|
33
|
+
<Drawer
|
|
34
|
+
open
|
|
35
|
+
position="left"
|
|
36
|
+
headerTitle="Left drawer title"
|
|
37
|
+
footerContent={<button type="button">Done</button>}
|
|
38
|
+
onClose={() => {}}
|
|
39
|
+
>
|
|
40
|
+
<p>Left drawer body content.</p>
|
|
41
|
+
</Drawer>
|
|
42
|
+
),
|
|
43
|
+
...iframeDiff,
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export const WithoutTitle: Story = {
|
|
47
|
+
render: () => (
|
|
48
|
+
<Drawer
|
|
49
|
+
open
|
|
50
|
+
position="right"
|
|
51
|
+
footerContent={<button type="button">Done</button>}
|
|
52
|
+
onClose={() => {}}
|
|
53
|
+
>
|
|
54
|
+
<p>No title drawer content.</p>
|
|
55
|
+
</Drawer>
|
|
56
|
+
),
|
|
57
|
+
...iframeDiff,
|
|
58
|
+
};
|