@payfit/unity-components
Version:
38 lines (37 loc) • 1.37 kB
JavaScript
import { IconButton as e } from "../../icon-button/IconButton.js";
import { Text as t } from "../../text/Text.js";
import { useTaskMenuContext as n } from "../TaskMenu.context.js";
import { uyTv as r } from "@payfit/unity-themes";
import { jsx as i, jsxs as a } from "react/jsx-runtime";
import { useTranslation as o } from "react-i18next";
//#region src/core/components/task-menu/parts/Header.tsx
var s = r({ slots: {
header: ["uy:flex uy:px-300 uy:py-200 uy:gap-200 uy:shadow-raising"],
headerSelectedTask: ["uy:flex-1 uy:basis-full uy:self-center"]
} }), c = () => {
let { currentTask: r, taskMenuId: c, taskMenuContentId: l, state: u, triggerProps: d, triggerRef: f } = n(), { t: p } = o("unity"), { header: m, headerSelectedTask: h } = s();
return /* @__PURE__ */ a("div", {
className: m(),
children: [/* @__PURE__ */ i(t, {
asElement: "span",
className: h(),
"aria-describedby": c,
children: r?.label
}), /* @__PURE__ */ i(e, {
...d,
ref: f,
variant: "ghost",
color: "neutral",
icon: u?.isOpen ? "CloseOutlined" : "ListOutlined",
label: p((e) => u?.isOpen ? e.unity.component.taskMenu.header.menuClose : e.unity.component.taskMenu.header.menuOpen),
onClick: () => {
u?.toggle();
},
"aria-expanded": !!u?.isOpen,
"aria-controls": l
})]
});
};
c.displayName = "Header";
//#endregion
export { c as Header };