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

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;
@@ -1781,6 +1782,16 @@ declare interface ITreeRowItem extends TRowType_2 {
1781
1782
  onDrop?: (event: default_2.DragEvent<HTMLDivElement>) => void;
1782
1783
  }
1783
1784
 
1785
+ export declare interface ITreeTableProps extends ITreeProps {
1786
+ table: {
1787
+ columnAlignment?: (Align.LEFT | Align.RIGHT)[];
1788
+ columnWidths?: string[];
1789
+ fixedWidth?: string;
1790
+ headers?: TRowType_2[];
1791
+ rows: ITreeRowItem[];
1792
+ };
1793
+ }
1794
+
1784
1795
  declare interface IUnitConfigItem {
1785
1796
  onChange?: (params: {
1786
1797
  oldUnit: string;
@@ -2175,6 +2186,8 @@ declare const TRANSLATION_FALLBACK: {
2175
2186
 
2176
2187
  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;
2177
2188
 
2189
+ export declare const TreeTable: ({ allowParentReassignment, autoOpenActiveItems, canDrop, draggable, icons, isInitialOpen, itemHasChild, onItemToggle, onListReorder, onChangeOpen, table, testId, treeRef, }: ITreeTableProps) => JSX_2.Element;
2190
+
2178
2191
  export declare enum TriggerType {
2179
2192
  TEXT = "Text",
2180
2193
  BUTTON = "Button",
package/dist/index.js CHANGED
@@ -827,29 +827,28 @@ const Section$1 = ({ section: e, closeOnOptionClick: t, close: n, tree: r, path:
827
827
  placement: e || (t ? "right-start" : "bottom-start")
828
828
  }), isStringNumberOrNode = (e) => isString(e) || isNumber(e) || isValidElement(e), getType = (e) => Array.isArray(e) ? "array" : typeof e;
829
829
  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"
830
+ wrapper: "_wrapper_14vly_1",
831
+ badge: "_badge_14vly_5",
832
+ label: "_label_14vly_11",
833
+ small: "_small_14vly_23",
834
+ dot: "_dot_14vly_27",
835
+ hasChildren: "_hasChildren_14vly_33"
838
836
  }, isDark = (e) => {
839
837
  let t = e.substring(1), n = parseInt(t, 16), r = n >> 16 & 255, i = n >> 8 & 255, a = n >> 0 & 255;
840
838
  return .2126 * r + .7152 * i + .0722 * a < 128;
841
839
  };
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);
840
+ const Badge = ({ children: e, color: t = "", textColor: n = "", title: r = null, dot: i = !1, margin: a = null, small: o = !1 }) => {
841
+ let s = !(r === null && i === !1), c = n || (isDark(t) ? "#fff" : "rgba(0, 0, 0, 0.6)");
844
842
  return /* @__PURE__ */ jsxs("div", {
845
843
  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 : ""),
844
+ children: [s && /* @__PURE__ */ jsx("sup", {
845
+ 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
846
  style: {
849
847
  background: t || void 0,
850
- margin: i || void 0
848
+ margin: a || void 0,
849
+ color: c
851
850
  },
852
- children: n
851
+ children: r
853
852
  }), e]
854
853
  });
855
854
  }, 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 }) => {
@@ -6733,6 +6732,141 @@ const TreeItem = ({ node: t, depth: n, isOpen: r, onToggle: i, hasChild: a, drag
6733
6732
  })
6734
6733
  })]
6735
6734
  });
6735
+ };
6736
+ var tree_table_module_default = {
6737
+ treeTable: "_treeTable_3rlrs_1",
6738
+ treeTableHeader: "_treeTableHeader_3rlrs_21",
6739
+ folderCell: "_folderCell_3rlrs_29",
6740
+ dragCell: "_dragCell_3rlrs_30",
6741
+ drag: "_drag_3rlrs_30",
6742
+ folder: "_folder_3rlrs_29",
6743
+ treeTableRow: "_treeTableRow_3rlrs_60",
6744
+ nested: "_nested_3rlrs_63"
6745
+ };
6746
+ 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 }) => {
6747
+ 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))`;
6748
+ return /* @__PURE__ */ jsx("table", {
6749
+ className: table_module_default.table,
6750
+ "data-testid": b,
6751
+ onDrop: p,
6752
+ onDragEnter: u,
6753
+ onDragOver: d,
6754
+ onDragLeave: f,
6755
+ children: /* @__PURE__ */ jsx("tbody", { children: /* @__PURE__ */ jsxs("tr", {
6756
+ className: cx(tree_table_module_default.treeTableRow, n > 0 && tree_table_module_default.nested),
6757
+ children: [
6758
+ r && /* @__PURE__ */ jsx("td", {
6759
+ className: tree_table_module_default.dragCell,
6760
+ children: /* @__PURE__ */ jsx("div", {
6761
+ className: tree_table_module_default.drag,
6762
+ onClick: (e) => e.stopPropagation(),
6763
+ ref: i,
6764
+ children: /* @__PURE__ */ jsx(Icon, { icon: IconType.DRAG })
6765
+ })
6766
+ }),
6767
+ /* @__PURE__ */ jsx("td", {
6768
+ className: tree_table_module_default.folderCell,
6769
+ style: {
6770
+ width: S,
6771
+ minWidth: S,
6772
+ maxWidth: S
6773
+ },
6774
+ children: (_ || a) && /* @__PURE__ */ jsx("div", {
6775
+ className: tree_table_module_default.folder,
6776
+ onClick: () => m(v),
6777
+ onMouseDown: (e) => e.stopPropagation(),
6778
+ children: /* @__PURE__ */ jsx(Button, {
6779
+ basic: !0,
6780
+ colored: c ? !0 : Color.MUTED,
6781
+ disabled: !a,
6782
+ small: !0,
6783
+ round: !0,
6784
+ icon: a && c ? (s == null ? void 0 : s.collapse) || IconType.COLLAPSE : (s == null ? void 0 : s.expand) || IconType.EXPAND
6785
+ })
6786
+ })
6787
+ }),
6788
+ y.map((n, r) => {
6789
+ let i = t ? t[r] : void 0;
6790
+ return /* @__PURE__ */ jsx(Cell, {
6791
+ isHeader: !1,
6792
+ cell: n,
6793
+ width: r === 0 ? `calc(${i} - ${S} + var(--size))` : i,
6794
+ columnAlignment: e ? e[r] : null
6795
+ }, r);
6796
+ }),
6797
+ o && /* @__PURE__ */ jsx(Cell, {
6798
+ isHeader: !1,
6799
+ cell: {
6800
+ type: CellType.ACTIONS,
6801
+ actions: x
6802
+ }
6803
+ })
6804
+ ]
6805
+ }) })
6806
+ });
6807
+ }, TreeTableHeader = ({ columnAlignment: e, columnWidths: t, draggable: n, hasRowActions: r, headers: i }) => /* @__PURE__ */ jsx("table", {
6808
+ className: cx(table_module_default.table, tree_table_module_default.treeTableHeader),
6809
+ children: /* @__PURE__ */ jsx("thead", { children: i.map((i, a) => /* @__PURE__ */ jsxs("tr", { children: [
6810
+ n && /* @__PURE__ */ jsx("th", { className: tree_table_module_default.dragCell }),
6811
+ /* @__PURE__ */ jsx("th", { className: tree_table_module_default.folderCell }),
6812
+ i.cells.map((n, r) => /* @__PURE__ */ jsx(Cell, {
6813
+ isHeader: !0,
6814
+ cell: n,
6815
+ width: t ? t[r] : void 0,
6816
+ columnAlignment: e ? e[r] : void 0
6817
+ }, r)),
6818
+ r && /* @__PURE__ */ jsx(Cell, {
6819
+ isHeader: !0,
6820
+ cell: {
6821
+ type: CellType.ACTIONS,
6822
+ actions: i.actions,
6823
+ width: 31
6824
+ }
6825
+ })
6826
+ ] }, a)) })
6827
+ }), 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 }) => {
6828
+ let { columnAlignment: p, columnWidths: m, fixedWidth: h, headers: g, rows: _ = [] } = u, v = hasRowActions(_, g == null ? [] : g);
6829
+ return /* @__PURE__ */ jsxs("div", {
6830
+ className: tree_table_module_default.treeTable,
6831
+ "data-testid": d,
6832
+ style: { width: h },
6833
+ children: [!!g && /* @__PURE__ */ jsx(TreeTableHeader, {
6834
+ columnAlignment: p,
6835
+ columnWidths: m,
6836
+ draggable: r,
6837
+ hasRowActions: v,
6838
+ headers: g
6839
+ }), /* @__PURE__ */ jsx(Tree, {
6840
+ allowParentReassignment: e,
6841
+ autoOpenActiveItems: t,
6842
+ canDrop: n,
6843
+ draggable: r,
6844
+ icons: i,
6845
+ isInitialOpen: a,
6846
+ itemHasChild: o,
6847
+ list: {
6848
+ noHeader: !0,
6849
+ items: _
6850
+ },
6851
+ onChangeOpen: l,
6852
+ onItemToggle: s,
6853
+ onListReorder: c,
6854
+ render: (e, { depth: t, draggable: n, handleRef: r, hasChild: a, isOpen: o, onToggle: s }) => /* @__PURE__ */ jsx(TreeTableRow, {
6855
+ node: e,
6856
+ columnAlignment: p,
6857
+ columnWidths: m,
6858
+ depth: t,
6859
+ draggable: n,
6860
+ handleRef: r,
6861
+ hasChild: a,
6862
+ hasRowActions: v,
6863
+ icons: i,
6864
+ isOpen: o,
6865
+ onToggle: s
6866
+ }, e.id),
6867
+ treeRef: f
6868
+ })]
6869
+ });
6736
6870
  }, useRunAfterUpdate = () => {
6737
6871
  let e = useRef(null);
6738
6872
  return useLayoutEffect(() => {
@@ -8978,4 +9112,4 @@ const ComparisonViewModal = ({ auditLog: e, auditLogs: t, data: n, isOpen: r, se
8978
9112
  e === ConfigKeyType.Translations ? setConfig(e, getTranslations(t)) : setConfig(e, isPrimitiveValue(t) ? t : { ...t });
8979
9113
  });
8980
9114
  };
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 };
9115
+ 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.2",
3
+ "version": "5.13.4",
4
4
  "description": "Reusable UI components for React projects",
5
5
  "homepage": "https://oliasoft-open-source.gitlab.io/react-ui-library",
6
6
  "bugs": {