@easyvision/easyvision-ui 1.5.1 → 1.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -518,6 +518,23 @@ interface EasyVisionTableProps<T> extends BaseStatefulProps {
518
518
  getRowId?: (row: T) => string;
519
519
  itemsPerPage?: number;
520
520
  itemsPerPageOptions?: number[];
521
+ /**
522
+ * Controls how the pagination footer is displayed. Independent of
523
+ * `paginationMode` (which decides where slicing happens — local or api).
524
+ *
525
+ * - `'always'` (default): full footer — rows-per-page selector, item count,
526
+ * page selector + nav. Matches the historical behavior.
527
+ * - `'fixedItemsPerPage'`: rows-per-page selector is hidden (the value is
528
+ * considered fixed). Item count is always visible. Page selector + nav
529
+ * appear only when `totalCount > itemsPerPage`. Good for tables where
530
+ * the page size is a deliberate product choice but you still want
531
+ * pagination on overflow.
532
+ * - `'fixedTotalItems'`: the footer is not rendered at all. Pair with a
533
+ * large `itemsPerPage` so every row fits in a single page. Good for
534
+ * short, naturally-bounded lists (a product's plans, conditions,
535
+ * periods, …) where pagination is just noise.
536
+ */
537
+ paginationDisplay?: 'always' | 'fixedItemsPerPage' | 'fixedTotalItems';
521
538
  enableRowSelection?: boolean;
522
539
  selectAllScope?: 'page' | 'all' | 'toggleable';
523
540
  /**
package/dist/index.d.ts CHANGED
@@ -518,6 +518,23 @@ interface EasyVisionTableProps<T> extends BaseStatefulProps {
518
518
  getRowId?: (row: T) => string;
519
519
  itemsPerPage?: number;
520
520
  itemsPerPageOptions?: number[];
521
+ /**
522
+ * Controls how the pagination footer is displayed. Independent of
523
+ * `paginationMode` (which decides where slicing happens — local or api).
524
+ *
525
+ * - `'always'` (default): full footer — rows-per-page selector, item count,
526
+ * page selector + nav. Matches the historical behavior.
527
+ * - `'fixedItemsPerPage'`: rows-per-page selector is hidden (the value is
528
+ * considered fixed). Item count is always visible. Page selector + nav
529
+ * appear only when `totalCount > itemsPerPage`. Good for tables where
530
+ * the page size is a deliberate product choice but you still want
531
+ * pagination on overflow.
532
+ * - `'fixedTotalItems'`: the footer is not rendered at all. Pair with a
533
+ * large `itemsPerPage` so every row fits in a single page. Good for
534
+ * short, naturally-bounded lists (a product's plans, conditions,
535
+ * periods, …) where pagination is just noise.
536
+ */
537
+ paginationDisplay?: 'always' | 'fixedItemsPerPage' | 'fixedTotalItems';
521
538
  enableRowSelection?: boolean;
522
539
  selectAllScope?: 'page' | 'all' | 'toggleable';
523
540
  /**
package/dist/index.js CHANGED
@@ -5,7 +5,7 @@ import { createContext, forwardRef, useMemo, useSyncExternalStore, useRef, useEf
5
5
  import { ChevronDown, ChevronUp, Check, Search, X, Plus, ChevronRight, Circle, Calendar as Calendar$1, ChevronLeft, ChevronsUpDown, Loader2, ArrowUp, ArrowDown, ArrowUpDown, Settings2 } from 'lucide-react';
6
6
  import { clsx } from 'clsx';
7
7
  import { twMerge } from 'tailwind-merge';
8
- import { jsx, jsxs } from 'react/jsx-runtime';
8
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
9
9
  import { createStore } from 'zustand/vanilla';
10
10
  import * as SelectPrimitive from '@radix-ui/react-select';
11
11
  import { Slot } from '@radix-ui/react-slot';
@@ -1864,30 +1864,36 @@ function PaginationFooter({
1864
1864
  itemsPerPageOptions,
1865
1865
  onPageChange,
1866
1866
  onItemsPerPageChange,
1867
- labels
1867
+ labels,
1868
+ display = "always"
1868
1869
  }) {
1869
1870
  const totalPages = Math.max(1, Math.ceil(totalCount / itemsPerPage));
1871
+ const fitsInOnePage = totalCount <= itemsPerPage;
1872
+ const showRowsPerPage = display === "always";
1873
+ const showPageNav = display === "always" || !fitsInOnePage;
1870
1874
  return /* @__PURE__ */ jsxs("div", { className: "ev-table-footer", children: [
1871
1875
  /* @__PURE__ */ jsxs("div", { className: "ev-table-footer-section", children: [
1872
- /* @__PURE__ */ jsx("span", { children: labels.rowsPerPage }),
1873
- /* @__PURE__ */ jsxs(
1874
- Select,
1875
- {
1876
- value: String(itemsPerPage),
1877
- onValueChange: (v) => onItemsPerPageChange(Number(v)),
1878
- children: [
1879
- /* @__PURE__ */ jsx(SelectTrigger, { className: "ev-table-footer-ipp", children: /* @__PURE__ */ jsx(SelectValue, {}) }),
1880
- /* @__PURE__ */ jsx(SelectContent, { children: itemsPerPageOptions.map((opt) => /* @__PURE__ */ jsx(SelectItem, { value: String(opt), children: opt }, opt)) })
1881
- ]
1882
- }
1883
- ),
1876
+ showRowsPerPage && /* @__PURE__ */ jsxs(Fragment, { children: [
1877
+ /* @__PURE__ */ jsx("span", { children: labels.rowsPerPage }),
1878
+ /* @__PURE__ */ jsxs(
1879
+ Select,
1880
+ {
1881
+ value: String(itemsPerPage),
1882
+ onValueChange: (v) => onItemsPerPageChange(Number(v)),
1883
+ children: [
1884
+ /* @__PURE__ */ jsx(SelectTrigger, { className: "ev-table-footer-ipp", children: /* @__PURE__ */ jsx(SelectValue, {}) }),
1885
+ /* @__PURE__ */ jsx(SelectContent, { children: itemsPerPageOptions.map((opt) => /* @__PURE__ */ jsx(SelectItem, { value: String(opt), children: opt }, opt)) })
1886
+ ]
1887
+ }
1888
+ )
1889
+ ] }),
1884
1890
  /* @__PURE__ */ jsxs("span", { children: [
1885
1891
  totalCount,
1886
1892
  " ",
1887
1893
  labels.results
1888
1894
  ] })
1889
1895
  ] }),
1890
- /* @__PURE__ */ jsxs("div", { className: "ev-table-footer-section", children: [
1896
+ showPageNav && /* @__PURE__ */ jsxs("div", { className: "ev-table-footer-section", children: [
1891
1897
  /* @__PURE__ */ jsx("span", { children: labels.page }),
1892
1898
  /* @__PURE__ */ jsxs(
1893
1899
  Select,
@@ -2130,6 +2136,7 @@ function EasyVisionTable(props) {
2130
2136
  getRowId: getRowIdProp,
2131
2137
  itemsPerPage: itemsPerPageProp = 10,
2132
2138
  itemsPerPageOptions = [10, 15, 20],
2139
+ paginationDisplay = "always",
2133
2140
  enableRowSelection = false,
2134
2141
  selectAllScope = "toggleable",
2135
2142
  selectAllResolution = "lazy",
@@ -2749,7 +2756,7 @@ function EasyVisionTable(props) {
2749
2756
  ] })
2750
2757
  }
2751
2758
  ),
2752
- /* @__PURE__ */ jsx(
2759
+ paginationDisplay !== "fixedTotalItems" && /* @__PURE__ */ jsx(
2753
2760
  PaginationFooter,
2754
2761
  {
2755
2762
  currentPage: page,
@@ -2758,7 +2765,8 @@ function EasyVisionTable(props) {
2758
2765
  itemsPerPageOptions,
2759
2766
  onPageChange: (p) => patch({ page: p }),
2760
2767
  onItemsPerPageChange: (n) => patch({ itemsPerPage: n, page: 1 }),
2761
- labels
2768
+ labels,
2769
+ display: paginationDisplay
2762
2770
  }
2763
2771
  )
2764
2772
  ] })