@transferwise/components 0.0.0-experimental-37d8e2c → 0.0.0-experimental-dabe7c7
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.
- package/build/actionButton/ActionButton.js +1 -1
- package/build/actionButton/ActionButton.js.map +1 -1
- package/build/actionButton/ActionButton.mjs +1 -1
- package/build/actionButton/ActionButton.mjs.map +1 -1
- package/build/actionOption/ActionOption.js +7 -2
- package/build/actionOption/ActionOption.js.map +1 -1
- package/build/actionOption/ActionOption.mjs +8 -3
- package/build/actionOption/ActionOption.mjs.map +1 -1
- package/build/avatar/Avatar.js +1 -4
- package/build/avatar/Avatar.js.map +1 -1
- package/build/avatar/Avatar.mjs +1 -4
- package/build/avatar/Avatar.mjs.map +1 -1
- package/build/avatar/colors/colors.js +1 -1
- package/build/avatar/colors/colors.js.map +1 -1
- package/build/avatar/colors/colors.mjs +1 -1
- package/build/avatar/colors/colors.mjs.map +1 -1
- package/build/avatarWrapper/AvatarWrapper.js +9 -6
- package/build/avatarWrapper/AvatarWrapper.js.map +1 -1
- package/build/avatarWrapper/AvatarWrapper.mjs +8 -5
- package/build/avatarWrapper/AvatarWrapper.mjs.map +1 -1
- package/build/badge/Badge.js +1 -6
- package/build/badge/Badge.js.map +1 -1
- package/build/badge/Badge.mjs +1 -6
- package/build/badge/Badge.mjs.map +1 -1
- package/build/circularButton/CircularButton.js +7 -4
- package/build/circularButton/CircularButton.js.map +1 -1
- package/build/circularButton/CircularButton.mjs +7 -4
- package/build/circularButton/CircularButton.mjs.map +1 -1
- package/build/common/circle/Circle.js +1 -24
- package/build/common/circle/Circle.js.map +1 -1
- package/build/common/circle/Circle.mjs +1 -24
- package/build/common/circle/Circle.mjs.map +1 -1
- package/build/display/Display.js +1 -1
- package/build/display/Display.js.map +1 -1
- package/build/display/Display.mjs +1 -1
- package/build/display/Display.mjs.map +1 -1
- package/build/index.js +0 -6
- package/build/index.js.map +1 -1
- package/build/index.mjs +0 -3
- package/build/index.mjs.map +1 -1
- package/build/main.css +56 -82
- package/build/statusIcon/StatusIcon.js +2 -4
- package/build/statusIcon/StatusIcon.js.map +1 -1
- package/build/statusIcon/StatusIcon.mjs +2 -4
- package/build/statusIcon/StatusIcon.mjs.map +1 -1
- package/build/styles/actionButton/ActionButton.css +11 -0
- package/build/styles/actionOption/ActionOption.css +4 -0
- package/build/styles/badge/Badge.css +5 -5
- package/build/styles/circularButton/CircularButton.css +24 -0
- package/build/styles/common/circle/Circle.css +0 -17
- package/build/styles/main.css +56 -82
- package/build/styles/statusIcon/StatusIcon.css +12 -0
- package/build/types/actionButton/ActionButton.d.ts +3 -3
- package/build/types/actionButton/ActionButton.d.ts.map +1 -1
- package/build/types/actionOption/ActionOption.d.ts +2 -2
- package/build/types/actionOption/ActionOption.d.ts.map +1 -1
- package/build/types/avatar/Avatar.d.ts +0 -3
- package/build/types/avatar/Avatar.d.ts.map +1 -1
- package/build/types/avatar/colors/colors.d.ts +1 -1
- package/build/types/avatar/colors/colors.d.ts.map +1 -1
- package/build/types/avatarWrapper/AvatarWrapper.d.ts +0 -3
- package/build/types/avatarWrapper/AvatarWrapper.d.ts.map +1 -1
- package/build/types/badge/Badge.d.ts +1 -2
- package/build/types/badge/Badge.d.ts.map +1 -1
- package/build/types/circularButton/CircularButton.d.ts.map +1 -1
- package/build/types/common/circle/Circle.d.ts +1 -1
- package/build/types/common/circle/Circle.d.ts.map +1 -1
- package/build/types/common/index.d.ts +0 -1
- package/build/types/index.d.ts +1 -4
- package/build/types/index.d.ts.map +1 -1
- package/build/types/statusIcon/StatusIcon.d.ts +2 -6
- package/build/types/statusIcon/StatusIcon.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/actionButton/ActionButton.css +11 -0
- package/src/actionButton/ActionButton.less +14 -0
- package/src/actionButton/ActionButton.story.tsx +7 -0
- package/src/actionButton/ActionButton.tsx +7 -3
- package/src/actionOption/ActionOption.css +4 -0
- package/src/actionOption/ActionOption.less +3 -0
- package/src/actionOption/ActionOption.story.tsx +4 -0
- package/src/actionOption/ActionOption.tsx +15 -2
- package/src/avatar/Avatar.tsx +1 -4
- package/src/avatar/colors/colors.ts +4 -4
- package/src/avatarWrapper/AvatarWrapper.tsx +16 -12
- package/src/badge/Badge.css +5 -5
- package/src/badge/Badge.less +3 -3
- package/src/badge/Badge.tsx +1 -10
- package/src/circularButton/CircularButton.css +24 -0
- package/src/circularButton/CircularButton.less +15 -15
- package/src/circularButton/CircularButton.tsx +5 -4
- package/src/common/circle/Circle.css +0 -17
- package/src/common/circle/Circle.less +0 -22
- package/src/common/circle/Circle.tsx +2 -33
- package/src/common/index.js +0 -1
- package/src/display/Display.tsx +1 -1
- package/src/index.ts +0 -4
- package/src/main.css +56 -82
- package/src/main.less +1 -3
- package/src/statusIcon/StatusIcon.css +12 -0
- package/src/statusIcon/StatusIcon.less +6 -6
- package/src/statusIcon/StatusIcon.story.tsx +28 -32
- package/src/statusIcon/StatusIcon.tsx +4 -18
- package/build/avatarView/AvatarView.js +0 -207
- package/build/avatarView/AvatarView.js.map +0 -1
- package/build/avatarView/AvatarView.mjs +0 -205
- package/build/avatarView/AvatarView.mjs.map +0 -1
- package/build/common/initials.js +0 -12
- package/build/common/initials.js.map +0 -1
- package/build/common/initials.mjs +0 -10
- package/build/common/initials.mjs.map +0 -1
- package/build/common/notificationDot/NotificationDot.js +0 -16
- package/build/common/notificationDot/NotificationDot.js.map +0 -1
- package/build/common/notificationDot/NotificationDot.mjs +0 -14
- package/build/common/notificationDot/NotificationDot.mjs.map +0 -1
- package/build/styles/avatarGroup/AvatarGroup.css +0 -28
- package/build/styles/avatarView/AvatarView.css +0 -22
- package/build/styles/common/notificationDot/NotificationDot.css +0 -10
- package/build/types/avatarGroup/AvatarGroup.d.ts +0 -19
- package/build/types/avatarGroup/AvatarGroup.d.ts.map +0 -1
- package/build/types/avatarGroup/index.d.ts +0 -3
- package/build/types/avatarGroup/index.d.ts.map +0 -1
- package/build/types/avatarView/AvatarView.d.ts +0 -25
- package/build/types/avatarView/AvatarView.d.ts.map +0 -1
- package/build/types/avatarView/index.d.ts +0 -3
- package/build/types/avatarView/index.d.ts.map +0 -1
- package/build/types/common/initials.d.ts +0 -2
- package/build/types/common/initials.d.ts.map +0 -1
- package/build/types/common/notificationDot/NotificationDot.d.ts +0 -8
- package/build/types/common/notificationDot/NotificationDot.d.ts.map +0 -1
- package/src/avatarGroup/AvatarGroup.css +0 -28
- package/src/avatarGroup/AvatarGroup.less +0 -32
- package/src/avatarGroup/AvatarGroup.story.tsx +0 -249
- package/src/avatarGroup/AvatarGroup.tsx +0 -78
- package/src/avatarGroup/index.ts +0 -2
- package/src/avatarView/AvatarView.css +0 -22
- package/src/avatarView/AvatarView.less +0 -24
- package/src/avatarView/AvatarView.story.tsx +0 -425
- package/src/avatarView/AvatarView.tsx +0 -217
- package/src/avatarView/index.ts +0 -2
- package/src/common/initials.ts +0 -13
- package/src/common/notificationDot/NotificationDot.css +0 -10
- package/src/common/notificationDot/NotificationDot.less +0 -7
- package/src/common/notificationDot/NotificationDot.tsx +0 -10
- package/src/test-utils/avatar-img.webp +0 -0
|
@@ -23,6 +23,9 @@ export const Basic: Story = storyConfig(
|
|
|
23
23
|
<ActionButton priority="secondary" {...args}>
|
|
24
24
|
Secondary label
|
|
25
25
|
</ActionButton>
|
|
26
|
+
<ActionButton priority="tertiary" {...args} style={{ display: 'flex', gap: '0.4rem' }}>
|
|
27
|
+
Tertiary label
|
|
28
|
+
</ActionButton>
|
|
26
29
|
<ActionButton priority="primary" {...args} style={{ display: 'flex', gap: '0.4rem' }}>
|
|
27
30
|
<Settings />
|
|
28
31
|
Primary label
|
|
@@ -31,6 +34,10 @@ export const Basic: Story = storyConfig(
|
|
|
31
34
|
<Settings />
|
|
32
35
|
Secondary label
|
|
33
36
|
</ActionButton>
|
|
37
|
+
<ActionButton priority="tertiary" {...args} style={{ display: 'flex', gap: '0.4rem' }}>
|
|
38
|
+
<Settings />
|
|
39
|
+
Tertiary label
|
|
40
|
+
</ActionButton>
|
|
34
41
|
</div>
|
|
35
42
|
),
|
|
36
43
|
},
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { clsx } from 'clsx';
|
|
2
2
|
import { ButtonHTMLAttributes, forwardRef } from 'react';
|
|
3
3
|
|
|
4
|
-
import { Priority, PriorityPrimary, PrioritySecondary } from '../common';
|
|
4
|
+
import { Priority, PriorityPrimary, PrioritySecondary, PriorityTertiary } from '../common';
|
|
5
5
|
|
|
6
6
|
export type ActionButtonProps = {
|
|
7
|
-
priority?: PriorityPrimary | PrioritySecondary;
|
|
7
|
+
priority?: PriorityPrimary | PrioritySecondary | PriorityTertiary;
|
|
8
8
|
/**
|
|
9
9
|
* @deprecated use `children` instead
|
|
10
10
|
*/
|
|
@@ -30,7 +30,11 @@ const ActionButton = forwardRef<HTMLButtonElement, ActionButtonProps>(
|
|
|
30
30
|
className={clsx(
|
|
31
31
|
'np-action-btn',
|
|
32
32
|
'np-text-body-default-bold',
|
|
33
|
-
priority === Priority.
|
|
33
|
+
priority === Priority.TERTIARY
|
|
34
|
+
? 'btn-priority-3'
|
|
35
|
+
: priority === Priority.SECONDARY
|
|
36
|
+
? 'btn-priority-2'
|
|
37
|
+
: 'btn-priority-1',
|
|
34
38
|
className,
|
|
35
39
|
)}
|
|
36
40
|
disabled={disabled}
|
|
@@ -29,6 +29,10 @@ export const WithSecondarypriority: Story = {
|
|
|
29
29
|
render: (args) => <ActionOption priority="secondary" {...args} />,
|
|
30
30
|
};
|
|
31
31
|
|
|
32
|
+
export const WithTertiarypriority: Story = {
|
|
33
|
+
render: (args) => <ActionOption priority="tertiary" {...args} />,
|
|
34
|
+
};
|
|
35
|
+
|
|
32
36
|
export const WithContainerContent: Story = {
|
|
33
37
|
render: (args) => (
|
|
34
38
|
<>
|
|
@@ -1,8 +1,15 @@
|
|
|
1
1
|
import { clsx } from 'clsx';
|
|
2
2
|
|
|
3
3
|
import ActionButton from '../actionButton';
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
CommonProps,
|
|
6
|
+
Priority,
|
|
7
|
+
PriorityPrimary,
|
|
8
|
+
PrioritySecondary,
|
|
9
|
+
PriorityTertiary,
|
|
10
|
+
} from '../common';
|
|
5
11
|
import Option from '../common/Option';
|
|
12
|
+
import { ChevronRight } from '@transferwise/icons';
|
|
6
13
|
|
|
7
14
|
export type ActionOptionProps = {
|
|
8
15
|
complex?: boolean;
|
|
@@ -13,7 +20,7 @@ export type ActionOptionProps = {
|
|
|
13
20
|
onClick: () => void;
|
|
14
21
|
title: React.ReactNode;
|
|
15
22
|
action: React.ReactNode;
|
|
16
|
-
priority?: PriorityPrimary | PrioritySecondary;
|
|
23
|
+
priority?: PriorityPrimary | PrioritySecondary | PriorityTertiary;
|
|
17
24
|
showMediaCircle?: boolean;
|
|
18
25
|
isContainerAligned?: boolean;
|
|
19
26
|
as?: React.ElementType;
|
|
@@ -72,6 +79,12 @@ const ActionOption = ({
|
|
|
72
79
|
onClick={onClick}
|
|
73
80
|
>
|
|
74
81
|
{action}
|
|
82
|
+
{priority === Priority.TERTIARY && (
|
|
83
|
+
<>
|
|
84
|
+
|
|
85
|
+
<ChevronRight className="np-action-btn-chevron" />
|
|
86
|
+
</>
|
|
87
|
+
)}
|
|
75
88
|
</ActionButton>
|
|
76
89
|
}
|
|
77
90
|
/>
|
package/src/avatar/Avatar.tsx
CHANGED
|
@@ -44,9 +44,6 @@ const backwardsCompatibleSize = (size: AvatarSize): NumericAvatarSize => {
|
|
|
44
44
|
}
|
|
45
45
|
};
|
|
46
46
|
|
|
47
|
-
/**
|
|
48
|
-
* @deprecated Use `AvatarView` component instead
|
|
49
|
-
*/
|
|
50
47
|
const Avatar: React.FC<AvatarProps> = ({
|
|
51
48
|
backgroundColor = null,
|
|
52
49
|
backgroundColorSeed = null,
|
|
@@ -61,7 +58,7 @@ const Avatar: React.FC<AvatarProps> = ({
|
|
|
61
58
|
const backgroundColorFromSeed = useMemo<string | undefined>(
|
|
62
59
|
() =>
|
|
63
60
|
!backgroundColor && backgroundColorSeed
|
|
64
|
-
? getAvatarColorFromSeed(backgroundColorSeed)
|
|
61
|
+
? `var(${getAvatarColorFromSeed(backgroundColorSeed)})`
|
|
65
62
|
: undefined,
|
|
66
63
|
[backgroundColor, backgroundColorSeed],
|
|
67
64
|
);
|
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
* Do not change this array.
|
|
5
5
|
*/
|
|
6
6
|
const avatarColors = [
|
|
7
|
-
'
|
|
8
|
-
'
|
|
9
|
-
'
|
|
10
|
-
'
|
|
7
|
+
'--color-bright-blue',
|
|
8
|
+
'--color-bright-yellow',
|
|
9
|
+
'--color-bright-pink',
|
|
10
|
+
'--color-bright-orange',
|
|
11
11
|
] as const;
|
|
12
12
|
|
|
13
13
|
/*
|
|
@@ -3,14 +3,7 @@ import { useState, useEffect } from 'react';
|
|
|
3
3
|
|
|
4
4
|
import Avatar, { AvatarProps, AvatarType } from '../avatar';
|
|
5
5
|
import Badge, { BadgeProps } from '../badge';
|
|
6
|
-
import {
|
|
7
|
-
ProfileType,
|
|
8
|
-
ProfileTypePersonal,
|
|
9
|
-
ProfileTypeBusiness,
|
|
10
|
-
Size,
|
|
11
|
-
Sentiment,
|
|
12
|
-
getInitials,
|
|
13
|
-
} from '../common';
|
|
6
|
+
import { ProfileType, ProfileTypePersonal, ProfileTypeBusiness, Size, Sentiment } from '../common';
|
|
14
7
|
import StatusIcon from '../statusIcon/StatusIcon';
|
|
15
8
|
|
|
16
9
|
interface OptionalBadgeProps extends Omit<BadgeProps, 'badge'> {
|
|
@@ -75,9 +68,6 @@ export type AvatarWrapperProps = {
|
|
|
75
68
|
}
|
|
76
69
|
);
|
|
77
70
|
|
|
78
|
-
/**
|
|
79
|
-
* @deprecated Use `AvatarView` component instead
|
|
80
|
-
*/
|
|
81
71
|
const AvatarWrapper = ({
|
|
82
72
|
url,
|
|
83
73
|
'aria-label': ariaLabel,
|
|
@@ -119,7 +109,7 @@ const AvatarWrapper = ({
|
|
|
119
109
|
return {
|
|
120
110
|
type: AvatarType.INITIALS,
|
|
121
111
|
children: <>{getInitials(name)}</>,
|
|
122
|
-
backgroundColorSeed:
|
|
112
|
+
backgroundColorSeed: profileId?.toString(),
|
|
123
113
|
...updatedAvatarProps,
|
|
124
114
|
};
|
|
125
115
|
}
|
|
@@ -143,4 +133,18 @@ const AvatarWrapper = ({
|
|
|
143
133
|
);
|
|
144
134
|
};
|
|
145
135
|
|
|
136
|
+
function getInitials(name: string) {
|
|
137
|
+
const allInitials = name
|
|
138
|
+
.split(' ')
|
|
139
|
+
.map((part) => part[0])
|
|
140
|
+
.join('')
|
|
141
|
+
.toUpperCase();
|
|
142
|
+
|
|
143
|
+
if (allInitials.length === 1) {
|
|
144
|
+
return allInitials[0];
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
return allInitials[0] + allInitials.slice(-1);
|
|
148
|
+
}
|
|
149
|
+
|
|
146
150
|
export default AvatarWrapper;
|
package/src/badge/Badge.css
CHANGED
|
@@ -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
|
|
18
|
-
mask-image: radial-gradient(circle at
|
|
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));
|
|
19
19
|
}
|
|
20
20
|
[dir="rtl"] .tw-badge > .tw-badge__children {
|
|
21
|
-
-webkit-mask-image: radial-gradient(circle at
|
|
22
|
-
mask-image: radial-gradient(circle at
|
|
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));
|
|
23
23
|
}
|
|
24
24
|
.tw-badge > .tw-badge__content {
|
|
25
25
|
position: absolute;
|
|
26
|
-
bottom:
|
|
26
|
+
bottom: 0;
|
|
27
27
|
right: 0;
|
|
28
28
|
box-sizing: border-box;
|
|
29
29
|
text-align: center;
|
package/src/badge/Badge.less
CHANGED
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
|
|
34
34
|
mask-image:
|
|
35
35
|
radial-gradient(
|
|
36
|
-
circle at
|
|
36
|
+
circle at top 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
|
|
45
|
+
circle at top 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:
|
|
55
|
+
bottom: 0;
|
|
56
56
|
.right(0);
|
|
57
57
|
|
|
58
58
|
box-sizing: border-box;
|
package/src/badge/Badge.tsx
CHANGED
|
@@ -27,7 +27,6 @@ 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';
|
|
31
30
|
} & CommonProps;
|
|
32
31
|
|
|
33
32
|
const mapLegacySize = {
|
|
@@ -44,7 +43,6 @@ const Badge = ({
|
|
|
44
43
|
border = Theme.LIGHT,
|
|
45
44
|
'aria-label': ariaLabel,
|
|
46
45
|
children,
|
|
47
|
-
position = 'bottom-right',
|
|
48
46
|
}: BadgeProps) => {
|
|
49
47
|
// medium is deprecated, so we map it to small
|
|
50
48
|
const size = sizeProp === Size.MEDIUM ? Size.SMALL : sizeProp;
|
|
@@ -58,14 +56,7 @@ const Badge = ({
|
|
|
58
56
|
);
|
|
59
57
|
|
|
60
58
|
return (
|
|
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
|
-
>
|
|
59
|
+
<div aria-label={ariaLabel} className={classes}>
|
|
69
60
|
<div className="tw-badge__children">{children}</div>
|
|
70
61
|
<Circle size={mapLegacySize[size]} fixedSize className="tw-badge__content">
|
|
71
62
|
{badge}
|
|
@@ -6,6 +6,30 @@
|
|
|
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
|
+
}
|
|
9
33
|
.np-theme-personal .np-circular-btn {
|
|
10
34
|
/* stylelint-disable-next-line no-duplicate-selectors */
|
|
11
35
|
}
|
|
@@ -9,23 +9,23 @@
|
|
|
9
9
|
cursor: pointer;
|
|
10
10
|
position: relative;
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
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
|
-
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
@media (--screen-400-zoom) {
|
|
22
|
+
top: var(--size-8);
|
|
23
|
+
}
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
|
|
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,12 +28,14 @@ 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
|
+
|
|
31
33
|
const isTinyViewport = useMedia(`(max-width: ${Breakpoint.ZOOM_400}px)`);
|
|
32
34
|
|
|
33
35
|
return (
|
|
34
36
|
<label className={clsx('np-circular-btn', priority, type, disabled && 'disabled', className)}>
|
|
35
37
|
<Circle
|
|
36
|
-
as="
|
|
38
|
+
as="input"
|
|
37
39
|
// @ts-expect-error it's input[type=button] element
|
|
38
40
|
type="button"
|
|
39
41
|
size={isTinyViewport ? 64 : 56}
|
|
@@ -41,9 +43,8 @@ const CircularButton = ({
|
|
|
41
43
|
className={classes}
|
|
42
44
|
disabled={disabled}
|
|
43
45
|
{...rest}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
</Circle>
|
|
46
|
+
/>
|
|
47
|
+
{iconElement}
|
|
47
48
|
<Body as="span" className="np-circular-btn__label" type={Typography.BODY_DEFAULT_BOLD}>
|
|
48
49
|
{children}
|
|
49
50
|
</Body>
|
|
@@ -4,21 +4,4 @@
|
|
|
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);
|
|
24
7
|
}
|
|
@@ -3,26 +3,4 @@
|
|
|
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
|
-
}
|
|
28
6
|
}
|
|
@@ -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 | 72;
|
|
4
|
+
export type ShapeSize = 16 | 24 | 32 | 40 | 48 | 56 | 64 | 72;
|
|
5
5
|
|
|
6
6
|
export type Props = {
|
|
7
7
|
/**
|
|
@@ -19,32 +19,6 @@ 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
|
-
|
|
48
22
|
const Circle = forwardRef(function Circle(
|
|
49
23
|
{
|
|
50
24
|
as: Element = 'div',
|
|
@@ -61,12 +35,7 @@ const Circle = forwardRef(function Circle(
|
|
|
61
35
|
<Element
|
|
62
36
|
{...props}
|
|
63
37
|
ref={ref}
|
|
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
|
-
}}
|
|
38
|
+
style={{ ...style, '--circle-size': fixedSize ? `${size}px` : `var(--size-${size})` }}
|
|
70
39
|
className={clsx('np-circle', 'd-flex align-items-center justify-content-center', className)}
|
|
71
40
|
>
|
|
72
41
|
{children}
|
package/src/common/index.js
CHANGED
package/src/display/Display.tsx
CHANGED
|
@@ -18,7 +18,7 @@ function Display({
|
|
|
18
18
|
id,
|
|
19
19
|
}: Props) {
|
|
20
20
|
return (
|
|
21
|
-
<Heading id={id} className={clsx(
|
|
21
|
+
<Heading id={id} className={clsx(`np-text-${type}`, 'text-primary', className)}>
|
|
22
22
|
{children}
|
|
23
23
|
</Heading>
|
|
24
24
|
);
|
package/src/index.ts
CHANGED
|
@@ -8,7 +8,6 @@ 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';
|
|
12
11
|
export type { BadgeProps } from './badge';
|
|
13
12
|
export type { CardProps } from './card';
|
|
14
13
|
export type { CarouselProps } from './carousel';
|
|
@@ -103,7 +102,6 @@ export { default as ActionOption } from './actionOption';
|
|
|
103
102
|
export { default as SelectOption } from './selectOption';
|
|
104
103
|
export { default as Alert } from './alert';
|
|
105
104
|
export { default as Avatar } from './avatar';
|
|
106
|
-
export { default as AvatarView } from './avatarView';
|
|
107
105
|
export { default as AvatarWrapper } from './avatarWrapper';
|
|
108
106
|
export { default as Badge } from './badge';
|
|
109
107
|
export { default as Body } from './body';
|
|
@@ -245,9 +243,7 @@ export {
|
|
|
245
243
|
getLangFromLocale,
|
|
246
244
|
isBrowser,
|
|
247
245
|
isServerSide,
|
|
248
|
-
getInitials,
|
|
249
246
|
} from './common';
|
|
250
|
-
export { getAvatarColorFromSeed } from './avatar/colors';
|
|
251
247
|
|
|
252
248
|
/**
|
|
253
249
|
* Translations
|