@oliasoft-open-source/react-ui-library 5.13.1 → 5.13.3

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
@@ -8,10 +8,12 @@ import { ElementType as ElementType_2 } from 'react';
8
8
  import { FC } from 'react';
9
9
  import { FocusEvent as FocusEvent_2 } from 'react';
10
10
  import { FocusEventHandler } from 'react';
11
+ import { ForwardRefExoticComponent } from 'react';
11
12
  import { Id } from 'react-toastify';
12
13
  import { JSX as JSX_2 } from 'react/jsx-runtime';
13
14
  import { KeyboardEvent as KeyboardEvent_2 } from 'react';
14
15
  import { KeyboardEventHandler } from 'react';
16
+ import { MemoExoticComponent } from 'react';
15
17
  import { MouseEvent as MouseEvent_2 } from 'react';
16
18
  import { MouseEventHandler } from 'react';
17
19
  import { MutableRefObject } from 'react';
@@ -21,6 +23,7 @@ import { Property } from 'csstype';
21
23
  import { ReactElement } from 'react';
22
24
  import { ReactNode } from 'react';
23
25
  import { ReactPortal } from 'react';
26
+ import { RefAttributes } from 'react';
24
27
  import { RefObject } from 'react';
25
28
  import { ToastContainer as Toaster } from 'react-toastify';
26
29
 
@@ -1778,6 +1781,16 @@ declare interface ITreeRowItem extends TRowType_2 {
1778
1781
  onDrop?: (event: default_2.DragEvent<HTMLDivElement>) => void;
1779
1782
  }
1780
1783
 
1784
+ export declare interface ITreeTableProps extends ITreeProps {
1785
+ table: {
1786
+ columnAlignment?: (Align.LEFT | Align.RIGHT)[];
1787
+ columnWidths?: string[];
1788
+ fixedWidth?: string;
1789
+ headers?: TRowType_2[];
1790
+ rows: ITreeRowItem[];
1791
+ };
1792
+ }
1793
+
1781
1794
  declare interface IUnitConfigItem {
1782
1795
  onChange?: (params: {
1783
1796
  oldUnit: string;
@@ -1956,7 +1969,7 @@ export declare const RadioButton: ({ name, label: rawLabel, options: rawOptions,
1956
1969
 
1957
1970
  export declare const readFile: (file?: Blob, method?: TFileReaderMethod) => Promise<string | ArrayBuffer | null>;
1958
1971
 
1959
- export declare const RichTextInput: default_2.ForwardRefExoticComponent<IRichTextInputProps & default_2.RefAttributes<any>>;
1972
+ export declare const RichTextInput: MemoExoticComponent<ForwardRefExoticComponent<IRichTextInputProps & RefAttributes<any>>>;
1960
1973
 
1961
1974
  export declare const Row: ({ alignItems, justifyContent, children, flex, height, marginBottom, marginTop, spacing: spacingProp, wrap, testId, }: IRowProps) => JSX_2.Element;
1962
1975
 
@@ -2172,6 +2185,8 @@ declare const TRANSLATION_FALLBACK: {
2172
2185
 
2173
2186
  export declare const Tree: ({ list, canDrop, draggable, onListReorder, onChangeOpen, testId, isInitialOpen, autoOpenActiveItems, treeRef: treeRefProp, itemHasChild, onItemToggle, icons, allowParentReassignment, stickyHeader, height, render, }: ITreeProps) => JSX_2.Element;
2174
2187
 
2188
+ export declare const TreeTable: ({ allowParentReassignment, autoOpenActiveItems, canDrop, draggable, icons, isInitialOpen, itemHasChild, onItemToggle, onListReorder, onChangeOpen, table, testId, treeRef, }: ITreeTableProps) => JSX_2.Element;
2189
+
2175
2190
  export declare enum TriggerType {
2176
2191
  TEXT = "Text",
2177
2192
  BUTTON = "Button",
package/dist/index.js CHANGED
@@ -6061,9 +6061,9 @@ var rich_text_input_module_default = {
6061
6061
  hideScrollbars: "_hideScrollbars_1fb4l_67",
6062
6062
  richTextInput: "_richTextInput_1fb4l_77"
6063
6063
  };
6064
- const RichTextInput = forwardRef(({ placeholder: e, onChange: t, value: n, disabled: r, toolbarComponent: i }, a) => {
6065
- let o = useContext(DisabledContext), c = r || o, { manager: u, state: d, setState: f, getContext: p } = useRemirror({
6066
- extensions: () => [
6064
+ 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
6067
  new BoldExtension({}),
6068
6068
  new BulletListExtension({}),
6069
6069
  new CodeExtension(),
@@ -6071,29 +6071,29 @@ const RichTextInput = forwardRef(({ placeholder: e, onChange: t, value: n, disab
6071
6071
  new MarkdownExtension({}),
6072
6072
  new OrderedListExtension(),
6073
6073
  new PlaceholderExtension({ placeholder: e })
6074
- ],
6074
+ ], [e]),
6075
6075
  content: n,
6076
6076
  selection: "start",
6077
6077
  stringHandler: "markdown"
6078
6078
  });
6079
- return useImperativeHandle(a, () => p(), [p]), /* @__PURE__ */ jsx("div", {
6079
+ return useImperativeHandle(a, () => m(), [m]), /* @__PURE__ */ jsx("div", {
6080
6080
  className: rich_text_input_module_default.richTextInput,
6081
6081
  children: /* @__PURE__ */ jsxs(Remirror, {
6082
- manager: u,
6083
- state: d,
6082
+ manager: d,
6083
+ state: f,
6084
6084
  placeholder: e,
6085
6085
  onChange: ({ helpers: e, state: n }) => {
6086
6086
  let r = e.getMarkdown(n);
6087
- t && t(r), f(n);
6087
+ t && t(r), p(n);
6088
6088
  },
6089
- editable: !c,
6089
+ editable: !u,
6090
6090
  children: [/* @__PURE__ */ jsx(RichTextToolbar, {
6091
- disabled: c,
6091
+ disabled: u,
6092
6092
  toolbarComponent: i
6093
6093
  }), /* @__PURE__ */ jsx(EditorComponent, {})]
6094
6094
  })
6095
6095
  });
6096
- });
6096
+ }));
6097
6097
  var row_module_default = { row: "_row_n16je_1" };
6098
6098
  const Row = ({ alignItems: t = "initial", justifyContent: n = "initial", children: r = null, flex: a = !1, height: o = "auto", marginBottom: s = "0", marginTop: c = "0", spacing: l = "var(--padding)", wrap: u = !1, testId: d = null }) => {
6099
6099
  let f = typeof l == "number" ? `${l}px` : l, p = (r === null || r === !1 ? [] : Array.isArray(r) ? r.filter((e) => isValidElement(e)) : [r]).map((t, n) => /* @__PURE__ */ jsx(React.Fragment, { children: React.cloneElement(t, { spacing: f }) }, n));
@@ -6733,6 +6733,141 @@ const TreeItem = ({ node: t, depth: n, isOpen: r, onToggle: i, hasChild: a, drag
6733
6733
  })
6734
6734
  })]
6735
6735
  });
6736
+ };
6737
+ var tree_table_module_default = {
6738
+ treeTable: "_treeTable_3rlrs_1",
6739
+ treeTableHeader: "_treeTableHeader_3rlrs_21",
6740
+ folderCell: "_folderCell_3rlrs_29",
6741
+ dragCell: "_dragCell_3rlrs_30",
6742
+ drag: "_drag_3rlrs_30",
6743
+ folder: "_folder_3rlrs_29",
6744
+ treeTableRow: "_treeTableRow_3rlrs_60",
6745
+ nested: "_nested_3rlrs_63"
6746
+ };
6747
+ const TreeTableRow = ({ columnAlignment: e, columnWidths: t, depth: n, draggable: r, handleRef: i, hasChild: a, hasRowActions: o, icons: s, isOpen: c, node: l, onDragEnter: u, onDragOver: d, onDragLeave: f, onDrop: p, onToggle: m }) => {
6748
+ let { data: h, droppable: _ } = l, { id: v, cells: y, testId: b, actions: x = [] } = h, S = `max(calc(var(--size) * ${a ? n + 1 : n}), var(--size))`;
6749
+ return /* @__PURE__ */ jsx("table", {
6750
+ className: table_module_default.table,
6751
+ "data-testid": b,
6752
+ onDrop: p,
6753
+ onDragEnter: u,
6754
+ onDragOver: d,
6755
+ onDragLeave: f,
6756
+ children: /* @__PURE__ */ jsx("tbody", { children: /* @__PURE__ */ jsxs("tr", {
6757
+ className: cx(tree_table_module_default.treeTableRow, n > 0 && tree_table_module_default.nested),
6758
+ children: [
6759
+ r && /* @__PURE__ */ jsx("td", {
6760
+ className: tree_table_module_default.dragCell,
6761
+ children: /* @__PURE__ */ jsx("div", {
6762
+ className: tree_table_module_default.drag,
6763
+ onClick: (e) => e.stopPropagation(),
6764
+ ref: i,
6765
+ children: /* @__PURE__ */ jsx(Icon, { icon: IconType.DRAG })
6766
+ })
6767
+ }),
6768
+ /* @__PURE__ */ jsx("td", {
6769
+ className: tree_table_module_default.folderCell,
6770
+ style: {
6771
+ width: S,
6772
+ minWidth: S,
6773
+ maxWidth: S
6774
+ },
6775
+ children: (_ || a) && /* @__PURE__ */ jsx("div", {
6776
+ className: tree_table_module_default.folder,
6777
+ onClick: () => m(v),
6778
+ onMouseDown: (e) => e.stopPropagation(),
6779
+ children: /* @__PURE__ */ jsx(Button, {
6780
+ basic: !0,
6781
+ colored: c ? !0 : Color.MUTED,
6782
+ disabled: !a,
6783
+ small: !0,
6784
+ round: !0,
6785
+ icon: a && c ? (s == null ? void 0 : s.collapse) || IconType.COLLAPSE : (s == null ? void 0 : s.expand) || IconType.EXPAND
6786
+ })
6787
+ })
6788
+ }),
6789
+ y.map((n, r) => {
6790
+ let i = t ? t[r] : void 0;
6791
+ return /* @__PURE__ */ jsx(Cell, {
6792
+ isHeader: !1,
6793
+ cell: n,
6794
+ width: r === 0 ? `calc(${i} - ${S} + var(--size))` : i,
6795
+ columnAlignment: e ? e[r] : null
6796
+ }, r);
6797
+ }),
6798
+ o && /* @__PURE__ */ jsx(Cell, {
6799
+ isHeader: !1,
6800
+ cell: {
6801
+ type: CellType.ACTIONS,
6802
+ actions: x
6803
+ }
6804
+ })
6805
+ ]
6806
+ }) })
6807
+ });
6808
+ }, TreeTableHeader = ({ columnAlignment: e, columnWidths: t, draggable: n, hasRowActions: r, headers: i }) => /* @__PURE__ */ jsx("table", {
6809
+ className: cx(table_module_default.table, tree_table_module_default.treeTableHeader),
6810
+ children: /* @__PURE__ */ jsx("thead", { children: i.map((i, a) => /* @__PURE__ */ jsxs("tr", { children: [
6811
+ n && /* @__PURE__ */ jsx("th", { className: tree_table_module_default.dragCell }),
6812
+ /* @__PURE__ */ jsx("th", { className: tree_table_module_default.folderCell }),
6813
+ i.cells.map((n, r) => /* @__PURE__ */ jsx(Cell, {
6814
+ isHeader: !0,
6815
+ cell: n,
6816
+ width: t ? t[r] : void 0,
6817
+ columnAlignment: e ? e[r] : void 0
6818
+ }, r)),
6819
+ r && /* @__PURE__ */ jsx(Cell, {
6820
+ isHeader: !0,
6821
+ cell: {
6822
+ type: CellType.ACTIONS,
6823
+ actions: i.actions,
6824
+ width: 31
6825
+ }
6826
+ })
6827
+ ] }, a)) })
6828
+ }), TreeTable = ({ allowParentReassignment: e, autoOpenActiveItems: t = !1, canDrop: n, draggable: r = !1, icons: i, isInitialOpen: a = !1, itemHasChild: o, onItemToggle: s, onListReorder: c, onChangeOpen: l, table: u, testId: d, treeRef: f }) => {
6829
+ let { columnAlignment: p, columnWidths: m, fixedWidth: h, headers: g, rows: _ = [] } = u, v = hasRowActions(_, g == null ? [] : g);
6830
+ return /* @__PURE__ */ jsxs("div", {
6831
+ className: tree_table_module_default.treeTable,
6832
+ "data-testid": d,
6833
+ style: { width: h },
6834
+ children: [!!g && /* @__PURE__ */ jsx(TreeTableHeader, {
6835
+ columnAlignment: p,
6836
+ columnWidths: m,
6837
+ draggable: r,
6838
+ hasRowActions: v,
6839
+ headers: g
6840
+ }), /* @__PURE__ */ jsx(Tree, {
6841
+ allowParentReassignment: e,
6842
+ autoOpenActiveItems: t,
6843
+ canDrop: n,
6844
+ draggable: r,
6845
+ icons: i,
6846
+ isInitialOpen: a,
6847
+ itemHasChild: o,
6848
+ list: {
6849
+ noHeader: !0,
6850
+ items: _
6851
+ },
6852
+ onChangeOpen: l,
6853
+ onItemToggle: s,
6854
+ onListReorder: c,
6855
+ render: (e, { depth: t, draggable: n, handleRef: r, hasChild: a, isOpen: o, onToggle: s }) => /* @__PURE__ */ jsx(TreeTableRow, {
6856
+ node: e,
6857
+ columnAlignment: p,
6858
+ columnWidths: m,
6859
+ depth: t,
6860
+ draggable: n,
6861
+ handleRef: r,
6862
+ hasChild: a,
6863
+ hasRowActions: v,
6864
+ icons: i,
6865
+ isOpen: o,
6866
+ onToggle: s
6867
+ }, e.id),
6868
+ treeRef: f
6869
+ })]
6870
+ });
6736
6871
  }, useRunAfterUpdate = () => {
6737
6872
  let e = useRef(null);
6738
6873
  return useLayoutEffect(() => {
@@ -8978,4 +9113,4 @@ const ComparisonViewModal = ({ auditLog: e, auditLogs: t, data: n, isOpen: r, se
8978
9113
  e === ConfigKeyType.Translations ? setConfig(e, getTranslations(t)) : setConfig(e, isPrimitiveValue(t) ? t : { ...t });
8979
9114
  });
8980
9115
  };
8981
- export { Accordion, AccordionWithDefaultToggle, Actions, Align, AuditLog, Badge, Breadcrumb, BreadcrumbLinkType, Button, ButtonGroup, ButtonPosition, ButtonType, Card, CheckBox, Chevron, Collapse, Color, Column, Dialog, DiffViewer, DisabledContext, Divider, Drawer, ElementType, Empty, Field, FileButton, FileInput, Flex, FormRow, Grid, GroupOrder, Heading, HelpIcon, Icon, IconType, Input, InputGroup, InputGroupAddon, InputReaderMethods, InputType, Label, List, ListHeading, ListSubheading, Loader, Menu, MenuCarat, MenuType, Message, MessageType, Modal, NativeSelect, NumberInput, OptionDropdown, Page, Pagination, PopConfirm, Popover, Portal, PrintHeader, ProgressBar, RadioButton, RichTextInput, Row, Select, SettingField, SideBar, Slider, SmartUploadModal, Spacer, Spinner, Table, TableImportExport, Tabs, Text, TextArea, TextLink, TextTransform, Theme, Toaster, Toggle, Tooltip, TopBar, Tree, TriggerType, UnitInput, UnitTable, UsageTracker, dismissToast, initializeContext, initializeGuiLibrary, readFile, toast, useFocus, useKeyboardEvent, useWindowWidth };
9116
+ export { Accordion, AccordionWithDefaultToggle, Actions, Align, AuditLog, Badge, Breadcrumb, BreadcrumbLinkType, Button, ButtonGroup, ButtonPosition, ButtonType, Card, CheckBox, Chevron, Collapse, Color, Column, Dialog, DiffViewer, DisabledContext, Divider, Drawer, ElementType, Empty, Field, FileButton, FileInput, Flex, FormRow, Grid, GroupOrder, Heading, HelpIcon, Icon, IconType, Input, InputGroup, InputGroupAddon, InputReaderMethods, InputType, Label, List, ListHeading, ListSubheading, Loader, Menu, MenuCarat, MenuType, Message, MessageType, Modal, NativeSelect, NumberInput, OptionDropdown, Page, Pagination, PopConfirm, Popover, Portal, PrintHeader, ProgressBar, RadioButton, RichTextInput, Row, Select, SettingField, SideBar, Slider, SmartUploadModal, Spacer, Spinner, Table, TableImportExport, Tabs, Text, TextArea, TextLink, TextTransform, Theme, Toaster, Toggle, Tooltip, TopBar, Tree, TreeTable, TriggerType, UnitInput, UnitTable, UsageTracker, dismissToast, initializeContext, initializeGuiLibrary, readFile, toast, useFocus, useKeyboardEvent, useWindowWidth };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oliasoft-open-source/react-ui-library",
3
- "version": "5.13.1",
3
+ "version": "5.13.3",
4
4
  "description": "Reusable UI components for React projects",
5
5
  "homepage": "https://oliasoft-open-source.gitlab.io/react-ui-library",
6
6
  "bugs": {