UNPKG

@payfit/unity-components

Version:

79 lines (78 loc) 2.7 kB
import { useAvatarContext as e } from "../Avatar.context.js"; import { avatarBase as t } from "../Avatar.variants.js"; import { getInitials as n } from "../utils.js"; import * as r from "react"; import { uyMerge as i, uyTv as a } from "@payfit/unity-themes"; import { jsx as o } from "react/jsx-runtime"; import * as s from "@radix-ui/react-avatar"; //#region src/components/avatar/parts/AvatarFallback.tsx var c = a({ slots: { base: "uy:absolute uy:overflow-hidden", background: "", foreground: "" }, variants: { color: { blue: { background: "uy:theme-legacy:bg-blue-l4 uy:theme-rebrand:bg-blue-l3", foreground: "uy:theme-legacy:fill-blue-l3 uy:theme-rebrand:fill-blue-l4" }, yellow: { background: "uy:theme-legacy:bg-yellow-l4 uy:theme-rebrand:bg-yellow-l3", foreground: "uy:theme-legacy:fill-yellow-l3 uy:theme-rebrand:fill-yellow-l4" }, purple: { background: "uy:theme-legacy:bg-purple-l4 uy:theme-rebrand:bg-purple-l3", foreground: "uy:theme-legacy:fill-purple-l3 uy:theme-rebrand:fill-purple-l4" } } } }), l = a({ extend: t, base: "uy:absolute uy:flex uy:h-full uy:w-full uy:items-center uy:justify-center uy:text-content-neutral uy:bg-surface-neutral-lowest", variants: { size: { xs: "uy:typography-body-small-strong", sm: "uy:typography-body-small-strong", md: "uy:typography-body-small-strong", lg: "uy:typography-body-strong", xl: "uy:typography-h2" } } }), u = r.forwardRef(({ variant: r, color: a, children: u, ...d }, f) => { let { size: p, variant: m } = e(); if (r === "placeholder") { let e = t({ size: p, variant: m }), { base: n, background: r, foreground: l } = c({ color: a }); return console.log("BASE", n()), console.log("FG", l()), console.log("BG", r()), /* @__PURE__ */ o(s.Fallback, { ref: f, role: "presentation", ...d, children: /* @__PURE__ */ o("svg", { role: "img", "aria-hidden": !0, xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 16 16", className: i(e, n(), r()), children: /* @__PURE__ */ o("path", { className: l(), fillRule: "evenodd", d: "M0 8.322c.245.06.49.117.732.17 2.113.455 3.727.487 4.79.12.478-.166.824-.405 1.09-.732.276-.336.567-.888.737-1.82.4-2.19.02-3.485-.47-4.283C6.407 1.012 5.665.432 4.732 0h6.861c.904 1.906 1.173 4.227.674 6.959-.29 1.587-.871 2.97-1.784 4.086-.921 1.126-2.08 1.86-3.328 2.292-2.283.789-4.872.574-7.156.11V8.322Z", clipRule: "evenodd" }) }) }); } return /* @__PURE__ */ o(s.Fallback, { ref: f, role: "presentation", className: l({ size: p, variant: m }), ...d, children: n(u) }); }); u.displayName = s.Fallback.displayName; //#endregion export { u as AvatarFallback };