Files
NapCatQQ/.pnpm-store/v3/files/f7/7fef0552738da5c3a9f05b6733a52c3a2d876b497e82f32406c740173d498bf1014ed4a76c2fa91ae2de1367979287646d39895e942fdbeeeb2e7f303209f4
TanTan e311ca3275
Build NapCat Artifacts / Windows Loader Test (push) Canceled after 0s
Build NapCat Artifacts / Type Check & Test (push) Canceled after 0s
Build NapCat Artifacts / Build NapCat.Framework (push) Canceled after 0s
Build NapCat Artifacts / Build NapCat.Shell (push) Canceled after 0s
docs: 仓库链接指向本镜像仓库
2026-11-13 09:25:58 +08:00

51 lines
1.6 KiB
Plaintext

"use client";
import {
AvatarIcon
} from "./chunk-25E6VDTZ.mjs";
import {
useAvatar
} from "./chunk-LTC67JRI.mjs";
// src/avatar.tsx
import { useMemo } from "react";
import { forwardRef } from "@heroui/system";
import { jsx, jsxs } from "react/jsx-runtime";
var Avatar = forwardRef((props, ref) => {
const {
Component,
ImgComponent,
src,
icon = /* @__PURE__ */ jsx(AvatarIcon, {}),
alt,
classNames,
slots,
name,
showFallback,
fallback: fallbackComponent,
getInitials,
getAvatarProps,
getImageProps
} = useAvatar({
...props,
ref
});
const fallback = useMemo(() => {
if (!showFallback && src)
return null;
if (fallbackComponent) {
return /* @__PURE__ */ jsx("div", { "aria-label": alt, className: slots.fallback({ class: classNames == null ? void 0 : classNames.fallback }), role: "img", children: fallbackComponent });
}
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 });
}, [showFallback, src, fallbackComponent, name, classNames]);
return /* @__PURE__ */ jsxs(Component, { ...getAvatarProps(), children: [
src && /* @__PURE__ */ jsx(ImgComponent, { ...getImageProps(), alt }),
fallback
] });
});
Avatar.displayName = "HeroUI.Avatar";
var avatar_default = Avatar;
export {
avatar_default
};