@transferwise/components 46.165.0 → 46.165.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 (99) hide show
  1. package/build/Snackbar/Snackbar.js +98 -101
  2. package/build/Snackbar/Snackbar.js.map +1 -1
  3. package/build/Snackbar/Snackbar.mjs +99 -102
  4. package/build/Snackbar/Snackbar.mjs.map +1 -1
  5. package/build/Snackbar/SnackbarProvider.js +2 -6
  6. package/build/Snackbar/SnackbarProvider.js.map +1 -1
  7. package/build/Snackbar/SnackbarProvider.mjs +2 -6
  8. package/build/Snackbar/SnackbarProvider.mjs.map +1 -1
  9. package/build/index.js +0 -2
  10. package/build/index.js.map +1 -1
  11. package/build/index.mjs +0 -1
  12. package/build/index.mjs.map +1 -1
  13. package/build/types/Body/Body.d.ts +2 -2
  14. package/build/types/Carousel/_stories/constants.d.ts +25 -0
  15. package/build/types/Carousel/_stories/constants.d.ts.map +1 -1
  16. package/build/types/IconButton/IconButton.d.ts +1 -1
  17. package/build/types/ListItem/_stories/variants/helpers.d.ts +38 -1
  18. package/build/types/ListItem/_stories/variants/helpers.d.ts.map +1 -1
  19. package/build/types/MoneyInput/MoneyInput.d.ts +1 -1
  20. package/build/types/MoneyInput/MoneyInput.d.ts.map +1 -1
  21. package/build/types/Snackbar/Snackbar.d.ts +2 -16
  22. package/build/types/Snackbar/Snackbar.d.ts.map +1 -1
  23. package/build/types/Snackbar/SnackbarProvider.d.ts.map +1 -1
  24. package/build/types/Title/Title.d.ts +2 -2
  25. package/build/types/Upload/Steps/UploadImageStep/UploadImageStep.d.ts +1 -1
  26. package/build/types/UploadInput/UploadItem/UploadItemLink.d.ts +1 -1
  27. package/build/types/index.d.ts +0 -1
  28. package/build/types/index.d.ts.map +1 -1
  29. package/package.json +1 -1
  30. package/src/Accordion/_stories/Accordion.test.story.tsx +74 -48
  31. package/src/AvatarLayout/_stories/AvatarLayout.test.story.tsx +46 -30
  32. package/src/Button/LegacyButton/_stories/LegacyButton.test.story.tsx +29 -19
  33. package/src/Button/_stories/Button.test.story.tsx +96 -62
  34. package/src/Calendar/_stories/Calendar.test.story.tsx +34 -21
  35. package/src/Carousel/_stories/Carousel.test.story.tsx +18 -8
  36. package/src/Carousel/_stories/constants.tsx +29 -4
  37. package/src/Checkbox/_stories/Checkbox.test.story.tsx +22 -13
  38. package/src/CheckboxButton/_stories/CheckboxButton.test.story.tsx +23 -14
  39. package/src/Chips/_stories/Chips.test.story.tsx +51 -36
  40. package/src/DateInput/_stories/DateInput.rtl.test.story.tsx +62 -12
  41. package/src/DateLookup/_stories/DateLookup.rtl.test.story.tsx +2 -2
  42. package/src/Decision/_stories/Decision.test.story.tsx +74 -58
  43. package/src/DefinitionList/_stories/DefinitionList.test.story.tsx +58 -42
  44. package/src/Drawer/_stories/Drawer.rtl.test.story.tsx +65 -38
  45. package/src/ExpressiveMoneyInput/_stories/ExpressiveMoneyInput.rtl.test.story.tsx +107 -74
  46. package/src/Field/_stories/Field.test.story.tsx +18 -18
  47. package/src/FlowNavigation/_stories/FlowNavigation.rtl.test.story.tsx +81 -51
  48. package/src/Header/_stories/Header.test.story.tsx +30 -18
  49. package/src/Info/_stories/Info.rtl.test.story.tsx +124 -50
  50. package/src/InputWithDisplayFormat/_stories/InputWithDisplayFormat.test.story.tsx +4 -4
  51. package/src/Inputs/InputGroup/_stories/InputGroup.test.story.tsx +9 -8
  52. package/src/Inputs/SearchInput/_stories/SearchInput.test.story.tsx +5 -3
  53. package/src/Inputs/SelectInput/_stories/SelectInput.rtl.test.story.tsx +108 -79
  54. package/src/Inputs/TextArea/_stories/TextArea.test.story.tsx +10 -10
  55. package/src/InstructionsList/_stories/InstructionsList.test.story.tsx +43 -16
  56. package/src/Label/_stories/Label.test.story.tsx +7 -7
  57. package/src/Link/_stories/Link.test.story.tsx +27 -13
  58. package/src/ListItem/_stories/ListItem.rtl.test.story.tsx +126 -6
  59. package/src/ListItem/_stories/variants/helpers.tsx +174 -126
  60. package/src/Loader/_stories/Loader.test.story.tsx +17 -10
  61. package/src/Modal/_stories/Modal.rtl.test.story.tsx +58 -39
  62. package/src/MoneyInput/_stories/MoneyInput.rtl.test.story.tsx +21 -3
  63. package/src/Nudge/_stories/Nudge.test.story.tsx +70 -21
  64. package/src/PhoneNumberInput/_stories/PhoneNumberInput.rtl.test.story.tsx +1 -1
  65. package/src/Popover/_stories/Popover.rtl.test.story.tsx +92 -49
  66. package/src/ProgressBar/_stories/ProgressBar.test.story.tsx +6 -6
  67. package/src/PromoCard/_stories/PromoCard.test.story.tsx +53 -29
  68. package/src/PromoCard/_stories/PromoCardGroup.test.story.tsx +60 -36
  69. package/src/Prompt/ActionPrompt/_stories/ActionPrompt.test.story.tsx +74 -38
  70. package/src/Prompt/CriticalBanner/_stories/CriticalBanner.test.story.tsx +68 -31
  71. package/src/Prompt/InfoPrompt/_stories/InfoPrompt.test.story.tsx +52 -22
  72. package/src/Prompt/InlinePrompt/_stories/InlinePrompt.test.story.tsx +36 -21
  73. package/src/Radio/_stories/Radio.test.story.tsx +60 -46
  74. package/src/RadioGroup/_stories/RadioGroup.test.story.tsx +70 -51
  75. package/src/Section/_stories/Section.test.story.tsx +30 -14
  76. package/src/SegmentedControl/_stories/SegmentedControl.test.story.tsx +38 -15
  77. package/src/SlidingPanel/_stories/SlidingPanel.rtl.test.story.tsx +58 -34
  78. package/src/Snackbar/Snackbar.test.tsx +16 -0
  79. package/src/Snackbar/Snackbar.tsx +93 -90
  80. package/src/Snackbar/SnackbarProvider.tsx +4 -10
  81. package/src/Snackbar/_stories/Snackbar.rtl.test.story.tsx +24 -12
  82. package/src/Stepper/_stories/Stepper.test.story.tsx +27 -9
  83. package/src/Switch/_stories/Switch.test.story.tsx +20 -12
  84. package/src/Table/_stories/Table.test.story.tsx +107 -86
  85. package/src/Tabs/_stories/Tabs.test.story.tsx +92 -52
  86. package/src/Tag/_stories/Tag.test.story.tsx +27 -16
  87. package/src/TextareaWithDisplayFormat/_stories/TextareaWithDisplayFormat.test.story.tsx +4 -4
  88. package/src/Tooltip/_stories/Tooltip.rtl.test.story.tsx +68 -25
  89. package/src/Typeahead/_stories/Typeahead.rtl.test.story.tsx +4 -4
  90. package/src/Upload/_stories/Upload.rtl.test.story.tsx +49 -26
  91. package/src/UploadInput/_stories/UploadInput.test.story.tsx +63 -41
  92. package/src/_deprecated/Alert/_stories/Alert.test.story.tsx +45 -24
  93. package/src/_deprecated/Card/_stories/Card.test.story.tsx +47 -23
  94. package/src/_deprecated/CriticalBanner/_stories/CriticalCommsBanner.test.story.tsx +21 -15
  95. package/src/_deprecated/InlineAlert/_stories/InlineAlert.test.story.tsx +23 -12
  96. package/src/_deprecated/Select/_stories/Select.rtl.test.story.tsx +78 -42
  97. package/src/common/BottomSheet/_stories/BottomSheet.test.story.tsx +38 -20
  98. package/src/common/Panel/_stories/Panel.rtl.test.story.tsx +135 -51
  99. package/src/index.ts +0 -1
@@ -12,7 +12,7 @@ import Title from '../../../Title';
12
12
  import ListItem from '../../../ListItem';
13
13
  import BottomSheet from '../BottomSheet';
14
14
  import { withVariantConfig } from '../../../../.storybook/helpers';
15
- import { withRTLDiff } from '../../../../.storybook/decorators/RtlDiffDecorator';
15
+ import { useRtlDiffI18n, withRTLDiff } from '../../../../.storybook/decorators/RtlDiffDecorator';
16
16
 
17
17
  const wait = async (duration = 500) =>
18
18
  new Promise<void>((resolve) => {
@@ -229,23 +229,41 @@ export const WithOverflowContentZoom400: Story = {
229
229
  };
230
230
 
231
231
  export const RTLDiff: Story = {
232
- render: () => (
233
- <BottomSheet open aria-label="Manage your card">
234
- <Title type={Typography.TITLE_SECTION}>Money without borders</Title>
235
- {lorem10}
236
- <br />
237
- <br />
238
- <ListItem
239
- title="List item"
240
- subtitle="Button and icon are vertically centered."
241
- control={<ListItem.Navigation href="#" />}
242
- media={
243
- <ListItem.AvatarView>
244
- <FastFlag />
245
- </ListItem.AvatarView>
246
- }
247
- />
248
- </BottomSheet>
249
- ),
250
- ...withRTLDiff({ renderAs: 'iframe' }),
232
+ render: () => {
233
+ const i18n = useRtlDiffI18n();
234
+ return (
235
+ <BottomSheet open aria-label={i18n.sheetLabel}>
236
+ <Title type={Typography.TITLE_SECTION}>{i18n.title}</Title>
237
+ {i18n.body}
238
+ <br />
239
+ <br />
240
+ <ListItem
241
+ title={i18n.listItemTitle}
242
+ subtitle={i18n.listItemSubtitle}
243
+ control={<ListItem.Navigation href="#" />}
244
+ media={
245
+ <ListItem.AvatarView>
246
+ <FastFlag />
247
+ </ListItem.AvatarView>
248
+ }
249
+ />
250
+ </BottomSheet>
251
+ );
252
+ },
253
+ ...withRTLDiff({
254
+ renderAs: 'iframe',
255
+ i18n: {
256
+ sheetLabel: { en: 'Manage your card', ar: 'إدارة بطاقتك' },
257
+ title: { en: 'Money without borders', ar: 'أموال بلا حدود' },
258
+ body: {
259
+ en: lorem10,
260
+ ar: 'نص تجريبي يُستخدم لعرض شكل التصميم النهائي قبل إضافة المحتوى الفعلي.',
261
+ },
262
+ listItemTitle: { en: 'List item', ar: 'عنصر القائمة' },
263
+ listItemSubtitle: {
264
+ en: 'Button and icon are vertically centered.',
265
+ ar: 'الزر والأيقونة متمركزان عموديًا.',
266
+ },
267
+ },
268
+ }),
251
269
  };
@@ -1,6 +1,6 @@
1
1
  import type { Meta, StoryObj } from '@storybook/react-webpack5';
2
2
  import { useRef } from 'react';
3
- import { withRTLDiff } from '../../../../.storybook/decorators/RtlDiffDecorator';
3
+ import { useRtlDiffI18n, withRTLDiff } from '../../../../.storybook/decorators/RtlDiffDecorator';
4
4
  import Button from '../../../Button';
5
5
  import { Position } from '../../PropsValues/position';
6
6
  import Panel from '../Panel';
@@ -20,6 +20,7 @@ function PanelStory({
20
20
  position: Parameters<typeof Panel>[0]['position'];
21
21
  label: string;
22
22
  }) {
23
+ const i18n = useRtlDiffI18n();
23
24
  const anchorRef = useRef<HTMLButtonElement>(null);
24
25
  const margin =
25
26
  position?.startsWith('bottom') || position?.startsWith('top') ? '3.5rem 0' : '2.5rem 0';
@@ -34,10 +35,10 @@ function PanelStory({
34
35
  position={position}
35
36
  anchorRef={anchorRef}
36
37
  arrow
37
- aria-label={`Panel positioned ${label}`}
38
+ aria-label={`${i18n.panelAriaLabelPrefix} ${label}`}
38
39
  >
39
40
  <div style={{ padding: '16px', maxWidth: '200px' }}>
40
- Panel content positioned at <strong>{label}</strong>
41
+ {i18n.panelContentPrefix} <strong>{label}</strong>
41
42
  </div>
42
43
  </Panel>
43
44
  </>
@@ -45,66 +46,149 @@ function PanelStory({
45
46
  }
46
47
 
47
48
  export const Top: Story = {
48
- render: () => (
49
- <>
50
- <PanelStory position={Position.TOP_LEFT} label="top-left" />
51
- <PanelStory position={Position.TOP} label="top" />
52
- <PanelStory position={Position.TOP_RIGHT} label="top-right" />
53
- </>
54
- ),
55
- ...withRTLDiff({ renderAs: 'iframe', hAlign: 'center', vAlign: 'bottom' }),
49
+ render: () => {
50
+ const i18n = useRtlDiffI18n();
51
+ return (
52
+ <>
53
+ <PanelStory position={Position.TOP_LEFT} label={i18n.topLeft} />
54
+ <PanelStory position={Position.TOP} label={i18n.top} />
55
+ <PanelStory position={Position.TOP_RIGHT} label={i18n.topRight} />
56
+ </>
57
+ );
58
+ },
59
+ ...withRTLDiff({
60
+ renderAs: 'iframe',
61
+ hAlign: 'center',
62
+ vAlign: 'bottom',
63
+ i18n: {
64
+ panelAriaLabelPrefix: { en: 'Panel positioned', ar: 'لوحة موضوعة عند' },
65
+ panelContentPrefix: { en: 'Panel content positioned at', ar: 'محتوى اللوحة موضوع عند' },
66
+ topLeft: { en: 'top-left', ar: 'أعلى اليسار' },
67
+ top: { en: 'top', ar: 'أعلى' },
68
+ topRight: { en: 'top-right', ar: 'أعلى اليمين' },
69
+ },
70
+ }),
56
71
  };
57
72
 
58
73
  export const Right: Story = {
59
- render: () => (
60
- <>
61
- <PanelStory position={Position.RIGHT_TOP} label="right-top" />
62
- <PanelStory position={Position.RIGHT} label="right" />
63
- <PanelStory position={Position.RIGHT_BOTTOM} label="right-bottom" />
64
- </>
65
- ),
66
- ...withRTLDiff({ renderAs: 'iframe', hAlign: 'left', vAlign: 'center' }),
74
+ render: () => {
75
+ const i18n = useRtlDiffI18n();
76
+ return (
77
+ <>
78
+ <PanelStory position={Position.RIGHT_TOP} label={i18n.rightTop} />
79
+ <PanelStory position={Position.RIGHT} label={i18n.right} />
80
+ <PanelStory position={Position.RIGHT_BOTTOM} label={i18n.rightBottom} />
81
+ </>
82
+ );
83
+ },
84
+ ...withRTLDiff({
85
+ renderAs: 'iframe',
86
+ hAlign: 'left',
87
+ vAlign: 'center',
88
+ i18n: {
89
+ panelAriaLabelPrefix: { en: 'Panel positioned', ar: 'لوحة موضوعة عند' },
90
+ panelContentPrefix: { en: 'Panel content positioned at', ar: 'محتوى اللوحة موضوع عند' },
91
+ rightTop: { en: 'right-top', ar: 'اليمين أعلى' },
92
+ right: { en: 'right', ar: 'اليمين' },
93
+ rightBottom: { en: 'right-bottom', ar: 'اليمين أسفل' },
94
+ },
95
+ }),
67
96
  };
68
97
  export const RightFlipped: Story = {
69
- render: () => (
70
- <>
71
- <PanelStory position={Position.RIGHT_TOP} label="right-top" />
72
- <PanelStory position={Position.RIGHT} label="right" />
73
- <PanelStory position={Position.RIGHT_BOTTOM} label="right-bottom" />
74
- </>
75
- ),
76
- ...withRTLDiff({ renderAs: 'iframe', hAlign: 'right', vAlign: 'center' }),
98
+ render: () => {
99
+ const i18n = useRtlDiffI18n();
100
+ return (
101
+ <>
102
+ <PanelStory position={Position.RIGHT_TOP} label={i18n.rightTop} />
103
+ <PanelStory position={Position.RIGHT} label={i18n.right} />
104
+ <PanelStory position={Position.RIGHT_BOTTOM} label={i18n.rightBottom} />
105
+ </>
106
+ );
107
+ },
108
+ ...withRTLDiff({
109
+ renderAs: 'iframe',
110
+ hAlign: 'right',
111
+ vAlign: 'center',
112
+ i18n: {
113
+ panelAriaLabelPrefix: { en: 'Panel positioned', ar: 'لوحة موضوعة عند' },
114
+ panelContentPrefix: { en: 'Panel content positioned at', ar: 'محتوى اللوحة موضوع عند' },
115
+ rightTop: { en: 'right-top', ar: 'اليمين أعلى' },
116
+ right: { en: 'right', ar: 'اليمين' },
117
+ rightBottom: { en: 'right-bottom', ar: 'اليمين أسفل' },
118
+ },
119
+ }),
77
120
  };
78
121
 
79
122
  export const Bottom: Story = {
80
- render: () => (
81
- <>
82
- <PanelStory position={Position.BOTTOM_LEFT} label="bottom-left" />
83
- <PanelStory position={Position.BOTTOM} label="bottom" />
84
- <PanelStory position={Position.BOTTOM_RIGHT} label="bottom-right" />
85
- </>
86
- ),
87
- ...withRTLDiff({ renderAs: 'iframe', hAlign: 'center' }),
123
+ render: () => {
124
+ const i18n = useRtlDiffI18n();
125
+ return (
126
+ <>
127
+ <PanelStory position={Position.BOTTOM_LEFT} label={i18n.bottomLeft} />
128
+ <PanelStory position={Position.BOTTOM} label={i18n.bottom} />
129
+ <PanelStory position={Position.BOTTOM_RIGHT} label={i18n.bottomRight} />
130
+ </>
131
+ );
132
+ },
133
+ ...withRTLDiff({
134
+ renderAs: 'iframe',
135
+ hAlign: 'center',
136
+ i18n: {
137
+ panelAriaLabelPrefix: { en: 'Panel positioned', ar: 'لوحة موضوعة عند' },
138
+ panelContentPrefix: { en: 'Panel content positioned at', ar: 'محتوى اللوحة موضوع عند' },
139
+ bottomLeft: { en: 'bottom-left', ar: 'أسفل اليسار' },
140
+ bottom: { en: 'bottom', ar: 'أسفل' },
141
+ bottomRight: { en: 'bottom-right', ar: 'أسفل اليمين' },
142
+ },
143
+ }),
88
144
  };
89
145
 
90
146
  export const Left: Story = {
91
- render: () => (
92
- <>
93
- <PanelStory position={Position.LEFT_TOP} label="left-top" />
94
- <PanelStory position={Position.LEFT} label="left" />
95
- <PanelStory position={Position.LEFT_BOTTOM} label="left-bottom" />
96
- </>
97
- ),
98
- ...withRTLDiff({ renderAs: 'iframe', hAlign: 'right', vAlign: 'center' }),
147
+ render: () => {
148
+ const i18n = useRtlDiffI18n();
149
+ return (
150
+ <>
151
+ <PanelStory position={Position.LEFT_TOP} label={i18n.leftTop} />
152
+ <PanelStory position={Position.LEFT} label={i18n.left} />
153
+ <PanelStory position={Position.LEFT_BOTTOM} label={i18n.leftBottom} />
154
+ </>
155
+ );
156
+ },
157
+ ...withRTLDiff({
158
+ renderAs: 'iframe',
159
+ hAlign: 'right',
160
+ vAlign: 'center',
161
+ i18n: {
162
+ panelAriaLabelPrefix: { en: 'Panel positioned', ar: 'لوحة موضوعة عند' },
163
+ panelContentPrefix: { en: 'Panel content positioned at', ar: 'محتوى اللوحة موضوع عند' },
164
+ leftTop: { en: 'left-top', ar: 'اليسار أعلى' },
165
+ left: { en: 'left', ar: 'اليسار' },
166
+ leftBottom: { en: 'left-bottom', ar: 'اليسار أسفل' },
167
+ },
168
+ }),
99
169
  };
100
170
 
101
171
  export const LeftFlipped: Story = {
102
- render: () => (
103
- <>
104
- <PanelStory position={Position.LEFT_TOP} label="left-top" />
105
- <PanelStory position={Position.LEFT} label="left" />
106
- <PanelStory position={Position.LEFT_BOTTOM} label="left-bottom" />
107
- </>
108
- ),
109
- ...withRTLDiff({ renderAs: 'iframe', hAlign: 'left', vAlign: 'center' }),
172
+ render: () => {
173
+ const i18n = useRtlDiffI18n();
174
+ return (
175
+ <>
176
+ <PanelStory position={Position.LEFT_TOP} label={i18n.leftTop} />
177
+ <PanelStory position={Position.LEFT} label={i18n.left} />
178
+ <PanelStory position={Position.LEFT_BOTTOM} label={i18n.leftBottom} />
179
+ </>
180
+ );
181
+ },
182
+ ...withRTLDiff({
183
+ renderAs: 'iframe',
184
+ hAlign: 'left',
185
+ vAlign: 'center',
186
+ i18n: {
187
+ panelAriaLabelPrefix: { en: 'Panel positioned', ar: 'لوحة موضوعة عند' },
188
+ panelContentPrefix: { en: 'Panel content positioned at', ar: 'محتوى اللوحة موضوع عند' },
189
+ leftTop: { en: 'left-top', ar: 'اليسار أعلى' },
190
+ left: { en: 'left', ar: 'اليسار' },
191
+ leftBottom: { en: 'left-bottom', ar: 'اليسار أسفل' },
192
+ },
193
+ }),
110
194
  };
package/src/index.ts CHANGED
@@ -282,7 +282,6 @@ export { default as SegmentedControl } from './SegmentedControl';
282
282
  export { default as Select } from './_deprecated/Select';
283
283
  export { default as SentimentSurface } from './SentimentSurface';
284
284
  export { default as SlidingPanel } from './SlidingPanel';
285
- export { default as SnackbarPortal } from './Snackbar/Snackbar';
286
285
  export { SnackbarConsumer, SnackbarContext } from './Snackbar/SnackbarContext';
287
286
  export { default as SnackbarProvider } from './Snackbar/SnackbarProvider';
288
287
  export { default as StatusIcon } from './StatusIcon/StatusIcon';