pixelize-design-library 2.2.199 → 2.3.1-beta.10

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 (163) hide show
  1. package/.claude/settings.local.json +44 -0
  2. package/coverage/clover.xml +638 -0
  3. package/coverage/coverage-final.json +20 -0
  4. package/coverage/lcov-report/Table/CompactSelect.tsx.html +379 -0
  5. package/coverage/lcov-report/Table/Components/ActiveFilters.tsx.html +514 -0
  6. package/coverage/lcov-report/Table/Components/HeaderActions.tsx.html +373 -0
  7. package/coverage/lcov-report/Table/Components/Pagination.tsx.html +574 -0
  8. package/coverage/lcov-report/Table/Components/TableActions.tsx.html +574 -0
  9. package/coverage/lcov-report/Table/Components/TableBody.tsx.html +1027 -0
  10. package/coverage/lcov-report/Table/Components/TableFilters.tsx.html +397 -0
  11. package/coverage/lcov-report/Table/Components/TableHeader.tsx.html +1060 -0
  12. package/coverage/lcov-report/Table/Components/TableLoading.tsx.html +361 -0
  13. package/coverage/lcov-report/Table/Components/TableSearch.tsx.html +337 -0
  14. package/coverage/lcov-report/Table/Components/index.html +266 -0
  15. package/coverage/lcov-report/Table/Components/useDebounce.ts.html +178 -0
  16. package/coverage/lcov-report/Table/Components/useTable.ts.html +778 -0
  17. package/coverage/lcov-report/Table/LeftFilterPane.tsx.html +1810 -0
  18. package/coverage/lcov-report/Table/SelectOperationControls.tsx.html +178 -0
  19. package/coverage/lcov-report/Table/Table.tsx.html +1567 -0
  20. package/coverage/lcov-report/Table/TableProps.tsx.html +658 -0
  21. package/coverage/lcov-report/Table/TableSettings/ManageColumns.tsx.html +619 -0
  22. package/coverage/lcov-report/Table/TableSettings/TableFilters.tsx.html +229 -0
  23. package/coverage/lcov-report/Table/TableSettings/TableSettings.tsx.html +532 -0
  24. package/coverage/lcov-report/Table/TableSettings/index.html +146 -0
  25. package/coverage/lcov-report/Table/TableToDo.tsx.html +973 -0
  26. package/coverage/lcov-report/Table/TextOperationControls.tsx.html +271 -0
  27. package/coverage/lcov-report/Table/filterTypes.ts.html +97 -0
  28. package/coverage/lcov-report/Table/index.html +176 -0
  29. package/coverage/lcov-report/base.css +224 -0
  30. package/coverage/lcov-report/block-navigation.js +87 -0
  31. package/coverage/lcov-report/favicon.png +0 -0
  32. package/coverage/lcov-report/index.html +146 -0
  33. package/coverage/lcov-report/prettify.css +1 -0
  34. package/coverage/lcov-report/prettify.js +2 -0
  35. package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
  36. package/coverage/lcov-report/sorter.js +210 -0
  37. package/coverage/lcov.info +1836 -0
  38. package/dist/Assets/defaultLogo.tsx +31 -0
  39. package/dist/Components/Accordion/Accordion.js +26 -5
  40. package/dist/Components/Button/Button.styles.js +44 -3
  41. package/dist/Components/Button/ButtonProps.d.ts +1 -1
  42. package/dist/Components/ButtonGroupIcon/ButtonGoupIconProps.d.ts +2 -2
  43. package/dist/Components/ButtonGroupIcon/ButtonGroupIcon.js +50 -38
  44. package/dist/Components/Card/PaymentCard/PaymentCard.d.ts +1 -1
  45. package/dist/Components/Card/PaymentCard/PaymentCard.js +3 -3
  46. package/dist/Components/Card/PaymentCard/PaymentCardProps.d.ts +0 -1
  47. package/dist/Components/Checkbox/Checkbox.js +2 -2
  48. package/dist/Components/Checkbox/Checkbox.styles.js +2 -0
  49. package/dist/Components/Common/FormLabel.d.ts +2 -1
  50. package/dist/Components/Common/FormLabel.js +8 -9
  51. package/dist/Components/Common/fieldStyles.d.ts +22 -0
  52. package/dist/Components/Common/fieldStyles.js +42 -0
  53. package/dist/Components/DatePicker/CalendarPanel.d.ts +2 -0
  54. package/dist/Components/DatePicker/CalendarPanel.js +104 -65
  55. package/dist/Components/DatePicker/RangeDatePicker.js +37 -16
  56. package/dist/Components/DatePicker/SingleDatePicker.js +16 -16
  57. package/dist/Components/DatePicker/TimePicker.js +4 -4
  58. package/dist/Components/Input/Input/Input.d.ts +1 -1
  59. package/dist/Components/Input/Input/Input.js +5 -4
  60. package/dist/Components/Input/Input/InputProps.d.ts +2 -0
  61. package/dist/Components/Input/TextInput.styles.js +2 -1
  62. package/dist/Components/InputTextArea/InputTextArea.style.js +2 -1
  63. package/dist/Components/KanbanBoard/AccountCard.js +17 -14
  64. package/dist/Components/KanbanBoard/KanbanBoard.js +93 -78
  65. package/dist/Components/MultiSelect/MultiSelect.js +11 -12
  66. package/dist/Components/NavigationBar/NavigationBar.d.ts +1 -1
  67. package/dist/Components/NavigationBar/NavigationBar.js +57 -30
  68. package/dist/Components/NavigationBar/NavigationBarProps.d.ts +1 -0
  69. package/dist/Components/NoteTextArea/NoteTextArea.js +44 -40
  70. package/dist/Components/NumberInput/NumberInput.styles.js +2 -1
  71. package/dist/Components/PinInput/PinInput.d.ts +1 -1
  72. package/dist/Components/PinInput/PinInput.js +3 -2
  73. package/dist/Components/PinInput/PinInputProps.d.ts +4 -0
  74. package/dist/Components/ProfilePhotoViewer/ProfilePhotoViewer.d.ts +1 -1
  75. package/dist/Components/ProfilePhotoViewer/ProfilePhotoViewer.js +42 -24
  76. package/dist/Components/ProfilePhotoViewer/ProfilePhotoViewerProps.d.ts +2 -0
  77. package/dist/Components/RadioButton/RadioButton.js +1 -1
  78. package/dist/Components/SearchSelect/SearchSelect.d.ts +1 -1
  79. package/dist/Components/SearchSelect/SearchSelect.js +56 -24
  80. package/dist/Components/SearchSelect/SearchSelectProps.d.ts +2 -0
  81. package/dist/Components/Select/Select.styles.js +2 -1
  82. package/dist/Components/SelectSearch/SelectSearch.js +7 -4
  83. package/dist/Components/SideBar/SecondaryBar.js +20 -18
  84. package/dist/Components/SideBar/SideBar.d.ts +1 -1
  85. package/dist/Components/SideBar/SideBar.js +58 -43
  86. package/dist/Components/SideBar/SideBarProps.d.ts +14 -3
  87. package/dist/Components/SideBar/components/MenuItemBox.js +28 -24
  88. package/dist/Components/SideBar/components/MenuItems.js +16 -2
  89. package/dist/Components/SideBar/components/MenuPopoverContent.js +16 -16
  90. package/dist/Components/SideBar/components/OtherApps.js +16 -14
  91. package/dist/Components/Table/Table.d.ts +1 -1
  92. package/dist/Components/Table/Table.js +234 -38
  93. package/dist/Components/Table/TableProps.d.ts +42 -2
  94. package/dist/Components/Table/{Components → components}/TableActions.d.ts +2 -2
  95. package/dist/Components/Table/{Components → components}/TableActions.js +5 -4
  96. package/dist/Components/Table/{Components → components}/TableBody.d.ts +5 -1
  97. package/dist/Components/Table/components/TableBody.js +369 -0
  98. package/dist/Components/Table/components/TableGroupRow.d.ts +15 -0
  99. package/dist/Components/Table/components/TableGroupRow.js +27 -0
  100. package/dist/Components/Table/{Components → components}/TableHeader.js +18 -8
  101. package/dist/Components/Table/{LeftFilterPane.js → filters/LeftFilterPane.js} +3 -3
  102. package/dist/Components/Table/{Components → hooks}/useTable.d.ts +1 -1
  103. package/dist/Components/Table/{Components → hooks}/useTable.js +8 -7
  104. package/dist/Components/Table/settings/TableSettings.d.ts +11 -0
  105. package/dist/Components/Table/settings/TableSettings.js +165 -0
  106. package/dist/Components/Timeline/Timeline.d.ts +1 -1
  107. package/dist/Components/Timeline/Timeline.js +145 -78
  108. package/dist/Components/Toaster/Toaster.js +40 -20
  109. package/dist/Theme/Default/palette.d.ts +4 -0
  110. package/dist/Theme/Default/palette.js +3 -0
  111. package/dist/Theme/Emerald/palette.d.ts +4 -0
  112. package/dist/Theme/Emerald/palette.js +2 -1
  113. package/dist/Theme/Meadow/palette.d.ts +4 -0
  114. package/dist/Theme/Meadow/palette.js +2 -1
  115. package/dist/Theme/Radiant/palette.d.ts +4 -0
  116. package/dist/Theme/Radiant/palette.js +2 -1
  117. package/dist/Theme/Rosewood/palette.d.ts +4 -0
  118. package/dist/Theme/Rosewood/palette.js +2 -1
  119. package/dist/Theme/Skyline/palette.d.ts +4 -0
  120. package/dist/Theme/Skyline/palette.js +2 -1
  121. package/dist/Theme/Slate/palette.d.ts +4 -0
  122. package/dist/Theme/Slate/palette.js +2 -1
  123. package/dist/Theme/themeProps.d.ts +4 -0
  124. package/dist/Utils/table.d.ts +26 -0
  125. package/dist/Utils/table.js +142 -38
  126. package/package.json +2 -2
  127. package/dist/Components/Table/Components/TableBody.js +0 -201
  128. package/dist/Components/Table/TableSettings/TableFilters.d.ts +0 -10
  129. package/dist/Components/Table/TableSettings/TableFilters.js +0 -69
  130. package/dist/Components/Table/TableSettings/TableFilters.test.d.ts +0 -1
  131. package/dist/Components/Table/TableSettings/TableFilters.test.js +0 -109
  132. package/dist/Components/Table/TableSettings/TableSettings.d.ts +0 -8
  133. package/dist/Components/Table/TableSettings/TableSettings.js +0 -141
  134. package/dist/Components/Table/TableToDo.d.ts +0 -2
  135. package/dist/Components/Table/TableToDo.js +0 -291
  136. /package/dist/Components/Table/{Components → components}/HeaderActions.d.ts +0 -0
  137. /package/dist/Components/Table/{Components → components}/HeaderActions.js +0 -0
  138. /package/dist/Components/Table/{Components → components}/Pagination.d.ts +0 -0
  139. /package/dist/Components/Table/{Components → components}/Pagination.js +0 -0
  140. /package/dist/Components/Table/{Components → components}/TableBody.virtualize.test.d.ts +0 -0
  141. /package/dist/Components/Table/{Components → components}/TableBody.virtualize.test.js +0 -0
  142. /package/dist/Components/Table/{Components → components}/TableHeader.d.ts +0 -0
  143. /package/dist/Components/Table/{Components → components}/TableLoading.d.ts +0 -0
  144. /package/dist/Components/Table/{Components → components}/TableLoading.js +0 -0
  145. /package/dist/Components/Table/{Components → components}/TableSearch.d.ts +0 -0
  146. /package/dist/Components/Table/{Components → components}/TableSearch.js +0 -0
  147. /package/dist/Components/Table/{Components → filters}/ActiveFilters.d.ts +0 -0
  148. /package/dist/Components/Table/{Components → filters}/ActiveFilters.js +0 -0
  149. /package/dist/Components/Table/{CompactSelect.d.ts → filters/CompactSelect.d.ts} +0 -0
  150. /package/dist/Components/Table/{CompactSelect.js → filters/CompactSelect.js} +0 -0
  151. /package/dist/Components/Table/{LeftFilterPane.d.ts → filters/LeftFilterPane.d.ts} +0 -0
  152. /package/dist/Components/Table/{SelectOperationControls.d.ts → filters/SelectOperationControls.d.ts} +0 -0
  153. /package/dist/Components/Table/{SelectOperationControls.js → filters/SelectOperationControls.js} +0 -0
  154. /package/dist/Components/Table/{Components → filters}/TableFilters.d.ts +0 -0
  155. /package/dist/Components/Table/{Components → filters}/TableFilters.js +0 -0
  156. /package/dist/Components/Table/{TextOperationControls.d.ts → filters/TextOperationControls.d.ts} +0 -0
  157. /package/dist/Components/Table/{TextOperationControls.js → filters/TextOperationControls.js} +0 -0
  158. /package/dist/Components/Table/{Components → hooks}/useDebounce.d.ts +0 -0
  159. /package/dist/Components/Table/{Components → hooks}/useDebounce.js +0 -0
  160. /package/dist/Components/Table/{TableSettings → settings}/ManageColumns.d.ts +0 -0
  161. /package/dist/Components/Table/{TableSettings → settings}/ManageColumns.js +0 -0
  162. /package/dist/Components/Table/{TableSettings → settings}/ManageColumns.test.d.ts +0 -0
  163. /package/dist/Components/Table/{TableSettings → settings}/ManageColumns.test.js +0 -0
@@ -0,0 +1,369 @@
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 () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ var __importDefault = (this && this.__importDefault) || function (mod) {
36
+ return (mod && mod.__esModule) ? mod : { "default": mod };
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.DENSITY_CONFIG = void 0;
40
+ var react_1 = require("@chakra-ui/react");
41
+ var react_2 = __importStar(require("react"));
42
+ var table_1 = require("../../../Utils/table");
43
+ var useCustomTheme_1 = require("../../../Theme/useCustomTheme");
44
+ var TableLoading_1 = require("./TableLoading");
45
+ var TableActions_1 = __importDefault(require("./TableActions"));
46
+ var lucide_react_1 = require("lucide-react");
47
+ var Checkbox_1 = __importDefault(require("../../Checkbox/Checkbox"));
48
+ var TableGroupRow_1 = __importDefault(require("./TableGroupRow"));
49
+ // Density → row height (px) + cell vertical padding. The padding (not just the
50
+ // min-height) is what drives perceived row size, so compact tightens both.
51
+ exports.DENSITY_CONFIG = {
52
+ compact: { height: 32, py: "0.125rem" },
53
+ normal: { height: 40, py: "0.5rem" },
54
+ comfortable: { height: 52, py: "0.875rem" },
55
+ };
56
+ // Monday-style status cell: the whole cell is filled with the status color and
57
+ // the label is centered in white.
58
+ var StatusCell = function (_a) {
59
+ var value = _a.value;
60
+ return (react_2.default.createElement(react_1.Box, { display: "flex", alignItems: "center", justifyContent: "center", w: "100%", h: "100%", px: "0.5rem", fontSize: "0.75rem", fontWeight: 600, color: "white", textAlign: "center", whiteSpace: "nowrap", overflow: "hidden", textOverflow: "ellipsis" }, value));
61
+ };
62
+ var EMPTY_SX = {};
63
+ var EMPTY_HOVER = {};
64
+ var TableRow = react_2.default.memo(function (_a) {
65
+ var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
66
+ var row = _a.row, rowIndex = _a.rowIndex, index = _a.index, isChecked = _a.isChecked, isExpanded = _a.isExpanded, isContent = _a.isContent, isLink = _a.isLink, isCheckbox = _a.isCheckbox, isLoading = _a.isLoading, isActionFreeze = _a.isActionFreeze, columns = _a.columns, leftOffsets = _a.leftOffsets, noBorders = _a.noBorders, freezedBgColor = _a.freezedBgColor, freezedTextColor = _a.freezedTextColor, theme = _a.theme, borderStyle = _a.borderStyle, hoverStyle = _a.hoverStyle, rowHeight = _a.rowHeight, cellPy = _a.cellPy, palette = _a.palette, accentColor = _a.accentColor, handleCheckbox = _a.handleCheckbox, onRowClick = _a.onRowClick, toggleRowExpansion = _a.toggleRowExpansion, onMeasure = _a.onMeasure;
67
+ var checkedSx = (0, react_2.useMemo)(function () {
68
+ var _a, _b, _c;
69
+ return isChecked ? {
70
+ "& td": { backgroundColor: (_c = (_b = (_a = theme.colors.primary) === null || _a === void 0 ? void 0 : _a.opacity) === null || _b === void 0 ? void 0 : _b[16]) !== null && _c !== void 0 ? _c : theme.colors.disabled[100] },
71
+ } : EMPTY_SX;
72
+ }, [isChecked, (_b = theme.colors.primary) === null || _b === void 0 ? void 0 : _b.opacity, theme.colors.disabled]);
73
+ // Measured-height virtualization: report this row's real height (main + any
74
+ // expanded panel) so the windower can place variable/expandable rows exactly.
75
+ var mainRowRef = (0, react_2.useRef)(null);
76
+ var expandedRowRef = (0, react_2.useRef)(null);
77
+ var hasContent = !!row.content;
78
+ (0, react_2.useLayoutEffect)(function () {
79
+ if (!onMeasure)
80
+ return;
81
+ var measure = function () {
82
+ var _a, _b, _c, _d;
83
+ var main = (_b = (_a = mainRowRef.current) === null || _a === void 0 ? void 0 : _a.offsetHeight) !== null && _b !== void 0 ? _b : 0;
84
+ var exp = isExpanded && hasContent ? (_d = (_c = expandedRowRef.current) === null || _c === void 0 ? void 0 : _c.offsetHeight) !== null && _d !== void 0 ? _d : 0 : 0;
85
+ var h = main + exp;
86
+ if (h > 0)
87
+ onMeasure(row.id, h);
88
+ };
89
+ measure();
90
+ var raf = requestAnimationFrame(measure);
91
+ var ro;
92
+ if (typeof ResizeObserver !== "undefined") {
93
+ ro = new ResizeObserver(measure);
94
+ if (mainRowRef.current)
95
+ ro.observe(mainRowRef.current);
96
+ if (expandedRowRef.current)
97
+ ro.observe(expandedRowRef.current);
98
+ }
99
+ return function () {
100
+ cancelAnimationFrame(raf);
101
+ ro === null || ro === void 0 ? void 0 : ro.disconnect();
102
+ };
103
+ }, [onMeasure, isExpanded, hasContent, row.id]);
104
+ var handleCellClick = (0, react_2.useCallback)(function (header) {
105
+ if (!header.node && onRowClick) {
106
+ onRowClick(row, { label: header.label, id: header.id });
107
+ }
108
+ }, [row, onRowClick]);
109
+ var firstDataColIndex = columns.findIndex(function (c) { return !c.isHidden; });
110
+ var accentSx = accentColor ? "inset 3px 0 0 ".concat(accentColor) : undefined;
111
+ return (react_2.default.createElement(react_2.default.Fragment, null,
112
+ react_2.default.createElement(react_1.Tr, { ref: mainRowRef, opacity: isLoading ? 0.4 : 1, pointerEvents: isLoading ? "none" : "auto", transition: "opacity 0.2s", sx: checkedSx },
113
+ isContent && (react_2.default.createElement(react_1.Td, { w: "6", p: 0, fontSize: 14, backgroundColor: (_d = (_c = theme.colors) === null || _c === void 0 ? void 0 : _c.background) === null || _d === void 0 ? void 0 : _d[50], color: freezedTextColor, position: "sticky", borderBottom: borderStyle, boxShadow: accentSx, boxSizing: "border-box", left: 0, zIndex: 1, className: "columns sticky-columns" }, !!(row === null || row === void 0 ? void 0 : row.content) && (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" })))),
114
+ isCheckbox && (react_2.default.createElement(react_1.Td, { w: "6", fontSize: 14, fontWeight: 600, color: (_g = (_f = theme.colors) === null || _f === void 0 ? void 0 : _f.background) === null || _g === void 0 ? void 0 : _g[50], textTransform: "capitalize", backgroundColor: (_j = (_h = theme.colors) === null || _h === void 0 ? void 0 : _h.background) === null || _j === void 0 ? void 0 : _j[50], position: "sticky", borderBottom: borderStyle, boxShadow: !isContent ? accentSx : undefined, boxSizing: "border-box", left: 0, zIndex: 1, className: "columns sticky-columns" },
115
+ react_2.default.createElement(Checkbox_1.default, { "aria-label": "Select all rows", onChange: function () { return handleCheckbox(row.id); }, isChecked: isChecked }))),
116
+ columns.map(function (header, headerIndex) {
117
+ var _a, _b, _c, _d, _e, _f, _g;
118
+ if (header.isHidden)
119
+ return null;
120
+ var isFrozen = header.isFreeze;
121
+ var isFirstDataCell = !isContent && !isCheckbox && headerIndex === firstDataColIndex;
122
+ var isStatus = header.type === "status" && !header.node;
123
+ var rawStatus = String((_a = row[header.id]) !== null && _a !== void 0 ? _a : "");
124
+ var statusColor = isStatus
125
+ ? (0, table_1.pickTableColor)(rawStatus, palette, (_b = header.statusColors) === null || _b === void 0 ? void 0 : _b[rawStatus])
126
+ : null;
127
+ return (react_2.default.createElement(react_1.Td, { maxWidth: 500, minWidth: 120, height: "".concat(rowHeight, "px"), py: isStatus && statusColor ? 0 : cellPy, px: isStatus && statusColor ? 0 : undefined, key: headerIndex + 1, onClick: function () { return handleCellClick(header); }, fontSize: 14, fontWeight: 400, position: isFrozen ? "sticky" : undefined, left: isFrozen ? leftOffsets[headerIndex] : undefined, zIndex: isFrozen ? 1 : 0, backgroundColor: isStatus && statusColor ? statusColor.solid : (_c = theme.colors.background) === null || _c === void 0 ? void 0 : _c[50], textOverflow: "ellipsis", boxShadow: isFirstDataCell ? accentSx : undefined, borderBottom: noBorders
128
+ ? "none"
129
+ : "0.063rem solid ".concat((_d = theme.colors) === null || _d === void 0 ? void 0 : _d.gray[isFrozen || isChecked ? 300 : 200]), className: "columns ".concat(isFrozen ? "sticky-columns" : "scrollable-columns"), boxSizing: "border-box", color: isStatus && statusColor ? "white" : (_f = (_e = theme.colors) === null || _e === void 0 ? void 0 : _e.text) === null || _f === void 0 ? void 0 : _f[500], _hover: isStatus && statusColor
130
+ ? EMPTY_HOVER
131
+ : ((_g = row.cellStyle) === null || _g === void 0 ? void 0 : _g[header.id]) || row.rowStyle
132
+ ? EMPTY_HOVER
133
+ : hoverStyle }, isStatus && statusColor ? (react_2.default.createElement(StatusCell, { value: (0, table_1.normalizeTableCellValue)(row[header.id]) })) : (react_2.default.createElement(react_1.Box, { display: "block", overflow: "hidden", whiteSpace: "normal", overflowWrap: "break-word" }, (0, table_1.normalizeTableCellValue)(header.node ? header.node(row) : row[header.id])))));
134
+ }),
135
+ isLink && (react_2.default.createElement(react_1.Td, { w: 2, p: 0, fontSize: 14, backgroundColor: (_l = (_k = theme === null || theme === void 0 ? void 0 : theme.colors) === null || _k === void 0 ? void 0 : _k.background) === null || _l === void 0 ? void 0 : _l[50], color: freezedTextColor, position: isActionFreeze ? "sticky" : "relative", borderBottom: borderStyle, 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 }))))),
136
+ row.content && isExpanded && (react_2.default.createElement(react_1.Tr, { ref: expandedRowRef },
137
+ react_2.default.createElement(react_1.Td, { colSpan: columns.length +
138
+ (isCheckbox ? 1 : 0) +
139
+ (isContent ? 1 : 0) +
140
+ (isLink ? 1 : 0), p: 2 },
141
+ react_2.default.createElement(react_1.Box, { p: 2, bg: theme.colors.white, borderRadius: "md" }, row === null || row === void 0 ? void 0 : row.content(row)))))));
142
+ });
143
+ var TableBody = function (_a) {
144
+ var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
145
+ 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, loadingSkeletonRows = _a.loadingSkeletonRows, scrollContainerRef = _a.scrollContainerRef, density = _a.density, accentColors = _a.accentColors, groups = _a.groups, onAddItem = _a.onAddItem, emptyState = _a.emptyState;
146
+ var theme = (0, useCustomTheme_1.useCustomTheme)();
147
+ var _u = (0, react_2.useState)(new Set()), expandedRows = _u[0], setExpandedRows = _u[1];
148
+ var _v = (0, react_2.useState)(new Set()), collapsedGroups = _v[0], setCollapsedGroups = _v[1];
149
+ var toggleGroup = (0, react_2.useCallback)(function (value) {
150
+ setCollapsedGroups(function (prev) {
151
+ var next = new Set(prev);
152
+ next.has(value) ? next.delete(value) : next.add(value);
153
+ return next;
154
+ });
155
+ }, []);
156
+ var selectionsSet = (0, react_2.useMemo)(function () { return new Set(selections); }, [selections]);
157
+ var palette = (0, react_2.useMemo)(function () { return (0, table_1.buildTablePalette)(theme); }, [theme]);
158
+ var densityConfig = (_b = exports.DENSITY_CONFIG[density !== null && density !== void 0 ? density : "normal"]) !== null && _b !== void 0 ? _b : exports.DENSITY_CONFIG.normal;
159
+ var rowHeight = densityConfig.height;
160
+ var cellPy = densityConfig.py;
161
+ // --- Row virtualization ---------------------------------------------------
162
+ // Rows are a fixed 45px tall (see the `height={45}` on every <Td/> below),
163
+ // and the scroll viewport is capped at ~500px, so only ~11 rows are ever
164
+ // visible. Mounting all 50/100 page rows is what makes paging freeze. We
165
+ // render only the rows inside the viewport (+ overscan) and reserve the
166
+ // remaining height with empty spacer rows. Spacer rows (rather than CSS
167
+ // transforms) keep the table in normal flow so the sticky header and
168
+ // `position: sticky` frozen columns keep working.
169
+ // Expandable `content` rows are supported via measured heights (see
170
+ // `measuredHeights` / `onMeasure` below) — each rendered row reports its real
171
+ // height, so the window places variable/expanded rows exactly.
172
+ var ROW_HEIGHT = rowHeight;
173
+ var GROUP_HEADER_H = 42;
174
+ var OVERSCAN = 6;
175
+ var VIRTUALIZE_THRESHOLD = 30;
176
+ var ESTIMATED_EXPAND = 120; // assumed extra height for an expanded-but-not-yet-measured row
177
+ var shouldVirtualize = data.length > VIRTUALIZE_THRESHOLD;
178
+ // Grouped mode has no pager, so it virtualizes too (when no expandable rows):
179
+ // group headers + rows form one flat sequence that we window over.
180
+ var groupRowCount = groups ? groups.reduce(function (n, g) { return n + g.rows.length; }, 0) : 0;
181
+ var groupVirtualize = !!groups && !isContent && groupRowCount > VIRTUALIZE_THRESHOLD;
182
+ var _w = (0, react_2.useState)(0), scrollTop = _w[0], setScrollTop = _w[1];
183
+ var _x = (0, react_2.useState)(0), viewportH = _x[0], setViewportH = _x[1];
184
+ // Measured row heights keyed by row id (stable across scroll/paging).
185
+ var _y = (0, react_2.useState)(new Map()), measuredHeights = _y[0], setMeasuredHeights = _y[1];
186
+ var reportHeight = (0, react_2.useCallback)(function (id, h) {
187
+ setMeasuredHeights(function (prev) {
188
+ if (prev.get(id) === h)
189
+ return prev;
190
+ var next = new Map(prev);
191
+ next.set(id, h);
192
+ return next;
193
+ });
194
+ }, []);
195
+ (0, react_2.useEffect)(function () {
196
+ var el = scrollContainerRef === null || scrollContainerRef === void 0 ? void 0 : scrollContainerRef.current;
197
+ if (!el || !(shouldVirtualize || groupVirtualize))
198
+ return;
199
+ var onScroll = function () { return setScrollTop(el.scrollTop); };
200
+ var measure = function () { return setViewportH(el.clientHeight); };
201
+ measure();
202
+ setScrollTop(el.scrollTop);
203
+ el.addEventListener("scroll", onScroll, { passive: true });
204
+ window.addEventListener("resize", measure);
205
+ return function () {
206
+ el.removeEventListener("scroll", onScroll);
207
+ window.removeEventListener("resize", measure);
208
+ };
209
+ }, [scrollContainerRef, shouldVirtualize, groupVirtualize, data.length, groupRowCount]);
210
+ // New page: jump back to the top so the window recomputes from row 0.
211
+ (0, react_2.useEffect)(function () {
212
+ if (!shouldVirtualize)
213
+ return;
214
+ var el = scrollContainerRef === null || scrollContainerRef === void 0 ? void 0 : scrollContainerRef.current;
215
+ if (el)
216
+ el.scrollTop = 0;
217
+ setScrollTop(0);
218
+ }, [startRow, shouldVirtualize, scrollContainerRef]);
219
+ var total = data.length;
220
+ var firstIndex = 0;
221
+ var lastIndex = total;
222
+ var topPad = 0;
223
+ var bottomPad = 0;
224
+ if (shouldVirtualize) {
225
+ var vh = viewportH || 500;
226
+ // Prefix-sum offsets using measured heights (exact for rendered rows) and
227
+ // estimates for not-yet-measured rows (ROW_HEIGHT, + ESTIMATED_EXPAND if expanded).
228
+ var offsets = new Array(total + 1);
229
+ offsets[0] = 0;
230
+ for (var i = 0; i < total; i++) {
231
+ var id = data[i].id;
232
+ var measured = measuredHeights.get(id);
233
+ var h = measured != null
234
+ ? measured
235
+ : ROW_HEIGHT + (expandedRows.has(startRow + i) ? ESTIMATED_EXPAND : 0);
236
+ offsets[i + 1] = offsets[i] + h;
237
+ }
238
+ var totalH = offsets[total];
239
+ var top_1 = scrollTop - OVERSCAN * ROW_HEIGHT;
240
+ var bottom = scrollTop + vh + OVERSCAN * ROW_HEIGHT;
241
+ firstIndex = 0;
242
+ while (firstIndex < total && offsets[firstIndex + 1] <= top_1)
243
+ firstIndex++;
244
+ lastIndex = firstIndex;
245
+ while (lastIndex < total && offsets[lastIndex] < bottom)
246
+ lastIndex++;
247
+ if (lastIndex < firstIndex)
248
+ lastIndex = firstIndex;
249
+ topPad = offsets[firstIndex];
250
+ bottomPad = totalH - offsets[lastIndex];
251
+ }
252
+ var visibleRows = shouldVirtualize ? data.slice(firstIndex, lastIndex) : data;
253
+ var toggleRowExpansion = (0, react_2.useCallback)(function (rowIndex) {
254
+ setExpandedRows(function (prev) {
255
+ var newSet = new Set(prev);
256
+ if (newSet.has(rowIndex)) {
257
+ newSet.delete(rowIndex);
258
+ }
259
+ else {
260
+ newSet.add(rowIndex);
261
+ }
262
+ return newSet;
263
+ });
264
+ }, []);
265
+ var totalVisibleColumns = (0, react_2.useMemo)(function () {
266
+ return columns.filter(function (o) { return !o.isHidden; }).length +
267
+ (isCheckbox ? 1 : 0) +
268
+ (isContent ? 1 : 0) +
269
+ (isLink ? 1 : 0);
270
+ }, [columns, isCheckbox, isContent, isLink]);
271
+ var leftOffsets = (0, react_2.useMemo)(function () {
272
+ var checkboxOffset = isCheckbox ? 50 : 0;
273
+ return columnWidths.map(function (_, idx) {
274
+ return columnWidths.slice(0, idx).reduce(function (sum, w) { return sum + w; }, 0) + checkboxOffset;
275
+ });
276
+ }, [columnWidths, isCheckbox]);
277
+ var borderStyle = (0, react_2.useMemo)(function () { var _a; return noBorders ? "none" : "0.063rem solid ".concat((_a = theme.colors) === null || _a === void 0 ? void 0 : _a.border[500]); }, [noBorders, (_c = theme.colors) === null || _c === void 0 ? void 0 : _c.border]);
278
+ var hoverStyle = (0, react_2.useMemo)(function () {
279
+ var _a, _b, _c, _d, _e;
280
+ return ({
281
+ backgroundColor: (_c = (_b = (_a = theme.colors.table) === null || _a === void 0 ? void 0 : _a.hover) === null || _b === void 0 ? void 0 : _b[300]) !== null && _c !== void 0 ? _c : (_e = (_d = theme.colors.secondary) === null || _d === void 0 ? void 0 : _d.opacity) === null || _e === void 0 ? void 0 : _e[4],
282
+ });
283
+ }, [(_d = theme.colors.table) === null || _d === void 0 ? void 0 : _d.hover, (_e = theme.colors.secondary) === null || _e === void 0 ? void 0 : _e.opacity]);
284
+ if (isLoading && data.length === 0) {
285
+ return (react_2.default.createElement(TableLoading_1.TableBodyLoading, { noOfColumns: totalVisibleColumns, borderColor: theme.colors.gray[300], rowsCount: typeof loadingSkeletonRows === "number" ? loadingSkeletonRows : 4 }));
286
+ }
287
+ if (!isLoading && data.length === 0) {
288
+ var isStructured = emptyState && typeof emptyState === "object" && !react_2.default.isValidElement(emptyState);
289
+ var es = isStructured ? emptyState : null;
290
+ return (react_2.default.createElement(react_1.Tr, { backgroundColor: (_f = theme.colors.background) === null || _f === void 0 ? void 0 : _f[50] },
291
+ react_2.default.createElement(react_1.Td, { colSpan: totalVisibleColumns, textAlign: "center", py: 10, border: "none" }, emptyState && !isStructured ? emptyState : (react_2.default.createElement(react_1.Box, { display: "flex", flexDirection: "column", alignItems: "center", gap: 2, color: (_h = (_g = theme.colors) === null || _g === void 0 ? void 0 : _g.gray) === null || _h === void 0 ? void 0 : _h[500] },
292
+ (es === null || es === void 0 ? void 0 : es.icon) && react_2.default.createElement(react_1.Box, { fontSize: "1.75rem", color: (_k = (_j = theme.colors) === null || _j === void 0 ? void 0 : _j.gray) === null || _k === void 0 ? void 0 : _k[400] }, es.icon),
293
+ react_2.default.createElement(react_1.Box, { fontSize: "0.95rem", fontWeight: 600, color: (_m = (_l = theme.colors) === null || _l === void 0 ? void 0 : _l.text) === null || _m === void 0 ? void 0 : _m[700] }, (_o = es === null || es === void 0 ? void 0 : es.title) !== null && _o !== void 0 ? _o : "No data found"),
294
+ (es === null || es === void 0 ? void 0 : es.description) && (react_2.default.createElement(react_1.Box, { fontSize: "0.8125rem", color: (_q = (_p = theme.colors) === null || _p === void 0 ? void 0 : _p.gray) === null || _q === void 0 ? void 0 : _q[500] }, es.description)))))));
295
+ }
296
+ // --- Monday-style grouped board render (virtualized when large) -----------
297
+ if (groups) {
298
+ // Flatten groups → one sequence of header/row items so it can be windowed.
299
+ var items = [];
300
+ for (var _i = 0, groups_1 = groups; _i < groups_1.length; _i++) {
301
+ var g = groups_1[_i];
302
+ items.push({ kind: "header", g: g });
303
+ if (!collapsedGroups.has(g.value)) {
304
+ for (var _z = 0, _0 = g.rows; _z < _0.length; _z++) {
305
+ var row = _0[_z];
306
+ items.push({ kind: "row", g: g, row: row });
307
+ }
308
+ }
309
+ }
310
+ var firstI_1 = 0;
311
+ var lastI = items.length;
312
+ var gTopPad = 0;
313
+ var gBottomPad = 0;
314
+ if (groupVirtualize) {
315
+ var heights_2 = items.map(function (it) { return (it.kind === "header" ? GROUP_HEADER_H : rowHeight); });
316
+ var offsets_1 = [];
317
+ var acc = 0;
318
+ for (var _1 = 0, heights_1 = heights_2; _1 < heights_1.length; _1++) {
319
+ var h = heights_1[_1];
320
+ offsets_1.push(acc);
321
+ acc += h;
322
+ }
323
+ var totalH = acc;
324
+ var vh = viewportH || 500;
325
+ var top_2 = scrollTop - OVERSCAN * rowHeight;
326
+ var bottom = scrollTop + vh + OVERSCAN * rowHeight;
327
+ firstI_1 = items.findIndex(function (_, i) { return offsets_1[i] + heights_2[i] > top_2; });
328
+ if (firstI_1 < 0)
329
+ firstI_1 = items.length;
330
+ lastI = items.length;
331
+ for (var i = firstI_1; i < items.length; i++) {
332
+ if (offsets_1[i] > bottom) {
333
+ lastI = i;
334
+ break;
335
+ }
336
+ }
337
+ gTopPad = (_r = offsets_1[firstI_1]) !== null && _r !== void 0 ? _r : 0;
338
+ gBottomPad = totalH - (lastI > firstI_1 ? offsets_1[lastI - 1] + heights_2[lastI - 1] : gTopPad);
339
+ }
340
+ var windowItems = groupVirtualize ? items.slice(firstI_1, lastI) : items;
341
+ return (react_2.default.createElement(react_2.default.Fragment, null,
342
+ gTopPad > 0 && (react_2.default.createElement("tr", { "aria-hidden": "true", style: { height: gTopPad } },
343
+ react_2.default.createElement("td", { colSpan: totalVisibleColumns, style: { padding: 0, border: "none", height: gTopPad } }))),
344
+ windowItems.map(function (it, k) {
345
+ var _a;
346
+ return it.kind === "header" ? (react_2.default.createElement(TableGroupRow_1.default, { key: "h-".concat(it.g.value), label: it.g.label, value: it.g.value, count: it.g.rows.length, color: it.g.color, collapsed: collapsedGroups.has(it.g.value), colSpan: totalVisibleColumns, onToggle: function () { return toggleGroup(it.g.value); }, onAddItem: onAddItem })) : (react_2.default.createElement(TableRow, { key: (_a = it.row.id) !== null && _a !== void 0 ? _a : "r-".concat(firstI_1 + k), row: it.row, rowIndex: firstI_1 + k, index: firstI_1 + k, isChecked: selectionsSet.has(it.row.id), isExpanded: expandedRows.has(firstI_1 + k), isContent: isContent, isLink: isLink, isCheckbox: isCheckbox, isLoading: isLoading, isActionFreeze: isActionFreeze, columns: columns, leftOffsets: leftOffsets, noBorders: noBorders, freezedBgColor: freezedBgColor, freezedTextColor: freezedTextColor, theme: theme, borderStyle: borderStyle, hoverStyle: hoverStyle, rowHeight: rowHeight, cellPy: cellPy, palette: palette, accentColor: it.g.color.solid, handleCheckbox: handleCheckbox, onRowClick: onRowClick, toggleRowExpansion: toggleRowExpansion }));
347
+ }),
348
+ gBottomPad > 0 && (react_2.default.createElement("tr", { "aria-hidden": "true", style: { height: gBottomPad } },
349
+ react_2.default.createElement("td", { colSpan: totalVisibleColumns, style: { padding: 0, border: "none", height: gBottomPad } })))));
350
+ }
351
+ return (react_2.default.createElement(react_2.default.Fragment, null,
352
+ isLoading && data.length > 0 && (react_2.default.createElement(react_1.Tr, null,
353
+ react_2.default.createElement(react_1.Td, { colSpan: totalVisibleColumns, p: 0, border: "none", position: "relative", height: 0 },
354
+ react_2.default.createElement(react_1.Box, { position: "absolute", top: 4, left: "50%", transform: "translateX(-50%)", zIndex: 10 },
355
+ react_2.default.createElement(react_1.Spinner, { size: "sm", color: ((_t = (_s = theme.colors) === null || _s === void 0 ? void 0 : _s.primary) === null || _t === void 0 ? void 0 : _t[500]) || "blue.500" }))))),
356
+ shouldVirtualize && topPad > 0 && (react_2.default.createElement("tr", { "aria-hidden": "true", style: { height: topPad } },
357
+ react_2.default.createElement("td", { colSpan: totalVisibleColumns, style: { padding: 0, border: "none", height: topPad } }))),
358
+ visibleRows.map(function (row, i) {
359
+ var _a;
360
+ var index = firstIndex + i;
361
+ var rowIndex = startRow + index;
362
+ var isExpanded = expandedRows.has(rowIndex);
363
+ var isChecked = selectionsSet.has(row.id);
364
+ return (react_2.default.createElement(TableRow, { key: (_a = row.id) !== null && _a !== void 0 ? _a : rowIndex, row: row, rowIndex: rowIndex, index: index, isChecked: isChecked, isExpanded: isExpanded, isContent: isContent, isLink: isLink, isCheckbox: isCheckbox, isLoading: isLoading, isActionFreeze: isActionFreeze, columns: columns, leftOffsets: leftOffsets, noBorders: noBorders, freezedBgColor: freezedBgColor, freezedTextColor: freezedTextColor, theme: theme, borderStyle: borderStyle, hoverStyle: hoverStyle, rowHeight: rowHeight, cellPy: cellPy, palette: palette, accentColor: accentColors === null || accentColors === void 0 ? void 0 : accentColors[row.id], handleCheckbox: handleCheckbox, onRowClick: onRowClick, toggleRowExpansion: toggleRowExpansion, onMeasure: shouldVirtualize ? reportHeight : undefined }));
365
+ }),
366
+ shouldVirtualize && bottomPad > 0 && (react_2.default.createElement("tr", { "aria-hidden": "true", style: { height: bottomPad } },
367
+ react_2.default.createElement("td", { colSpan: totalVisibleColumns, style: { padding: 0, border: "none", height: bottomPad } })))));
368
+ };
369
+ exports.default = TableBody;
@@ -0,0 +1,15 @@
1
+ import React from "react";
2
+ import { TablePaletteColor } from "../../../Utils/table";
3
+ type Props = {
4
+ label: string;
5
+ value: string | number;
6
+ count: number;
7
+ color: TablePaletteColor;
8
+ collapsed: boolean;
9
+ colSpan: number;
10
+ onToggle: () => void;
11
+ onAddItem?: (groupValue: string | number) => void;
12
+ };
13
+ /** Monday-style colored, collapsible group header row. */
14
+ export declare const TableGroupRow: React.FC<Props>;
15
+ export default TableGroupRow;
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.TableGroupRow = void 0;
7
+ var react_1 = __importDefault(require("react"));
8
+ var react_2 = require("@chakra-ui/react");
9
+ var lucide_react_1 = require("lucide-react");
10
+ var useCustomTheme_1 = require("../../../Theme/useCustomTheme");
11
+ /** Monday-style colored, collapsible group header row. */
12
+ var TableGroupRow = function (_a) {
13
+ var _b, _c, _d, _e, _f, _g;
14
+ var label = _a.label, value = _a.value, count = _a.count, color = _a.color, collapsed = _a.collapsed, colSpan = _a.colSpan, onToggle = _a.onToggle, onAddItem = _a.onAddItem;
15
+ var theme = (0, useCustomTheme_1.useCustomTheme)();
16
+ return (react_1.default.createElement(react_2.Tr, null,
17
+ react_1.default.createElement(react_2.Td, { colSpan: colSpan, p: 0, border: "none" },
18
+ react_1.default.createElement(react_2.Flex, { align: "center", gap: 2, px: 3, py: 2, bg: color.soft, boxShadow: "inset 4px 0 0 ".concat(color.solid), borderBottom: "0.063rem solid ".concat((_c = (_b = theme.colors) === null || _b === void 0 ? void 0 : _b.border) === null || _c === void 0 ? void 0 : _c[500]) },
19
+ react_1.default.createElement(react_2.IconButton, { "aria-label": collapsed ? "Expand group" : "Collapse group", size: "xs", variant: "ghost", color: color.text, onClick: onToggle, icon: collapsed ? react_1.default.createElement(lucide_react_1.ChevronRight, { size: 16 }) : react_1.default.createElement(lucide_react_1.ChevronDown, { size: 16 }) }),
20
+ react_1.default.createElement(react_2.Text, { fontSize: "0.8125rem", fontWeight: 700, color: color.text, isTruncated: true, maxW: "20rem" }, label),
21
+ react_1.default.createElement(react_2.Box, { as: "span", fontSize: "0.6875rem", fontWeight: 600, color: color.text, bg: (_e = (_d = theme.colors) === null || _d === void 0 ? void 0 : _d.background) === null || _e === void 0 ? void 0 : _e[50], borderRadius: "full", px: "0.5rem", py: "0.0625rem" }, count),
22
+ onAddItem && (react_1.default.createElement(react_2.Flex, { as: "button", type: "button", align: "center", gap: 1, ml: "auto", px: 2, py: 1, borderRadius: "md", fontSize: "0.75rem", fontWeight: 500, color: (_g = (_f = theme.colors) === null || _f === void 0 ? void 0 : _f.text) === null || _g === void 0 ? void 0 : _g[500], _hover: { bg: "whiteAlpha.500", color: color.text }, onClick: function () { return onAddItem(value); } },
23
+ react_1.default.createElement(lucide_react_1.Plus, { size: 14 }),
24
+ " Add item"))))));
25
+ };
26
+ exports.TableGroupRow = TableGroupRow;
27
+ exports.default = exports.TableGroupRow;
@@ -51,7 +51,7 @@ var react_1 = require("@chakra-ui/react");
51
51
  var react_2 = __importStar(require("react"));
52
52
  var table_1 = require("../../../Utils/table");
53
53
  var useCustomTheme_1 = require("../../../Theme/useCustomTheme");
54
- var TableFilters_1 = __importDefault(require("./TableFilters"));
54
+ var TableFilters_1 = __importDefault(require("../filters/TableFilters"));
55
55
  var lucide_react_1 = require("lucide-react");
56
56
  var Checkbox_1 = __importDefault(require("../../Checkbox/Checkbox"));
57
57
  var TableHeader = function (_a) {
@@ -60,7 +60,7 @@ var TableHeader = function (_a) {
60
60
  var _b = (0, react_2.useState)(null), openFilterId = _b[0], setOpenFilterId = _b[1];
61
61
  var RenderCheckbox = (0, react_2.useCallback)(function () {
62
62
  var _a, _b, _c, _d, _e;
63
- return (react_2.default.createElement(react_1.Th, { w: 6, fontSize: 14, fontWeight: 600, color: freezedTextColor, textTransform: "capitalize", backgroundColor: (_b = (_a = theme.colors) === null || _a === void 0 ? void 0 : _a.secondary) === null || _b === void 0 ? void 0 : _b[50], borderY: noBorders ? "none" : "0.063rem solid ".concat((_c = theme.colors) === null || _c === void 0 ? void 0 : _c.gray[300]), position: "sticky", className: "columns sticky-columns", left: "0px", zIndex: 9, boxShadow: theme.shadows.md }, isSelecting ? (react_2.default.createElement(react_1.Spinner, { size: "sm", color: (_e = (_d = theme.colors) === null || _d === void 0 ? void 0 : _d.primary) === null || _e === void 0 ? void 0 : _e[500] })) : (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" }))));
63
+ return (react_2.default.createElement(react_1.Th, { w: 6, fontSize: 14, fontWeight: 600, color: freezedTextColor, textTransform: "capitalize", backgroundColor: (_b = (_a = theme.colors) === null || _a === void 0 ? void 0 : _a.secondary) === null || _b === void 0 ? void 0 : _b[50], position: "sticky", className: "columns sticky-columns", left: "0px", zIndex: 9, borderBottom: noBorders ? "none" : "0.063rem solid ".concat((_c = theme.colors) === null || _c === void 0 ? void 0 : _c.gray[300]) }, isSelecting ? (react_2.default.createElement(react_1.Spinner, { size: "sm", color: (_e = (_d = theme.colors) === null || _d === void 0 ? void 0 : _d.primary) === null || _e === void 0 ? void 0 : _e[500] })) : (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" }))));
64
64
  }, [
65
65
  checked,
66
66
  freezedTextColor,
@@ -72,11 +72,11 @@ var TableHeader = function (_a) {
72
72
  ]);
73
73
  var RenderConent = (0, react_2.useCallback)(function () {
74
74
  var _a, _b, _c;
75
- return (react_2.default.createElement(react_1.Th, { w: 6, minW: "35px", p: 0, backgroundColor: (_b = (_a = theme.colors) === null || _a === void 0 ? void 0 : _a.secondary) === null || _b === void 0 ? void 0 : _b[50], borderY: noBorders ? "none" : "0.063rem solid ".concat((_c = theme.colors) === null || _c === void 0 ? void 0 : _c.gray[300]), position: "sticky", className: "columns sticky-columns", left: "0px", zIndex: 1, boxShadow: theme.shadows.md }));
75
+ return (react_2.default.createElement(react_1.Th, { w: 6, minW: "35px", p: 0, backgroundColor: (_b = (_a = theme.colors) === null || _a === void 0 ? void 0 : _a.secondary) === null || _b === void 0 ? void 0 : _b[50], borderBottom: noBorders ? "none" : "0.063rem solid ".concat((_c = theme.colors) === null || _c === void 0 ? void 0 : _c.gray[300]), position: "sticky", className: "columns sticky-columns", left: "0px", zIndex: 1 }));
76
76
  }, [noBorders, theme.colors]);
77
77
  var RenderView = (0, react_2.useCallback)(function () {
78
78
  var _a, _b, _c;
79
- return (react_2.default.createElement(react_1.Th, { w: 2, p: 0, minW: "2.065rem", backgroundColor: (_b = (_a = theme.colors) === null || _a === void 0 ? void 0 : _a.secondary) === null || _b === void 0 ? void 0 : _b[50], borderY: noBorders ? "none" : "0.063rem solid ".concat((_c = theme.colors) === null || _c === void 0 ? void 0 : _c.gray[300]), position: isActionFreeze ? "sticky" : "relative", className: "columns sticky-columns", right: "0px", zIndex: 1, boxShadow: theme.shadows.md }));
79
+ return (react_2.default.createElement(react_1.Th, { w: 2, p: 0, minW: "2.065rem", backgroundColor: (_b = (_a = theme.colors) === null || _a === void 0 ? void 0 : _a.secondary) === null || _b === void 0 ? void 0 : _b[50], borderBottom: noBorders ? "none" : "0.063rem solid ".concat((_c = theme.colors) === null || _c === void 0 ? void 0 : _c.gray[300]), position: isActionFreeze ? "sticky" : "relative", className: "columns sticky-columns", right: "0px", zIndex: 1 }));
80
80
  }, [noBorders, theme.colors, isActionFreeze]);
81
81
  return (react_2.default.createElement(react_1.Tr, { pr: 0 },
82
82
  isContent && react_2.default.createElement(RenderConent, null),
@@ -99,9 +99,9 @@ var SortingIcon = (0, react_2.memo)(function (_a) {
99
99
  sortState === "desc" && react_2.default.createElement(lucide_react_1.ChevronDown, { size: 14 })));
100
100
  });
101
101
  var ColumnHeader = (0, react_2.memo)(function (_a) {
102
- var _b, _c, _d, _e, _f;
102
+ var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
103
103
  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, openFilterId = _a.openFilterId, setOpenFilterId = _a.setOpenFilterId;
104
- var _g = (0, react_2.useState)(false), isHovered = _g[0], setIsHovered = _g[1];
104
+ var _v = (0, react_2.useState)(false), isHovered = _v[0], setIsHovered = _v[1];
105
105
  var theme = (0, useCustomTheme_1.useCustomTheme)();
106
106
  var isFrozen = header.isFreeze;
107
107
  var leftOffset = isFrozen
@@ -110,6 +110,15 @@ var ColumnHeader = (0, react_2.memo)(function (_a) {
110
110
  var isSorting = header.isSort
111
111
  ? columnsSort.find(function (o) { return o.column === header.id; })
112
112
  : undefined;
113
+ var activeSorts = columnsSort.filter(function (o) { return o.direction !== "none"; });
114
+ var sortPriority = activeSorts.length > 1 && isSorting && isSorting.direction !== "none"
115
+ ? activeSorts.findIndex(function (o) { return o.column === header.id; }) + 1
116
+ : 0;
117
+ var ariaSort = (isSorting === null || isSorting === void 0 ? void 0 : isSorting.direction) === "asc"
118
+ ? "ascending"
119
+ : (isSorting === null || isSorting === void 0 ? void 0 : isSorting.direction) === "desc"
120
+ ? "descending"
121
+ : undefined;
113
122
  // const TextColor = isFrozen ? freezedTextColor : headerTextColor;
114
123
  var handleMouseDown = function (e) {
115
124
  var parentBox = e.target
@@ -144,11 +153,12 @@ var ColumnHeader = (0, react_2.memo)(function (_a) {
144
153
  }, [handleSort]);
145
154
  var isFiltersEnabled = (isHovered && header.isSort) ||
146
155
  ((isSorting === null || isSorting === void 0 ? void 0 : isSorting.direction) && isSorting.direction !== "none");
147
- 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: (_c = (_b = theme.colors) === null || _b === void 0 ? void 0 : _b.secondary) === null || _c === void 0 ? void 0 : _c[50], maxWidth: 500, zIndex: isFrozen ? 2 : 1, py: 2, pr: 0, overflow: "hidden", borderY: noBorders ? "none" : "0.063rem solid ".concat((_d = theme.colors) === null || _d === void 0 ? void 0 : _d.border[500]), className: "columns ".concat(isFrozen ? "sticky-columns" : "scrollable-columns"), height: 45, onMouseEnter: function () { return setIsHovered(true); }, onMouseLeave: function () { return setIsHovered(false); } },
148
- react_2.default.createElement(react_1.Box, { display: "flex", color: (_f = (_e = theme.colors) === null || _e === void 0 ? void 0 : _e.secondary) === null || _f === void 0 ? void 0 : _f[500], lineHeight: "1.25rem", justifyContent: "space-between", alignItems: "center", position: "relative" },
156
+ return (react_2.default.createElement(react_1.Th, { key: index + 1, ref: function (el) { return (headerRefs.current[index] = el); }, "aria-sort": ariaSort, textTransform: "capitalize", fontSize: 13, fontWeight: 600, position: isFrozen ? "sticky" : undefined, left: isFrozen ? leftOffset : undefined, minWidth: 120, backgroundColor: (_e = (_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[200]) !== null && _e !== void 0 ? _e : (_g = (_f = theme.colors) === null || _f === void 0 ? void 0 : _f.secondary) === null || _g === void 0 ? void 0 : _g[50], maxWidth: 500, zIndex: isFrozen ? 2 : 1, py: 2, pr: 0, overflow: "hidden", borderTop: "none", borderBottom: noBorders ? "none" : "0.063rem solid ".concat((_h = theme.colors) === null || _h === void 0 ? void 0 : _h.border[500]), borderRight: noBorders ? "none" : "0.063rem solid ".concat((_l = (_k = (_j = theme.colors) === null || _j === void 0 ? void 0 : _j.boxborder) === null || _k === void 0 ? void 0 : _k[300]) !== null && _l !== void 0 ? _l : (_m = theme.colors) === null || _m === void 0 ? void 0 : _m.gray[200]), className: "columns ".concat(isFrozen ? "sticky-columns" : "scrollable-columns"), height: 45, onMouseEnter: function () { return setIsHovered(true); }, onMouseLeave: function () { return setIsHovered(false); } },
157
+ react_2.default.createElement(react_1.Box, { display: "flex", color: (_p = (_o = theme.colors) === null || _o === void 0 ? void 0 : _o.secondary) === null || _p === void 0 ? void 0 : _p[500], lineHeight: "1.25rem", justifyContent: "space-between", alignItems: "center", position: "relative" },
149
158
  react_2.default.createElement(react_1.Box, { textOverflow: "ellipsis", whiteSpace: "nowrap", display: "inline-block", overflow: "hidden" }, header.label),
150
159
  react_2.default.createElement(react_1.Box, { display: "inline-flex", alignItems: "center" },
151
160
  isFiltersEnabled && (react_2.default.createElement(Sorting, { isSorting: isSorting, header: header })),
161
+ sortPriority > 0 && (react_2.default.createElement(react_1.Box, { as: "span", ml: 1, fontSize: "0.625rem", fontWeight: 700, lineHeight: "1", borderRadius: "full", px: "0.3rem", py: "0.1rem", bg: (_s = (_r = (_q = theme.colors) === null || _q === void 0 ? void 0 : _q.primary) === null || _r === void 0 ? void 0 : _r.opacity) === null || _s === void 0 ? void 0 : _s[16], color: (_u = (_t = theme.colors) === null || _t === void 0 ? void 0 : _t.primary) === null || _u === void 0 ? void 0 : _u[600] }, sortPriority)),
152
162
  react_2.default.createElement(TableFilters_1.default, { header: header, setColumnsSearch: function (searchVal) {
153
163
  return setColumnsSearch(function (prev) {
154
164
  var _a;
@@ -61,12 +61,12 @@ var react_2 = require("@chakra-ui/react");
61
61
  var lucide_react_1 = require("lucide-react");
62
62
  var framer_motion_1 = require("framer-motion");
63
63
  var react_3 = require("@chakra-ui/react");
64
- var Checkbox_1 = __importDefault(require("../Checkbox/Checkbox"));
65
- var RadioButton_1 = require("../RadioButton/RadioButton");
64
+ var Checkbox_1 = __importDefault(require("../../Checkbox/Checkbox"));
65
+ var RadioButton_1 = require("../../RadioButton/RadioButton");
66
66
  var TextOperationControls_1 = require("./TextOperationControls");
67
67
  var SelectOperationControls_1 = require("./SelectOperationControls");
68
68
  var CompactSelect_1 = __importDefault(require("./CompactSelect"));
69
- var DatePicker_1 = __importDefault(require("../DatePicker/DatePicker"));
69
+ var DatePicker_1 = __importDefault(require("../../DatePicker/DatePicker"));
70
70
  // ─── Helpers ──────────────────────────────────────────────────────────────────
71
71
  var LABEL_MAX_LENGTH = 18;
72
72
  function formatHeaderLabel(label) {
@@ -41,7 +41,7 @@ declare const useTable: ({ tableBorderColor, data, isPagination, selections, onS
41
41
  rowsPerPage: number;
42
42
  setCurrentPage: import("react").Dispatch<import("react").SetStateAction<number>>;
43
43
  columnsList: TableHeaderProps[];
44
- handleColumnPreferences: (columns: any) => void;
44
+ handleColumnPreferences: (columns: any, extra?: Record<string, any>) => void;
45
45
  isSelecting: boolean;
46
46
  };
47
47
  export default useTable;
@@ -47,13 +47,13 @@ var useTable = function (_a) {
47
47
  var _f = (0, react_1.useState)([]), columnsSort = _f[0], setColumnsSort = _f[1];
48
48
  var _g = (0, react_1.useState)(0), currentPage = _g[0], setCurrentPage = _g[1];
49
49
  var _h = (0, react_1.useState)(noOfRowsPerPage !== null && noOfRowsPerPage !== void 0 ? noOfRowsPerPage : defaultPageSize), rowsPerPage = _h[0], setRowsPerPage = _h[1];
50
- var prevRowsPerPageProp = (0, react_1.useRef)(noOfRowsPerPage);
51
- if (noOfRowsPerPage !== prevRowsPerPageProp.current) {
52
- prevRowsPerPageProp.current = noOfRowsPerPage;
53
- if (noOfRowsPerPage !== undefined && noOfRowsPerPage !== rowsPerPage) {
50
+ // Keep the internal page size in sync with the `noOfRowsPerPage` prop when the
51
+ // consumer changes it (e.g. a page-size control outside the table).
52
+ (0, react_1.useEffect)(function () {
53
+ if (noOfRowsPerPage !== undefined) {
54
54
  setRowsPerPage(noOfRowsPerPage);
55
55
  }
56
- }
56
+ }, [noOfRowsPerPage]);
57
57
  var tableData = data;
58
58
  var _j = (0, react_1.useState)(function () {
59
59
  return columns.map(function (col, i) {
@@ -187,10 +187,11 @@ var useTable = function (_a) {
187
187
  (_a = onSelectionRef.current) === null || _a === void 0 ? void 0 : _a.call(onSelectionRef, selectedItems);
188
188
  }
189
189
  }, [tableData]);
190
- var handleColumnPreferences = function (columns) {
190
+ var handleColumnPreferences = function (columns, extra) {
191
+ if (extra === void 0) { extra = {}; }
191
192
  setColumnsList(columns);
192
193
  savePreferences &&
193
- savePreferences(__assign(__assign({}, tablePreferences), { columns: columns }));
194
+ savePreferences(__assign(__assign(__assign({}, tablePreferences), { columns: columns }), extra));
194
195
  };
195
196
  return {
196
197
  tableData: tableData,
@@ -0,0 +1,11 @@
1
+ import React from "react";
2
+ import { TableDensity, TableProps } from "../TableProps";
3
+ declare const TableSettings: ({ columns, onSave, density, onDensityChange, groupBy, }: {
4
+ columns: TableProps["columns"];
5
+ onSave: (updatedColumns: TableProps["columns"], groupBy: string | number | undefined) => void;
6
+ tableSettings?: TableProps["tableSettings"];
7
+ density?: TableDensity;
8
+ onDensityChange?: (d: TableDensity) => void;
9
+ groupBy?: string | number;
10
+ }) => React.JSX.Element;
11
+ export default TableSettings;