UNPKG

laif-ds

Version:

Design System di Laif con componenti React basati su principi di Atomic Design

51 lines (50 loc) 1.59 kB
"use client"; import { jsx as i } from "react/jsx-runtime"; import { useState as m } from "react"; import { $isTableSelection as l } from "../../../../node_modules/@lexical/table/LexicalTable.prod.js"; import { FORMAT_TEXT_COMMAND as n, $isRangeSelection as d } from "../../../../node_modules/lexical/Lexical.prod.js"; import { useToolbarContext as c } from "../../context/toolbar-context.js"; import { useUpdateToolbarHandler as p } from "../../editor-hooks/use-update-toolbar.js"; import { Toggle as f } from "../../../ui/toggle.js"; import u from "../../../../node_modules/lucide-react/dist/esm/icons/code.js"; import T from "../../../../node_modules/lucide-react/dist/esm/icons/strikethrough.js"; import b from "../../../../node_modules/lucide-react/dist/esm/icons/underline.js"; import g from "../../../../node_modules/lucide-react/dist/esm/icons/italic.js"; import h from "../../../../node_modules/lucide-react/dist/esm/icons/bold.js"; const C = { bold: h, italic: g, underline: b, strikethrough: T, code: u }; function R({ format: o }) { const { activeEditor: a } = c(), [r, t] = m(!1); p((e) => { (d(e) || l(e)) && t(e.hasFormat(o)); }); const s = C[o]; return /* @__PURE__ */ i( f, { "aria-label": "Toggle bold", variant: "outline", size: "sm", defaultPressed: r, pressed: r, onPressedChange: t, onClick: () => { a.dispatchCommand( n, o ); }, children: /* @__PURE__ */ i(s, { className: "h-4 w-4" }) } ); } export { R as FontFormatToolbarPlugin };