@transferwise/components 46.165.0 → 46.165.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (86) 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/types/Body/Body.d.ts +2 -2
  6. package/build/types/Carousel/_stories/constants.d.ts +25 -0
  7. package/build/types/Carousel/_stories/constants.d.ts.map +1 -1
  8. package/build/types/IconButton/IconButton.d.ts +1 -1
  9. package/build/types/ListItem/_stories/variants/helpers.d.ts +38 -1
  10. package/build/types/ListItem/_stories/variants/helpers.d.ts.map +1 -1
  11. package/build/types/MoneyInput/MoneyInput.d.ts +1 -1
  12. package/build/types/MoneyInput/MoneyInput.d.ts.map +1 -1
  13. package/build/types/Snackbar/Snackbar.d.ts +1 -15
  14. package/build/types/Snackbar/Snackbar.d.ts.map +1 -1
  15. package/build/types/Title/Title.d.ts +2 -2
  16. package/build/types/Upload/Steps/UploadImageStep/UploadImageStep.d.ts +1 -1
  17. package/build/types/UploadInput/UploadItem/UploadItemLink.d.ts +1 -1
  18. package/package.json +1 -1
  19. package/src/Accordion/_stories/Accordion.test.story.tsx +74 -48
  20. package/src/AvatarLayout/_stories/AvatarLayout.test.story.tsx +46 -30
  21. package/src/Button/LegacyButton/_stories/LegacyButton.test.story.tsx +29 -19
  22. package/src/Button/_stories/Button.test.story.tsx +96 -62
  23. package/src/Calendar/_stories/Calendar.test.story.tsx +34 -21
  24. package/src/Carousel/_stories/Carousel.test.story.tsx +18 -8
  25. package/src/Carousel/_stories/constants.tsx +29 -4
  26. package/src/Checkbox/_stories/Checkbox.test.story.tsx +22 -13
  27. package/src/CheckboxButton/_stories/CheckboxButton.test.story.tsx +23 -14
  28. package/src/Chips/_stories/Chips.test.story.tsx +51 -36
  29. package/src/DateInput/_stories/DateInput.rtl.test.story.tsx +62 -12
  30. package/src/DateLookup/_stories/DateLookup.rtl.test.story.tsx +2 -2
  31. package/src/Decision/_stories/Decision.test.story.tsx +74 -58
  32. package/src/DefinitionList/_stories/DefinitionList.test.story.tsx +58 -42
  33. package/src/Drawer/_stories/Drawer.rtl.test.story.tsx +65 -38
  34. package/src/ExpressiveMoneyInput/_stories/ExpressiveMoneyInput.rtl.test.story.tsx +107 -74
  35. package/src/Field/_stories/Field.test.story.tsx +18 -18
  36. package/src/FlowNavigation/_stories/FlowNavigation.rtl.test.story.tsx +81 -51
  37. package/src/Header/_stories/Header.test.story.tsx +30 -18
  38. package/src/Info/_stories/Info.rtl.test.story.tsx +124 -50
  39. package/src/InputWithDisplayFormat/_stories/InputWithDisplayFormat.test.story.tsx +4 -4
  40. package/src/Inputs/InputGroup/_stories/InputGroup.test.story.tsx +9 -8
  41. package/src/Inputs/SearchInput/_stories/SearchInput.test.story.tsx +5 -3
  42. package/src/Inputs/SelectInput/_stories/SelectInput.rtl.test.story.tsx +108 -79
  43. package/src/Inputs/TextArea/_stories/TextArea.test.story.tsx +10 -10
  44. package/src/InstructionsList/_stories/InstructionsList.test.story.tsx +43 -16
  45. package/src/Label/_stories/Label.test.story.tsx +7 -7
  46. package/src/Link/_stories/Link.test.story.tsx +27 -13
  47. package/src/ListItem/_stories/ListItem.rtl.test.story.tsx +126 -6
  48. package/src/ListItem/_stories/variants/helpers.tsx +174 -126
  49. package/src/Loader/_stories/Loader.test.story.tsx +17 -10
  50. package/src/Modal/_stories/Modal.rtl.test.story.tsx +58 -39
  51. package/src/MoneyInput/_stories/MoneyInput.rtl.test.story.tsx +21 -3
  52. package/src/Nudge/_stories/Nudge.test.story.tsx +70 -21
  53. package/src/PhoneNumberInput/_stories/PhoneNumberInput.rtl.test.story.tsx +1 -1
  54. package/src/Popover/_stories/Popover.rtl.test.story.tsx +92 -49
  55. package/src/ProgressBar/_stories/ProgressBar.test.story.tsx +6 -6
  56. package/src/PromoCard/_stories/PromoCard.test.story.tsx +53 -29
  57. package/src/PromoCard/_stories/PromoCardGroup.test.story.tsx +60 -36
  58. package/src/Prompt/ActionPrompt/_stories/ActionPrompt.test.story.tsx +74 -38
  59. package/src/Prompt/CriticalBanner/_stories/CriticalBanner.test.story.tsx +68 -31
  60. package/src/Prompt/InfoPrompt/_stories/InfoPrompt.test.story.tsx +52 -22
  61. package/src/Prompt/InlinePrompt/_stories/InlinePrompt.test.story.tsx +36 -21
  62. package/src/Radio/_stories/Radio.test.story.tsx +60 -46
  63. package/src/RadioGroup/_stories/RadioGroup.test.story.tsx +70 -51
  64. package/src/Section/_stories/Section.test.story.tsx +30 -14
  65. package/src/SegmentedControl/_stories/SegmentedControl.test.story.tsx +38 -15
  66. package/src/SlidingPanel/_stories/SlidingPanel.rtl.test.story.tsx +58 -34
  67. package/src/Snackbar/Snackbar.test.tsx +16 -0
  68. package/src/Snackbar/Snackbar.tsx +91 -88
  69. package/src/Snackbar/_stories/Snackbar.rtl.test.story.tsx +24 -12
  70. package/src/Stepper/_stories/Stepper.test.story.tsx +27 -9
  71. package/src/Switch/_stories/Switch.test.story.tsx +20 -12
  72. package/src/Table/_stories/Table.test.story.tsx +107 -86
  73. package/src/Tabs/_stories/Tabs.test.story.tsx +92 -52
  74. package/src/Tag/_stories/Tag.test.story.tsx +27 -16
  75. package/src/TextareaWithDisplayFormat/_stories/TextareaWithDisplayFormat.test.story.tsx +4 -4
  76. package/src/Tooltip/_stories/Tooltip.rtl.test.story.tsx +68 -25
  77. package/src/Typeahead/_stories/Typeahead.rtl.test.story.tsx +4 -4
  78. package/src/Upload/_stories/Upload.rtl.test.story.tsx +49 -26
  79. package/src/UploadInput/_stories/UploadInput.test.story.tsx +63 -41
  80. package/src/_deprecated/Alert/_stories/Alert.test.story.tsx +45 -24
  81. package/src/_deprecated/Card/_stories/Card.test.story.tsx +47 -23
  82. package/src/_deprecated/CriticalBanner/_stories/CriticalCommsBanner.test.story.tsx +21 -15
  83. package/src/_deprecated/InlineAlert/_stories/InlineAlert.test.story.tsx +23 -12
  84. package/src/_deprecated/Select/_stories/Select.rtl.test.story.tsx +78 -42
  85. package/src/common/BottomSheet/_stories/BottomSheet.test.story.tsx +38 -20
  86. package/src/common/Panel/_stories/Panel.rtl.test.story.tsx +135 -51
@@ -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
  };