@frontify/fondue
Version:
Design system of Frontify
49 lines (48 loc) • 1.75 kB
JavaScript
import { jsxs as r, jsx as n } from "react/jsx-runtime";
import { cloneElement as p } from "react";
import { IconSize as l } from "../../foundation/Icon/IconSize.es.js";
import { merge as o } from "../../utilities/merge.es.js";
import { MenuItemContentSize as t } from "./types.es.js";
const d = {
[t.XSmall]: "tw-pr-1.5",
[t.Small]: "tw-pr-1.5",
[t.Large]: "tw-pr-2"
}, x = ({
title: i,
decorator: m,
switchComponent: s,
subtitle: a,
ariaProps: w,
size: e = t.Small,
children: c
}) => /* @__PURE__ */ r(
"div",
{
...w,
"data-test-id": "menu-item-content",
className: "tw-flex tw-box-border tw-items-center tw-font-sans tw-text-s tw-flex-auto tw-min-w-0",
children: [
m && /* @__PURE__ */ n("span", { className: o(["tw-shrink-0", d[e]]), "data-test-id": "menu-item-decorator", children: p(m, {
size: e === t.Large ? l.Size24 : l.Size16
}) }),
/* @__PURE__ */ r("div", { className: "tw-flex-1 tw-overflow-hidden tw-text-ellipsis tw-whitespace-nowrap", children: [
/* @__PURE__ */ n(
"div",
{
"data-test-id": "menu-item-title",
className: "tw-select-none tw-text-ellipsis tw-overflow-hidden",
title: typeof i == "string" ? i : "",
children: c || i
}
),
a && e === t.Large && /* @__PURE__ */ n("div", { "data-test-id": "menu-item-subtitle", className: "tw-select-none tw-text-xxs", title: a, children: a })
] }),
s && /* @__PURE__ */ n("span", { className: o(["tw-shrink-0", d[e]]), "data-test-id": "menu-item-decorator", children: s })
]
}
);
x.displayName = "FondueMenuItemContent";
export {
x as MenuItemContent
};
//# sourceMappingURL=MenuItemContent.es.js.map