@kopexa/avatar 1.0.0 → 1.0.2
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/dist/avatar-group.context.d.mts +13 -0
- package/dist/avatar-group.context.d.ts +13 -0
- package/dist/avatar-group.context.js +37 -0
- package/dist/avatar-group.context.mjs +9 -0
- package/dist/avatar-group.d.mts +14 -0
- package/dist/avatar-group.d.ts +14 -0
- package/dist/avatar-group.js +306 -0
- package/dist/avatar-group.mjs +11 -0
- package/dist/avatar.d.mts +7 -17
- package/dist/avatar.d.ts +7 -17
- package/dist/avatar.js +135 -63
- package/dist/avatar.mjs +3 -1
- package/dist/chunk-CI55TF4E.mjs +118 -0
- package/dist/chunk-FBUAHX2S.mjs +13 -0
- package/dist/chunk-HBUPEI6X.mjs +30 -0
- package/dist/chunk-J37VYVJO.mjs +83 -0
- package/dist/chunk-KPWT5YIU.mjs +67 -0
- package/dist/index.d.mts +5 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.js +231 -65
- package/dist/index.mjs +9 -2
- package/dist/use-avatar-group.d.mts +51 -0
- package/dist/use-avatar-group.d.ts +51 -0
- package/dist/use-avatar-group.js +104 -0
- package/dist/use-avatar-group.mjs +7 -0
- package/dist/use-avatar.d.mts +136 -0
- package/dist/use-avatar.d.ts +136 -0
- package/dist/use-avatar.js +141 -0
- package/dist/use-avatar.mjs +8 -0
- package/package.json +4 -4
- package/dist/chunk-EVKHBB7E.mjs +0 -109
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { ContextType } from './use-avatar-group.mjs';
|
|
3
|
+
import '@kopexa/react-utils';
|
|
4
|
+
import '@kopexa/theme';
|
|
5
|
+
import './avatar.mjs';
|
|
6
|
+
import 'react/jsx-runtime';
|
|
7
|
+
import './use-avatar.mjs';
|
|
8
|
+
import 'tailwind-variants';
|
|
9
|
+
|
|
10
|
+
declare const AvatarGroupProvider: react.Provider<ContextType>;
|
|
11
|
+
declare const useAvatarGroupContext: () => ContextType;
|
|
12
|
+
|
|
13
|
+
export { AvatarGroupProvider, useAvatarGroupContext };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { ContextType } from './use-avatar-group.js';
|
|
3
|
+
import '@kopexa/react-utils';
|
|
4
|
+
import '@kopexa/theme';
|
|
5
|
+
import './avatar.js';
|
|
6
|
+
import 'react/jsx-runtime';
|
|
7
|
+
import './use-avatar.js';
|
|
8
|
+
import 'tailwind-variants';
|
|
9
|
+
|
|
10
|
+
declare const AvatarGroupProvider: react.Provider<ContextType>;
|
|
11
|
+
declare const useAvatarGroupContext: () => ContextType;
|
|
12
|
+
|
|
13
|
+
export { AvatarGroupProvider, useAvatarGroupContext };
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use strict";
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
+
|
|
21
|
+
// src/avatar-group.context.ts
|
|
22
|
+
var avatar_group_context_exports = {};
|
|
23
|
+
__export(avatar_group_context_exports, {
|
|
24
|
+
AvatarGroupProvider: () => AvatarGroupProvider,
|
|
25
|
+
useAvatarGroupContext: () => useAvatarGroupContext
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(avatar_group_context_exports);
|
|
28
|
+
var import_react_utils = require("@kopexa/react-utils");
|
|
29
|
+
var [AvatarGroupProvider, useAvatarGroupContext] = (0, import_react_utils.createContext)({
|
|
30
|
+
name: "AvatarGroupContext",
|
|
31
|
+
strict: false
|
|
32
|
+
});
|
|
33
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
34
|
+
0 && (module.exports = {
|
|
35
|
+
AvatarGroupProvider,
|
|
36
|
+
useAvatarGroupContext
|
|
37
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import './avatar.mjs';
|
|
2
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
3
|
+
import { UseAvatarGroupProps } from './use-avatar-group.mjs';
|
|
4
|
+
import './use-avatar.mjs';
|
|
5
|
+
import 'tailwind-variants';
|
|
6
|
+
import '@kopexa/react-utils';
|
|
7
|
+
import '@kopexa/theme';
|
|
8
|
+
import 'react';
|
|
9
|
+
|
|
10
|
+
interface AvatarGroupProps extends UseAvatarGroupProps {
|
|
11
|
+
}
|
|
12
|
+
declare function AvatarGroup(props: AvatarGroupProps): react_jsx_runtime.JSX.Element;
|
|
13
|
+
|
|
14
|
+
export { AvatarGroup, type AvatarGroupProps };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import './avatar.js';
|
|
2
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
3
|
+
import { UseAvatarGroupProps } from './use-avatar-group.js';
|
|
4
|
+
import './use-avatar.js';
|
|
5
|
+
import 'tailwind-variants';
|
|
6
|
+
import '@kopexa/react-utils';
|
|
7
|
+
import '@kopexa/theme';
|
|
8
|
+
import 'react';
|
|
9
|
+
|
|
10
|
+
interface AvatarGroupProps extends UseAvatarGroupProps {
|
|
11
|
+
}
|
|
12
|
+
declare function AvatarGroup(props: AvatarGroupProps): react_jsx_runtime.JSX.Element;
|
|
13
|
+
|
|
14
|
+
export { AvatarGroup, type AvatarGroupProps };
|
|
@@ -0,0 +1,306 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use strict";
|
|
3
|
+
var __create = Object.create;
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __export = (target, all) => {
|
|
10
|
+
for (var name in all)
|
|
11
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
12
|
+
};
|
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from))
|
|
16
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
17
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
18
|
+
}
|
|
19
|
+
return to;
|
|
20
|
+
};
|
|
21
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
22
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
23
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
24
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
25
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
26
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
27
|
+
mod
|
|
28
|
+
));
|
|
29
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
30
|
+
|
|
31
|
+
// src/avatar-group.tsx
|
|
32
|
+
var avatar_group_exports = {};
|
|
33
|
+
__export(avatar_group_exports, {
|
|
34
|
+
AvatarGroup: () => AvatarGroup
|
|
35
|
+
});
|
|
36
|
+
module.exports = __toCommonJS(avatar_group_exports);
|
|
37
|
+
|
|
38
|
+
// src/avatar.tsx
|
|
39
|
+
var import_shared_utils2 = require("@kopexa/shared-utils");
|
|
40
|
+
var AvatarPrimitive = __toESM(require("@radix-ui/react-avatar"));
|
|
41
|
+
|
|
42
|
+
// src/use-avatar.ts
|
|
43
|
+
var import_shared_utils = require("@kopexa/shared-utils");
|
|
44
|
+
var import_theme = require("@kopexa/theme");
|
|
45
|
+
var import_react = require("react");
|
|
46
|
+
|
|
47
|
+
// src/avatar-group.context.ts
|
|
48
|
+
var import_react_utils = require("@kopexa/react-utils");
|
|
49
|
+
var [AvatarGroupProvider, useAvatarGroupContext] = (0, import_react_utils.createContext)({
|
|
50
|
+
name: "AvatarGroupContext",
|
|
51
|
+
strict: false
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
// src/use-avatar.ts
|
|
55
|
+
function useAvatar(originalProps = {}) {
|
|
56
|
+
var _a, _b, _c, _d, _e;
|
|
57
|
+
const groupContext = useAvatarGroupContext();
|
|
58
|
+
const isInGroup = !!groupContext;
|
|
59
|
+
const {
|
|
60
|
+
ref,
|
|
61
|
+
src,
|
|
62
|
+
name,
|
|
63
|
+
classNames,
|
|
64
|
+
alt = name || "avatar",
|
|
65
|
+
imgRef: imgRefProp,
|
|
66
|
+
color = (_a = groupContext == null ? void 0 : groupContext.color) != null ? _a : "default",
|
|
67
|
+
radius = (_b = groupContext == null ? void 0 : groupContext.radius) != null ? _b : "full",
|
|
68
|
+
size = (_c = groupContext == null ? void 0 : groupContext.size) != null ? _c : "md",
|
|
69
|
+
isBordered = (_d = groupContext == null ? void 0 : groupContext.isBordered) != null ? _d : false,
|
|
70
|
+
isDisabled = (_e = groupContext == null ? void 0 : groupContext.isDisabled) != null ? _e : false,
|
|
71
|
+
className,
|
|
72
|
+
onError,
|
|
73
|
+
onLoadingStatusChange,
|
|
74
|
+
...otherProps
|
|
75
|
+
} = originalProps;
|
|
76
|
+
const [status, setStatus] = (0, import_react.useState)("idle");
|
|
77
|
+
const handleLoadingStatusChange = (0, import_react.useCallback)(
|
|
78
|
+
(status2) => {
|
|
79
|
+
onLoadingStatusChange == null ? void 0 : onLoadingStatusChange(status2);
|
|
80
|
+
setStatus(status2);
|
|
81
|
+
},
|
|
82
|
+
[onLoadingStatusChange]
|
|
83
|
+
);
|
|
84
|
+
const slots = (0, import_react.useMemo)(
|
|
85
|
+
() => {
|
|
86
|
+
var _a2;
|
|
87
|
+
return (0, import_theme.avatar)({
|
|
88
|
+
color,
|
|
89
|
+
radius,
|
|
90
|
+
size,
|
|
91
|
+
isBordered,
|
|
92
|
+
isDisabled,
|
|
93
|
+
isInGroup,
|
|
94
|
+
isInGridGroup: (_a2 = groupContext == null ? void 0 : groupContext.isGrid) != null ? _a2 : false
|
|
95
|
+
});
|
|
96
|
+
},
|
|
97
|
+
[
|
|
98
|
+
color,
|
|
99
|
+
radius,
|
|
100
|
+
size,
|
|
101
|
+
isBordered,
|
|
102
|
+
isDisabled,
|
|
103
|
+
isInGroup,
|
|
104
|
+
groupContext == null ? void 0 : groupContext.isGrid
|
|
105
|
+
]
|
|
106
|
+
);
|
|
107
|
+
const baseStyles = (0, import_shared_utils.cn)(classNames == null ? void 0 : classNames.root, className);
|
|
108
|
+
const getAvatarProps = (0, import_react.useCallback)(
|
|
109
|
+
(props = {}) => ({
|
|
110
|
+
ref,
|
|
111
|
+
"data-slot": "avatar",
|
|
112
|
+
className: slots.root({
|
|
113
|
+
class: (0, import_shared_utils.cn)(baseStyles, props == null ? void 0 : props.className)
|
|
114
|
+
}),
|
|
115
|
+
...otherProps
|
|
116
|
+
}),
|
|
117
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies: we want to memoize this
|
|
118
|
+
[slots, baseStyles, otherProps, ref]
|
|
119
|
+
);
|
|
120
|
+
const getImageProps = (0, import_react.useCallback)(
|
|
121
|
+
() => ({
|
|
122
|
+
"data-slot": "avatar-image",
|
|
123
|
+
"data-status": status,
|
|
124
|
+
src,
|
|
125
|
+
onLoadingStatusChange: handleLoadingStatusChange,
|
|
126
|
+
ref: imgRefProp,
|
|
127
|
+
alt,
|
|
128
|
+
onError,
|
|
129
|
+
className: slots.img({
|
|
130
|
+
class: classNames == null ? void 0 : classNames.img
|
|
131
|
+
})
|
|
132
|
+
}),
|
|
133
|
+
[
|
|
134
|
+
status,
|
|
135
|
+
src,
|
|
136
|
+
handleLoadingStatusChange,
|
|
137
|
+
imgRefProp,
|
|
138
|
+
alt,
|
|
139
|
+
slots.img,
|
|
140
|
+
classNames == null ? void 0 : classNames.img,
|
|
141
|
+
onError
|
|
142
|
+
]
|
|
143
|
+
);
|
|
144
|
+
return {
|
|
145
|
+
src,
|
|
146
|
+
alt,
|
|
147
|
+
slots,
|
|
148
|
+
classNames,
|
|
149
|
+
name,
|
|
150
|
+
getAvatarProps,
|
|
151
|
+
getImageProps
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
// src/avatar.tsx
|
|
156
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
157
|
+
var Avatar = (props) => {
|
|
158
|
+
const { alt, getAvatarProps, getImageProps, slots, classNames, name } = useAvatar(props);
|
|
159
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(AvatarPrimitive.Root, { ...getAvatarProps(), children: [
|
|
160
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(AvatarPrimitive.Image, { ...getImageProps() }),
|
|
161
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(AvatarPrimitive.Fallback, { "data-slot": "avatar-fallback", children: name ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
162
|
+
"span",
|
|
163
|
+
{
|
|
164
|
+
className: slots.name({
|
|
165
|
+
className: classNames == null ? void 0 : classNames.name
|
|
166
|
+
}),
|
|
167
|
+
role: "img",
|
|
168
|
+
"aria-label": alt,
|
|
169
|
+
children: (0, import_shared_utils2.getInitials)(name)
|
|
170
|
+
}
|
|
171
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
172
|
+
"span",
|
|
173
|
+
{
|
|
174
|
+
className: slots.icon({
|
|
175
|
+
className: classNames == null ? void 0 : classNames.icon
|
|
176
|
+
}),
|
|
177
|
+
role: "img",
|
|
178
|
+
"aria-label": alt,
|
|
179
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AvatarIcon, {})
|
|
180
|
+
}
|
|
181
|
+
) })
|
|
182
|
+
] });
|
|
183
|
+
};
|
|
184
|
+
var AvatarIcon = () => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
185
|
+
"svg",
|
|
186
|
+
{
|
|
187
|
+
"aria-hidden": "true",
|
|
188
|
+
fill: "none",
|
|
189
|
+
height: "80%",
|
|
190
|
+
role: "presentation",
|
|
191
|
+
viewBox: "0 0 24 24",
|
|
192
|
+
width: "80%",
|
|
193
|
+
children: [
|
|
194
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
195
|
+
"path",
|
|
196
|
+
{
|
|
197
|
+
d: "M12 2C9.38 2 7.25 4.13 7.25 6.75C7.25 9.32 9.26 11.4 11.88 11.49C11.96 11.48 12.04 11.48 12.1 11.49C12.12 11.49 12.13 11.49 12.15 11.49C12.16 11.49 12.16 11.49 12.17 11.49C14.73 11.4 16.74 9.32 16.75 6.75C16.75 4.13 14.62 2 12 2Z",
|
|
198
|
+
fill: "currentColor"
|
|
199
|
+
}
|
|
200
|
+
),
|
|
201
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
202
|
+
"path",
|
|
203
|
+
{
|
|
204
|
+
d: "M17.0809 14.1489C14.2909 12.2889 9.74094 12.2889 6.93094 14.1489C5.66094 14.9989 4.96094 16.1489 4.96094 17.3789C4.96094 18.6089 5.66094 19.7489 6.92094 20.5889C8.32094 21.5289 10.1609 21.9989 12.0009 21.9989C13.8409 21.9989 15.6809 21.5289 17.0809 20.5889C18.3409 19.7389 19.0409 18.5989 19.0409 17.3589C19.0309 16.1289 18.3409 14.9889 17.0809 14.1489Z",
|
|
205
|
+
fill: "currentColor"
|
|
206
|
+
}
|
|
207
|
+
)
|
|
208
|
+
]
|
|
209
|
+
}
|
|
210
|
+
);
|
|
211
|
+
|
|
212
|
+
// src/use-avatar-group.ts
|
|
213
|
+
var import_react_utils2 = require("@kopexa/react-utils");
|
|
214
|
+
var import_shared_utils3 = require("@kopexa/shared-utils");
|
|
215
|
+
var import_theme2 = require("@kopexa/theme");
|
|
216
|
+
var import_react2 = require("react");
|
|
217
|
+
function useAvatarGroup(props = {}) {
|
|
218
|
+
const {
|
|
219
|
+
ref,
|
|
220
|
+
max = 5,
|
|
221
|
+
total,
|
|
222
|
+
size,
|
|
223
|
+
color,
|
|
224
|
+
radius,
|
|
225
|
+
children,
|
|
226
|
+
isBordered,
|
|
227
|
+
isDisabled,
|
|
228
|
+
isGrid,
|
|
229
|
+
className,
|
|
230
|
+
classNames,
|
|
231
|
+
...otherProps
|
|
232
|
+
} = props;
|
|
233
|
+
const context = (0, import_react2.useMemo)(
|
|
234
|
+
() => ({
|
|
235
|
+
size,
|
|
236
|
+
color,
|
|
237
|
+
radius,
|
|
238
|
+
isGrid,
|
|
239
|
+
isBordered,
|
|
240
|
+
isDisabled
|
|
241
|
+
}),
|
|
242
|
+
[size, color, radius, isGrid, isBordered, isDisabled]
|
|
243
|
+
);
|
|
244
|
+
const slots = (0, import_react2.useMemo)(
|
|
245
|
+
() => (0, import_theme2.avatarGroup)({ className, isGrid }),
|
|
246
|
+
[className, isGrid]
|
|
247
|
+
);
|
|
248
|
+
const validChildren = (0, import_react_utils2.getValidChildren)(children);
|
|
249
|
+
const childrenWithinMax = max ? validChildren.slice(0, max) : validChildren;
|
|
250
|
+
const remainingCount = total ? total : max != null ? validChildren.length - max : -1;
|
|
251
|
+
const clones = childrenWithinMax.map((child, index) => {
|
|
252
|
+
const isFirstAvatar = index === 0;
|
|
253
|
+
const isLastAvatar = index === childrenWithinMax.length - 1;
|
|
254
|
+
const childProps = {
|
|
255
|
+
className: (0, import_shared_utils3.cn)(
|
|
256
|
+
isFirstAvatar ? "ms-0" : !isGrid ? "-ms-2" : "",
|
|
257
|
+
isLastAvatar && remainingCount < 1 ? "hover:-translate-x-0" : ""
|
|
258
|
+
)
|
|
259
|
+
};
|
|
260
|
+
return (0, import_react2.cloneElement)(child, (0, import_shared_utils3.compact)(childProps));
|
|
261
|
+
});
|
|
262
|
+
const getAvatarGroupProps = () => {
|
|
263
|
+
return {
|
|
264
|
+
ref,
|
|
265
|
+
className: slots.base({
|
|
266
|
+
class: (0, import_shared_utils3.cn)(classNames == null ? void 0 : classNames.base, className)
|
|
267
|
+
}),
|
|
268
|
+
role: "group",
|
|
269
|
+
...otherProps
|
|
270
|
+
};
|
|
271
|
+
};
|
|
272
|
+
const getAvatarGroupCountProps = () => {
|
|
273
|
+
return {
|
|
274
|
+
className: slots.count({
|
|
275
|
+
class: classNames == null ? void 0 : classNames.count
|
|
276
|
+
})
|
|
277
|
+
};
|
|
278
|
+
};
|
|
279
|
+
return {
|
|
280
|
+
context,
|
|
281
|
+
remainingCount,
|
|
282
|
+
clones,
|
|
283
|
+
getAvatarGroupProps,
|
|
284
|
+
getAvatarGroupCountProps
|
|
285
|
+
};
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
// src/avatar-group.tsx
|
|
289
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
290
|
+
function AvatarGroup(props) {
|
|
291
|
+
const {
|
|
292
|
+
clones,
|
|
293
|
+
context,
|
|
294
|
+
remainingCount,
|
|
295
|
+
getAvatarGroupCountProps,
|
|
296
|
+
getAvatarGroupProps
|
|
297
|
+
} = useAvatarGroup(props);
|
|
298
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { ...getAvatarGroupProps(), children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(AvatarGroupProvider, { value: context, children: [
|
|
299
|
+
clones,
|
|
300
|
+
remainingCount > 0 && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Avatar, { ...getAvatarGroupCountProps(), name: `+${remainingCount}` })
|
|
301
|
+
] }) });
|
|
302
|
+
}
|
|
303
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
304
|
+
0 && (module.exports = {
|
|
305
|
+
AvatarGroup
|
|
306
|
+
});
|
package/dist/avatar.d.mts
CHANGED
|
@@ -1,22 +1,12 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import
|
|
2
|
+
import { UseAvatarProps } from './use-avatar.mjs';
|
|
3
|
+
import 'tailwind-variants';
|
|
4
|
+
import '@kopexa/react-utils';
|
|
5
|
+
import '@kopexa/theme';
|
|
6
|
+
import 'react';
|
|
5
7
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* The name of the person in the avatar. -
|
|
10
|
-
* if **src** has loaded, the name will be used as the **alt** attribute of the **img**
|
|
11
|
-
* - If **src** is not loaded, the name will be used to create the initials
|
|
12
|
-
*/
|
|
13
|
-
name?: string;
|
|
14
|
-
src?: string | undefined;
|
|
15
|
-
onLoadingStatusChange?: (status: "idle" | "loading" | "loaded" | "error") => void;
|
|
16
|
-
imgRef?: RefObject<HTMLImageElement | null>;
|
|
17
|
-
alt?: string;
|
|
18
|
-
};
|
|
19
|
-
type AvatarProps = ComponentProps<typeof AvatarPrimitive.Root> & BaseProps & AvatarVariantProps;
|
|
8
|
+
interface AvatarProps extends UseAvatarProps {
|
|
9
|
+
}
|
|
20
10
|
declare const Avatar: (props: AvatarProps) => react_jsx_runtime.JSX.Element;
|
|
21
11
|
|
|
22
12
|
export { Avatar, type AvatarProps };
|
package/dist/avatar.d.ts
CHANGED
|
@@ -1,22 +1,12 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import
|
|
2
|
+
import { UseAvatarProps } from './use-avatar.js';
|
|
3
|
+
import 'tailwind-variants';
|
|
4
|
+
import '@kopexa/react-utils';
|
|
5
|
+
import '@kopexa/theme';
|
|
6
|
+
import 'react';
|
|
5
7
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* The name of the person in the avatar. -
|
|
10
|
-
* if **src** has loaded, the name will be used as the **alt** attribute of the **img**
|
|
11
|
-
* - If **src** is not loaded, the name will be used to create the initials
|
|
12
|
-
*/
|
|
13
|
-
name?: string;
|
|
14
|
-
src?: string | undefined;
|
|
15
|
-
onLoadingStatusChange?: (status: "idle" | "loading" | "loaded" | "error") => void;
|
|
16
|
-
imgRef?: RefObject<HTMLImageElement | null>;
|
|
17
|
-
alt?: string;
|
|
18
|
-
};
|
|
19
|
-
type AvatarProps = ComponentProps<typeof AvatarPrimitive.Root> & BaseProps & AvatarVariantProps;
|
|
8
|
+
interface AvatarProps extends UseAvatarProps {
|
|
9
|
+
}
|
|
20
10
|
declare const Avatar: (props: AvatarProps) => react_jsx_runtime.JSX.Element;
|
|
21
11
|
|
|
22
12
|
export { Avatar, type AvatarProps };
|