@transferwise/components 0.0.0-experimental-bb32303 → 0.0.0-experimental-d11e9c5

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 (130) 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 +163 -0
  6. package/build/avatarView/AvatarView.js.map +1 -0
  7. package/build/avatarView/AvatarView.mjs +161 -0
  8. package/build/avatarView/AvatarView.mjs.map +1 -0
  9. package/build/avatarView/NotificationDot.js +59 -0
  10. package/build/avatarView/NotificationDot.js.map +1 -0
  11. package/build/avatarView/NotificationDot.mjs +57 -0
  12. package/build/avatarView/NotificationDot.mjs.map +1 -0
  13. package/build/avatarWrapper/AvatarWrapper.js +10 -4
  14. package/build/avatarWrapper/AvatarWrapper.js.map +1 -1
  15. package/build/avatarWrapper/AvatarWrapper.mjs +10 -4
  16. package/build/avatarWrapper/AvatarWrapper.mjs.map +1 -1
  17. package/build/badge/Badge.js +3 -1
  18. package/build/badge/Badge.js.map +1 -1
  19. package/build/badge/Badge.mjs +3 -1
  20. package/build/badge/Badge.mjs.map +1 -1
  21. package/build/badge/BadgeAssets.js +85 -0
  22. package/build/badge/BadgeAssets.js.map +1 -0
  23. package/build/badge/BadgeAssets.mjs +83 -0
  24. package/build/badge/BadgeAssets.mjs.map +1 -0
  25. package/build/button/Button.js.map +1 -1
  26. package/build/button/Button.mjs.map +1 -1
  27. package/build/button/legacyUtils/legacyUtils.js.map +1 -1
  28. package/build/button/legacyUtils/legacyUtils.mjs.map +1 -1
  29. package/build/common/circle/Circle.js +17 -1
  30. package/build/common/circle/Circle.js.map +1 -1
  31. package/build/common/circle/Circle.mjs +17 -1
  32. package/build/common/circle/Circle.mjs.map +1 -1
  33. package/build/i18n/th.json +5 -0
  34. package/build/i18n/th.json.js +5 -0
  35. package/build/i18n/th.json.js.map +1 -1
  36. package/build/i18n/th.json.mjs +5 -0
  37. package/build/i18n/th.json.mjs.map +1 -1
  38. package/build/index.js +128 -121
  39. package/build/index.js.map +1 -1
  40. package/build/index.mjs +33 -29
  41. package/build/index.mjs.map +1 -1
  42. package/build/main.css +109 -5
  43. package/build/styles/avatarGroup/AvatarGroup.css +29 -0
  44. package/build/styles/avatarView/AvatarView.css +42 -0
  45. package/build/styles/avatarView/NotificationDot.css +20 -0
  46. package/build/styles/badge/Badge.css +6 -5
  47. package/build/styles/common/circle/Circle.css +32 -0
  48. package/build/styles/main.css +109 -5
  49. package/build/types/avatar/Avatar.d.ts +3 -0
  50. package/build/types/avatar/Avatar.d.ts.map +1 -1
  51. package/build/types/avatarGroup/AvatarGroup.d.ts +18 -0
  52. package/build/types/avatarGroup/AvatarGroup.d.ts.map +1 -0
  53. package/build/types/avatarGroup/index.d.ts +3 -0
  54. package/build/types/avatarGroup/index.d.ts.map +1 -0
  55. package/build/types/avatarView/AvatarView.d.ts +19 -0
  56. package/build/types/avatarView/AvatarView.d.ts.map +1 -0
  57. package/build/types/avatarView/NotificationDot.d.ts +8 -0
  58. package/build/types/avatarView/NotificationDot.d.ts.map +1 -0
  59. package/build/types/avatarView/index.d.ts +3 -0
  60. package/build/types/avatarView/index.d.ts.map +1 -0
  61. package/build/types/avatarWrapper/AvatarWrapper.d.ts +3 -0
  62. package/build/types/avatarWrapper/AvatarWrapper.d.ts.map +1 -1
  63. package/build/types/badge/Badge.d.ts +5 -1
  64. package/build/types/badge/Badge.d.ts.map +1 -1
  65. package/build/types/badge/BadgeAssets.d.ts +15 -0
  66. package/build/types/badge/BadgeAssets.d.ts.map +1 -0
  67. package/build/types/badge/index.d.ts +2 -0
  68. package/build/types/badge/index.d.ts.map +1 -1
  69. package/build/types/button/Button.d.ts +1 -1
  70. package/build/types/button/Button.d.ts.map +1 -1
  71. package/build/types/button/legacyUtils/legacyUtils.d.ts +2 -2
  72. package/build/types/button/legacyUtils/legacyUtils.d.ts.map +1 -1
  73. package/build/types/common/circle/Circle.d.ts +2 -0
  74. package/build/types/common/circle/Circle.d.ts.map +1 -1
  75. package/build/types/index.d.ts +3 -1
  76. package/build/types/index.d.ts.map +1 -1
  77. package/package.json +3 -4
  78. package/src/avatar/Avatar.tsx +3 -0
  79. package/src/avatarGroup/AvatarGroup.css +29 -0
  80. package/src/avatarGroup/AvatarGroup.less +42 -0
  81. package/src/avatarGroup/AvatarGroup.story.tsx +284 -0
  82. package/src/avatarGroup/AvatarGroup.tsx +117 -0
  83. package/src/avatarGroup/index.ts +2 -0
  84. package/src/avatarView/AvatarView.css +42 -0
  85. package/src/avatarView/AvatarView.less +33 -0
  86. package/src/avatarView/AvatarView.story.tsx +425 -0
  87. package/src/avatarView/AvatarView.tsx +141 -0
  88. package/src/avatarView/NotificationDot.css +20 -0
  89. package/src/avatarView/NotificationDot.less +24 -0
  90. package/src/avatarView/NotificationDot.tsx +35 -0
  91. package/src/avatarView/index.ts +2 -0
  92. package/src/avatarWrapper/AvatarWrapper.tsx +3 -0
  93. package/src/badge/Badge.css +6 -5
  94. package/src/badge/Badge.less +4 -3
  95. package/src/badge/Badge.tsx +8 -1
  96. package/src/badge/BadgeAssets.tsx +65 -0
  97. package/src/badge/index.ts +3 -0
  98. package/src/button/{Button.spec.tsx → Button.spec.js} +2 -3
  99. package/src/button/Button.tsx +1 -1
  100. package/src/button/legacyUtils/{legacyUtils.spec.tsx → legacyUtils.spec.js} +1 -1
  101. package/src/button/legacyUtils/legacyUtils.ts +2 -2
  102. package/src/common/circle/Circle.css +32 -0
  103. package/src/common/circle/Circle.less +35 -0
  104. package/src/common/circle/Circle.tsx +22 -1
  105. package/src/decision/Decision.story.tsx +10 -46
  106. package/src/flowNavigation/FlowNavigation.story.tsx +10 -48
  107. package/src/i18n/th.json +5 -0
  108. package/src/index.ts +4 -0
  109. package/src/listItem/ListItem.story.tsx +5 -43
  110. package/src/main.css +109 -5
  111. package/src/main.less +2 -0
  112. package/src/modal/{Modal.rtl.spec.tsx → Modal.rtl.spec.js} +7 -8
  113. package/src/navigationOption/NavigationOption.story.tsx +14 -65
  114. package/src/overlayHeader/OverlayHeader.story.tsx +5 -10
  115. package/src/radio/Radio.story.tsx +5 -5
  116. package/src/radioGroup/RadioGroup.story.tsx +3 -3
  117. package/src/selectOption/SelectOption.story.tsx +31 -30
  118. package/src/slidingPanel/SlidingPanel.spec.js +1 -1
  119. package/src/ssr.spec.js +256 -0
  120. package/src/test-utils/{index.tsx → index.js} +6 -11
  121. package/src/test-utils/{jest.setup.ts → jest.setup.js} +8 -13
  122. package/src/tile/Tile.story.tsx +2 -6
  123. package/build/types/test-utils/index.d.ts +0 -158
  124. package/build/types/test-utils/index.d.ts.map +0 -1
  125. package/build/types/test-utils/jest.setup.d.ts +0 -2
  126. package/build/types/test-utils/jest.setup.d.ts.map +0 -1
  127. package/src/ssr.spec.tsx +0 -264
  128. /package/src/button/__snapshots__/{Button.spec.tsx.snap → Button.spec.js.snap} +0 -0
  129. /package/src/dimmer/{Dimmer.rtl.spec.tsx → Dimmer.rtl.spec.js} +0 -0
  130. /package/src/info/{Info.spec.jsx → Info.spec.js} +0 -0
@@ -17,6 +17,7 @@
17
17
  --badge-mask: @badge-mask-sm;
18
18
  --badge-mask-offset: calc(var(--badge-size) / 2);
19
19
  --badge-border-color: @badge-border-light;
20
+ --badge-content-position: 0px;
20
21
 
21
22
  &.tw-badge-lg {
22
23
  --badge-size: @badge-size-lg;
@@ -33,7 +34,7 @@
33
34
 
34
35
  mask-image:
35
36
  radial-gradient(
36
- circle at top calc(100% - var(--badge-mask-offset)) left calc(100% - var(--badge-mask-offset)),
37
+ circle at top calc(100% - var(--badge-mask-offset) - var(--badge-content-position)) left calc(100% - var(--badge-mask-offset) - var(--badge-content-position)),
37
38
  transparent 0,
38
39
  transparent calc(var(--badge-size) / 2 + var(--badge-mask)),
39
40
  black calc(var(--badge-size) / 2 + var(--badge-mask) + 0.5px)
@@ -54,8 +55,8 @@
54
55
  position: absolute;
55
56
  width: var(--badge-size);
56
57
  height: var(--badge-size);
57
- bottom: 0;
58
- .right(0);
58
+ bottom: var(--badge-content-position);
59
+ .right(var(--badge-content-position));
59
60
 
60
61
  box-sizing: border-box;
61
62
  border-radius: 50%;
@@ -26,8 +26,14 @@ export type BadgeProps = {
26
26
  size?: SizeSmall | DeprecatedSizes | SizeLarge;
27
27
  border?: ThemeDark | ThemeLight;
28
28
  'aria-label'?: string;
29
+ style?: React.CSSProperties;
29
30
  } & CommonProps;
30
31
 
32
+ // Note: Badge component is not deprecated, we want stop it's direct usage on consumer side.
33
+ // Deprecation notice will hint consumers to migrate. Eventually the component will become internal.
34
+ /**
35
+ * @deprecated Use `<AvatarView badge={..} />` instead.
36
+ */
31
37
  const Badge = ({
32
38
  badge,
33
39
  className = undefined,
@@ -35,6 +41,7 @@ const Badge = ({
35
41
  border = Theme.LIGHT,
36
42
  'aria-label': ariaLabel,
37
43
  children,
44
+ style,
38
45
  }: BadgeProps) => {
39
46
  // medium is deprecated, so we map it to small
40
47
  const size = sizeProp === Size.MEDIUM ? Size.SMALL : sizeProp;
@@ -48,7 +55,7 @@ const Badge = ({
48
55
  );
49
56
 
50
57
  return (
51
- <div aria-label={ariaLabel} className={classes}>
58
+ <div aria-label={ariaLabel} className={classes} style={style}>
52
59
  <div className="tw-badge__children">{children}</div>
53
60
  <div className="tw-badge__content">{badge}</div>
54
61
  </div>
@@ -0,0 +1,65 @@
1
+ import StatusIcon, { StatusIconProps } from '../statusIcon';
2
+ import { Flag } from '@wise/art';
3
+ import Circle, { CircleProps } from '../common/circle';
4
+ import Image from '../image';
5
+ import type { BadgeProps } from './Badge';
6
+ import { Plus } from '@transferwise/icons';
7
+ import { Size } from '../common';
8
+
9
+ export type Props = {
10
+ status?: StatusIconProps['sentiment'];
11
+ flagCode?: string;
12
+ imgSrc?: string;
13
+ icon?: React.ReactNode;
14
+ type?: 'action' | 'reference';
15
+ size?: BadgeProps['size'];
16
+ };
17
+
18
+ /**
19
+ * Common pre-built badge variants.
20
+ */
21
+ export default function BadgeAssets({
22
+ status,
23
+ flagCode,
24
+ imgSrc,
25
+ icon = null,
26
+ type = 'action',
27
+ size: sizeProp,
28
+ }: Props) {
29
+ // map to old size (sm, lg) to new ones (numeric)
30
+ const size: CircleProps['size'] = sizeProp === Size.LARGE ? 24 : 16;
31
+ if (status) {
32
+ return <StatusIcon sentiment={status} size={size} />;
33
+ }
34
+ if (flagCode) {
35
+ return (
36
+ <Circle size={size} fixedSize enableBorder>
37
+ <Flag code={flagCode} intrinsicSize={size} />
38
+ </Circle>
39
+ );
40
+ }
41
+ if (imgSrc) {
42
+ return (
43
+ <Circle size={size} fixedSize enableBorder>
44
+ <Image src={imgSrc} alt="" />
45
+ </Circle>
46
+ );
47
+ }
48
+ if (['action', 'reference'].includes(type)) {
49
+ return (
50
+ <Circle
51
+ size={size}
52
+ fixedSize
53
+ style={{
54
+ backgroundColor:
55
+ type === 'action'
56
+ ? 'var(--color-interactive-accent)'
57
+ : 'var(--color-background-neutral)',
58
+ }}
59
+ >
60
+ {icon ?? <Plus />}
61
+ </Circle>
62
+ );
63
+ }
64
+ return null;
65
+ }
@@ -1,2 +1,5 @@
1
1
  export { default } from './Badge';
2
2
  export type { BadgeProps } from './Badge';
3
+
4
+ export { default as BadgeAssets } from './BadgeAssets';
5
+ export type { Props as BadgeAssetsProps } from './BadgeAssets';
@@ -5,7 +5,6 @@ import { render, screen, userEvent } from '../test-utils';
5
5
 
6
6
  import Button from '.';
7
7
  import messages from './Button.messages';
8
- import { ButtonReferenceType } from './Button';
9
8
 
10
9
  const { ACCENT, POSITIVE, NEGATIVE } = ControlType;
11
10
  const { PAY, LINK, DANGER } = Type;
@@ -15,7 +14,7 @@ const { SMALL, MEDIUM, LARGE } = Size;
15
14
  describe('Button', () => {
16
15
  // eslint-disable-next-line no-console
17
16
  const originalWarn = console.warn;
18
- let mockedWarn: typeof originalWarn;
17
+ let mockedWarn;
19
18
 
20
19
  const props = {
21
20
  onClick: jest.fn(),
@@ -48,7 +47,7 @@ describe('Button', () => {
48
47
  });
49
48
 
50
49
  it('set `ref` to be true on Button', () => {
51
- const reference = createRef<ButtonReferenceType>();
50
+ const reference = createRef();
52
51
 
53
52
  expect(reference.current).toBeFalsy();
54
53
  render(<Button ref={reference}>Click me!</Button>);
@@ -51,7 +51,7 @@ type AnchorProps = CommonProps &
51
51
 
52
52
  export type Props = ButtonProps | AnchorProps;
53
53
 
54
- export type ButtonReferenceType = HTMLButtonElement | HTMLAnchorElement;
54
+ type ButtonReferenceType = HTMLButtonElement | HTMLAnchorElement;
55
55
 
56
56
  const Button = forwardRef<ButtonReferenceType, Props>(
57
57
  (
@@ -68,7 +68,7 @@ describe('establishNewType', () => {
68
68
 
69
69
  describe('logDeprecationNotices', () => {
70
70
  const origWarn = console.warn;
71
- let mockedWarn: typeof origWarn;
71
+ let mockedWarn;
72
72
 
73
73
  beforeAll(() => {
74
74
  mockedWarn = jest.fn();
@@ -57,8 +57,8 @@ export const establishNewPriority: EstablishNewPriorityType = (originalPriority,
57
57
 
58
58
  type DeprecatedTypeMapMessageType = keyof typeof deprecatedTypeMapMessage;
59
59
  type LogDeprecationNoticesType = (params: {
60
- size?: `${Size}`;
61
- type?: DeprecatedTypeMapMessageType | (string & Record<never, never>) | null;
60
+ size: `${Size}`;
61
+ type: DeprecatedTypeMapMessageType | (string & Record<never, never>) | null;
62
62
  }) => void;
63
63
  export const logDeprecationNotices: LogDeprecationNoticesType = ({ size, type }) => {
64
64
  logActionRequiredIf(
@@ -4,8 +4,40 @@
4
4
  width: var(--circle-size);
5
5
  height: var(--circle-size);
6
6
  flex-shrink: 0;
7
+ --circle-border-color: var(--color-border-neutral);
8
+ --circle-border-width: 1px;
9
+ font-size: var(--circle-font-size);
10
+ font-weight: 600;
11
+ font-weight: var(--font-weight-semi-bold);
12
+ line-height: 1;
13
+ }
14
+ .np-circle .np-display {
15
+ font-size: var(--circle-font-size);
7
16
  }
8
17
  .np-circle .tw-icon > svg {
9
18
  height: var(--circle-icon-size);
10
19
  width: var(--circle-icon-size);
11
20
  }
21
+ .np-circle img,
22
+ .np-circle .wds-flag {
23
+ border-radius: 9999px;
24
+ border-radius: var(--radius-full);
25
+ width: 100%;
26
+ height: 100%;
27
+ -o-object-fit: cover;
28
+ object-fit: cover;
29
+ }
30
+ .np-circle-border {
31
+ position: relative;
32
+ }
33
+ .np-circle-border::after {
34
+ content: "";
35
+ position: absolute;
36
+ top: 0;
37
+ left: 0;
38
+ width: 100%;
39
+ height: 100%;
40
+ border-radius: 9999px;
41
+ border-radius: var(--radius-full);
42
+ box-shadow: inset 0 0 0 var(--circle-border-width) var(--circle-border-color);
43
+ }
@@ -4,9 +4,44 @@
4
4
  height: var(--circle-size);
5
5
  flex-shrink: 0;
6
6
 
7
+ --circle-border-color: var(--color-border-neutral);
8
+ --circle-border-width: 1px;
9
+
10
+ // sets custom typography styles for default (Inter) font
11
+ font-size: var(--circle-font-size);
12
+ font-weight: var(--font-weight-semi-bold);
13
+ line-height: 1;
14
+
15
+ // sets custom typography styles for Wise Sand font
16
+ .np-display {
17
+ font-size: var(--circle-font-size);
18
+ }
19
+
7
20
  // circle like components has custom icon sizes
8
21
  .tw-icon > svg {
9
22
  height: var(--circle-icon-size);
10
23
  width: var(--circle-icon-size);
11
24
  }
25
+
26
+ img,
27
+ .wds-flag {
28
+ border-radius: var(--radius-full);
29
+ width: 100%;
30
+ height: 100%;
31
+ object-fit: cover;
32
+ }
33
+
34
+ &-border {
35
+ position: relative;
36
+ &::after {
37
+ content: "";
38
+ position: absolute;
39
+ top: 0;
40
+ left: 0;
41
+ width: 100%;
42
+ height: 100%;
43
+ border-radius: var(--radius-full);
44
+ box-shadow: inset 0 0 0 var(--circle-border-width) var(--circle-border-color);
45
+ }
46
+ }
12
47
  }
@@ -19,6 +19,7 @@ export type Props = {
19
19
  * as those can be dynamic a at certain viewport sizes
20
20
  */
21
21
  fixedSize?: boolean;
22
+ enableBorder?: boolean;
22
23
  } & HTMLAttributes<HTMLDivElement>;
23
24
 
24
25
  /**
@@ -34,12 +35,26 @@ const MAP_ICON_SIZE = {
34
35
  72: 36,
35
36
  };
36
37
 
38
+ /**
39
+ * circle like components have custom font styles
40
+ */
41
+ const MAP_FONT_SIZE = {
42
+ 16: 8,
43
+ 24: 12,
44
+ 32: 14,
45
+ 40: 18,
46
+ 48: 22,
47
+ 56: 26,
48
+ 72: 30,
49
+ };
50
+
37
51
  const Circle = forwardRef(function Circle(
38
52
  {
39
53
  as: Element = 'div',
40
54
  children,
41
55
  size = 48,
42
56
  fixedSize = false,
57
+ enableBorder = false,
43
58
  className,
44
59
  style,
45
60
  ...props
@@ -57,9 +72,15 @@ const Circle = forwardRef(function Circle(
57
72
  isTinyViewport && !fixedSize
58
73
  ? `${MAP_ICON_SIZE[size] / 2}px`
59
74
  : `${MAP_ICON_SIZE[size]}px`,
75
+ '--circle-font-size': `${MAP_FONT_SIZE[size]}px`,
60
76
  ...style,
61
77
  }}
62
- className={clsx('np-circle', 'd-flex align-items-center justify-content-center', className)}
78
+ className={clsx(
79
+ 'np-circle',
80
+ { 'np-circle-border': enableBorder },
81
+ 'd-flex align-items-center justify-content-center',
82
+ className,
83
+ )}
63
84
  >
64
85
  {children}
65
86
  </Element>
@@ -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 name="Henry Mike" />,
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 name="Henry Mike" />,
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 name="Henry Mike" />,
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 name="Henry Mike" />,
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 name="Henry Mike" />,
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 name="Henry Mike" />,
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 name="Henry Mike" />,
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 name="Henry Mike" />,
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 name="Henry Mike" />,
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,28 +17,14 @@ 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
- type ProfileTypeKeys = keyof typeof ProfileType;
28
-
29
- const getAvatarProfile = (showAvatar: string) =>
30
- showAvatar in avatarProfiles ? avatarProfiles[showAvatar as keyof typeof avatarProfiles] : null;
31
20
 
32
21
  export const Variants = () => {
33
22
  const [activeStep, setActiveStep] = useState(2);
34
23
  const [closed, setClosed] = useState(false);
35
- const showAvatar = select('avatar', Object.keys(avatarProfiles), 'Profile');
24
+ const showAvatar = select('avatar', ['', ProfileType.PERSONAL, ProfileType.BUSINESS], 'Profile');
36
25
  const showCloseButton = boolean('show closeButton', true);
37
26
  const showMobileBackButton = boolean('show mobile backButton', true);
38
27
  const done = boolean('done', false);
39
- const profileType: ProfileTypeKeys | undefined = select(
40
- 'profileType',
41
- Object.keys(ProfileType) as ProfileTypeKeys[],
42
- undefined,
43
- );
44
28
  const avatarURL = text(
45
29
  'avatarURL',
46
30
  'https://wise.com/web-art/assets/illustrations/heart-small@2x.webp',
@@ -49,13 +33,7 @@ export const Variants = () => {
49
33
  return !closed ? (
50
34
  <>
51
35
  <FlowNavigation
52
- avatar={
53
- !showAvatar ? null : (
54
- <Avatar type={AvatarType.ICON} size={Size.MEDIUM}>
55
- {getAvatarProfile(showAvatar)}
56
- </Avatar>
57
- )
58
- }
36
+ avatar={!showAvatar ? null : <AvatarView type={showAvatar.toLowerCase()} />}
59
37
  logo={<Logo />}
60
38
  activeStep={activeStep}
61
39
  done={done}
@@ -132,7 +110,7 @@ export const Variants = () => {
132
110
 
133
111
  <FlowNavigation
134
112
  done={done}
135
- avatar={<AvatarWrapper url={avatarURL} profileType={profileType} />}
113
+ avatar={<AvatarView imgSrc={avatarURL} type={showAvatar?.toLowerCase()} />}
136
114
  activeStep={activeStep}
137
115
  steps={[
138
116
  {
@@ -178,7 +156,7 @@ export const Variants = () => {
178
156
  {/* Instance of always `done` FlowNav for visual testing */}
179
157
  <FlowNavigation
180
158
  done
181
- avatar={<AvatarWrapper url={avatarURL} profileType={profileType} />}
159
+ avatar={<AvatarView imgSrc={avatarURL} type={showAvatar.toLowerCase()} />}
182
160
  activeStep={activeStep}
183
161
  steps={[
184
162
  { label: 'Recipient', hoverLabel: 'Daniele Tomboro', onClick: () => setActiveStep(0) },
@@ -240,11 +218,7 @@ export const SendFlow = () => {
240
218
  return (
241
219
  <>
242
220
  <FlowNavigation
243
- avatar={
244
- <Avatar type={AvatarType.ICON} size={Size.MEDIUM}>
245
- <ProfileIcon />
246
- </Avatar>
247
- }
221
+ avatar={<AvatarView />}
248
222
  logo={<Logo />}
249
223
  activeStep={activeStep}
250
224
  steps={steps}
@@ -272,7 +246,7 @@ export const SendFlow = () => {
272
246
  export const WithOverlayHeaderComparison = () => {
273
247
  const [activeStep, setActiveStep] = useState(4);
274
248
  const [closed, setClosed] = useState(false);
275
- const showAvatar = select('avatar', Object.keys(avatarProfiles), 'Profile');
249
+ const showAvatar = select('avatar', ['', ProfileType.PERSONAL, ProfileType.BUSINESS], 'Profile');
276
250
  const showCloseButton = boolean('show closeButton', true);
277
251
  const showMobileBackButton = boolean('show mobile backButton', true);
278
252
  const done = boolean('done', false);
@@ -281,13 +255,7 @@ export const WithOverlayHeaderComparison = () => {
281
255
  <>
282
256
  <div style={{ border: '1px solid #e8e8e8' }}>
283
257
  <FlowNavigation
284
- avatar={
285
- showAvatar ? (
286
- <Avatar type={AvatarType.ICON} size={Size.MEDIUM}>
287
- {getAvatarProfile(showAvatar)}
288
- </Avatar>
289
- ) : null
290
- }
258
+ avatar={showAvatar ? <AvatarView type={showAvatar.toLowerCase()} /> : null}
291
259
  activeStep={activeStep}
292
260
  done={done}
293
261
  steps={[]}
@@ -301,13 +269,7 @@ export const WithOverlayHeaderComparison = () => {
301
269
  </div>
302
270
  <div style={{ border: '1px solid #e8e8e8' }}>
303
271
  <OverlayHeader
304
- avatar={
305
- showAvatar ? (
306
- <Avatar type={AvatarType.ICON} size={Size.MEDIUM}>
307
- {getAvatarProfile(showAvatar)}
308
- </Avatar>
309
- ) : null
310
- }
272
+ avatar={showAvatar ? <AvatarView type={showAvatar.toLowerCase()} /> : null}
311
273
  onClose={showCloseButton ? () => setClosed(true) : undefined}
312
274
  />
313
275
  </div>
package/src/i18n/th.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/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';
@@ -103,6 +104,7 @@ export { default as ActionOption } from './actionOption';
103
104
  export { default as SelectOption } from './selectOption';
104
105
  export { default as Alert } from './alert';
105
106
  export { default as Avatar } from './avatar';
107
+ export { default as AvatarView } from './avatarView';
106
108
  export { default as AvatarWrapper } from './avatarWrapper';
107
109
  export { default as Badge } from './badge';
108
110
  export { default as Body } from './body';
@@ -244,6 +246,8 @@ export {
244
246
  getLangFromLocale,
245
247
  isBrowser,
246
248
  isServerSide,
249
+ getInitials,
250
+ getBrandColorFromSeed,
247
251
  } from './common';
248
252
 
249
253
  /**