UNPKG

@payfit/unity-components

Version:

71 lines (70 loc) 2.93 kB
import { Actionable as e } from "../actionable/Actionable.js"; import { Menu as t } from "../menu/Menu.js"; import { MenuContent as n } from "../menu/parts/MenuContent.js"; import { MenuTrigger as r } from "../menu/parts/MenuTrigger.js"; import { MenuHeader as i } from "../menu/parts/MenuHeader.js"; import { AppProfileMenuHeader as a } from "./parts/AppProfileMenuHeader.js"; import { useId as o, useRef as s } from "react"; import { uyTv as c } from "@payfit/unity-themes"; import { jsx as l, jsxs as u } from "react/jsx-runtime"; //#region src/components/app-profile-menu-button/AppProfileMenuButton.tsx var d = c({ base: [ "uy:transition-colors uy:rounded-75", "uy:theme-legacy:data-[hovered=true]:bg-surface-neutral-low-hover uy:theme-legacy:hover:bg-surface-neutral-low-hover", "uy:theme-rebrand:data-[hovered=true]:bg-surface-neutral-lowest-hover uy:theme-rebrand:hover:bg-surface-neutral-lowest-hover", "uy:theme-legacy:data-[pressed=true]:bg-surface-neutral-low-pressed uy:theme-legacy:active:bg-surface-neutral-low-active", "uy:theme-rebrand:data-[pressed=true]:bg-surface-neutral-lowest-pressed uy:theme-rebrand:active:bg-surface-neutral-lowest-active", "uy:data-[focus-visible=true]:outline-none uy:data-[focus-visible=true]:ring-2 uy:data-[focus-visible=true]:ring-utility-focus-ring uy:data-[focus-visible=true]:ring-offset-2", "uy:focus-visible:outline-none uy:focus-visible:ring-2 uy:focus-visible:ring-utility-focus-ring uy:focus-visible:ring-offset-2" ], variants: { variant: { large: "uy:w-full uy:px-150 uy:py-100", small: "uy:pr-0 uy:pl-100 uy:py-25" } } }), f = ({ avatar: c, avatarPair: f, avatarVariant: p = "square", badgeLabel: m, children: h, defaultOpen: g, description: _, isOpen: v, menuTriggerDescription: y, onOpenChange: b, placement: x, title: S, uploadAvatarCallback: C, uploadAvatarDescription: w, uploadAvatarLabel: T, variant: E = "large" }) => { let D = s(null), O = o(), k = o(), A = { avatar: c, avatarPair: f, avatarSize: E === "small" ? "md" : "lg", avatarVariant: p, badgeLabel: m, description: _, labelId: O, menuTriggerDescription: y, title: S, triggerDescriptionId: k, triggerVariant: E, uploadAvatarCallback: C, uploadAvatarDescription: w, uploadAvatarLabel: T }; return /* @__PURE__ */ u(t, { defaultOpen: g, isOpen: v, onOpenChange: b, placement: x ?? (E === "small" ? "bottom right" : "top left"), triggerRef: D, children: [/* @__PURE__ */ l(r, { asChild: !0, children: /* @__PURE__ */ l(e, { ref: D, "aria-describedby": k, "aria-labelledby": O, className: d({ variant: E }), children: /* @__PURE__ */ l(a, { ...A }) }) }), /* @__PURE__ */ u(n, { width: 312, children: [/* @__PURE__ */ l(i, { className: "uy:rounded-75", children: /* @__PURE__ */ l(a, { ...A, asMenuHeader: !0 }) }), h] })] }); }; //#endregion export { f as AppProfileMenuButton };