"use client"; import {Avatar as BaseAvatar} from "@base-ui/react/avatar"; import {mergeProps} from "@base-ui/react/merge-props"; import {useRender} from "@base-ui/react/use-render"; import * as React from "react"; import {cn} from "@/lib/utilities"; import styles from "./avatar.module.css"; /** * Props for the shared avatar root. */ interface AvatarProps extends Omit, "className"> { /** Additional CSS classes merged with the avatar root styles. @default undefined */ className?: string; } /** * Props for the shared avatar image. */ interface AvatarImageProps extends Omit, "className"> { /** Additional CSS classes merged with the avatar image styles. @default undefined */ className?: string; } /** * Props for the shared avatar fallback. */ interface AvatarFallbackProps extends Omit, "className"> { /** Additional CSS classes merged with the avatar fallback styles. @default undefined */ className?: string; } /** * Displays a user avatar container with shared sizing and shape styles. * * @remarks * - Renders a `` element by default * - Built on {@link https://base-ui.com/react/components/avatar | Base UI Avatar} * - Supports the `render` prop for element composition * - Styling via CSS Modules with `--ac-*` custom properties * * @example Basic usage * ```tsx * * * AO * * ``` * * @see {@link https://base-ui.com/react/components/avatar | Base UI Documentation} */ const Avatar = React.forwardRef((props, forwardedRef) => { const {className, children, render, ...otherProps} = props; return ( {children} ); }); Avatar.displayName = "Avatar"; /** * Renders the primary avatar image inside the avatar root. * * @remarks * - Renders an `` element by default * - Built on {@link https://base-ui.com/react/components/avatar | Base UI Avatar} * - Supports the `render` prop for element composition * - Styling via CSS Modules with `--ac-*` custom properties * * @example Basic usage * ```tsx * * ``` * * @see {@link https://base-ui.com/react/components/avatar | Base UI Documentation} */ const AvatarImage = React.forwardRef((props, forwardedRef) => { const {className, render, ...otherProps} = props; return ( ); }); AvatarImage.displayName = "AvatarImage"; /** * Renders fallback content when the avatar image is unavailable. * * @remarks * - Renders a `` element by default * - Built on {@link https://base-ui.com/react/components/avatar | Base UI Avatar} * - Supports the `render` prop for element composition * - Styling via CSS Modules with `--ac-*` custom properties * * @example Basic usage * ```tsx * AO * ``` * * @see {@link https://base-ui.com/react/components/avatar | Base UI Documentation} */ const AvatarFallback = React.forwardRef((props, forwardedRef) => { const {className, children, render, ...otherProps} = props; return ( {children} ); }); AvatarFallback.displayName = "AvatarFallback"; // eslint-disable-next-line no-redeclare -- required for the canonical component namespace typing API namespace Avatar { export type Props = AvatarProps; export type State = BaseAvatar.Root.State; } // eslint-disable-next-line no-redeclare -- required for the canonical component namespace typing API namespace AvatarImage { export type Props = AvatarImageProps; export type State = BaseAvatar.Image.State; } // eslint-disable-next-line no-redeclare -- required for the canonical component namespace typing API namespace AvatarFallback { export type Props = AvatarFallbackProps; export type State = BaseAvatar.Fallback.State; } export {Avatar, AvatarFallback, AvatarImage};