@televet/kibble-ui 1.20.0-beta.2nbq04d.2 → 1.20.0-beta.2nbq04d.4
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 -98
- 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,25 @@ 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
|
-
boxShadow: "0 0 0 1px ".concat(coreColors.white),
|
|
6677
|
-
_active: {
|
|
6678
|
-
backgroundColor: coreColors.gray[100],
|
|
6679
|
-
},
|
|
6680
6686
|
},
|
|
6681
6687
|
label: {
|
|
6682
6688
|
paddingTop: '1px',
|
|
6689
|
+
fontWeight: 'semibold',
|
|
6683
6690
|
},
|
|
6684
6691
|
},
|
|
6685
6692
|
sizes: {
|
|
@@ -6732,25 +6739,19 @@ var AvatarConfig = {
|
|
|
6732
6739
|
variants: {
|
|
6733
6740
|
red: {
|
|
6734
6741
|
container: {
|
|
6735
|
-
borderColor: coreColors.red[300],
|
|
6736
|
-
},
|
|
6737
|
-
label: {
|
|
6738
6742
|
color: coreColors.red[300],
|
|
6743
|
+
borderColor: coreColors.red[300],
|
|
6739
6744
|
},
|
|
6740
6745
|
},
|
|
6741
6746
|
green: {
|
|
6742
6747
|
container: {
|
|
6743
6748
|
borderColor: coreColors.green[400],
|
|
6744
|
-
},
|
|
6745
|
-
label: {
|
|
6746
6749
|
color: coreColors.green[400],
|
|
6747
6750
|
},
|
|
6748
6751
|
},
|
|
6749
6752
|
blue: {
|
|
6750
6753
|
container: {
|
|
6751
6754
|
borderColor: coreColors.blue[300],
|
|
6752
|
-
},
|
|
6753
|
-
label: {
|
|
6754
6755
|
color: coreColors.blue[300],
|
|
6755
6756
|
},
|
|
6756
6757
|
},
|
|
@@ -6758,74 +6759,49 @@ var AvatarConfig = {
|
|
|
6758
6759
|
container: {
|
|
6759
6760
|
backgroundColor: coreColors.comet[50],
|
|
6760
6761
|
borderColor: coreColors.comet[400],
|
|
6761
|
-
_hover: {
|
|
6762
|
-
backgroundColor: coreColors.comet[100],
|
|
6763
|
-
},
|
|
6764
|
-
_active: {
|
|
6765
|
-
backgroundColor: coreColors.comet[200],
|
|
6766
|
-
},
|
|
6767
|
-
},
|
|
6768
|
-
label: {
|
|
6769
6762
|
color: coreColors.comet[800],
|
|
6770
6763
|
},
|
|
6771
6764
|
},
|
|
6772
|
-
|
|
6765
|
+
dark: {
|
|
6773
6766
|
container: {
|
|
6774
6767
|
backgroundColor: coreColors.blue[800],
|
|
6775
6768
|
border: 0,
|
|
6776
|
-
_hover: {
|
|
6777
|
-
backgroundColor: coreColors.blue[800], // 700
|
|
6778
|
-
},
|
|
6779
|
-
_active: {
|
|
6780
|
-
backgroundColor: coreColors.blue[800], // 600
|
|
6781
|
-
},
|
|
6782
|
-
},
|
|
6783
|
-
label: {
|
|
6784
6769
|
color: coreColors.white,
|
|
6785
6770
|
},
|
|
6786
6771
|
},
|
|
6787
6772
|
dashed: {
|
|
6788
6773
|
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: {
|
|
6774
|
+
backgroundColor: coreColors.white,
|
|
6775
|
+
borderColor: coreColors.white,
|
|
6776
|
+
overflow: 'visible',
|
|
6802
6777
|
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 },
|
|
6778
|
+
_after: {
|
|
6779
|
+
content: "''",
|
|
6780
|
+
position: 'absolute',
|
|
6781
|
+
top: '-2px',
|
|
6782
|
+
right: '-2px',
|
|
6783
|
+
bottom: '-2px',
|
|
6784
|
+
left: '-2px',
|
|
6785
|
+
border: "2px dashed ".concat(coreColors.blackAlpha['300']),
|
|
6786
|
+
borderRadius: '100%',
|
|
6815
6787
|
},
|
|
6816
6788
|
},
|
|
6817
6789
|
},
|
|
6818
|
-
|
|
6790
|
+
test: {
|
|
6819
6791
|
container: {
|
|
6820
|
-
|
|
6821
|
-
|
|
6822
|
-
|
|
6823
|
-
|
|
6824
|
-
|
|
6825
|
-
|
|
6826
|
-
|
|
6827
|
-
|
|
6828
|
-
|
|
6792
|
+
backgroundColor: coreColors.orange['50'],
|
|
6793
|
+
borderColor: coreColors.orange['200'],
|
|
6794
|
+
overflow: 'visible',
|
|
6795
|
+
color: adaptiveColors.icon.light.subtle,
|
|
6796
|
+
_after: {
|
|
6797
|
+
content: "''",
|
|
6798
|
+
position: 'absolute',
|
|
6799
|
+
top: '-2px',
|
|
6800
|
+
right: '-2px',
|
|
6801
|
+
bottom: '-2px',
|
|
6802
|
+
left: '-2px',
|
|
6803
|
+
border: "2px dashed ".concat(coreColors.blackAlpha['200']),
|
|
6804
|
+
borderRadius: '100%',
|
|
6829
6805
|
},
|
|
6830
6806
|
},
|
|
6831
6807
|
},
|
|
@@ -6840,7 +6816,7 @@ exports.AvatarBadgePosition = void 0;
|
|
|
6840
6816
|
AvatarBadgePosition["BottomRight"] = "bottomRight";
|
|
6841
6817
|
})(exports.AvatarBadgePosition || (exports.AvatarBadgePosition = {}));
|
|
6842
6818
|
var AvatarBadge = function (_a) {
|
|
6843
|
-
var avatarSize = _a.avatarSize, badgeIconName = _a.badgeIconName,
|
|
6819
|
+
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
6820
|
var useSmallBadge = React.useMemo(function () { return avatarSize === 'xs' || !badgeIconName; }, [badgeIconName, avatarSize]);
|
|
6845
6821
|
var getBadgeTransform = function (position) {
|
|
6846
6822
|
var _a, _b, _c, _d;
|
|
@@ -6866,20 +6842,9 @@ var AvatarBadge = function (_a) {
|
|
|
6866
6842
|
: "translate(".concat(translation / 3, "px, ").concat(translation / 3, "px)");
|
|
6867
6843
|
}
|
|
6868
6844
|
};
|
|
6869
|
-
return (React__default["default"].createElement(react.AvatarBadge, { color: badgeIconColor
|
|
6845
|
+
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
6846
|
};
|
|
6871
6847
|
|
|
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
6848
|
var getAvatarVariant = function (charCode) {
|
|
6884
6849
|
if (charCode >= 65 && charCode <= 71) {
|
|
6885
6850
|
return exports.AvatarVariant.Blue;
|
|
@@ -6895,29 +6860,69 @@ var getAvatarVariant = function (charCode) {
|
|
|
6895
6860
|
}
|
|
6896
6861
|
};
|
|
6897
6862
|
var Avatar = function (_a) {
|
|
6898
|
-
var _b = _a.
|
|
6863
|
+
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
6864
|
var colors = useTheme().colors;
|
|
6900
|
-
var
|
|
6901
|
-
var
|
|
6902
|
-
var
|
|
6903
|
-
var shouldHideRemoveButton = size === 'xs'
|
|
6904
|
-
var _variant =
|
|
6905
|
-
if (
|
|
6906
|
-
_variant =
|
|
6865
|
+
var _l = __read(React.useState(!!src), 2), isSrcValid = _l[0], setIsSrcValid = _l[1];
|
|
6866
|
+
var _m = __read(React.useState(false), 2), isHoveringAvatar = _m[0], setIsHoveringAvatar = _m[1];
|
|
6867
|
+
var _o = __read(React.useState(false), 2), isHoveringRemoveButton = _o[0], setIsHoveringRemoveButton = _o[1];
|
|
6868
|
+
var shouldHideRemoveButton = size === 'xs';
|
|
6869
|
+
var _variant = variant;
|
|
6870
|
+
if (randomizeVariant) {
|
|
6871
|
+
_variant = getAvatarVariant(name.charCodeAt(0));
|
|
6907
6872
|
}
|
|
6908
|
-
|
|
6909
|
-
_variant
|
|
6910
|
-
|
|
6911
|
-
|
|
6912
|
-
|
|
6873
|
+
var hoverActiveStyles = React.useMemo(function () {
|
|
6874
|
+
switch (_variant) {
|
|
6875
|
+
case exports.AvatarVariant.Comet:
|
|
6876
|
+
return {
|
|
6877
|
+
_hover: {
|
|
6878
|
+
backgroundColor: colors.gray[100],
|
|
6879
|
+
},
|
|
6880
|
+
_active: {
|
|
6881
|
+
backgroundColor: colors.gray[200],
|
|
6882
|
+
},
|
|
6883
|
+
};
|
|
6884
|
+
case exports.AvatarVariant.Dark:
|
|
6885
|
+
return {
|
|
6886
|
+
_hover: {
|
|
6887
|
+
backgroundColor: colors.blue[700],
|
|
6888
|
+
},
|
|
6889
|
+
_active: {
|
|
6890
|
+
backgroundColor: colors.blue[600],
|
|
6891
|
+
},
|
|
6892
|
+
};
|
|
6893
|
+
case exports.AvatarVariant.Dashed:
|
|
6894
|
+
return {
|
|
6895
|
+
_hover: {
|
|
6896
|
+
backgroundColor: colors.blackAlpha[100],
|
|
6897
|
+
},
|
|
6898
|
+
_active: {
|
|
6899
|
+
backgroundColor: colors.blackAlpha[200],
|
|
6900
|
+
},
|
|
6901
|
+
};
|
|
6902
|
+
case exports.AvatarVariant.Test:
|
|
6903
|
+
return {
|
|
6904
|
+
_hover: {
|
|
6905
|
+
backgroundColor: colors.background.warning,
|
|
6906
|
+
},
|
|
6907
|
+
_active: {
|
|
6908
|
+
backgroundColor: colors.orange[200],
|
|
6909
|
+
},
|
|
6910
|
+
};
|
|
6911
|
+
default:
|
|
6912
|
+
return {
|
|
6913
|
+
_hover: {
|
|
6914
|
+
backgroundColor: colors.gray[50],
|
|
6915
|
+
},
|
|
6916
|
+
_active: {
|
|
6917
|
+
backgroundColor: colors.gray[100],
|
|
6918
|
+
},
|
|
6919
|
+
};
|
|
6920
|
+
}
|
|
6921
|
+
}, [_variant, colors]);
|
|
6922
|
+
var avatarMarkup = (React__default["default"].createElement(react.Avatar, __assign({ name: iconName ? '' : name, src: src, size: size, variant: _variant, boxShadow: "0 0 0 1px ".concat(hideBorder ? colors.transparent : colors.white), borderWidth: isSrcValid || hideBorder ? '0px' : '2px' }, (iconName && {
|
|
6913
6923
|
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); } },
|
|
6924
|
+
}), (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),
|
|
6925
|
+
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
6926
|
React__default["default"].createElement(Icon, { name: "closeCircle", size: isHoveringRemoveButton ? 'sm' : 'xs', colorToken: "default" }))),
|
|
6922
6927
|
showBadge && React__default["default"].createElement(AvatarBadge, __assign({ avatarSize: size }, badgeProps))));
|
|
6923
6928
|
if (showTooltip) {
|
|
@@ -6931,7 +6936,7 @@ var AvatarGroup = function (_a) {
|
|
|
6931
6936
|
var mergedNames = React.useMemo(function () { return avatars.map(function (avatar) { return avatar.name; }).join(', '); }, [avatars]);
|
|
6932
6937
|
var spacing = size === 'lg' || size === 'md' ? -2 : -1;
|
|
6933
6938
|
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.
|
|
6939
|
+
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
6940
|
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
6941
|
};
|
|
6937
6942
|
|