pixelize-design-library 1.1.94 → 2.0.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.
Files changed (93) hide show
  1. package/dist/App.js +25 -11
  2. package/dist/Assets/defaultLogo.d.ts +3 -0
  3. package/dist/Assets/defaultLogo.js +15 -0
  4. package/dist/Assets/defaultLogo.tsx +31 -0
  5. package/dist/Components/Button/Button.d.ts +1 -1
  6. package/dist/Components/Button/Button.js +2 -59
  7. package/dist/Components/Button/Button.styles.d.ts +2 -0
  8. package/dist/Components/Button/Button.styles.js +112 -0
  9. package/dist/Components/Button/ButtonProps.d.ts +4 -3
  10. package/dist/Components/Checkbox/Checkbox.styles.d.ts +2 -0
  11. package/dist/Components/Checkbox/Checkbox.styles.js +54 -0
  12. package/dist/Components/Common/FormLabel.js +8 -4
  13. package/dist/Components/Divider/Divider.d.ts +3 -0
  14. package/dist/Components/Divider/Divider.js +14 -0
  15. package/dist/Components/Input/TextInput.d.ts +1 -1
  16. package/dist/Components/Input/TextInput.js +17 -23
  17. package/dist/Components/Input/TextInput.styles.d.ts +2 -0
  18. package/dist/Components/Input/TextInput.styles.js +68 -0
  19. package/dist/Components/Input/TextInputProps.d.ts +3 -1
  20. package/dist/Components/SideBar/SideBar.d.ts +1 -1
  21. package/dist/Components/SideBar/SideBar.js +44 -61
  22. package/dist/Components/SideBar/SideBarProps.d.ts +18 -8
  23. package/dist/Components/SideBar/components/MenuItemBox.d.ts +11 -0
  24. package/dist/Components/SideBar/components/MenuItemBox.js +116 -0
  25. package/dist/Components/SideBar/components/MenuItems.d.ts +4 -0
  26. package/dist/Components/SideBar/components/MenuItems.js +13 -0
  27. package/dist/Components/SideBar/components/MenuPopoverContent.d.ts +9 -0
  28. package/dist/Components/SideBar/components/MenuPopoverContent.js +37 -0
  29. package/dist/Components/SideBar/components/TextTruncation.d.ts +8 -0
  30. package/dist/Components/SideBar/components/TextTruncation.js +65 -0
  31. package/dist/Components/Table/Components/HeaderActions.d.ts +7 -0
  32. package/dist/Components/Table/Components/HeaderActions.js +45 -0
  33. package/dist/Components/Table/Components/Pagination.js +7 -12
  34. package/dist/Components/Table/Components/TableBody.d.ts +1 -1
  35. package/dist/Components/Table/Components/TableBody.js +23 -30
  36. package/dist/Components/Table/Components/TableHeader.js +17 -30
  37. package/dist/Components/Table/Components/TableSearch.d.ts +6 -0
  38. package/dist/Components/Table/Components/TableSearch.js +60 -0
  39. package/dist/Components/Table/Components/useTable.d.ts +1 -0
  40. package/dist/Components/Table/Components/useTable.js +6 -0
  41. package/dist/Components/Table/Table.d.ts +1 -1
  42. package/dist/Components/Table/Table.js +25 -13
  43. package/dist/Components/Table/TableProps.d.ts +16 -0
  44. package/dist/Components/Table/TableSettings/ManageColumns.js +2 -6
  45. package/dist/Components/Table/TableSettings/TableSettings.js +6 -6
  46. package/dist/Components/Toggle/TableToggle.d.ts +4 -0
  47. package/dist/Components/Toggle/TableToggle.js +57 -0
  48. package/dist/Components/Toggle/TableToggleProps.d.ts +5 -0
  49. package/dist/Constants/Sidebar.js +25 -2
  50. package/dist/Layout.js +33 -32
  51. package/dist/Pages/TInput.js +4 -1
  52. package/dist/Pages/button.js +1 -1
  53. package/dist/Pages/input.js +16 -9
  54. package/dist/Pages/modal.js +1 -1
  55. package/dist/Pages/toster.js +1 -1
  56. package/dist/Theme/Default/palette.d.ts +19 -0
  57. package/dist/Theme/Default/palette.js +19 -0
  58. package/dist/Theme/Default/theme.js +2 -1
  59. package/dist/Theme/Meadow/palette.d.ts +168 -0
  60. package/dist/Theme/Meadow/palette.js +186 -32
  61. package/dist/Theme/Meadow/theme.js +2 -1
  62. package/dist/Theme/Radiant/palette.d.ts +168 -0
  63. package/dist/Theme/Radiant/palette.js +186 -32
  64. package/dist/Theme/Radiant/theme.js +2 -1
  65. package/dist/Theme/Skyline/palette.d.ts +168 -0
  66. package/dist/Theme/Skyline/palette.js +185 -31
  67. package/dist/Theme/Skyline/theme.js +2 -1
  68. package/dist/Theme/componentStyles.d.ts +5 -0
  69. package/dist/Theme/componentStyles.js +11 -0
  70. package/dist/Theme/themeProps.d.ts +168 -0
  71. package/dist/Utils/table.d.ts +9 -0
  72. package/dist/Utils/table.js +47 -1
  73. package/dist/index.d.ts +2 -1
  74. package/dist/index.js +4 -2
  75. package/dist/withTheme.js +1 -1
  76. package/package.json +1 -1
  77. package/dist/Components/KaTable/CustomHeader.d.ts +0 -14
  78. package/dist/Components/KaTable/CustomHeader.js +0 -69
  79. package/dist/Components/KaTable/KaTable.d.ts +0 -13
  80. package/dist/Components/KaTable/KaTable.js +0 -111
  81. package/dist/Components/KaTable/KaTableProps.d.ts +0 -23
  82. package/dist/Components/KaTable/SelectionCell.d.ts +0 -8
  83. package/dist/Components/KaTable/SelectionCell.js +0 -38
  84. package/dist/Components/KaTable/SelectionHeader.d.ts +0 -3
  85. package/dist/Components/KaTable/SelectionHeader.js +0 -56
  86. package/dist/Components/KaTable/ka-table.css +0 -27
  87. package/dist/Components/KaTable/useMergedChildComponents.d.ts +0 -14
  88. package/dist/Components/KaTable/useMergedChildComponents.js +0 -224
  89. package/dist/Pages/KaTableExample.d.ts +0 -3
  90. package/dist/Pages/KaTableExample.js +0 -259
  91. package/dist/Theme/Default/fonts.d.ts +0 -35
  92. package/dist/Theme/Default/fonts.js +0 -37
  93. /package/dist/Components/{KaTable/KaTableProps.js → Toggle/TableToggleProps.js} +0 -0
@@ -33,11 +33,11 @@ var useCustomTheme_1 = require("../../../Theme/useCustomTheme");
33
33
  var TableLoading_1 = require("./TableLoading");
34
34
  var TableActions_1 = __importDefault(require("./TableActions"));
35
35
  var lucide_react_1 = require("lucide-react");
36
+ var Checkbox_1 = __importDefault(require("../../Checkbox/Checkbox"));
36
37
  var TableBody = function (_a) {
37
- var _b;
38
- var data = _a.data, isCheckbox = _a.isCheckbox, columns = _a.columns, startRow = _a.startRow, endRow = _a.endRow, columnWidths = _a.columnWidths, freezedBgColor = _a.freezedBgColor, freezedTextColor = _a.freezedTextColor, noBorders = _a.noBorders, handleCheckbox = _a.handleCheckbox, selections = _a.selections, isLoading = _a.isLoading, onRowClick = _a.onRowClick, isContent = _a.isContent, isLink = _a.isLink, isActionFreeze = _a.isActionFreeze;
38
+ var data = _a.data, isCheckbox = _a.isCheckbox, columns = _a.columns, startRow = _a.startRow, columnWidths = _a.columnWidths, freezedBgColor = _a.freezedBgColor, freezedTextColor = _a.freezedTextColor, noBorders = _a.noBorders, handleCheckbox = _a.handleCheckbox, selections = _a.selections, isLoading = _a.isLoading, onRowClick = _a.onRowClick, isContent = _a.isContent, isLink = _a.isLink, isActionFreeze = _a.isActionFreeze;
39
39
  var theme = (0, useCustomTheme_1.useCustomTheme)();
40
- var _c = (0, react_2.useState)(new Set()), expandedRows = _c[0], setExpandedRows = _c[1];
40
+ var _b = (0, react_2.useState)(new Set()), expandedRows = _b[0], setExpandedRows = _b[1];
41
41
  var toggleRowExpansion = function (rowIndex) {
42
42
  setExpandedRows(function (prev) {
43
43
  var newSet = new Set(prev);
@@ -54,27 +54,21 @@ var TableBody = function (_a) {
54
54
  onRowClick && onRowClick(row, header);
55
55
  };
56
56
  var RenderCheckbox = (0, react_2.useCallback)(function (_a) {
57
- var _b;
57
+ var _b, _c, _d, _e, _f;
58
58
  var row = _a.row, isChecked = _a.isChecked;
59
- return (react_2.default.createElement(react_1.Td, { w: "6", fontSize: 14, fontWeight: 600, color: freezedTextColor, textTransform: "capitalize", backgroundColor: freezedBgColor, position: "sticky", border: noBorders ? "none" : "1px solid ".concat((_b = theme.colors) === null || _b === void 0 ? void 0 : _b.gray[300]), boxSizing: "border-box", left: 0, zIndex: 1, className: "columns sticky-columns" },
60
- react_2.default.createElement(react_1.Checkbox, { "aria-label": "Select all rows", colorScheme: "gray", backgroundColor: theme.colors.gray[50], borderColor: theme.colors.gray[500], variant: "subtle", onChange: function () { return handleCheckbox(row.id); }, isChecked: isChecked, _hover: { transform: "scale(1.1)" } })));
61
- }, [
62
- freezedBgColor,
63
- freezedTextColor,
64
- handleCheckbox,
65
- noBorders,
66
- (_b = theme.colors) === null || _b === void 0 ? void 0 : _b.gray,
67
- ]);
59
+ return (react_2.default.createElement(react_1.Td, { w: "6", fontSize: 14, fontWeight: 600, color: (_c = (_b = theme.colors) === null || _b === void 0 ? void 0 : _b.background) === null || _c === void 0 ? void 0 : _c[50], textTransform: "capitalize", backgroundColor: (_e = (_d = theme.colors) === null || _d === void 0 ? void 0 : _d.background) === null || _e === void 0 ? void 0 : _e[50], position: "sticky", borderBottom: noBorders ? "none" : "0.063rem solid ".concat((_f = theme.colors) === null || _f === void 0 ? void 0 : _f.border[500]), boxSizing: "border-box", left: 0, zIndex: 1, className: "columns sticky-columns" },
60
+ react_2.default.createElement(Checkbox_1.default, { "aria-label": "Select all rows", onChange: function () { return handleCheckbox(row.id); }, isChecked: isChecked })));
61
+ }, [handleCheckbox, noBorders, theme.colors]);
68
62
  var RenderContent = (0, react_2.useCallback)(function (_a) {
69
- var _b, _c;
63
+ var _b, _c, _d, _e;
70
64
  var isExpanded = _a.isExpanded, rowIndex = _a.rowIndex, isContent = _a.isContent;
71
- return (react_2.default.createElement(react_1.Td, { w: "6", p: 0, fontSize: 14, backgroundColor: freezedBgColor, color: freezedTextColor, position: "sticky", border: noBorders ? "none" : "1px solid ".concat((_b = theme.colors) === null || _b === void 0 ? void 0 : _b.gray[300]), boxSizing: "border-box", left: 0, zIndex: 1, className: "columns sticky-columns" }, isContent && (react_2.default.createElement(react_1.IconButton, { "aria-label": isExpanded ? "Collapse row" : "Expand row", color: (_c = theme.colors) === null || _c === void 0 ? void 0 : _c.gray[600], icon: isExpanded ? (react_2.default.createElement(lucide_react_1.ChevronDown, { fontSize: 16 })) : (react_2.default.createElement(lucide_react_1.ChevronRight, { fontSize: 16 })), _hover: { transform: "scale(1.1)" }, size: "sm", onClick: function () { return toggleRowExpansion(rowIndex); }, variant: "ghost" }))));
72
- }, [freezedBgColor, freezedTextColor, noBorders, theme.colors.gray]);
65
+ return (react_2.default.createElement(react_1.Td, { w: "6", p: 0, fontSize: 14, backgroundColor: (_c = (_b = theme.colors) === null || _b === void 0 ? void 0 : _b.background) === null || _c === void 0 ? void 0 : _c[50], color: freezedTextColor, position: "sticky", borderBottom: noBorders ? "none" : "0.063rem solid ".concat((_d = theme.colors) === null || _d === void 0 ? void 0 : _d.border[500]), boxSizing: "border-box", left: 0, zIndex: 1, className: "columns sticky-columns" }, isContent && (react_2.default.createElement(react_1.IconButton, { "aria-label": isExpanded ? "Collapse row" : "Expand row", color: (_e = theme.colors) === null || _e === void 0 ? void 0 : _e.gray[600], icon: isExpanded ? (react_2.default.createElement(lucide_react_1.ChevronDown, { fontSize: 16 })) : (react_2.default.createElement(lucide_react_1.ChevronRight, { fontSize: 16 })), _hover: { transform: "scale(1.1)" }, size: "sm", onClick: function () { return toggleRowExpansion(rowIndex); }, variant: "ghost" }))));
66
+ }, [freezedTextColor, noBorders, theme.colors]);
73
67
  var RenderView = (0, react_2.useCallback)(function (_a) {
74
- var _b;
75
- var row = _a.row, bgcolor = _a.bgcolor;
76
- return (react_2.default.createElement(react_1.Td, { w: 2, p: 0, fontSize: 14, backgroundColor: isActionFreeze ? freezedBgColor : bgcolor, color: freezedTextColor, position: isActionFreeze ? "sticky" : "relative", border: noBorders ? "none" : "1px solid ".concat((_b = theme.colors) === null || _b === void 0 ? void 0 : _b.gray[300]), boxSizing: "border-box", right: 0, zIndex: 1, className: "columns sticky-columns".concat(isActionFreeze ? "-right" : "") }, (row.onLink || row.onEdit || row.onDelete) && (react_2.default.createElement(TableActions_1.default, { row: row }))));
77
- }, [freezedBgColor, freezedTextColor, noBorders, theme.colors, isActionFreeze]);
68
+ var _b, _c, _d;
69
+ var row = _a.row;
70
+ return (react_2.default.createElement(react_1.Td, { w: 2, p: 0, fontSize: 14, backgroundColor: (_c = (_b = theme === null || theme === void 0 ? void 0 : theme.colors) === null || _b === void 0 ? void 0 : _b.background) === null || _c === void 0 ? void 0 : _c[50], color: freezedTextColor, position: isActionFreeze ? "sticky" : "relative", borderBottom: noBorders ? "none" : "0.063rem solid ".concat((_d = theme.colors) === null || _d === void 0 ? void 0 : _d.border[500]), boxSizing: "border-box", right: 0, zIndex: 1, className: "columns sticky-columns".concat(isActionFreeze ? "-right" : "") }, (row.onLink || row.onEdit || row.onDelete) && (react_2.default.createElement(TableActions_1.default, { row: row }))));
71
+ }, [freezedTextColor, noBorders, theme.colors, isActionFreeze]);
78
72
  var totalVisibleColumns = Object.values(columns).filter(function (o) { return !o.isHidden; }).length +
79
73
  (isCheckbox ? 1 : 0) +
80
74
  (isContent ? 1 : 0) +
@@ -93,23 +87,22 @@ var TableBody = function (_a) {
93
87
  var rowIndex = startRow + index;
94
88
  var isExpanded = expandedRows.has(rowIndex);
95
89
  var isChecked = selections.includes(row.id);
96
- var freezeViewColor = index % 2 === 1 ? theme.colors.backgroundColor.light : "white";
97
90
  return (react_2.default.createElement(react_2.default.Fragment, { key: rowIndex },
98
91
  react_2.default.createElement(react_1.Tr, { key: index + 1, sx: isChecked
99
92
  ? {
100
93
  "& td": {
101
- backgroundColor: theme.colors.gray[100],
94
+ backgroundColor: theme.colors.disabled[100],
102
95
  },
103
96
  }
104
97
  : {} },
105
98
  isContent && (react_2.default.createElement(RenderContent, { rowIndex: rowIndex, isExpanded: isExpanded, isContent: !!((_a = row === null || row === void 0 ? void 0 : row.content) === null || _a === void 0 ? void 0 : _a.call(row)) })),
106
99
  isCheckbox && react_2.default.createElement(RenderCheckbox, { row: row, isChecked: isChecked }),
107
100
  columns.map(function (header, headerIndex) {
108
- var _a, _b;
101
+ var _a, _b, _c, _d, _e, _f, _g;
109
102
  if (header.isHidden)
110
103
  return null;
111
104
  var isFrozen = header.isFreeze;
112
- var _c = (0, table_1.TableCellCalculation)({
105
+ var leftOffset = (0, table_1.TableCellCalculation)({
113
106
  isFrozen: isFrozen,
114
107
  columnWidths: columnWidths,
115
108
  headerIndex: headerIndex,
@@ -118,24 +111,24 @@ var TableBody = function (_a) {
118
111
  row: row,
119
112
  freezedBgColor: freezedBgColor,
120
113
  index: index,
121
- }), leftOffset = _c.leftOffset, cellBgColor = _c.cellBgColor, rowBgColor = _c.rowBgColor, cellTextColor = _c.cellTextColor, rowTextColor = _c.rowTextColor;
122
- return (react_2.default.createElement(react_1.Td, { maxWidth: 500, minWidth: 120, key: headerIndex + 1, onClick: function () {
114
+ }).leftOffset;
115
+ return (react_2.default.createElement(react_1.Td, { maxWidth: 500, minWidth: 120, height: 45, key: headerIndex + 1, onClick: function () {
123
116
  return !header.node
124
117
  ? handleRowClick(row, {
125
118
  label: header.label,
126
119
  id: header.id,
127
120
  })
128
121
  : null;
129
- }, fontSize: 14, fontWeight: 400, position: isFrozen ? "sticky" : undefined, left: isFrozen ? leftOffset : undefined, zIndex: isFrozen ? 1 : 0, backgroundColor: cellBgColor !== null && cellBgColor !== void 0 ? cellBgColor : rowBgColor, textOverflow: "ellipsis", border: noBorders
122
+ }, fontSize: 14, fontWeight: 400, position: isFrozen ? "sticky" : undefined, left: isFrozen ? leftOffset : undefined, zIndex: isFrozen ? 1 : 0, backgroundColor: (_a = theme.colors.background) === null || _a === void 0 ? void 0 : _a[50], textOverflow: "ellipsis", borderBottom: noBorders
130
123
  ? "none"
131
- : "1px solid ".concat((_a = theme.colors) === null || _a === void 0 ? void 0 : _a.gray[isFrozen || isChecked ? 300 : 200]), className: "columns ".concat(isFrozen ? "sticky-columns" : "scrollable-columns"), boxSizing: "border-box", color: cellTextColor !== null && cellTextColor !== void 0 ? cellTextColor : rowTextColor, _hover: ((_b = row.cellStyle) === null || _b === void 0 ? void 0 : _b[header.id]) || row.rowStyle
124
+ : "0.063rem solid ".concat((_b = theme.colors) === null || _b === void 0 ? void 0 : _b.gray[isFrozen || isChecked ? 300 : 200]), className: "columns ".concat(isFrozen ? "sticky-columns" : "scrollable-columns"), boxSizing: "border-box", color: (_d = (_c = theme.colors) === null || _c === void 0 ? void 0 : _c.text) === null || _d === void 0 ? void 0 : _d[500], _hover: ((_e = row.cellStyle) === null || _e === void 0 ? void 0 : _e[header.id]) || row.rowStyle
132
125
  ? {}
133
126
  : {
134
- backgroundColor: theme.colors.gray[100],
127
+ backgroundColor: (_g = (_f = theme.colors.secondary) === null || _f === void 0 ? void 0 : _f.opacity) === null || _g === void 0 ? void 0 : _g[4],
135
128
  } },
136
129
  react_2.default.createElement(react_1.Box, { display: "block", overflow: "hidden", whiteSpace: "normal", overflowWrap: "break-word" }, header.node ? header.node(row) : row[header.id])));
137
130
  }),
138
- isLink && react_2.default.createElement(RenderView, { row: row, bgcolor: freezeViewColor })),
131
+ isLink && react_2.default.createElement(RenderView, { row: row })),
139
132
  row.content && isExpanded && (react_2.default.createElement(react_1.Tr, null,
140
133
  react_2.default.createElement(react_1.Td, { colSpan: columns.length +
141
134
  (isCheckbox ? 1 : 0) +
@@ -43,42 +43,30 @@ var table_1 = require("../../../Utils/table");
43
43
  var useCustomTheme_1 = require("../../../Theme/useCustomTheme");
44
44
  var TableFilters_1 = __importDefault(require("./TableFilters"));
45
45
  var lucide_react_1 = require("lucide-react");
46
+ var Checkbox_1 = __importDefault(require("../../Checkbox/Checkbox"));
46
47
  var TableHeader = function (_a) {
47
- var _b;
48
48
  var columns = _a.columns, isCheckbox = _a.isCheckbox, handleSort = _a.handleSort, headerRefs = _a.headerRefs, columnWidths = _a.columnWidths, columnsSort = _a.columnsSort, headerBgColor = _a.headerBgColor, headerTextColor = _a.headerTextColor, freezedBgColor = _a.freezedBgColor, freezedTextColor = _a.freezedTextColor, noBorders = _a.noBorders, handleCheckbox = _a.handleCheckbox, checked = _a.checked, isLoading = _a.isLoading, isContent = _a.isContent, isLink = _a.isLink, isActionFreeze = _a.isActionFreeze, setColumnsSearch = _a.setColumnsSearch, columnsSearch = _a.columnsSearch;
49
49
  var theme = (0, useCustomTheme_1.useCustomTheme)();
50
50
  var RenderCheckbox = (0, react_2.useCallback)(function () {
51
- var _a;
52
- return (react_2.default.createElement(react_1.Th, { w: 6, fontSize: 14, fontWeight: 600, color: freezedTextColor, textTransform: "capitalize", backgroundColor: freezedBgColor, border: noBorders ? "none" : "1px solid ".concat((_a = theme.colors) === null || _a === void 0 ? void 0 : _a.gray[300]), position: "sticky", className: "columns sticky-columns", left: "0px", zIndex: 9, boxShadow: "2px 0 5px rgba(0, 0, 0, 0.1)" },
53
- react_2.default.createElement(react_1.Checkbox, { "aria-label": "Select all rows", colorScheme: "gray", backgroundColor: theme.colors.gray[50], borderColor: theme.colors.gray[500], variant: "outline", onChange: function () { return handleCheckbox(0); }, isChecked: isLoading ? false : checked === true, isIndeterminate: checked === "indeterminate", _hover: { transform: "scale(1.1)" } })));
51
+ var _a, _b, _c, _d;
52
+ return (react_2.default.createElement(react_1.Th, { w: 6, fontSize: 14, fontWeight: 600, color: freezedTextColor, textTransform: "capitalize", backgroundColor: (_c = (_b = (_a = theme.colors) === null || _a === void 0 ? void 0 : _a.table) === null || _b === void 0 ? void 0 : _b.hover) === null || _c === void 0 ? void 0 : _c[600], borderY: noBorders ? "none" : "0.063rem solid ".concat((_d = theme.colors) === null || _d === void 0 ? void 0 : _d.gray[300]), position: "sticky", className: "columns sticky-columns", left: "0px", zIndex: 9, boxShadow: "2px 0 5px rgba(0, 0, 0, 0.1)" },
53
+ react_2.default.createElement(Checkbox_1.default, { "aria-label": "Select all rows", variant: "outline", onChange: function () { return handleCheckbox(0); }, isChecked: isLoading ? false : checked === true, isIndeterminate: checked === "indeterminate" })));
54
54
  }, [
55
55
  checked,
56
- freezedBgColor,
57
56
  freezedTextColor,
58
57
  handleCheckbox,
59
58
  isLoading,
60
59
  noBorders,
61
- (_b = theme.colors) === null || _b === void 0 ? void 0 : _b.gray,
60
+ theme.colors,
62
61
  ]);
63
62
  var RenderConent = (0, react_2.useCallback)(function () {
64
- var _a;
65
- return (react_2.default.createElement(react_1.Th, { w: 6, minW: "35px", p: 0, backgroundColor: freezedBgColor, border: noBorders ? "none" : "1px solid ".concat((_a = theme.colors) === null || _a === void 0 ? void 0 : _a.gray[300]), position: "sticky", className: "columns sticky-columns", left: "0px", zIndex: 1, boxShadow: "2px 0 5px rgba(0, 0, 0, 0.1)" },
66
- react_2.default.createElement(react_1.Box, { display: "flex", justifyContent: "center" },
67
- react_2.default.createElement(lucide_react_1.FolderGit2, { size: 17 }))));
68
- }, [freezedBgColor, noBorders, theme.colors.gray]);
63
+ var _a, _b, _c, _d;
64
+ return (react_2.default.createElement(react_1.Th, { w: 6, minW: "35px", p: 0, backgroundColor: (_c = (_b = (_a = theme.colors) === null || _a === void 0 ? void 0 : _a.table) === null || _b === void 0 ? void 0 : _b.hover) === null || _c === void 0 ? void 0 : _c[600], borderY: noBorders ? "none" : "0.063rem solid ".concat((_d = theme.colors) === null || _d === void 0 ? void 0 : _d.gray[300]), position: "sticky", className: "columns sticky-columns", left: "0px", zIndex: 1, boxShadow: "2px 0 5px rgba(0, 0, 0, 0.1)" }));
65
+ }, [noBorders, theme.colors]);
69
66
  var RenderView = (0, react_2.useCallback)(function () {
70
- var _a;
71
- var BgColor = isActionFreeze ? freezedBgColor : headerBgColor;
72
- return (react_2.default.createElement(react_1.Th, { w: 2, p: 0, minW: "2.065rem", backgroundColor: BgColor, border: noBorders ? "none" : "1px solid ".concat((_a = theme.colors) === null || _a === void 0 ? void 0 : _a.gray[300]), position: isActionFreeze ? "sticky" : "relative", className: "columns sticky-columns", right: "0px", zIndex: 1, boxShadow: "2px 0 5px rgba(0, 0, 0, 0.1)" },
73
- react_2.default.createElement(react_1.Box, { display: "flex", justifyContent: "center" },
74
- react_2.default.createElement(lucide_react_1.FileSymlink, { size: 17 }))));
75
- }, [
76
- freezedBgColor,
77
- noBorders,
78
- theme.colors.gray,
79
- headerBgColor,
80
- isActionFreeze,
81
- ]);
67
+ var _a, _b, _c, _d;
68
+ return (react_2.default.createElement(react_1.Th, { w: 2, p: 0, minW: "2.065rem", backgroundColor: (_c = (_b = (_a = theme.colors) === null || _a === void 0 ? void 0 : _a.table) === null || _b === void 0 ? void 0 : _b.hover) === null || _c === void 0 ? void 0 : _c[600], borderY: noBorders ? "none" : "0.063rem solid ".concat((_d = theme.colors) === null || _d === void 0 ? void 0 : _d.gray[300]), position: isActionFreeze ? "sticky" : "relative", className: "columns sticky-columns", right: "0px", zIndex: 1, boxShadow: "2px 0 5px rgba(0, 0, 0, 0.1)" }));
69
+ }, [noBorders, theme.colors, isActionFreeze]);
82
70
  return (react_2.default.createElement(react_1.Tr, { pr: 0 },
83
71
  isContent && react_2.default.createElement(RenderConent, null),
84
72
  isCheckbox && react_2.default.createElement(RenderCheckbox, null),
@@ -99,9 +87,9 @@ var SortingIcon = (0, react_2.memo)(function (_a) {
99
87
  sortState === "desc" && react_2.default.createElement(lucide_react_1.ChevronDown, { color: "black", size: 14 })));
100
88
  });
101
89
  var ColumnHeader = (0, react_2.memo)(function (_a) {
102
- var _b;
103
- var header = _a.header, index = _a.index, columnWidths = _a.columnWidths, isCheckbox = _a.isCheckbox, headerBgColor = _a.headerBgColor, headerTextColor = _a.headerTextColor, freezedBgColor = _a.freezedBgColor, freezedTextColor = _a.freezedTextColor, noBorders = _a.noBorders, columnsSort = _a.columnsSort, headerRefs = _a.headerRefs, columnsSearch = _a.columnsSearch, setColumnsSearch = _a.setColumnsSearch, handleSort = _a.handleSort;
104
- var _c = (0, react_2.useState)(false), isHovered = _c[0], setIsHovered = _c[1];
90
+ var _b, _c, _d, _e, _f, _g;
91
+ var header = _a.header, index = _a.index, columnWidths = _a.columnWidths, isCheckbox = _a.isCheckbox, headerTextColor = _a.headerTextColor, freezedTextColor = _a.freezedTextColor, noBorders = _a.noBorders, columnsSort = _a.columnsSort, headerRefs = _a.headerRefs, columnsSearch = _a.columnsSearch, setColumnsSearch = _a.setColumnsSearch, handleSort = _a.handleSort;
92
+ var _h = (0, react_2.useState)(false), isHovered = _h[0], setIsHovered = _h[1];
105
93
  var theme = (0, useCustomTheme_1.useCustomTheme)();
106
94
  var isFrozen = header.isFreeze;
107
95
  var leftOffset = isFrozen
@@ -110,8 +98,7 @@ var ColumnHeader = (0, react_2.memo)(function (_a) {
110
98
  var isSorting = header.isSort
111
99
  ? columnsSort.find(function (o) { return o.column === header.id; })
112
100
  : undefined;
113
- var BgColor = isFrozen ? freezedBgColor : headerBgColor;
114
- var TextColor = isFrozen ? freezedTextColor : headerTextColor;
101
+ // const TextColor = isFrozen ? freezedTextColor : headerTextColor;
115
102
  var handleMouseDown = function (e) {
116
103
  var parentBox = e.target
117
104
  .parentElement;
@@ -145,8 +132,8 @@ var ColumnHeader = (0, react_2.memo)(function (_a) {
145
132
  }, [handleSort]);
146
133
  var isFiltersEnabled = (isHovered && header.isSort) ||
147
134
  ((isSorting === null || isSorting === void 0 ? void 0 : isSorting.direction) && isSorting.direction !== "none");
148
- return (react_2.default.createElement(react_1.Th, { key: index + 1, ref: function (el) { return (headerRefs.current[index] = el); }, textTransform: "capitalize", color: TextColor, fontSize: 14, fontWeight: 600, position: isFrozen ? "sticky" : undefined, left: isFrozen ? leftOffset : undefined, minWidth: 120, backgroundColor: BgColor, maxWidth: 500, zIndex: isFrozen ? 2 : 1, py: 2, pr: 0, border: noBorders ? "none" : "1px solid ".concat((_b = theme.colors) === null || _b === void 0 ? void 0 : _b.gray[300]), className: "columns ".concat(isFrozen ? "sticky-columns" : "scrollable-columns"), height: 41, onMouseEnter: function () { return setIsHovered(true); }, onMouseLeave: function () { return setIsHovered(false); } },
149
- react_2.default.createElement(react_1.Box, { display: "flex", color: TextColor, justifyContent: "space-between", alignItems: "center", position: "relative" },
135
+ return (react_2.default.createElement(react_1.Th, { key: index + 1, ref: function (el) { return (headerRefs.current[index] = el); }, textTransform: "capitalize", fontSize: 16, fontWeight: 600, position: isFrozen ? "sticky" : undefined, left: isFrozen ? leftOffset : undefined, minWidth: 120, backgroundColor: (_d = (_c = (_b = theme.colors) === null || _b === void 0 ? void 0 : _b.table) === null || _c === void 0 ? void 0 : _c.hover) === null || _d === void 0 ? void 0 : _d[600], maxWidth: 500, zIndex: isFrozen ? 2 : 1, py: 2, pr: 0, borderY: noBorders ? "none" : "0.063rem solid ".concat((_e = theme.colors) === null || _e === void 0 ? void 0 : _e.border[500]), className: "columns ".concat(isFrozen ? "sticky-columns" : "scrollable-columns"), height: 45, onMouseEnter: function () { return setIsHovered(true); }, onMouseLeave: function () { return setIsHovered(false); } },
136
+ react_2.default.createElement(react_1.Box, { display: "flex", color: (_g = (_f = theme.colors) === null || _f === void 0 ? void 0 : _f.secondary) === null || _g === void 0 ? void 0 : _g[500], lineHeight: "1.25rem", justifyContent: "space-between", alignItems: "center", position: "relative" },
150
137
  react_2.default.createElement(react_1.Box, { textOverflow: "ellipsis", whiteSpace: "nowrap", display: "block", overflow: "hidden" }, header.label),
151
138
  react_2.default.createElement(react_1.Box, { display: "flex", alignItems: "center" },
152
139
  isFiltersEnabled && (react_2.default.createElement(Sorting, { isSorting: isSorting, header: header })),
@@ -0,0 +1,6 @@
1
+ import React from "react";
2
+ interface TableSearchProps {
3
+ onSearch?: (value: string) => void;
4
+ }
5
+ declare const TableSearch: React.FC<TableSearchProps>;
6
+ export default TableSearch;
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ var react_1 = __importStar(require("react"));
27
+ var react_2 = require("@chakra-ui/react");
28
+ var lucide_react_1 = require("lucide-react");
29
+ var useCustomTheme_1 = require("../../../Theme/useCustomTheme");
30
+ var table_1 = require("../../../Utils/table");
31
+ var TableSearch = function (_a) {
32
+ var _b, _c, _d, _e;
33
+ var onSearch = _a.onSearch;
34
+ var colors = (0, useCustomTheme_1.useCustomTheme)().colors;
35
+ var _f = (0, react_1.useState)(false), showInput = _f[0], setShowInput = _f[1];
36
+ var _g = (0, react_1.useState)(""), query = _g[0], setQuery = _g[1];
37
+ var handleSearchClick = function () {
38
+ setShowInput(function (prev) { return !prev; });
39
+ if (showInput) {
40
+ setQuery("");
41
+ if (query)
42
+ onSearch === null || onSearch === void 0 ? void 0 : onSearch(""); // clear search on close
43
+ }
44
+ };
45
+ var handleDebounce = (0, table_1.useDebounce)(function (value) {
46
+ onSearch === null || onSearch === void 0 ? void 0 : onSearch(value);
47
+ }, 700);
48
+ var handleInputChange = function (e) {
49
+ var value = e.target.value;
50
+ setQuery(value);
51
+ handleDebounce(value);
52
+ };
53
+ return (react_1.default.createElement(react_2.Box, { display: "flex", alignItems: "center", gap: "2" },
54
+ !showInput && (react_1.default.createElement(react_2.Icon, { as: lucide_react_1.Search, transform: "scaleX(-1)", cursor: "pointer", boxSize: 5, color: (_b = colors === null || colors === void 0 ? void 0 : colors.text) === null || _b === void 0 ? void 0 : _b[500], onClick: handleSearchClick })),
55
+ showInput ? (react_1.default.createElement(react_2.InputGroup, { maxW: "12.5rem", transition: "all 0.3s ease" },
56
+ react_1.default.createElement(react_2.Input, { placeholder: "Search...", value: query, onChange: handleInputChange, size: "sm", borderRadius: "md", borderColor: (_c = colors === null || colors === void 0 ? void 0 : colors.border) === null || _c === void 0 ? void 0 : _c[500], _focus: { borderColor: (_d = colors === null || colors === void 0 ? void 0 : colors.primary) === null || _d === void 0 ? void 0 : _d[500] }, autoFocus: true }),
57
+ react_1.default.createElement(react_2.InputRightElement, { display: "flex", alignItems: "center", height: "2rem" },
58
+ react_1.default.createElement(react_2.Icon, { as: lucide_react_1.X, color: (_e = colors === null || colors === void 0 ? void 0 : colors.text) === null || _e === void 0 ? void 0 : _e[500], cursor: "pointer", onClick: handleSearchClick })))) : null));
59
+ };
60
+ exports.default = TableSearch;
@@ -41,5 +41,6 @@ declare const useTable: ({ tableBorderColor, data, isPagination, selections, onS
41
41
  setCurrentPage: import("react").Dispatch<import("react").SetStateAction<number>>;
42
42
  columnsList: TableHeaderProps[];
43
43
  handleColumnPreferences: (columns: any) => void;
44
+ handleGlobalSearch: (query: string) => void;
44
45
  };
45
46
  export default useTable;
@@ -136,6 +136,11 @@ var useTable = function (_a) {
136
136
  savePreferences &&
137
137
  savePreferences(__assign(__assign({}, tablePreferences), { columns: columns }));
138
138
  };
139
+ var handleGlobalSearch = function (query) {
140
+ if (!query)
141
+ setFilteredData(tableData);
142
+ setFilteredData((0, table_1.globalSearchFilter)(tableData, query));
143
+ };
139
144
  return {
140
145
  tableData: tableData,
141
146
  tableContainerStyles: tableContainerStyles,
@@ -157,6 +162,7 @@ var useTable = function (_a) {
157
162
  setCurrentPage: setCurrentPage,
158
163
  columnsList: columnsList,
159
164
  handleColumnPreferences: handleColumnPreferences,
165
+ handleGlobalSearch: handleGlobalSearch,
160
166
  };
161
167
  };
162
168
  exports.default = useTable;
@@ -1,4 +1,4 @@
1
1
  import React from "react";
2
2
  import { TableProps } from "./TableProps";
3
3
  import "./Table.css";
4
- export default function Table({ data, columns, onSelection, isLoading, isCheckbox, headerBgColor, freezedBgColor, headerTextColor, freezedTextColor, tableBorderColor, noBorders, isPagination, onRowClick, selections, isActionFreeze, preferencesUrl, preferencesKey, preferencesName, preferencesPage, authToken, paginationMode, noOfRowsPerPage, totalRecords, onPagination, isTableSettings, }: TableProps): React.JSX.Element;
4
+ export default function Table({ data, columns, onSelection, isLoading, isCheckbox, headerBgColor, freezedBgColor, headerTextColor, freezedTextColor, tableBorderColor, noBorders, isPagination, onRowClick, selections, isActionFreeze, preferencesUrl, preferencesKey, preferencesName, preferencesPage, authToken, paginationMode, noOfRowsPerPage, totalRecords, onPagination, isTableSettings, headerActions, }: TableProps): React.JSX.Element;
@@ -38,19 +38,22 @@ require("./Table.css");
38
38
  var table_1 = require("../../Utils/table");
39
39
  var usePreferences_1 = require("../../Hooks/usePreferences");
40
40
  var TableSettings_1 = __importDefault(require("./TableSettings/TableSettings"));
41
+ var HeaderActions_1 = __importDefault(require("./Components/HeaderActions"));
42
+ var Divider_1 = __importDefault(require("../Divider/Divider"));
43
+ var TableSearch_1 = __importDefault(require("./Components/TableSearch"));
41
44
  function Table(_a) {
42
- var _b, _c, _d;
43
- var data = _a.data, columns = _a.columns, onSelection = _a.onSelection, isLoading = _a.isLoading, _e = _a.isCheckbox, isCheckbox = _e === void 0 ? false : _e, headerBgColor = _a.headerBgColor, freezedBgColor = _a.freezedBgColor, headerTextColor = _a.headerTextColor, freezedTextColor = _a.freezedTextColor, tableBorderColor = _a.tableBorderColor, _f = _a.noBorders, noBorders = _f === void 0 ? false : _f, _g = _a.isPagination, isPagination = _g === void 0 ? true : _g, onRowClick = _a.onRowClick, selections = _a.selections, _h = _a.isActionFreeze, isActionFreeze = _h === void 0 ? true : _h, _j = _a.preferencesUrl, preferencesUrl = _j === void 0 ? "" : _j, _k = _a.preferencesKey, preferencesKey = _k === void 0 ? "" : _k, _l = _a.preferencesName, preferencesName = _l === void 0 ? "" : _l, _m = _a.preferencesPage, preferencesPage = _m === void 0 ? "" : _m, _o = _a.authToken, authToken = _o === void 0 ? "" : _o, _p = _a.paginationMode, paginationMode = _p === void 0 ? "client" : _p, _q = _a.noOfRowsPerPage, noOfRowsPerPage = _q === void 0 ? 50 : _q, _r = _a.totalRecords, totalRecords = _r === void 0 ? 0 : _r, onPagination = _a.onPagination, _s = _a.isTableSettings, isTableSettings = _s === void 0 ? false : _s;
45
+ var _b, _c, _d, _e, _f, _g;
46
+ var data = _a.data, columns = _a.columns, onSelection = _a.onSelection, isLoading = _a.isLoading, _h = _a.isCheckbox, isCheckbox = _h === void 0 ? false : _h, headerBgColor = _a.headerBgColor, freezedBgColor = _a.freezedBgColor, headerTextColor = _a.headerTextColor, freezedTextColor = _a.freezedTextColor, tableBorderColor = _a.tableBorderColor, _j = _a.noBorders, noBorders = _j === void 0 ? false : _j, _k = _a.isPagination, isPagination = _k === void 0 ? true : _k, onRowClick = _a.onRowClick, selections = _a.selections, _l = _a.isActionFreeze, isActionFreeze = _l === void 0 ? true : _l, _m = _a.preferencesUrl, preferencesUrl = _m === void 0 ? "" : _m, _o = _a.preferencesKey, preferencesKey = _o === void 0 ? "" : _o, _p = _a.preferencesName, preferencesName = _p === void 0 ? "" : _p, _q = _a.preferencesPage, preferencesPage = _q === void 0 ? "" : _q, _r = _a.authToken, authToken = _r === void 0 ? "" : _r, _s = _a.paginationMode, paginationMode = _s === void 0 ? "client" : _s, _t = _a.noOfRowsPerPage, noOfRowsPerPage = _t === void 0 ? 50 : _t, _u = _a.totalRecords, totalRecords = _u === void 0 ? 0 : _u, onPagination = _a.onPagination, _v = _a.isTableSettings, isTableSettings = _v === void 0 ? false : _v, headerActions = _a.headerActions;
44
47
  var theme = (0, useCustomTheme_1.useCustomTheme)();
45
- var _t = (0, react_1.useState)({}), columnsSearch = _t[0], setColumnsSearch = _t[1];
48
+ var _w = (0, react_1.useState)({}), columnsSearch = _w[0], setColumnsSearch = _w[1];
46
49
  var isServerPagination = paginationMode === "server";
47
- var _u = (0, usePreferences_1.useGetPreferences)({
50
+ var _x = (0, usePreferences_1.useGetPreferences)({
48
51
  baseUrl: preferencesUrl,
49
52
  page: preferencesPage,
50
53
  key: preferencesKey,
51
54
  name: preferencesName,
52
55
  authToken: authToken,
53
- }), preferences = _u.preferences, loading = _u.loading;
56
+ }), preferences = _x.preferences, loading = _x.loading;
54
57
  var savePreferences = (0, usePreferences_1.useSavePreferences)({
55
58
  baseUrl: preferencesUrl,
56
59
  page: preferencesPage,
@@ -67,7 +70,7 @@ function Table(_a) {
67
70
  }
68
71
  return {};
69
72
  }, [preferences]);
70
- var _v = (0, useTable_1.default)({
73
+ var _y = (0, useTable_1.default)({
71
74
  tableBorderColor: tableBorderColor,
72
75
  data: data,
73
76
  isPagination: isPagination,
@@ -79,7 +82,7 @@ function Table(_a) {
79
82
  noOfRowsPerPage: noOfRowsPerPage,
80
83
  totalRecords: totalRecords,
81
84
  isServerPagination: isServerPagination,
82
- }), tableData = _v.tableData, tableContainerStyles = _v.tableContainerStyles, isContent = _v.isContent, isLink = _v.isLink, headerRefs = _v.headerRefs, columnWidths = _v.columnWidths, handleSort = _v.handleSort, handleCheckbox = _v.handleCheckbox, filteredData = _v.filteredData, startRow = _v.startRow, endRow = _v.endRow, selection = _v.selection, columnsSort = _v.columnsSort, currentPage = _v.currentPage, pages = _v.pages, rowsPerPage = _v.rowsPerPage, handlePageSizeChange = _v.handlePageSizeChange, setCurrentPage = _v.setCurrentPage, columnsList = _v.columnsList, handleColumnPreferences = _v.handleColumnPreferences;
85
+ }), tableData = _y.tableData, isContent = _y.isContent, isLink = _y.isLink, headerRefs = _y.headerRefs, columnWidths = _y.columnWidths, handleSort = _y.handleSort, handleCheckbox = _y.handleCheckbox, filteredData = _y.filteredData, startRow = _y.startRow, endRow = _y.endRow, selection = _y.selection, columnsSort = _y.columnsSort, currentPage = _y.currentPage, pages = _y.pages, rowsPerPage = _y.rowsPerPage, handlePageSizeChange = _y.handlePageSizeChange, setCurrentPage = _y.setCurrentPage, columnsList = _y.columnsList, handleColumnPreferences = _y.handleColumnPreferences, handleGlobalSearch = _y.handleGlobalSearch;
83
86
  var _filteredData = (0, react_1.useMemo)(function () {
84
87
  return (0, table_1.searchAndSortData)(filteredData, columnsSearch);
85
88
  }, [columnsSearch, filteredData]);
@@ -88,18 +91,27 @@ function Table(_a) {
88
91
  onPagination(currentPage + 1, noOfRowsPerPage);
89
92
  }
90
93
  }, [currentPage, onPagination, noOfRowsPerPage]);
91
- return (react_1.default.createElement(react_1.default.Fragment, null,
92
- isTableSettings && (react_1.default.createElement(TableSettings_1.default, { columns: columnsList, onSave: function (cols) { return handleColumnPreferences(cols); } })),
93
- react_1.default.createElement(react_2.TableContainer, { sx: tableContainerStyles },
94
+ var tablePaginationText = "".concat(startRow + 1, " - ").concat(endRow > tableData.length ? tableData.length : endRow, " of ").concat(isServerPagination ? totalRecords : tableData.length);
95
+ return (react_1.default.createElement(react_2.Box, { bg: (_c = (_b = theme.colors) === null || _b === void 0 ? void 0 : _b.background) === null || _c === void 0 ? void 0 : _c[50], border: "0.063rem solid ".concat((_d = theme.colors.border) === null || _d === void 0 ? void 0 : _d[500]), borderRadius: 3 },
96
+ react_1.default.createElement(react_2.Box, { display: "flex", alignItems: "center", justifyContent: "space-between", px: 3, py: 0, height: 45, gap: 2 },
97
+ react_1.default.createElement(TableSearch_1.default, { onSearch: handleGlobalSearch }),
98
+ isTableSettings && (react_1.default.createElement(react_1.default.Fragment, null,
99
+ react_1.default.createElement(Divider_1.default, null),
100
+ react_1.default.createElement(TableSettings_1.default, { columns: columnsList, onSave: function (cols) { return handleColumnPreferences(cols); } }))),
101
+ selection.length ? (react_1.default.createElement(react_1.default.Fragment, null,
102
+ react_1.default.createElement(Divider_1.default, null),
103
+ react_1.default.createElement(HeaderActions_1.default, { actions: headerActions, selections: selection }))) : null,
104
+ (isPagination || isServerPagination) && (react_1.default.createElement(react_2.Box, { ml: "auto" },
105
+ react_1.default.createElement(Pagination_1.default, { columns: columns, currentPage: currentPage, setCurrentPage: setCurrentPage, rowsPerPage: rowsPerPage, pages: pages, paginationText: tablePaginationText, handlePageSizeChange: handlePageSizeChange, dataLength: tableData.length, isServerPagination: isServerPagination, isVisiblity: true })))),
106
+ react_1.default.createElement(react_2.TableContainer, { maxH: 500, overflowY: "auto" },
94
107
  react_1.default.createElement(react_3.Table, { variant: "simple", size: "sm", overflowX: "scroll", minW: "100%", className: "table_wrapper" },
95
108
  react_1.default.createElement(react_3.Thead, { position: "sticky", top: -0.5, zIndex: 2 },
96
- react_1.default.createElement(TableHeader_1.default, { columns: columnsList, isCheckbox: isCheckbox, headerBgColor: headerBgColor !== null && headerBgColor !== void 0 ? headerBgColor : theme.colors.backgroundColor.muted, headerTextColor: headerTextColor !== null && headerTextColor !== void 0 ? headerTextColor : (_b = theme.colors) === null || _b === void 0 ? void 0 : _b.gray[600], freezedBgColor: freezedBgColor !== null && freezedBgColor !== void 0 ? freezedBgColor : theme.colors.backgroundColor.secondary, freezedTextColor: freezedTextColor !== null && freezedTextColor !== void 0 ? freezedTextColor : (_c = theme.colors) === null || _c === void 0 ? void 0 : _c.gray[600], handleSort: handleSort, headerRefs: headerRefs, columnWidths: columnWidths, columnsSort: columnsSort, noBorders: noBorders, handleCheckbox: handleCheckbox, isLoading: isTableLoading, checked: tableData.length !== 0 && selection.length === tableData.length
109
+ react_1.default.createElement(TableHeader_1.default, { columns: columnsList, isCheckbox: isCheckbox, headerBgColor: headerBgColor !== null && headerBgColor !== void 0 ? headerBgColor : theme.colors.backgroundColor.muted, headerTextColor: headerTextColor !== null && headerTextColor !== void 0 ? headerTextColor : (_e = theme.colors) === null || _e === void 0 ? void 0 : _e.gray[600], freezedBgColor: freezedBgColor !== null && freezedBgColor !== void 0 ? freezedBgColor : theme.colors.backgroundColor.secondary, freezedTextColor: freezedTextColor !== null && freezedTextColor !== void 0 ? freezedTextColor : (_f = theme.colors) === null || _f === void 0 ? void 0 : _f.gray[600], handleSort: handleSort, headerRefs: headerRefs, columnWidths: columnWidths, columnsSort: columnsSort, noBorders: noBorders, handleCheckbox: handleCheckbox, isLoading: isTableLoading, checked: tableData.length !== 0 && selection.length === tableData.length
97
110
  ? true
98
111
  : selection.length === 0
99
112
  ? false
100
113
  : "indeterminate", isContent: isContent, isLink: isLink, isActionFreeze: isActionFreeze, setColumnsSearch: setColumnsSearch, columnsSearch: columnsSearch })),
101
114
  react_1.default.createElement(react_3.Tbody, null,
102
- react_1.default.createElement(TableBody_1.default, { data: _filteredData, columns: columnsList, startRow: startRow, endRow: endRow, isCheckbox: isCheckbox, columnWidths: columnWidths, noBorders: noBorders, freezedBgColor: freezedBgColor !== null && freezedBgColor !== void 0 ? freezedBgColor : theme.colors.backgroundColor.secondary, freezedTextColor: freezedTextColor !== null && freezedTextColor !== void 0 ? freezedTextColor : (_d = theme.colors) === null || _d === void 0 ? void 0 : _d.gray[600], handleCheckbox: handleCheckbox, selections: selection, isLoading: isTableLoading, onRowClick: onRowClick, isContent: isContent, isLink: isLink, isActionFreeze: isActionFreeze })))),
103
- (isPagination || isServerPagination) && (react_1.default.createElement(Pagination_1.default, { columns: columns, currentPage: currentPage, setCurrentPage: setCurrentPage, rowsPerPage: rowsPerPage, pages: pages, paginationText: "".concat(startRow + 1, " to ").concat(endRow, " of ").concat(isServerPagination ? totalRecords : tableData.length), handlePageSizeChange: handlePageSizeChange, dataLength: tableData.length, isServerPagination: isServerPagination, isVisiblity: true }))));
115
+ react_1.default.createElement(TableBody_1.default, { data: _filteredData, columns: columnsList, startRow: startRow, endRow: endRow, isCheckbox: isCheckbox, columnWidths: columnWidths, noBorders: noBorders, freezedBgColor: freezedBgColor !== null && freezedBgColor !== void 0 ? freezedBgColor : theme.colors.backgroundColor.secondary, freezedTextColor: freezedTextColor !== null && freezedTextColor !== void 0 ? freezedTextColor : (_g = theme.colors) === null || _g === void 0 ? void 0 : _g.gray[600], handleCheckbox: handleCheckbox, selections: selection, isLoading: isTableLoading, onRowClick: onRowClick, isContent: isContent, isLink: isLink, isActionFreeze: isActionFreeze }))))));
104
116
  }
105
117
  exports.default = Table;
@@ -29,6 +29,22 @@ export type TableProps = {
29
29
  totalRecords?: number;
30
30
  onPagination?: (page: number, noOfRecords: number) => void;
31
31
  isTableSettings?: boolean;
32
+ headerActions?: HeaderActionsProps;
33
+ };
34
+ export type HeaderActionsProps = {
35
+ isDelete?: {
36
+ enabled?: boolean;
37
+ onClick?: (selection: (string | number)[]) => void;
38
+ };
39
+ isUpdate?: {
40
+ enabled?: boolean;
41
+ onClick?: (selection: (string | number)[]) => void;
42
+ };
43
+ items?: {
44
+ icon: React.ReactElement;
45
+ name: string;
46
+ onClick?: (selection: (string | number)[]) => void;
47
+ }[];
32
48
  };
33
49
  export type DataObject = {
34
50
  [key: string]: string | number | any;
@@ -98,13 +98,9 @@ var ManageColumns = function (_a) {
98
98
  } }),
99
99
  react_1.default.createElement(react_2.Text, { ml: "2", fontSize: 14 }, "Select all"))),
100
100
  react_1.default.createElement(react_2.List, { spacing: "2" }, filteredItems.length > 0 ? (filteredItems.map(function (item, index) { return (react_1.default.createElement(react_2.ListItem, { key: item.id, draggable: true, onDragStart: function () { return handleDragStart(index); }, onDragOver: function (e) { return handleDragOver(e, index); }, onDragEnd: handleDragEnd, bg: theme.colors.gray[50], display: "flex", alignItems: "center", justifyContent: "space-between", borderRadius: "md", border: "1px solid", borderColor: "gray.200", cursor: "grab", position: "relative", fontSize: 14 },
101
- react_1.default.createElement(react_2.IconButton, { "aria-label": "Drag", icon: react_1.default.createElement(lucide_react_1.GripVertical, null), variant: "ghost", cursor: "grab", mr: "8" }),
101
+ react_1.default.createElement(react_2.IconButton, { "aria-label": "Drag", icon: react_1.default.createElement(lucide_react_1.GripVertical, null), variant: "ghost", cursor: "grab", mr: "1" }),
102
102
  react_1.default.createElement(Checkbox_1.default, { isChecked: item.isHidden, onChange: function () { return toggleCheckbox(index); }, sx: {
103
- position: "absolute",
104
- left: 50,
105
- padding: "10px 20px 10px 30px",
106
- width: 60,
107
- translate: "-40px",
103
+ marginRight: "4",
108
104
  } }),
109
105
  react_1.default.createElement(react_2.Text, { flex: "1" }, item.label))); })) : (react_1.default.createElement(react_2.Text, { color: "gray.500", textAlign: "center" }, "No items found")))));
110
106
  };
@@ -33,15 +33,15 @@ var Button_1 = __importDefault(require("../../Button/Button"));
33
33
  var useCustomTheme_1 = require("../../../Theme/useCustomTheme");
34
34
  var lucide_react_1 = require("lucide-react");
35
35
  var TableSettings = function (_a) {
36
+ var _b, _c;
36
37
  var columns = _a.columns, onSave = _a.onSave;
37
38
  var theme = (0, useCustomTheme_1.useCustomTheme)();
38
39
  var childInputMethodsRef = (0, react_2.useRef)({});
39
- var _b = (0, react_2.useState)(false), settingsOpen = _b[0], setSettingsOpen = _b[1];
40
- var _c = (0, react_2.useState)(0), selectedIndex = _c[0], setSelectedIndex = _c[1];
40
+ var _d = (0, react_2.useState)(false), settingsOpen = _d[0], setSettingsOpen = _d[1];
41
+ var _e = (0, react_2.useState)(0), selectedIndex = _e[0], setSelectedIndex = _e[1];
41
42
  return (react_2.default.createElement(react_1.Box, null,
42
- react_2.default.createElement(react_1.Box, { display: "flex", justifyContent: "flex-end", mb: 1 },
43
- react_2.default.createElement(react_1.IconButton, { onClick: function () { return setSettingsOpen(true); }, "aria-label": "Table Settings", border: "1px solid ".concat(theme.colors.gray[300]) },
44
- react_2.default.createElement(lucide_react_1.Settings, { fontSize: 18 }))),
43
+ react_2.default.createElement(react_1.Box, { display: "flex", justifyContent: "flex-end", cursor: "pointer" },
44
+ react_2.default.createElement(lucide_react_1.Settings, { onClick: function () { return setSettingsOpen(true); }, size: "1.25rem", color: (_c = (_b = theme === null || theme === void 0 ? void 0 : theme.colors) === null || _b === void 0 ? void 0 : _b.text) === null || _c === void 0 ? void 0 : _c[500] })),
45
45
  react_2.default.createElement(react_1.Modal, { isOpen: settingsOpen, onClose: function () { return setSettingsOpen(false); }, size: "md" },
46
46
  react_2.default.createElement(react_1.ModalOverlay, null),
47
47
  react_2.default.createElement(react_1.ModalContent, { minW: "700px", minH: "600px" },
@@ -63,7 +63,7 @@ var TableSettings = function (_a) {
63
63
  react_2.default.createElement(react_1.TabPanel, null,
64
64
  react_2.default.createElement(react_1.Text, null, "Scrollbar settings"))))),
65
65
  react_2.default.createElement(react_1.ModalFooter, null,
66
- react_2.default.createElement(Button_1.default, { label: "Close", size: "sm", onClick: function () { return setSettingsOpen(false); }, sx: { marginRight: "0.5rem" }, color: "gray" }),
66
+ react_2.default.createElement(Button_1.default, { label: "Close", size: "sm", onClick: function () { return setSettingsOpen(false); }, sx: { marginRight: "0.5rem" } }),
67
67
  react_2.default.createElement(Button_1.default, { label: "Save", size: "sm", onClick: function () {
68
68
  var _a, _b, _c;
69
69
  onSave((_c = (_b = (_a = childInputMethodsRef.current) === null || _a === void 0 ? void 0 : _a.getManageColumnsData) === null || _b === void 0 ? void 0 : _b.call(_a)) !== null && _c !== void 0 ? _c : []);
@@ -0,0 +1,4 @@
1
+ import React from "react";
2
+ import { ViewToggleProps } from "./TableToggleProps";
3
+ declare const TableToggle: React.FC<ViewToggleProps>;
4
+ export default TableToggle;
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ var __importDefault = (this && this.__importDefault) || function (mod) {
14
+ return (mod && mod.__esModule) ? mod : { "default": mod };
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ var react_1 = __importDefault(require("react"));
18
+ var react_2 = require("@chakra-ui/react");
19
+ var lucide_react_1 = require("lucide-react");
20
+ var useCustomTheme_1 = require("../../Theme/useCustomTheme");
21
+ var TableToggle = function (_a) {
22
+ var value = _a.value, onChange = _a.onChange;
23
+ var theme = (0, useCustomTheme_1.useCustomTheme)();
24
+ var styles = {
25
+ container: {
26
+ display: "flex",
27
+ alignItems: "center",
28
+ bg: theme.colors.background[600],
29
+ p: "0.125rem",
30
+ borderRadius: "0.375rem",
31
+ height: "2rem",
32
+ gap: "0.125rem",
33
+ width: "6.3rem",
34
+ },
35
+ button: function (mode) { return ({
36
+ bg: value === mode ? theme.colors.background[50] : "transparent",
37
+ boxShadow: value === mode ? "md" : "none",
38
+ color: value === mode ? theme.colors.black : theme.colors.background[800],
39
+ borderRadius: "0.313rem",
40
+ height: "1.75rem",
41
+ border: "0.031rem solid",
42
+ borderColor: value === mode ? theme.colors.background[400] : "transparent",
43
+ padding: "0.313rem 0.813rem",
44
+ _hover: {
45
+ bg: value === mode
46
+ ? theme.colors.background[50]
47
+ : theme.colors.background[400],
48
+ color: value === mode ? theme.colors.black : theme.colors.background[900],
49
+ },
50
+ transition: "all 0.3s ease-in-out",
51
+ }); },
52
+ };
53
+ return (react_1.default.createElement(react_2.Box, __assign({}, styles.container),
54
+ react_1.default.createElement(react_2.IconButton, __assign({ "aria-label": "Grid View", icon: react_1.default.createElement(lucide_react_1.Table2, { size: "1.25rem" }), variant: "ghost", onClick: function () { return onChange("grid"); } }, styles.button("grid"))),
55
+ react_1.default.createElement(react_2.IconButton, __assign({ "aria-label": "List View", icon: react_1.default.createElement(lucide_react_1.Columns3, { size: "1.25rem" }), variant: "ghost", onClick: function () { return onChange("list"); } }, styles.button("list")))));
56
+ };
57
+ exports.default = TableToggle;
@@ -0,0 +1,5 @@
1
+ export type ViewMode = "grid" | "list";
2
+ export type ViewToggleProps = {
3
+ value: ViewMode;
4
+ onChange: (val: ViewMode) => void;
5
+ };
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.FlexCss = void 0;
4
4
  exports.FlexCss = {
5
5
  "&::-webkit-scrollbar": {
6
- width: "3px",
6
+ width: "0.188rem",
7
7
  },
8
8
  "&::-webkit-scrollbar-track": {
9
9
  background: "transparent",
@@ -13,6 +13,29 @@ exports.FlexCss = {
13
13
  transition: "background 0.5s",
14
14
  },
15
15
  "&:hover::-webkit-scrollbar-thumb": {
16
- background: "#888",
16
+ background: "#9A4FE5",
17
17
  },
18
18
  };
19
+ var cssForScrollBar = function (theme) { return ({
20
+ "&::-webkit-scrollbar": {
21
+ width: "0.125rem",
22
+ },
23
+ "&::-webkit-scrollbar-track": {
24
+ background: theme.colors.sidebar.background[500],
25
+ },
26
+ "&::-webkit-scrollbar-thumb": {
27
+ background: "transparent",
28
+ borderRadius: "0.5rem",
29
+ },
30
+ "&:hover::-webkit-scrollbar-thumb": {
31
+ background: theme.colors.primary[500],
32
+ },
33
+ "&:hover::-webkit-scrollbar-thumb:hover": {
34
+ background: theme.colors.primary[700],
35
+ },
36
+ scrollbarWidth: "none",
37
+ "&:hover": {
38
+ scrollbarWidth: "thin",
39
+ scrollbarColor: "".concat(theme.colors.primary[500], " ").concat(theme.colors.sidebar.background[500]),
40
+ },
41
+ }); };