@oliasoft-open-source/react-ui-library 5.13.3 → 5.13.5-beta-1

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.d.ts CHANGED
@@ -55,7 +55,7 @@ export declare type AuditLogOperation = 'Created' | 'Cloned' | 'Reverted' | 'Imp
55
55
 
56
56
  export declare type AuditLogSource = 'System' | 'Application' | 'API';
57
57
 
58
- export declare const Badge: ({ children, color, title, dot, margin, small, }: IBadgeProps) => JSX_2.Element;
58
+ export declare const Badge: ({ children, color, textColor: textColorProp, title, dot, margin, small, }: IBadgeProps) => JSX_2.Element;
59
59
 
60
60
  export declare const Breadcrumb: ({ links, small }: IBreadcrumbProps) => JSX_2.Element;
61
61
 
@@ -215,6 +215,7 @@ declare interface IAuditLogProps {
215
215
  export declare interface IBadgeProps {
216
216
  children?: ReactNode;
217
217
  color?: string;
218
+ textColor?: string;
218
219
  title?: TStringOrNumber | ReactNode | null;
219
220
  dot?: boolean;
220
221
  margin?: TStringOrNumber | null;
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";
@@ -827,29 +828,28 @@ const Section$1 = ({ section: e, closeOnOptionClick: t, close: n, tree: r, path:
827
828
  placement: e || (t ? "right-start" : "bottom-start")
828
829
  }), isStringNumberOrNode = (e) => isString(e) || isNumber(e) || isValidElement(e), getType = (e) => Array.isArray(e) ? "array" : typeof e;
829
830
  var badge_module_default = {
830
- wrapper: "_wrapper_nwprz_1",
831
- badge: "_badge_nwprz_5",
832
- label: "_label_nwprz_11",
833
- dark: "_dark_nwprz_23",
834
- light: "_light_nwprz_26",
835
- small: "_small_nwprz_29",
836
- dot: "_dot_nwprz_33",
837
- hasChildren: "_hasChildren_nwprz_39"
831
+ wrapper: "_wrapper_14vly_1",
832
+ badge: "_badge_14vly_5",
833
+ label: "_label_14vly_11",
834
+ small: "_small_14vly_23",
835
+ dot: "_dot_14vly_27",
836
+ hasChildren: "_hasChildren_14vly_33"
838
837
  }, isDark = (e) => {
839
838
  let t = e.substring(1), n = parseInt(t, 16), r = n >> 16 & 255, i = n >> 8 & 255, a = n >> 0 & 255;
840
839
  return .2126 * r + .7152 * i + .0722 * a < 128;
841
840
  };
842
- const Badge = ({ children: e, color: t = "", title: n = null, dot: r = !1, margin: i = null, small: a = !1 }) => {
843
- let o = !(n === null && r === !1);
841
+ const Badge = ({ children: e, color: t = "", textColor: n = "", title: r = null, dot: i = !1, margin: a = null, small: o = !1 }) => {
842
+ let s = !(r === null && i === !1), c = n || (isDark(t) ? "#fff" : "rgba(0, 0, 0, 0.6)");
844
843
  return /* @__PURE__ */ jsxs("div", {
845
844
  className: badge_module_default.wrapper,
846
- children: [o && /* @__PURE__ */ jsx("sup", {
847
- className: cx(badge_module_default.badge, isDark(t) ? badge_module_default.dark : badge_module_default.light, n === null ? badge_module_default.dot : badge_module_default.label, a ? badge_module_default.small : "", e ? badge_module_default.hasChildren : ""),
845
+ children: [s && /* @__PURE__ */ jsx("sup", {
846
+ className: cx(badge_module_default.badge, r === null ? badge_module_default.dot : badge_module_default.label, o ? badge_module_default.small : "", e ? badge_module_default.hasChildren : ""),
848
847
  style: {
849
848
  background: t || void 0,
850
- margin: i || void 0
849
+ margin: a || void 0,
850
+ color: c
851
851
  },
852
- children: n
852
+ children: r
853
853
  }), e]
854
854
  });
855
855
  }, Button$1 = ({ trigger: e, label: t, colored: n, small: r, width: i, disabled: a, groupOrder: o, loading: c, error: l, warning: u, active: d, tabIndex: f }) => {
@@ -5003,7 +5003,7 @@ const normalizeParsedResult = (e) => {
5003
5003
  onClickCopyClipboard: useCallback(async (e) => {
5004
5004
  let t = await v();
5005
5005
  if (!t) return;
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) => 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: " " });
5007
5007
  try {
5008
5008
  await navigator.clipboard.writeText(c), transitionToast({ message: {
5009
5009
  type: "Success",
@@ -6004,94 +6004,95 @@ var rich_text_toolbar_module_default = {
6004
6004
  let RichTextIcon = /* @__PURE__ */ function(e) {
6005
6005
  return e.BOLD = "bold", e.ITALIC = "italic", e.CODE = "code", e.UL = "ul", e.OL = "ol", e;
6006
6006
  }({});
6007
- const RichTextToolbar = ({ disabled: e = !1, toolbarComponent: t = null }) => {
6008
- 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 = [
6009
6010
  {
6010
6011
  icon: RichTextIcon.BOLD,
6011
- onClick: r,
6012
- 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
6013
6014
  },
6014
6015
  {
6015
6016
  icon: RichTextIcon.ITALIC,
6016
- onClick: o,
6017
- 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
6018
6019
  },
6019
6020
  {
6020
6021
  icon: RichTextIcon.CODE,
6021
- onClick: a,
6022
- 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
6023
6024
  },
6024
6025
  {
6025
6026
  icon: RichTextIcon.UL,
6026
- onClick: i,
6027
- 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
6028
6029
  },
6029
6030
  {
6030
6031
  icon: RichTextIcon.OL,
6031
- onClick: s,
6032
- 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
6033
6034
  }
6034
6035
  ];
6035
6036
  return /* @__PURE__ */ jsxs("div", {
6036
6037
  className: rich_text_toolbar_module_default.richTextToolbarContainer,
6037
6038
  children: [/* @__PURE__ */ jsx("div", {
6038
6039
  className: rich_text_toolbar_module_default.richTextToolbar,
6039
- children: l.map((t, r) => /* @__PURE__ */ jsx(Button, {
6040
+ children: c.map((e, n) => /* @__PURE__ */ jsx(Button, {
6040
6041
  small: !0,
6041
6042
  round: !0,
6042
6043
  basic: !0,
6043
- icon: t.icon,
6044
+ icon: e.icon,
6044
6045
  colored: Color.MUTED,
6045
- onClick: () => {
6046
- t.onClick(), n();
6047
- },
6048
- active: t.active,
6049
- disabled: e
6050
- }, r))
6051
- }), t]
6046
+ onClick: e.onClick,
6047
+ active: e.active,
6048
+ disabled: t
6049
+ }, n))
6050
+ }), n]
6052
6051
  });
6053
6052
  };
6054
6053
  var rich_text_input_module_default = {
6055
- inputInTable: "_inputInTable_1fb4l_1",
6056
- inputHover: "_inputHover_1fb4l_13",
6057
- inputFocus: "_inputFocus_1fb4l_18",
6058
- inputError: "_inputError_1fb4l_25",
6059
- inputWarning: "_inputWarning_1fb4l_26",
6060
- inputDisabled: "_inputDisabled_1fb4l_61",
6061
- hideScrollbars: "_hideScrollbars_1fb4l_67",
6062
- 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"
6063
6062
  };
6064
6063
  const RichTextInput = memo(forwardRef(({ placeholder: e, onChange: t, value: n, disabled: r, toolbarComponent: i }, a) => {
6065
- let c = useContext(DisabledContext), u = r || c, { manager: d, state: f, setState: p, getContext: m } = useRemirror({
6066
- extensions: useCallback(() => [
6067
- new BoldExtension({}),
6068
- new BulletListExtension({}),
6069
- new CodeExtension(),
6070
- new ItalicExtension(),
6071
- new MarkdownExtension({}),
6072
- new OrderedListExtension(),
6073
- new PlaceholderExtension({ placeholder: e })
6074
- ], [e]),
6075
- content: n,
6076
- selection: "start",
6077
- 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
+ }
6078
6076
  });
6079
- 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", {
6080
6090
  className: rich_text_input_module_default.richTextInput,
6081
- children: /* @__PURE__ */ jsxs(Remirror, {
6082
- manager: d,
6083
- state: f,
6084
- placeholder: e,
6085
- onChange: ({ helpers: e, state: n }) => {
6086
- let r = e.getMarkdown(n);
6087
- t && t(r), p(n);
6088
- },
6089
- editable: !u,
6090
- children: [/* @__PURE__ */ jsx(RichTextToolbar, {
6091
- disabled: u,
6092
- toolbarComponent: i
6093
- }), /* @__PURE__ */ jsx(EditorComponent, {})]
6094
- })
6091
+ children: [/* @__PURE__ */ jsx(RichTextToolbar, {
6092
+ editor: d,
6093
+ disabled: u,
6094
+ toolbarComponent: i
6095
+ }), /* @__PURE__ */ jsx(EditorContent, { editor: d })]
6095
6096
  });
6096
6097
  }));
6097
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.3",
3
+ "version": "5.13.5-beta-1",
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",