@transferwise/components 46.160.0 → 46.160.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 (183) hide show
  1. package/build/Calendar/Calendar.js +9 -3
  2. package/build/Calendar/Calendar.js.map +1 -1
  3. package/build/Calendar/Calendar.mjs +9 -3
  4. package/build/Calendar/Calendar.mjs.map +1 -1
  5. package/build/Carousel/Carousel.js +17 -10
  6. package/build/Carousel/Carousel.js.map +1 -1
  7. package/build/Carousel/Carousel.mjs +17 -10
  8. package/build/Carousel/Carousel.mjs.map +1 -1
  9. package/build/ExpressiveMoneyInput/Chevron/Chevron.js +10 -2
  10. package/build/ExpressiveMoneyInput/Chevron/Chevron.js.map +1 -1
  11. package/build/ExpressiveMoneyInput/Chevron/Chevron.mjs +11 -3
  12. package/build/ExpressiveMoneyInput/Chevron/Chevron.mjs.map +1 -1
  13. package/build/ProcessIndicator/ProcessIndicator.js +1 -1
  14. package/build/ProcessIndicator/ProcessIndicator.js.map +1 -1
  15. package/build/ProcessIndicator/ProcessIndicator.mjs +1 -1
  16. package/build/ProcessIndicator/ProcessIndicator.mjs.map +1 -1
  17. package/build/Prompt/CriticalBanner/CriticalBanner.js +10 -1
  18. package/build/Prompt/CriticalBanner/CriticalBanner.js.map +1 -1
  19. package/build/Prompt/CriticalBanner/CriticalBanner.mjs +10 -1
  20. package/build/Prompt/CriticalBanner/CriticalBanner.mjs.map +1 -1
  21. package/build/SegmentedControl/SegmentedControl.js +9 -2
  22. package/build/SegmentedControl/SegmentedControl.js.map +1 -1
  23. package/build/SegmentedControl/SegmentedControl.mjs +9 -2
  24. package/build/SegmentedControl/SegmentedControl.mjs.map +1 -1
  25. package/build/Tooltip/Tooltip.js +6 -1
  26. package/build/Tooltip/Tooltip.js.map +1 -1
  27. package/build/Tooltip/Tooltip.mjs +6 -1
  28. package/build/Tooltip/Tooltip.mjs.map +1 -1
  29. package/build/common/Panel/Panel.js +13 -25
  30. package/build/common/Panel/Panel.js.map +1 -1
  31. package/build/common/Panel/Panel.mjs +10 -22
  32. package/build/common/Panel/Panel.mjs.map +1 -1
  33. package/build/common/Panel/Panel.positionUtils.js +68 -0
  34. package/build/common/Panel/Panel.positionUtils.js.map +1 -0
  35. package/build/common/Panel/Panel.positionUtils.mjs +63 -0
  36. package/build/common/Panel/Panel.positionUtils.mjs.map +1 -0
  37. package/build/common/PropsValues/position.js +0 -25
  38. package/build/common/PropsValues/position.js.map +1 -1
  39. package/build/common/PropsValues/position.mjs +1 -24
  40. package/build/common/PropsValues/position.mjs.map +1 -1
  41. package/build/i18n/tr.json +5 -0
  42. package/build/i18n/tr.json.js +5 -0
  43. package/build/i18n/tr.json.js.map +1 -1
  44. package/build/i18n/tr.json.mjs +5 -0
  45. package/build/i18n/tr.json.mjs.map +1 -1
  46. package/build/i18n/zh-CN.json +5 -0
  47. package/build/i18n/zh-CN.json.js +5 -0
  48. package/build/i18n/zh-CN.json.js.map +1 -1
  49. package/build/i18n/zh-CN.json.mjs +5 -0
  50. package/build/i18n/zh-CN.json.mjs.map +1 -1
  51. package/build/main.css +134 -88
  52. package/build/styles/AvatarLayout/AvatarLayout.css +26 -9
  53. package/build/styles/AvatarView/AvatarView.css +8 -0
  54. package/build/styles/AvatarView/Dot/Dot.css +8 -0
  55. package/build/styles/CheckboxButton/CheckboxButton.css +3 -0
  56. package/build/styles/Nudge/Nudge.css +4 -38
  57. package/build/styles/Prompt/CriticalBanner/CriticalBanner.css +34 -0
  58. package/build/styles/SegmentedControl/SegmentedControl.css +2 -1
  59. package/build/styles/SlidingPanel/SlidingPanel.css +8 -0
  60. package/build/styles/Tooltip/Tooltip.css +0 -6
  61. package/build/styles/UploadInput/UploadItem/UploadItem.css +4 -5
  62. package/build/styles/_deprecated/Badge/Badge.css +4 -2
  63. package/build/styles/common/Panel/Panel.css +16 -8
  64. package/build/styles/css/accordion.css +3 -0
  65. package/build/styles/css/buttons.css +1 -7
  66. package/build/styles/css/chevron.css +3 -0
  67. package/build/styles/css/neptune.css +25 -19
  68. package/build/styles/css/process.css +15 -9
  69. package/build/styles/css/tick.css +6 -3
  70. package/build/styles/main.css +134 -88
  71. package/build/styles/styles/less/accordion.css +3 -0
  72. package/build/styles/styles/less/buttons.css +1 -7
  73. package/build/styles/styles/less/chevron.css +3 -0
  74. package/build/styles/styles/less/neptune.css +25 -19
  75. package/build/styles/styles/less/process.css +15 -9
  76. package/build/styles/styles/less/tick.css +6 -3
  77. package/build/types/Calendar/Calendar.d.ts.map +1 -1
  78. package/build/types/Carousel/Carousel.d.ts.map +1 -1
  79. package/build/types/Carousel/_stories/constants.d.ts +3 -0
  80. package/build/types/Carousel/_stories/constants.d.ts.map +1 -0
  81. package/build/types/ExpressiveMoneyInput/Chevron/Chevron.d.ts.map +1 -1
  82. package/build/types/Prompt/CriticalBanner/CriticalBanner.d.ts +6 -1
  83. package/build/types/Prompt/CriticalBanner/CriticalBanner.d.ts.map +1 -1
  84. package/build/types/SegmentedControl/SegmentedControl.d.ts.map +1 -1
  85. package/build/types/Tooltip/Tooltip.d.ts.map +1 -1
  86. package/build/types/common/Panel/Panel.d.ts +1 -1
  87. package/build/types/common/Panel/Panel.d.ts.map +1 -1
  88. package/build/types/common/Panel/Panel.positionUtils.d.ts +7 -0
  89. package/build/types/common/Panel/Panel.positionUtils.d.ts.map +1 -0
  90. package/build/types/common/PropsValues/position.d.ts +0 -13
  91. package/build/types/common/PropsValues/position.d.ts.map +1 -1
  92. package/build/types/common/ResponsivePanel/ResponsivePanel.d.ts +1 -1
  93. package/package.json +8 -8
  94. package/src/AvatarLayout/AvatarLayout.css +26 -9
  95. package/src/AvatarLayout/AvatarLayout.less +46 -22
  96. package/src/AvatarLayout/_stories/AvatarLayout.test.story.tsx +17 -42
  97. package/src/AvatarView/AvatarView.css +8 -0
  98. package/src/AvatarView/Dot/Dot.css +8 -0
  99. package/src/AvatarView/Dot/Dot.less +7 -1
  100. package/src/Button/_stories/Button.test.story.tsx +1 -1
  101. package/src/Calendar/Calendar.test.tsx +82 -0
  102. package/src/Calendar/Calendar.tsx +6 -3
  103. package/src/Carousel/Carousel.test.tsx +50 -2
  104. package/src/Carousel/Carousel.tsx +13 -10
  105. package/src/Carousel/_stories/Carousel.story.tsx +12 -52
  106. package/src/Carousel/_stories/Carousel.test.story.tsx +7 -43
  107. package/src/Carousel/_stories/constants.tsx +46 -0
  108. package/src/Checkbox/_stories/Checkbox.story.tsx +1 -1
  109. package/src/Checkbox/_stories/Checkbox.test.story.tsx +3 -2
  110. package/src/CheckboxButton/CheckboxButton.css +3 -0
  111. package/src/CheckboxButton/CheckboxButton.less +4 -0
  112. package/src/Chevron/_stories/Chevron.test.story.tsx +2 -2
  113. package/src/DateLookup/_stories/DateLookup.rtl.test.story.tsx +59 -48
  114. package/src/ExpressiveMoneyInput/Chevron/Chevron.tsx +8 -3
  115. package/src/Field/_stories/Field.test.story.tsx +48 -37
  116. package/src/FlowNavigation/_stories/FlowNavigation.rtl.test.story.tsx +78 -0
  117. package/src/FlowNavigation/_stories/FlowNavigation.test.story.tsx +0 -44
  118. package/src/Header/_stories/Header.test.story.tsx +1 -1
  119. package/src/Info/_stories/Info.rtl.test.story.tsx +35 -10
  120. package/src/Info/_stories/Info.story.tsx +1 -1
  121. package/src/Inputs/SelectInput/_stories/SelectInput.test.story.tsx +1 -1
  122. package/src/Label/_stories/Label.test.story.tsx +35 -22
  123. package/src/ListItem/_stories/subcomponents.tsx +1 -1
  124. package/src/Loader/_stories/Loader.test.story.tsx +23 -0
  125. package/src/MoneyInput/_stories/MoneyInput.rtl.test.story.tsx +1 -1
  126. package/src/Nudge/Nudge.css +4 -38
  127. package/src/Nudge/Nudge.less +4 -4
  128. package/src/Nudge/_stories/Nudge.test.story.tsx +29 -12
  129. package/src/PhoneNumberInput/_stories/{PhoneNumberInput.test.story.tsx → PhoneNumberInput.rtl.test.story.tsx} +18 -10
  130. package/src/Popover/_stories/Popover.rtl.test.story.tsx +40 -50
  131. package/src/ProcessIndicator/ProcessIndicator.tsx +1 -1
  132. package/src/ProcessIndicator/_stories/ProcessIndicator.test.story.tsx +32 -0
  133. package/src/ProgressBar/_stories/ProgressBar.test.story.tsx +33 -19
  134. package/src/Prompt/CriticalBanner/CriticalBanner.css +34 -0
  135. package/src/Prompt/CriticalBanner/CriticalBanner.less +45 -0
  136. package/src/Prompt/CriticalBanner/CriticalBanner.test.tsx +26 -3
  137. package/src/Prompt/CriticalBanner/CriticalBanner.tsx +15 -1
  138. package/src/Prompt/CriticalBanner/_stories/CriticalBanner.accessibility.docs.mdx +4 -1
  139. package/src/Prompt/CriticalBanner/_stories/CriticalBanner.story.tsx +52 -0
  140. package/src/Prompt/CriticalBanner/_stories/CriticalBanner.test.story.tsx +22 -1
  141. package/src/SegmentedControl/SegmentedControl.css +2 -1
  142. package/src/SegmentedControl/SegmentedControl.less +4 -2
  143. package/src/SegmentedControl/SegmentedControl.tsx +8 -2
  144. package/src/SegmentedControl/_stories/SegmentedControl.test.story.tsx +16 -8
  145. package/src/SlidingPanel/SlidingPanel.css +8 -0
  146. package/src/SlidingPanel/SlidingPanel.less +8 -0
  147. package/src/SlidingPanel/_stories/SlidingPanel.rtl.test.story.tsx +4 -3
  148. package/src/Snackbar/_stories/Snackbar.rtl.test.story.tsx +14 -16
  149. package/src/Snackbar/_stories/Snackbar.story.tsx +1 -1
  150. package/src/Snackbar/_stories/Snackbar.test.story.tsx +1 -1
  151. package/src/StatusIcon/_stories/StatusIcon.test.story.tsx +12 -4
  152. package/src/Tooltip/Tooltip.css +0 -6
  153. package/src/Tooltip/Tooltip.less +0 -12
  154. package/src/Tooltip/Tooltip.test.tsx +51 -0
  155. package/src/Tooltip/Tooltip.tsx +11 -1
  156. package/src/Tooltip/_stories/Tooltip.rtl.test.story.tsx +16 -34
  157. package/src/UploadInput/UploadItem/UploadItem.css +4 -5
  158. package/src/UploadInput/UploadItem/UploadItem.less +7 -6
  159. package/src/UploadInput/_stories/UploadInput.test.story.tsx +1 -1
  160. package/src/_deprecated/Badge/Badge.css +4 -2
  161. package/src/_deprecated/Badge/Badge.less +7 -14
  162. package/src/_deprecated/CriticalBanner/_stories/CriticalCommsBanner.test.story.tsx +0 -16
  163. package/src/_deprecated/OverlayHeader/_stories/OverlayHeader.test.story.tsx +15 -0
  164. package/src/common/Panel/Panel.css +16 -8
  165. package/src/common/Panel/Panel.less +31 -13
  166. package/src/common/Panel/Panel.positionUtils.ts +79 -0
  167. package/src/common/Panel/Panel.test.tsx +40 -0
  168. package/src/common/Panel/Panel.tsx +13 -24
  169. package/src/common/Panel/_stories/Panel.rtl.test.story.tsx +110 -0
  170. package/src/common/PropsValues/position.ts +0 -50
  171. package/src/i18n/tr.json +5 -0
  172. package/src/i18n/zh-CN.json +5 -0
  173. package/src/main.css +134 -88
  174. package/src/styles/less/accordion.css +3 -0
  175. package/src/styles/less/buttons.css +1 -7
  176. package/src/styles/less/buttons.less +3 -11
  177. package/src/styles/less/chevron.css +3 -0
  178. package/src/styles/less/chevron.less +4 -0
  179. package/src/styles/less/neptune.css +25 -19
  180. package/src/styles/less/process.css +15 -9
  181. package/src/styles/less/process.less +13 -6
  182. package/src/styles/less/tick.css +6 -3
  183. package/src/styles/less/tick.less +7 -3
@@ -1,7 +1,7 @@
1
1
  import type { Meta, StoryObj } from '@storybook/react-webpack5';
2
2
  import { userEvent, within } from 'storybook/test';
3
3
 
4
- import { withRTLDiff } from '../../../.storybook/decorators/RtlDiffDecorator';
4
+ import { useRtlDiffI18n, withRTLDiff } from '../../../.storybook/decorators/RtlDiffDecorator';
5
5
  import DateLookup from '..';
6
6
 
7
7
  export default {
@@ -14,39 +14,47 @@ type Story = StoryObj<typeof DateLookup>;
14
14
 
15
15
  const selectedDate = new Date(2024, 5, 14);
16
16
 
17
+ const i18nConfig = {
18
+ label: { ltr: 'Select date', rtl: 'اختر التاريخ' },
19
+ placeholder: { ltr: 'Choose a date', rtl: 'اختر تاريخًا' },
20
+ };
21
+
17
22
  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(),
23
+ render: () => {
24
+ const i18n = useRtlDiffI18n<{ label: string; placeholder: string }>();
25
+ return (
26
+ <>
27
+ <DateLookup
28
+ label={i18n.label}
29
+ placeholder={i18n.placeholder}
30
+ value={selectedDate}
31
+ onChange={() => {}}
32
+ />
33
+ <DateLookup
34
+ label={i18n.label}
35
+ placeholder={i18n.placeholder}
36
+ value={selectedDate}
37
+ clearable
38
+ onChange={() => {}}
39
+ />
40
+ <DateLookup
41
+ label={i18n.label}
42
+ placeholder={i18n.placeholder}
43
+ size="sm"
44
+ value={selectedDate}
45
+ onChange={() => {}}
46
+ />
47
+ <DateLookup
48
+ label={i18n.label}
49
+ placeholder={i18n.placeholder}
50
+ size="lg"
51
+ value={selectedDate}
52
+ onChange={() => {}}
53
+ />
54
+ </>
55
+ );
56
+ },
57
+ ...withRTLDiff({ renderAs: 'iframe', i18n: i18nConfig }),
50
58
  };
51
59
 
52
60
  const containerStyle: React.CSSProperties = {
@@ -59,16 +67,19 @@ const containerStyle: React.CSSProperties = {
59
67
  };
60
68
 
61
69
  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
- ),
70
+ render: () => {
71
+ const i18n = useRtlDiffI18n<{ label: string; placeholder: string }>();
72
+ return (
73
+ <div style={containerStyle}>
74
+ <DateLookup
75
+ label={i18n.label}
76
+ placeholder={i18n.placeholder}
77
+ value={selectedDate}
78
+ onChange={() => {}}
79
+ />
80
+ </div>
81
+ );
82
+ },
72
83
  play: async ({ canvasElement }: { canvasElement: HTMLElement }) => {
73
84
  const canvas = within(canvasElement);
74
85
  const trigger = canvas.queryByRole('button');
@@ -77,12 +88,12 @@ export const OpenCalendarPanel: Story = {
77
88
  // Suppress focus ring on calendar cells — FocusScope traps focus inside the panel
78
89
  // and the autofocus cycle causes the selected date's ring to flicker between iframes.
79
90
  const style = canvasElement.ownerDocument.createElement('style');
80
- style.textContent = `
81
- .np-panel__content *:focus {
82
- outline: none !important;
83
- box-shadow: none !important;
91
+ style.textContent = `
92
+ .np-panel__content *:focus {
93
+ outline: none !important;
94
+ box-shadow: none !important;
84
95
  }`;
85
96
  canvasElement.ownerDocument.head.appendChild(style);
86
97
  },
87
- ...withRTLDiff({ renderAs: 'iframe' }),
98
+ ...withRTLDiff({ renderAs: 'iframe', i18n: i18nConfig }),
88
99
  };
@@ -1,12 +1,17 @@
1
- import { ChevronLeft } from '@transferwise/icons';
1
+ import { ChevronLeft, ChevronRight } from '@transferwise/icons';
2
2
  import { clsx } from 'clsx';
3
3
  import { motion } from 'motion/react';
4
4
 
5
+ import { useDirection } from '../../common/hooks';
6
+
5
7
  interface Props {
6
8
  shouldShow: boolean;
7
9
  }
8
10
 
9
11
  export const Chevron = ({ shouldShow = true }: Props) => {
12
+ const { isRTL } = useDirection();
13
+ const Icon = isRTL ? ChevronRight : ChevronLeft;
14
+
10
15
  return (
11
16
  <div
12
17
  className={clsx(
@@ -17,7 +22,7 @@ export const Chevron = ({ shouldShow = true }: Props) => {
17
22
  >
18
23
  <motion.div
19
24
  animate={{
20
- x: [12, 0, 0, -12],
25
+ x: isRTL ? [-12, 0, 0, 12] : [12, 0, 0, -12],
21
26
  opacity: [0, 1, 1, 0],
22
27
  }}
23
28
  transition={{
@@ -28,7 +33,7 @@ export const Chevron = ({ shouldShow = true }: Props) => {
28
33
  repeatType: 'loop',
29
34
  }}
30
35
  >
31
- <ChevronLeft />
36
+ <Icon />
32
37
  </motion.div>
33
38
  </div>
34
39
  );
@@ -1,9 +1,8 @@
1
1
  import { useState } from 'react';
2
2
  import { Meta, StoryObj } from '@storybook/react-webpack5';
3
- import { withRTLDiff } from '../../../.storybook/decorators/RtlDiffDecorator';
3
+ import { useRtlDiffI18n, withRTLDiff } from '../../../.storybook/decorators/RtlDiffDecorator';
4
4
  import { Input } from '../../Inputs/Input/Input';
5
5
  import { TextArea } from '../../Inputs/TextArea/TextArea';
6
- import { lorem10 } from '../../test-utils';
7
6
  import Field, { FieldProps } from '..';
8
7
  import { Sentiment } from '../../common';
9
8
 
@@ -59,44 +58,56 @@ export const DeprecatedProps: Story = {
59
58
  };
60
59
 
61
60
  export const RTLDiff: Story = {
62
- render: () => (
63
- <>
64
- {/* Required label (default) — label text aligns to start */}
65
- <Field label="Required field">
66
- <Input defaultValue="Input value" />
67
- </Field>
61
+ render: () => {
62
+ const i18n = useRtlDiffI18n();
63
+ return (
64
+ <>
65
+ <Field label={i18n.requiredLabel}>
66
+ <Input defaultValue={i18n.inputValue} />
67
+ </Field>
68
68
 
69
- {/* Optional label — "(optional)" suffix uses directional margin-left */}
70
- <Field label="Optional field" required={false}>
71
- <Input defaultValue="Input value" />
72
- </Field>
69
+ <Field label={i18n.optionalLabel} required={false}>
70
+ <Input defaultValue={i18n.inputValue} />
71
+ </Field>
73
72
 
74
- {/* Label + description + message — full vertical layout with directional icon */}
75
- <Field
76
- label="Field with description and message"
77
- required={false}
78
- description={lorem10}
79
- message="This is a validation message"
80
- sentiment="negative"
81
- >
82
- <Input defaultValue="Input value" />
83
- </Field>
73
+ <Field
74
+ label={i18n.descriptionLabel}
75
+ required={false}
76
+ description={i18n.description}
77
+ message={i18n.validationMessage}
78
+ sentiment="negative"
79
+ >
80
+ <Input defaultValue={i18n.inputValue} />
81
+ </Field>
84
82
 
85
- {/* Message only (no label) — InlinePrompt icon+text layout visible */}
86
- <Field message="A helpful message" sentiment="positive">
87
- <Input defaultValue="Input value" />
88
- </Field>
83
+ <Field message={i18n.helpfulMessage} sentiment="positive">
84
+ <Input defaultValue={i18n.inputValue} />
85
+ </Field>
89
86
 
90
- {/* Loading message — spinner replaces icon but layout structure is identical */}
91
- <Field label="Field with loading message" message="Saving…" messageLoading>
92
- <Input defaultValue="Input value" />
93
- </Field>
87
+ <Field label={i18n.loadingLabel} message={i18n.savingMessage} messageLoading>
88
+ <Input defaultValue={i18n.inputValue} />
89
+ </Field>
94
90
 
95
- {/* Textarea with char counter — counter uses text-align:right + margin-left:auto */}
96
- <Field label="Textarea with char counter" required={false} description="Max 100 characters">
97
- <TextArea maxLength={100} defaultValue="Textarea value" />
98
- </Field>
99
- </>
100
- ),
101
- ...withRTLDiff(),
91
+ <Field label={i18n.textareaLabel} required={false} description={i18n.maxChars}>
92
+ <TextArea maxLength={100} defaultValue={i18n.textareaValue} />
93
+ </Field>
94
+ </>
95
+ );
96
+ },
97
+ ...withRTLDiff({
98
+ i18n: {
99
+ requiredLabel: { ltr: 'Required field', rtl: 'حقل مطلوب' },
100
+ optionalLabel: { ltr: 'Optional field', rtl: 'حقل اختياري' },
101
+ descriptionLabel: { ltr: 'Field with description and message', rtl: 'حقل مع وصف ورسالة' },
102
+ description: { ltr: 'A short description of the field', rtl: 'وصف قصير للحقل' },
103
+ validationMessage: { ltr: 'This is a validation message', rtl: 'هذه رسالة تحقق' },
104
+ helpfulMessage: { ltr: 'A helpful message', rtl: 'رسالة مفيدة' },
105
+ loadingLabel: { ltr: 'Field with loading message', rtl: 'حقل مع رسالة تحميل' },
106
+ savingMessage: { ltr: 'Saving…', rtl: 'جارٍ الحفظ…' },
107
+ textareaLabel: { ltr: 'Textarea with char counter', rtl: 'حقل نص مع عداد الأحرف' },
108
+ maxChars: { ltr: 'Max 100 characters', rtl: 'الحد الأقصى 100 حرف' },
109
+ inputValue: { ltr: 'Input value', rtl: 'قيمة الإدخال' },
110
+ textareaValue: { ltr: 'Textarea value', rtl: 'قيمة حقل النص' },
111
+ },
112
+ }),
102
113
  };
@@ -0,0 +1,78 @@
1
+ import { Meta, StoryObj } from '@storybook/react-webpack5';
2
+
3
+ import { withRTLDiff } from '../../../.storybook/decorators/RtlDiffDecorator';
4
+ import AvatarView from '../../AvatarView';
5
+ import { ProfileType } from '../../common';
6
+ import Logo from '../../Logo';
7
+
8
+ import FlowNavigation from '../FlowNavigation';
9
+
10
+ const noop = () => {};
11
+
12
+ const steps = [
13
+ { label: 'Amount', hoverLabel: '100 GBP', onClick: noop },
14
+ { label: 'You', hoverLabel: 'Elena Durante', onClick: noop },
15
+ { label: 'Review', onClick: noop },
16
+ { label: 'Pay', onClick: noop },
17
+ ];
18
+
19
+ const meta: Meta<typeof FlowNavigation> = {
20
+ component: FlowNavigation,
21
+ title: 'Navigation/FlowNavigation/Tests/RTL Diff',
22
+ tags: ['!autodocs', '!manifest'],
23
+ parameters: {
24
+ padding: '0',
25
+ },
26
+ };
27
+ export default meta;
28
+
29
+ type Story = StoryObj<typeof FlowNavigation>;
30
+
31
+ export const Desktop: Story = {
32
+ render: () => (
33
+ <>
34
+ <FlowNavigation
35
+ activeStep={2}
36
+ avatar={<AvatarView profileType={ProfileType.PERSONAL} />}
37
+ logo={<Logo />}
38
+ steps={steps}
39
+ onClose={noop}
40
+ onGoBack={noop}
41
+ />
42
+ <FlowNavigation
43
+ avatar={<AvatarView profileType={ProfileType.PERSONAL} />}
44
+ logo={<Logo />}
45
+ onClose={noop}
46
+ />
47
+ <FlowNavigation
48
+ done
49
+ avatar={<AvatarView profileType={ProfileType.PERSONAL} />}
50
+ logo={<Logo />}
51
+ steps={steps}
52
+ onClose={noop}
53
+ />
54
+ </>
55
+ ),
56
+ ...withRTLDiff(),
57
+ };
58
+
59
+ export const Mobile: Story = {
60
+ render: () => (
61
+ <>
62
+ <FlowNavigation
63
+ activeStep={2}
64
+ avatar={<AvatarView profileType={ProfileType.PERSONAL} />}
65
+ logo={<Logo />}
66
+ steps={steps}
67
+ onClose={noop}
68
+ onGoBack={noop}
69
+ />
70
+ <FlowNavigation
71
+ avatar={<AvatarView profileType={ProfileType.PERSONAL} />}
72
+ logo={<Logo />}
73
+ onClose={noop}
74
+ />
75
+ </>
76
+ ),
77
+ ...withRTLDiff({ viewport: 'largeMobile' }),
78
+ };
@@ -1,6 +1,5 @@
1
1
  import { Meta, StoryObj } from '@storybook/react-webpack5';
2
2
 
3
- import { withRTLDiff } from '../../../.storybook/decorators/RtlDiffDecorator';
4
3
  import AvatarView from '../../AvatarView';
5
4
  import { ProfileType } from '../../common';
6
5
  import Logo from '../../Logo';
@@ -77,46 +76,3 @@ export const LongLabel: Story = {
77
76
  />
78
77
  ),
79
78
  };
80
-
81
- const rtlSteps = [
82
- { label: 'Amount', hoverLabel: '100 GBP', onClick: noop },
83
- { label: 'You', hoverLabel: 'Elena Durante', onClick: noop },
84
- { label: 'Review', onClick: noop },
85
- { label: 'Pay', onClick: noop },
86
- ];
87
-
88
- /**
89
- * FlowNavigation has directional layout: back button on inline-start,
90
- * close button and avatar on inline-end, and a stepper progress bar that
91
- * flows in the reading direction. All of these flip in RTL.
92
- */
93
- export const RTLDiff: Story = {
94
- render: () => (
95
- <>
96
- {/* With stepper, back button, close button, and avatar */}
97
- <FlowNavigation
98
- activeStep={2}
99
- avatar={<AvatarView profileType={ProfileType.PERSONAL} />}
100
- logo={<Logo />}
101
- steps={rtlSteps}
102
- onClose={noop}
103
- onGoBack={noop}
104
- />
105
- {/* Without stepper — logo left, close button right */}
106
- <FlowNavigation
107
- avatar={<AvatarView profileType={ProfileType.PERSONAL} />}
108
- logo={<Logo />}
109
- onClose={noop}
110
- />
111
- {/* Done state — no stepper, logo and close button only */}
112
- <FlowNavigation
113
- done
114
- avatar={<AvatarView profileType={ProfileType.PERSONAL} />}
115
- logo={<Logo />}
116
- steps={rtlSteps}
117
- onClose={noop}
118
- />
119
- </>
120
- ),
121
- ...withRTLDiff(),
122
- };
@@ -86,7 +86,7 @@ export const SectionTrailingSpaceWithAction: Story = {
86
86
  };
87
87
 
88
88
  export const AllVariants: Story = {
89
- ...withVariantConfig(['default', 'dark', 'bright-green', 'forest-green', 'rtl'], {
89
+ ...withVariantConfig(['default', 'dark', 'bright-green', 'forest-green'], {
90
90
  parameters: {
91
91
  padding: '0',
92
92
  },
@@ -12,8 +12,6 @@ export default {
12
12
 
13
13
  type Story = StoryObj<typeof Info>;
14
14
 
15
- const iframeDiff = withRTLDiff({ renderAs: 'iframe' });
16
-
17
15
  const openInfo = async ({ canvasElement }: { canvasElement: HTMLElement }) => {
18
16
  const canvas = within(canvasElement);
19
17
  const button = canvas.queryByRole('button');
@@ -21,32 +19,60 @@ const openInfo = async ({ canvasElement }: { canvasElement: HTMLElement }) => {
21
19
  await userEvent.click(button);
22
20
  };
23
21
 
24
- export const Popover: Story = {
22
+ export const PlacementTop: Story = {
23
+ render: () => (
24
+ <Info
25
+ aria-label="Info trigger"
26
+ title="Information"
27
+ content="This is some descriptive content inside the info component."
28
+ presentation="POPOVER"
29
+ preferredPlacement="top"
30
+ />
31
+ ),
32
+ play: openInfo,
33
+ ...withRTLDiff({ renderAs: 'iframe', hAlign: 'center', vAlign: 'bottom' }),
34
+ };
35
+
36
+ export const PlacementRight: Story = {
37
+ render: () => (
38
+ <Info
39
+ aria-label="Info trigger"
40
+ title="Information"
41
+ content="This is some descriptive content inside the info component."
42
+ presentation="POPOVER"
43
+ preferredPlacement="right"
44
+ />
45
+ ),
46
+ play: openInfo,
47
+ ...withRTLDiff({ renderAs: 'iframe', hAlign: 'left', vAlign: 'center' }),
48
+ };
49
+
50
+ export const PlacementBottom: Story = {
25
51
  render: () => (
26
52
  <Info
27
53
  aria-label="Info trigger"
28
54
  title="Information"
29
55
  content="This is some descriptive content inside the info component."
30
56
  presentation="POPOVER"
31
- size="sm"
57
+ preferredPlacement="bottom"
32
58
  />
33
59
  ),
34
60
  play: openInfo,
35
- ...iframeDiff,
61
+ ...withRTLDiff({ renderAs: 'iframe', hAlign: 'center' }),
36
62
  };
37
63
 
38
- export const PopoverLarge: Story = {
64
+ export const PlacementLeft: Story = {
39
65
  render: () => (
40
66
  <Info
41
67
  aria-label="Info trigger"
42
68
  title="Information"
43
69
  content="This is some descriptive content inside the info component."
44
70
  presentation="POPOVER"
45
- size="lg"
71
+ preferredPlacement="left"
46
72
  />
47
73
  ),
48
74
  play: openInfo,
49
- ...iframeDiff,
75
+ ...withRTLDiff({ renderAs: 'iframe', hAlign: 'right', vAlign: 'center' }),
50
76
  };
51
77
 
52
78
  export const Modal: Story = {
@@ -56,9 +82,8 @@ export const Modal: Story = {
56
82
  title="Information"
57
83
  content="This is some descriptive content inside the info component."
58
84
  presentation="MODAL"
59
- size="sm"
60
85
  />
61
86
  ),
62
87
  play: openInfo,
63
- ...iframeDiff,
88
+ ...withRTLDiff({ renderAs: 'iframe', hAlign: 'center', vAlign: 'center' }),
64
89
  };
@@ -36,5 +36,5 @@ export const Sandbox = createSandboxStory({
36
36
  });
37
37
 
38
38
  export const Basic: Story = {
39
- ...withVariantConfig(['default', 'dark', 'rtl']),
39
+ ...withVariantConfig(['default', 'dark']),
40
40
  };
@@ -166,7 +166,7 @@ export const Variants: Story<TestCurrency> = {
166
166
  </div>
167
167
  );
168
168
  },
169
- ...withVariantConfig(['default', 'dark', 'bright-green', 'forest-green', 'rtl']),
169
+ ...withVariantConfig(['default', 'dark', 'bright-green', 'forest-green']),
170
170
  };
171
171
 
172
172
  /**
@@ -1,5 +1,5 @@
1
1
  import type { Meta, StoryObj } from '@storybook/react-webpack5';
2
- import { withRTLDiff } from '../../../.storybook/decorators/RtlDiffDecorator';
2
+ import { useRtlDiffI18n, withRTLDiff } from '../../../.storybook/decorators/RtlDiffDecorator';
3
3
  import Info from '../../Info';
4
4
  import Label from '..';
5
5
 
@@ -12,25 +12,38 @@ export default {
12
12
  type Story = StoryObj<typeof Label>;
13
13
 
14
14
  export const RTLDiff: Story = {
15
- render: () => (
16
- <>
17
- <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(),
15
+ render: () => {
16
+ const i18n = useRtlDiffI18n();
17
+ return (
18
+ <>
19
+ <Label>{i18n.plain}</Label>
20
+ <Label>
21
+ <Label.Optional>{i18n.optional}</Label.Optional>
22
+ </Label>
23
+ <Label>
24
+ <div>
25
+ {i18n.withInfo} <Info content={i18n.tooltip} aria-label={i18n.moreInfo} />
26
+ </div>
27
+ </Label>
28
+ <Label>
29
+ <Label.Optional>
30
+ {i18n.optionalWithInfo} <Info content={i18n.tooltip} aria-label={i18n.moreInfo} />
31
+ </Label.Optional>
32
+ </Label>
33
+ </>
34
+ );
35
+ },
36
+ ...withRTLDiff({
37
+ i18n: {
38
+ plain: { ltr: 'Plain label text', rtl: 'نص التسمية العادي' },
39
+ optional: { ltr: 'Label with optional marker', rtl: 'تسمية مع علامة اختيارية' },
40
+ withInfo: { ltr: 'Label with info icon', rtl: 'تسمية مع أيقونة معلومات' },
41
+ optionalWithInfo: {
42
+ ltr: 'Label with optional and info icon',
43
+ rtl: 'تسمية مع اختيارية وأيقونة معلومات',
44
+ },
45
+ tooltip: { ltr: 'Helpful tooltip content', rtl: 'محتوى تلميح مفيد' },
46
+ moreInfo: { ltr: 'More information', rtl: 'مزيد من المعلومات' },
47
+ },
48
+ }),
36
49
  };
@@ -60,7 +60,7 @@ export const SB_LIST_ITEM_CONTROLS: Record<SB_ListItem_ControlType, ReactNode> =
60
60
  ),
61
61
  navigation: <ListItem.Navigation href="https://wise.com" />,
62
62
  navigationAsButton: <ListItem.Navigation onClick={fn()} />,
63
- checkbox: <ListItem.Checkbox onChange={() => {}} />,
63
+ checkbox: <ListItem.Checkbox checked onChange={() => {}} />,
64
64
  radio: <ListItem.Radio name="radio" value={Math.random().toString()} onChange={() => {}} />,
65
65
  switch: <ListItem.Switch onClick={() => {}} />,
66
66
  iconButton: (
@@ -0,0 +1,23 @@
1
+ import type { Meta, StoryObj } from '@storybook/react-webpack5';
2
+ import { withRTLDiff } from '../../../.storybook/decorators/RtlDiffDecorator';
3
+ import Loader from '..';
4
+
5
+ export default {
6
+ component: Loader,
7
+ title: 'Loading/Loader/Tests',
8
+ tags: ['!autodocs', '!manifest'],
9
+ } satisfies Meta<typeof Loader>;
10
+
11
+ type Story = StoryObj<typeof Loader>;
12
+
13
+ export const RTLDiff: Story = {
14
+ render: () => (
15
+ <>
16
+ <Loader size="sm" displayInstantly />
17
+ <Loader size="md" displayInstantly />
18
+ <Loader size="sm" displayInstantly label="Sending your money" />
19
+ <Loader size="md" displayInstantly label="Sending your money" />
20
+ </>
21
+ ),
22
+ ...withRTLDiff(),
23
+ };
@@ -84,5 +84,5 @@ export const OpenDropdown: Story = {
84
84
  if (!trigger) return;
85
85
  await userEvent.click(trigger);
86
86
  },
87
- ...withRTLDiff({ renderAs: 'iframe', width: '80%' }),
87
+ ...withRTLDiff({ renderAs: 'iframe', width: '40%' }),
88
88
  };