@farmzone/fz-react-ui 1.1.9 → 1.1.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -279,6 +279,9 @@ var Z_INDEX = {
279
279
  CALENDAR_PORTAL: 60,
280
280
  TOOLTIP: 70,
281
281
  SELECT_CONTENT: 100,
282
+ // body에 직접 mount되는 플로팅 메뉴(예: 에디터 멘션 제안 목록)가
283
+ // Modal(55) 안에서 열려도 가려지지 않도록 TOP(Toast) 바로 아래 배치
284
+ OVERLAY_POPUP: 9998,
282
285
  TOP: 9999,
283
286
  MODAL_Z_STEP: 10
284
287
  };
@@ -1285,7 +1288,7 @@ function PopoverContent({
1285
1288
  side: position,
1286
1289
  sideOffset,
1287
1290
  className: cn(
1288
- "z-50 w-72 rounded-md border border-neutral-200 bg-white p-4 text-neutral-950 shadow-md outline-none",
1291
+ "z-100 w-72 rounded-md border border-neutral-200 bg-white p-4 text-neutral-950 shadow-md outline-none",
1289
1292
  "data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95",
1290
1293
  "data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
1291
1294
  className
@@ -10070,7 +10073,7 @@ var LIGHT = {
10070
10073
  toolbar: {
10071
10074
  wrapper: "border-b border-gray-200 bg-white",
10072
10075
  btnIdle: "text-gray-700 hover:bg-gray-100",
10073
- btnActive: "bg-indigo-100 text-indigo-600",
10076
+ btnActive: "bg-[var(--rich-editor-accent-bg,#e0e7ff)] text-[var(--rich-editor-accent-text,#4f46e5)]",
10074
10077
  btnDestructive: "text-red-400 hover:bg-red-50 hover:text-red-600",
10075
10078
  divider: "bg-gray-200",
10076
10079
  rText: "text-gray-700"
@@ -10091,16 +10094,16 @@ var LIGHT = {
10091
10094
  container: "border-gray-200 bg-white",
10092
10095
  emptyText: "text-gray-400",
10093
10096
  btnIdle: "text-gray-700 hover:bg-gray-100 hover:text-gray-900",
10094
- btnSelected: "bg-blue-100 text-blue-900",
10097
+ btnSelected: "bg-[var(--rich-editor-accent-bg,#dbeafe)] text-[var(--rich-editor-accent-text,#1e3a8a)]",
10095
10098
  badgeIdle: "bg-gray-100 text-gray-500",
10096
- badgeSelected: "bg-blue-200 text-blue-800"
10099
+ badgeSelected: "bg-[var(--rich-editor-accent-bg,#bfdbfe)] text-[var(--rich-editor-accent-text,#1e40af)]"
10097
10100
  }
10098
10101
  };
10099
10102
  var DARK = {
10100
10103
  toolbar: {
10101
10104
  wrapper: "border-b border-gray-800 bg-gray-900",
10102
10105
  btnIdle: "text-gray-400 hover:bg-gray-800 hover:text-gray-200",
10103
- btnActive: "bg-indigo-900/50 text-indigo-400",
10106
+ btnActive: "bg-[var(--rich-editor-accent-bg,rgba(49,46,129,0.5))] text-[var(--rich-editor-accent-text,#818cf8)]",
10104
10107
  btnDestructive: "text-red-400 hover:bg-red-900/30 hover:text-red-300",
10105
10108
  divider: "bg-gray-800",
10106
10109
  rText: "text-gray-400"
@@ -10121,9 +10124,9 @@ var DARK = {
10121
10124
  container: "border-gray-700 bg-gray-900",
10122
10125
  emptyText: "text-gray-500",
10123
10126
  btnIdle: "text-gray-300 hover:bg-gray-800 hover:text-gray-100",
10124
- btnSelected: "bg-blue-900/50 text-blue-200",
10127
+ btnSelected: "bg-[var(--rich-editor-accent-bg,rgba(30,58,138,0.5))] text-[var(--rich-editor-accent-text,#bfdbfe)]",
10125
10128
  badgeIdle: "bg-gray-800 text-gray-400",
10126
- badgeSelected: "bg-blue-800 text-blue-200"
10129
+ badgeSelected: "bg-[var(--rich-editor-accent-bg,#1e40af)] text-[var(--rich-editor-accent-text,#bfdbfe)]"
10127
10130
  }
10128
10131
  };
10129
10132
  var RICH_EDITOR_THEMES = {
@@ -10136,8 +10139,12 @@ function useRichEditorTheme() {
10136
10139
  return React6.useContext(RichEditorThemeContext);
10137
10140
  }
10138
10141
  var MentionList = React6.forwardRef((props, ref) => {
10139
- const { items, command, loading, className } = props;
10142
+ const { items, command, loading, className, listClassName, accentColor, accentTextColor } = props;
10140
10143
  const theme = useRichEditorTheme();
10144
+ const accentStyle = {
10145
+ ...accentColor ? { "--rich-editor-accent-bg": accentColor } : {},
10146
+ ...accentTextColor ? { "--rich-editor-accent-text": accentTextColor } : {}
10147
+ };
10141
10148
  const [selectedIndex, setSelectedIndex] = React6.useState(0);
10142
10149
  const selectedRef = React6.useRef(null);
10143
10150
  const selectItem = (index) => {
@@ -10167,41 +10174,58 @@ var MentionList = React6.forwardRef((props, ref) => {
10167
10174
  return false;
10168
10175
  }
10169
10176
  }));
10170
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("rich-editor-mention-list z-50 overflow-hidden rounded-md border shadow-md", theme.mention.container, className), children: loading ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("px-3 py-2 text-sm", theme.mention.emptyText), children: "\uAC80\uC0C9 \uC911..." }) : items.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("px-3 py-2 text-sm", theme.mention.emptyText), children: "\uAC80\uC0C9 \uACB0\uACFC \uC5C6\uC74C" }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "max-h-48 overflow-y-auto p-1", children: items.map((item, index) => {
10171
- const isSelected = index === selectedIndex;
10172
- return /* @__PURE__ */ jsxRuntime.jsxs(
10173
- "button",
10174
- {
10175
- ref: isSelected ? selectedRef : null,
10176
- type: "button",
10177
- onClick: () => selectItem(index),
10178
- className: cn(
10179
- "flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pl-2 pr-4 text-sm text-left select-none transition-colors",
10180
- isSelected ? theme.mention.btnSelected : theme.mention.btnIdle
10181
- ),
10182
- children: [
10183
- /* @__PURE__ */ jsxRuntime.jsx(
10184
- "span",
10185
- {
10186
- className: cn(
10187
- "flex h-5 w-5 shrink-0 items-center justify-center rounded-full text-[11px] font-semibold",
10188
- isSelected ? theme.mention.badgeSelected : theme.mention.badgeIdle
10177
+ return /* @__PURE__ */ jsxRuntime.jsx(
10178
+ "div",
10179
+ {
10180
+ className: cn("rich-editor-mention-list z-50 overflow-hidden rounded-md border shadow-md", theme.mention.container, className),
10181
+ style: accentStyle,
10182
+ children: loading ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("px-3 py-2 text-sm", theme.mention.emptyText), children: "\uAC80\uC0C9 \uC911..." }) : items.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("px-3 py-2 text-sm", theme.mention.emptyText), children: "\uAC80\uC0C9 \uACB0\uACFC \uC5C6\uC74C" }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("max-h-68 overflow-y-auto p-1", listClassName), children: items.map((item, index) => {
10183
+ const isSelected = index === selectedIndex;
10184
+ return /* @__PURE__ */ jsxRuntime.jsxs(
10185
+ "button",
10186
+ {
10187
+ ref: isSelected ? selectedRef : null,
10188
+ type: "button",
10189
+ onClick: () => selectItem(index),
10190
+ className: cn(
10191
+ "flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pl-2 pr-4 text-sm text-left select-none transition-colors",
10192
+ isSelected ? theme.mention.btnSelected : theme.mention.btnIdle
10193
+ ),
10194
+ children: [
10195
+ /* @__PURE__ */ jsxRuntime.jsx(
10196
+ "span",
10197
+ {
10198
+ className: cn(
10199
+ "flex h-5 w-5 shrink-0 items-center justify-center rounded-full text-[11px] font-semibold",
10200
+ isSelected ? theme.mention.badgeSelected : theme.mention.badgeIdle
10201
+ ),
10202
+ children: item.label[0]?.toUpperCase()
10203
+ }
10189
10204
  ),
10190
- children: item.label[0]?.toUpperCase()
10191
- }
10192
- ),
10193
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate", children: item.label })
10194
- ]
10195
- },
10196
- item.id
10197
- );
10198
- }) }) });
10205
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate", children: item.label })
10206
+ ]
10207
+ },
10208
+ item.id
10209
+ );
10210
+ }) })
10211
+ }
10212
+ );
10199
10213
  });
10200
10214
  MentionList.displayName = "MentionList";
10201
10215
 
10202
10216
  // src/components/RichEditor/config/extensions.ts
10203
10217
  function buildExtensions(config) {
10204
- const { toolbar, mentionUsers = [], onMentionSearch, mentionClassName } = config;
10218
+ const {
10219
+ toolbar,
10220
+ mentionUsers = [],
10221
+ onMentionSearch,
10222
+ mentionClassName,
10223
+ mentionListClassName,
10224
+ mentionTagClassName,
10225
+ accentColor,
10226
+ accentTextColor,
10227
+ zIndex
10228
+ } = config;
10205
10229
  const exts = [extensionTextStyle.TextStyleKit, buildMarkResetOnEnter()];
10206
10230
  const headingLevels = toolbar.heading === false ? [] : Array.isArray(toolbar.heading) ? [...toolbar.heading] : [1, 2, 3, 4];
10207
10231
  exts.push(
@@ -10242,7 +10266,7 @@ function buildExtensions(config) {
10242
10266
  const ALL_ITEM = { id: "__all__", label: "\uBAA8\uB450" };
10243
10267
  exts.push(
10244
10268
  Mention__default.default.configure({
10245
- HTMLAttributes: { class: "rich-editor-mention" },
10269
+ HTMLAttributes: { class: cn("rich-editor-mention", mentionTagClassName) },
10246
10270
  suggestion: {
10247
10271
  items: async ({ query }) => {
10248
10272
  let items;
@@ -10258,18 +10282,25 @@ function buildExtensions(config) {
10258
10282
  render: () => {
10259
10283
  let component;
10260
10284
  let unmount;
10285
+ const extraProps = {
10286
+ className: mentionClassName,
10287
+ listClassName: mentionListClassName,
10288
+ accentColor,
10289
+ accentTextColor
10290
+ };
10261
10291
  return {
10262
10292
  onStart: (props) => {
10263
10293
  component = new react.ReactRenderer(MentionList, {
10264
- props: mentionClassName ? { ...props, className: mentionClassName } : props,
10294
+ props: { ...props, ...extraProps },
10265
10295
  editor: props.editor
10266
10296
  });
10267
10297
  unmount = props.mount(component.element);
10298
+ if (component.element instanceof HTMLElement) {
10299
+ component.element.style.zIndex = String(zIndex ?? Z_INDEX.OVERLAY_POPUP);
10300
+ }
10268
10301
  },
10269
10302
  onUpdate: (props) => {
10270
- component.updateProps(
10271
- mentionClassName ? { ...props, className: mentionClassName } : props
10272
- );
10303
+ component.updateProps({ ...props, ...extraProps });
10273
10304
  },
10274
10305
  onKeyDown: ({ event }) => {
10275
10306
  return component.ref?.onKeyDown({ event }) ?? false;
@@ -10460,6 +10491,11 @@ function useRichEditor(options = {}) {
10460
10491
  mentionUsers = [],
10461
10492
  onMentionSearch,
10462
10493
  mentionClassName,
10494
+ mentionListClassName,
10495
+ mentionTagClassName,
10496
+ accentColor,
10497
+ accentTextColor,
10498
+ zIndex,
10463
10499
  editable = true,
10464
10500
  autofocus,
10465
10501
  editorClassName,
@@ -10477,7 +10513,12 @@ function useRichEditor(options = {}) {
10477
10513
  toolbar,
10478
10514
  mentionUsers,
10479
10515
  onMentionSearch,
10480
- mentionClassName
10516
+ mentionClassName,
10517
+ mentionListClassName,
10518
+ mentionTagClassName,
10519
+ accentColor,
10520
+ accentTextColor,
10521
+ zIndex
10481
10522
  }),
10482
10523
  ...additionalExtensions
10483
10524
  ];
@@ -10579,6 +10620,97 @@ function RowIcon() {
10579
10620
  /* @__PURE__ */ jsxRuntime.jsx("rect", { x: "1", y: "8", width: "12", height: "5", rx: "1", fill: "currentColor", opacity: "0.15" })
10580
10621
  ] });
10581
10622
  }
10623
+ var DEFAULT_COLOR_ROWS = [
10624
+ ["#9CA3AF", "#60A5FA", "#2DD4BF", "#4ADE80", "#FACC15", "#FB923C", "#F472B6", "#C084FC"],
10625
+ ["#4B5563", "#2563EB", "#0D9488", "#16A34A", "#CA8A04", "#EA580C", "#DC2626", "#9333EA"],
10626
+ ["#1F2937", "#1E3A8A", "#134E4A", "#14532D", "#713F12", "#7C2D12", "#7F1D1D", "#581C87"]
10627
+ ];
10628
+ function isLightColor(hex) {
10629
+ const normalized = hex.replace("#", "");
10630
+ if (normalized.length !== 6) return true;
10631
+ const r = parseInt(normalized.slice(0, 2), 16) / 255;
10632
+ const g = parseInt(normalized.slice(2, 4), 16) / 255;
10633
+ const b = parseInt(normalized.slice(4, 6), 16) / 255;
10634
+ const toLinear = (c) => c <= 0.03928 ? c / 12.92 : ((c + 0.055) / 1.055) ** 2.4;
10635
+ const luminance = 0.2126 * toLinear(r) + 0.7152 * toLinear(g) + 0.0722 * toLinear(b);
10636
+ return luminance > 0.55;
10637
+ }
10638
+ function TextColorPicker({ editor, colors, currentColor, onClose }) {
10639
+ const [customColor, setCustomColor] = React6.useState(currentColor ?? "#000000");
10640
+ const rows = colors ? Array.isArray(colors[0]) ? colors : [colors] : DEFAULT_COLOR_ROWS;
10641
+ const applyColor = (color) => {
10642
+ editor.chain().focus().setColor(color).run();
10643
+ onClose();
10644
+ };
10645
+ const clearColor = () => {
10646
+ editor.chain().focus().unsetColor().run();
10647
+ onClose();
10648
+ };
10649
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "w-64 p-3", children: [
10650
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "mb-2 text-xs font-medium text-gray-400", children: "\uD14D\uC2A4\uD2B8 \uC0C9\uC0C1" }),
10651
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-1", children: rows.map((row, rowIdx) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex gap-1", children: row.map((color) => {
10652
+ const isSelected = currentColor?.toLowerCase() === color.toLowerCase();
10653
+ return /* @__PURE__ */ jsxRuntime.jsx(
10654
+ "button",
10655
+ {
10656
+ type: "button",
10657
+ "aria-label": `\uAE00\uC790 \uC0C9\uC0C1 ${color}`,
10658
+ onClick: () => applyColor(color),
10659
+ className: cn(
10660
+ "flex size-6 shrink-0 cursor-pointer items-center justify-center rounded-full border transition-transform hover:scale-110",
10661
+ color.toLowerCase() === "#ffffff" ? "border-gray-300" : "border-black/10"
10662
+ ),
10663
+ style: { backgroundColor: color },
10664
+ children: isSelected && /* @__PURE__ */ jsxRuntime.jsx(
10665
+ lucideReact.Check,
10666
+ {
10667
+ size: 12,
10668
+ strokeWidth: 3,
10669
+ className: isLightColor(color) ? "text-gray-900" : "text-white"
10670
+ }
10671
+ )
10672
+ },
10673
+ color
10674
+ );
10675
+ }) }, rowIdx)) }),
10676
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mt-3 flex items-center gap-2 border-t border-gray-100 pt-3", children: [
10677
+ /* @__PURE__ */ jsxRuntime.jsx("label", { className: "relative size-7 shrink-0 cursor-pointer overflow-hidden rounded-full border border-gray-200", children: /* @__PURE__ */ jsxRuntime.jsx(
10678
+ "input",
10679
+ {
10680
+ type: "color",
10681
+ value: customColor,
10682
+ onChange: (e) => {
10683
+ setCustomColor(e.target.value);
10684
+ applyColor(e.target.value);
10685
+ },
10686
+ className: "absolute -left-1 -top-1 size-9 cursor-pointer"
10687
+ }
10688
+ ) }),
10689
+ /* @__PURE__ */ jsxRuntime.jsx(
10690
+ "input",
10691
+ {
10692
+ type: "text",
10693
+ value: customColor,
10694
+ onChange: (e) => setCustomColor(e.target.value),
10695
+ onKeyDown: (e) => {
10696
+ if (e.key === "Enter") applyColor(customColor);
10697
+ },
10698
+ placeholder: "#RRGGBB",
10699
+ className: "h-7 flex-1 rounded border border-gray-200 px-2 text-xs text-gray-700 outline-none focus:border-indigo-400"
10700
+ }
10701
+ )
10702
+ ] }),
10703
+ /* @__PURE__ */ jsxRuntime.jsx(
10704
+ "button",
10705
+ {
10706
+ type: "button",
10707
+ onClick: clearColor,
10708
+ className: "mt-2 w-full cursor-pointer rounded py-1 text-xs font-medium text-gray-500 hover:bg-gray-100",
10709
+ children: "\uC0C9\uC0C1 \uC9C0\uC6B0\uAE30"
10710
+ }
10711
+ )
10712
+ ] });
10713
+ }
10582
10714
  function ToolbarButton(props) {
10583
10715
  const { onMouseDown, active, disabled, title, tooltip, variant = "default", children } = props;
10584
10716
  const theme = useRichEditorTheme();
@@ -10607,13 +10739,16 @@ function Divider() {
10607
10739
  function cmd(fn) {
10608
10740
  return (e) => {
10609
10741
  e.preventDefault();
10742
+ e.stopPropagation();
10610
10743
  fn();
10611
10744
  };
10612
10745
  }
10613
10746
  function RichEditorToolbar(props) {
10614
- const { editor, toolbar = {}, className } = props;
10747
+ const { editor, toolbar = {}, className, zIndex } = props;
10748
+ const popoverStyle = zIndex !== void 0 ? { zIndex } : void 0;
10615
10749
  const theme = useRichEditorTheme();
10616
10750
  const [tablePickerOpen, setTablePickerOpen] = React6.useState(false);
10751
+ const [colorPickerOpen, setColorPickerOpen] = React6.useState(false);
10617
10752
  const stateOrNull = react.useEditorState({
10618
10753
  editor,
10619
10754
  selector: ({ editor: e }) => ({
@@ -10632,7 +10767,8 @@ function RichEditorToolbar(props) {
10632
10767
  isOrderedList: e?.isActive("orderedList") ?? false,
10633
10768
  isBlockquote: e?.isActive("blockquote") ?? false,
10634
10769
  isCodeBlock: e?.isActive("codeBlock") ?? false,
10635
- isTable: e?.isActive("table") ?? false
10770
+ isTable: e?.isActive("table") ?? false,
10771
+ textColor: e?.getAttributes("textStyle").color ?? null
10636
10772
  })
10637
10773
  });
10638
10774
  if (!editor) return null;
@@ -10652,7 +10788,8 @@ function RichEditorToolbar(props) {
10652
10788
  isOrderedList: false,
10653
10789
  isBlockquote: false,
10654
10790
  isCodeBlock: false,
10655
- isTable: false
10791
+ isTable: false,
10792
+ textColor: null
10656
10793
  };
10657
10794
  const showHeadingGroup = toolbar.heading !== false && (Array.isArray(toolbar.heading) ? toolbar.heading.length > 0 : true);
10658
10795
  const showInlineGroup = toolbar.bold !== false || toolbar.italic !== false || toolbar.strike !== false || toolbar.code !== false;
@@ -10750,8 +10887,56 @@ function RichEditorToolbar(props) {
10750
10887
  children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Code, { size: 16 })
10751
10888
  }
10752
10889
  ),
10753
- showAlignGroup && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
10890
+ toolbar.textColor && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
10754
10891
  showInlineGroup && /* @__PURE__ */ jsxRuntime.jsx(Divider, {}),
10892
+ /* @__PURE__ */ jsxRuntime.jsxs(Popover, { open: colorPickerOpen, onOpenChange: setColorPickerOpen, children: [
10893
+ /* @__PURE__ */ jsxRuntime.jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(
10894
+ "button",
10895
+ {
10896
+ type: "button",
10897
+ "aria-label": "\uAE00\uC790 \uC0C9\uC0C1",
10898
+ className: cn(
10899
+ "flex h-8 w-8 cursor-pointer flex-col items-center justify-center gap-0.5 rounded text-sm transition-colors",
10900
+ "disabled:cursor-not-allowed disabled:opacity-40",
10901
+ state.textColor ? theme.toolbar.btnActive : theme.toolbar.btnIdle
10902
+ ),
10903
+ children: [
10904
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Baseline, { size: 16 }),
10905
+ /* @__PURE__ */ jsxRuntime.jsx(
10906
+ "span",
10907
+ {
10908
+ className: "h-0.5 w-4 rounded-full",
10909
+ style: { backgroundColor: state.textColor ?? "currentColor" }
10910
+ }
10911
+ )
10912
+ ]
10913
+ }
10914
+ ) }),
10915
+ /* @__PURE__ */ jsxRuntime.jsx(
10916
+ PopoverContent,
10917
+ {
10918
+ className: "w-auto p-0",
10919
+ align: "start",
10920
+ position: "bottom",
10921
+ style: popoverStyle,
10922
+ onMouseDown: (e) => e.stopPropagation(),
10923
+ onOpenAutoFocus: (e) => e.preventDefault(),
10924
+ onFocusOutside: (e) => e.preventDefault(),
10925
+ children: editor && /* @__PURE__ */ jsxRuntime.jsx(
10926
+ TextColorPicker,
10927
+ {
10928
+ editor,
10929
+ currentColor: state.textColor,
10930
+ colors: Array.isArray(toolbar.textColor) ? toolbar.textColor : void 0,
10931
+ onClose: () => setColorPickerOpen(false)
10932
+ }
10933
+ )
10934
+ }
10935
+ )
10936
+ ] })
10937
+ ] }),
10938
+ showAlignGroup && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
10939
+ (showInlineGroup || toolbar.textColor) && /* @__PURE__ */ jsxRuntime.jsx(Divider, {}),
10755
10940
  /* @__PURE__ */ jsxRuntime.jsx(
10756
10941
  ToolbarButton,
10757
10942
  {
@@ -10849,7 +11034,19 @@ function RichEditorToolbar(props) {
10849
11034
  children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Table, { size: 16 })
10850
11035
  }
10851
11036
  ) }),
10852
- /* @__PURE__ */ jsxRuntime.jsx(PopoverContent, { className: "w-auto p-0", align: "start", position: "bottom", children: editor && /* @__PURE__ */ jsxRuntime.jsx(TableGridPicker, { editor, onClose: () => setTablePickerOpen(false) }) })
11037
+ /* @__PURE__ */ jsxRuntime.jsx(
11038
+ PopoverContent,
11039
+ {
11040
+ className: "w-auto p-0",
11041
+ align: "start",
11042
+ position: "bottom",
11043
+ style: popoverStyle,
11044
+ onMouseDown: (e) => e.stopPropagation(),
11045
+ onOpenAutoFocus: (e) => e.preventDefault(),
11046
+ onFocusOutside: (e) => e.preventDefault(),
11047
+ children: editor && /* @__PURE__ */ jsxRuntime.jsx(TableGridPicker, { editor, onClose: () => setTablePickerOpen(false) })
11048
+ }
11049
+ )
10853
11050
  ] }),
10854
11051
  state.isTable && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
10855
11052
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -10944,7 +11141,8 @@ var DEFAULT_TOOLBAR = {
10944
11141
  bulletList: true,
10945
11142
  orderedList: true,
10946
11143
  blockquote: true,
10947
- code: true
11144
+ code: true,
11145
+ textColor: true
10948
11146
  };
10949
11147
  function RichEditorContent(props) {
10950
11148
  const { editor, className, editorClassName, minHeight, maxHeight } = props;
@@ -10954,7 +11152,20 @@ function RichEditorContent(props) {
10954
11152
  style.maxHeight = typeof maxHeight === "number" ? `${maxHeight}px` : maxHeight;
10955
11153
  style.overflowY = "auto";
10956
11154
  }
10957
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("rich-editor-content", className), style, children: /* @__PURE__ */ jsxRuntime.jsx(react.EditorContent, { editor, className: cn("h-full", editorClassName) }) });
11155
+ return /* @__PURE__ */ jsxRuntime.jsx(
11156
+ "div",
11157
+ {
11158
+ className: cn("rich-editor-content cursor-text", className),
11159
+ style,
11160
+ onMouseDown: (e) => {
11161
+ if (!editor) return;
11162
+ if (e.target.closest(".ProseMirror")) return;
11163
+ e.preventDefault();
11164
+ editor.commands.focus("end");
11165
+ },
11166
+ children: /* @__PURE__ */ jsxRuntime.jsx(react.EditorContent, { editor, className: cn("h-full", editorClassName) })
11167
+ }
11168
+ );
10958
11169
  }
10959
11170
  var RichEditor = React6.forwardRef(function RichEditor2({
10960
11171
  value,
@@ -10973,6 +11184,11 @@ var RichEditor = React6.forwardRef(function RichEditor2({
10973
11184
  bodyClassName,
10974
11185
  editorClassName,
10975
11186
  mentionClassName,
11187
+ mentionListClassName,
11188
+ mentionTagClassName,
11189
+ accentColor,
11190
+ accentTextColor,
11191
+ zIndex,
10976
11192
  themeTokens,
10977
11193
  editable = true,
10978
11194
  autofocus
@@ -10998,6 +11214,11 @@ var RichEditor = React6.forwardRef(function RichEditor2({
10998
11214
  mentionUsers,
10999
11215
  onMentionSearch,
11000
11216
  mentionClassName,
11217
+ mentionListClassName,
11218
+ mentionTagClassName,
11219
+ accentColor,
11220
+ accentTextColor,
11221
+ zIndex,
11001
11222
  additionalExtensions,
11002
11223
  editable,
11003
11224
  autofocus,
@@ -11043,17 +11264,23 @@ var RichEditor = React6.forwardRef(function RichEditor2({
11043
11264
  ...themeTokens.toolbar && { toolbar: { ...baseTheme.toolbar, ...themeTokens.toolbar } },
11044
11265
  ...themeTokens.mention && { mention: { ...baseTheme.mention, ...themeTokens.mention } }
11045
11266
  } : baseTheme;
11267
+ const accentStyle = {
11268
+ ...accentColor ? { "--rich-editor-accent-bg": accentColor } : {},
11269
+ ...accentTextColor ? { "--rich-editor-accent-text": accentTextColor } : {}
11270
+ };
11046
11271
  return /* @__PURE__ */ jsxRuntime.jsx(RichEditorThemeProvider, { value: resolvedTheme, children: /* @__PURE__ */ jsxRuntime.jsxs(
11047
11272
  "div",
11048
11273
  {
11049
11274
  className: cn("overflow-hidden rounded-lg border border-gray-200 shadow-sm flex flex-col relative", className),
11050
11275
  "data-rich-editor-theme": theme,
11276
+ style: accentStyle,
11051
11277
  children: [
11052
11278
  isToolbarVisible && /* @__PURE__ */ jsxRuntime.jsx(
11053
11279
  RichEditorToolbar,
11054
11280
  {
11055
11281
  editor,
11056
- toolbar: activeToolbar
11282
+ toolbar: activeToolbar,
11283
+ zIndex
11057
11284
  }
11058
11285
  ),
11059
11286
  /* @__PURE__ */ jsxRuntime.jsx(