@transferwise/components 0.0.0-experimental-8d0974a → 0.0.0-experimental-53b8447

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 (207) hide show
  1. package/build/avatar/Avatar.js +3 -0
  2. package/build/avatar/Avatar.js.map +1 -1
  3. package/build/avatar/Avatar.mjs +3 -0
  4. package/build/avatar/Avatar.mjs.map +1 -1
  5. package/build/avatarView/AvatarView.js +187 -0
  6. package/build/avatarView/AvatarView.js.map +1 -0
  7. package/build/avatarView/AvatarView.mjs +185 -0
  8. package/build/avatarView/AvatarView.mjs.map +1 -0
  9. package/build/avatarView/NotificationDot.js +56 -0
  10. package/build/avatarView/NotificationDot.js.map +1 -0
  11. package/build/avatarView/NotificationDot.mjs +54 -0
  12. package/build/avatarView/NotificationDot.mjs.map +1 -0
  13. package/build/avatarWrapper/AvatarWrapper.js +6 -1
  14. package/build/avatarWrapper/AvatarWrapper.js.map +1 -1
  15. package/build/avatarWrapper/AvatarWrapper.mjs +6 -1
  16. package/build/avatarWrapper/AvatarWrapper.mjs.map +1 -1
  17. package/build/badge/Badge.js +8 -1
  18. package/build/badge/Badge.js.map +1 -1
  19. package/build/badge/Badge.mjs +8 -1
  20. package/build/badge/Badge.mjs.map +1 -1
  21. package/build/badge/BadgeAssets.js +63 -0
  22. package/build/badge/BadgeAssets.js.map +1 -0
  23. package/build/badge/BadgeAssets.mjs +61 -0
  24. package/build/badge/BadgeAssets.mjs.map +1 -0
  25. package/build/common/circle/Circle.js +29 -3
  26. package/build/common/circle/Circle.js.map +1 -1
  27. package/build/common/circle/Circle.mjs +29 -3
  28. package/build/common/circle/Circle.mjs.map +1 -1
  29. package/build/dateLookup/DateLookup.js +6 -6
  30. package/build/dateLookup/DateLookup.js.map +1 -1
  31. package/build/dateLookup/DateLookup.mjs +6 -6
  32. package/build/dateLookup/DateLookup.mjs.map +1 -1
  33. package/build/dateLookup/dayCalendar/table/DayCalendarTable.js +1 -4
  34. package/build/dateLookup/dayCalendar/table/DayCalendarTable.js.map +1 -1
  35. package/build/dateLookup/dayCalendar/table/DayCalendarTable.mjs +1 -4
  36. package/build/dateLookup/dayCalendar/table/DayCalendarTable.mjs.map +1 -1
  37. package/build/i18n/de.json +5 -0
  38. package/build/i18n/de.json.js +5 -0
  39. package/build/i18n/de.json.js.map +1 -1
  40. package/build/i18n/de.json.mjs +5 -0
  41. package/build/i18n/de.json.mjs.map +1 -1
  42. package/build/i18n/es.json +5 -0
  43. package/build/i18n/es.json.js +5 -0
  44. package/build/i18n/es.json.js.map +1 -1
  45. package/build/i18n/es.json.mjs +5 -0
  46. package/build/i18n/es.json.mjs.map +1 -1
  47. package/build/i18n/fr.json +5 -0
  48. package/build/i18n/fr.json.js +5 -0
  49. package/build/i18n/fr.json.js.map +1 -1
  50. package/build/i18n/fr.json.mjs +5 -0
  51. package/build/i18n/fr.json.mjs.map +1 -1
  52. package/build/i18n/hu.json +5 -0
  53. package/build/i18n/hu.json.js +5 -0
  54. package/build/i18n/hu.json.js.map +1 -1
  55. package/build/i18n/hu.json.mjs +5 -0
  56. package/build/i18n/hu.json.mjs.map +1 -1
  57. package/build/i18n/id.json +5 -0
  58. package/build/i18n/id.json.js +5 -0
  59. package/build/i18n/id.json.js.map +1 -1
  60. package/build/i18n/id.json.mjs +5 -0
  61. package/build/i18n/id.json.mjs.map +1 -1
  62. package/build/i18n/it.json +5 -0
  63. package/build/i18n/it.json.js +5 -0
  64. package/build/i18n/it.json.js.map +1 -1
  65. package/build/i18n/it.json.mjs +5 -0
  66. package/build/i18n/it.json.mjs.map +1 -1
  67. package/build/i18n/ja.json +5 -0
  68. package/build/i18n/ja.json.js +5 -0
  69. package/build/i18n/ja.json.js.map +1 -1
  70. package/build/i18n/ja.json.mjs +5 -0
  71. package/build/i18n/ja.json.mjs.map +1 -1
  72. package/build/i18n/pl.json +5 -0
  73. package/build/i18n/pl.json.js +5 -0
  74. package/build/i18n/pl.json.js.map +1 -1
  75. package/build/i18n/pl.json.mjs +5 -0
  76. package/build/i18n/pl.json.mjs.map +1 -1
  77. package/build/i18n/pt.json +5 -0
  78. package/build/i18n/pt.json.js +5 -0
  79. package/build/i18n/pt.json.js.map +1 -1
  80. package/build/i18n/pt.json.mjs +5 -0
  81. package/build/i18n/pt.json.mjs.map +1 -1
  82. package/build/i18n/ro.json +5 -0
  83. package/build/i18n/ro.json.js +5 -0
  84. package/build/i18n/ro.json.js.map +1 -1
  85. package/build/i18n/ro.json.mjs +5 -0
  86. package/build/i18n/ro.json.mjs.map +1 -1
  87. package/build/i18n/ru.json +5 -0
  88. package/build/i18n/ru.json.js +5 -0
  89. package/build/i18n/ru.json.js.map +1 -1
  90. package/build/i18n/ru.json.mjs +5 -0
  91. package/build/i18n/ru.json.mjs.map +1 -1
  92. package/build/i18n/tr.json +5 -0
  93. package/build/i18n/tr.json.js +5 -0
  94. package/build/i18n/tr.json.js.map +1 -1
  95. package/build/i18n/tr.json.mjs +5 -0
  96. package/build/i18n/tr.json.mjs.map +1 -1
  97. package/build/index.js +15 -4
  98. package/build/index.js.map +1 -1
  99. package/build/index.mjs +10 -2
  100. package/build/index.mjs.map +1 -1
  101. package/build/main.css +98 -25
  102. package/build/statusIcon/StatusIcon.js +2 -2
  103. package/build/statusIcon/StatusIcon.js.map +1 -1
  104. package/build/statusIcon/StatusIcon.mjs +2 -2
  105. package/build/statusIcon/StatusIcon.mjs.map +1 -1
  106. package/build/styles/avatarGroup/AvatarGroup.css +28 -0
  107. package/build/styles/avatarView/AvatarView.css +28 -0
  108. package/build/styles/avatarView/NotificationDot.css +20 -0
  109. package/build/styles/badge/Badge.css +6 -5
  110. package/build/styles/common/circle/Circle.css +36 -0
  111. package/build/styles/main.css +98 -25
  112. package/build/styles/statusIcon/StatusIcon.css +0 -20
  113. package/build/types/avatar/Avatar.d.ts +3 -0
  114. package/build/types/avatar/Avatar.d.ts.map +1 -1
  115. package/build/types/avatarGroup/AvatarGroup.d.ts +18 -0
  116. package/build/types/avatarGroup/AvatarGroup.d.ts.map +1 -0
  117. package/build/types/avatarGroup/index.d.ts +3 -0
  118. package/build/types/avatarGroup/index.d.ts.map +1 -0
  119. package/build/types/avatarView/AvatarView.d.ts +25 -0
  120. package/build/types/avatarView/AvatarView.d.ts.map +1 -0
  121. package/build/types/avatarView/NotificationDot.d.ts +8 -0
  122. package/build/types/avatarView/NotificationDot.d.ts.map +1 -0
  123. package/build/types/avatarView/index.d.ts +3 -0
  124. package/build/types/avatarView/index.d.ts.map +1 -0
  125. package/build/types/avatarWrapper/AvatarWrapper.d.ts +3 -0
  126. package/build/types/avatarWrapper/AvatarWrapper.d.ts.map +1 -1
  127. package/build/types/badge/Badge.d.ts +5 -1
  128. package/build/types/badge/Badge.d.ts.map +1 -1
  129. package/build/types/badge/BadgeAssets.d.ts +15 -0
  130. package/build/types/badge/BadgeAssets.d.ts.map +1 -0
  131. package/build/types/badge/index.d.ts +2 -0
  132. package/build/types/badge/index.d.ts.map +1 -1
  133. package/build/types/common/circle/Circle.d.ts +3 -1
  134. package/build/types/common/circle/Circle.d.ts.map +1 -1
  135. package/build/types/common/dateUtils/index.d.ts +0 -1
  136. package/build/types/common/dateUtils/index.d.ts.map +1 -1
  137. package/build/types/dateLookup/DateLookup.d.ts +1 -1
  138. package/build/types/dateLookup/DateLookup.d.ts.map +1 -1
  139. package/build/types/dateLookup/dayCalendar/table/DayCalendarTable.d.ts +1 -1
  140. package/build/types/dateLookup/dayCalendar/table/DayCalendarTable.d.ts.map +1 -1
  141. package/build/types/index.d.ts +3 -1
  142. package/build/types/index.d.ts.map +1 -1
  143. package/build/types/statusIcon/StatusIcon.d.ts +6 -2
  144. package/build/types/statusIcon/StatusIcon.d.ts.map +1 -1
  145. package/package.json +3 -3
  146. package/src/avatar/Avatar.tsx +3 -0
  147. package/src/avatarGroup/AvatarGroup.css +28 -0
  148. package/src/avatarGroup/AvatarGroup.less +32 -0
  149. package/src/avatarGroup/AvatarGroup.story.tsx +195 -0
  150. package/src/avatarGroup/AvatarGroup.tsx +80 -0
  151. package/src/avatarGroup/index.ts +2 -0
  152. package/src/avatarView/AvatarView.css +28 -0
  153. package/src/avatarView/AvatarView.less +16 -0
  154. package/src/avatarView/AvatarView.story.tsx +573 -0
  155. package/src/avatarView/AvatarView.tsx +184 -0
  156. package/src/avatarView/NotificationDot.css +20 -0
  157. package/src/avatarView/NotificationDot.less +24 -0
  158. package/src/avatarView/NotificationDot.tsx +32 -0
  159. package/src/avatarView/index.ts +2 -0
  160. package/src/avatarWrapper/AvatarWrapper.story.tsx +6 -0
  161. package/src/avatarWrapper/AvatarWrapper.tsx +3 -0
  162. package/src/badge/Badge.css +6 -5
  163. package/src/badge/Badge.less +4 -3
  164. package/src/badge/Badge.tsx +8 -1
  165. package/src/badge/BadgeAssets.tsx +65 -0
  166. package/src/badge/index.ts +3 -0
  167. package/src/common/circle/Circle.css +36 -0
  168. package/src/common/circle/Circle.less +42 -1
  169. package/src/common/circle/Circle.tsx +41 -3
  170. package/src/common/dateUtils/index.ts +0 -1
  171. package/src/dateLookup/DateLookup.tests.story.tsx +5 -40
  172. package/src/dateLookup/DateLookup.tsx +11 -9
  173. package/src/dateLookup/dayCalendar/table/DayCalendarTable.tsx +2 -5
  174. package/src/decision/Decision.story.tsx +10 -46
  175. package/src/flowNavigation/FlowNavigation.story.js +10 -39
  176. package/src/i18n/de.json +5 -0
  177. package/src/i18n/es.json +5 -0
  178. package/src/i18n/fr.json +5 -0
  179. package/src/i18n/hu.json +5 -0
  180. package/src/i18n/id.json +5 -0
  181. package/src/i18n/it.json +5 -0
  182. package/src/i18n/ja.json +5 -0
  183. package/src/i18n/pl.json +5 -0
  184. package/src/i18n/pt.json +5 -0
  185. package/src/i18n/ro.json +5 -0
  186. package/src/i18n/ru.json +5 -0
  187. package/src/i18n/tr.json +5 -0
  188. package/src/index.ts +4 -0
  189. package/src/listItem/ListItem.story.tsx +6 -43
  190. package/src/main.css +98 -25
  191. package/src/main.less +2 -0
  192. package/src/navigationOption/NavigationOption.story.js +14 -65
  193. package/src/overlayHeader/OverlayHeader.story.tsx +5 -10
  194. package/src/radio/Radio.story.tsx +5 -5
  195. package/src/radioGroup/RadioGroup.story.tsx +3 -3
  196. package/src/selectOption/SelectOption.story.tsx +31 -30
  197. package/src/statusIcon/StatusIcon.css +0 -20
  198. package/src/statusIcon/StatusIcon.less +0 -17
  199. package/src/statusIcon/StatusIcon.tsx +14 -4
  200. package/src/tile/Tile.story.tsx +2 -6
  201. package/build/common/dateUtils/getDateView/getDateView.js +0 -10
  202. package/build/common/dateUtils/getDateView/getDateView.js.map +0 -1
  203. package/build/common/dateUtils/getDateView/getDateView.mjs +0 -8
  204. package/build/common/dateUtils/getDateView/getDateView.mjs.map +0 -1
  205. package/build/types/common/dateUtils/getDateView/getDateView.d.ts +0 -2
  206. package/build/types/common/dateUtils/getDateView/getDateView.d.ts.map +0 -1
  207. package/src/common/dateUtils/getDateView/getDateView.ts +0 -5
@@ -1,30 +1,21 @@
1
1
  import { StoryFn } from '@storybook/react';
2
2
  import { expect, userEvent, within } from '@storybook/test';
3
- import { action } from '@storybook/addon-actions';
4
3
  import { useState } from 'react';
5
4
 
6
- import DateLookup, { type DateLookupProps } from './DateLookup';
5
+ import DateLookup from './DateLookup';
7
6
 
8
7
  export default {
9
8
  component: DateLookup,
10
9
  title: 'Forms/DateLookup/Tests',
11
10
  };
12
11
 
13
- const props: DateLookupProps = {
14
- value: new Date(1987, 0, 10, 12, 0, 0),
15
- onChange: (value: Date | null) => {
16
- action(value?.toString() || 'null');
17
- },
18
- };
19
12
  type Story = StoryFn<typeof DateLookup>;
20
13
 
21
- const Template: Story = (args: DateLookupProps) => {
22
- const { value: initialValue } = args;
23
- const [value, setValue] = useState<Date | null>(initialValue);
14
+ const Template: Story = () => {
15
+ const [value, setValue] = useState<Date | null>(new Date(1987, 0, 10, 12, 0, 0));
24
16
 
25
17
  return (
26
18
  <DateLookup
27
- {...args}
28
19
  value={value}
29
20
  clearable
30
21
  placeholder="placeholder"
@@ -36,7 +27,7 @@ const Template: Story = (args: DateLookupProps) => {
36
27
  };
37
28
 
38
29
  export const ClearSpace = Template.bind({});
39
- ClearSpace.args = { ...props };
30
+
40
31
  ClearSpace.play = async ({ canvasElement, step }) => {
41
32
  const canvas = within(canvasElement);
42
33
 
@@ -55,7 +46,7 @@ ClearSpace.play = async ({ canvasElement, step }) => {
55
46
  };
56
47
 
57
48
  export const ClearEnter = Template.bind({});
58
- ClearEnter.args = { ...props };
49
+
59
50
  ClearEnter.play = async ({ canvasElement, step }) => {
60
51
  const canvas = within(canvasElement);
61
52
 
@@ -72,29 +63,3 @@ ClearEnter.play = async ({ canvasElement, step }) => {
72
63
  await expect(placeholder).toBeInTheDocument();
73
64
  });
74
65
  };
75
-
76
- export const FocusOnSelectedDay = Template.bind({});
77
- FocusOnSelectedDay.args = { ...props };
78
- FocusOnSelectedDay.play = async () => {
79
- await userEvent.tab();
80
- await userEvent.keyboard(' ');
81
- };
82
-
83
- export const FocusOnToday = Template.bind({});
84
- FocusOnToday.args = { ...props, value: null };
85
- FocusOnToday.play = async () => {
86
- await userEvent.tab();
87
- await userEvent.keyboard(' ');
88
- };
89
-
90
- export const FocusOnFirstNonDisabledDate = Template.bind({});
91
- FocusOnFirstNonDisabledDate.args = {
92
- ...props,
93
- value: null,
94
- min: new Date(1987, 0, 10, 12, 0, 0),
95
- max: new Date(1987, 0, 12, 12, 0, 0),
96
- };
97
- FocusOnFirstNonDisabledDate.play = async () => {
98
- await userEvent.tab();
99
- await userEvent.keyboard(' ');
100
- };
@@ -6,11 +6,11 @@ import {
6
6
  MonthFormat,
7
7
  Position,
8
8
  Breakpoint,
9
- type SizeSmall,
10
- type SizeMedium,
11
- type SizeLarge,
9
+ SizeSmall,
10
+ SizeMedium,
11
+ SizeLarge,
12
12
  } from '../common';
13
- import { isWithinRange, moveToWithinRange, returnDateView } from '../common/dateUtils';
13
+ import { isWithinRange, moveToWithinRange } from '../common/dateUtils';
14
14
  import ResponsivePanel from '../common/responsivePanel';
15
15
  import { WithInputAttributesProps, withInputAttributes } from '../inputs/contexts';
16
16
  import { OverlayIdContext, OverlayIdProvider } from '../provider/overlay/OverlayIdProvider';
@@ -72,14 +72,13 @@ class DateLookup extends PureComponent<DateLookupPropsWithInputAttributes, DateL
72
72
 
73
73
  constructor(props: DateLookup['props']) {
74
74
  super(props);
75
- const dateView = returnDateView(props.value, props.min, props.max);
76
75
  this.state = {
77
76
  selectedDate: getStartOfDay(props.value),
78
77
  originalDate: null,
79
78
  min: getStartOfDay(props.min),
80
79
  max: getStartOfDay(props.max),
81
- viewMonth: dateView.getMonth(),
82
- viewYear: dateView.getFullYear(),
80
+ viewMonth: (props.value || new Date()).getMonth(),
81
+ viewYear: (props.value || new Date()).getFullYear(),
83
82
  open: false,
84
83
  mode: 'day',
85
84
  isMobile: false,
@@ -101,7 +100,8 @@ class DateLookup extends PureComponent<DateLookupPropsWithInputAttributes, DateL
101
100
  props.onChange(moveToWithinRange(selectedDate, min, max));
102
101
  return null;
103
102
  }
104
- const viewDateThatIsWithinRange: Date = returnDateView(selectedDate, min, max);
103
+ const viewDateThatIsWithinRange: Date =
104
+ selectedDate || ((min || max) && moveToWithinRange(new Date(), min, max)) || new Date();
105
105
  const viewMonth = viewDateThatIsWithinRange.getMonth();
106
106
  const viewYear = viewDateThatIsWithinRange.getFullYear();
107
107
  return { selectedDate, min, max, viewMonth, viewYear };
@@ -209,7 +209,9 @@ class DateLookup extends PureComponent<DateLookupPropsWithInputAttributes, DateL
209
209
  } else {
210
210
  date = getStartOfDay(new Date());
211
211
  }
212
- date &&= moveToWithinRange(date, min, max);
212
+ if (date) {
213
+ date = moveToWithinRange(date, min, max);
214
+ }
213
215
  if (date?.getTime() !== selectedDate?.getTime()) {
214
216
  this.props.onChange(date);
215
217
  }
@@ -1,6 +1,6 @@
1
1
  import { formatDate } from '@transferwise/formatting';
2
2
  import { PureComponent } from 'react';
3
- import { injectIntl, type WrappedComponentProps } from 'react-intl';
3
+ import { injectIntl, WrappedComponentProps } from 'react-intl';
4
4
 
5
5
  import { getDayNames, isWithinRange } from '../../../common/dateUtils';
6
6
  import { getFocusableTime } from '../../getFocusableTime/getFocusableTime';
@@ -64,9 +64,6 @@ class DayCalendarTable extends PureComponent<DayCalendarTableProps> {
64
64
  };
65
65
 
66
66
  isDisabled = (day: number) => {
67
- if (day < 0) {
68
- return true;
69
- }
70
67
  const { min, max, viewMonth, viewYear } = this.props;
71
68
  const date = new Date(viewYear, viewMonth, day);
72
69
 
@@ -75,7 +72,7 @@ class DayCalendarTable extends PureComponent<DayCalendarTableProps> {
75
72
 
76
73
  isActive = (day: number) => {
77
74
  const { selectedDate, viewMonth, viewYear } = this.props;
78
- return !!(selectedDate && Number(new Date(viewYear, viewMonth, day)) === Number(selectedDate));
75
+ return !!(selectedDate && +new Date(viewYear, viewMonth, day) === +selectedDate);
79
76
  };
80
77
 
81
78
  isToday = (day: number) => {
@@ -2,7 +2,7 @@ import { action } from '@storybook/addon-actions';
2
2
  import { boolean, select } from '@storybook/addon-knobs';
3
3
  import { Illustration } from '@wise/art';
4
4
 
5
- import Avatar from '../avatar';
5
+ import AvatarView from '../avatarView';
6
6
  import { Size } from '../common';
7
7
 
8
8
  import Decision, { DecisionPresentation, DecisionType } from '.';
@@ -33,11 +33,7 @@ export const Basic = () => {
33
33
  disabled,
34
34
  media: {
35
35
  block: <Illustration name="globe" alt="" disablePadding />,
36
- list: (
37
- <Avatar size="md" type="initials">
38
- HM
39
- </Avatar>
40
- ),
36
+ list: <AvatarView>HM</AvatarView>,
41
37
  },
42
38
  'aria-label': 'Click to see something',
43
39
  title: 'Hank Miller',
@@ -50,11 +46,7 @@ export const Basic = () => {
50
46
  href: '#href2',
51
47
  media: {
52
48
  block: <Illustration name="confetti" alt="" disablePadding />,
53
- list: (
54
- <Avatar size="md" type="initials">
55
- HM
56
- </Avatar>
57
- ),
49
+ list: <AvatarView>HM</AvatarView>,
58
50
  },
59
51
  'aria-label': 'Click here to send money to Hank Miller.',
60
52
  title: 'Hank Miller',
@@ -109,11 +101,7 @@ export const grid = () => {
109
101
  alt=""
110
102
  />
111
103
  ),
112
- list: (
113
- <Avatar size="md" type="initials">
114
- HM
115
- </Avatar>
116
- ),
104
+ list: <AvatarView>HM</AvatarView>,
117
105
  },
118
106
  'aria-label': 'Click to see something',
119
107
  title: 'Hank Miller',
@@ -131,11 +119,7 @@ export const grid = () => {
131
119
  alt=""
132
120
  />
133
121
  ),
134
- list: (
135
- <Avatar size="md" type="initials">
136
- HM
137
- </Avatar>
138
- ),
122
+ list: <AvatarView>HM</AvatarView>,
139
123
  },
140
124
  'aria-label': 'Click here to send money to Hank Miller.',
141
125
  title: 'Hank Miller',
@@ -152,11 +136,7 @@ export const grid = () => {
152
136
  alt=""
153
137
  />
154
138
  ),
155
- list: (
156
- <Avatar size="md" type="initials">
157
- HM
158
- </Avatar>
159
- ),
139
+ list: <AvatarView>HM</AvatarView>,
160
140
  },
161
141
  'aria-label': 'Click here to send money to Hank Miller.',
162
142
  disabled,
@@ -175,11 +155,7 @@ export const grid = () => {
175
155
  alt=""
176
156
  />
177
157
  ),
178
- list: (
179
- <Avatar size="md" type="initials">
180
- HM
181
- </Avatar>
182
- ),
158
+ list: <AvatarView>HM</AvatarView>,
183
159
  },
184
160
  'aria-label': 'Click here to send money to Hank Miller.',
185
161
  title: 'Hank Miller',
@@ -197,11 +173,7 @@ export const grid = () => {
197
173
  alt=""
198
174
  />
199
175
  ),
200
- list: (
201
- <Avatar size="md" type="initials">
202
- HM
203
- </Avatar>
204
- ),
176
+ list: <AvatarView>HM</AvatarView>,
205
177
  },
206
178
  'aria-label': 'Click here to send money to Hank Miller.',
207
179
  title: 'Hank Miller',
@@ -219,11 +191,7 @@ export const grid = () => {
219
191
  alt=""
220
192
  />
221
193
  ),
222
- list: (
223
- <Avatar size="md" type="initials">
224
- HM
225
- </Avatar>
226
- ),
194
+ list: <AvatarView>HM</AvatarView>,
227
195
  },
228
196
  'aria-label': 'Click here to send money to Hank Miller.',
229
197
  title: 'Hank Miller',
@@ -241,11 +209,7 @@ export const grid = () => {
241
209
  alt=""
242
210
  />
243
211
  ),
244
- list: (
245
- <Avatar size="md" type="initials">
246
- HM
247
- </Avatar>
248
- ),
212
+ list: <AvatarView>HM</AvatarView>,
249
213
  },
250
214
  'aria-label': 'Click here to send money to Hank Miller.',
251
215
  title: 'Hank Miller',
@@ -1,12 +1,10 @@
1
1
  import { boolean, select, text } from '@storybook/addon-knobs';
2
- import { Person as ProfileIcon, Briefcase as BriefcaseIcon } from '@transferwise/icons';
3
2
  import { useState } from 'react';
4
3
 
5
- import Avatar, { AvatarType } from '../avatar';
6
- import AvatarWrapper from '../avatarWrapper';
4
+ import AvatarView from '../avatarView';
7
5
  import Body from '../body';
8
6
  import Button from '../button';
9
- import { ProfileType, Size, Typography } from '../common';
7
+ import { ProfileType, Typography } from '../common';
10
8
  import Logo from '../logo';
11
9
  import OverlayHeader from '../overlayHeader';
12
10
 
@@ -19,16 +17,11 @@ export default {
19
17
  component: FlowNavigation,
20
18
  title: 'Navigation/FlowNavigation',
21
19
  };
22
- const avatarProfiles = {
23
- '': null,
24
- Business: <BriefcaseIcon />,
25
- Profile: <ProfileIcon />,
26
- };
27
20
 
28
21
  export const Variants = () => {
29
22
  const [activeStep, setActiveStep] = useState(2);
30
23
  const [closed, setClosed] = useState(false);
31
- const showAvatar = select('avatar', Object.keys(avatarProfiles), 'Profile');
24
+ const showAvatar = select('avatar', ['', ProfileType.PERSONAL, ProfileType.BUSINESS], 'Profile');
32
25
  const showCloseButton = boolean('show closeButton', true);
33
26
  const showMobileBackButton = boolean('show mobile backButton', true);
34
27
  const done = boolean('done', false);
@@ -41,13 +34,7 @@ export const Variants = () => {
41
34
  return !closed ? (
42
35
  <>
43
36
  <FlowNavigation
44
- avatar={
45
- !showAvatar ? null : (
46
- <Avatar type={AvatarType.ICON} size={Size.MEDIUM}>
47
- {avatarProfiles[showAvatar]}
48
- </Avatar>
49
- )
50
- }
37
+ avatar={!showAvatar ? null : <AvatarView type={showAvatar.toLowerCase()} />}
51
38
  logo={<Logo />}
52
39
  activeStep={activeStep}
53
40
  done={done}
@@ -120,7 +107,7 @@ export const Variants = () => {
120
107
 
121
108
  <FlowNavigation
122
109
  done={done}
123
- avatar={<AvatarWrapper url={avatarURL} profileType={profileType} />}
110
+ avatar={<AvatarView imgSrc={avatarURL} type={profileType} />}
124
111
  activeStep={activeStep}
125
112
  steps={[
126
113
  {
@@ -164,7 +151,7 @@ export const Variants = () => {
164
151
  {/* Instance of always `done` FlowNav for visual testing */}
165
152
  <FlowNavigation
166
153
  done
167
- avatar={<AvatarWrapper url={avatarURL} profileType={profileType} />}
154
+ avatar={<AvatarView imgSrc={avatarURL} type={profileType} />}
168
155
  activeStep={activeStep}
169
156
  steps={[
170
157
  { label: 'Recipient', hoverLabel: 'Daniele Tomboro', onClick: () => setActiveStep(0) },
@@ -224,11 +211,7 @@ export const SendFlow = () => {
224
211
  return (
225
212
  <>
226
213
  <FlowNavigation
227
- avatar={
228
- <Avatar type={AvatarType.ICON} size={Size.MEDIUM}>
229
- <ProfileIcon />
230
- </Avatar>
231
- }
214
+ avatar={<AvatarView />}
232
215
  logo={<Logo />}
233
216
  activeStep={activeStep}
234
217
  steps={steps}
@@ -256,7 +239,7 @@ export const SendFlow = () => {
256
239
  export const WithOverlayHeaderComparison = () => {
257
240
  const [activeStep, setActiveStep] = useState(4);
258
241
  const [closed, setClosed] = useState(false);
259
- const showAvatar = select('avatar', Object.keys(avatarProfiles), 'Profile');
242
+ const showAvatar = select('avatar', ['', ProfileType.PERSONAL, ProfileType.BUSINESS], 'Profile');
260
243
  const showCloseButton = boolean('show closeButton', true);
261
244
  const showMobileBackButton = boolean('show mobile backButton', true);
262
245
  const done = boolean('done', false);
@@ -265,13 +248,7 @@ export const WithOverlayHeaderComparison = () => {
265
248
  <>
266
249
  <div style={{ border: '1px solid #e8e8e8' }}>
267
250
  <FlowNavigation
268
- avatar={
269
- showAvatar ? (
270
- <Avatar type={AvatarType.ICON} size={Size.MEDIUM}>
271
- {avatarProfiles[showAvatar]}
272
- </Avatar>
273
- ) : null
274
- }
251
+ avatar={showAvatar ? <AvatarView type={showAvatar.toLocaleLowerCase()} /> : null}
275
252
  activeStep={activeStep}
276
253
  done={done}
277
254
  steps={[]}
@@ -283,13 +260,7 @@ export const WithOverlayHeaderComparison = () => {
283
260
  </div>
284
261
  <div style={{ border: '1px solid #e8e8e8' }}>
285
262
  <OverlayHeader
286
- avatar={
287
- showAvatar ? (
288
- <Avatar type={AvatarType.ICON} size={Size.MEDIUM}>
289
- {avatarProfiles[showAvatar]}
290
- </Avatar>
291
- ) : null
292
- }
263
+ avatar={showAvatar ? <AvatarView type={showAvatar.toLowerCase()} /> : null}
293
264
  onClose={showCloseButton && (() => setClosed(true))}
294
265
  />
295
266
  </div>
package/src/i18n/de.json CHANGED
@@ -27,6 +27,11 @@
27
27
  "neptune.SelectInput.noResultsFound": "Keine Ergebnisse gefunden",
28
28
  "neptune.SelectOption.action.label": "Auswählen",
29
29
  "neptune.SelectOption.selected.action.label": "Ausgewählte Option ändern",
30
+ "neptune.StatusIcon.iconLabel.error": "Fehler:",
31
+ "neptune.StatusIcon.iconLabel.information": "Auskünfte:",
32
+ "neptune.StatusIcon.iconLabel.pending": "Ausstehend:",
33
+ "neptune.StatusIcon.iconLabel.success": "Erfolgreich:",
34
+ "neptune.StatusIcon.iconLabel.warning": "Warnung:",
30
35
  "neptune.Summary.statusDone": "Schritt erledigt",
31
36
  "neptune.Summary.statusNotDone": "Schritt noch zu erledigen",
32
37
  "neptune.Summary.statusPending": "Schritt ausstehend",
package/src/i18n/es.json CHANGED
@@ -27,6 +27,11 @@
27
27
  "neptune.SelectInput.noResultsFound": "No se han encontrado resultados",
28
28
  "neptune.SelectOption.action.label": "Elegir",
29
29
  "neptune.SelectOption.selected.action.label": "Cambiar opción elegida",
30
+ "neptune.StatusIcon.iconLabel.error": "Error:",
31
+ "neptune.StatusIcon.iconLabel.information": "Información:",
32
+ "neptune.StatusIcon.iconLabel.pending": "Pendiente:",
33
+ "neptune.StatusIcon.iconLabel.success": "Éxito:",
34
+ "neptune.StatusIcon.iconLabel.warning": "Advertencia:",
30
35
  "neptune.Summary.statusDone": "Apartado listo",
31
36
  "neptune.Summary.statusNotDone": "Apartado a completar",
32
37
  "neptune.Summary.statusPending": "Apartado pendiente",
package/src/i18n/fr.json CHANGED
@@ -27,6 +27,11 @@
27
27
  "neptune.SelectInput.noResultsFound": "Aucun résultat trouvé",
28
28
  "neptune.SelectOption.action.label": "Sélectionner",
29
29
  "neptune.SelectOption.selected.action.label": "Modifier l'option choisie",
30
+ "neptune.StatusIcon.iconLabel.error": "Erreur:",
31
+ "neptune.StatusIcon.iconLabel.information": "Informations:",
32
+ "neptune.StatusIcon.iconLabel.pending": "En attente :",
33
+ "neptune.StatusIcon.iconLabel.success": "Terminé:",
34
+ "neptune.StatusIcon.iconLabel.warning": "Attention:",
30
35
  "neptune.Summary.statusDone": "Validé",
31
36
  "neptune.Summary.statusNotDone": "À compléter",
32
37
  "neptune.Summary.statusPending": "En attente",
package/src/i18n/hu.json CHANGED
@@ -27,6 +27,11 @@
27
27
  "neptune.SelectInput.noResultsFound": "Nincs találat",
28
28
  "neptune.SelectOption.action.label": "Kiválasztás",
29
29
  "neptune.SelectOption.selected.action.label": "Kiválasztott opció módosítása",
30
+ "neptune.StatusIcon.iconLabel.error": "Hiba:",
31
+ "neptune.StatusIcon.iconLabel.information": "Információ:",
32
+ "neptune.StatusIcon.iconLabel.pending": "Függőben:",
33
+ "neptune.StatusIcon.iconLabel.success": "Siker:",
34
+ "neptune.StatusIcon.iconLabel.warning": "Figyelmeztetés:",
30
35
  "neptune.Summary.statusDone": "Kész",
31
36
  "neptune.Summary.statusNotDone": "Hátravan",
32
37
  "neptune.Summary.statusPending": "Függőben",
package/src/i18n/id.json CHANGED
@@ -27,6 +27,11 @@
27
27
  "neptune.SelectInput.noResultsFound": "Hasil tidak ditemukan",
28
28
  "neptune.SelectOption.action.label": "Pilih",
29
29
  "neptune.SelectOption.selected.action.label": "Ubah opsi yang dipilih",
30
+ "neptune.StatusIcon.iconLabel.error": "Kesalahan:",
31
+ "neptune.StatusIcon.iconLabel.information": "Informasi:",
32
+ "neptune.StatusIcon.iconLabel.pending": "Tertunda:",
33
+ "neptune.StatusIcon.iconLabel.success": "Berhasil:",
34
+ "neptune.StatusIcon.iconLabel.warning": "Peringatan:",
30
35
  "neptune.Summary.statusDone": "Item selesai",
31
36
  "neptune.Summary.statusNotDone": "Item yang harus dilakukan",
32
37
  "neptune.Summary.statusPending": "Item tertunda",
package/src/i18n/it.json CHANGED
@@ -27,6 +27,11 @@
27
27
  "neptune.SelectInput.noResultsFound": "Nessun risultato trovato",
28
28
  "neptune.SelectOption.action.label": "Scegli",
29
29
  "neptune.SelectOption.selected.action.label": "Modifica l'opzione scelta",
30
+ "neptune.StatusIcon.iconLabel.error": "Errore:",
31
+ "neptune.StatusIcon.iconLabel.information": "Informazioni:",
32
+ "neptune.StatusIcon.iconLabel.pending": "In attesa:",
33
+ "neptune.StatusIcon.iconLabel.success": "Fatto:",
34
+ "neptune.StatusIcon.iconLabel.warning": "Attenzione:",
30
35
  "neptune.Summary.statusDone": "Completato",
31
36
  "neptune.Summary.statusNotDone": "Da completare",
32
37
  "neptune.Summary.statusPending": "In corso",
package/src/i18n/ja.json CHANGED
@@ -27,6 +27,11 @@
27
27
  "neptune.SelectInput.noResultsFound": "結果が見つかりませんでした",
28
28
  "neptune.SelectOption.action.label": "選択してください",
29
29
  "neptune.SelectOption.selected.action.label": "選択したオプションを変更する",
30
+ "neptune.StatusIcon.iconLabel.error": "エラー:",
31
+ "neptune.StatusIcon.iconLabel.information": "情報:",
32
+ "neptune.StatusIcon.iconLabel.pending": "保留中:",
33
+ "neptune.StatusIcon.iconLabel.success": "完了:",
34
+ "neptune.StatusIcon.iconLabel.warning": "警告:",
30
35
  "neptune.Summary.statusDone": "完了",
31
36
  "neptune.Summary.statusNotDone": "未完了",
32
37
  "neptune.Summary.statusPending": "保留中",
package/src/i18n/pl.json CHANGED
@@ -27,6 +27,11 @@
27
27
  "neptune.SelectInput.noResultsFound": "Nie znaleziono wyników",
28
28
  "neptune.SelectOption.action.label": "Wybierz",
29
29
  "neptune.SelectOption.selected.action.label": "Zmień wybraną opcję",
30
+ "neptune.StatusIcon.iconLabel.error": "Błąd:",
31
+ "neptune.StatusIcon.iconLabel.information": "Informacje:",
32
+ "neptune.StatusIcon.iconLabel.pending": "W toku:",
33
+ "neptune.StatusIcon.iconLabel.success": "Gotowe:",
34
+ "neptune.StatusIcon.iconLabel.warning": "Ostrzeżenie:",
30
35
  "neptune.Summary.statusDone": "Czynność wykonana",
31
36
  "neptune.Summary.statusNotDone": "Czynność do wykonania",
32
37
  "neptune.Summary.statusPending": "Czynność oczekująca",
package/src/i18n/pt.json CHANGED
@@ -27,6 +27,11 @@
27
27
  "neptune.SelectInput.noResultsFound": "Nenhum resultado encontrado",
28
28
  "neptune.SelectOption.action.label": "Selecionar",
29
29
  "neptune.SelectOption.selected.action.label": "Altere a opção escolhida",
30
+ "neptune.StatusIcon.iconLabel.error": "Erro:",
31
+ "neptune.StatusIcon.iconLabel.information": "Informação:",
32
+ "neptune.StatusIcon.iconLabel.pending": "Pendente:",
33
+ "neptune.StatusIcon.iconLabel.success": "Concluído:",
34
+ "neptune.StatusIcon.iconLabel.warning": "Aviso:",
30
35
  "neptune.Summary.statusDone": "Pronto",
31
36
  "neptune.Summary.statusNotDone": "Não iniciado",
32
37
  "neptune.Summary.statusPending": "Pendente",
package/src/i18n/ro.json CHANGED
@@ -27,6 +27,11 @@
27
27
  "neptune.SelectInput.noResultsFound": "Nu s-a găsit niciun rezultat",
28
28
  "neptune.SelectOption.action.label": "Alege",
29
29
  "neptune.SelectOption.selected.action.label": "Schimbă opțiunea aleasă",
30
+ "neptune.StatusIcon.iconLabel.error": "Eroare:",
31
+ "neptune.StatusIcon.iconLabel.information": "Informații:",
32
+ "neptune.StatusIcon.iconLabel.pending": "În așteptare:",
33
+ "neptune.StatusIcon.iconLabel.success": "Gata:",
34
+ "neptune.StatusIcon.iconLabel.warning": "Avertisment:",
30
35
  "neptune.Summary.statusDone": "Finalizat",
31
36
  "neptune.Summary.statusNotDone": "De făcut",
32
37
  "neptune.Summary.statusPending": "În așteptare",
package/src/i18n/ru.json CHANGED
@@ -27,6 +27,11 @@
27
27
  "neptune.SelectInput.noResultsFound": "Ничего не найдено",
28
28
  "neptune.SelectOption.action.label": "Выбрать",
29
29
  "neptune.SelectOption.selected.action.label": "Изменить выбранный вариант",
30
+ "neptune.StatusIcon.iconLabel.error": "Ошибка:",
31
+ "neptune.StatusIcon.iconLabel.information": "Информация:",
32
+ "neptune.StatusIcon.iconLabel.pending": "В ожидании:",
33
+ "neptune.StatusIcon.iconLabel.success": "Готово:",
34
+ "neptune.StatusIcon.iconLabel.warning": "Внимание:",
30
35
  "neptune.Summary.statusDone": "Этап завершен",
31
36
  "neptune.Summary.statusNotDone": "Этап к выполнению",
32
37
  "neptune.Summary.statusPending": "Этап в процессе",
package/src/i18n/tr.json CHANGED
@@ -27,6 +27,11 @@
27
27
  "neptune.SelectInput.noResultsFound": "Sonuç bulunamadı",
28
28
  "neptune.SelectOption.action.label": "Seç",
29
29
  "neptune.SelectOption.selected.action.label": "Seçilen opsiyonu değiştir",
30
+ "neptune.StatusIcon.iconLabel.error": "Hata:",
31
+ "neptune.StatusIcon.iconLabel.information": "Bilgi:",
32
+ "neptune.StatusIcon.iconLabel.pending": "Bekliyor:",
33
+ "neptune.StatusIcon.iconLabel.success": "Başarılı:",
34
+ "neptune.StatusIcon.iconLabel.warning": "Uyarı:",
30
35
  "neptune.Summary.statusDone": "Tamamlanan aşama",
31
36
  "neptune.Summary.statusNotDone": "Yapılacak",
32
37
  "neptune.Summary.statusPending": "Bekliyor",
package/src/index.ts CHANGED
@@ -8,6 +8,7 @@ export type { ActionOptionProps } from './actionOption';
8
8
  export type { SelectOptionProps, SelectOptionValue, SelectOptiopsSection } from './selectOption';
9
9
  export type { AlertAction, AlertProps, AlertType } from './alert';
10
10
  export type { AvatarProps } from './avatar';
11
+ export type { AvatarViewProps } from './avatarView';
11
12
  export type { BadgeProps } from './badge';
12
13
  export type { CardProps } from './card';
13
14
  export type { CarouselProps } from './carousel';
@@ -102,6 +103,7 @@ export { default as ActionOption } from './actionOption';
102
103
  export { default as SelectOption } from './selectOption';
103
104
  export { default as Alert } from './alert';
104
105
  export { default as Avatar } from './avatar';
106
+ export { default as AvatarView } from './avatarView';
105
107
  export { default as AvatarWrapper } from './avatarWrapper';
106
108
  export { default as Badge } from './badge';
107
109
  export { default as Body } from './body';
@@ -243,6 +245,8 @@ export {
243
245
  getLangFromLocale,
244
246
  isBrowser,
245
247
  isServerSide,
248
+ getInitials,
249
+ getBrandColorFromSeed,
246
250
  } from './common';
247
251
 
248
252
  /**