@oliasoft-open-source/react-ui-library 5.13.6-beta-2 → 5.13.6

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
@@ -1239,17 +1239,6 @@ export declare interface IRadioButtonProps {
1239
1239
  classForContainer?: 'grouped fields' | 'inline fields';
1240
1240
  }
1241
1241
 
1242
- declare interface IRadioCell extends TCommonCell {
1243
- type: TCellType;
1244
- name: TStringOrNumber;
1245
- value: TStringOrNumber;
1246
- selected: boolean;
1247
- disabled?: boolean;
1248
- small?: boolean;
1249
- onChange: (evt: default_2.MouseEvent<HTMLDivElement, MouseEvent>) => void;
1250
- testId?: string;
1251
- }
1252
-
1253
1242
  declare interface IReorderData {
1254
1243
  from?: number;
1255
1244
  to?: number;
@@ -2032,9 +2021,9 @@ export declare type TButtonPosition = 'top' | 'bottom';
2032
2021
 
2033
2022
  export declare type TButtonType = 'submit' | 'button' | 'reset';
2034
2023
 
2035
- declare type TCellShape = IPopoverCell | IStaticCell | ISelectCell | IHelpIconCell | ILibraryIconCell | ICheckBoxCell | IIconCell | IInputCell | ILinkCell | INumberInputCell | IActionCell | IRadioCell | ISortCell | ISliderCell | ISimpleCell;
2024
+ declare type TCellShape = IPopoverCell | IStaticCell | ISelectCell | IHelpIconCell | ILibraryIconCell | ICheckBoxCell | IIconCell | IInputCell | ILinkCell | INumberInputCell | IActionCell | ISortCell | ISliderCell | ISimpleCell;
2036
2025
 
2037
- declare type TCellType = 'Static' | 'Icon' | 'Select' | 'Input' | 'NumberInput' | 'Popover' | 'CheckBox' | 'Radio' | 'Actions' | 'Link' | 'Slider' | 'Unit' | string;
2026
+ declare type TCellType = 'Static' | 'Icon' | 'Select' | 'Input' | 'NumberInput' | 'Popover' | 'CheckBox' | 'Actions' | 'Link' | 'Slider' | 'Unit' | string;
2038
2027
 
2039
2028
  export declare type TChangeEvent<T extends HTMLElement = HTMLInputElement> = ChangeEvent<T> & {
2040
2029
  target: T | {
package/dist/index.js CHANGED
@@ -22,11 +22,10 @@ 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 { 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";
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";
30
29
  import { DndProvider } from "react-dnd";
31
30
  import { MultiBackend, Tree as Tree$1, getBackendOptions } from "@minoru/react-dnd-treeview";
32
31
  import ReactDiffViewer, { DiffMethod } from "react-diff-viewer-continued";
@@ -3587,55 +3586,7 @@ const Popover = ({ children: t, content: n, placement: r = "top-center", closeOn
3587
3586
  })
3588
3587
  })
3589
3588
  });
3590
- };
3591
- var radio_button_module_default = {
3592
- wrapper: "_wrapper_1homz_1",
3593
- inline: "_inline_1homz_1",
3594
- radio: "_radio_1homz_5",
3595
- labelMargin: "_labelMargin_1homz_8",
3596
- small: "_small_1homz_27",
3597
- noMargin: "_noMargin_1homz_32",
3598
- noLabel: "_noLabel_1homz_36",
3599
- disabled: "_disabled_1homz_96",
3600
- isInTable: "_isInTable_1homz_112",
3601
- helpIconEnabled: "_helpIconEnabled_1homz_117"
3602
- };
3603
- const RadioInput = ({ name: e, label: t, value: n, selected: r, disabled: i = !1, small: a = !1, onChange: o, noMargin: s = !1, testId: c, helpText: l, onClickHelp: u, textTransform: d = TextTransform.CAPITALIZE }) => {
3604
- let f = l || u;
3605
- return /* @__PURE__ */ jsxs("div", {
3606
- className: cx(radio_button_module_default.radio, i ? radio_button_module_default.disabled : null, a ? radio_button_module_default.small : null, s ? radio_button_module_default.noMargin : null, t ? null : radio_button_module_default.noLabel),
3607
- onClick: o,
3608
- "data-testid": c,
3609
- children: [
3610
- /* @__PURE__ */ jsx("input", {
3611
- type: InputType.RADIO,
3612
- value: n,
3613
- checked: r,
3614
- onChange: () => {},
3615
- disabled: i
3616
- }),
3617
- /* @__PURE__ */ jsx("label", {
3618
- "data-name": e,
3619
- "data-value": n,
3620
- style: { textTransform: d },
3621
- children: t
3622
- }),
3623
- f && /* @__PURE__ */ jsx("div", {
3624
- className: radio_button_module_default.helpIconEnabled,
3625
- onClick: u,
3626
- children: /* @__PURE__ */ jsx(HelpIcon, { text: l })
3627
- })
3628
- ]
3629
- });
3630
- }, RadioCell = ({ cell: e, testId: t }) => /* @__PURE__ */ jsx(RadioInput, {
3631
- selected: e.selected,
3632
- name: e.name,
3633
- value: e.value,
3634
- noMargin: !0,
3635
- disabled: e.disabled,
3636
- onChange: (t) => e.onChange(t),
3637
- testId: t
3638
- }), CellWrapper = ({ cell: e, isHeader: t, columnAlignment: n, testId: r }) => {
3589
+ }, CellWrapper = ({ cell: e, isHeader: t, columnAlignment: n, testId: r }) => {
3639
3590
  if (!e) return null;
3640
3591
  switch (e.type) {
3641
3592
  case "Input":
@@ -3654,10 +3605,6 @@ const RadioInput = ({ name: e, label: t, value: n, selected: r, disabled: i = !1
3654
3605
  cell: e,
3655
3606
  testId: r
3656
3607
  });
3657
- case "Radio": return /* @__PURE__ */ jsx(RadioCell, {
3658
- cell: e,
3659
- testId: r
3660
- });
3661
3608
  case "Slider": return /* @__PURE__ */ jsx(SliderCell, { cell: e });
3662
3609
  case "Icon": return /* @__PURE__ */ jsx(IconCell, { cell: e });
3663
3610
  case "Actions": return /* @__PURE__ */ jsx(ActionsCell, { cell: e });
@@ -3670,7 +3617,7 @@ const RadioInput = ({ name: e, label: t, value: n, selected: r, disabled: i = !1
3670
3617
  }
3671
3618
  };
3672
3619
  let CellType = /* @__PURE__ */ function(e) {
3673
- return e.INPUT = "Input", e.NUMBER_INPUT = "NumberInput", e.SELECT = "Select", e.POPOVER = "Popover", e.SLIDER = "Slider", e.CHECKBOX = "CheckBox", e.RADIO = "Radio", e.ACTIONS = "Actions", e.AUTO_UNIT = "AutoUnit", e.UNIT = "Unit", e.STATIC = "Static", e;
3620
+ return e.INPUT = "Input", e.NUMBER_INPUT = "NumberInput", e.SELECT = "Select", e.POPOVER = "Popover", e.SLIDER = "Slider", e.CHECKBOX = "CheckBox", e.ACTIONS = "Actions", e.AUTO_UNIT = "AutoUnit", e.UNIT = "Unit", e.STATIC = "Static", e;
3674
3621
  }({});
3675
3622
  const Cell = ({ cell: e, isHeader: t, columnHeaderAlignment: n, columnAlignment: r = Align.LEFT, width: i, testId: a }) => {
3676
3623
  var o;
@@ -3679,7 +3626,7 @@ const Cell = ({ cell: e, isHeader: t, columnHeaderAlignment: n, columnAlignment:
3679
3626
  bodyAlignment: r,
3680
3627
  headerAlignment: n,
3681
3628
  isHeader: t
3682
- }, m = getCellAlignment(f, cell_module_default), h = getCellAlignment(f, cell_module_default, !0), _ = e.type === CellType.INPUT || e.type === CellType.NUMBER_INPUT || e.type === CellType.SELECT || e.type === CellType.POPOVER ? cell_module_default.inputCell : e.type === CellType.SLIDER ? cell_module_default.sliderCell : e.type === CellType.CHECKBOX || e.type === CellType.RADIO ? cell_module_default.checkBoxCell : e.type === CellType.ACTIONS ? cell_module_default.actionsCell : cell_module_default.staticCell, v = cx(cell_module_default.cell, _, e.hasSort ? cell_module_default.sortingCell : null, m, e.breakWord ? cell_module_default.breakWord : ""), y = (o = u == null ? i : u) == null ? void 0 : o, b = e.type === CellType.STATIC || !e.type, x = {
3629
+ }, m = getCellAlignment(f, cell_module_default), h = getCellAlignment(f, cell_module_default, !0), _ = e.type === CellType.INPUT || e.type === CellType.NUMBER_INPUT || e.type === CellType.SELECT || e.type === CellType.POPOVER ? cell_module_default.inputCell : e.type === CellType.SLIDER ? cell_module_default.sliderCell : e.type === CellType.CHECKBOX ? cell_module_default.checkBoxCell : e.type === CellType.ACTIONS ? cell_module_default.actionsCell : cell_module_default.staticCell, v = cx(cell_module_default.cell, _, e.hasSort ? cell_module_default.sortingCell : null, m, e.breakWord ? cell_module_default.breakWord : ""), y = (o = u == null ? i : u) == null ? void 0 : o, b = e.type === CellType.STATIC || !e.type, x = {
3683
3630
  width: y,
3684
3631
  minWidth: y,
3685
3632
  textTransform: t && b ? TextTransform.CAPITALIZE : void 0,
@@ -5055,7 +5002,7 @@ const normalizeParsedResult = (e) => {
5055
5002
  onClickCopyClipboard: useCallback(async (e) => {
5056
5003
  let t = await v();
5057
5004
  if (!t) return;
5058
- 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: " " });
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: " " });
5059
5006
  try {
5060
5007
  await navigator.clipboard.writeText(c), transitionToast({ message: {
5061
5008
  type: "Success",
@@ -5978,7 +5925,46 @@ const PrintHeader = ({ logo: e, alt: t, logoWidth: n = "100px" }) => /* @__PURE_
5978
5925
  alt: t,
5979
5926
  className: print_header_module_default.printHeader,
5980
5927
  style: { width: n }
5981
- }), RadioButton = ({ name: e, label: t, options: n, value: r, onChange: i, disabled: a = !1, small: o = !1, noMargin: c = !1, onClick: l = () => {}, inline: u = !1, mainLabel: d = "", radioButtonsData: f, classForContainer: p = "grouped fields" }) => {
5928
+ });
5929
+ var radio_button_module_default = {
5930
+ wrapper: "_wrapper_1fbik_1",
5931
+ inline: "_inline_1fbik_1",
5932
+ radio: "_radio_1fbik_5",
5933
+ labelMargin: "_labelMargin_1fbik_8",
5934
+ small: "_small_1fbik_27",
5935
+ noMargin: "_noMargin_1fbik_32",
5936
+ disabled: "_disabled_1fbik_90",
5937
+ isInTable: "_isInTable_1fbik_106",
5938
+ helpIconEnabled: "_helpIconEnabled_1fbik_111"
5939
+ };
5940
+ const RadioInput = ({ name: e, label: t, value: n, selected: r, disabled: i = !1, small: a = !1, onChange: o, noMargin: s = !1, testId: c, helpText: l, onClickHelp: u, textTransform: d = TextTransform.CAPITALIZE }) => {
5941
+ let f = l || u;
5942
+ return /* @__PURE__ */ jsxs("div", {
5943
+ className: cx(radio_button_module_default.radio, i ? radio_button_module_default.disabled : null, a ? radio_button_module_default.small : null, s ? radio_button_module_default.noMargin : null),
5944
+ onClick: o,
5945
+ "data-testid": c,
5946
+ children: [
5947
+ /* @__PURE__ */ jsx("input", {
5948
+ type: InputType.RADIO,
5949
+ value: n,
5950
+ checked: r,
5951
+ onChange: () => {},
5952
+ disabled: i
5953
+ }),
5954
+ /* @__PURE__ */ jsx("label", {
5955
+ "data-name": e,
5956
+ "data-value": n,
5957
+ style: { textTransform: d },
5958
+ children: t
5959
+ }),
5960
+ f && /* @__PURE__ */ jsx("div", {
5961
+ className: radio_button_module_default.helpIconEnabled,
5962
+ onClick: u,
5963
+ children: /* @__PURE__ */ jsx(HelpIcon, { text: l })
5964
+ })
5965
+ ]
5966
+ });
5967
+ }, RadioButton = ({ name: e, label: t, options: n, value: r, onChange: i, disabled: a = !1, small: o = !1, noMargin: c = !1, onClick: l = () => {}, inline: u = !1, mainLabel: d = "", radioButtonsData: f, classForContainer: p = "grouped fields" }) => {
5982
5968
  let m = useContext(DisabledContext), h = f !== void 0, { simpleInputs: _, options: v, selectedOptions: y } = h ? {
5983
5969
  simpleInputs: !1,
5984
5970
  options: f,
@@ -6017,95 +6003,94 @@ var rich_text_toolbar_module_default = {
6017
6003
  let RichTextIcon = /* @__PURE__ */ function(e) {
6018
6004
  return e.BOLD = "bold", e.ITALIC = "italic", e.CODE = "code", e.UL = "ul", e.OL = "ol", e;
6019
6005
  }({});
6020
- const RichTextToolbar = ({ editor: e, disabled: t = !1, toolbarComponent: n = null }) => {
6021
- var r, i, a, o, s;
6022
- let c = [
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 = [
6023
6008
  {
6024
6009
  icon: RichTextIcon.BOLD,
6025
- onClick: () => e == null ? void 0 : e.chain().focus().toggleBold().run(),
6026
- active: (r = e == null ? void 0 : e.isActive("bold")) == null ? !1 : r
6010
+ onClick: r,
6011
+ active: c.bold()
6027
6012
  },
6028
6013
  {
6029
6014
  icon: RichTextIcon.ITALIC,
6030
- onClick: () => e == null ? void 0 : e.chain().focus().toggleItalic().run(),
6031
- active: (i = e == null ? void 0 : e.isActive("italic")) == null ? !1 : i
6015
+ onClick: o,
6016
+ active: c.italic()
6032
6017
  },
6033
6018
  {
6034
6019
  icon: RichTextIcon.CODE,
6035
- onClick: () => e == null ? void 0 : e.chain().focus().toggleCode().run(),
6036
- active: (a = e == null ? void 0 : e.isActive("code")) == null ? !1 : a
6020
+ onClick: a,
6021
+ active: c.code()
6037
6022
  },
6038
6023
  {
6039
6024
  icon: RichTextIcon.UL,
6040
- onClick: () => e == null ? void 0 : e.chain().focus().toggleBulletList().run(),
6041
- active: (o = e == null ? void 0 : e.isActive("bulletList")) == null ? !1 : o
6025
+ onClick: i,
6026
+ active: c.bulletList()
6042
6027
  },
6043
6028
  {
6044
6029
  icon: RichTextIcon.OL,
6045
- onClick: () => e == null ? void 0 : e.chain().focus().toggleOrderedList().run(),
6046
- active: (s = e == null ? void 0 : e.isActive("orderedList")) == null ? !1 : s
6030
+ onClick: s,
6031
+ active: c.orderedList()
6047
6032
  }
6048
6033
  ];
6049
6034
  return /* @__PURE__ */ jsxs("div", {
6050
6035
  className: rich_text_toolbar_module_default.richTextToolbarContainer,
6051
6036
  children: [/* @__PURE__ */ jsx("div", {
6052
6037
  className: rich_text_toolbar_module_default.richTextToolbar,
6053
- children: c.map((e, n) => /* @__PURE__ */ jsx(Button, {
6038
+ children: l.map((t, r) => /* @__PURE__ */ jsx(Button, {
6054
6039
  small: !0,
6055
6040
  round: !0,
6056
6041
  basic: !0,
6057
- icon: e.icon,
6042
+ icon: t.icon,
6058
6043
  colored: Color.MUTED,
6059
- onClick: e.onClick,
6060
- active: e.active,
6061
- disabled: t
6062
- }, n))
6063
- }), n]
6044
+ onClick: () => {
6045
+ t.onClick(), n();
6046
+ },
6047
+ active: t.active,
6048
+ disabled: e
6049
+ }, r))
6050
+ }), t]
6064
6051
  });
6065
6052
  };
6066
6053
  var rich_text_input_module_default = {
6067
- inputInTable: "_inputInTable_gb097_1",
6068
- inputHover: "_inputHover_gb097_13",
6069
- inputFocus: "_inputFocus_gb097_18",
6070
- inputError: "_inputError_gb097_25",
6071
- inputWarning: "_inputWarning_gb097_26",
6072
- inputDisabled: "_inputDisabled_gb097_61",
6073
- hideScrollbars: "_hideScrollbars_gb097_67",
6074
- richTextInput: "_richTextInput_gb097_77"
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"
6075
6062
  };
6076
6063
  const RichTextInput = memo(forwardRef(({ placeholder: e, onChange: t, value: n, disabled: r, toolbarComponent: i }, a) => {
6077
- let o = useContext(DisabledContext), u = r || o, d = useEditor({
6078
- extensions: [
6079
- StarterKit,
6080
- Placeholder.configure({ placeholder: e }),
6081
- Markdown
6082
- ],
6083
- content: n == null ? "" : n,
6084
- contentType: "markdown",
6085
- editable: !u,
6086
- onUpdate: ({ editor: e }) => {
6087
- t == null || t(e.getMarkdown());
6088
- }
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"
6089
6077
  });
6090
- return useEffect(() => {
6091
- if (!d) return;
6092
- let e = d.getMarkdown();
6093
- n !== void 0 && n !== e && d.commands.setContent(n, {
6094
- emitUpdate: !1,
6095
- contentType: "markdown"
6096
- });
6097
- }, [n, d]), useEffect(() => {
6098
- d && d.setEditable(!u);
6099
- }, [u, d]), useImperativeHandle(a, () => ({
6100
- clearContent: () => d == null ? void 0 : d.commands.clearContent(!0),
6101
- editor: d
6102
- }), [d]), /* @__PURE__ */ jsxs("div", {
6078
+ return useImperativeHandle(a, () => m(), [m]), /* @__PURE__ */ jsx("div", {
6103
6079
  className: rich_text_input_module_default.richTextInput,
6104
- children: [/* @__PURE__ */ jsx(RichTextToolbar, {
6105
- editor: d,
6106
- disabled: u,
6107
- toolbarComponent: i
6108
- }), /* @__PURE__ */ jsx(EditorContent, { editor: d })]
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
+ })
6109
6094
  });
6110
6095
  }));
6111
6096
  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.6-beta-2",
3
+ "version": "5.13.6",
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,10 +39,9 @@
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",
42
44
  "@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",
46
45
  "@types/rc-slider": "^9.3.1",
47
46
  "@types/react-resizable": "^3.0.8",
48
47
  "@types/react-window": "^1.8.8",
@@ -65,10 +64,10 @@
65
64
  "react-toastify": "^9.1.3",
66
65
  "react-transition-group": "^4.4.5",
67
66
  "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",
71
- "@tiptap/markdown": "^3.20.0"
70
+ "styled-components": "^6.1.15"
72
71
  },
73
72
  "devDependencies": {
74
73
  "@dmsnell/diff-match-patch": "^1.1.0",