@heroui/avatar 2.2.8 → 2.2.10

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.js ADDED
@@ -0,0 +1,233 @@
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.tsx
22
+ var avatar_exports = {};
23
+ __export(avatar_exports, {
24
+ default: () => avatar_default
25
+ });
26
+ module.exports = __toCommonJS(avatar_exports);
27
+ var import_react2 = require("react");
28
+ var import_system2 = require("@heroui/system");
29
+
30
+ // src/avatar-icon.tsx
31
+ var import_jsx_runtime = require("react/jsx-runtime");
32
+ var AvatarIcon = () => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
33
+ "svg",
34
+ {
35
+ "aria-hidden": "true",
36
+ fill: "none",
37
+ height: "80%",
38
+ role: "presentation",
39
+ viewBox: "0 0 24 24",
40
+ width: "80%",
41
+ children: [
42
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
43
+ "path",
44
+ {
45
+ 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",
46
+ fill: "currentColor"
47
+ }
48
+ ),
49
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
50
+ "path",
51
+ {
52
+ 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",
53
+ fill: "currentColor"
54
+ }
55
+ )
56
+ ]
57
+ }
58
+ );
59
+
60
+ // src/use-avatar.ts
61
+ var import_theme = require("@heroui/theme");
62
+ var import_system = require("@heroui/system");
63
+ var import_utils = require("@react-aria/utils");
64
+ var import_react_utils2 = require("@heroui/react-utils");
65
+ var import_shared_utils = require("@heroui/shared-utils");
66
+ var import_focus = require("@react-aria/focus");
67
+ var import_react = require("react");
68
+ var import_use_image = require("@heroui/use-image");
69
+ var import_interactions = require("@react-aria/interactions");
70
+
71
+ // src/avatar-group-context.ts
72
+ var import_react_utils = require("@heroui/react-utils");
73
+ var [AvatarGroupProvider, useAvatarGroupContext] = (0, import_react_utils.createContext)({
74
+ name: "AvatarGroupContext",
75
+ strict: false
76
+ });
77
+
78
+ // src/use-avatar.ts
79
+ function useAvatar(originalProps = {}) {
80
+ var _a, _b, _c, _d, _e, _f;
81
+ const globalContext = (0, import_system.useProviderContext)();
82
+ const groupContext = useAvatarGroupContext();
83
+ const isInGroup = !!groupContext;
84
+ const {
85
+ as,
86
+ ref,
87
+ src,
88
+ name,
89
+ icon,
90
+ classNames,
91
+ fallback,
92
+ alt = name || "avatar",
93
+ imgRef: imgRefProp,
94
+ color = (_a = groupContext == null ? void 0 : groupContext.color) != null ? _a : "default",
95
+ radius = (_b = groupContext == null ? void 0 : groupContext.radius) != null ? _b : "full",
96
+ size = (_c = groupContext == null ? void 0 : groupContext.size) != null ? _c : "md",
97
+ isBordered = (_d = groupContext == null ? void 0 : groupContext.isBordered) != null ? _d : false,
98
+ isDisabled = (_e = groupContext == null ? void 0 : groupContext.isDisabled) != null ? _e : false,
99
+ isFocusable = false,
100
+ getInitials = import_shared_utils.safeText,
101
+ ignoreFallback = false,
102
+ showFallback: showFallbackProp = false,
103
+ ImgComponent = "img",
104
+ imgProps,
105
+ className,
106
+ onError,
107
+ disableAnimation: disableAnimationProp,
108
+ ...otherProps
109
+ } = originalProps;
110
+ const Component = as || "span";
111
+ const domRef = (0, import_react_utils2.useDOMRef)(ref);
112
+ const imgRef = (0, import_react_utils2.useDOMRef)(imgRefProp);
113
+ const { isFocusVisible, isFocused, focusProps } = (0, import_focus.useFocusRing)();
114
+ const { isHovered, hoverProps } = (0, import_interactions.useHover)({ isDisabled });
115
+ const disableAnimation = (_f = disableAnimationProp != null ? disableAnimationProp : globalContext == null ? void 0 : globalContext.disableAnimation) != null ? _f : false;
116
+ const imageStatus = (0, import_use_image.useImage)({ src, onError, ignoreFallback });
117
+ const isImgLoaded = imageStatus === "loaded";
118
+ const shouldFilterDOMProps = typeof ImgComponent === "string";
119
+ const showFallback = (!src || !isImgLoaded) && showFallbackProp;
120
+ const slots = (0, import_react.useMemo)(
121
+ () => {
122
+ var _a2;
123
+ return (0, import_theme.avatar)({
124
+ color,
125
+ radius,
126
+ size,
127
+ isBordered,
128
+ isDisabled,
129
+ isInGroup,
130
+ disableAnimation,
131
+ isInGridGroup: (_a2 = groupContext == null ? void 0 : groupContext.isGrid) != null ? _a2 : false
132
+ });
133
+ },
134
+ [
135
+ color,
136
+ radius,
137
+ size,
138
+ isBordered,
139
+ isDisabled,
140
+ disableAnimation,
141
+ isInGroup,
142
+ groupContext == null ? void 0 : groupContext.isGrid
143
+ ]
144
+ );
145
+ const baseStyles = (0, import_shared_utils.clsx)(classNames == null ? void 0 : classNames.base, className);
146
+ const canBeFocused = (0, import_react.useMemo)(() => {
147
+ return isFocusable || as === "button";
148
+ }, [isFocusable, as]);
149
+ const getAvatarProps = (0, import_react.useCallback)(
150
+ (props = {}) => ({
151
+ ref: domRef,
152
+ tabIndex: canBeFocused ? 0 : -1,
153
+ "data-hover": (0, import_shared_utils.dataAttr)(isHovered),
154
+ "data-focus": (0, import_shared_utils.dataAttr)(isFocused),
155
+ "data-focus-visible": (0, import_shared_utils.dataAttr)(isFocusVisible),
156
+ className: slots.base({
157
+ class: (0, import_shared_utils.clsx)(baseStyles, props == null ? void 0 : props.className)
158
+ }),
159
+ ...(0, import_utils.mergeProps)(otherProps, hoverProps, canBeFocused ? focusProps : {})
160
+ }),
161
+ [canBeFocused, slots, baseStyles, focusProps, otherProps]
162
+ );
163
+ const getImageProps = (0, import_react.useCallback)(
164
+ (props = {}) => ({
165
+ ref: imgRef,
166
+ src,
167
+ "data-loaded": (0, import_shared_utils.dataAttr)(isImgLoaded),
168
+ className: slots.img({ class: classNames == null ? void 0 : classNames.img }),
169
+ ...(0, import_utils.mergeProps)(
170
+ imgProps,
171
+ props,
172
+ (0, import_react_utils2.filterDOMProps)({ disableAnimation }, {
173
+ enabled: shouldFilterDOMProps
174
+ })
175
+ )
176
+ }),
177
+ [slots, isImgLoaded, imgProps, disableAnimation, src, imgRef, shouldFilterDOMProps]
178
+ );
179
+ return {
180
+ Component,
181
+ ImgComponent,
182
+ src,
183
+ alt,
184
+ icon,
185
+ name,
186
+ imgRef,
187
+ slots,
188
+ classNames,
189
+ fallback,
190
+ isImgLoaded,
191
+ showFallback,
192
+ ignoreFallback,
193
+ getInitials,
194
+ getAvatarProps,
195
+ getImageProps
196
+ };
197
+ }
198
+
199
+ // src/avatar.tsx
200
+ var import_jsx_runtime2 = require("react/jsx-runtime");
201
+ var Avatar = (0, import_system2.forwardRef)((props, ref) => {
202
+ const {
203
+ Component,
204
+ ImgComponent,
205
+ src,
206
+ icon = /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(AvatarIcon, {}),
207
+ alt,
208
+ classNames,
209
+ slots,
210
+ name,
211
+ showFallback,
212
+ fallback: fallbackComponent,
213
+ getInitials,
214
+ getAvatarProps,
215
+ getImageProps
216
+ } = useAvatar({
217
+ ...props,
218
+ ref
219
+ });
220
+ const fallback = (0, import_react2.useMemo)(() => {
221
+ if (!showFallback && src) return null;
222
+ if (fallbackComponent) {
223
+ 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 });
224
+ }
225
+ 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 });
226
+ }, [showFallback, src, fallbackComponent, name, classNames]);
227
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Component, { ...getAvatarProps(), children: [
228
+ src && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(ImgComponent, { ...getImageProps(), alt }),
229
+ fallback
230
+ ] });
231
+ });
232
+ Avatar.displayName = "HeroUI.Avatar";
233
+ var avatar_default = Avatar;
@@ -0,0 +1,10 @@
1
+ "use client";
2
+ import {
3
+ avatar_default
4
+ } from "./chunk-A6PX3NG3.mjs";
5
+ import "./chunk-25E6VDTZ.mjs";
6
+ import "./chunk-LTC67JRI.mjs";
7
+ import "./chunk-JUJ53SJZ.mjs";
8
+ export {
9
+ avatar_default as default
10
+ };
@@ -0,0 +1,35 @@
1
+ "use client";
2
+
3
+ // src/avatar-icon.tsx
4
+ import { jsx, jsxs } from "react/jsx-runtime";
5
+ var AvatarIcon = () => /* @__PURE__ */ jsxs(
6
+ "svg",
7
+ {
8
+ "aria-hidden": "true",
9
+ fill: "none",
10
+ height: "80%",
11
+ role: "presentation",
12
+ viewBox: "0 0 24 24",
13
+ width: "80%",
14
+ children: [
15
+ /* @__PURE__ */ jsx(
16
+ "path",
17
+ {
18
+ 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",
19
+ fill: "currentColor"
20
+ }
21
+ ),
22
+ /* @__PURE__ */ jsx(
23
+ "path",
24
+ {
25
+ 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",
26
+ fill: "currentColor"
27
+ }
28
+ )
29
+ ]
30
+ }
31
+ );
32
+
33
+ export {
34
+ AvatarIcon
35
+ };
@@ -0,0 +1,49 @@
1
+ "use client";
2
+ import {
3
+ AvatarIcon
4
+ } from "./chunk-25E6VDTZ.mjs";
5
+ import {
6
+ useAvatar
7
+ } from "./chunk-LTC67JRI.mjs";
8
+
9
+ // src/avatar.tsx
10
+ import { useMemo } from "react";
11
+ import { forwardRef } from "@heroui/system";
12
+ import { jsx, jsxs } from "react/jsx-runtime";
13
+ var Avatar = forwardRef((props, ref) => {
14
+ const {
15
+ Component,
16
+ ImgComponent,
17
+ src,
18
+ icon = /* @__PURE__ */ jsx(AvatarIcon, {}),
19
+ alt,
20
+ classNames,
21
+ slots,
22
+ name,
23
+ showFallback,
24
+ fallback: fallbackComponent,
25
+ getInitials,
26
+ getAvatarProps,
27
+ getImageProps
28
+ } = useAvatar({
29
+ ...props,
30
+ ref
31
+ });
32
+ const fallback = useMemo(() => {
33
+ if (!showFallback && src) return null;
34
+ if (fallbackComponent) {
35
+ return /* @__PURE__ */ jsx("div", { "aria-label": alt, className: slots.fallback({ class: classNames == null ? void 0 : classNames.fallback }), role: "img", children: fallbackComponent });
36
+ }
37
+ return name ? /* @__PURE__ */ jsx("span", { "aria-label": alt, className: slots.name({ class: classNames == null ? void 0 : classNames.name }), role: "img", children: getInitials(name) }) : /* @__PURE__ */ jsx("span", { "aria-label": alt, className: slots.icon({ class: classNames == null ? void 0 : classNames.icon }), role: "img", children: icon });
38
+ }, [showFallback, src, fallbackComponent, name, classNames]);
39
+ return /* @__PURE__ */ jsxs(Component, { ...getAvatarProps(), children: [
40
+ src && /* @__PURE__ */ jsx(ImgComponent, { ...getImageProps(), alt }),
41
+ fallback
42
+ ] });
43
+ });
44
+ Avatar.displayName = "HeroUI.Avatar";
45
+ var avatar_default = Avatar;
46
+
47
+ export {
48
+ avatar_default
49
+ };
@@ -0,0 +1,38 @@
1
+ "use client";
2
+ import {
3
+ avatar_default
4
+ } from "./chunk-A6PX3NG3.mjs";
5
+ import {
6
+ useAvatarGroup
7
+ } from "./chunk-QH65JCLF.mjs";
8
+ import {
9
+ AvatarGroupProvider
10
+ } from "./chunk-JUJ53SJZ.mjs";
11
+
12
+ // src/avatar-group.tsx
13
+ import { forwardRef } from "@heroui/system";
14
+ import { jsx, jsxs } from "react/jsx-runtime";
15
+ var AvatarGroup = forwardRef((props, ref) => {
16
+ const {
17
+ Component,
18
+ clones,
19
+ context,
20
+ remainingCount,
21
+ getAvatarGroupCountProps,
22
+ getAvatarGroupProps,
23
+ renderCount = (count) => /* @__PURE__ */ jsx(avatar_default, { ...getAvatarGroupCountProps(), name: `+${count}` })
24
+ } = useAvatarGroup({
25
+ ...props,
26
+ ref
27
+ });
28
+ return /* @__PURE__ */ jsx(Component, { ...getAvatarGroupProps(), children: /* @__PURE__ */ jsxs(AvatarGroupProvider, { value: context, children: [
29
+ clones,
30
+ remainingCount > 0 && renderCount(remainingCount)
31
+ ] }) });
32
+ });
33
+ AvatarGroup.displayName = "HeroUI.AvatarGroup";
34
+ var avatar_group_default = AvatarGroup;
35
+
36
+ export {
37
+ avatar_group_default
38
+ };
@@ -0,0 +1,13 @@
1
+ "use client";
2
+
3
+ // src/avatar-group-context.ts
4
+ import { createContext } from "@heroui/react-utils";
5
+ var [AvatarGroupProvider, useAvatarGroupContext] = createContext({
6
+ name: "AvatarGroupContext",
7
+ strict: false
8
+ });
9
+
10
+ export {
11
+ AvatarGroupProvider,
12
+ useAvatarGroupContext
13
+ };
@@ -0,0 +1,138 @@
1
+ "use client";
2
+ import {
3
+ useAvatarGroupContext
4
+ } from "./chunk-JUJ53SJZ.mjs";
5
+
6
+ // src/use-avatar.ts
7
+ import { avatar } from "@heroui/theme";
8
+ import { useProviderContext } from "@heroui/system";
9
+ import { mergeProps } from "@react-aria/utils";
10
+ import { useDOMRef, filterDOMProps } from "@heroui/react-utils";
11
+ import { clsx, safeText, dataAttr } from "@heroui/shared-utils";
12
+ import { useFocusRing } from "@react-aria/focus";
13
+ import { useMemo, useCallback } from "react";
14
+ import { useImage } from "@heroui/use-image";
15
+ import { useHover } from "@react-aria/interactions";
16
+ function useAvatar(originalProps = {}) {
17
+ var _a, _b, _c, _d, _e, _f;
18
+ const globalContext = useProviderContext();
19
+ const groupContext = useAvatarGroupContext();
20
+ const isInGroup = !!groupContext;
21
+ const {
22
+ as,
23
+ ref,
24
+ src,
25
+ name,
26
+ icon,
27
+ classNames,
28
+ fallback,
29
+ alt = name || "avatar",
30
+ imgRef: imgRefProp,
31
+ color = (_a = groupContext == null ? void 0 : groupContext.color) != null ? _a : "default",
32
+ radius = (_b = groupContext == null ? void 0 : groupContext.radius) != null ? _b : "full",
33
+ size = (_c = groupContext == null ? void 0 : groupContext.size) != null ? _c : "md",
34
+ isBordered = (_d = groupContext == null ? void 0 : groupContext.isBordered) != null ? _d : false,
35
+ isDisabled = (_e = groupContext == null ? void 0 : groupContext.isDisabled) != null ? _e : false,
36
+ isFocusable = false,
37
+ getInitials = safeText,
38
+ ignoreFallback = false,
39
+ showFallback: showFallbackProp = false,
40
+ ImgComponent = "img",
41
+ imgProps,
42
+ className,
43
+ onError,
44
+ disableAnimation: disableAnimationProp,
45
+ ...otherProps
46
+ } = originalProps;
47
+ const Component = as || "span";
48
+ const domRef = useDOMRef(ref);
49
+ const imgRef = useDOMRef(imgRefProp);
50
+ const { isFocusVisible, isFocused, focusProps } = useFocusRing();
51
+ const { isHovered, hoverProps } = useHover({ isDisabled });
52
+ const disableAnimation = (_f = disableAnimationProp != null ? disableAnimationProp : globalContext == null ? void 0 : globalContext.disableAnimation) != null ? _f : false;
53
+ const imageStatus = useImage({ src, onError, ignoreFallback });
54
+ const isImgLoaded = imageStatus === "loaded";
55
+ const shouldFilterDOMProps = typeof ImgComponent === "string";
56
+ const showFallback = (!src || !isImgLoaded) && showFallbackProp;
57
+ const slots = useMemo(
58
+ () => {
59
+ var _a2;
60
+ return avatar({
61
+ color,
62
+ radius,
63
+ size,
64
+ isBordered,
65
+ isDisabled,
66
+ isInGroup,
67
+ disableAnimation,
68
+ isInGridGroup: (_a2 = groupContext == null ? void 0 : groupContext.isGrid) != null ? _a2 : false
69
+ });
70
+ },
71
+ [
72
+ color,
73
+ radius,
74
+ size,
75
+ isBordered,
76
+ isDisabled,
77
+ disableAnimation,
78
+ isInGroup,
79
+ groupContext == null ? void 0 : groupContext.isGrid
80
+ ]
81
+ );
82
+ const baseStyles = clsx(classNames == null ? void 0 : classNames.base, className);
83
+ const canBeFocused = useMemo(() => {
84
+ return isFocusable || as === "button";
85
+ }, [isFocusable, as]);
86
+ const getAvatarProps = useCallback(
87
+ (props = {}) => ({
88
+ ref: domRef,
89
+ tabIndex: canBeFocused ? 0 : -1,
90
+ "data-hover": dataAttr(isHovered),
91
+ "data-focus": dataAttr(isFocused),
92
+ "data-focus-visible": dataAttr(isFocusVisible),
93
+ className: slots.base({
94
+ class: clsx(baseStyles, props == null ? void 0 : props.className)
95
+ }),
96
+ ...mergeProps(otherProps, hoverProps, canBeFocused ? focusProps : {})
97
+ }),
98
+ [canBeFocused, slots, baseStyles, focusProps, otherProps]
99
+ );
100
+ const getImageProps = useCallback(
101
+ (props = {}) => ({
102
+ ref: imgRef,
103
+ src,
104
+ "data-loaded": dataAttr(isImgLoaded),
105
+ className: slots.img({ class: classNames == null ? void 0 : classNames.img }),
106
+ ...mergeProps(
107
+ imgProps,
108
+ props,
109
+ filterDOMProps({ disableAnimation }, {
110
+ enabled: shouldFilterDOMProps
111
+ })
112
+ )
113
+ }),
114
+ [slots, isImgLoaded, imgProps, disableAnimation, src, imgRef, shouldFilterDOMProps]
115
+ );
116
+ return {
117
+ Component,
118
+ ImgComponent,
119
+ src,
120
+ alt,
121
+ icon,
122
+ name,
123
+ imgRef,
124
+ slots,
125
+ classNames,
126
+ fallback,
127
+ isImgLoaded,
128
+ showFallback,
129
+ ignoreFallback,
130
+ getInitials,
131
+ getAvatarProps,
132
+ getImageProps
133
+ };
134
+ }
135
+
136
+ export {
137
+ useAvatar
138
+ };
@@ -0,0 +1,85 @@
1
+ "use client";
2
+
3
+ // src/use-avatar-group.ts
4
+ import { avatarGroup } from "@heroui/theme";
5
+ import { useDOMRef } from "@heroui/react-utils";
6
+ import { clsx, compact } from "@heroui/shared-utils";
7
+ import { getValidChildren } from "@heroui/react-utils";
8
+ import { cloneElement, useMemo } from "react";
9
+ function useAvatarGroup(props = {}) {
10
+ const {
11
+ as,
12
+ ref,
13
+ max = 5,
14
+ total,
15
+ size,
16
+ color,
17
+ radius,
18
+ children,
19
+ isBordered,
20
+ isDisabled,
21
+ isGrid,
22
+ renderCount,
23
+ className,
24
+ classNames,
25
+ ...otherProps
26
+ } = props;
27
+ const domRef = useDOMRef(ref);
28
+ const Component = as || "div";
29
+ const context = useMemo(
30
+ () => ({
31
+ size,
32
+ color,
33
+ radius,
34
+ isGrid,
35
+ isBordered,
36
+ isDisabled
37
+ }),
38
+ [size, color, radius, isGrid, isBordered, isDisabled]
39
+ );
40
+ const slots = useMemo(() => avatarGroup({ className, isGrid }), [className, isGrid]);
41
+ const validChildren = getValidChildren(children);
42
+ const childrenWithinMax = max ? validChildren.slice(0, max) : validChildren;
43
+ const remainingCount = total ? total : max != null ? validChildren.length - max : -1;
44
+ const clones = childrenWithinMax.map((child, index) => {
45
+ const isFirstAvatar = index === 0;
46
+ const isLastAvatar = index === childrenWithinMax.length - 1;
47
+ const childProps = {
48
+ className: clsx(
49
+ isFirstAvatar ? "ms-0" : !isGrid ? "-ms-2" : "",
50
+ isLastAvatar && remainingCount < 1 ? "hover:-translate-x-0" : ""
51
+ )
52
+ };
53
+ return cloneElement(child, compact(childProps));
54
+ });
55
+ const getAvatarGroupProps = () => {
56
+ return {
57
+ ref: domRef,
58
+ className: slots.base({
59
+ class: clsx(classNames == null ? void 0 : classNames.base, className)
60
+ }),
61
+ role: "group",
62
+ ...otherProps
63
+ };
64
+ };
65
+ const getAvatarGroupCountProps = () => {
66
+ return {
67
+ className: slots.count({
68
+ class: classNames == null ? void 0 : classNames.count
69
+ })
70
+ };
71
+ };
72
+ return {
73
+ Component,
74
+ context,
75
+ remainingCount,
76
+ clones,
77
+ renderCount,
78
+ getAvatarGroupProps,
79
+ getAvatarGroupCountProps
80
+ };
81
+ }
82
+
83
+ export {
84
+ useAvatarGroup
85
+ };
@@ -0,0 +1,12 @@
1
+ export { default as Avatar, AvatarProps } from './avatar.mjs';
2
+ export { default as AvatarGroup, AvatarGroupProps } from './avatar-group.mjs';
3
+ export { useAvatar } from './use-avatar.mjs';
4
+ export { useAvatarGroup } from './use-avatar-group.mjs';
5
+ export { AvatarIcon } from './avatar-icon.mjs';
6
+ export { AvatarGroupProvider, useAvatarGroupContext } from './avatar-group-context.mjs';
7
+ import '@heroui/system';
8
+ import 'tailwind-variants';
9
+ import 'react';
10
+ import '@heroui/theme';
11
+ import '@heroui/react-utils';
12
+ import 'react/jsx-runtime';
@@ -0,0 +1,12 @@
1
+ export { default as Avatar, AvatarProps } from './avatar.js';
2
+ export { default as AvatarGroup, AvatarGroupProps } from './avatar-group.js';
3
+ export { useAvatar } from './use-avatar.js';
4
+ export { useAvatarGroup } from './use-avatar-group.js';
5
+ export { AvatarIcon } from './avatar-icon.js';
6
+ export { AvatarGroupProvider, useAvatarGroupContext } from './avatar-group-context.js';
7
+ import '@heroui/system';
8
+ import 'tailwind-variants';
9
+ import 'react';
10
+ import '@heroui/theme';
11
+ import '@heroui/react-utils';
12
+ import 'react/jsx-runtime';