@transferwise/components 0.0.0-experimental-06b4575 → 0.0.0-experimental-7fec974

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 (134) hide show
  1. package/build/dateLookup/monthCalendar/table/MonthCalendarTable.js +1 -1
  2. package/build/dateLookup/monthCalendar/table/MonthCalendarTable.js.map +1 -1
  3. package/build/dateLookup/monthCalendar/table/MonthCalendarTable.mjs +1 -1
  4. package/build/dateLookup/monthCalendar/table/MonthCalendarTable.mjs.map +1 -1
  5. package/build/dateLookup/yearCalendar/table/YearCalendarTable.js +1 -1
  6. package/build/dateLookup/yearCalendar/table/YearCalendarTable.js.map +1 -1
  7. package/build/dateLookup/yearCalendar/table/YearCalendarTable.mjs +1 -1
  8. package/build/dateLookup/yearCalendar/table/YearCalendarTable.mjs.map +1 -1
  9. package/build/field/Field.js +1 -0
  10. package/build/field/Field.js.map +1 -1
  11. package/build/field/Field.mjs +1 -0
  12. package/build/field/Field.mjs.map +1 -1
  13. package/build/header/Header.js +1 -1
  14. package/build/header/Header.js.map +1 -1
  15. package/build/header/Header.mjs +1 -1
  16. package/build/header/Header.mjs.map +1 -1
  17. package/build/index.js +2 -0
  18. package/build/index.js.map +1 -1
  19. package/build/index.mjs +1 -0
  20. package/build/index.mjs.map +1 -1
  21. package/build/inputs/Input.js.map +1 -1
  22. package/build/inputs/Input.mjs.map +1 -1
  23. package/build/inputs/SearchInput.js.map +1 -1
  24. package/build/inputs/SearchInput.mjs.map +1 -1
  25. package/build/inputs/TextArea.js.map +1 -1
  26. package/build/inputs/TextArea.mjs.map +1 -1
  27. package/build/listItem/Prompt/ListItemPrompt.js +1 -0
  28. package/build/listItem/Prompt/ListItemPrompt.js.map +1 -1
  29. package/build/listItem/Prompt/ListItemPrompt.mjs +1 -0
  30. package/build/listItem/Prompt/ListItemPrompt.mjs.map +1 -1
  31. package/build/main.css +31 -0
  32. package/build/prompt/InfoPrompt/InfoPrompt.js +113 -0
  33. package/build/prompt/InfoPrompt/InfoPrompt.js.map +1 -0
  34. package/build/prompt/InfoPrompt/InfoPrompt.mjs +111 -0
  35. package/build/prompt/InfoPrompt/InfoPrompt.mjs.map +1 -0
  36. package/build/prompt/PrimitivePrompt/PrimitivePrompt.js.map +1 -1
  37. package/build/prompt/PrimitivePrompt/PrimitivePrompt.mjs.map +1 -1
  38. package/build/radioOption/RadioOption.js.map +1 -1
  39. package/build/radioOption/RadioOption.mjs.map +1 -1
  40. package/build/slidingPanel/SlidingPanel.js.map +1 -1
  41. package/build/slidingPanel/SlidingPanel.mjs.map +1 -1
  42. package/build/styles/main.css +31 -0
  43. package/build/styles/prompt/InfoPrompt/InfoPrompt.css +31 -0
  44. package/build/table/TableCell.js.map +1 -1
  45. package/build/table/TableCell.mjs.map +1 -1
  46. package/build/tabs/Tabs.js +1 -1
  47. package/build/tabs/Tabs.js.map +1 -1
  48. package/build/tabs/Tabs.mjs +1 -1
  49. package/build/tabs/Tabs.mjs.map +1 -1
  50. package/build/typeahead/Typeahead.js +1 -0
  51. package/build/typeahead/Typeahead.js.map +1 -1
  52. package/build/typeahead/Typeahead.mjs +1 -0
  53. package/build/typeahead/Typeahead.mjs.map +1 -1
  54. package/build/types/dateLookup/monthCalendar/table/MonthCalendarTable.d.ts.map +1 -1
  55. package/build/types/index.d.ts +2 -1
  56. package/build/types/index.d.ts.map +1 -1
  57. package/build/types/inputs/Input.d.ts.map +1 -1
  58. package/build/types/inputs/SearchInput.d.ts.map +1 -1
  59. package/build/types/inputs/TextArea.d.ts.map +1 -1
  60. package/build/types/primitives/PrimitiveAnchor/PrimitiveAnchor.types.d.ts.map +1 -1
  61. package/build/types/primitives/PrimitiveButton/PrimitiveButton.types.d.ts.map +1 -1
  62. package/build/types/prompt/InfoPrompt/InfoPrompt.d.ts +56 -0
  63. package/build/types/prompt/InfoPrompt/InfoPrompt.d.ts.map +1 -0
  64. package/build/types/prompt/InfoPrompt/index.d.ts +3 -0
  65. package/build/types/prompt/InfoPrompt/index.d.ts.map +1 -0
  66. package/build/types/prompt/PrimitivePrompt/PrimitivePrompt.d.ts +5 -5
  67. package/build/types/prompt/PrimitivePrompt/PrimitivePrompt.d.ts.map +1 -1
  68. package/build/types/prompt/index.d.ts +2 -0
  69. package/build/types/prompt/index.d.ts.map +1 -1
  70. package/build/types/radioOption/RadioOption.d.ts.map +1 -1
  71. package/build/types/slidingPanel/SlidingPanel.d.ts.map +1 -1
  72. package/build/types/table/TableCell.d.ts.map +1 -1
  73. package/build/types/withDisplayFormat/WithDisplayFormat.d.ts.map +1 -1
  74. package/build/uploadInput/UploadInput.js +1 -1
  75. package/build/uploadInput/UploadInput.js.map +1 -1
  76. package/build/uploadInput/UploadInput.mjs +1 -1
  77. package/build/uploadInput/UploadInput.mjs.map +1 -1
  78. package/build/withDisplayFormat/WithDisplayFormat.js.map +1 -1
  79. package/build/withDisplayFormat/WithDisplayFormat.mjs.map +1 -1
  80. package/package.json +3 -3
  81. package/src/actionButton/ActionButton.story.tsx +9 -2
  82. package/src/avatar/Avatar.story.tsx +8 -2
  83. package/src/avatarLayout/AvatarLayout.story.tsx +3 -3
  84. package/src/avatarView/AvatarView.story.tsx +29 -24
  85. package/src/button/_stories/Button.test.story.tsx +10 -5
  86. package/src/checkbox/Checkbox.story.tsx +16 -3
  87. package/src/circularButton/CircularButton.story.tsx +7 -2
  88. package/src/common/bottomSheet/BottomSheet.story.tsx +32 -6
  89. package/src/common/circle/Circle.story.tsx +14 -3
  90. package/src/criticalBanner/CriticalCommsBanner.story.tsx +16 -3
  91. package/src/dateInput/DateInput.test.story.tsx +13 -3
  92. package/src/dateLookup/DateLookup.story.tsx +7 -9
  93. package/src/dateLookup/monthCalendar/table/MonthCalendarTable.tsx +1 -5
  94. package/src/dateLookup/yearCalendar/table/YearCalendarTable.tsx +1 -1
  95. package/src/header/Header.test.story.tsx +10 -5
  96. package/src/header/Header.tsx +1 -1
  97. package/src/index.ts +2 -1
  98. package/src/info/Info.story.tsx +20 -4
  99. package/src/inputs/Input.tsx +8 -9
  100. package/src/inputs/SearchInput.tsx +8 -9
  101. package/src/inputs/TextArea.tsx +6 -7
  102. package/src/listItem/_stories/variants/ListItem.brightGreen.test.story.tsx +7 -2
  103. package/src/listItem/_stories/variants/ListItem.dark.test.story.tsx +7 -2
  104. package/src/listItem/_stories/variants/ListItem.forestGreen.test.story.tsx +7 -2
  105. package/src/listItem/_stories/variants/ListItem.rtl.test.story.tsx +7 -2
  106. package/src/main.css +31 -0
  107. package/src/main.less +2 -1
  108. package/src/modal/Modal.story.tsx +31 -6
  109. package/src/primitives/PrimitiveAnchor/PrimitiveAnchor.types.ts +1 -3
  110. package/src/primitives/PrimitiveButton/PrimitiveButton.types.ts +1 -3
  111. package/src/prompt/ActionPrompt/ActionPrompt.less +1 -1
  112. package/src/prompt/ActionPrompt/ActionPrompt.story.tsx +7 -2
  113. package/src/prompt/ActionPrompt/ActionPrompt.test.tsx +2 -7
  114. package/src/prompt/InfoPrompt/InfoPrompt.css +31 -0
  115. package/src/prompt/InfoPrompt/InfoPrompt.less +37 -0
  116. package/src/prompt/InfoPrompt/InfoPrompt.story.tsx +312 -0
  117. package/src/prompt/InfoPrompt/InfoPrompt.test.story.tsx +246 -0
  118. package/src/prompt/InfoPrompt/InfoPrompt.test.tsx +224 -0
  119. package/src/prompt/InfoPrompt/InfoPrompt.tsx +148 -0
  120. package/src/prompt/InfoPrompt/index.ts +2 -0
  121. package/src/prompt/PrimitivePrompt/PrimitivePrompt.less +1 -1
  122. package/src/prompt/PrimitivePrompt/PrimitivePrompt.tsx +5 -5
  123. package/src/prompt/index.ts +5 -0
  124. package/src/radioOption/RadioOption.tsx +2 -1
  125. package/src/select/Select.story.tsx +1 -1
  126. package/src/slidingPanel/SlidingPanel.tsx +4 -2
  127. package/src/snackbar/Snackbar.test.story.tsx +32 -6
  128. package/src/ssr.test.tsx +1 -0
  129. package/src/statusIcon/StatusIcon.story.tsx +9 -5
  130. package/src/table/TableCell.tsx +1 -3
  131. package/src/tabs/Tabs.tsx +1 -1
  132. package/src/tooltip/Tooltip.story.tsx +7 -2
  133. package/src/uploadInput/UploadInput.tsx +1 -1
  134. package/src/withDisplayFormat/WithDisplayFormat.tsx +13 -14
@@ -6,8 +6,10 @@ import { Position } from '../common';
6
6
 
7
7
  export const EXIT_ANIMATION = 350;
8
8
 
9
- export interface SlidingPanelProps
10
- extends Pick<React.ComponentPropsWithRef<'div'>, 'ref' | 'className' | 'children'> {
9
+ export interface SlidingPanelProps extends Pick<
10
+ React.ComponentPropsWithRef<'div'>,
11
+ 'ref' | 'className' | 'children'
12
+ > {
11
13
  position?: `${Position.TOP | Position.RIGHT | Position.BOTTOM | Position.LEFT}`;
12
14
  open: boolean;
13
15
  showSlidingPanelBorder?: boolean;
@@ -7,7 +7,7 @@ import SnackbarProvider from './SnackbarProvider';
7
7
  import Button from '../button';
8
8
  import CheckboxOption from '../checkboxOption';
9
9
  import { wait } from '../test-utils/wait';
10
- import { withVariantConfig } from '../../.storybook/helpers';
10
+ import { allModes } from '../../.storybook/modes';
11
11
 
12
12
  export default {
13
13
  title: 'Dialogs/Snackbar/Tests',
@@ -115,7 +115,12 @@ export const Mobile = {
115
115
  </div>
116
116
  ) as React.ReactNode,
117
117
  },
118
- ...withVariantConfig(['mobile'], Default),
118
+ parameters: {
119
+ variants: ['mobile'],
120
+ chromatic: {
121
+ mobile: allModes.largeMobile,
122
+ },
123
+ },
119
124
  };
120
125
 
121
126
  const switchToDarkMode = async (context: { canvasElement: HTMLElement }) => {
@@ -147,7 +152,12 @@ export const DarkMode = {
147
152
  ) as React.ReactNode,
148
153
  },
149
154
  play: switchToDarkMode,
150
- ...withVariantConfig(['dark'], Default),
155
+ parameters: {
156
+ variants: ['dark'],
157
+ chromatic: {
158
+ dark: allModes.dark,
159
+ },
160
+ },
151
161
  };
152
162
 
153
163
  const switchToRTL = async (context: { canvasElement: HTMLElement }) => {
@@ -199,7 +209,12 @@ export const RTL = {
199
209
  ) as React.ReactNode,
200
210
  },
201
211
  play: switchToRTL,
202
- ...withVariantConfig(['rtl'], Default),
212
+ parameters: {
213
+ variants: ['rtl'],
214
+ chromatic: {
215
+ rtl: allModes.rtl,
216
+ },
217
+ },
203
218
  };
204
219
 
205
220
  export const RTLMobile = {
@@ -208,7 +223,13 @@ export const RTLMobile = {
208
223
  ...RTL.args,
209
224
  },
210
225
  play: switchToRTL,
211
- ...withVariantConfig(['rtl', 'mobile'], Default),
226
+ parameters: {
227
+ variants: ['rtl', 'mobile'],
228
+ chromatic: {
229
+ rtl: allModes.rtl,
230
+ mobile: allModes.largeMobile,
231
+ },
232
+ },
212
233
  };
213
234
 
214
235
  export const Zoom400 = {
@@ -233,7 +254,12 @@ export const Zoom400 = {
233
254
  </div>
234
255
  ),
235
256
  },
236
- ...withVariantConfig(['400%'], Default),
257
+ parameters: {
258
+ variants: ['400%'],
259
+ chromatic: {
260
+ zoom400: allModes.zoom400,
261
+ },
262
+ },
237
263
  };
238
264
 
239
265
  export const MultipleClicks = {
package/src/ssr.test.tsx CHANGED
@@ -91,6 +91,7 @@ describe('Server side rendering', () => {
91
91
 
92
92
  // stick all possible properties we might need to render all components in here
93
93
  const allProps: Record<string, unknown> = {
94
+ actionPrimary: { label: 'Action', onClick: jest.fn(), href: '#' },
94
95
  currencies: [],
95
96
  currencySelector: { options: [] },
96
97
  steps: [],
@@ -3,7 +3,7 @@ import { Meta, StoryObj } from '@storybook/react-webpack5';
3
3
  import { Sentiment, Size, Status } from '../common';
4
4
 
5
5
  import StatusIcon, { StatusIconSentiment } from './StatusIcon';
6
- import { withVariantConfig } from '../../.storybook/helpers';
6
+ import { allModes } from '../../.storybook/modes';
7
7
 
8
8
  export default {
9
9
  component: StatusIcon,
@@ -30,11 +30,15 @@ export const Presentational: Story = {
30
30
  };
31
31
 
32
32
  export const Variants: Story = {
33
- ...withVariantConfig(['default', 'dark', 'bright-green', 'forest-green'], {
34
- parameters: {
35
- padding: '0',
33
+ parameters: {
34
+ padding: '0',
35
+ variants: ['default', 'dark', 'bright-green', 'forest-green'],
36
+ chromatic: {
37
+ dark: allModes.dark,
38
+ brightGreen: allModes.brightGreen,
39
+ forestGreen: allModes.forestGreen,
36
40
  },
37
- }),
41
+ },
38
42
  render: () => (
39
43
  <span style={{ display: 'flex', justifyContent: 'space-between', maxWidth: '400px' }}>
40
44
  {[
@@ -27,9 +27,7 @@ export interface TableCellMedia extends TableCellTypeProp, TableCellTextProps {
27
27
  }
28
28
 
29
29
  export interface TableCellLeading
30
- extends TableCellTypeProp,
31
- TableCellTextProps,
32
- TableCellStatusProp {
30
+ extends TableCellTypeProp, TableCellTextProps, TableCellStatusProp {
33
31
  avatar?: Pick<AvatarViewProps, 'badge' | 'imgSrc' | 'profileName' | 'profileType'> & {
34
32
  asset?: AvatarViewProps['children'];
35
33
  /** @deprecated Use `"imgSrc" instead. */
package/src/tabs/Tabs.tsx CHANGED
@@ -353,7 +353,7 @@ export default class Tabs extends Component<TabsProps, TabsState> {
353
353
  };
354
354
 
355
355
  onKeyDown = (index: number) => (event: React.KeyboardEvent<HTMLLIElement>) => {
356
- if (event && event.key === 'Enter') {
356
+ if (event?.key === 'Enter') {
357
357
  this.switchTab(index);
358
358
  }
359
359
  };
@@ -4,7 +4,7 @@ import { userEvent, within } from 'storybook/test';
4
4
  import Button from '../button';
5
5
 
6
6
  import Tooltip from './Tooltip';
7
- import { withVariantConfig } from '../../.storybook/helpers';
7
+ import { allModes } from '../../.storybook/modes';
8
8
 
9
9
  export default {
10
10
  component: Tooltip,
@@ -40,5 +40,10 @@ export const OpenedTooltip: Story = {
40
40
 
41
41
  export const OpenedTooltipDark: Story = {
42
42
  ...OpenedTooltip,
43
- ...withVariantConfig(['dark'], OpenedTooltip),
43
+ parameters: {
44
+ variants: ['dark'],
45
+ chromatic: {
46
+ dark: allModes.dark,
47
+ },
48
+ },
44
49
  };
@@ -435,7 +435,7 @@ const UploadInput = ({
435
435
  if (
436
436
  el &&
437
437
  el.id !== markedFileForDelete?.id &&
438
- !fileRefs.some((ref) => ref && ref.id === el.id) &&
438
+ !fileRefs.some((ref) => ref?.id === el.id) &&
439
439
  el.status !== 'processing'
440
440
  ) {
441
441
  fileRefs.push(el);
@@ -36,20 +36,19 @@ interface WithDisplayFormatState {
36
36
  selectionEnd: number;
37
37
  }
38
38
 
39
- export interface WithDisplayFormatProps<T extends TextElementProps = TextElementProps>
40
- extends Pick<
41
- TextElementProps,
42
- | 'className'
43
- | 'disabled'
44
- | 'id'
45
- | 'maxLength'
46
- | 'minLength'
47
- | 'name'
48
- | 'placeholder'
49
- | 'readOnly'
50
- | 'required'
51
- | 'inputMode'
52
- > {
39
+ export interface WithDisplayFormatProps<T extends TextElementProps = TextElementProps> extends Pick<
40
+ TextElementProps,
41
+ | 'className'
42
+ | 'disabled'
43
+ | 'id'
44
+ | 'maxLength'
45
+ | 'minLength'
46
+ | 'name'
47
+ | 'placeholder'
48
+ | 'readOnly'
49
+ | 'required'
50
+ | 'inputMode'
51
+ > {
53
52
  value?: string;
54
53
  displayPattern: string;
55
54
  /**