UNPKG

@frontify/fondue

Version:
40 lines (39 loc) 1.53 kB
import { jsx as w } from "react/jsx-runtime"; import { toggleNodeType as a } from "@udecode/plate-core"; import { ELEMENT_LI as i } from "@udecode/plate-list"; import { someNode as m, getAboveNode as p } from "@udecode/slate"; import { getMark as l, setMarks as c } from "@udecode/slate-utils"; import { merge as x } from "../../../../../utilities/merge.es.js"; import { MARK_TEXT_STYLE as r } from "../../ListPlugin/ListPlugin.es.js"; import { ELEMENT_CHECK_ITEM as u } from "../../CheckboxListPlugin/id.es.js"; const f = (t) => p(t, { match: { type: i }, mode: "lowest" }) || m(t, { match: { type: u }, mode: "lowest" }), L = ({ editor: t, type: e, children: n }) => { const s = t != null && t.selection ? l(t, r) === e.id : m(t, { match: { type: e } }); return /* @__PURE__ */ w( "button", { "data-test-id": "textstyle-option", type: "button", className: x([ "tw-block tw-w-full tw-text-left tw-px-3 tw-py-2 tw-outline-none tw-cursor-pointer tw-truncate hover:tw-bg-box-neutral-hover hover:w-text-box-neutral-inverse-hover tw-max-h-20 tw-max-w-[15rem] tw-min-h-[2.25rem]", s ? "tw-text-box-neutral-inverse tw-bg-box-neutral" : "tw-text-text" ]), onMouseDown: (o) => { o.preventDefault(), o.stopPropagation(), !(!t || !t.selection) && (c(t, { [r]: e.id }), f(t) || a(t, { activeType: e.id, inactiveType: e.id })); }, children: n } ); }; export { L as DropdownItem }; //# sourceMappingURL=DropdownItem.es.js.map