@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.
Files changed (190) hide show
  1. package/build/i18n/cs.json +5 -0
  2. package/build/i18n/cs.json.js +5 -0
  3. package/build/i18n/cs.json.js.map +1 -1
  4. package/build/i18n/cs.json.mjs +5 -0
  5. package/build/i18n/cs.json.mjs.map +1 -1
  6. package/build/i18n/de.json +5 -0
  7. package/build/i18n/de.json.js +5 -0
  8. package/build/i18n/de.json.js.map +1 -1
  9. package/build/i18n/de.json.mjs +5 -0
  10. package/build/i18n/de.json.mjs.map +1 -1
  11. package/build/i18n/es.json +5 -0
  12. package/build/i18n/es.json.js +5 -0
  13. package/build/i18n/es.json.js.map +1 -1
  14. package/build/i18n/es.json.mjs +5 -0
  15. package/build/i18n/es.json.mjs.map +1 -1
  16. package/build/i18n/fr.json +5 -0
  17. package/build/i18n/fr.json.js +5 -0
  18. package/build/i18n/fr.json.js.map +1 -1
  19. package/build/i18n/fr.json.mjs +5 -0
  20. package/build/i18n/fr.json.mjs.map +1 -1
  21. package/build/i18n/hu.json +5 -0
  22. package/build/i18n/hu.json.js +5 -0
  23. package/build/i18n/hu.json.js.map +1 -1
  24. package/build/i18n/hu.json.mjs +5 -0
  25. package/build/i18n/hu.json.mjs.map +1 -1
  26. package/build/i18n/id.json +5 -0
  27. package/build/i18n/id.json.js +5 -0
  28. package/build/i18n/id.json.js.map +1 -1
  29. package/build/i18n/id.json.mjs +5 -0
  30. package/build/i18n/id.json.mjs.map +1 -1
  31. package/build/i18n/it.json +5 -0
  32. package/build/i18n/it.json.js +5 -0
  33. package/build/i18n/it.json.js.map +1 -1
  34. package/build/i18n/it.json.mjs +5 -0
  35. package/build/i18n/it.json.mjs.map +1 -1
  36. package/build/i18n/ja.json +5 -0
  37. package/build/i18n/ja.json.js +5 -0
  38. package/build/i18n/ja.json.js.map +1 -1
  39. package/build/i18n/ja.json.mjs +5 -0
  40. package/build/i18n/ja.json.mjs.map +1 -1
  41. package/build/i18n/nl.json +5 -0
  42. package/build/i18n/nl.json.js +5 -0
  43. package/build/i18n/nl.json.js.map +1 -1
  44. package/build/i18n/nl.json.mjs +5 -0
  45. package/build/i18n/nl.json.mjs.map +1 -1
  46. package/build/i18n/pl.json +5 -0
  47. package/build/i18n/pl.json.js +5 -0
  48. package/build/i18n/pl.json.js.map +1 -1
  49. package/build/i18n/pl.json.mjs +5 -0
  50. package/build/i18n/pl.json.mjs.map +1 -1
  51. package/build/i18n/pt.json +5 -0
  52. package/build/i18n/pt.json.js +5 -0
  53. package/build/i18n/pt.json.js.map +1 -1
  54. package/build/i18n/pt.json.mjs +5 -0
  55. package/build/i18n/pt.json.mjs.map +1 -1
  56. package/build/i18n/ro.json +5 -0
  57. package/build/i18n/ro.json.js +5 -0
  58. package/build/i18n/ro.json.js.map +1 -1
  59. package/build/i18n/ro.json.mjs +5 -0
  60. package/build/i18n/ro.json.mjs.map +1 -1
  61. package/build/i18n/ru.json +5 -0
  62. package/build/i18n/ru.json.js +5 -0
  63. package/build/i18n/ru.json.js.map +1 -1
  64. package/build/i18n/ru.json.mjs +5 -0
  65. package/build/i18n/ru.json.mjs.map +1 -1
  66. package/build/i18n/th.json +5 -0
  67. package/build/i18n/th.json.js +5 -0
  68. package/build/i18n/th.json.js.map +1 -1
  69. package/build/i18n/th.json.mjs +5 -0
  70. package/build/i18n/th.json.mjs.map +1 -1
  71. package/build/i18n/uk.json +5 -0
  72. package/build/i18n/uk.json.js +5 -0
  73. package/build/i18n/uk.json.js.map +1 -1
  74. package/build/i18n/uk.json.mjs +5 -0
  75. package/build/i18n/uk.json.mjs.map +1 -1
  76. package/build/i18n/zh-HK.json +5 -0
  77. package/build/i18n/zh-HK.json.js +5 -0
  78. package/build/i18n/zh-HK.json.js.map +1 -1
  79. package/build/i18n/zh-HK.json.mjs +5 -0
  80. package/build/i18n/zh-HK.json.mjs.map +1 -1
  81. package/build/main.css +4 -4104
  82. package/build/styles/ListItem/ListItem.css +1 -0
  83. package/build/styles/PocketSurface/PocketSurface.css +2 -11
  84. package/build/styles/SentimentSurface/SentimentSurface.css +0 -23
  85. package/build/styles/css/neptune-addons.css +1841 -0
  86. package/build/styles/css/neptune-core.css +2092 -0
  87. package/build/styles/css/neptune.css +0 -2821
  88. package/build/styles/main.css +4 -4104
  89. package/build/styles/styles/less/neptune-addons.css +1841 -0
  90. package/build/styles/styles/less/neptune-core.css +2092 -0
  91. package/build/styles/styles/less/neptune.css +0 -2821
  92. package/build/types/ListItem/_stories/variants/helpers.d.ts.map +1 -1
  93. package/package.json +10 -10
  94. package/src/Accordion/_stories/Accordion.test.story.tsx +71 -0
  95. package/src/AvatarLayout/_stories/AvatarLayout.test.story.tsx +64 -0
  96. package/src/AvatarView/_stories/AvatarView.test.story.tsx +151 -0
  97. package/src/Button/LegacyButton/_stories/LegacyButton.test.story.tsx +22 -0
  98. package/src/Button/_stories/Button.test.story.tsx +65 -0
  99. package/src/Calendar/_stories/Calendar.test.story.tsx +73 -24
  100. package/src/Carousel/_stories/Carousel.test.story.tsx +59 -0
  101. package/src/Checkbox/_stories/Checkbox.test.story.tsx +20 -0
  102. package/src/CheckboxButton/_stories/CheckboxButton.test.story.tsx +17 -37
  103. package/src/Chevron/_stories/Chevron.test.story.tsx +26 -0
  104. package/src/Chips/_stories/Chips.test.story.tsx +39 -34
  105. package/src/CircularButton/_stories/CircularButton.test.story.tsx +0 -68
  106. package/src/DateInput/_stories/DateInput.test.story.tsx +13 -0
  107. package/src/DateLookup/_stories/DateLookup.rtl.test.story.tsx +88 -0
  108. package/src/Decision/_stories/Decision.test.story.tsx +79 -0
  109. package/src/DefinitionList/_stories/DefinitionList.test.story.tsx +54 -1
  110. package/src/Drawer/_stories/Drawer.rtl.test.story.tsx +58 -0
  111. package/src/ExpressiveMoneyInput/_stories/ExpressiveMoneyInput.rtl.test.story.tsx +118 -0
  112. package/src/Field/_stories/Field.test.story.tsx +46 -0
  113. package/src/FlowNavigation/AnimatedLabel/AnimatedLabel.less +0 -1
  114. package/src/FlowNavigation/_stories/FlowNavigation.test.story.tsx +44 -0
  115. package/src/Header/_stories/Header.test.story.tsx +27 -0
  116. package/src/Info/_stories/Info.rtl.test.story.tsx +64 -0
  117. package/src/Inputs/SelectInput/_stories/SelectInput.rtl.test.story.tsx +135 -0
  118. package/src/Inputs/_stories/InputGroup.test.story.tsx +69 -0
  119. package/src/Inputs/_stories/SearchInput.test.story.tsx +32 -0
  120. package/src/Inputs/_stories/TextArea.test.story.tsx +27 -0
  121. package/src/InstructionsList/_stories/InstructionsList.test.story.tsx +30 -0
  122. package/src/Label/_stories/Label.test.story.tsx +36 -0
  123. package/src/Link/_stories/Link.test.story.tsx +26 -0
  124. package/src/ListItem/ListItem.css +1 -0
  125. package/src/ListItem/_stories/{variants/ListItem.rtl.test.story.tsx → ListItem.rtl.test.story.tsx} +6 -10
  126. package/src/ListItem/_stories/variants/helpers.tsx +2 -6
  127. package/src/Logo/_stories/Logo.test.story.tsx +44 -0
  128. package/src/Modal/_stories/Modal.rtl.test.story.tsx +59 -0
  129. package/src/MoneyInput/_stories/MoneyInput.rtl.test.story.tsx +88 -0
  130. package/src/Nudge/_stories/Nudge.test.story.tsx +37 -0
  131. package/src/PhoneNumberInput/_stories/PhoneNumberInput.test.story.tsx +44 -0
  132. package/src/PocketSurface/PocketSurface.css +2 -11
  133. package/src/PocketSurface/PocketSurface.less +1 -1
  134. package/src/Popover/_stories/Popover.rtl.test.story.tsx +96 -0
  135. package/src/Progress/_stories/Progress.test.story.tsx +27 -0
  136. package/src/ProgressBar/_stories/ProgressBar.test.story.tsx +33 -0
  137. package/src/PromoCard/_stories/PromoCard.test.story.tsx +42 -0
  138. package/src/PromoCard/_stories/PromoCardGroup.test.story.tsx +51 -0
  139. package/src/Prompt/ActionPrompt/_stories/ActionPrompt.test.story.tsx +42 -1
  140. package/src/Prompt/CriticalBanner/_stories/CriticalBanner.test.story.tsx +34 -31
  141. package/src/Prompt/InfoPrompt/_stories/InfoPrompt.test.story.tsx +25 -0
  142. package/src/Prompt/InlinePrompt/_stories/InlinePrompt.test.story.tsx +27 -0
  143. package/src/Radio/_stories/Radio.test.story.tsx +61 -0
  144. package/src/RadioGroup/_stories/RadioGroup.test.story.tsx +56 -0
  145. package/src/Section/_stories/Section.test.story.tsx +29 -0
  146. package/src/SegmentedControl/_stories/SegmentedControl.test.story.tsx +45 -0
  147. package/src/SentimentSurface/SentimentSurface.css +0 -23
  148. package/src/SlidingPanel/_stories/SlidingPanel.rtl.test.story.tsx +70 -0
  149. package/src/Snackbar/_stories/Snackbar.rtl.test.story.tsx +45 -0
  150. package/src/Snackbar/_stories/Snackbar.test.story.tsx +0 -31
  151. package/src/Stepper/_stories/Stepper.test.story.tsx +17 -0
  152. package/src/Switch/_stories/Switch.test.story.tsx +20 -26
  153. package/src/Table/_stories/Table.test.story.tsx +104 -0
  154. package/src/Tabs/_stories/Tabs.test.story.tsx +72 -0
  155. package/src/TextareaWithDisplayFormat/_stories/TextareaWithDisplayFormat.test.story.tsx +48 -0
  156. package/src/Tooltip/_stories/Tooltip.rtl.test.story.tsx +79 -0
  157. package/src/Typeahead/_stories/Typeahead.rtl.test.story.tsx +90 -0
  158. package/src/Upload/_stories/Upload.rtl.test.story.tsx +53 -0
  159. package/src/UploadInput/_stories/UploadInput.test.story.tsx +47 -0
  160. package/src/_deprecated/Alert/_stories/Alert.test.story.tsx +28 -1
  161. package/src/_deprecated/Card/_stories/Card.test.story.tsx +38 -0
  162. package/src/_deprecated/CriticalBanner/_stories/CriticalCommsBanner.test.story.tsx +18 -0
  163. package/src/_deprecated/InlineAlert/_stories/InlineAlert.test.story.tsx +26 -0
  164. package/src/_deprecated/OverlayHeader/_stories/OverlayHeader.test.story.tsx +42 -0
  165. package/src/_deprecated/Select/_stories/Select.rtl.test.story.tsx +71 -0
  166. package/src/common/BottomSheet/_stories/BottomSheet.test.story.tsx +23 -0
  167. package/src/i18n/cs.json +5 -0
  168. package/src/i18n/de.json +5 -0
  169. package/src/i18n/es.json +5 -0
  170. package/src/i18n/fr.json +5 -0
  171. package/src/i18n/hu.json +5 -0
  172. package/src/i18n/id.json +5 -0
  173. package/src/i18n/it.json +5 -0
  174. package/src/i18n/ja.json +5 -0
  175. package/src/i18n/nl.json +5 -0
  176. package/src/i18n/pl.json +5 -0
  177. package/src/i18n/pt.json +5 -0
  178. package/src/i18n/ro.json +5 -0
  179. package/src/i18n/ru.json +5 -0
  180. package/src/i18n/th.json +5 -0
  181. package/src/i18n/uk.json +5 -0
  182. package/src/i18n/zh-HK.json +5 -0
  183. package/src/main.css +4 -4104
  184. package/src/styles/less/alerts.less +1 -2
  185. package/src/styles/less/neptune-addons.css +1841 -0
  186. package/src/styles/less/neptune-addons.less +4 -0
  187. package/src/styles/less/neptune-core.css +2092 -0
  188. package/src/styles/less/neptune-core.less +4 -0
  189. package/src/styles/less/neptune.bundle.less +11 -11
  190. 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
+ };