@payfit/unity-components
Version:
41 lines (40 loc) • 1.44 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 { useIntl as o } from "react-intl";
//#region src/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(), p = o(), { 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.formatMessage({
id: u?.isOpen ? "unity:component:task-menu:header:menu-close" : "unity:component:task-menu:header:menu-open",
defaultMessage: u?.isOpen ? "Close task menu" : "Open task menu"
}),
onClick: () => {
u?.toggle();
},
"aria-expanded": !!u?.isOpen,
"aria-controls": l
})]
});
};
c.displayName = "Header";
//#endregion
export { c as Header };