UNPKG

reactjs-tiptap-editor

Version:

A modern WYSIWYG rich text editor based on tiptap and shadcn ui for React

144 lines (143 loc) 6.13 kB
import { jsx as c, jsxs as x } from "react/jsx-runtime"; import * as s from "react"; import * as t from "@radix-ui/react-dropdown-menu"; import { ChevronRight as d, Check as h, Circle as l } from "lucide-react"; import { c as o } from "./index-RcSPeQHn.js"; const R = t.Root, I = t.Trigger, S = t.Portal, C = t.Sub, m = s.forwardRef(({ className: e, inset: r, children: i, ...a }, n) => /* @__PURE__ */ x( t.SubTrigger, { ref: n, className: o( "richtext-flex richtext-cursor-default richtext-select-none richtext-items-center richtext-rounded-sm richtext-px-2 richtext-py-1.5 richtext-text-sm richtext-outline-none focus:richtext-bg-accent data-[state=open]:richtext-bg-accent", r && "richtext-pl-8", e ), ...a, children: [ i, /* @__PURE__ */ c(d, { className: "richtext-ml-auto richtext-size-4" }) ] } )); m.displayName = t.SubTrigger.displayName; const p = s.forwardRef(({ className: e, ...r }, i) => /* @__PURE__ */ c( t.SubContent, { "data-richtext-portal": !0, ref: i, className: o( "richtext-z-50 richtext-min-w-[8rem] richtext-overflow-hidden richtext-rounded-md !richtext-border !richtext-border-border richtext-bg-popover richtext-p-1 richtext-text-popover-foreground richtext-shadow-lg data-[state=open]:richtext-animate-in data-[state=closed]:richtext-animate-out data-[state=closed]:richtext-fade-out-0 data-[state=open]:richtext-fade-in-0 data-[state=closed]:richtext-zoom-out-95 data-[state=open]:richtext-zoom-in-95 data-[side=bottom]:richtext-slide-in-from-top-2 data-[side=left]:richtext-slide-in-from-right-2 data-[side=right]:richtext-slide-in-from-left-2 data-[side=top]:richtext-slide-in-from-bottom-2", e ), ...r } )); p.displayName = t.SubContent.displayName; const u = s.forwardRef(({ className: e, sideOffset: r = 4, ...i }, a) => /* @__PURE__ */ c(t.Portal, { "data-richtext-portal": !0, children: /* @__PURE__ */ c( t.Content, { "data-richtext-portal": !0, ref: a, sideOffset: r, className: o( "richtext-z-50 richtext-min-w-[8rem] richtext-overflow-hidden richtext-rounded-md !richtext-border richtext-bg-popover richtext-p-1 richtext-text-popover-foreground richtext-shadow-md data-[state=open]:richtext-animate-in data-[state=closed]:richtext-animate-out data-[state=closed]:richtext-fade-out-0 data-[state=open]:richtext-fade-in-0 data-[state=closed]:richtext-zoom-out-95 data-[state=open]:richtext-zoom-in-95 data-[side=bottom]:richtext-slide-in-from-top-2 data-[side=left]:richtext-slide-in-from-right-2 data-[side=right]:richtext-slide-in-from-left-2 data-[side=top]:richtext-slide-in-from-bottom-2 !richtext-border-border", e ), ...i } ) })); u.displayName = t.Content.displayName; const f = s.forwardRef(({ className: e, inset: r, ...i }, a) => /* @__PURE__ */ c( t.Item, { ref: a, className: o( "richtext-relative richtext-flex richtext-cursor-default richtext-select-none richtext-items-center richtext-rounded-sm richtext-px-2 richtext-py-1.5 richtext-text-sm richtext-outline-none richtext-transition-colors focus:richtext-bg-accent focus:richtext-text-accent-foreground data-[disabled]:richtext-pointer-events-none data-[disabled]:richtext-opacity-50", r && "richtext-pl-8", e ), ...i } )); f.displayName = t.Item.displayName; const b = s.forwardRef(({ className: e, children: r, checked: i, ...a }, n) => /* @__PURE__ */ x( t.CheckboxItem, { checked: i, ref: n, className: o( "richtext-relative richtext-flex richtext-cursor-default richtext-select-none richtext-items-center richtext-rounded-sm richtext-py-1.5 richtext-pl-8 richtext-pr-2 richtext-text-sm richtext-outline-none richtext-transition-colors focus:richtext-bg-accent focus:richtext-text-accent-foreground data-[disabled]:richtext-pointer-events-none data-[disabled]:richtext-opacity-50", e ), ...a, children: [ /* @__PURE__ */ c("span", { className: "richtext-absolute richtext-left-2 richtext-flex richtext-size-3.5 richtext-items-center richtext-justify-center", children: /* @__PURE__ */ c(t.ItemIndicator, { children: /* @__PURE__ */ c(h, { className: "richtext-size-4" }) }) }), r ] } )); b.displayName = t.CheckboxItem.displayName; const g = s.forwardRef(({ className: e, children: r, ...i }, a) => /* @__PURE__ */ x( t.RadioItem, { ref: a, className: o( "richtext-relative richtext-flex richtext-cursor-default richtext-select-none richtext-items-center richtext-rounded-sm richtext-py-1.5 richtext-pl-8 richtext-pr-2 richtext-text-sm richtext-outline-none richtext-transition-colors focus:richtext-bg-accent focus:richtext-text-accent-foreground data-[disabled]:richtext-pointer-events-none data-[disabled]:richtext-opacity-50", e ), ...i, children: [ /* @__PURE__ */ c("span", { className: "richtext-absolute richtext-left-2 richtext-flex richtext-size-3.5 richtext-items-center richtext-justify-center", children: /* @__PURE__ */ c(t.ItemIndicator, { children: /* @__PURE__ */ c(l, { className: "richtext-size-2 richtext-fill-current" }) }) }), r ] } )); g.displayName = t.RadioItem.displayName; const N = s.forwardRef(({ className: e, inset: r, ...i }, a) => /* @__PURE__ */ c( t.Label, { ref: a, className: o( "richtext-px-2 richtext-py-1.5 richtext-text-sm richtext-font-semibold", r && "richtext-pl-8", e ), ...i } )); N.displayName = t.Label.displayName; const w = s.forwardRef(({ className: e, ...r }, i) => /* @__PURE__ */ c( t.Separator, { className: o("richtext--mx-1 richtext-my-1 richtext-h-px richtext-bg-muted", e), ref: i, ...r } )); w.displayName = t.Separator.displayName; function y({ className: e, ...r }) { return /* @__PURE__ */ c( "span", { className: o("richtext-ml-auto richtext-text-xs richtext-tracking-widest richtext-opacity-60", e), ...r } ); } y.displayName = "DropdownMenuShortcut"; export { R as D, I as a, u as b, b as c, w as d, y as e, f, C as g, m as h, S as i, p as j };