@pibit.ai/cure-design-system 0.6.60 → 0.6.61

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.
@@ -1,5 +1,4 @@
1
- import { __require as r } from "../node_modules/react-is/index.js";
2
- var a = r();
1
+ var e = { exports: {} };
3
2
  export {
4
- a as r
3
+ e as __module
5
4
  };
@@ -1,4 +1,5 @@
1
- var e = { exports: {} };
1
+ import { __require as r } from "../node_modules/react-is/index.js";
2
+ var a = r();
2
3
  export {
3
- e as __module
4
+ a as r
4
5
  };
@@ -1,5 +1,5 @@
1
1
  import { Children as p } from "react";
2
- import { r as y } from "../../../../_virtual/index.js";
2
+ import { r as y } from "../../../../_virtual/index2.js";
3
3
  import { isNullish as m } from "./DataUtils.js";
4
4
  import { get as f } from "../../../es-toolkit/dist/compat/object/get.js";
5
5
  var u = (r) => typeof r == "string" ? r : r ? r.displayName || r.name || "Component" : "", l = null, n = null, o = (r) => {
@@ -1,4 +1,4 @@
1
- import { __module as r } from "../../../_virtual/index2.js";
1
+ import { __module as r } from "../../../_virtual/index.js";
2
2
  import { __require as o } from "../cjs/use-sync-external-store-shim.production.js";
3
3
  import { __require as i } from "../cjs/use-sync-external-store-shim.development.js";
4
4
  var e;
@@ -1,22 +1,34 @@
1
1
  export type TablePaginationConfig = {
2
2
  currentPage: number;
3
3
  pageSize: number;
4
- totalPages: number;
5
- totalItems: number;
4
+ /** Omitted: the page control falls back to its own default. */
5
+ totalPages?: number;
6
+ /** Omitted: the "Total rows" count is not shown. */
7
+ totalItems?: number;
6
8
  onPageChange: (page: number) => void;
7
- onPageSizeChange: (size: number | string) => void;
9
+ onPageSizeChange: (size: number) => void;
8
10
  /** Whether pagination should actually render. Default: true. */
9
11
  showPagination?: boolean;
10
12
  };
11
13
  export interface TablePaginationProps extends TablePaginationConfig {
12
14
  loading?: boolean;
13
15
  rootClassName?: string;
16
+ /** Render nothing when `totalItems` is 0. Default: true. */
17
+ hideWhenEmpty?: boolean;
18
+ /**
19
+ * Wait this long after a page-size pick before calling `onPageSizeChange`, so
20
+ * a burst of picks makes one change (and one request). Default: 0, immediate.
21
+ * The select keeps showing `pageSize` until the parent passes the new one.
22
+ */
23
+ pageSizeChangeDelayMs?: number;
24
+ /** data-testid for the "Total rows" text. */
25
+ totalRowsTestId?: string;
14
26
  }
15
27
  /**
16
28
  * Table footer pagination — page-size select, total count, and page controls.
17
29
  * Matches the `TableWrapperPaginationConfig` contract used in platform-ui.
18
30
  */
19
- export declare function TablePagination({ currentPage, pageSize, totalPages, totalItems, onPageChange, onPageSizeChange, showPagination, loading, rootClassName, }: TablePaginationProps): import("react/jsx-runtime").JSX.Element | null;
31
+ export declare function TablePagination({ currentPage, pageSize, totalPages, totalItems, onPageChange, onPageSizeChange, showPagination, loading, rootClassName, hideWhenEmpty, pageSizeChangeDelayMs, totalRowsTestId, }: TablePaginationProps): import("react/jsx-runtime").JSX.Element | null;
20
32
  export declare namespace TablePagination {
21
33
  var displayName: string;
22
34
  }
@@ -1 +1 @@
1
- {"version":3,"file":"TablePagination.d.ts","sourceRoot":"","sources":["../../../src/patterns/table/TablePagination.tsx"],"names":[],"mappings":"AAIA,MAAM,MAAM,qBAAqB,GAAG;IAClC,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC,gBAAgB,EAAE,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,KAAK,IAAI,CAAC;IAClD,gEAAgE;IAChE,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B,CAAC;AAEF,MAAM,WAAW,oBAAqB,SAAQ,qBAAqB;IACjE,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AASD;;;GAGG;AACH,wBAAgB,eAAe,CAAC,EAC9B,WAAW,EACX,QAAQ,EACR,UAAU,EACV,UAAU,EACV,YAAY,EACZ,gBAAgB,EAChB,cAAqB,EACrB,OAAe,EACf,aAAa,GACd,EAAE,oBAAoB,kDAwCtB;yBAlDe,eAAe"}
1
+ {"version":3,"file":"TablePagination.d.ts","sourceRoot":"","sources":["../../../src/patterns/table/TablePagination.tsx"],"names":[],"mappings":"AAMA,MAAM,MAAM,qBAAqB,GAAG;IAClC,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,+DAA+D;IAC/D,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,oDAAoD;IACpD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC,gBAAgB,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACzC,gEAAgE;IAChE,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B,CAAC;AAEF,MAAM,WAAW,oBAAqB,SAAQ,qBAAqB;IACjE,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,4DAA4D;IAC5D,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB;;;;OAIG;IACH,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,6CAA6C;IAC7C,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AASD;;;GAGG;AACH,wBAAgB,eAAe,CAAC,EAC9B,WAAW,EACX,QAAQ,EACR,UAAU,EACV,UAAU,EACV,YAAY,EACZ,gBAAgB,EAChB,cAAqB,EACrB,OAAe,EACf,aAAa,EACb,aAAoB,EACpB,qBAAyB,EACzB,eAAe,GAChB,EAAE,oBAAoB,kDA0EtB;yBAvFe,eAAe"}
@@ -1,60 +1,82 @@
1
- import { jsxs as a, jsx as e } from "react/jsx-runtime";
2
- import { cn as x } from "../../utils/cn.js";
3
- import { PaginationCardDefault as f } from "./pagination-card.js";
4
- import { Select as i } from "../../primitives/select/select.js";
5
- const b = [
1
+ import { jsxs as s, jsx as t } from "react/jsx-runtime";
2
+ import { useRef as c, useEffect as g } from "react";
3
+ import { cn as v } from "../../utils/cn.js";
4
+ import { PaginationCardDefault as y } from "./pagination-card.js";
5
+ import { Select as d } from "../../primitives/select/select.js";
6
+ const R = [
6
7
  { label: "10", id: "10" },
7
8
  { label: "20", id: "20" },
8
9
  { label: "50", id: "50" },
9
10
  { label: "100", id: "100" }
10
11
  ];
11
- function h({
12
- currentPage: n,
13
- pageSize: s,
14
- totalPages: o,
15
- totalItems: l,
16
- onPageChange: m,
17
- onPageSizeChange: c,
18
- showPagination: d = !0,
19
- loading: r = !1,
20
- rootClassName: p
12
+ function E({
13
+ currentPage: x,
14
+ pageSize: l,
15
+ totalPages: p,
16
+ totalItems: a,
17
+ onPageChange: b,
18
+ onPageSizeChange: i,
19
+ showPagination: N = !0,
20
+ loading: o = !1,
21
+ rootClassName: h,
22
+ hideWhenEmpty: w = !0,
23
+ pageSizeChangeDelayMs: u = 0,
24
+ totalRowsTestId: S
21
25
  }) {
22
- return !d || l === 0 ? null : /* @__PURE__ */ a("div", { className: x("flex items-center justify-between border-t border-secondary pt-2", p), children: [
23
- /* @__PURE__ */ a("div", { className: "flex items-center gap-2", children: [
24
- /* @__PURE__ */ e("p", { className: "text-xs font-normal text-tertiary", children: "Show rows per page" }),
25
- /* @__PURE__ */ e(
26
- i,
26
+ const e = c(null), m = c(l), f = c(i);
27
+ if (m.current = l, f.current = i, g(
28
+ () => () => {
29
+ e.current && clearTimeout(e.current);
30
+ },
31
+ []
32
+ ), !N || w && a === 0) return null;
33
+ const T = (n) => {
34
+ const r = Number(n);
35
+ if (!(n == null || !Number.isFinite(r) || r <= 0) && (e.current && (clearTimeout(e.current), e.current = null), r !== l)) {
36
+ if (u <= 0) {
37
+ i(r);
38
+ return;
39
+ }
40
+ e.current = setTimeout(() => {
41
+ e.current = null, r !== m.current && f.current(r);
42
+ }, u);
43
+ }
44
+ };
45
+ return /* @__PURE__ */ s("div", { className: v("flex items-center justify-between border-t border-secondary pt-2", h), children: [
46
+ /* @__PURE__ */ s("div", { className: "flex items-center gap-2", children: [
47
+ /* @__PURE__ */ t("p", { className: "text-xs font-normal text-tertiary", children: "Show rows per page" }),
48
+ /* @__PURE__ */ t(
49
+ d,
27
50
  {
28
- isDisabled: r,
51
+ "aria-label": "Rows per page",
52
+ isDisabled: o,
29
53
  size: "sm",
30
- value: s.toString(),
31
- items: b,
32
- onSelectionChange: (t) => {
33
- t != null && c(t);
34
- },
54
+ value: l.toString(),
55
+ items: R,
56
+ onSelectionChange: T,
35
57
  className: "w-auto min-w-10",
36
58
  popoverClassName: "w-20",
37
59
  textStyles: "text-xs align-center",
38
- children: (t) => /* @__PURE__ */ e(i.Item, { id: t.id, textStyles: "text-xs font-normal", children: t.label })
60
+ children: (n) => /* @__PURE__ */ t(d.Item, { id: n.id, textStyles: "text-xs font-normal", children: n.label })
39
61
  }
40
62
  ),
41
- /* @__PURE__ */ a("p", { className: "ml-4 text-xs", children: [
42
- /* @__PURE__ */ e("span", { className: "font-normal text-tertiary", children: "Total rows " }),
43
- /* @__PURE__ */ e("span", { className: "font-medium text-primary", children: l.toLocaleString() })
63
+ a != null && /* @__PURE__ */ s("p", { className: "ml-4 text-xs", "data-testid": S, children: [
64
+ /* @__PURE__ */ t("span", { className: "font-normal text-tertiary", children: "Total rows " }),
65
+ /* @__PURE__ */ t("span", { className: "font-medium text-primary", children: a.toLocaleString() })
44
66
  ] })
45
67
  ] }),
46
- /* @__PURE__ */ e("div", { className: "relative", children: /* @__PURE__ */ e(
47
- f,
68
+ /* @__PURE__ */ t("div", { className: "relative", children: /* @__PURE__ */ t(
69
+ y,
48
70
  {
49
- loading: r,
50
- page: n,
51
- total: o,
52
- onPageChange: m
71
+ loading: o,
72
+ page: x,
73
+ total: p,
74
+ onPageChange: b
53
75
  }
54
76
  ) })
55
77
  ] });
56
78
  }
57
- h.displayName = "TablePagination";
79
+ E.displayName = "TablePagination";
58
80
  export {
59
- h as TablePagination
81
+ E as TablePagination
60
82
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pibit.ai/cure-design-system",
3
- "version": "0.6.60",
3
+ "version": "0.6.61",
4
4
  "description": "CURE Design System - React component library",
5
5
  "author": "Pibit",
6
6
  "license": "MIT",
@@ -81,12 +81,13 @@
81
81
  "build:lib": "tsc && vite build",
82
82
  "build:css": "node scripts/build-css.js",
83
83
  "build:watch": "vite build --watch",
84
- "lint": "eslint . --ext ts,tsx",
84
+ "lint": "eslint .",
85
85
  "storybook": "storybook dev -p 6006",
86
86
  "build-storybook": "storybook build",
87
87
  "test": "vitest",
88
88
  "check:exports": "node scripts/check-exports.mjs",
89
- "generate:icons": "node scripts/generate-icons.mjs"
89
+ "generate:icons": "node scripts/generate-icons.mjs",
90
+ "lint:gate": "node scripts/lint-gate.mjs"
90
91
  },
91
92
  "peerDependencies": {
92
93
  "@codemirror/commands": "^6.10.3",
@@ -160,6 +161,7 @@
160
161
  "@codemirror/merge": "^6.12.2",
161
162
  "@codemirror/state": "^6.6.0",
162
163
  "@codemirror/view": "^6.43.0",
164
+ "@eslint/js": "^9.39.5",
163
165
  "@lezer/highlight": "^1.2.0",
164
166
  "@storybook/addon-a11y": "^8.5.0",
165
167
  "@storybook/addon-essentials": "^8.5.0",
@@ -185,6 +187,8 @@
185
187
  "@uiw/react-codemirror": "^4.25.10",
186
188
  "@vitejs/plugin-react": "^4.3.4",
187
189
  "eslint": "^9.33.0",
190
+ "eslint-plugin-react-hooks": "^5.2.0",
191
+ "globals": "^16.5.0",
188
192
  "jsdom": "^29.1.1",
189
193
  "prettier": "^3.4.2",
190
194
  "storybook": "^8.5.0",
@@ -193,6 +197,7 @@
193
197
  "tailwindcss-react-aria-components": "^2.0.1",
194
198
  "tippy.js": "^6.3.7",
195
199
  "typescript": "^5.8.3",
200
+ "typescript-eslint": "^8.72.2",
196
201
  "vite": "^6.0.7",
197
202
  "vite-plugin-dts": "^4.5.0",
198
203
  "vitest": "^2.1.8"