react-better-html 1.1.104 → 1.1.106

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -6823,7 +6823,7 @@ var TableStyledComponent = styled10.table.withConfig({
6823
6823
  ${(props) => props.withHover ? css2`
6824
6824
  transition: ${props.theme.styles.transition};
6825
6825
 
6826
- &:not(.isHeader):hover {
6826
+ &:not(.isHeader):not(.isFooter):not(.withoutHover):hover {
6827
6827
  filter: brightness(${props.colorTheme === "light" ? "0.95" : "0.85"});
6828
6828
  }
6829
6829
  ` : ""}
@@ -6879,6 +6879,7 @@ var TableComponent = forwardRef15(function Table({
6879
6879
  withStickyHeader,
6880
6880
  noDataItemsMessage = "No data available",
6881
6881
  pageSize,
6882
+ pageCount,
6882
6883
  onClickRow,
6883
6884
  onClickAllCheckboxes,
6884
6885
  onChangePage,
@@ -7148,14 +7149,14 @@ var TableComponent = forwardRef15(function Table({
7148
7149
  []
7149
7150
  );
7150
7151
  }, [data, openedFilterColumn]);
7151
- const pagesCount = pageSize !== void 0 ? Math.ceil(dataAfterPagination.length / pageSize) : 1;
7152
+ const pageCountInternal = pageCount ?? (pageSize !== void 0 ? Math.ceil(dataAfterPagination.length / pageSize) : 1);
7152
7153
  const paginationItems = useMemo7(() => {
7153
7154
  const halfRange = Math.floor(maximumVisiblePages / 2);
7154
7155
  let startPage = Math.max(1, currentPage - halfRange);
7155
- let endPage = Math.min(pagesCount, currentPage + halfRange);
7156
+ let endPage = Math.min(pageCountInternal, currentPage + halfRange);
7156
7157
  if (endPage - startPage + 1 < maximumVisiblePages) {
7157
7158
  startPage = Math.max(1, endPage - maximumVisiblePages + 1);
7158
- endPage = Math.min(pagesCount, startPage + maximumVisiblePages - 1);
7159
+ endPage = Math.min(pageCountInternal, startPage + maximumVisiblePages - 1);
7159
7160
  }
7160
7161
  return Array.from(
7161
7162
  {
@@ -7163,10 +7164,10 @@ var TableComponent = forwardRef15(function Table({
7163
7164
  },
7164
7165
  (_, index) => startPage + index
7165
7166
  );
7166
- }, [pagesCount, currentPage]);
7167
+ }, [pageCountInternal, currentPage]);
7167
7168
  const onClickNextPage = useCallback10(() => {
7168
- setCurrentPage((oldValue) => oldValue >= pagesCount ? pagesCount : oldValue + 1);
7169
- }, [pagesCount]);
7169
+ setCurrentPage((oldValue) => oldValue >= pageCountInternal ? pageCountInternal : oldValue + 1);
7170
+ }, [pageCountInternal]);
7170
7171
  const onClickPreviousPage = useCallback10(() => {
7171
7172
  setCurrentPage((oldValue) => oldValue <= 1 ? 1 : oldValue - 1);
7172
7173
  }, []);
@@ -7187,13 +7188,13 @@ var TableComponent = forwardRef15(function Table({
7187
7188
  return {
7188
7189
  currentPage,
7189
7190
  setCurrentPage,
7190
- pagesCount,
7191
+ pagesCount: pageCountInternal,
7191
7192
  setCheckedItems
7192
7193
  };
7193
7194
  },
7194
- [currentPage, setCurrentPage, pagesCount, setCheckedItems]
7195
+ [currentPage, setCurrentPage, pageCountInternal, setCheckedItems]
7195
7196
  );
7196
- const mobileFooterBreakingPoint = mediumScreen.size700 && pagesCount > maximumVisiblePages / 1.4;
7197
+ const mobileFooterBreakingPoint = mediumScreen.size700 && pageCountInternal > maximumVisiblePages / 1.4;
7197
7198
  return /* @__PURE__ */ jsxs16(Fragment5, { children: [
7198
7199
  /* @__PURE__ */ jsx20(
7199
7200
  Div_default,
@@ -7248,7 +7249,7 @@ var TableComponent = forwardRef15(function Table({
7248
7249
  },
7249
7250
  column.type + column.label + index
7250
7251
  )) }) }),
7251
- /* @__PURE__ */ jsx20("tbody", { children: isLoading ? /* @__PURE__ */ jsx20("tr", { children: /* @__PURE__ */ jsx20("td", { className: "noData", colSpan: columns.length, children: /* @__PURE__ */ jsx20(Loader_default.box, {}) }) }) : dataAfterPagination.length > 0 ? dataAfterPagination.map((item, rowIndex) => /* @__PURE__ */ jsx20(
7252
+ /* @__PURE__ */ jsx20("tbody", { children: isLoading ? /* @__PURE__ */ jsx20("tr", { className: "withoutHover", children: /* @__PURE__ */ jsx20("td", { className: "noData", colSpan: columns.length, children: /* @__PURE__ */ jsx20(Loader_default.box, {}) }) }) : dataAfterPagination.length > 0 ? dataAfterPagination.map((item, rowIndex) => /* @__PURE__ */ jsx20(
7252
7253
  "tr",
7253
7254
  {
7254
7255
  className: onClickRow ? "isClickable" : void 0,
@@ -7256,7 +7257,7 @@ var TableComponent = forwardRef15(function Table({
7256
7257
  children: columns.map((column, colIndex) => /* @__PURE__ */ jsx20(TdStyledComponent, { textAlign: column.align, children: renderCellContent(column, item, rowIndex) }, column.type + column.label + colIndex))
7257
7258
  },
7258
7259
  JSON.stringify(item) + rowIndex
7259
- )) : /* @__PURE__ */ jsx20("tr", { children: /* @__PURE__ */ jsx20("td", { className: "noData", colSpan: columns.length, children: /* @__PURE__ */ jsx20(Text_default.unknown, { children: noDataItemsMessage }) }) }) }),
7260
+ )) : /* @__PURE__ */ jsx20("tr", { className: "withoutHover", children: /* @__PURE__ */ jsx20("td", { className: "noData", colSpan: columns.length, children: /* @__PURE__ */ jsx20(Text_default.unknown, { children: noDataItemsMessage }) }) }) }),
7260
7261
  pageSize !== void 0 && /* @__PURE__ */ jsx20("tfoot", { children: /* @__PURE__ */ jsx20("tr", { className: "isFooter", children: /* @__PURE__ */ jsx20("td", { colSpan: columns.length, children: /* @__PURE__ */ jsxs16(
7261
7262
  Div_default.column,
7262
7263
  {
@@ -7277,12 +7278,12 @@ var TableComponent = forwardRef15(function Table({
7277
7278
  children: [
7278
7279
  currentPage,
7279
7280
  " / ",
7280
- pagesCount
7281
+ pageCountInternal
7281
7282
  ]
7282
7283
  }
7283
7284
  ),
7284
7285
  /* @__PURE__ */ jsxs16(Div_default.row, { alignItems: "center", justifyContent: "center", gap: theme2.styles.gap * 2, children: [
7285
- pagesCount > maximumVisiblePages && /* @__PURE__ */ jsx20(
7286
+ pageCountInternal > maximumVisiblePages && /* @__PURE__ */ jsx20(
7286
7287
  Button_default.icon,
7287
7288
  {
7288
7289
  icon: "doubleChevronLeft",
@@ -7334,17 +7335,17 @@ var TableComponent = forwardRef15(function Table({
7334
7335
  Button_default.icon,
7335
7336
  {
7336
7337
  icon: "chevronRight",
7337
- disabled: currentPage === pagesCount,
7338
+ disabled: currentPage === pageCountInternal,
7338
7339
  onClick: onClickNextPage
7339
7340
  }
7340
7341
  ),
7341
- pagesCount > maximumVisiblePages && /* @__PURE__ */ jsx20(
7342
+ pageCountInternal > maximumVisiblePages && /* @__PURE__ */ jsx20(
7342
7343
  Button_default.icon,
7343
7344
  {
7344
7345
  icon: "doubleChevronRight",
7345
- disabled: currentPage === pagesCount,
7346
+ disabled: currentPage === pageCountInternal,
7346
7347
  onClickWithValue: setCurrentPage,
7347
- value: pagesCount
7348
+ value: pageCountInternal
7348
7349
  }
7349
7350
  )
7350
7351
  ] })