@heroui/avatar 2.2.7 → 2.2.8
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/LICENSE +1 -1
- package/README.md +2 -2
- package/package.json +10 -10
- package/dist/avatar-group-context.d.ts +0 -13
- package/dist/avatar-group-context.js +0 -37
- package/dist/avatar-group-context.mjs +0 -9
- package/dist/avatar-group.d.ts +0 -14
- package/dist/avatar-group.js +0 -340
- package/dist/avatar-group.mjs +0 -12
- package/dist/avatar-icon.d.ts +0 -5
- package/dist/avatar-icon.js +0 -58
- package/dist/avatar-icon.mjs +0 -7
- package/dist/avatar.d.ts +0 -12
- package/dist/avatar.js +0 -236
- package/dist/avatar.mjs +0 -10
- package/dist/chunk-25E6VDTZ.mjs +0 -35
- package/dist/chunk-JUJ53SJZ.mjs +0 -13
- package/dist/chunk-LTC67JRI.mjs +0 -138
- package/dist/chunk-NB7VH5TP.mjs +0 -38
- package/dist/chunk-QH65JCLF.mjs +0 -85
- package/dist/chunk-SXMLSBOY.mjs +0 -50
- package/dist/index.d.ts +0 -12
- package/dist/index.js +0 -358
- package/dist/index.mjs +0 -29
- package/dist/use-avatar-group.d.ts +0 -67
- package/dist/use-avatar-group.js +0 -108
- package/dist/use-avatar-group.mjs +0 -7
- package/dist/use-avatar.d.ts +0 -207
- package/dist/use-avatar.js +0 -167
- package/dist/use-avatar.mjs +0 -8
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -15,10 +15,10 @@ npm i @heroui/avatar
|
|
|
15
15
|
## Contribution
|
|
16
16
|
|
|
17
17
|
Yes please! See the
|
|
18
|
-
[contributing guidelines](https://github.com/
|
|
18
|
+
[contributing guidelines](https://github.com/heroui-inc/heroui/blob/master/CONTRIBUTING.md)
|
|
19
19
|
for details.
|
|
20
20
|
|
|
21
21
|
## License
|
|
22
22
|
|
|
23
23
|
This project is licensed under the terms of the
|
|
24
|
-
[MIT license](https://github.com/
|
|
24
|
+
[MIT license](https://github.com/heroui-inc/heroui/blob/master/LICENSE).
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@heroui/avatar",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.8",
|
|
4
4
|
"description": "The Avatar component is used to represent a user, and displays the profile picture, initials or fallback icon.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"avatar"
|
|
7
7
|
],
|
|
8
|
-
"author": "
|
|
8
|
+
"author": "HeroUI <support@heroui.com>",
|
|
9
9
|
"homepage": "https://heroui.com",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"main": "dist/index.js",
|
|
@@ -27,16 +27,16 @@
|
|
|
27
27
|
"peerDependencies": {
|
|
28
28
|
"react": ">=18 || >=19.0.0-rc.0",
|
|
29
29
|
"react-dom": ">=18 || >=19.0.0-rc.0",
|
|
30
|
-
"@heroui/theme": ">=2.4.
|
|
31
|
-
"@heroui/system": ">=2.4.
|
|
30
|
+
"@heroui/theme": ">=2.4.6",
|
|
31
|
+
"@heroui/system": ">=2.4.7"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@react-aria/interactions": "3.
|
|
35
|
-
"@react-aria/focus": "3.19.
|
|
36
|
-
"@react-aria/utils": "3.
|
|
37
|
-
"@heroui/shared-utils": "2.1.
|
|
38
|
-
"@heroui/react-utils": "2.1.
|
|
39
|
-
"@heroui/use-image": "2.1.
|
|
34
|
+
"@react-aria/interactions": "3.23.0",
|
|
35
|
+
"@react-aria/focus": "3.19.1",
|
|
36
|
+
"@react-aria/utils": "3.27.0",
|
|
37
|
+
"@heroui/shared-utils": "2.1.4",
|
|
38
|
+
"@heroui/react-utils": "2.1.5",
|
|
39
|
+
"@heroui/use-image": "2.1.4"
|
|
40
40
|
},
|
|
41
41
|
"clean-package": "../../../clean-package.config.json",
|
|
42
42
|
"module": "dist/index.mjs",
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import * as react from 'react';
|
|
2
|
-
import { ContextType } from './use-avatar-group.js';
|
|
3
|
-
import '@heroui/system';
|
|
4
|
-
import '@heroui/theme';
|
|
5
|
-
import '@heroui/react-utils';
|
|
6
|
-
import './avatar.js';
|
|
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 };
|
|
@@ -1,37 +0,0 @@
|
|
|
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("@heroui/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
|
-
});
|
package/dist/avatar-group.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import * as _heroui_system from '@heroui/system';
|
|
2
|
-
import { UseAvatarGroupProps } from './use-avatar-group.js';
|
|
3
|
-
import 'react';
|
|
4
|
-
import '@heroui/theme';
|
|
5
|
-
import '@heroui/react-utils';
|
|
6
|
-
import './avatar.js';
|
|
7
|
-
import './use-avatar.js';
|
|
8
|
-
import 'tailwind-variants';
|
|
9
|
-
|
|
10
|
-
interface AvatarGroupProps extends UseAvatarGroupProps {
|
|
11
|
-
}
|
|
12
|
-
declare const AvatarGroup: _heroui_system.InternalForwardRefRenderFunction<"div", AvatarGroupProps, never>;
|
|
13
|
-
|
|
14
|
-
export { AvatarGroupProps, AvatarGroup as default };
|
package/dist/avatar-group.js
DELETED
|
@@ -1,340 +0,0 @@
|
|
|
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.tsx
|
|
22
|
-
var avatar_group_exports = {};
|
|
23
|
-
__export(avatar_group_exports, {
|
|
24
|
-
default: () => avatar_group_default
|
|
25
|
-
});
|
|
26
|
-
module.exports = __toCommonJS(avatar_group_exports);
|
|
27
|
-
var import_system3 = require("@heroui/system");
|
|
28
|
-
|
|
29
|
-
// src/avatar-group-context.ts
|
|
30
|
-
var import_react_utils = require("@heroui/react-utils");
|
|
31
|
-
var [AvatarGroupProvider, useAvatarGroupContext] = (0, import_react_utils.createContext)({
|
|
32
|
-
name: "AvatarGroupContext",
|
|
33
|
-
strict: false
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
// src/use-avatar-group.ts
|
|
37
|
-
var import_theme = require("@heroui/theme");
|
|
38
|
-
var import_react_utils2 = require("@heroui/react-utils");
|
|
39
|
-
var import_shared_utils = require("@heroui/shared-utils");
|
|
40
|
-
var import_react_utils3 = require("@heroui/react-utils");
|
|
41
|
-
var import_react = require("react");
|
|
42
|
-
function useAvatarGroup(props = {}) {
|
|
43
|
-
const {
|
|
44
|
-
as,
|
|
45
|
-
ref,
|
|
46
|
-
max = 5,
|
|
47
|
-
total,
|
|
48
|
-
size,
|
|
49
|
-
color,
|
|
50
|
-
radius,
|
|
51
|
-
children,
|
|
52
|
-
isBordered,
|
|
53
|
-
isDisabled,
|
|
54
|
-
isGrid,
|
|
55
|
-
renderCount,
|
|
56
|
-
className,
|
|
57
|
-
classNames,
|
|
58
|
-
...otherProps
|
|
59
|
-
} = props;
|
|
60
|
-
const domRef = (0, import_react_utils2.useDOMRef)(ref);
|
|
61
|
-
const Component = as || "div";
|
|
62
|
-
const context = (0, import_react.useMemo)(
|
|
63
|
-
() => ({
|
|
64
|
-
size,
|
|
65
|
-
color,
|
|
66
|
-
radius,
|
|
67
|
-
isGrid,
|
|
68
|
-
isBordered,
|
|
69
|
-
isDisabled
|
|
70
|
-
}),
|
|
71
|
-
[size, color, radius, isGrid, isBordered, isDisabled]
|
|
72
|
-
);
|
|
73
|
-
const slots = (0, import_react.useMemo)(() => (0, import_theme.avatarGroup)({ className, isGrid }), [className, isGrid]);
|
|
74
|
-
const validChildren = (0, import_react_utils3.getValidChildren)(children);
|
|
75
|
-
const childrenWithinMax = max ? validChildren.slice(0, max) : validChildren;
|
|
76
|
-
const remainingCount = total ? total : max != null ? validChildren.length - max : -1;
|
|
77
|
-
const clones = childrenWithinMax.map((child, index) => {
|
|
78
|
-
const isFirstAvatar = index === 0;
|
|
79
|
-
const isLastAvatar = index === childrenWithinMax.length - 1;
|
|
80
|
-
const childProps = {
|
|
81
|
-
className: (0, import_shared_utils.clsx)(
|
|
82
|
-
isFirstAvatar ? "ms-0" : !isGrid ? "-ms-2" : "",
|
|
83
|
-
isLastAvatar && remainingCount < 1 ? "hover:-translate-x-0" : ""
|
|
84
|
-
)
|
|
85
|
-
};
|
|
86
|
-
return (0, import_react.cloneElement)(child, (0, import_shared_utils.compact)(childProps));
|
|
87
|
-
});
|
|
88
|
-
const getAvatarGroupProps = () => {
|
|
89
|
-
return {
|
|
90
|
-
ref: domRef,
|
|
91
|
-
className: slots.base({
|
|
92
|
-
class: (0, import_shared_utils.clsx)(classNames == null ? void 0 : classNames.base, className)
|
|
93
|
-
}),
|
|
94
|
-
role: "group",
|
|
95
|
-
...otherProps
|
|
96
|
-
};
|
|
97
|
-
};
|
|
98
|
-
const getAvatarGroupCountProps = () => {
|
|
99
|
-
return {
|
|
100
|
-
className: slots.count({
|
|
101
|
-
class: classNames == null ? void 0 : classNames.count
|
|
102
|
-
})
|
|
103
|
-
};
|
|
104
|
-
};
|
|
105
|
-
return {
|
|
106
|
-
Component,
|
|
107
|
-
context,
|
|
108
|
-
remainingCount,
|
|
109
|
-
clones,
|
|
110
|
-
renderCount,
|
|
111
|
-
getAvatarGroupProps,
|
|
112
|
-
getAvatarGroupCountProps
|
|
113
|
-
};
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
// src/avatar.tsx
|
|
117
|
-
var import_react3 = require("react");
|
|
118
|
-
var import_system2 = require("@heroui/system");
|
|
119
|
-
|
|
120
|
-
// src/avatar-icon.tsx
|
|
121
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
122
|
-
var AvatarIcon = () => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
123
|
-
"svg",
|
|
124
|
-
{
|
|
125
|
-
"aria-hidden": "true",
|
|
126
|
-
fill: "none",
|
|
127
|
-
height: "80%",
|
|
128
|
-
role: "presentation",
|
|
129
|
-
viewBox: "0 0 24 24",
|
|
130
|
-
width: "80%",
|
|
131
|
-
children: [
|
|
132
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
133
|
-
"path",
|
|
134
|
-
{
|
|
135
|
-
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",
|
|
136
|
-
fill: "currentColor"
|
|
137
|
-
}
|
|
138
|
-
),
|
|
139
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
140
|
-
"path",
|
|
141
|
-
{
|
|
142
|
-
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",
|
|
143
|
-
fill: "currentColor"
|
|
144
|
-
}
|
|
145
|
-
)
|
|
146
|
-
]
|
|
147
|
-
}
|
|
148
|
-
);
|
|
149
|
-
|
|
150
|
-
// src/use-avatar.ts
|
|
151
|
-
var import_theme2 = require("@heroui/theme");
|
|
152
|
-
var import_system = require("@heroui/system");
|
|
153
|
-
var import_utils = require("@react-aria/utils");
|
|
154
|
-
var import_react_utils4 = require("@heroui/react-utils");
|
|
155
|
-
var import_shared_utils2 = require("@heroui/shared-utils");
|
|
156
|
-
var import_focus = require("@react-aria/focus");
|
|
157
|
-
var import_react2 = require("react");
|
|
158
|
-
var import_use_image = require("@heroui/use-image");
|
|
159
|
-
var import_interactions = require("@react-aria/interactions");
|
|
160
|
-
function useAvatar(originalProps = {}) {
|
|
161
|
-
var _a, _b, _c, _d, _e, _f;
|
|
162
|
-
const globalContext = (0, import_system.useProviderContext)();
|
|
163
|
-
const groupContext = useAvatarGroupContext();
|
|
164
|
-
const isInGroup = !!groupContext;
|
|
165
|
-
const {
|
|
166
|
-
as,
|
|
167
|
-
ref,
|
|
168
|
-
src,
|
|
169
|
-
name,
|
|
170
|
-
icon,
|
|
171
|
-
classNames,
|
|
172
|
-
fallback,
|
|
173
|
-
alt = name || "avatar",
|
|
174
|
-
imgRef: imgRefProp,
|
|
175
|
-
color = (_a = groupContext == null ? void 0 : groupContext.color) != null ? _a : "default",
|
|
176
|
-
radius = (_b = groupContext == null ? void 0 : groupContext.radius) != null ? _b : "full",
|
|
177
|
-
size = (_c = groupContext == null ? void 0 : groupContext.size) != null ? _c : "md",
|
|
178
|
-
isBordered = (_d = groupContext == null ? void 0 : groupContext.isBordered) != null ? _d : false,
|
|
179
|
-
isDisabled = (_e = groupContext == null ? void 0 : groupContext.isDisabled) != null ? _e : false,
|
|
180
|
-
isFocusable = false,
|
|
181
|
-
getInitials = import_shared_utils2.safeText,
|
|
182
|
-
ignoreFallback = false,
|
|
183
|
-
showFallback: showFallbackProp = false,
|
|
184
|
-
ImgComponent = "img",
|
|
185
|
-
imgProps,
|
|
186
|
-
className,
|
|
187
|
-
onError,
|
|
188
|
-
disableAnimation: disableAnimationProp,
|
|
189
|
-
...otherProps
|
|
190
|
-
} = originalProps;
|
|
191
|
-
const Component = as || "span";
|
|
192
|
-
const domRef = (0, import_react_utils4.useDOMRef)(ref);
|
|
193
|
-
const imgRef = (0, import_react_utils4.useDOMRef)(imgRefProp);
|
|
194
|
-
const { isFocusVisible, isFocused, focusProps } = (0, import_focus.useFocusRing)();
|
|
195
|
-
const { isHovered, hoverProps } = (0, import_interactions.useHover)({ isDisabled });
|
|
196
|
-
const disableAnimation = (_f = disableAnimationProp != null ? disableAnimationProp : globalContext == null ? void 0 : globalContext.disableAnimation) != null ? _f : false;
|
|
197
|
-
const imageStatus = (0, import_use_image.useImage)({ src, onError, ignoreFallback });
|
|
198
|
-
const isImgLoaded = imageStatus === "loaded";
|
|
199
|
-
const shouldFilterDOMProps = typeof ImgComponent === "string";
|
|
200
|
-
const showFallback = (!src || !isImgLoaded) && showFallbackProp;
|
|
201
|
-
const slots = (0, import_react2.useMemo)(
|
|
202
|
-
() => {
|
|
203
|
-
var _a2;
|
|
204
|
-
return (0, import_theme2.avatar)({
|
|
205
|
-
color,
|
|
206
|
-
radius,
|
|
207
|
-
size,
|
|
208
|
-
isBordered,
|
|
209
|
-
isDisabled,
|
|
210
|
-
isInGroup,
|
|
211
|
-
disableAnimation,
|
|
212
|
-
isInGridGroup: (_a2 = groupContext == null ? void 0 : groupContext.isGrid) != null ? _a2 : false
|
|
213
|
-
});
|
|
214
|
-
},
|
|
215
|
-
[
|
|
216
|
-
color,
|
|
217
|
-
radius,
|
|
218
|
-
size,
|
|
219
|
-
isBordered,
|
|
220
|
-
isDisabled,
|
|
221
|
-
disableAnimation,
|
|
222
|
-
isInGroup,
|
|
223
|
-
groupContext == null ? void 0 : groupContext.isGrid
|
|
224
|
-
]
|
|
225
|
-
);
|
|
226
|
-
const baseStyles = (0, import_shared_utils2.clsx)(classNames == null ? void 0 : classNames.base, className);
|
|
227
|
-
const canBeFocused = (0, import_react2.useMemo)(() => {
|
|
228
|
-
return isFocusable || as === "button";
|
|
229
|
-
}, [isFocusable, as]);
|
|
230
|
-
const getAvatarProps = (0, import_react2.useCallback)(
|
|
231
|
-
(props = {}) => ({
|
|
232
|
-
ref: domRef,
|
|
233
|
-
tabIndex: canBeFocused ? 0 : -1,
|
|
234
|
-
"data-hover": (0, import_shared_utils2.dataAttr)(isHovered),
|
|
235
|
-
"data-focus": (0, import_shared_utils2.dataAttr)(isFocused),
|
|
236
|
-
"data-focus-visible": (0, import_shared_utils2.dataAttr)(isFocusVisible),
|
|
237
|
-
className: slots.base({
|
|
238
|
-
class: (0, import_shared_utils2.clsx)(baseStyles, props == null ? void 0 : props.className)
|
|
239
|
-
}),
|
|
240
|
-
...(0, import_utils.mergeProps)(otherProps, hoverProps, canBeFocused ? focusProps : {})
|
|
241
|
-
}),
|
|
242
|
-
[canBeFocused, slots, baseStyles, focusProps, otherProps]
|
|
243
|
-
);
|
|
244
|
-
const getImageProps = (0, import_react2.useCallback)(
|
|
245
|
-
(props = {}) => ({
|
|
246
|
-
ref: imgRef,
|
|
247
|
-
src,
|
|
248
|
-
"data-loaded": (0, import_shared_utils2.dataAttr)(isImgLoaded),
|
|
249
|
-
className: slots.img({ class: classNames == null ? void 0 : classNames.img }),
|
|
250
|
-
...(0, import_utils.mergeProps)(
|
|
251
|
-
imgProps,
|
|
252
|
-
props,
|
|
253
|
-
(0, import_react_utils4.filterDOMProps)({ disableAnimation }, {
|
|
254
|
-
enabled: shouldFilterDOMProps
|
|
255
|
-
})
|
|
256
|
-
)
|
|
257
|
-
}),
|
|
258
|
-
[slots, isImgLoaded, imgProps, disableAnimation, src, imgRef, shouldFilterDOMProps]
|
|
259
|
-
);
|
|
260
|
-
return {
|
|
261
|
-
Component,
|
|
262
|
-
ImgComponent,
|
|
263
|
-
src,
|
|
264
|
-
alt,
|
|
265
|
-
icon,
|
|
266
|
-
name,
|
|
267
|
-
imgRef,
|
|
268
|
-
slots,
|
|
269
|
-
classNames,
|
|
270
|
-
fallback,
|
|
271
|
-
isImgLoaded,
|
|
272
|
-
showFallback,
|
|
273
|
-
ignoreFallback,
|
|
274
|
-
getInitials,
|
|
275
|
-
getAvatarProps,
|
|
276
|
-
getImageProps
|
|
277
|
-
};
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
// src/avatar.tsx
|
|
281
|
-
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
282
|
-
var Avatar = (0, import_system2.forwardRef)((props, ref) => {
|
|
283
|
-
const {
|
|
284
|
-
Component,
|
|
285
|
-
ImgComponent,
|
|
286
|
-
src,
|
|
287
|
-
icon = /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(AvatarIcon, {}),
|
|
288
|
-
alt,
|
|
289
|
-
classNames,
|
|
290
|
-
slots,
|
|
291
|
-
name,
|
|
292
|
-
showFallback,
|
|
293
|
-
fallback: fallbackComponent,
|
|
294
|
-
getInitials,
|
|
295
|
-
getAvatarProps,
|
|
296
|
-
getImageProps
|
|
297
|
-
} = useAvatar({
|
|
298
|
-
...props,
|
|
299
|
-
ref
|
|
300
|
-
});
|
|
301
|
-
const fallback = (0, import_react3.useMemo)(() => {
|
|
302
|
-
if (!showFallback && src)
|
|
303
|
-
return null;
|
|
304
|
-
if (fallbackComponent) {
|
|
305
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { "aria-label": alt, className: slots.fallback({ class: classNames == null ? void 0 : classNames.fallback }), role: "img", children: fallbackComponent });
|
|
306
|
-
}
|
|
307
|
-
return name ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { "aria-label": alt, className: slots.name({ class: classNames == null ? void 0 : classNames.name }), role: "img", children: getInitials(name) }) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { "aria-label": alt, className: slots.icon({ class: classNames == null ? void 0 : classNames.icon }), role: "img", children: icon });
|
|
308
|
-
}, [showFallback, src, fallbackComponent, name, classNames]);
|
|
309
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Component, { ...getAvatarProps(), children: [
|
|
310
|
-
src && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(ImgComponent, { ...getImageProps(), alt }),
|
|
311
|
-
fallback
|
|
312
|
-
] });
|
|
313
|
-
});
|
|
314
|
-
Avatar.displayName = "HeroUI.Avatar";
|
|
315
|
-
var avatar_default = Avatar;
|
|
316
|
-
|
|
317
|
-
// src/avatar-group.tsx
|
|
318
|
-
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
319
|
-
var AvatarGroup = (0, import_system3.forwardRef)((props, ref) => {
|
|
320
|
-
const {
|
|
321
|
-
Component,
|
|
322
|
-
clones,
|
|
323
|
-
context,
|
|
324
|
-
remainingCount,
|
|
325
|
-
getAvatarGroupCountProps,
|
|
326
|
-
getAvatarGroupProps,
|
|
327
|
-
renderCount = (count) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(avatar_default, { ...getAvatarGroupCountProps(), name: `+${count}` })
|
|
328
|
-
} = useAvatarGroup({
|
|
329
|
-
...props,
|
|
330
|
-
ref
|
|
331
|
-
});
|
|
332
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Component, { ...getAvatarGroupProps(), children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(AvatarGroupProvider, { value: context, children: [
|
|
333
|
-
clones,
|
|
334
|
-
remainingCount > 0 && renderCount(remainingCount)
|
|
335
|
-
] }) });
|
|
336
|
-
});
|
|
337
|
-
AvatarGroup.displayName = "HeroUI.AvatarGroup";
|
|
338
|
-
var avatar_group_default = AvatarGroup;
|
|
339
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
340
|
-
0 && (module.exports = {});
|
package/dist/avatar-group.mjs
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import {
|
|
3
|
-
avatar_group_default
|
|
4
|
-
} from "./chunk-NB7VH5TP.mjs";
|
|
5
|
-
import "./chunk-SXMLSBOY.mjs";
|
|
6
|
-
import "./chunk-25E6VDTZ.mjs";
|
|
7
|
-
import "./chunk-QH65JCLF.mjs";
|
|
8
|
-
import "./chunk-LTC67JRI.mjs";
|
|
9
|
-
import "./chunk-JUJ53SJZ.mjs";
|
|
10
|
-
export {
|
|
11
|
-
avatar_group_default as default
|
|
12
|
-
};
|
package/dist/avatar-icon.d.ts
DELETED
package/dist/avatar-icon.js
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
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-icon.tsx
|
|
22
|
-
var avatar_icon_exports = {};
|
|
23
|
-
__export(avatar_icon_exports, {
|
|
24
|
-
AvatarIcon: () => AvatarIcon
|
|
25
|
-
});
|
|
26
|
-
module.exports = __toCommonJS(avatar_icon_exports);
|
|
27
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
28
|
-
var AvatarIcon = () => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
29
|
-
"svg",
|
|
30
|
-
{
|
|
31
|
-
"aria-hidden": "true",
|
|
32
|
-
fill: "none",
|
|
33
|
-
height: "80%",
|
|
34
|
-
role: "presentation",
|
|
35
|
-
viewBox: "0 0 24 24",
|
|
36
|
-
width: "80%",
|
|
37
|
-
children: [
|
|
38
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
39
|
-
"path",
|
|
40
|
-
{
|
|
41
|
-
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",
|
|
42
|
-
fill: "currentColor"
|
|
43
|
-
}
|
|
44
|
-
),
|
|
45
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
46
|
-
"path",
|
|
47
|
-
{
|
|
48
|
-
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",
|
|
49
|
-
fill: "currentColor"
|
|
50
|
-
}
|
|
51
|
-
)
|
|
52
|
-
]
|
|
53
|
-
}
|
|
54
|
-
);
|
|
55
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
56
|
-
0 && (module.exports = {
|
|
57
|
-
AvatarIcon
|
|
58
|
-
});
|
package/dist/avatar-icon.mjs
DELETED
package/dist/avatar.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import * as _heroui_system from '@heroui/system';
|
|
2
|
-
import { UseAvatarProps } from './use-avatar.js';
|
|
3
|
-
import 'tailwind-variants';
|
|
4
|
-
import 'react';
|
|
5
|
-
import '@heroui/theme';
|
|
6
|
-
import '@heroui/react-utils';
|
|
7
|
-
|
|
8
|
-
interface AvatarProps extends UseAvatarProps {
|
|
9
|
-
}
|
|
10
|
-
declare const Avatar: _heroui_system.InternalForwardRefRenderFunction<"span", AvatarProps, never>;
|
|
11
|
-
|
|
12
|
-
export { AvatarProps, Avatar as default };
|