@televet/kibble-ui 1.20.0-beta.2nbq04d.2 → 1.20.0-beta.2nbq04d.3
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/components/MediaAndIcons/Avatar/avatar.argTypes.d.ts +91 -45
- package/build/components/MediaAndIcons/Avatar/avatar.component.d.ts +14 -23
- package/build/components/MediaAndIcons/Avatar/avatar.types.d.ts +9 -0
- package/build/components/MediaAndIcons/Avatar/index.d.ts +1 -1
- package/build/components/MediaAndIcons/{Avatar/components/AvatarGroup → AvatarGroup}/avatarGroup.component.d.ts +2 -2
- package/build/index.js +103 -97
- package/build/index.js.map +1 -1
- package/package.json +1 -1
- /package/build/components/MediaAndIcons/{Avatar/components/AvatarGroup → AvatarGroup}/avatarGroup.utilities.d.ts +0 -0
|
@@ -1,25 +1,69 @@
|
|
|
1
|
+
import { Placement } from '@chakra-ui/react';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { AvatarSize, AvatarVariant } from './index';
|
|
4
|
+
import { IconName } from '../Icon';
|
|
5
|
+
import { AvatarBadgePosition, AvatarBadgeProps } from './components/AvatarBadge/avatarBadge.component';
|
|
6
|
+
export interface AvatarArgTypeProps {
|
|
7
|
+
backgroundColor?: string;
|
|
8
|
+
badgeBackgroundColor?: string;
|
|
9
|
+
badgeBorderColor?: string;
|
|
10
|
+
badgeIconColor?: string;
|
|
11
|
+
badgeIconName?: IconName;
|
|
12
|
+
badgePosition?: AvatarBadgePosition;
|
|
13
|
+
badgeProps?: AvatarBadgeProps;
|
|
14
|
+
color?: string;
|
|
15
|
+
handleClick?: React.MouseEventHandler<HTMLSpanElement>;
|
|
16
|
+
handleRemoveButtonClick?: React.MouseEventHandler<HTMLDivElement>;
|
|
17
|
+
hideBorder?: boolean;
|
|
18
|
+
iconName?: IconName;
|
|
19
|
+
name?: string;
|
|
20
|
+
randomizeVariant?: boolean;
|
|
21
|
+
showBadge?: boolean;
|
|
22
|
+
showRemoveButton?: boolean;
|
|
23
|
+
showTooltip?: boolean;
|
|
24
|
+
size?: AvatarSize;
|
|
25
|
+
src?: string;
|
|
26
|
+
tooltipPlacement?: Placement;
|
|
27
|
+
tooltipText?: string;
|
|
28
|
+
variant?: AvatarVariant;
|
|
29
|
+
}
|
|
1
30
|
export declare const avatarArgTypes: {
|
|
2
|
-
|
|
3
|
-
type: {
|
|
4
|
-
name: string;
|
|
5
|
-
required: boolean;
|
|
6
|
-
};
|
|
7
|
-
control: string;
|
|
31
|
+
backgroundColor: {
|
|
8
32
|
description: string;
|
|
9
|
-
|
|
10
|
-
type: {
|
|
11
|
-
summary: string;
|
|
12
|
-
};
|
|
13
|
-
};
|
|
33
|
+
control: string;
|
|
14
34
|
};
|
|
15
|
-
|
|
35
|
+
badgeBackgroundColor: any;
|
|
36
|
+
badgeBorderColor: any;
|
|
37
|
+
badgeIconColor: any;
|
|
38
|
+
badgeIconName: any;
|
|
39
|
+
badgePosition: any;
|
|
40
|
+
badgeProps: {
|
|
16
41
|
type: string;
|
|
42
|
+
description: string;
|
|
43
|
+
};
|
|
44
|
+
color: {
|
|
45
|
+
description: string;
|
|
17
46
|
control: string;
|
|
47
|
+
};
|
|
48
|
+
handleClick: {
|
|
49
|
+
type: string;
|
|
50
|
+
description: string;
|
|
51
|
+
};
|
|
52
|
+
handleRemoveButtonClick: {
|
|
53
|
+
type: string;
|
|
54
|
+
description: string;
|
|
55
|
+
};
|
|
56
|
+
hideBorder: {
|
|
57
|
+
type: string;
|
|
18
58
|
description: string;
|
|
59
|
+
defaultValue: boolean;
|
|
19
60
|
table: {
|
|
20
61
|
type: {
|
|
21
62
|
summary: string;
|
|
22
63
|
};
|
|
64
|
+
defaultValue: {
|
|
65
|
+
summary: string;
|
|
66
|
+
};
|
|
23
67
|
};
|
|
24
68
|
};
|
|
25
69
|
iconName: {
|
|
@@ -29,12 +73,22 @@ export declare const avatarArgTypes: {
|
|
|
29
73
|
options: string[];
|
|
30
74
|
description: string;
|
|
31
75
|
};
|
|
32
|
-
|
|
33
|
-
type:
|
|
76
|
+
name: {
|
|
77
|
+
type: {
|
|
78
|
+
name: string;
|
|
79
|
+
};
|
|
34
80
|
control: string;
|
|
35
81
|
description: string;
|
|
36
|
-
|
|
37
|
-
|
|
82
|
+
table: {
|
|
83
|
+
type: {
|
|
84
|
+
summary: string;
|
|
85
|
+
};
|
|
86
|
+
};
|
|
87
|
+
};
|
|
88
|
+
randomizeVariant: {
|
|
89
|
+
type: string;
|
|
90
|
+
description: string;
|
|
91
|
+
defaultValue: boolean;
|
|
38
92
|
table: {
|
|
39
93
|
type: {
|
|
40
94
|
summary: string;
|
|
@@ -44,10 +98,9 @@ export declare const avatarArgTypes: {
|
|
|
44
98
|
};
|
|
45
99
|
};
|
|
46
100
|
};
|
|
47
|
-
|
|
101
|
+
showBadge: {
|
|
48
102
|
type: string;
|
|
49
103
|
description: string;
|
|
50
|
-
defaultValue: boolean;
|
|
51
104
|
table: {
|
|
52
105
|
type: {
|
|
53
106
|
summary: string;
|
|
@@ -57,7 +110,7 @@ export declare const avatarArgTypes: {
|
|
|
57
110
|
};
|
|
58
111
|
};
|
|
59
112
|
};
|
|
60
|
-
|
|
113
|
+
showRemoveButton: {
|
|
61
114
|
type: string;
|
|
62
115
|
description: string;
|
|
63
116
|
defaultValue: boolean;
|
|
@@ -83,11 +136,12 @@ export declare const avatarArgTypes: {
|
|
|
83
136
|
};
|
|
84
137
|
};
|
|
85
138
|
};
|
|
86
|
-
|
|
139
|
+
size: {
|
|
140
|
+
type: string;
|
|
87
141
|
control: string;
|
|
88
|
-
options: import("@popperjs/core").Placement[];
|
|
89
|
-
defaultValue: string;
|
|
90
142
|
description: string;
|
|
143
|
+
defaultValue: string;
|
|
144
|
+
options: string[];
|
|
91
145
|
table: {
|
|
92
146
|
type: {
|
|
93
147
|
summary: string;
|
|
@@ -97,8 +151,9 @@ export declare const avatarArgTypes: {
|
|
|
97
151
|
};
|
|
98
152
|
};
|
|
99
153
|
};
|
|
100
|
-
|
|
154
|
+
src: {
|
|
101
155
|
type: string;
|
|
156
|
+
control: string;
|
|
102
157
|
description: string;
|
|
103
158
|
table: {
|
|
104
159
|
type: {
|
|
@@ -106,18 +161,21 @@ export declare const avatarArgTypes: {
|
|
|
106
161
|
};
|
|
107
162
|
};
|
|
108
163
|
};
|
|
109
|
-
|
|
110
|
-
type: string;
|
|
164
|
+
tooltipPlacement: {
|
|
111
165
|
control: string;
|
|
166
|
+
options: Placement[];
|
|
167
|
+
defaultValue: string;
|
|
112
168
|
description: string;
|
|
113
|
-
options: string[];
|
|
114
169
|
table: {
|
|
115
170
|
type: {
|
|
116
171
|
summary: string;
|
|
117
172
|
};
|
|
173
|
+
defaultValue: {
|
|
174
|
+
summary: string;
|
|
175
|
+
};
|
|
118
176
|
};
|
|
119
177
|
};
|
|
120
|
-
|
|
178
|
+
tooltipText: {
|
|
121
179
|
type: string;
|
|
122
180
|
description: string;
|
|
123
181
|
table: {
|
|
@@ -126,30 +184,18 @@ export declare const avatarArgTypes: {
|
|
|
126
184
|
};
|
|
127
185
|
};
|
|
128
186
|
};
|
|
129
|
-
|
|
130
|
-
description: string;
|
|
131
|
-
control: string;
|
|
132
|
-
};
|
|
133
|
-
color: {
|
|
134
|
-
description: string;
|
|
187
|
+
variant: {
|
|
135
188
|
control: string;
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
type: string;
|
|
189
|
+
options: AvatarVariant[];
|
|
190
|
+
defaultValue: AvatarVariant;
|
|
139
191
|
description: string;
|
|
140
192
|
table: {
|
|
141
193
|
type: {
|
|
142
194
|
summary: string;
|
|
143
195
|
};
|
|
196
|
+
defaultValue: {
|
|
197
|
+
summary: AvatarVariant;
|
|
198
|
+
};
|
|
144
199
|
};
|
|
145
200
|
};
|
|
146
|
-
badgeProps: {
|
|
147
|
-
type: string;
|
|
148
|
-
description: string;
|
|
149
|
-
};
|
|
150
|
-
badgeIconName: any;
|
|
151
|
-
badgePosition: any;
|
|
152
|
-
badgeIconColor: any;
|
|
153
|
-
badgeBorderColor: any;
|
|
154
|
-
badgeBackgroundColor: any;
|
|
155
201
|
};
|
|
@@ -1,32 +1,23 @@
|
|
|
1
1
|
import { AvatarProps as CAvatarProps, Placement } from '@chakra-ui/react';
|
|
2
2
|
import { IconName } from 'components/MediaAndIcons/Icon';
|
|
3
|
-
import React
|
|
4
|
-
import { AvatarSize } from './avatar.types';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { AvatarSize, AvatarVariant } from './avatar.types';
|
|
5
5
|
import { AvatarBadgeProps } from './components/AvatarBadge/avatarBadge.component';
|
|
6
|
-
export declare enum AvatarVariant {
|
|
7
|
-
Green = "green",
|
|
8
|
-
Red = "red",
|
|
9
|
-
Blue = "blue",
|
|
10
|
-
Comet = "comet",
|
|
11
|
-
Number = "number",
|
|
12
|
-
Dashed = "dashed",
|
|
13
|
-
Image = "image",
|
|
14
|
-
Icon = "icon"
|
|
15
|
-
}
|
|
16
6
|
export interface AvatarProps extends CAvatarProps {
|
|
17
|
-
|
|
18
|
-
size?: AvatarSize;
|
|
19
|
-
isClinic?: boolean;
|
|
20
|
-
showTooltip?: boolean;
|
|
21
|
-
tooltipPlacement?: Placement;
|
|
22
|
-
style?: CSSProperties;
|
|
7
|
+
badgeProps?: AvatarBadgeProps;
|
|
23
8
|
handleClick?: React.MouseEventHandler<HTMLSpanElement>;
|
|
24
|
-
showRemoveButton?: boolean;
|
|
25
9
|
handleRemoveButtonClick?: React.MouseEventHandler<HTMLDivElement>;
|
|
26
|
-
|
|
10
|
+
hideBorder?: boolean;
|
|
27
11
|
iconName?: IconName;
|
|
28
|
-
|
|
12
|
+
name?: string;
|
|
13
|
+
randomizeVariant?: boolean;
|
|
29
14
|
showBadge?: boolean;
|
|
30
|
-
|
|
15
|
+
showRemoveButton?: boolean;
|
|
16
|
+
showTooltip?: boolean;
|
|
17
|
+
size?: AvatarSize;
|
|
18
|
+
src?: string;
|
|
19
|
+
tooltipPlacement?: Placement;
|
|
20
|
+
tooltipText?: string;
|
|
21
|
+
variant?: AvatarVariant;
|
|
31
22
|
}
|
|
32
|
-
export declare const Avatar: ({
|
|
23
|
+
export declare const Avatar: ({ badgeProps, handleClick, handleRemoveButtonClick, hideBorder, iconName, name, randomizeVariant, showBadge, showRemoveButton, showTooltip, size, src, tooltipPlacement, tooltipText, variant, ...rest }: AvatarProps) => JSX.Element;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { AvatarProps } from '
|
|
2
|
-
import { AvatarSize } from '
|
|
1
|
+
import { AvatarProps } from '../Avatar/avatar.component';
|
|
2
|
+
import { AvatarSize } from '../Avatar/avatar.types';
|
|
3
3
|
export interface AvatarGroupProps {
|
|
4
4
|
avatars: AvatarProps[];
|
|
5
5
|
max?: number;
|
package/build/index.js
CHANGED
|
@@ -6668,18 +6668,26 @@ var TooltipConfig = {
|
|
|
6668
6668
|
},
|
|
6669
6669
|
};
|
|
6670
6670
|
|
|
6671
|
+
exports.AvatarVariant = void 0;
|
|
6672
|
+
(function (AvatarVariant) {
|
|
6673
|
+
AvatarVariant["Green"] = "green";
|
|
6674
|
+
AvatarVariant["Red"] = "red";
|
|
6675
|
+
AvatarVariant["Blue"] = "blue";
|
|
6676
|
+
AvatarVariant["Comet"] = "comet";
|
|
6677
|
+
AvatarVariant["Dark"] = "dark";
|
|
6678
|
+
AvatarVariant["Dashed"] = "dashed";
|
|
6679
|
+
AvatarVariant["Test"] = "test";
|
|
6680
|
+
})(exports.AvatarVariant || (exports.AvatarVariant = {}));
|
|
6681
|
+
|
|
6671
6682
|
var AvatarConfig = {
|
|
6672
6683
|
baseStyle: {
|
|
6673
6684
|
container: {
|
|
6674
6685
|
backgroundColor: coreColors.white,
|
|
6675
|
-
borderWidth: '2px',
|
|
6676
6686
|
boxShadow: "0 0 0 1px ".concat(coreColors.white),
|
|
6677
|
-
_active: {
|
|
6678
|
-
backgroundColor: coreColors.gray[100],
|
|
6679
|
-
},
|
|
6680
6687
|
},
|
|
6681
6688
|
label: {
|
|
6682
6689
|
paddingTop: '1px',
|
|
6690
|
+
fontWeight: 'semibold',
|
|
6683
6691
|
},
|
|
6684
6692
|
},
|
|
6685
6693
|
sizes: {
|
|
@@ -6732,25 +6740,19 @@ var AvatarConfig = {
|
|
|
6732
6740
|
variants: {
|
|
6733
6741
|
red: {
|
|
6734
6742
|
container: {
|
|
6735
|
-
borderColor: coreColors.red[300],
|
|
6736
|
-
},
|
|
6737
|
-
label: {
|
|
6738
6743
|
color: coreColors.red[300],
|
|
6744
|
+
borderColor: coreColors.red[300],
|
|
6739
6745
|
},
|
|
6740
6746
|
},
|
|
6741
6747
|
green: {
|
|
6742
6748
|
container: {
|
|
6743
6749
|
borderColor: coreColors.green[400],
|
|
6744
|
-
},
|
|
6745
|
-
label: {
|
|
6746
6750
|
color: coreColors.green[400],
|
|
6747
6751
|
},
|
|
6748
6752
|
},
|
|
6749
6753
|
blue: {
|
|
6750
6754
|
container: {
|
|
6751
6755
|
borderColor: coreColors.blue[300],
|
|
6752
|
-
},
|
|
6753
|
-
label: {
|
|
6754
6756
|
color: coreColors.blue[300],
|
|
6755
6757
|
},
|
|
6756
6758
|
},
|
|
@@ -6758,74 +6760,49 @@ var AvatarConfig = {
|
|
|
6758
6760
|
container: {
|
|
6759
6761
|
backgroundColor: coreColors.comet[50],
|
|
6760
6762
|
borderColor: coreColors.comet[400],
|
|
6761
|
-
_hover: {
|
|
6762
|
-
backgroundColor: coreColors.comet[100],
|
|
6763
|
-
},
|
|
6764
|
-
_active: {
|
|
6765
|
-
backgroundColor: coreColors.comet[200],
|
|
6766
|
-
},
|
|
6767
|
-
},
|
|
6768
|
-
label: {
|
|
6769
6763
|
color: coreColors.comet[800],
|
|
6770
6764
|
},
|
|
6771
6765
|
},
|
|
6772
|
-
|
|
6766
|
+
dark: {
|
|
6773
6767
|
container: {
|
|
6774
6768
|
backgroundColor: coreColors.blue[800],
|
|
6775
6769
|
border: 0,
|
|
6776
|
-
_hover: {
|
|
6777
|
-
backgroundColor: coreColors.blue[800], // 700
|
|
6778
|
-
},
|
|
6779
|
-
_active: {
|
|
6780
|
-
backgroundColor: coreColors.blue[800], // 600
|
|
6781
|
-
},
|
|
6782
|
-
},
|
|
6783
|
-
label: {
|
|
6784
6770
|
color: coreColors.white,
|
|
6785
6771
|
},
|
|
6786
6772
|
},
|
|
6787
6773
|
dashed: {
|
|
6788
6774
|
container: {
|
|
6789
|
-
backgroundColor: coreColors.
|
|
6790
|
-
|
|
6791
|
-
|
|
6792
|
-
boxShadow: 0,
|
|
6793
|
-
_hover: {
|
|
6794
|
-
backgroundColor: coreColors.blackAlpha[100],
|
|
6795
|
-
zIndex: 0,
|
|
6796
|
-
},
|
|
6797
|
-
_active: {
|
|
6798
|
-
backgroundColor: coreColors.blackAlpha[200],
|
|
6799
|
-
},
|
|
6800
|
-
},
|
|
6801
|
-
label: {
|
|
6775
|
+
backgroundColor: coreColors.white,
|
|
6776
|
+
borderColor: coreColors.white,
|
|
6777
|
+
overflow: 'visible',
|
|
6802
6778
|
color: adaptiveColors.icon.light.subtle,
|
|
6803
|
-
|
|
6804
|
-
|
|
6805
|
-
|
|
6806
|
-
|
|
6807
|
-
|
|
6808
|
-
|
|
6809
|
-
|
|
6810
|
-
|
|
6811
|
-
|
|
6812
|
-
_active: {
|
|
6813
|
-
backgroundColor: coreColors.black,
|
|
6814
|
-
img: { opacity: 0.92 },
|
|
6779
|
+
_after: {
|
|
6780
|
+
content: "''",
|
|
6781
|
+
position: 'absolute',
|
|
6782
|
+
top: '-2px',
|
|
6783
|
+
right: '-2px',
|
|
6784
|
+
bottom: '-2px',
|
|
6785
|
+
left: '-2px',
|
|
6786
|
+
border: "2px dashed ".concat(coreColors.blackAlpha['300']),
|
|
6787
|
+
borderRadius: '100%',
|
|
6815
6788
|
},
|
|
6816
6789
|
},
|
|
6817
6790
|
},
|
|
6818
|
-
|
|
6791
|
+
test: {
|
|
6819
6792
|
container: {
|
|
6820
|
-
|
|
6821
|
-
|
|
6822
|
-
|
|
6823
|
-
|
|
6824
|
-
|
|
6825
|
-
|
|
6826
|
-
|
|
6827
|
-
|
|
6828
|
-
|
|
6793
|
+
backgroundColor: coreColors.orange['50'],
|
|
6794
|
+
borderColor: coreColors.orange['200'],
|
|
6795
|
+
overflow: 'visible',
|
|
6796
|
+
color: adaptiveColors.icon.light.subtle,
|
|
6797
|
+
_after: {
|
|
6798
|
+
content: "''",
|
|
6799
|
+
position: 'absolute',
|
|
6800
|
+
top: '-2px',
|
|
6801
|
+
right: '-2px',
|
|
6802
|
+
bottom: '-2px',
|
|
6803
|
+
left: '-2px',
|
|
6804
|
+
border: "2px dashed ".concat(coreColors.blackAlpha['200']),
|
|
6805
|
+
borderRadius: '100%',
|
|
6829
6806
|
},
|
|
6830
6807
|
},
|
|
6831
6808
|
},
|
|
@@ -6840,7 +6817,7 @@ exports.AvatarBadgePosition = void 0;
|
|
|
6840
6817
|
AvatarBadgePosition["BottomRight"] = "bottomRight";
|
|
6841
6818
|
})(exports.AvatarBadgePosition || (exports.AvatarBadgePosition = {}));
|
|
6842
6819
|
var AvatarBadge = function (_a) {
|
|
6843
|
-
var avatarSize = _a.avatarSize, badgeIconName = _a.badgeIconName,
|
|
6820
|
+
var avatarSize = _a.avatarSize, badgeIconName = _a.badgeIconName, _b = _a.badgeBackgroundColor, badgeBackgroundColor = _b === void 0 ? semanticColors.background.info : _b, _c = _a.badgeBorderColor, badgeBorderColor = _c === void 0 ? coreColors.white : _c, _d = _a.badgeIconColor, badgeIconColor = _d === void 0 ? adaptiveColors.icon.light.active : _d, _e = _a.badgePosition, badgePosition = _e === void 0 ? exports.AvatarBadgePosition.BottomRight : _e;
|
|
6844
6821
|
var useSmallBadge = React.useMemo(function () { return avatarSize === 'xs' || !badgeIconName; }, [badgeIconName, avatarSize]);
|
|
6845
6822
|
var getBadgeTransform = function (position) {
|
|
6846
6823
|
var _a, _b, _c, _d;
|
|
@@ -6866,20 +6843,9 @@ var AvatarBadge = function (_a) {
|
|
|
6866
6843
|
: "translate(".concat(translation / 3, "px, ").concat(translation / 3, "px)");
|
|
6867
6844
|
}
|
|
6868
6845
|
};
|
|
6869
|
-
return (React__default["default"].createElement(react.AvatarBadge, { color: badgeIconColor
|
|
6846
|
+
return (React__default["default"].createElement(react.AvatarBadge, { color: badgeIconColor, borderColor: badgeBorderColor, borderWidth: "1px", bg: badgeBackgroundColor, boxSize: useSmallBadge ? '10px' : '18px', transform: getBadgeTransform(badgePosition) }, !useSmallBadge && badgeIconName && React__default["default"].createElement(Icon, { name: badgeIconName, size: 'xs' })));
|
|
6870
6847
|
};
|
|
6871
6848
|
|
|
6872
|
-
exports.AvatarVariant = void 0;
|
|
6873
|
-
(function (AvatarVariant) {
|
|
6874
|
-
AvatarVariant["Green"] = "green";
|
|
6875
|
-
AvatarVariant["Red"] = "red";
|
|
6876
|
-
AvatarVariant["Blue"] = "blue";
|
|
6877
|
-
AvatarVariant["Comet"] = "comet";
|
|
6878
|
-
AvatarVariant["Number"] = "number";
|
|
6879
|
-
AvatarVariant["Dashed"] = "dashed";
|
|
6880
|
-
AvatarVariant["Image"] = "image";
|
|
6881
|
-
AvatarVariant["Icon"] = "icon";
|
|
6882
|
-
})(exports.AvatarVariant || (exports.AvatarVariant = {}));
|
|
6883
6849
|
var getAvatarVariant = function (charCode) {
|
|
6884
6850
|
if (charCode >= 65 && charCode <= 71) {
|
|
6885
6851
|
return exports.AvatarVariant.Blue;
|
|
@@ -6895,29 +6861,69 @@ var getAvatarVariant = function (charCode) {
|
|
|
6895
6861
|
}
|
|
6896
6862
|
};
|
|
6897
6863
|
var Avatar = function (_a) {
|
|
6898
|
-
var _b = _a.
|
|
6864
|
+
var badgeProps = _a.badgeProps, handleClick = _a.handleClick, handleRemoveButtonClick = _a.handleRemoveButtonClick, _b = _a.hideBorder, hideBorder = _b === void 0 ? false : _b, iconName = _a.iconName, _c = _a.name, name = _c === void 0 ? '' : _c, _d = _a.randomizeVariant, randomizeVariant = _d === void 0 ? false : _d, _e = _a.showBadge, showBadge = _e === void 0 ? false : _e, _f = _a.showRemoveButton, showRemoveButton = _f === void 0 ? false : _f, _g = _a.showTooltip, showTooltip = _g === void 0 ? true : _g, _h = _a.size, size = _h === void 0 ? 'md' : _h, src = _a.src, _j = _a.tooltipPlacement, tooltipPlacement = _j === void 0 ? 'bottom' : _j, tooltipText = _a.tooltipText, _k = _a.variant, variant = _k === void 0 ? exports.AvatarVariant.Comet : _k, rest = __rest(_a, ["badgeProps", "handleClick", "handleRemoveButtonClick", "hideBorder", "iconName", "name", "randomizeVariant", "showBadge", "showRemoveButton", "showTooltip", "size", "src", "tooltipPlacement", "tooltipText", "variant"]);
|
|
6899
6865
|
var colors = useTheme().colors;
|
|
6900
|
-
var
|
|
6901
|
-
var
|
|
6902
|
-
var
|
|
6903
|
-
var shouldHideRemoveButton = size === 'xs'
|
|
6904
|
-
var _variant =
|
|
6905
|
-
if (
|
|
6906
|
-
_variant =
|
|
6866
|
+
var _l = __read(React.useState(!!src), 2), isSrcValid = _l[0], setIsSrcValid = _l[1];
|
|
6867
|
+
var _m = __read(React.useState(false), 2), isHoveringAvatar = _m[0], setIsHoveringAvatar = _m[1];
|
|
6868
|
+
var _o = __read(React.useState(false), 2), isHoveringRemoveButton = _o[0], setIsHoveringRemoveButton = _o[1];
|
|
6869
|
+
var shouldHideRemoveButton = size === 'xs';
|
|
6870
|
+
var _variant = variant;
|
|
6871
|
+
if (randomizeVariant) {
|
|
6872
|
+
_variant = getAvatarVariant(name.charCodeAt(0));
|
|
6907
6873
|
}
|
|
6908
|
-
|
|
6909
|
-
_variant
|
|
6910
|
-
|
|
6911
|
-
|
|
6912
|
-
|
|
6874
|
+
var hoverActiveStyles = React.useMemo(function () {
|
|
6875
|
+
switch (_variant) {
|
|
6876
|
+
case exports.AvatarVariant.Comet:
|
|
6877
|
+
return {
|
|
6878
|
+
_hover: {
|
|
6879
|
+
backgroundColor: colors.gray[100],
|
|
6880
|
+
},
|
|
6881
|
+
_active: {
|
|
6882
|
+
backgroundColor: colors.gray[200],
|
|
6883
|
+
},
|
|
6884
|
+
};
|
|
6885
|
+
case exports.AvatarVariant.Dark:
|
|
6886
|
+
return {
|
|
6887
|
+
_hover: {
|
|
6888
|
+
backgroundColor: colors.blue[700],
|
|
6889
|
+
},
|
|
6890
|
+
_active: {
|
|
6891
|
+
backgroundColor: colors.blue[600],
|
|
6892
|
+
},
|
|
6893
|
+
};
|
|
6894
|
+
case exports.AvatarVariant.Dashed:
|
|
6895
|
+
return {
|
|
6896
|
+
_hover: {
|
|
6897
|
+
backgroundColor: colors.blackAlpha[100],
|
|
6898
|
+
},
|
|
6899
|
+
_active: {
|
|
6900
|
+
backgroundColor: colors.blackAlpha[200],
|
|
6901
|
+
},
|
|
6902
|
+
};
|
|
6903
|
+
case exports.AvatarVariant.Test:
|
|
6904
|
+
return {
|
|
6905
|
+
_hover: {
|
|
6906
|
+
backgroundColor: colors.background.warning,
|
|
6907
|
+
},
|
|
6908
|
+
_active: {
|
|
6909
|
+
backgroundColor: colors.orange[200],
|
|
6910
|
+
},
|
|
6911
|
+
};
|
|
6912
|
+
default:
|
|
6913
|
+
return {
|
|
6914
|
+
_hover: {
|
|
6915
|
+
backgroundColor: colors.gray[50],
|
|
6916
|
+
},
|
|
6917
|
+
_active: {
|
|
6918
|
+
backgroundColor: colors.gray[100],
|
|
6919
|
+
},
|
|
6920
|
+
};
|
|
6921
|
+
}
|
|
6922
|
+
}, [_variant, colors]);
|
|
6923
|
+
var avatarMarkup = (React__default["default"].createElement(react.Avatar, __assign({ name: iconName ? '' : name, src: src, size: size, variant: _variant, borderWidth: isSrcValid || hideBorder ? '0px' : '2px' }, (iconName && {
|
|
6913
6924
|
icon: React__default["default"].createElement(Icon, { name: iconName, size: getNextIconSize(size, true, size === 'sm' || size === 'xs' ? 2 : 1) }),
|
|
6914
|
-
}), {
|
|
6915
|
-
|
|
6916
|
-
backgroundColor: colors.gray[50],
|
|
6917
|
-
zIndex: 2,
|
|
6918
|
-
}
|
|
6919
|
-
: {}, icon: iconName && React__default["default"].createElement(Icon, { name: iconName, size: getNextIconSize(size, true, size === 'sm' || size === 'xs' ? 2 : 1) }), onClick: handleClick, onError: function () { return setIsSrcValid(false); }, onMouseEnter: function () { return setIsHoveringAvatar(true); }, onMouseLeave: function () { return setIsHoveringAvatar(false); } }),
|
|
6920
|
-
showRemoveButton && isHoveringAvatar && !shouldHideRemoveButton && (React__default["default"].createElement(react.Box, { backgroundColor: colors.white, borderRadius: "9999px", cursor: "pointer", position: "absolute", top: "-4px", right: "-4px", onClick: handleRemoveButtonClick, onMouseEnter: function () { return setIsHoveringRemoveButton(true); }, onMouseLeave: function () { return setIsHoveringRemoveButton(false); } },
|
|
6925
|
+
}), (handleClick && __assign({ onClick: handleClick, cursor: 'pointer', zIndex: 2 }, hoverActiveStyles)), { onError: function () { return setIsSrcValid(false); }, onMouseEnter: function () { return setIsHoveringAvatar(true); }, onMouseLeave: function () { return setIsHoveringAvatar(false); } }, rest),
|
|
6926
|
+
showRemoveButton && isHoveringAvatar && !shouldHideRemoveButton && (React__default["default"].createElement(react.Box, { backgroundColor: colors.white, borderRadius: "9999px", cursor: "pointer", position: "absolute", top: "-4px", right: "-5px", onClick: handleRemoveButtonClick, onMouseEnter: function () { return setIsHoveringRemoveButton(true); }, zIndex: 2, onMouseLeave: function () { return setIsHoveringRemoveButton(false); } },
|
|
6921
6927
|
React__default["default"].createElement(Icon, { name: "closeCircle", size: isHoveringRemoveButton ? 'sm' : 'xs', colorToken: "default" }))),
|
|
6922
6928
|
showBadge && React__default["default"].createElement(AvatarBadge, __assign({ avatarSize: size }, badgeProps))));
|
|
6923
6929
|
if (showTooltip) {
|
|
@@ -6931,7 +6937,7 @@ var AvatarGroup = function (_a) {
|
|
|
6931
6937
|
var mergedNames = React.useMemo(function () { return avatars.map(function (avatar) { return avatar.name; }).join(', '); }, [avatars]);
|
|
6932
6938
|
var spacing = size === 'lg' || size === 'md' ? -2 : -1;
|
|
6933
6939
|
return (React__default["default"].createElement(react.AvatarGroup, { size: size, spacing: spacing },
|
|
6934
|
-
avatars.length > max ? (React__default["default"].createElement(Avatar, { name: "".concat(avatars.length), size: size, variant: exports.AvatarVariant.
|
|
6940
|
+
avatars.length > max ? (React__default["default"].createElement(Avatar, { name: "".concat(avatars.length), size: size, variant: exports.AvatarVariant.Dark, showRemoveButton: false, tooltipText: mergedNames })) : (avatars.map(function (avatar) { return (React__default["default"].createElement(Avatar, __assign({}, avatar, { key: avatar.name, size: size, showRemoveButton: showRemoveAvatarButton, handleRemoveButtonClick: handleRemoveButtonClick }))); })),
|
|
6935
6941
|
showAddButton && (React__default["default"].createElement(Avatar, { name: "", variant: exports.AvatarVariant.Dashed, icon: React__default["default"].createElement(Icon, { name: "plus", colorToken: "subtle", size: size }), onClick: handleAddButtonClick, tooltipText: addButtonTooltipText, size: size }))));
|
|
6936
6942
|
};
|
|
6937
6943
|
|