UNPKG

@metamask/design-system-react

Version:
16 lines 1.2 kB
function $importDefault(module) { if (module?.__esModule) { return module.default; } return module; } import $React, { forwardRef } from "react"; const React = $importDefault($React); import { AvatarIconSize, AvatarIconSeverity } from "../../types/index.mjs"; import { twMerge } from "../../utils/tw-merge.mjs"; import { AvatarBase, AvatarBaseShape } from "../AvatarBase/index.mjs"; import { Icon } from "../Icon/index.mjs"; import { MAP_AVATARICON_SIZE_ICONSIZE, TWCLASSMAP_AVATARICON_SEVERITY_BACKGROUNDCOLOR, MAP_AVATARICON_SEVERITY_ICONCOLOR } from "./AvatarIcon.constants.mjs"; export const AvatarIcon = forwardRef(({ iconName, iconProps, size = AvatarIconSize.Md, severity = AvatarIconSeverity.Neutral, className, ...props }, ref) => (React.createElement(AvatarBase, { ref: ref, shape: AvatarBaseShape.Circle, size: size, className: twMerge(TWCLASSMAP_AVATARICON_SEVERITY_BACKGROUNDCOLOR[severity], className), ...props }, iconName && (React.createElement(Icon, { name: iconName, size: MAP_AVATARICON_SIZE_ICONSIZE[size], color: MAP_AVATARICON_SEVERITY_ICONCOLOR[severity], ...iconProps }))))); AvatarIcon.displayName = 'AvatarIcon'; //# sourceMappingURL=AvatarIcon.mjs.map