@payfit/unity-components
Version:
124 lines (123 loc) • 3.71 kB
JavaScript
import { Text as e } from "../../text/Text.js";
import { Badge as t } from "../../badge/Badge.js";
import { AppProfileAvatar as n, InteractiveAppProfileAvatar as r } from "./AppProfileAvatar.js";
import { uyTv as i } from "@payfit/unity-themes";
import { jsx as a, jsxs as o } from "react/jsx-runtime";
import { useTranslation as s } from "react-i18next";
import { Icon as c } from "@payfit/unity-icons";
//#region src/core/components/app-profile-menu-button/parts/AppProfileMenuHeader.tsx
var l = i({
slots: {
summary: "uy:flex uy:w-full uy:items-center",
avatar: "uy:flex uy:items-center",
details: "uy:min-w-0 uy:flex-grow uy:flex-col uy:text-left uy:leading-[1.25]",
disclosure: "uy:p-100",
iconWrapper: "uy:flex uy:items-center uy:p-25",
icon: ""
},
variants: {
hideResponsiveDetails: {
true: {
avatar: "uy:mr-0 uy:lg:mr-150",
details: "uy:sr-only uy:lg:not-sr-only uy:lg:flex",
disclosure: "uy:ml-50 uy:lg:ml-150"
},
false: {
avatar: "uy:mr-150",
details: "uy:flex"
}
},
triggerVariant: {
small: { icon: [
"uy:block uy:origin-center uy:transition-transform",
"uy:duration-150 uy:ease-linear",
"uy:group-aria-[expanded=true]:rotate-180"
] },
large: {}
}
}
}), u = ({ asMenuHeader: i = !1, avatar: u, avatarPair: d, avatarSize: f, avatarVariant: p, badgeLabel: m, description: h, labelId: g, menuTriggerDescription: _, title: v, triggerDescriptionId: y, triggerVariant: b, uploadAvatarCallback: x, uploadAvatarDescription: S, uploadAvatarLabel: C }) => {
let { t: w } = s("unity"), T = _ ?? w((e) => e.unity.component.appMenu.footer.profileButton.description), { summary: E, avatar: D, details: O, disclosure: k, iconWrapper: A, icon: j } = l({
hideResponsiveDetails: !i && b === "small",
triggerVariant: b
});
return /* @__PURE__ */ o("div", {
className: E(),
"data-unity-slot": "profile-summary",
children: [
/* @__PURE__ */ a("div", {
className: D(),
"data-unity-slot": "avatar",
children: x ? /* @__PURE__ */ a(r, {
avatar: u,
avatarPair: d,
avatarSize: f,
avatarVariant: p,
labelId: g,
title: v,
uploadAvatarCallback: x,
uploadAvatarDescription: S,
uploadAvatarLabel: C
}) : /* @__PURE__ */ a(n, {
avatar: u,
avatarPair: d,
avatarSize: f,
avatarVariant: p,
isPairAvatarVisible: !0,
labelId: g,
title: v
})
}),
/* @__PURE__ */ o("div", {
className: O(),
"data-unity-slot": "profile-details",
children: [
/* @__PURE__ */ a(e, {
asElement: "span",
className: "uy:w-full",
color: "content.neutral",
"data-dd-privacy": "mask",
id: i ? void 0 : g,
isTruncated: !0,
variant: f === "md" ? "bodySmallStrong" : "bodyStrong",
children: v
}),
/* @__PURE__ */ a(e, {
asElement: "span",
className: "uy:w-full",
color: "content.neutral.low",
"data-dd-privacy": "allow",
isTruncated: !0,
variant: "bodySmall",
children: h
}),
!i && /* @__PURE__ */ a("span", {
id: y,
className: "uy:sr-only",
children: T
})
]
}),
/* @__PURE__ */ a("div", {
className: k(),
"data-unity-slot": "disclosure",
children: i ? m && /* @__PURE__ */ a(t, {
className: "uy:capitalize",
variant: "neutral",
children: m
}) : /* @__PURE__ */ a("div", {
className: A(),
children: /* @__PURE__ */ a(c, {
className: j(),
src: b === "small" ? "CaretDownOutlined" : "CaretUpDownOutlined",
alt: T,
size: 20,
color: "content.neutral.low"
})
})
})
]
});
};
//#endregion
export { u as AppProfileMenuHeader };