pixelize-design-library 2.3.1-beta.8 → 2.3.2

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 (193) hide show
  1. package/.cursor/TASK-SETUP.md +43 -0
  2. package/.cursor/agents/be-impl.md +37 -0
  3. package/.cursor/agents/fe-impl.md +39 -0
  4. package/.cursor/agents/task-plan.md +56 -0
  5. package/.cursor/agents/test-create.md +31 -0
  6. package/.cursor/agents/test-exec.md +26 -0
  7. package/.cursor/hooks/task-hint.env +1 -0
  8. package/.cursor/hooks/task-skill-nudge.sh +71 -0
  9. package/.cursor/hooks/task-slash-guard.sh +31 -0
  10. package/.cursor/hooks.json +13 -0
  11. package/.cursor/modules/account-management/MODULE.md +16 -0
  12. package/.cursor/modules/buttons/MODULE.md +13 -0
  13. package/.cursor/modules/cards/MODULE.md +13 -0
  14. package/.cursor/modules/charts/MODULE.md +13 -0
  15. package/.cursor/modules/common/MODULE.md +13 -0
  16. package/.cursor/modules/contact-auth/MODULE.md +13 -0
  17. package/.cursor/modules/data-display/MODULE.md +18 -0
  18. package/.cursor/modules/feedback/MODULE.md +14 -0
  19. package/.cursor/modules/form/MODULE.md +13 -0
  20. package/.cursor/modules/inputs-basic/MODULE.md +13 -0
  21. package/.cursor/modules/inputs-date-file/MODULE.md +19 -0
  22. package/.cursor/modules/inputs-select/MODULE.md +14 -0
  23. package/.cursor/modules/inputs-toggle/MODULE.md +13 -0
  24. package/.cursor/modules/kanban/MODULE.md +14 -0
  25. package/.cursor/modules/layout-navigation/MODULE.md +14 -0
  26. package/.cursor/modules/overlays/MODULE.md +13 -0
  27. package/.cursor/modules/playground/MODULE.md +15 -0
  28. package/.cursor/modules/table/MODULE.md +15 -0
  29. package/.cursor/modules/theme/MODULE.md +15 -0
  30. package/.cursor/modules/types-exports/MODULE.md +17 -0
  31. package/.cursor/modules/utility-ui/MODULE.md +15 -0
  32. package/.cursor/modules/utils-hooks/MODULE.md +13 -0
  33. package/.cursor/pixelize-task-statusline.sh +64 -0
  34. package/.cursor/plans/blocked/.gitkeep +0 -0
  35. package/.cursor/plans/current.md +35 -0
  36. package/.cursor/plans/done/.gitkeep +0 -0
  37. package/.cursor/rules +31 -0
  38. package/.cursor/skills/task/SKILL.md +167 -0
  39. package/CLAUDE.md +122 -0
  40. package/dist/Components/Card/PaymentCard/PaymentCard.d.ts +1 -1
  41. package/dist/Components/Card/PaymentCard/PaymentCard.js +3 -3
  42. package/dist/Components/Card/PaymentCard/PaymentCardProps.d.ts +1 -0
  43. package/dist/Components/CopyButton/CopyButton.d.ts +22 -0
  44. package/dist/Components/CopyButton/CopyButton.js +126 -0
  45. package/dist/Components/CustomModulesTable/CustomModulesTable.d.ts +4 -0
  46. package/dist/Components/CustomModulesTable/CustomModulesTable.js +182 -0
  47. package/dist/Components/CustomModulesTable/CustomModulesTable.test.d.ts +1 -0
  48. package/dist/Components/CustomModulesTable/CustomModulesTable.test.js +84 -0
  49. package/dist/Components/CustomModulesTable/CustomModulesTableProps.d.ts +54 -0
  50. package/dist/Components/CustomModulesTable/CustomModulesTableProps.js +2 -0
  51. package/dist/Components/CustomModulesTable/DeleteModuleModal.d.ts +4 -0
  52. package/dist/Components/CustomModulesTable/DeleteModuleModal.js +33 -0
  53. package/dist/Components/CustomModulesTable/EditModuleModal.d.ts +4 -0
  54. package/dist/Components/CustomModulesTable/EditModuleModal.js +63 -0
  55. package/dist/Components/Dropdown/DropDown.js +110 -28
  56. package/dist/Components/Dropdown/Dropdown.test.d.ts +1 -0
  57. package/dist/Components/Dropdown/Dropdown.test.js +102 -0
  58. package/dist/Components/Dropdown/DropdownProps.d.ts +4 -1
  59. package/dist/Components/EmptyState/EmptyState.d.ts +4 -0
  60. package/dist/Components/EmptyState/EmptyState.js +65 -0
  61. package/dist/Components/EmptyState/EmptyStateProps.d.ts +28 -0
  62. package/dist/Components/EmptyState/EmptyStateProps.js +2 -0
  63. package/dist/Components/FieldSelectModal/FieldSelectModal.d.ts +26 -0
  64. package/dist/Components/FieldSelectModal/FieldSelectModal.js +107 -0
  65. package/dist/Components/FilePreview/FilePreview.d.ts +6 -0
  66. package/dist/Components/FilePreview/FilePreview.js +190 -0
  67. package/dist/Components/FilePreview/FilePreviewProps.d.ts +26 -0
  68. package/dist/Components/FilePreview/FilePreviewProps.js +2 -0
  69. package/dist/Components/LazyWrapper/LazyWrapper.d.ts +10 -0
  70. package/dist/Components/LazyWrapper/LazyWrapper.js +50 -0
  71. package/dist/Components/MoreItems/MoreItems.d.ts +4 -0
  72. package/dist/Components/MoreItems/MoreItems.js +35 -0
  73. package/dist/Components/MoreItems/MoreItemsProps.d.ts +29 -0
  74. package/dist/Components/MoreItems/MoreItemsProps.js +2 -0
  75. package/dist/Components/OrgSwitcher/OrgSwitcher.d.ts +4 -0
  76. package/dist/Components/OrgSwitcher/OrgSwitcher.js +121 -0
  77. package/dist/Components/OrgSwitcher/OrgSwitcherProps.d.ts +41 -0
  78. package/dist/Components/OrgSwitcher/OrgSwitcherProps.js +25 -0
  79. package/dist/Components/OrganizationDetails/CreateOrgModal.d.ts +4 -0
  80. package/dist/Components/OrganizationDetails/CreateOrgModal.js +122 -0
  81. package/dist/Components/OrganizationDetails/DeleteOrgModal.d.ts +4 -0
  82. package/dist/Components/OrganizationDetails/DeleteOrgModal.js +29 -0
  83. package/dist/Components/OrganizationDetails/OrganizationDetails.d.ts +4 -0
  84. package/dist/Components/OrganizationDetails/OrganizationDetails.js +264 -0
  85. package/dist/Components/OrganizationDetails/OrganizationDetails.test.d.ts +1 -0
  86. package/dist/Components/OrganizationDetails/OrganizationDetails.test.js +122 -0
  87. package/dist/Components/OrganizationDetails/OrganizationDetailsProps.d.ts +88 -0
  88. package/dist/Components/OrganizationDetails/OrganizationDetailsProps.js +2 -0
  89. package/dist/Components/PdfViewer/PdfViewer.d.ts +15 -0
  90. package/dist/Components/PdfViewer/PdfViewer.js +29 -0
  91. package/dist/Components/RolesPermission/DeleteRoleModal.d.ts +4 -0
  92. package/dist/Components/RolesPermission/DeleteRoleModal.js +29 -0
  93. package/dist/Components/RolesPermission/RolesPermission.d.ts +4 -0
  94. package/dist/Components/RolesPermission/RolesPermission.js +243 -0
  95. package/dist/Components/RolesPermission/RolesPermission.test.d.ts +1 -0
  96. package/dist/Components/RolesPermission/RolesPermission.test.js +150 -0
  97. package/dist/Components/RolesPermission/RolesPermissionProps.d.ts +117 -0
  98. package/dist/Components/RolesPermission/RolesPermissionProps.js +2 -0
  99. package/dist/Components/ScrollToTop/ScrollToTop.d.ts +19 -0
  100. package/dist/Components/ScrollToTop/ScrollToTop.js +104 -0
  101. package/dist/Components/SideBar/components/OtherApps.test.js +3 -2
  102. package/dist/Components/SignInActivityTable/SignInActivityTable.d.ts +4 -0
  103. package/dist/Components/SignInActivityTable/SignInActivityTable.js +95 -0
  104. package/dist/Components/SignInActivityTable/SignInActivityTable.test.d.ts +1 -0
  105. package/dist/Components/SignInActivityTable/SignInActivityTable.test.js +63 -0
  106. package/dist/Components/SignInActivityTable/SignInActivityTableProps.d.ts +21 -0
  107. package/dist/Components/SignInActivityTable/SignInActivityTableProps.js +2 -0
  108. package/dist/Components/StageProgress/StageItem.d.ts +4 -0
  109. package/dist/Components/StageProgress/StageItem.js +137 -0
  110. package/dist/Components/StageProgress/StageProgress.d.ts +4 -0
  111. package/dist/Components/StageProgress/StageProgress.js +59 -0
  112. package/dist/Components/StageProgress/StageProgressProps.d.ts +85 -0
  113. package/dist/Components/StageProgress/StageProgressProps.js +27 -0
  114. package/dist/Components/StageProgress/StepperStage.d.ts +4 -0
  115. package/dist/Components/StageProgress/StepperStage.js +78 -0
  116. package/dist/Components/Table/Table.js +81 -34
  117. package/dist/Components/Table/TableProps.d.ts +4 -2
  118. package/dist/Components/Table/components/Pagination.js +1 -1
  119. package/dist/Components/Table/components/TableBody.js +15 -12
  120. package/dist/Components/Table/components/TableBody.virtualize.test.js +13 -3
  121. package/dist/Components/Table/components/TableHeader.d.ts +1 -1
  122. package/dist/Components/Table/components/TableHeader.js +9 -9
  123. package/dist/Components/Table/hooks/useTable.d.ts +1 -0
  124. package/dist/Components/Table/hooks/useTable.js +21 -8
  125. package/dist/Components/Table/settings/ManageColumns.test.js +1 -0
  126. package/dist/Components/Tag/Tag.d.ts +3 -11
  127. package/dist/Components/Tag/Tag.js +10 -2
  128. package/dist/Components/Tag/Tag.styles.d.ts +2 -2
  129. package/dist/Components/Tag/Tag.styles.js +58 -33
  130. package/dist/Components/Tag/Tag.test.d.ts +1 -0
  131. package/dist/Components/Tag/Tag.test.js +68 -0
  132. package/dist/Components/Tag/TagProps.d.ts +13 -0
  133. package/dist/Components/Tag/TagProps.js +2 -0
  134. package/dist/Components/UpgradeButton/UpgradeButton.d.ts +4 -0
  135. package/dist/Components/UpgradeButton/UpgradeButton.js +73 -0
  136. package/dist/Components/UpgradeButton/UpgradeButtonProps.d.ts +43 -0
  137. package/dist/Components/UpgradeButton/UpgradeButtonProps.js +2 -0
  138. package/dist/Components/UserDetails/AddUserModal.d.ts +4 -0
  139. package/dist/Components/UserDetails/AddUserModal.js +218 -0
  140. package/dist/Components/UserDetails/ChangeRoleModal.d.ts +4 -0
  141. package/dist/Components/UserDetails/ChangeRoleModal.js +150 -0
  142. package/dist/Components/UserDetails/DeactivateConfirmModal.d.ts +4 -0
  143. package/dist/Components/UserDetails/DeactivateConfirmModal.js +34 -0
  144. package/dist/Components/UserDetails/UserDetails.d.ts +4 -0
  145. package/dist/Components/UserDetails/UserDetails.js +263 -0
  146. package/dist/Components/UserDetails/UserDetails.test.d.ts +1 -0
  147. package/dist/Components/UserDetails/UserDetails.test.js +129 -0
  148. package/dist/Components/UserDetails/UserDetailsProps.d.ts +151 -0
  149. package/dist/Components/UserDetails/UserDetailsProps.js +2 -0
  150. package/dist/Theme/componentStyles.d.ts +1 -1
  151. package/dist/Theme/index.d.ts +4 -4
  152. package/dist/Theme/index.js +4 -4
  153. package/dist/index.d.ts +23 -1
  154. package/dist/index.js +37 -2
  155. package/package.json +2 -2
  156. package/.claude/settings.local.json +0 -44
  157. package/coverage/clover.xml +0 -638
  158. package/coverage/coverage-final.json +0 -20
  159. package/coverage/lcov-report/Table/CompactSelect.tsx.html +0 -379
  160. package/coverage/lcov-report/Table/Components/ActiveFilters.tsx.html +0 -514
  161. package/coverage/lcov-report/Table/Components/HeaderActions.tsx.html +0 -373
  162. package/coverage/lcov-report/Table/Components/Pagination.tsx.html +0 -574
  163. package/coverage/lcov-report/Table/Components/TableActions.tsx.html +0 -574
  164. package/coverage/lcov-report/Table/Components/TableBody.tsx.html +0 -1027
  165. package/coverage/lcov-report/Table/Components/TableFilters.tsx.html +0 -397
  166. package/coverage/lcov-report/Table/Components/TableHeader.tsx.html +0 -1060
  167. package/coverage/lcov-report/Table/Components/TableLoading.tsx.html +0 -361
  168. package/coverage/lcov-report/Table/Components/TableSearch.tsx.html +0 -337
  169. package/coverage/lcov-report/Table/Components/index.html +0 -266
  170. package/coverage/lcov-report/Table/Components/useDebounce.ts.html +0 -178
  171. package/coverage/lcov-report/Table/Components/useTable.ts.html +0 -778
  172. package/coverage/lcov-report/Table/LeftFilterPane.tsx.html +0 -1810
  173. package/coverage/lcov-report/Table/SelectOperationControls.tsx.html +0 -178
  174. package/coverage/lcov-report/Table/Table.tsx.html +0 -1567
  175. package/coverage/lcov-report/Table/TableProps.tsx.html +0 -658
  176. package/coverage/lcov-report/Table/TableSettings/ManageColumns.tsx.html +0 -619
  177. package/coverage/lcov-report/Table/TableSettings/TableFilters.tsx.html +0 -229
  178. package/coverage/lcov-report/Table/TableSettings/TableSettings.tsx.html +0 -532
  179. package/coverage/lcov-report/Table/TableSettings/index.html +0 -146
  180. package/coverage/lcov-report/Table/TableToDo.tsx.html +0 -973
  181. package/coverage/lcov-report/Table/TextOperationControls.tsx.html +0 -271
  182. package/coverage/lcov-report/Table/filterTypes.ts.html +0 -97
  183. package/coverage/lcov-report/Table/index.html +0 -176
  184. package/coverage/lcov-report/base.css +0 -224
  185. package/coverage/lcov-report/block-navigation.js +0 -87
  186. package/coverage/lcov-report/favicon.png +0 -0
  187. package/coverage/lcov-report/index.html +0 -146
  188. package/coverage/lcov-report/prettify.css +0 -1
  189. package/coverage/lcov-report/prettify.js +0 -2
  190. package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
  191. package/coverage/lcov-report/sorter.js +0 -210
  192. package/coverage/lcov.info +0 -1836
  193. package/dist/Assets/defaultLogo.tsx +0 -31
@@ -78,30 +78,30 @@ var Button_1 = __importDefault(require("../Button/Button"));
78
78
  var lucide_react_1 = require("lucide-react");
79
79
  var MotionBox = (0, framer_motion_1.motion)(react_2.Box);
80
80
  function Table(_a) {
81
- var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13;
82
- var data = _a.data, columns = _a.columns, onSelection = _a.onSelection, isLoading = _a.isLoading, _14 = _a.isCheckbox, isCheckbox = _14 === void 0 ? false : _14, headerBgColor = _a.headerBgColor, freezedBgColor = _a.freezedBgColor, headerTextColor = _a.headerTextColor, freezedTextColor = _a.freezedTextColor, tableBorderColor = _a.tableBorderColor, _15 = _a.noBorders, noBorders = _15 === void 0 ? false : _15, _16 = _a.isPagination, isPagination = _16 === void 0 ? true : _16, onRowClick = _a.onRowClick, selections = _a.selections, _17 = _a.isActionFreeze, isActionFreeze = _17 === void 0 ? true : _17, _18 = _a.preferences, preferences = _18 === void 0 ? {
81
+ var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12;
82
+ var data = _a.data, columns = _a.columns, onSelection = _a.onSelection, isLoading = _a.isLoading, _13 = _a.isCheckbox, isCheckbox = _13 === void 0 ? false : _13, headerBgColor = _a.headerBgColor, freezedBgColor = _a.freezedBgColor, headerTextColor = _a.headerTextColor, freezedTextColor = _a.freezedTextColor, tableBorderColor = _a.tableBorderColor, _14 = _a.noBorders, noBorders = _14 === void 0 ? false : _14, _15 = _a.isPagination, isPagination = _15 === void 0 ? true : _15, onRowClick = _a.onRowClick, selections = _a.selections, _16 = _a.isActionFreeze, isActionFreeze = _16 === void 0 ? true : _16, _17 = _a.preferences, preferences = _17 === void 0 ? {
83
83
  url: "",
84
84
  token: "",
85
85
  key: "",
86
86
  name: "",
87
87
  page: "",
88
88
  orgId: "",
89
- } : _18, _19 = _a.paginationMode, paginationMode = _19 === void 0 ? "client" : _19, _20 = _a.infiniteScroll, infiniteScroll = _20 === void 0 ? false : _20, hasMore = _a.hasMore, _21 = _a.isLoadingMore, isLoadingMore = _21 === void 0 ? false : _21, _22 = _a.groupLoadMore, groupLoadMore = _22 === void 0 ? false : _22, _23 = _a.loadMoreText, loadMoreText = _23 === void 0 ? "Load more" : _23, _24 = _a.loadMorePosition, loadMorePosition = _24 === void 0 ? "top" : _24, loadMoreChunkSize = _a.loadMoreChunkSize, _25 = _a.noOfRowsPerPage, noOfRowsPerPage = _25 === void 0 ? 50 : _25, _26 = _a.totalRecords, totalRecords = _26 === void 0 ? 0 : _26, onPagination = _a.onPagination, _27 = _a.isTableSettings, isTableSettings = _27 === void 0 ? false : _27, headerActions = _a.headerActions, onGlobalSearch = _a.onGlobalSearch, onNoOfRowsPerPageChange = _a.onNoOfRowsPerPageChange, paginationSelectOptions = _a.paginationSelectOptions, tableMaxHeight = _a.tableMaxHeight, minVisibleRows = _a.minVisibleRows, maxVisibleRows = _a.maxVisibleRows, autoFitViewport = _a.autoFitViewport, tableSettings = _a.tableSettings, filterSidebar = _a.filterSidebar, loadingSkeletonRows = _a.loadingSkeletonRows, defaultVisibleColumns = _a.defaultVisibleColumns, _28 = _a.density, density = _28 === void 0 ? "normal" : _28, stripe = _a.stripe, groupColors = _a.groupColors, onAddItem = _a.onAddItem, emptyState = _a.emptyState;
89
+ } : _17, _18 = _a.paginationMode, paginationMode = _18 === void 0 ? "client" : _18, _19 = _a.infiniteScroll, infiniteScroll = _19 === void 0 ? false : _19, hasMore = _a.hasMore, _20 = _a.isLoadingMore, isLoadingMore = _20 === void 0 ? false : _20, _21 = _a.groupLoadMore, groupLoadMore = _21 === void 0 ? false : _21, _22 = _a.loadMoreText, loadMoreText = _22 === void 0 ? "Load more" : _22, _23 = _a.loadMorePosition, loadMorePosition = _23 === void 0 ? "top" : _23, loadMoreChunkSize = _a.loadMoreChunkSize, _24 = _a.noOfRowsPerPage, noOfRowsPerPage = _24 === void 0 ? 50 : _24, _25 = _a.totalRecords, totalRecords = _25 === void 0 ? 0 : _25, onPagination = _a.onPagination, _26 = _a.isTableSettings, isTableSettings = _26 === void 0 ? false : _26, headerActions = _a.headerActions, onGlobalSearch = _a.onGlobalSearch, onNoOfRowsPerPageChange = _a.onNoOfRowsPerPageChange, paginationSelectOptions = _a.paginationSelectOptions, tableMaxHeight = _a.tableMaxHeight, minVisibleRows = _a.minVisibleRows, maxVisibleRows = _a.maxVisibleRows, autoFitViewport = _a.autoFitViewport, tableSettings = _a.tableSettings, filterSidebar = _a.filterSidebar, loadingSkeletonRows = _a.loadingSkeletonRows, defaultVisibleColumns = _a.defaultVisibleColumns, _27 = _a.density, density = _27 === void 0 ? "normal" : _27, stripe = _a.stripe, groupColors = _a.groupColors, onAddItem = _a.onAddItem, emptyState = _a.emptyState;
90
90
  var theme = (0, useCustomTheme_1.useCustomTheme)();
91
- var _29 = (0, react_1.useState)({}), columnsSearch = _29[0], setColumnsSearch = _29[1];
91
+ var _28 = (0, react_1.useState)({}), columnsSearch = _28[0], setColumnsSearch = _28[1];
92
92
  var tableContainerRef = (0, react_1.useRef)(null);
93
- var _30 = (0, react_2.useDisclosure)(), isFilterModalOpen = _30.isOpen, onFilterModalOpen = _30.onOpen, onFilterModalClose = _30.onClose;
93
+ var _29 = (0, react_2.useDisclosure)(), isFilterModalOpen = _29.isOpen, onFilterModalOpen = _29.onOpen, onFilterModalClose = _29.onClose;
94
94
  var filterMode = (_b = filterSidebar === null || filterSidebar === void 0 ? void 0 : filterSidebar.filterMode) !== null && _b !== void 0 ? _b : "sidebar";
95
- var _31 = (0, react_1.useState)(500), viewportAvailableH = _31[0], setViewportAvailableH = _31[1];
95
+ var _30 = (0, react_1.useState)(500), viewportAvailableH = _30[0], setViewportAvailableH = _30[1];
96
96
  var isServerPagination = paginationMode === "server";
97
- var _32 = (0, usePreferences_1.useGetPreferences)({
97
+ var _31 = (0, usePreferences_1.useGetPreferences)({
98
98
  baseUrl: preferences.url,
99
99
  page: preferences.page,
100
100
  key: preferences.key,
101
101
  name: preferences.name,
102
102
  authToken: preferences.token,
103
103
  orgId: preferences.orgId,
104
- }), tablePreferencesData = _32.preferences, loading = _32.loading;
104
+ }), tablePreferencesData = _31.preferences, loading = _31.loading;
105
105
  var savePreferences = (0, usePreferences_1.useSavePreferences)({
106
106
  baseUrl: preferences.url,
107
107
  page: preferences.page,
@@ -119,7 +119,7 @@ function Table(_a) {
119
119
  }
120
120
  return {};
121
121
  }, [tablePreferencesData]);
122
- var _33 = (0, useTable_1.default)({
122
+ var _32 = (0, useTable_1.default)({
123
123
  tableBorderColor: tableBorderColor,
124
124
  data: data,
125
125
  isPagination: isPagination,
@@ -133,24 +133,30 @@ function Table(_a) {
133
133
  isServerPagination: isServerPagination,
134
134
  onNoOfRowsPerPageChange: onNoOfRowsPerPageChange,
135
135
  defaultVisibleColumns: defaultVisibleColumns,
136
- }), tableData = _33.tableData, isContent = _33.isContent, isLink = _33.isLink, headerRefs = _33.headerRefs, columnWidths = _33.columnWidths, handleSort = _33.handleSort, handleCheckbox = _33.handleCheckbox, filteredData = _33.filteredData, startRow = _33.startRow, endRow = _33.endRow, selection = _33.selection, columnsSort = _33.columnsSort, currentPage = _33.currentPage, pages = _33.pages, rowsPerPage = _33.rowsPerPage, handlePageSizeChange = _33.handlePageSizeChange, setCurrentPage = _33.setCurrentPage, columnsList = _33.columnsList, handleColumnPreferences = _33.handleColumnPreferences, isSelecting = _33.isSelecting;
136
+ }), tableData = _32.tableData, isContent = _32.isContent, isLink = _32.isLink, headerRefs = _32.headerRefs, columnWidths = _32.columnWidths, handleSort = _32.handleSort, handleCheckbox = _32.handleCheckbox, filteredData = _32.filteredData, startRow = _32.startRow, endRow = _32.endRow, selection = _32.selection, columnsSort = _32.columnsSort, currentPage = _32.currentPage, pages = _32.pages, rowsPerPage = _32.rowsPerPage, handlePageSizeChange = _32.handlePageSizeChange, setCurrentPage = _32.setCurrentPage, columnsList = _32.columnsList, handleColumnPreferences = _32.handleColumnPreferences, isSelecting = _32.isSelecting, selectAllRowsRef = _32.selectAllRowsRef;
137
137
  // Density + grouping are managed here so the Table Settings tabs can change +
138
138
  // persist them (seeded from the prop / saved preferences when they load).
139
- var _34 = (0, react_1.useState)(density), densityState = _34[0], setDensityState = _34[1];
139
+ var _33 = (0, react_1.useState)(density), densityState = _33[0], setDensityState = _33[1];
140
140
  // Grouping is chosen by the user in Table Settings > Group and persisted to
141
141
  // preferences (`json.groupBy`); there is no `groupBy` prop.
142
- var _35 = (0, react_1.useState)(undefined), groupByState = _35[0], setGroupByState = _35[1];
142
+ var _34 = (0, react_1.useState)(undefined), groupByState = _34[0], setGroupByState = _34[1];
143
143
  // Grouped "Load more" accumulates pages here so loading more ADDS rows to the
144
144
  // groups (server pagination replaces `data` each fetch). Reset on fresh loads
145
145
  // (search / filter / sort / page-size). Only used in grouped + groupLoadMore mode.
146
- var _36 = (0, react_1.useState)([]), accumulatedRows = _36[0], setAccumulatedRows = _36[1];
146
+ var _35 = (0, react_1.useState)([]), accumulatedRows = _35[0], setAccumulatedRows = _35[1];
147
147
  var pendingLoadMoreRef = (0, react_1.useRef)(false);
148
+ // Pages loaded so far (1 = the initial page). The next page is derived from this
149
+ // counter — NOT from the deduped row count — so overlapping rows across pages
150
+ // (e.g. pinned rows that repeat on every page) don't stall the page index.
151
+ var loadedPagesRef = (0, react_1.useRef)(1);
148
152
  (0, react_1.useEffect)(function () {
149
153
  if (!groupLoadMore)
150
154
  return;
151
155
  setAccumulatedRows(function (prev) {
152
- if (prev.length === 0)
156
+ if (prev.length === 0) {
157
+ loadedPagesRef.current = 1;
153
158
  return tableData.slice();
159
+ }
154
160
  var accIds = new Set(prev.map(function (r) { return r.id; }));
155
161
  if (pendingLoadMoreRef.current) {
156
162
  // A "Load more" is in flight. The parent may re-emit the SAME page (new
@@ -166,10 +172,26 @@ function Table(_a) {
166
172
  // (the parent re-renders the current page often). Genuinely new rows
167
173
  // (search / filter / sort / page-size / reload) reset it.
168
174
  var allKnown = tableData.length > 0 && tableData.every(function (r) { return accIds.has(r.id); });
169
- return allKnown ? prev : tableData.slice();
175
+ if (allKnown)
176
+ return prev;
177
+ loadedPagesRef.current = 1; // fresh data set
178
+ return tableData.slice();
170
179
  });
171
180
  // eslint-disable-next-line react-hooks/exhaustive-deps
172
181
  }, [tableData, groupLoadMore]);
182
+ // Page-size change restarts the accumulation (the page boundaries change), so the
183
+ // next "Load more" requests page 2 of the NEW size, not a stale page index.
184
+ var rowsPerPageMountedRef = (0, react_1.useRef)(false);
185
+ (0, react_1.useEffect)(function () {
186
+ if (!rowsPerPageMountedRef.current) {
187
+ rowsPerPageMountedRef.current = true;
188
+ return;
189
+ }
190
+ pendingLoadMoreRef.current = false;
191
+ loadedPagesRef.current = 1;
192
+ setAccumulatedRows(tableData); // current page at the new size (not empty)
193
+ // eslint-disable-next-line react-hooks/exhaustive-deps
194
+ }, [rowsPerPage]);
173
195
  (0, react_1.useEffect)(function () {
174
196
  if (tablePreferences === null || tablePreferences === void 0 ? void 0 : tablePreferences.density)
175
197
  setDensityState(tablePreferences.density);
@@ -208,7 +230,10 @@ function Table(_a) {
208
230
  : isServerPagination
209
231
  ? loadMoreBase.length < totalRecords
210
232
  : false;
211
- var canGroupLoadMore = isGrouped && groupLoadMore && hasMoreEffective;
233
+ var groupLoadMoreActive = isGrouped && groupLoadMore;
234
+ // Keep the button while a load is in flight (so a transient empty `data` during
235
+ // fetching doesn't make it flicker); hide it once loading settles with no more.
236
+ var canGroupLoadMore = groupLoadMoreActive && (hasMoreEffective || isLoadingMore);
212
237
  var groupPalette = (0, react_1.useMemo)(function () { return (0, table_1.buildTablePalette)(theme); }, [theme]);
213
238
  var groupedSource = (0, react_1.useMemo)(function () {
214
239
  if (!isGrouped)
@@ -221,6 +246,18 @@ function Table(_a) {
221
246
  return undefined;
222
247
  return (0, table_1.groupRows)(groupedSource, groupByState).map(function (g) { return (__assign(__assign({}, g), { color: (0, table_1.pickTableColor)(g.value, groupPalette, groupColors === null || groupColors === void 0 ? void 0 : groupColors[g.value]) })); });
223
248
  }, [isGrouped, groupedSource, groupByState, groupPalette, groupColors]);
249
+ // "Select all" + header checkbox operate on the rows actually rendered: the
250
+ // accumulated grouped source when grouped, otherwise the table data.
251
+ var selectAllRows = isGrouped ? groupedSource : tableData;
252
+ selectAllRowsRef.current = isGrouped ? groupedSource : null;
253
+ var headerChecked = (0, react_1.useMemo)(function () {
254
+ if (selection.length === 0)
255
+ return false;
256
+ if (selectAllRows.length === 0)
257
+ return false;
258
+ var sel = new Set(selection);
259
+ return selectAllRows.every(function (r) { return sel.has(r.id); }) ? true : "indeterminate";
260
+ }, [selection, selectAllRows]);
224
261
  var onPaginationRef = (0, react_1.useRef)(onPagination);
225
262
  onPaginationRef.current = onPagination;
226
263
  var prevPageRef = (0, react_1.useRef)(currentPage);
@@ -253,15 +290,29 @@ function Table(_a) {
253
290
  var _a;
254
291
  if (isLoadingMore || isTableLoading || !hasMoreEffective)
255
292
  return;
256
- var chunk = loadMoreChunkSize !== null && loadMoreChunkSize !== void 0 ? loadMoreChunkSize : rowsPerPage;
257
- // Next page is derived from how many rows we've already accumulated, so each
258
- // click advances (fixes "always fromIndex 2") and the parent can replace `data`.
259
- var nextPage = Math.floor(loadMoreBase.length / (chunk || 1)) + 1;
293
+ // Must request the SAME page size the data was loaded with a page-count model
294
+ // breaks if pages have different sizes (e.g. page size 100 but a 20-row chunk
295
+ // re-requests already-loaded records). `loadMoreChunkSize` is only a last-resort
296
+ // fallback and is otherwise ignored.
297
+ var chunk = rowsPerPage || loadMoreChunkSize || 20;
298
+ // Advance by page COUNT (not by deduped row count) so overlapping/pinned rows
299
+ // across pages don't keep us stuck on the same page.
300
+ var nextPage = loadedPagesRef.current + 1;
301
+ loadedPagesRef.current = nextPage;
260
302
  var lastRecord = loadMoreBase.length > 0 ? loadMoreBase[loadMoreBase.length - 1] : undefined;
261
303
  pendingLoadMoreRef.current = true;
262
304
  (_a = onPaginationRef.current) === null || _a === void 0 ? void 0 : _a.call(onPaginationRef, nextPage, chunk, lastRecord, "next");
263
305
  };
264
- var groupLoadMoreCaption = totalRecords > 0 ? "Showing ".concat(loadMoreBase.length, " of ").concat(totalRecords) : undefined;
306
+ // While more can load live count; once everything's loaded "Showing all
307
+ // records" (the running total isn't shown because de-duped/server totals can
308
+ // disagree, e.g. "250 of 250" would be misleading).
309
+ var groupLoadMoreCaption = !groupLoadMoreActive || isTableLoading || loadMoreBase.length === 0
310
+ ? undefined
311
+ : canGroupLoadMore
312
+ ? totalRecords > 0
313
+ ? "Showing ".concat(loadMoreBase.length, " of ").concat(totalRecords)
314
+ : "Showing ".concat(loadMoreBase.length)
315
+ : "Showing all records";
265
316
  var tablePaginationText = (0, react_1.useMemo)(function () { return isServerPagination
266
317
  ? "".concat(startRow + 1, " - ").concat(Math.min(startRow + rowsPerPage, totalRecords), " of ").concat(totalRecords)
267
318
  : "".concat(startRow + 1, " - ").concat(endRow > tableData.length ? tableData.length : endRow, " of ").concat(tableData.length); }, [startRow, rowsPerPage, totalRecords, endRow, tableData.length]);
@@ -380,9 +431,9 @@ function Table(_a) {
380
431
  react_1.default.createElement(HeaderActions_1.default, { actions: headerActions, selections: selection }))),
381
432
  react_1.default.createElement(ActiveFilters_1.default, { columns: columnsList, columnsSearch: columnsSearch, setColumnsSearch: setColumnsSearch }),
382
433
  react_1.default.createElement(react_2.Box, { ml: "auto", display: "flex", alignItems: "center", gap: 2 },
383
- canGroupLoadMore && loadMorePosition === "top" && (react_1.default.createElement(react_2.Box, { display: "flex", alignItems: "center", gap: 2, flex: "0 0 auto" },
434
+ groupLoadMoreActive && loadMorePosition === "top" && (groupLoadMoreCaption || canGroupLoadMore) && (react_1.default.createElement(react_2.Box, { display: "flex", alignItems: "center", gap: 2, flex: "0 0 auto" },
384
435
  groupLoadMoreCaption && (react_1.default.createElement(react_2.Box, { fontSize: "0.75rem", color: (_x = (_w = theme.colors) === null || _w === void 0 ? void 0 : _w.text) === null || _x === void 0 ? void 0 : _x[500], whiteSpace: "nowrap" }, groupLoadMoreCaption)),
385
- react_1.default.createElement(Button_1.default, { size: "xs", variant: "outline", colorScheme: "gray", isLoading: isLoadingMore, loadingText: loadMoreText, onClick: handleGroupLoadMore, label: loadMoreText }))),
436
+ canGroupLoadMore && (react_1.default.createElement(Button_1.default, { size: "xs", variant: "outline", colorScheme: "gray", isLoading: isLoadingMore, loadingText: loadMoreText, onClick: handleGroupLoadMore, label: loadMoreText })))),
386
437
  (isPagination || isServerPagination) && !isGrouped && !canInfinite && !isCompactHeader && (react_1.default.createElement(react_2.Box, { flex: "0 0 auto" },
387
438
  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, paginationSelectOptions: paginationSelectOptions, isVisiblity: true }))),
388
439
  (isPagination || isServerPagination) && !isGrouped && !canInfinite && isCompactHeader && tableData.length > 0 && (react_1.default.createElement(react_2.Popover, { placement: "bottom-end" },
@@ -435,17 +486,13 @@ function Table(_a) {
435
486
  },
436
487
  } },
437
488
  react_1.default.createElement(react_3.Thead, { position: "sticky", top: 0, zIndex: 4, bg: (_2 = (_1 = (_0 = theme.colors.table) === null || _0 === void 0 ? void 0 : _0.hover) === null || _1 === void 0 ? void 0 : _1[200]) !== null && _2 !== void 0 ? _2 : (_3 = theme.colors.secondary) === null || _3 === void 0 ? void 0 : _3[50] },
438
- 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 : (_4 = theme.colors) === null || _4 === void 0 ? void 0 : _4.gray[600], freezedBgColor: freezedBgColor !== null && freezedBgColor !== void 0 ? freezedBgColor : theme.colors.backgroundColor.secondary, freezedTextColor: freezedTextColor !== null && freezedTextColor !== void 0 ? freezedTextColor : (_5 = theme.colors) === null || _5 === void 0 ? void 0 : _5.gray[600], handleSort: handleSort, headerRefs: headerRefs, columnWidths: columnWidths, columnsSort: columnsSort, noBorders: noBorders, handleCheckbox: handleCheckbox, isLoading: isTableLoading, checked: tableData.length !== 0 && selection.length === tableData.length
439
- ? true
440
- : selection.length === 0
441
- ? false
442
- : "indeterminate", isContent: isContent, isLink: isLink, isActionFreeze: isActionFreeze, setColumnsSearch: setColumnsSearch, columnsSearch: columnsSearch, isSelecting: isSelecting })),
489
+ react_1.default.createElement(TableHeader_1.default, { columns: columnsList, isCheckbox: isCheckbox, headerBgColor: headerBgColor !== null && headerBgColor !== void 0 ? headerBgColor : theme.colors.backgroundColor.muted, freezedBgColor: freezedBgColor !== null && freezedBgColor !== void 0 ? freezedBgColor : theme.colors.backgroundColor.secondary, freezedTextColor: freezedTextColor !== null && freezedTextColor !== void 0 ? freezedTextColor : (_4 = theme.colors) === null || _4 === void 0 ? void 0 : _4.gray[600], handleSort: handleSort, headerRefs: headerRefs, columnWidths: columnWidths, columnsSort: columnsSort, noBorders: noBorders, handleCheckbox: handleCheckbox, isLoading: isTableLoading, checked: headerChecked, isContent: isContent, isLink: isLink, isActionFreeze: isActionFreeze, setColumnsSearch: setColumnsSearch, columnsSearch: columnsSearch, isSelecting: isSelecting })),
443
490
  react_1.default.createElement(react_3.Tbody, null,
444
- react_1.default.createElement(TableBody_1.default, { data: isGrouped ? groupedSource : _filteredData, groups: renderGroups, onAddItem: onAddItem, columns: columnsList, startRow: isGrouped ? 0 : startRow, endRow: endRow, scrollContainerRef: tableContainerRef, isCheckbox: isCheckbox, columnWidths: columnWidths, noBorders: noBorders, freezedBgColor: freezedBgColor !== null && freezedBgColor !== void 0 ? freezedBgColor : theme.colors.backgroundColor.secondary, freezedTextColor: freezedTextColor !== null && freezedTextColor !== void 0 ? freezedTextColor : (_6 = theme.colors) === null || _6 === void 0 ? void 0 : _6.gray[600], handleCheckbox: handleCheckbox, selections: selection, isLoading: isTableLoading, loadingSkeletonRows: loadingSkeletonRows, onRowClick: onRowClick, isContent: isContent, isLink: isLink, isActionFreeze: isActionFreeze, density: densityState, stripe: stripe, emptyState: emptyState }))),
491
+ react_1.default.createElement(TableBody_1.default, { data: isGrouped ? groupedSource : _filteredData, groups: renderGroups, onAddItem: onAddItem, columns: columnsList, startRow: isGrouped ? 0 : startRow, endRow: endRow, scrollContainerRef: tableContainerRef, isCheckbox: isCheckbox, columnWidths: columnWidths, noBorders: noBorders, freezedBgColor: freezedBgColor !== null && freezedBgColor !== void 0 ? freezedBgColor : theme.colors.backgroundColor.secondary, freezedTextColor: freezedTextColor !== null && freezedTextColor !== void 0 ? freezedTextColor : (_5 = theme.colors) === null || _5 === void 0 ? void 0 : _5.gray[600], handleCheckbox: handleCheckbox, selections: selection, isLoading: isTableLoading, loadingSkeletonRows: loadingSkeletonRows, onRowClick: onRowClick, isContent: isContent, isLink: isLink, isActionFreeze: isActionFreeze, density: densityState, stripe: stripe, emptyState: emptyState }))),
445
492
  canInfinite && isLoadingMore && (react_1.default.createElement(react_2.Flex, { justify: "center", align: "center", py: 3, gap: 2 },
446
- react_1.default.createElement(react_2.Spinner, { size: "sm", color: (_8 = (_7 = theme.colors) === null || _7 === void 0 ? void 0 : _7.primary) === null || _8 === void 0 ? void 0 : _8[500] }),
447
- react_1.default.createElement(react_2.Box, { fontSize: "0.75rem", color: (_10 = (_9 = theme.colors) === null || _9 === void 0 ? void 0 : _9.text) === null || _10 === void 0 ? void 0 : _10[500] }, "Loading more\u2026")))),
448
- canGroupLoadMore && loadMorePosition === "bottom" && (react_1.default.createElement(react_2.Flex, { justify: "center", align: "center", gap: 3, py: 3, borderTop: "0.063rem solid ".concat((_11 = theme.colors.border) === null || _11 === void 0 ? void 0 : _11[500]) },
449
- groupLoadMoreCaption && (react_1.default.createElement(react_2.Box, { fontSize: "0.75rem", color: (_13 = (_12 = theme.colors) === null || _12 === void 0 ? void 0 : _12.text) === null || _13 === void 0 ? void 0 : _13[500] }, groupLoadMoreCaption)),
450
- react_1.default.createElement(Button_1.default, { size: "xs", variant: "outline", colorScheme: "gray", isLoading: isLoadingMore, loadingText: loadMoreText, onClick: handleGroupLoadMore, label: loadMoreText })))))));
493
+ react_1.default.createElement(react_2.Spinner, { size: "sm", color: (_7 = (_6 = theme.colors) === null || _6 === void 0 ? void 0 : _6.primary) === null || _7 === void 0 ? void 0 : _7[500] }),
494
+ react_1.default.createElement(react_2.Box, { fontSize: "0.75rem", color: (_9 = (_8 = theme.colors) === null || _8 === void 0 ? void 0 : _8.text) === null || _9 === void 0 ? void 0 : _9[500] }, "Loading more\u2026")))),
495
+ groupLoadMoreActive && loadMorePosition === "bottom" && (groupLoadMoreCaption || canGroupLoadMore) && (react_1.default.createElement(react_2.Flex, { justify: "center", align: "center", gap: 3, py: 3, borderTop: "0.063rem solid ".concat((_10 = theme.colors.border) === null || _10 === void 0 ? void 0 : _10[500]) },
496
+ groupLoadMoreCaption && (react_1.default.createElement(react_2.Box, { fontSize: "0.75rem", color: (_12 = (_11 = theme.colors) === null || _11 === void 0 ? void 0 : _11.text) === null || _12 === void 0 ? void 0 : _12[500] }, groupLoadMoreCaption)),
497
+ canGroupLoadMore && (react_1.default.createElement(Button_1.default, { size: "xs", variant: "outline", colorScheme: "gray", isLoading: isLoadingMore, loadingText: loadMoreText, onClick: handleGroupLoadMore, label: loadMoreText }))))))));
451
498
  }
@@ -38,6 +38,8 @@ export type TableProps = {
38
38
  groupLoadMore?: boolean;
39
39
  loadMoreText?: string;
40
40
  loadMorePosition?: "top" | "bottom";
41
+ /** @deprecated Ignored — load more always uses the current page size (`noOfRowsPerPage`)
42
+ * so page boundaries stay consistent. Kept only for backward compatibility. */
41
43
  loadMoreChunkSize?: number;
42
44
  noOfRowsPerPage?: number;
43
45
  totalRecords?: number;
@@ -121,7 +123,7 @@ export type ColumnSortingProps = {
121
123
  column: string | number;
122
124
  direction: "asc" | "desc" | "none";
123
125
  };
124
- export type TableHeaderPageProps = Pick<TableProps, "columns" | "isCheckbox" | "headerBgColor" | "headerTextColor" | "freezedBgColor" | "freezedTextColor" | "noBorders" | "isLoading" | "isActionFreeze"> & {
126
+ export type TableHeaderPageProps = Pick<TableProps, "columns" | "isCheckbox" | "headerBgColor" | "freezedBgColor" | "freezedTextColor" | "noBorders" | "isLoading" | "isActionFreeze"> & {
125
127
  handleSort: (label: string | number, type: "asc" | "desc" | "none") => void;
126
128
  activeHeader?: string | null;
127
129
  isPopoverOpen?: boolean;
@@ -170,7 +172,7 @@ export type TableFiltersProps = {
170
172
  columnsSearch: string;
171
173
  onClose: () => void;
172
174
  };
173
- export type ColumnHeaderProps = Pick<TableProps, "isCheckbox" | "headerBgColor" | "headerTextColor" | "freezedBgColor" | "freezedTextColor" | "noBorders"> & Pick<TableHeaderPageProps, "handleSort" | "columnsSort"> & {
175
+ export type ColumnHeaderProps = Pick<TableProps, "isCheckbox" | "headerBgColor" | "freezedBgColor" | "noBorders"> & Pick<TableHeaderPageProps, "handleSort" | "columnsSort"> & {
174
176
  header: TableHeaderProps;
175
177
  index: number;
176
178
  columnWidths: number[];
@@ -49,7 +49,7 @@ var Pagination = react_1.default.memo(function (_a) {
49
49
  var isLeftDisabled = dataLength === 0 || currentPage === 0;
50
50
  var isRightDisabled = dataLength === 0 || currentPage >= pages - 1;
51
51
  return (react_1.default.createElement(react_2.Flex, { justify: "flex-end", align: "center", flexWrap: "nowrap" },
52
- (!isServerPagination || paginationSelectOptions) && (react_1.default.createElement(react_2.Select, { onChange: handlePageSizeChange, value: rowsPerPage, size: "xs", borderRadius: 3, width: 20, isDisabled: dataLength === 0 },
52
+ (!isServerPagination || paginationSelectOptions) && (react_1.default.createElement(react_2.Select, { onChange: handlePageSizeChange, value: rowsPerPage, size: "xs", borderRadius: 3, width: "auto", minW: "4.5rem", isDisabled: dataLength === 0 },
53
53
  !paginationSelectOptions && dataLength < 100 ? react_1.default.createElement("option", { value: 0 }) : null,
54
54
  computedOptions.map(function (size, index) { return (react_1.default.createElement("option", { key: index, value: size }, String(size))); }))),
55
55
  dataLength > 0 && (react_1.default.createElement(react_2.Flex, { w: "100%" },
@@ -62,14 +62,14 @@ var StatusCell = function (_a) {
62
62
  var EMPTY_SX = {};
63
63
  var EMPTY_HOVER = {};
64
64
  var TableRow = react_2.default.memo(function (_a) {
65
- var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
65
+ var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
66
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]);
67
+ // Selected-row tint applied per-cell (NOT a blanket `& td` override) so status
68
+ // cells keep their solid color + white text instead of white-on-tint.
69
+ var selectedBg = (_d = (_c = (_b = theme.colors.primary) === null || _b === void 0 ? void 0 : _b.opacity) === null || _c === void 0 ? void 0 : _c[16]) !== null && _d !== void 0 ? _d : (_e = theme.colors.disabled) === null || _e === void 0 ? void 0 : _e[100];
70
+ // Sticky/frozen cells overlay scrolling content, so their selected background
71
+ // must be OPAQUE — paint the (translucent) tint over an opaque base.
72
+ var selectedFrozenBg = "linear-gradient(0deg, ".concat(selectedBg, ", ").concat(selectedBg, "), ").concat((_h = (_g = (_f = theme.colors) === null || _f === void 0 ? void 0 : _f.background) === null || _g === void 0 ? void 0 : _g[50]) !== null && _h !== void 0 ? _h : "#fff");
73
73
  // Measured-height virtualization: report this row's real height (main + any
74
74
  // expanded panel) so the windower can place variable/expandable rows exactly.
75
75
  var mainRowRef = (0, react_2.useRef)(null);
@@ -108,10 +108,13 @@ var TableRow = react_2.default.memo(function (_a) {
108
108
  }, [row, onRowClick]);
109
109
  var firstDataColIndex = columns.findIndex(function (c) { return !c.isHidden; });
110
110
  var accentSx = accentColor ? "inset 3px 0 0 ".concat(accentColor) : undefined;
111
+ // Pinned/frozen columns get a tinted, opaque background so the frozen pane reads
112
+ // as one piece with its header (and so sticky cells cover scrolling content).
113
+ var frozenCellBg = (_m = freezedBgColor !== null && freezedBgColor !== void 0 ? freezedBgColor : (_l = (_k = (_j = theme.colors) === null || _j === void 0 ? void 0 : _j.table) === null || _k === void 0 ? void 0 : _k.hover) === null || _l === void 0 ? void 0 : _l[100]) !== null && _m !== void 0 ? _m : (_p = (_o = theme.colors) === null || _o === void 0 ? void 0 : _o.background) === null || _p === void 0 ? void 0 : _p[100];
111
114
  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(react_1.Tr, { ref: mainRowRef, opacity: isLoading ? 0.4 : 1, pointerEvents: isLoading ? "none" : "auto", transition: "opacity 0.2s" },
116
+ isContent && (react_2.default.createElement(react_1.Td, { w: "6", p: 0, fontSize: 14, background: isChecked ? selectedFrozenBg : frozenCellBg, 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: (_q = theme.colors) === null || _q === void 0 ? void 0 : _q.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" })))),
117
+ isCheckbox && (react_2.default.createElement(react_1.Td, { w: "6", fontSize: 14, fontWeight: 600, color: (_s = (_r = theme.colors) === null || _r === void 0 ? void 0 : _r.background) === null || _s === void 0 ? void 0 : _s[50], textTransform: "capitalize", background: isChecked ? selectedFrozenBg : frozenCellBg, position: "sticky", borderBottom: borderStyle, boxShadow: !isContent ? accentSx : undefined, boxSizing: "border-box", left: 0, zIndex: 1, className: "columns sticky-columns" },
115
118
  react_2.default.createElement(Checkbox_1.default, { "aria-label": "Select all rows", onChange: function () { return handleCheckbox(row.id); }, isChecked: isChecked }))),
116
119
  columns.map(function (header, headerIndex) {
117
120
  var _a, _b, _c, _d, _e, _f, _g;
@@ -124,7 +127,7 @@ var TableRow = react_2.default.memo(function (_a) {
124
127
  var statusColor = isStatus
125
128
  ? (0, table_1.pickTableColor)(rawStatus, palette, (_b = header.statusColors) === null || _b === void 0 ? void 0 : _b[rawStatus])
126
129
  : 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
130
+ 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, background: isStatus && statusColor ? statusColor.solid : isChecked ? (isFrozen ? selectedFrozenBg : selectedBg) : isFrozen ? frozenCellBg : (_c = theme.colors.background) === null || _c === void 0 ? void 0 : _c[50], textOverflow: "ellipsis", boxShadow: isFirstDataCell ? accentSx : undefined, borderBottom: noBorders
128
131
  ? "none"
129
132
  : "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
133
  ? EMPTY_HOVER
@@ -132,7 +135,7 @@ var TableRow = react_2.default.memo(function (_a) {
132
135
  ? EMPTY_HOVER
133
136
  : 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
137
  }),
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 }))))),
138
+ isLink && (react_2.default.createElement(react_1.Td, { w: 2, p: 0, fontSize: 14, background: isChecked ? (isActionFreeze ? selectedFrozenBg : selectedBg) : isActionFreeze ? frozenCellBg : (_u = (_t = theme === null || theme === void 0 ? void 0 : theme.colors) === null || _t === void 0 ? void 0 : _t.background) === null || _u === void 0 ? void 0 : _u[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
139
  row.content && isExpanded && (react_2.default.createElement(react_1.Tr, { ref: expandedRowRef },
137
140
  react_2.default.createElement(react_1.Td, { colSpan: columns.length +
138
141
  (isCheckbox ? 1 : 0) +
@@ -70,19 +70,29 @@ var Harness = function (_a) {
70
70
  react_1.default.createElement(react_3.Tbody, null,
71
71
  react_1.default.createElement(TableBody_1.default, { data: makeData(count), columns: columns, startRow: 0, endRow: count, columnWidths: [120], isCheckbox: false, isContent: false, isLink: false, isActionFreeze: false, noBorders: false, selections: [], handleCheckbox: function () { }, scrollContainerRef: ref }))))));
72
72
  };
73
+ // Windowing math (normal density): ROW_HEIGHT=40, OVERSCAN=6, viewport falls
74
+ // back to 500px (jsdom clientHeight=0). Rows are unmeasured in jsdom, so every
75
+ // row is estimated at 40px. bottom = 0 + 500 + 6*40 = 740 -> last rendered row
76
+ // is the highest index with offset < 740 -> index 18 (offsets[18]=720). So rows
77
+ // 0..18 (19 rows) render and the trailing spacer reserves (100-19)*40 px.
78
+ var ROW_HEIGHT = 40;
79
+ var VISIBLE_COUNT = 19;
80
+ var LAST_VISIBLE = VISIBLE_COUNT - 1;
73
81
  describe("TableBody virtualization", function () {
74
82
  it("windows large pages and reserves height with spacer rows", function () {
75
83
  var _a = (0, react_2.render)(react_1.default.createElement(Harness, { count: 100 })), container = _a.container, queryByText = _a.queryByText;
76
- // jsdom clientHeight=0 -> 500px fallback -> ceil(500/45)+12 = 24 rows
77
84
  expect(queryByText("Row 0")).toBeInTheDocument();
78
- expect(queryByText("Row 23")).toBeInTheDocument();
85
+ expect(queryByText("Row ".concat(LAST_VISIBLE))).toBeInTheDocument();
79
86
  // Rows beyond the window are not mounted.
87
+ expect(queryByText("Row ".concat(LAST_VISIBLE + 1))).not.toBeInTheDocument();
80
88
  expect(queryByText("Row 50")).not.toBeInTheDocument();
81
89
  expect(queryByText("Row 99")).not.toBeInTheDocument();
82
90
  // A trailing spacer reserves the height of the unrendered rows.
83
91
  var spacers = container.querySelectorAll('tr[aria-hidden="true"]');
84
92
  expect(spacers.length).toBe(1);
85
- expect(spacers[0]).toHaveStyle({ height: "".concat((100 - 24) * 45, "px") });
93
+ expect(spacers[0]).toHaveStyle({
94
+ height: "".concat((100 - VISIBLE_COUNT) * ROW_HEIGHT, "px"),
95
+ });
86
96
  });
87
97
  it("renders every row and no spacers below the threshold", function () {
88
98
  var _a = (0, react_2.render)(react_1.default.createElement(Harness, { count: 30 })), container = _a.container, queryByText = _a.queryByText;
@@ -1,4 +1,4 @@
1
1
  import React from "react";
2
2
  import { TableHeaderPageProps } from "../TableProps";
3
- declare const _default: React.MemoExoticComponent<({ columns, isCheckbox, handleSort, headerRefs, columnWidths, columnsSort, headerBgColor, headerTextColor, freezedBgColor, freezedTextColor, noBorders, handleCheckbox, checked, isLoading, isContent, isLink, isActionFreeze, setColumnsSearch, columnsSearch, isSelecting, }: TableHeaderPageProps) => React.JSX.Element>;
3
+ declare const _default: React.MemoExoticComponent<({ columns, isCheckbox, handleSort, headerRefs, columnWidths, columnsSort, headerBgColor, freezedBgColor, freezedTextColor, noBorders, handleCheckbox, checked, isLoading, isContent, isLink, isActionFreeze, setColumnsSearch, columnsSearch, isSelecting, }: TableHeaderPageProps) => React.JSX.Element>;
4
4
  export default _default;
@@ -55,12 +55,12 @@ 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) {
58
- 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, isSelecting = _a.isSelecting;
58
+ var columns = _a.columns, isCheckbox = _a.isCheckbox, handleSort = _a.handleSort, headerRefs = _a.headerRefs, columnWidths = _a.columnWidths, columnsSort = _a.columnsSort, headerBgColor = _a.headerBgColor, 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, isSelecting = _a.isSelecting;
59
59
  var theme = (0, useCustomTheme_1.useCustomTheme)();
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
- 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], 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" }))));
62
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
63
+ return (react_2.default.createElement(react_1.Th, { w: 6, fontSize: 14, fontWeight: 600, color: freezedTextColor, textTransform: "capitalize", backgroundColor: (_d = (_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[200]) !== null && _d !== void 0 ? _d : (_f = (_e = theme.colors) === null || _e === void 0 ? void 0 : _e.secondary) === null || _f === void 0 ? void 0 : _f[50], position: "sticky", className: "columns sticky-columns", left: "0px", zIndex: 9, borderBottom: noBorders ? "none" : "0.063rem solid ".concat((_g = theme.colors) === null || _g === void 0 ? void 0 : _g.gray[300]) }, isSelecting ? (react_2.default.createElement(react_1.Spinner, { size: "sm", color: (_j = (_h = theme.colors) === null || _h === void 0 ? void 0 : _h.primary) === null || _j === void 0 ? void 0 : _j[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,
@@ -71,12 +71,12 @@ var TableHeader = function (_a) {
71
71
  theme.colors,
72
72
  ]);
73
73
  var RenderConent = (0, react_2.useCallback)(function () {
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], 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 }));
74
+ var _a, _b, _c, _d, _e, _f, _g;
75
+ return (react_2.default.createElement(react_1.Th, { w: 6, minW: "35px", p: 0, backgroundColor: (_d = (_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[200]) !== null && _d !== void 0 ? _d : (_f = (_e = theme.colors) === null || _e === void 0 ? void 0 : _e.secondary) === null || _f === void 0 ? void 0 : _f[50], borderBottom: noBorders ? "none" : "0.063rem solid ".concat((_g = theme.colors) === null || _g === void 0 ? void 0 : _g.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
- 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], 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 }));
78
+ var _a, _b, _c, _d, _e, _f, _g;
79
+ return (react_2.default.createElement(react_1.Th, { w: 2, p: 0, minW: "2.065rem", backgroundColor: (_d = (_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[200]) !== null && _d !== void 0 ? _d : (_f = (_e = theme.colors) === null || _e === void 0 ? void 0 : _e.secondary) === null || _f === void 0 ? void 0 : _f[50], borderBottom: noBorders ? "none" : "0.063rem solid ".concat((_g = theme.colors) === null || _g === void 0 ? void 0 : _g.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),
@@ -84,7 +84,7 @@ var TableHeader = function (_a) {
84
84
  columns.map(function (header, index) {
85
85
  if (header === null || header === void 0 ? void 0 : header.isHidden)
86
86
  return null;
87
- return (react_2.default.createElement(ColumnHeader, { header: header, index: index, key: header.label, columnWidths: columnWidths, handleSort: handleSort, isCheckbox: isCheckbox, headerBgColor: headerBgColor, headerTextColor: headerTextColor, freezedBgColor: freezedBgColor, freezedTextColor: freezedTextColor, noBorders: noBorders, columnsSort: columnsSort, headerRefs: headerRefs, columnsSearch: columnsSearch, setColumnsSearch: setColumnsSearch, openFilterId: openFilterId, setOpenFilterId: setOpenFilterId }));
87
+ return (react_2.default.createElement(ColumnHeader, { header: header, index: index, key: header.label, columnWidths: columnWidths, handleSort: handleSort, isCheckbox: isCheckbox, headerBgColor: headerBgColor, freezedBgColor: freezedBgColor, noBorders: noBorders, columnsSort: columnsSort, headerRefs: headerRefs, columnsSearch: columnsSearch, setColumnsSearch: setColumnsSearch, openFilterId: openFilterId, setOpenFilterId: setOpenFilterId }));
88
88
  }),
89
89
  isLink && react_2.default.createElement(RenderView, null)));
90
90
  };
@@ -100,7 +100,7 @@ var SortingIcon = (0, react_2.memo)(function (_a) {
100
100
  });
101
101
  var ColumnHeader = (0, react_2.memo)(function (_a) {
102
102
  var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
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;
103
+ var header = _a.header, index = _a.index, columnWidths = _a.columnWidths, isCheckbox = _a.isCheckbox, 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
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;
@@ -43,5 +43,6 @@ declare const useTable: ({ tableBorderColor, data, isPagination, selections, onS
43
43
  columnsList: TableHeaderProps[];
44
44
  handleColumnPreferences: (columns: any, extra?: Record<string, any>) => void;
45
45
  isSelecting: boolean;
46
+ selectAllRowsRef: import("react").MutableRefObject<DataObject[] | null>;
46
47
  };
47
48
  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) {
@@ -162,14 +162,26 @@ var useTable = function (_a) {
162
162
  selectionRef.current = selection;
163
163
  var onSelectionRef = (0, react_1.useRef)(onSelection);
164
164
  onSelectionRef.current = onSelection;
165
+ // Rows that "select all" should toggle. Defaults to `tableData`, but in grouped
166
+ // "load more" mode the parent points this at the accumulated/rendered rows so
167
+ // select-all covers everything on screen (not just the latest page).
168
+ var selectAllRowsRef = (0, react_1.useRef)(null);
165
169
  var handleCheckbox = (0, react_1.useCallback)(function (id) {
166
- var _a;
170
+ var _a, _b;
167
171
  var current = selectionRef.current;
168
172
  if (id === 0) {
173
+ var rows = (_a = selectAllRowsRef.current) !== null && _a !== void 0 ? _a : tableData;
174
+ var ids_1 = rows.map(function (item) { return item.id; });
175
+ var idSet_1 = new Set(ids_1);
176
+ var currentSet_1 = new Set(current);
177
+ var allSelected_1 = ids_1.length > 0 && ids_1.every(function (i) { return currentSet_1.has(i); });
169
178
  setIsSelecting(true);
170
179
  setTimeout(function () {
171
180
  var _a;
172
- var selectedItems = current.length === tableData.length ? [] : tableData.map(function (item) { return item.id; });
181
+ // Toggle the rendered rows while preserving any selection outside them.
182
+ var selectedItems = allSelected_1
183
+ ? current.filter(function (i) { return !idSet_1.has(i); })
184
+ : Array.from(new Set(__spreadArray(__spreadArray([], current, true), ids_1, true)));
173
185
  setSelection(selectedItems);
174
186
  (_a = onSelectionRef.current) === null || _a === void 0 ? void 0 : _a.call(onSelectionRef, selectedItems);
175
187
  setIsSelecting(false);
@@ -184,7 +196,7 @@ var useTable = function (_a) {
184
196
  selectedItems = __spreadArray(__spreadArray([], current, true), [id], false);
185
197
  }
186
198
  setSelection(selectedItems);
187
- (_a = onSelectionRef.current) === null || _a === void 0 ? void 0 : _a.call(onSelectionRef, selectedItems);
199
+ (_b = onSelectionRef.current) === null || _b === void 0 ? void 0 : _b.call(onSelectionRef, selectedItems);
188
200
  }
189
201
  }, [tableData]);
190
202
  var handleColumnPreferences = function (columns, extra) {
@@ -215,6 +227,7 @@ var useTable = function (_a) {
215
227
  columnsList: columnsList,
216
228
  handleColumnPreferences: handleColumnPreferences,
217
229
  isSelecting: isSelecting,
230
+ selectAllRowsRef: selectAllRowsRef,
218
231
  };
219
232
  };
220
233
  exports.default = useTable;
@@ -97,6 +97,7 @@ jest.mock("../../../Theme/useCustomTheme", function () { return ({
97
97
  },
98
98
  red: { 50: "#fee", 200: "#fcc", 600: "#c00" },
99
99
  border: { 200: "#e2e8f0" },
100
+ text: { 500: "#555", 700: "#333" },
100
101
  white: "#fff",
101
102
  },
102
103
  shadows: { sm: "0 1px 2px rgba(0,0,0,0.05)" },
@@ -1,12 +1,4 @@
1
- import React, { ElementType } from "react";
2
- interface ChipProps {
3
- label: string;
4
- onIconClick?: () => void;
5
- onTagClick?: () => void;
6
- icon?: ElementType;
7
- colorScheme?: "primary" | "secondary" | "tertiary" | "gray" | "red" | "orange" | "yellow" | "green" | "teal" | "blue" | "cyan" | "purple" | "pink";
8
- size?: "sm" | "md" | "lg";
9
- variant?: "solid" | "outline";
10
- }
11
- declare const Tag: React.FC<ChipProps>;
1
+ import React from "react";
2
+ import { TagProps } from "./TagProps";
3
+ declare const Tag: React.FC<TagProps>;
12
4
  export default Tag;
@@ -5,11 +5,19 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  var react_1 = __importDefault(require("react"));
7
7
  var react_2 = require("@chakra-ui/react");
8
+ // Icon size scales with the tag size so the right icon stays proportional.
9
+ var ICON_SIZE = {
10
+ xs: "0.75rem",
11
+ sm: "0.875rem",
12
+ md: "1em",
13
+ lg: "1.1em",
14
+ };
8
15
  var Tag = function (_a) {
9
16
  var label = _a.label, _b = _a.colorScheme, colorScheme = _b === void 0 ? "primary" : _b, _c = _a.variant, variant = _c === void 0 ? "solid" : _c, _d = _a.size, size = _d === void 0 ? "md" : _d, icon = _a.icon, onTagClick = _a.onTagClick, onIconClick = _a.onIconClick;
10
- return (react_1.default.createElement(react_2.Tag, { size: size, variant: variant, colorScheme: colorScheme, borderRadius: "full", cursor: "pointer", onClick: function () { return onTagClick === null || onTagClick === void 0 ? void 0 : onTagClick(); } },
17
+ var isInteractive = !!onTagClick;
18
+ return (react_1.default.createElement(react_2.Tag, { size: size, variant: variant, colorScheme: colorScheme, borderRadius: "full", cursor: isInteractive ? "pointer" : "default", role: isInteractive ? "button" : undefined, "aria-label": isInteractive ? label : undefined, onClick: function () { return onTagClick === null || onTagClick === void 0 ? void 0 : onTagClick(); } },
11
19
  react_1.default.createElement(react_2.TagLabel, null, label),
12
- icon && (react_1.default.createElement(react_2.TagRightIcon, { as: icon, boxSize: "1em", cursor: onIconClick ? "pointer" : "default", onClick: function (e) {
20
+ icon && (react_1.default.createElement(react_2.TagRightIcon, { as: icon, boxSize: ICON_SIZE[size], cursor: onIconClick ? "pointer" : "default", onClick: function (e) {
13
21
  e.stopPropagation();
14
22
  onIconClick === null || onIconClick === void 0 ? void 0 : onIconClick();
15
23
  }, transition: "all 0.2s ease", _hover: {
@@ -1,2 +1,2 @@
1
- import { ComponentStyleConfig } from "@chakra-ui/react";
2
- export declare const Tag: ComponentStyleConfig;
1
+ import { ComponentMultiStyleConfig } from "@chakra-ui/react";
2
+ export declare const Tag: ComponentMultiStyleConfig;