@oliasoft-open-source/react-ui-library 5.13.4 → 5.13.5

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.js CHANGED
@@ -22,10 +22,11 @@ import { useVirtualizer } from "@tanstack/react-virtual";
22
22
  import { SimplifyAP } from "simplify-ts";
23
23
  import Papa from "papaparse";
24
24
  import { Slide, ToastContainer as Toaster, toast as toast$1 } from "react-toastify";
25
- import { isNullOrUndefined } from "remirror";
26
- import { BoldExtension, BulletListExtension, CodeExtension, ItalicExtension, MarkdownExtension, OrderedListExtension, PlaceholderExtension } from "remirror/extensions";
27
- import { EditorComponent, Remirror, useActive, useCommands, useRemirror } from "@remirror/react";
28
- import "remirror/styles/all.css";
25
+ import { isNil as isNil$1 } from "es-toolkit";
26
+ import { EditorContent, useEditor } from "@tiptap/react";
27
+ import StarterKit from "@tiptap/starter-kit";
28
+ import Placeholder from "@tiptap/extension-placeholder";
29
+ import { Markdown } from "@tiptap/markdown";
29
30
  import { DndProvider } from "react-dnd";
30
31
  import { MultiBackend, Tree as Tree$1, getBackendOptions } from "@minoru/react-dnd-treeview";
31
32
  import ReactDiffViewer, { DiffMethod } from "react-diff-viewer-continued";
@@ -5002,7 +5003,7 @@ const normalizeParsedResult = (e) => {
5002
5003
  onClickCopyClipboard: useCallback(async (e) => {
5003
5004
  let t = await v();
5004
5005
  if (!t) return;
5005
- let { fields: n = [], units: r = [], rows: a = [] } = t, o = (r == null ? [] : r).map((e) => e != null && e.length ? e : placeholder$1).slice(0, n.length), s = (e, t) => t === "comma" ? e.replace(/\./g, ",") : e, c = unParse(n, o, a.map((t) => t.map((t) => isNullOrUndefined(t) ? "" : s(t.toString(), e))), { delimiter: " " });
5006
+ let { fields: n = [], units: r = [], rows: a = [] } = t, o = (r == null ? [] : r).map((e) => e != null && e.length ? e : placeholder$1).slice(0, n.length), s = (e, t) => t === "comma" ? e.replace(/\./g, ",") : e, c = unParse(n, o, a.map((t) => t.map((t) => isNil$1(t) ? "" : s(t.toString(), e))), { delimiter: " " });
5006
5007
  try {
5007
5008
  await navigator.clipboard.writeText(c), transitionToast({ message: {
5008
5009
  type: "Success",
@@ -6003,94 +6004,95 @@ var rich_text_toolbar_module_default = {
6003
6004
  let RichTextIcon = /* @__PURE__ */ function(e) {
6004
6005
  return e.BOLD = "bold", e.ITALIC = "italic", e.CODE = "code", e.UL = "ul", e.OL = "ol", e;
6005
6006
  }({});
6006
- const RichTextToolbar = ({ disabled: e = !1, toolbarComponent: t = null }) => {
6007
- let { focus: n, toggleBold: r, toggleBulletList: i, toggleCode: a, toggleItalic: o, toggleOrderedList: s } = useCommands(), c = useActive(), l = [
6007
+ const RichTextToolbar = ({ editor: e, disabled: t = !1, toolbarComponent: n = null }) => {
6008
+ var r, i, a, o, s;
6009
+ let c = [
6008
6010
  {
6009
6011
  icon: RichTextIcon.BOLD,
6010
- onClick: r,
6011
- active: c.bold()
6012
+ onClick: () => e == null ? void 0 : e.chain().focus().toggleBold().run(),
6013
+ active: (r = e == null ? void 0 : e.isActive("bold")) == null ? !1 : r
6012
6014
  },
6013
6015
  {
6014
6016
  icon: RichTextIcon.ITALIC,
6015
- onClick: o,
6016
- active: c.italic()
6017
+ onClick: () => e == null ? void 0 : e.chain().focus().toggleItalic().run(),
6018
+ active: (i = e == null ? void 0 : e.isActive("italic")) == null ? !1 : i
6017
6019
  },
6018
6020
  {
6019
6021
  icon: RichTextIcon.CODE,
6020
- onClick: a,
6021
- active: c.code()
6022
+ onClick: () => e == null ? void 0 : e.chain().focus().toggleCode().run(),
6023
+ active: (a = e == null ? void 0 : e.isActive("code")) == null ? !1 : a
6022
6024
  },
6023
6025
  {
6024
6026
  icon: RichTextIcon.UL,
6025
- onClick: i,
6026
- active: c.bulletList()
6027
+ onClick: () => e == null ? void 0 : e.chain().focus().toggleBulletList().run(),
6028
+ active: (o = e == null ? void 0 : e.isActive("bulletList")) == null ? !1 : o
6027
6029
  },
6028
6030
  {
6029
6031
  icon: RichTextIcon.OL,
6030
- onClick: s,
6031
- active: c.orderedList()
6032
+ onClick: () => e == null ? void 0 : e.chain().focus().toggleOrderedList().run(),
6033
+ active: (s = e == null ? void 0 : e.isActive("orderedList")) == null ? !1 : s
6032
6034
  }
6033
6035
  ];
6034
6036
  return /* @__PURE__ */ jsxs("div", {
6035
6037
  className: rich_text_toolbar_module_default.richTextToolbarContainer,
6036
6038
  children: [/* @__PURE__ */ jsx("div", {
6037
6039
  className: rich_text_toolbar_module_default.richTextToolbar,
6038
- children: l.map((t, r) => /* @__PURE__ */ jsx(Button, {
6040
+ children: c.map((e, n) => /* @__PURE__ */ jsx(Button, {
6039
6041
  small: !0,
6040
6042
  round: !0,
6041
6043
  basic: !0,
6042
- icon: t.icon,
6044
+ icon: e.icon,
6043
6045
  colored: Color.MUTED,
6044
- onClick: () => {
6045
- t.onClick(), n();
6046
- },
6047
- active: t.active,
6048
- disabled: e
6049
- }, r))
6050
- }), t]
6046
+ onClick: e.onClick,
6047
+ active: e.active,
6048
+ disabled: t
6049
+ }, n))
6050
+ }), n]
6051
6051
  });
6052
6052
  };
6053
6053
  var rich_text_input_module_default = {
6054
- inputInTable: "_inputInTable_1fb4l_1",
6055
- inputHover: "_inputHover_1fb4l_13",
6056
- inputFocus: "_inputFocus_1fb4l_18",
6057
- inputError: "_inputError_1fb4l_25",
6058
- inputWarning: "_inputWarning_1fb4l_26",
6059
- inputDisabled: "_inputDisabled_1fb4l_61",
6060
- hideScrollbars: "_hideScrollbars_1fb4l_67",
6061
- richTextInput: "_richTextInput_1fb4l_77"
6054
+ inputInTable: "_inputInTable_gb097_1",
6055
+ inputHover: "_inputHover_gb097_13",
6056
+ inputFocus: "_inputFocus_gb097_18",
6057
+ inputError: "_inputError_gb097_25",
6058
+ inputWarning: "_inputWarning_gb097_26",
6059
+ inputDisabled: "_inputDisabled_gb097_61",
6060
+ hideScrollbars: "_hideScrollbars_gb097_67",
6061
+ richTextInput: "_richTextInput_gb097_77"
6062
6062
  };
6063
6063
  const RichTextInput = memo(forwardRef(({ placeholder: e, onChange: t, value: n, disabled: r, toolbarComponent: i }, a) => {
6064
- let c = useContext(DisabledContext), u = r || c, { manager: d, state: f, setState: p, getContext: m } = useRemirror({
6065
- extensions: useCallback(() => [
6066
- new BoldExtension({}),
6067
- new BulletListExtension({}),
6068
- new CodeExtension(),
6069
- new ItalicExtension(),
6070
- new MarkdownExtension({}),
6071
- new OrderedListExtension(),
6072
- new PlaceholderExtension({ placeholder: e })
6073
- ], [e]),
6074
- content: n,
6075
- selection: "start",
6076
- stringHandler: "markdown"
6064
+ let o = useContext(DisabledContext), u = r || o, d = useEditor({
6065
+ extensions: [
6066
+ StarterKit,
6067
+ Placeholder.configure({ placeholder: e }),
6068
+ Markdown
6069
+ ],
6070
+ content: n == null ? "" : n,
6071
+ contentType: "markdown",
6072
+ editable: !u,
6073
+ onUpdate: ({ editor: e }) => {
6074
+ t == null || t(e.getMarkdown());
6075
+ }
6077
6076
  });
6078
- return useImperativeHandle(a, () => m(), [m]), /* @__PURE__ */ jsx("div", {
6077
+ return useEffect(() => {
6078
+ if (!d) return;
6079
+ let e = d.getMarkdown();
6080
+ n !== void 0 && n !== e && d.commands.setContent(n, {
6081
+ emitUpdate: !1,
6082
+ contentType: "markdown"
6083
+ });
6084
+ }, [n, d]), useEffect(() => {
6085
+ d && d.setEditable(!u);
6086
+ }, [u, d]), useImperativeHandle(a, () => ({
6087
+ clearContent: () => d == null ? void 0 : d.commands.clearContent(!0),
6088
+ editor: d
6089
+ }), [d]), /* @__PURE__ */ jsxs("div", {
6079
6090
  className: rich_text_input_module_default.richTextInput,
6080
- children: /* @__PURE__ */ jsxs(Remirror, {
6081
- manager: d,
6082
- state: f,
6083
- placeholder: e,
6084
- onChange: ({ helpers: e, state: n }) => {
6085
- let r = e.getMarkdown(n);
6086
- t && t(r), p(n);
6087
- },
6088
- editable: !u,
6089
- children: [/* @__PURE__ */ jsx(RichTextToolbar, {
6090
- disabled: u,
6091
- toolbarComponent: i
6092
- }), /* @__PURE__ */ jsx(EditorComponent, {})]
6093
- })
6091
+ children: [/* @__PURE__ */ jsx(RichTextToolbar, {
6092
+ editor: d,
6093
+ disabled: u,
6094
+ toolbarComponent: i
6095
+ }), /* @__PURE__ */ jsx(EditorContent, { editor: d })]
6094
6096
  });
6095
6097
  }));
6096
6098
  var row_module_default = { row: "_row_n16je_1" };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oliasoft-open-source/react-ui-library",
3
- "version": "5.13.4",
3
+ "version": "5.13.5",
4
4
  "description": "Reusable UI components for React projects",
5
5
  "homepage": "https://oliasoft-open-source.gitlab.io/react-ui-library",
6
6
  "bugs": {
@@ -39,9 +39,10 @@
39
39
  "dependencies": {
40
40
  "@fontsource/noto-sans": "^5.2.5",
41
41
  "@minoru/react-dnd-treeview": "^3.5.0",
42
- "@remirror/pm": "^3.0.1",
43
- "@remirror/react": "^3.0.3",
44
42
  "@tanstack/react-virtual": "^3.13.2",
43
+ "@tiptap/extension-placeholder": "^3.20.0",
44
+ "@tiptap/react": "^3.20.0",
45
+ "@tiptap/starter-kit": "^3.20.0",
45
46
  "@types/rc-slider": "^9.3.1",
46
47
  "@types/react-resizable": "^3.0.8",
47
48
  "@types/react-window": "^1.8.8",
@@ -64,10 +65,10 @@
64
65
  "react-toastify": "^9.1.3",
65
66
  "react-transition-group": "^4.4.5",
66
67
  "react-window": "^1.8.11",
67
- "remirror": "^3.0.3",
68
68
  "resize-observer-polyfill": "^1.5.1",
69
69
  "simplify-ts": "^1.0.2",
70
- "styled-components": "^6.1.15"
70
+ "styled-components": "^6.1.15",
71
+ "@tiptap/markdown": "^3.20.0"
71
72
  },
72
73
  "devDependencies": {
73
74
  "@dmsnell/diff-match-patch": "^1.1.0",