@transferwise/components 0.0.0-experimental-e5e0684 → 0.0.0-experimental-37d8e2c

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 (151) hide show
  1. package/build/avatar/Avatar.js +4 -1
  2. package/build/avatar/Avatar.js.map +1 -1
  3. package/build/avatar/Avatar.mjs +4 -1
  4. package/build/avatar/Avatar.mjs.map +1 -1
  5. package/build/avatar/colors/colors.js +1 -1
  6. package/build/avatar/colors/colors.js.map +1 -1
  7. package/build/avatar/colors/colors.mjs +1 -1
  8. package/build/avatar/colors/colors.mjs.map +1 -1
  9. package/build/avatarView/AvatarView.js +207 -0
  10. package/build/avatarView/AvatarView.js.map +1 -0
  11. package/build/avatarView/AvatarView.mjs +205 -0
  12. package/build/avatarView/AvatarView.mjs.map +1 -0
  13. package/build/avatarWrapper/AvatarWrapper.js +6 -9
  14. package/build/avatarWrapper/AvatarWrapper.js.map +1 -1
  15. package/build/avatarWrapper/AvatarWrapper.mjs +5 -8
  16. package/build/avatarWrapper/AvatarWrapper.mjs.map +1 -1
  17. package/build/badge/Badge.js +6 -1
  18. package/build/badge/Badge.js.map +1 -1
  19. package/build/badge/Badge.mjs +6 -1
  20. package/build/badge/Badge.mjs.map +1 -1
  21. package/build/circularButton/CircularButton.js +4 -7
  22. package/build/circularButton/CircularButton.js.map +1 -1
  23. package/build/circularButton/CircularButton.mjs +4 -7
  24. package/build/circularButton/CircularButton.mjs.map +1 -1
  25. package/build/common/circle/Circle.js +24 -1
  26. package/build/common/circle/Circle.js.map +1 -1
  27. package/build/common/circle/Circle.mjs +24 -1
  28. package/build/common/circle/Circle.mjs.map +1 -1
  29. package/build/common/initials.js +12 -0
  30. package/build/common/initials.js.map +1 -0
  31. package/build/common/initials.mjs +10 -0
  32. package/build/common/initials.mjs.map +1 -0
  33. package/build/common/notificationDot/NotificationDot.js +16 -0
  34. package/build/common/notificationDot/NotificationDot.js.map +1 -0
  35. package/build/common/notificationDot/NotificationDot.mjs +14 -0
  36. package/build/common/notificationDot/NotificationDot.mjs.map +1 -0
  37. package/build/display/Display.js +1 -1
  38. package/build/display/Display.js.map +1 -1
  39. package/build/display/Display.mjs +1 -1
  40. package/build/display/Display.mjs.map +1 -1
  41. package/build/index.js +6 -0
  42. package/build/index.js.map +1 -1
  43. package/build/index.mjs +3 -0
  44. package/build/index.mjs.map +1 -1
  45. package/build/main.css +82 -41
  46. package/build/statusIcon/StatusIcon.js +4 -2
  47. package/build/statusIcon/StatusIcon.js.map +1 -1
  48. package/build/statusIcon/StatusIcon.mjs +4 -2
  49. package/build/statusIcon/StatusIcon.mjs.map +1 -1
  50. package/build/styles/avatarGroup/AvatarGroup.css +28 -0
  51. package/build/styles/avatarView/AvatarView.css +22 -0
  52. package/build/styles/badge/Badge.css +5 -5
  53. package/build/styles/circularButton/CircularButton.css +0 -24
  54. package/build/styles/common/circle/Circle.css +17 -0
  55. package/build/styles/common/notificationDot/NotificationDot.css +10 -0
  56. package/build/styles/main.css +82 -41
  57. package/build/styles/statusIcon/StatusIcon.css +0 -12
  58. package/build/typeahead/util/highlight.js +14 -2
  59. package/build/typeahead/util/highlight.js.map +1 -1
  60. package/build/typeahead/util/highlight.mjs +15 -3
  61. package/build/typeahead/util/highlight.mjs.map +1 -1
  62. package/build/types/avatar/Avatar.d.ts +3 -0
  63. package/build/types/avatar/Avatar.d.ts.map +1 -1
  64. package/build/types/avatar/colors/colors.d.ts +1 -1
  65. package/build/types/avatar/colors/colors.d.ts.map +1 -1
  66. package/build/types/avatarGroup/AvatarGroup.d.ts +19 -0
  67. package/build/types/avatarGroup/AvatarGroup.d.ts.map +1 -0
  68. package/build/types/avatarGroup/index.d.ts +3 -0
  69. package/build/types/avatarGroup/index.d.ts.map +1 -0
  70. package/build/types/avatarView/AvatarView.d.ts +25 -0
  71. package/build/types/avatarView/AvatarView.d.ts.map +1 -0
  72. package/build/types/avatarView/index.d.ts +3 -0
  73. package/build/types/avatarView/index.d.ts.map +1 -0
  74. package/build/types/avatarWrapper/AvatarWrapper.d.ts +3 -0
  75. package/build/types/avatarWrapper/AvatarWrapper.d.ts.map +1 -1
  76. package/build/types/badge/Badge.d.ts +2 -1
  77. package/build/types/badge/Badge.d.ts.map +1 -1
  78. package/build/types/circularButton/CircularButton.d.ts.map +1 -1
  79. package/build/types/common/circle/Circle.d.ts +1 -1
  80. package/build/types/common/circle/Circle.d.ts.map +1 -1
  81. package/build/types/common/index.d.ts +1 -0
  82. package/build/types/common/initials.d.ts +2 -0
  83. package/build/types/common/initials.d.ts.map +1 -0
  84. package/build/types/common/notificationDot/NotificationDot.d.ts +8 -0
  85. package/build/types/common/notificationDot/NotificationDot.d.ts.map +1 -0
  86. package/build/types/index.d.ts +4 -1
  87. package/build/types/index.d.ts.map +1 -1
  88. package/build/types/statusIcon/StatusIcon.d.ts +6 -2
  89. package/build/types/statusIcon/StatusIcon.d.ts.map +1 -1
  90. package/build/types/typeahead/util/highlight.d.ts +1 -1
  91. package/build/types/typeahead/util/highlight.d.ts.map +1 -1
  92. package/build/types/uploadInput/UploadInput.d.ts +0 -9
  93. package/build/types/uploadInput/UploadInput.d.ts.map +1 -1
  94. package/build/types/uploadInput/uploadItem/UploadItem.d.ts +1 -3
  95. package/build/types/uploadInput/uploadItem/UploadItem.d.ts.map +1 -1
  96. package/build/types/uploadInput/uploadItem/UploadItemLink.d.ts.map +1 -1
  97. package/build/uploadInput/UploadInput.js +51 -57
  98. package/build/uploadInput/UploadInput.js.map +1 -1
  99. package/build/uploadInput/UploadInput.mjs +51 -57
  100. package/build/uploadInput/UploadInput.mjs.map +1 -1
  101. package/build/uploadInput/uploadItem/UploadItem.js +3 -8
  102. package/build/uploadInput/uploadItem/UploadItem.js.map +1 -1
  103. package/build/uploadInput/uploadItem/UploadItem.mjs +3 -8
  104. package/build/uploadInput/uploadItem/UploadItem.mjs.map +1 -1
  105. package/build/uploadInput/uploadItem/UploadItemLink.js +0 -1
  106. package/build/uploadInput/uploadItem/UploadItemLink.js.map +1 -1
  107. package/build/uploadInput/uploadItem/UploadItemLink.mjs +0 -1
  108. package/build/uploadInput/uploadItem/UploadItemLink.mjs.map +1 -1
  109. package/package.json +3 -3
  110. package/src/avatar/Avatar.tsx +4 -1
  111. package/src/avatar/colors/colors.ts +4 -4
  112. package/src/avatarGroup/AvatarGroup.css +28 -0
  113. package/src/avatarGroup/AvatarGroup.less +32 -0
  114. package/src/avatarGroup/AvatarGroup.story.tsx +249 -0
  115. package/src/avatarGroup/AvatarGroup.tsx +78 -0
  116. package/src/avatarGroup/index.ts +2 -0
  117. package/src/avatarView/AvatarView.css +22 -0
  118. package/src/avatarView/AvatarView.less +24 -0
  119. package/src/avatarView/AvatarView.story.tsx +425 -0
  120. package/src/avatarView/AvatarView.tsx +217 -0
  121. package/src/avatarView/index.ts +2 -0
  122. package/src/avatarWrapper/AvatarWrapper.tsx +12 -16
  123. package/src/badge/Badge.css +5 -5
  124. package/src/badge/Badge.less +3 -3
  125. package/src/badge/Badge.tsx +10 -1
  126. package/src/circularButton/CircularButton.css +0 -24
  127. package/src/circularButton/CircularButton.less +15 -15
  128. package/src/circularButton/CircularButton.tsx +4 -5
  129. package/src/common/circle/Circle.css +17 -0
  130. package/src/common/circle/Circle.less +22 -0
  131. package/src/common/circle/Circle.tsx +33 -2
  132. package/src/common/index.js +1 -0
  133. package/src/common/initials.ts +13 -0
  134. package/src/common/notificationDot/NotificationDot.css +10 -0
  135. package/src/common/notificationDot/NotificationDot.less +7 -0
  136. package/src/common/notificationDot/NotificationDot.tsx +10 -0
  137. package/src/display/Display.tsx +1 -1
  138. package/src/index.ts +4 -0
  139. package/src/main.css +82 -41
  140. package/src/main.less +3 -0
  141. package/src/statusIcon/StatusIcon.css +0 -12
  142. package/src/statusIcon/StatusIcon.less +6 -6
  143. package/src/statusIcon/StatusIcon.story.tsx +32 -28
  144. package/src/statusIcon/StatusIcon.tsx +18 -4
  145. package/src/test-utils/avatar-img.webp +0 -0
  146. package/src/typeahead/typeaheadOption/TypeaheadOption.spec.js +7 -5
  147. package/src/typeahead/util/highlight.tsx +7 -2
  148. package/src/uploadInput/UploadInput.spec.tsx +6 -150
  149. package/src/uploadInput/UploadInput.tsx +60 -81
  150. package/src/uploadInput/uploadItem/UploadItem.tsx +6 -12
  151. package/src/uploadInput/uploadItem/UploadItemLink.tsx +1 -9
@@ -14,16 +14,16 @@
14
14
  --badge-border-color: rgba(0, 0, 0, 0.08);
15
15
  }
16
16
  .tw-badge > .tw-badge__children {
17
- -webkit-mask-image: radial-gradient(circle at top calc(100% - var(--badge-mask-offset)) left calc(100% - var(--badge-mask-offset)), transparent 0, transparent calc(var(--badge-size) / 2 + var(--badge-mask)), black calc(var(--badge-size) / 2 + var(--badge-mask) + 0.5px));
18
- mask-image: radial-gradient(circle at top calc(100% - var(--badge-mask-offset)) left calc(100% - var(--badge-mask-offset)), transparent 0, transparent calc(var(--badge-size) / 2 + var(--badge-mask)), black calc(var(--badge-size) / 2 + var(--badge-mask) + 0.5px));
17
+ -webkit-mask-image: radial-gradient(circle at var(--badge-mask-position) calc(100% - var(--badge-mask-offset)) left calc(100% - var(--badge-mask-offset)), transparent 0, transparent calc(var(--badge-size) / 2 + var(--badge-mask)), black calc(var(--badge-size) / 2 + var(--badge-mask) + 0.5px));
18
+ mask-image: radial-gradient(circle at var(--badge-mask-position) calc(100% - var(--badge-mask-offset)) left calc(100% - var(--badge-mask-offset)), transparent 0, transparent calc(var(--badge-size) / 2 + var(--badge-mask)), black calc(var(--badge-size) / 2 + var(--badge-mask) + 0.5px));
19
19
  }
20
20
  [dir="rtl"] .tw-badge > .tw-badge__children {
21
- -webkit-mask-image: radial-gradient(circle at top calc(100% - var(--badge-mask-offset)) right calc(100% - var(--badge-mask-offset)), transparent 0, transparent calc(var(--badge-size) / 2 + var(--badge-mask)), black calc(var(--badge-size) / 2 + var(--badge-mask) + 0.5px));
22
- mask-image: radial-gradient(circle at top calc(100% - var(--badge-mask-offset)) right calc(100% - var(--badge-mask-offset)), transparent 0, transparent calc(var(--badge-size) / 2 + var(--badge-mask)), black calc(var(--badge-size) / 2 + var(--badge-mask) + 0.5px));
21
+ -webkit-mask-image: radial-gradient(circle at var(--badge-mask-position) calc(100% - var(--badge-mask-offset)) right calc(100% - var(--badge-mask-offset)), transparent 0, transparent calc(var(--badge-size) / 2 + var(--badge-mask)), black calc(var(--badge-size) / 2 + var(--badge-mask) + 0.5px));
22
+ mask-image: radial-gradient(circle at var(--badge-mask-position) calc(100% - var(--badge-mask-offset)) right calc(100% - var(--badge-mask-offset)), transparent 0, transparent calc(var(--badge-size) / 2 + var(--badge-mask)), black calc(var(--badge-size) / 2 + var(--badge-mask) + 0.5px));
23
23
  }
24
24
  .tw-badge > .tw-badge__content {
25
25
  position: absolute;
26
- bottom: 0;
26
+ bottom: var(--badge-bottom-position);
27
27
  right: 0;
28
28
  box-sizing: border-box;
29
29
  text-align: center;
@@ -33,7 +33,7 @@
33
33
 
34
34
  mask-image:
35
35
  radial-gradient(
36
- circle at top calc(100% - var(--badge-mask-offset)) left calc(100% - var(--badge-mask-offset)),
36
+ circle at var(--badge-mask-position) calc(100% - var(--badge-mask-offset)) left calc(100% - var(--badge-mask-offset)),
37
37
  transparent 0,
38
38
  transparent calc(var(--badge-size) / 2 + var(--badge-mask)),
39
39
  black calc(var(--badge-size) / 2 + var(--badge-mask) + 0.5px)
@@ -42,7 +42,7 @@
42
42
  [dir="rtl"] & {
43
43
  mask-image:
44
44
  radial-gradient(
45
- circle at top calc(100% - var(--badge-mask-offset)) right calc(100% - var(--badge-mask-offset)),
45
+ circle at var(--badge-mask-position) calc(100% - var(--badge-mask-offset)) right calc(100% - var(--badge-mask-offset)),
46
46
  transparent 0,
47
47
  transparent calc(var(--badge-size) / 2 + var(--badge-mask)),
48
48
  black calc(var(--badge-size) / 2 + var(--badge-mask) + 0.5px)
@@ -52,7 +52,7 @@
52
52
 
53
53
  & > &__content {
54
54
  position: absolute;
55
- bottom: 0;
55
+ bottom: var(--badge-bottom-position);
56
56
  .right(0);
57
57
 
58
58
  box-sizing: border-box;
@@ -27,6 +27,7 @@ export type BadgeProps = {
27
27
  size?: SizeSmall | DeprecatedSizes | SizeLarge;
28
28
  border?: ThemeDark | ThemeLight;
29
29
  'aria-label'?: string;
30
+ position?: 'top-right' | 'bottom-right';
30
31
  } & CommonProps;
31
32
 
32
33
  const mapLegacySize = {
@@ -43,6 +44,7 @@ const Badge = ({
43
44
  border = Theme.LIGHT,
44
45
  'aria-label': ariaLabel,
45
46
  children,
47
+ position = 'bottom-right',
46
48
  }: BadgeProps) => {
47
49
  // medium is deprecated, so we map it to small
48
50
  const size = sizeProp === Size.MEDIUM ? Size.SMALL : sizeProp;
@@ -56,7 +58,14 @@ const Badge = ({
56
58
  );
57
59
 
58
60
  return (
59
- <div aria-label={ariaLabel} className={classes}>
61
+ <div
62
+ aria-label={ariaLabel}
63
+ className={classes}
64
+ style={{
65
+ '--badge-mask-position': position === 'top-right' ? 'bottom' : 'top',
66
+ '--badge-bottom-position': position === 'top-right' ? 'calc(var(--badge-size) * 2)' : 0,
67
+ }}
68
+ >
60
69
  <div className="tw-badge__children">{children}</div>
61
70
  <Circle size={mapLegacySize[size]} fixedSize className="tw-badge__content">
62
71
  {badge}
@@ -6,30 +6,6 @@
6
6
  cursor: pointer;
7
7
  position: relative;
8
8
  }
9
- .np-circular-btn .tw-icon {
10
- position: absolute;
11
- top: 16px;
12
- top: var(--size-16);
13
- pointer-events: none;
14
- color: white;
15
- transition: color 0.15s ease-in-out;
16
- width: 100%;
17
- left: 0;
18
- }
19
- [dir="rtl"] .np-circular-btn .tw-icon {
20
- right: 0;
21
- left: auto;
22
- left: initial;
23
- }
24
- @media (max-width: 320px) {
25
- .np-circular-btn .tw-icon {
26
- top: 8px;
27
- top: var(--size-8);
28
- }
29
- }
30
- .np-circular-btn .tw-icon > svg {
31
- margin: 0 auto;
32
- }
33
9
  .np-theme-personal .np-circular-btn {
34
10
  /* stylelint-disable-next-line no-duplicate-selectors */
35
11
  }
@@ -9,23 +9,23 @@
9
9
  cursor: pointer;
10
10
  position: relative;
11
11
 
12
- .tw-icon {
13
- position: absolute;
14
- top: var(--size-16);
15
- pointer-events: none;
16
- color: white;
17
- transition: color 0.15s ease-in-out;
18
- width: 100%;
19
- .left(0);
12
+ // .tw-icon {
13
+ // position: absolute;
14
+ // top: var(--size-16);
15
+ // pointer-events: none;
16
+ // color: white;
17
+ // transition: color 0.15s ease-in-out;
18
+ // width: 100%;
19
+ // .left(0);
20
20
 
21
- @media (--screen-400-zoom) {
22
- top: var(--size-8);
23
- }
21
+ // @media (--screen-400-zoom) {
22
+ // top: var(--size-8);
23
+ // }
24
24
 
25
- > svg {
26
- margin: 0 auto;
27
- }
28
- }
25
+ // > svg {
26
+ // margin: 0 auto;
27
+ // }
28
+ // }
29
29
 
30
30
  .np-theme-personal & {
31
31
  /* stylelint-disable-next-line no-duplicate-selectors */
@@ -28,14 +28,12 @@ const CircularButton = ({
28
28
  }: CircularButtonProps) => {
29
29
  const classes = clsx('btn np-btn', 'm-b-1', typeClassMap[type], priorityClassMap[priority]);
30
30
 
31
- const iconElement = Number(icon.props.size) !== 24 ? cloneElement(icon, { size: 24 }) : icon;
32
-
33
31
  const isTinyViewport = useMedia(`(max-width: ${Breakpoint.ZOOM_400}px)`);
34
32
 
35
33
  return (
36
34
  <label className={clsx('np-circular-btn', priority, type, disabled && 'disabled', className)}>
37
35
  <Circle
38
- as="input"
36
+ as="button"
39
37
  // @ts-expect-error it's input[type=button] element
40
38
  type="button"
41
39
  size={isTinyViewport ? 64 : 56}
@@ -43,8 +41,9 @@ const CircularButton = ({
43
41
  className={classes}
44
42
  disabled={disabled}
45
43
  {...rest}
46
- />
47
- {iconElement}
44
+ >
45
+ {icon}
46
+ </Circle>
48
47
  <Body as="span" className="np-circular-btn__label" type={Typography.BODY_DEFAULT_BOLD}>
49
48
  {children}
50
49
  </Body>
@@ -4,4 +4,21 @@
4
4
  width: var(--circle-size);
5
5
  height: var(--circle-size);
6
6
  flex-shrink: 0;
7
+ font-size: var(--circle-font-size);
8
+ font-weight: 600;
9
+ font-weight: var(--font-weight-semi-bold);
10
+ line-height: 1;
11
+ }
12
+ .np-circle img {
13
+ border-radius: 9999px;
14
+ border-radius: var(--radius-full);
15
+ width: 100%;
16
+ height: 100%;
17
+ }
18
+ .np-circle .np-display {
19
+ font-size: var(--circle-font-size);
20
+ }
21
+ .np-circle .tw-icon > svg {
22
+ height: var(--circle-icon-size);
23
+ width: var(--circle-icon-size);
7
24
  }
@@ -3,4 +3,26 @@
3
3
  width: var(--circle-size);
4
4
  height: var(--circle-size);
5
5
  flex-shrink: 0;
6
+
7
+ img {
8
+ border-radius: var(--radius-full);
9
+ width: 100%;
10
+ height: 100%;
11
+ }
12
+
13
+ // circle like components set custom typography styles for default (Inter) font
14
+ font-size: var(--circle-font-size);
15
+ font-weight: var(--font-weight-semi-bold);
16
+ line-height: 1;
17
+
18
+ // circle like components set custom typography styles for Wise Sand font
19
+ .np-display {
20
+ font-size: var(--circle-font-size);
21
+ }
22
+
23
+ // circle like components have custom icon sizes
24
+ .tw-icon > svg {
25
+ height: var(--circle-icon-size);
26
+ width: var(--circle-icon-size);
27
+ }
6
28
  }
@@ -1,7 +1,7 @@
1
1
  import { HTMLAttributes, forwardRef } from 'react';
2
2
  import { clsx } from 'clsx';
3
3
 
4
- export type ShapeSize = 16 | 24 | 32 | 40 | 48 | 56 | 64 | 72;
4
+ export type ShapeSize = 16 | 24 | 32 | 40 | 48 | 56 | 72;
5
5
 
6
6
  export type Props = {
7
7
  /**
@@ -19,6 +19,32 @@ export type Props = {
19
19
  fixedSize?: boolean;
20
20
  } & HTMLAttributes<HTMLDivElement>;
21
21
 
22
+ /**
23
+ * circle like components has custom sizes for icons
24
+ */
25
+ const mapIconSize = {
26
+ 16: 12,
27
+ 24: 16,
28
+ 32: 18,
29
+ 40: 20,
30
+ 48: 24,
31
+ 56: 28,
32
+ 72: 36,
33
+ };
34
+
35
+ /**
36
+ * circle like components have custom font styles
37
+ */
38
+ const mapFontSize = {
39
+ 16: 8,
40
+ 24: 12,
41
+ 32: 14,
42
+ 40: 18,
43
+ 48: 22,
44
+ 56: 26,
45
+ 72: 30,
46
+ };
47
+
22
48
  const Circle = forwardRef(function Circle(
23
49
  {
24
50
  as: Element = 'div',
@@ -35,7 +61,12 @@ const Circle = forwardRef(function Circle(
35
61
  <Element
36
62
  {...props}
37
63
  ref={ref}
38
- style={{ ...style, '--circle-size': fixedSize ? `${size}px` : `var(--size-${size})` }}
64
+ style={{
65
+ ...style,
66
+ '--circle-size': fixedSize ? `${size}px` : `var(--size-${size})`,
67
+ '--circle-icon-size': `${mapIconSize[size]}px`,
68
+ '--circle-font-size': `${mapFontSize[size]}px`,
69
+ }}
39
70
  className={clsx('np-circle', 'd-flex align-items-center justify-content-center', className)}
40
71
  >
41
72
  {children}
@@ -23,3 +23,4 @@ export { MarkdownNodeType } from './propsValues/markdownNodeType';
23
23
  export { FileType } from './fileType';
24
24
  export * from './locale';
25
25
  export * from './commonProps';
26
+ export * from './initials';
@@ -0,0 +1,13 @@
1
+ export function getInitials(name: string) {
2
+ const allInitials = name
3
+ .split(' ')
4
+ .map((part) => part[0])
5
+ .join('')
6
+ .toUpperCase();
7
+
8
+ if (allInitials.length === 1) {
9
+ return allInitials[0];
10
+ }
11
+
12
+ return allInitials[0] + allInitials.slice(-1);
13
+ }
@@ -0,0 +1,10 @@
1
+ .np-notification-dot {
2
+ --badge-notification-dot-size: 14px;
3
+ width: 14px;
4
+ width: var(--badge-notification-dot-size);
5
+ height: 14px;
6
+ height: var(--badge-notification-dot-size);
7
+ background-color: var(--color-sentiment-negative);
8
+ border-radius: 9999px;
9
+ border-radius: var(--radius-full);
10
+ }
@@ -0,0 +1,7 @@
1
+ .np-notification-dot {
2
+ --badge-notification-dot-size: 14px;
3
+ width: var(--badge-notification-dot-size);
4
+ height: var(--badge-notification-dot-size);
5
+ background-color: var(--color-sentiment-negative);
6
+ border-radius: var(--radius-full);
7
+ }
@@ -0,0 +1,10 @@
1
+ import { HTMLAttributes } from 'react';
2
+
3
+ type Props = Pick<HTMLAttributes<HTMLDivElement>, 'className' | 'style'>;
4
+
5
+ /**
6
+ * @deprecated make this element part pre build badges
7
+ */
8
+ export default function NotificationDot(props: Props) {
9
+ return <div {...props} className="np-notification-dot" />;
10
+ }
@@ -18,7 +18,7 @@ function Display({
18
18
  id,
19
19
  }: Props) {
20
20
  return (
21
- <Heading id={id} className={clsx(`np-text-${type}`, 'text-primary', className)}>
21
+ <Heading id={id} className={clsx('np-display', `np-text-${type}`, 'text-primary', className)}>
22
22
  {children}
23
23
  </Heading>
24
24
  );
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,7 +245,9 @@ export {
243
245
  getLangFromLocale,
244
246
  isBrowser,
245
247
  isServerSide,
248
+ getInitials,
246
249
  } from './common';
250
+ export { getAvatarColorFromSeed } from './avatar/colors';
247
251
 
248
252
  /**
249
253
  * Translations
package/src/main.css CHANGED
@@ -421,6 +421,56 @@ div.critical-comms .critical-comms-body {
421
421
  .np-theme-personal .tw-avatar--outlined:not(.disabled):not(:disabled):hover {
422
422
  border-color: var(--color-interactive-primary-hover);
423
423
  }
424
+ .np-avatar-view {
425
+ border-radius: 9999px;
426
+ border-radius: var(--radius-full);
427
+ color: var(--color-interactive-primary);
428
+ height: -moz-fit-content;
429
+ height: fit-content;
430
+ width: -moz-fit-content;
431
+ width: fit-content;
432
+ }
433
+ .np-avatar-view .np-circle {
434
+ background-color: transparent;
435
+ border: var(--avatar-view-non-interactive-border-width) solid rgba(0,0,0,0.10196);
436
+ border: var(--avatar-view-non-interactive-border-width) solid var(--color-border-neutral);
437
+ }
438
+ .np-avatar-view-selected .np-circle {
439
+ border: var(--avatar-view-selected-border-width) solid var(--color-interactive-primary) !important;
440
+ }
441
+ .np-avatar-view-interactive .np-circle {
442
+ background-color: rgba(134,167,189,0.10196);
443
+ background-color: var(--color-background-neutral);
444
+ border: none;
445
+ }
446
+ .np-avatar-group {
447
+ display: inline-flex;
448
+ --np-avatar-group-size: 48px;
449
+ --np-avatar-size: 32px;
450
+ }
451
+ .np-avatar-group-diagonal {
452
+ width: var(--np-avatar-group-size);
453
+ height: var(--np-avatar-group-size);
454
+ }
455
+ .np-avatar-group-diagonal-mask {
456
+ -webkit-mask-image: radial-gradient(circle at right 100%, transparent, transparent calc(var(--np-avatar-size) / 1.8), black 0);
457
+ mask-image: radial-gradient(circle at right 100%, transparent, transparent calc(var(--np-avatar-size) / 1.8), black 0);
458
+ }
459
+ .np-avatar-group-diagonal-child {
460
+ margin-left: calc((var(--np-avatar-size) / 2) * -1);
461
+ margin-top: calc((var(--np-avatar-size) * var(--np-avatar-group-index)) / 2);
462
+ }
463
+ .np-avatar-group-horizontal {
464
+ width: calc((var(--np-avatar-size) * 2) - 2px);
465
+ height: var(--np-avatar-group-size);
466
+ }
467
+ .np-avatar-group-horizontal-mask {
468
+ -webkit-mask-image: radial-gradient(circle at right 50%, transparent, transparent calc(var(--np-avatar-size) / 2), black 0);
469
+ mask-image: radial-gradient(circle at right 50%, transparent, transparent calc(var(--np-avatar-size) / 2), black 0);
470
+ }
471
+ .np-avatar-group-horizontal-child {
472
+ margin-left: calc((var(--np-avatar-size) / 4) * -1);
473
+ }
424
474
  .tw-badge {
425
475
  position: relative;
426
476
  display: inline-block;
@@ -437,16 +487,16 @@ div.critical-comms .critical-comms-body {
437
487
  --badge-border-color: rgba(0, 0, 0, 0.08);
438
488
  }
439
489
  .tw-badge > .tw-badge__children {
440
- -webkit-mask-image: radial-gradient(circle at top calc(100% - var(--badge-mask-offset)) left calc(100% - var(--badge-mask-offset)), transparent 0, transparent calc(var(--badge-size) / 2 + var(--badge-mask)), black calc(var(--badge-size) / 2 + var(--badge-mask) + 0.5px));
441
- mask-image: radial-gradient(circle at top calc(100% - var(--badge-mask-offset)) left calc(100% - var(--badge-mask-offset)), transparent 0, transparent calc(var(--badge-size) / 2 + var(--badge-mask)), black calc(var(--badge-size) / 2 + var(--badge-mask) + 0.5px));
490
+ -webkit-mask-image: radial-gradient(circle at var(--badge-mask-position) calc(100% - var(--badge-mask-offset)) left calc(100% - var(--badge-mask-offset)), transparent 0, transparent calc(var(--badge-size) / 2 + var(--badge-mask)), black calc(var(--badge-size) / 2 + var(--badge-mask) + 0.5px));
491
+ mask-image: radial-gradient(circle at var(--badge-mask-position) calc(100% - var(--badge-mask-offset)) left calc(100% - var(--badge-mask-offset)), transparent 0, transparent calc(var(--badge-size) / 2 + var(--badge-mask)), black calc(var(--badge-size) / 2 + var(--badge-mask) + 0.5px));
442
492
  }
443
493
  [dir="rtl"] .tw-badge > .tw-badge__children {
444
- -webkit-mask-image: radial-gradient(circle at top calc(100% - var(--badge-mask-offset)) right calc(100% - var(--badge-mask-offset)), transparent 0, transparent calc(var(--badge-size) / 2 + var(--badge-mask)), black calc(var(--badge-size) / 2 + var(--badge-mask) + 0.5px));
445
- mask-image: radial-gradient(circle at top calc(100% - var(--badge-mask-offset)) right calc(100% - var(--badge-mask-offset)), transparent 0, transparent calc(var(--badge-size) / 2 + var(--badge-mask)), black calc(var(--badge-size) / 2 + var(--badge-mask) + 0.5px));
494
+ -webkit-mask-image: radial-gradient(circle at var(--badge-mask-position) calc(100% - var(--badge-mask-offset)) right calc(100% - var(--badge-mask-offset)), transparent 0, transparent calc(var(--badge-size) / 2 + var(--badge-mask)), black calc(var(--badge-size) / 2 + var(--badge-mask) + 0.5px));
495
+ mask-image: radial-gradient(circle at var(--badge-mask-position) calc(100% - var(--badge-mask-offset)) right calc(100% - var(--badge-mask-offset)), transparent 0, transparent calc(var(--badge-size) / 2 + var(--badge-mask)), black calc(var(--badge-size) / 2 + var(--badge-mask) + 0.5px));
446
496
  }
447
497
  .tw-badge > .tw-badge__content {
448
498
  position: absolute;
449
- bottom: 0;
499
+ bottom: var(--badge-bottom-position);
450
500
  right: 0;
451
501
  box-sizing: border-box;
452
502
  text-align: center;
@@ -985,30 +1035,6 @@ div.critical-comms .critical-comms-body {
985
1035
  cursor: pointer;
986
1036
  position: relative;
987
1037
  }
988
- .np-circular-btn .tw-icon {
989
- position: absolute;
990
- top: 16px;
991
- top: var(--size-16);
992
- pointer-events: none;
993
- color: white;
994
- transition: color 0.15s ease-in-out;
995
- width: 100%;
996
- left: 0;
997
- }
998
- [dir="rtl"] .np-circular-btn .tw-icon {
999
- right: 0;
1000
- left: auto;
1001
- left: initial;
1002
- }
1003
- @media (max-width: 320px) {
1004
- .np-circular-btn .tw-icon {
1005
- top: 8px;
1006
- top: var(--size-8);
1007
- }
1008
- }
1009
- .np-circular-btn .tw-icon > svg {
1010
- margin: 0 auto;
1011
- }
1012
1038
  .np-theme-personal .np-circular-btn {
1013
1039
  /* stylelint-disable-next-line no-duplicate-selectors */
1014
1040
  }
@@ -1157,6 +1183,23 @@ div.critical-comms .critical-comms-body {
1157
1183
  width: var(--circle-size);
1158
1184
  height: var(--circle-size);
1159
1185
  flex-shrink: 0;
1186
+ font-size: var(--circle-font-size);
1187
+ font-weight: 600;
1188
+ font-weight: var(--font-weight-semi-bold);
1189
+ line-height: 1;
1190
+ }
1191
+ .np-circle img {
1192
+ border-radius: 9999px;
1193
+ border-radius: var(--radius-full);
1194
+ width: 100%;
1195
+ height: 100%;
1196
+ }
1197
+ .np-circle .np-display {
1198
+ font-size: var(--circle-font-size);
1199
+ }
1200
+ .np-circle .tw-icon > svg {
1201
+ height: var(--circle-icon-size);
1202
+ width: var(--circle-icon-size);
1160
1203
  }
1161
1204
  .np-bottom-sheet {
1162
1205
  border-radius: 10px 10px 0 0;
@@ -1439,6 +1482,16 @@ button.np-option {
1439
1482
  border-radius: var(--radius-small);
1440
1483
  }
1441
1484
  }
1485
+ .np-notification-dot {
1486
+ --badge-notification-dot-size: 14px;
1487
+ width: 14px;
1488
+ width: var(--badge-notification-dot-size);
1489
+ height: 14px;
1490
+ height: var(--badge-notification-dot-size);
1491
+ background-color: var(--color-sentiment-negative);
1492
+ border-radius: 9999px;
1493
+ border-radius: var(--radius-full);
1494
+ }
1442
1495
  .np-select-option {
1443
1496
  border-radius: 10px;
1444
1497
  border-radius: var(--radius-small);
@@ -4144,12 +4197,6 @@ html:not([dir="rtl"]) .np-navigation-option {
4144
4197
  transform: translateY(-24px);
4145
4198
  }
4146
4199
  }
4147
- .status-icon > svg {
4148
- height: 32px;
4149
- height: var(--size-32);
4150
- width: 32px;
4151
- width: var(--size-32);
4152
- }
4153
4200
  .status-circle .light {
4154
4201
  color: var(--color-contrast);
4155
4202
  }
@@ -4165,12 +4212,6 @@ html:not([dir="rtl"]) .np-navigation-option {
4165
4212
  .np-theme-personal .status-circle.pending .status-icon {
4166
4213
  color: var(--color-dark);
4167
4214
  }
4168
- .status-circle-sm .status-icon > svg {
4169
- height: 14px;
4170
- height: var(--size-14);
4171
- width: 14px;
4172
- width: var(--size-14);
4173
- }
4174
4215
  @media (max-width: 320px) {
4175
4216
  .status-circle-sm .status-icon > svg {
4176
4217
  width: 24px;
package/src/main.less CHANGED
@@ -2,6 +2,8 @@
2
2
  @import "./accordion/Accordion.less";
3
3
  @import "./actionButton/ActionButton.less";
4
4
  @import "./avatar/Avatar.less";
5
+ @import "./avatarView/AvatarView.less";
6
+ @import "./avatarGroup/AvatarGroup.less";
5
7
  @import "./badge/Badge.less";
6
8
  @import "./button/Button.less";
7
9
  @import "./card/Card.less";
@@ -14,6 +16,7 @@
14
16
  @import "./common/card/Card.less";
15
17
  @import "./common/closeButton/CloseButton.less";
16
18
  @import "./common/Option/Option.less";
19
+ @import "./common/notificationDot/NotificationDot.less";
17
20
  @import "./selectOption/SelectOption.less";
18
21
  @import "./common/panel/Panel.less";
19
22
  @import "./common/RadioButton/RadioButton.less";
@@ -1,9 +1,3 @@
1
- .status-icon > svg {
2
- height: 32px;
3
- height: var(--size-32);
4
- width: 32px;
5
- width: var(--size-32);
6
- }
7
1
  .status-circle .light {
8
2
  color: var(--color-contrast);
9
3
  }
@@ -19,12 +13,6 @@
19
13
  .np-theme-personal .status-circle.pending .status-icon {
20
14
  color: var(--color-dark);
21
15
  }
22
- .status-circle-sm .status-icon > svg {
23
- height: 14px;
24
- height: var(--size-14);
25
- width: 14px;
26
- width: var(--size-14);
27
- }
28
16
  @media (max-width: 320px) {
29
17
  .status-circle-sm .status-icon > svg {
30
18
  width: 24px;
@@ -1,7 +1,7 @@
1
- .status-icon > svg {
2
- height: var(--size-32);
3
- width: var(--size-32);
4
- }
1
+ // .status-icon > svg {
2
+ // height: var(--size-32);
3
+ // width: var(--size-32);
4
+ // }
5
5
 
6
6
  .status-circle {
7
7
  .light {
@@ -25,8 +25,8 @@
25
25
 
26
26
  &-sm {
27
27
  .status-icon > svg {
28
- height: var(--size-14);
29
- width: var(--size-14);
28
+ // height: var(--size-14);
29
+ // width: var(--size-14);
30
30
 
31
31
  @media (--screen-400-zoom) {
32
32
  width: var(--size-24);