@pibit.ai/cure-design-system 0.6.59 → 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.
@@ -0,0 +1,8 @@
1
+ import { Sort } from './sort-builder';
2
+ /**
3
+ * Sorts rows client-side by the given criteria, first criterion first. Arrays
4
+ * compare by length; null and undefined sort last; rows with an empty field are
5
+ * skipped. Returns a new array; `data` is not mutated.
6
+ */
7
+ export declare const applySorts: <T extends Record<string, any>>(data: T[], sorts: Sort[]) => T[];
8
+ //# sourceMappingURL=apply-sorts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"apply-sorts.d.ts","sourceRoot":"","sources":["../../../src/patterns/sort-builder/apply-sorts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAE3C;;;;GAIG;AAEH,eAAO,MAAM,UAAU,GAAI,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,CAAC,EAAE,EAAE,OAAO,IAAI,EAAE,KAAG,CAAC,EAoCrF,CAAC"}
@@ -0,0 +1,16 @@
1
+ const a = (l, i) => !i || i.length === 0 ? l : [...l].sort((f, o) => {
2
+ for (const n of i) {
3
+ if (!n.field) continue;
4
+ let e = f[n.field], r = o[n.field];
5
+ if (Array.isArray(e) && Array.isArray(r) && (e = e.length, r = r.length), e == null && r == null) continue;
6
+ if (e == null) return 1;
7
+ if (r == null) return -1;
8
+ let t;
9
+ if (typeof e == "string" && typeof r == "string" ? t = e.localeCompare(r) : typeof e == "number" && typeof r == "number" ? t = e - r : e instanceof Date && r instanceof Date ? t = e.getTime() - r.getTime() : t = String(e).localeCompare(String(r)), t !== 0)
10
+ return n.direction === "desc" ? -t : t;
11
+ }
12
+ return 0;
13
+ });
14
+ export {
15
+ a as applySorts
16
+ };
@@ -0,0 +1,3 @@
1
+ export { SortBuilder, type SortBuilderProps, type Sort, type SortColumn } from './sort-builder';
2
+ export { applySorts } from './apply-sorts';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/patterns/sort-builder/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,KAAK,gBAAgB,EAAE,KAAK,IAAI,EAAE,KAAK,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAChG,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC"}
@@ -0,0 +1,49 @@
1
+ import { FC } from 'react';
2
+ /** A column the builder can sort by. Extra fields ride along untouched. */
3
+ export interface SortColumn {
4
+ key: string;
5
+ label: string;
6
+ /** The field the sort is applied to, when it differs from `key`. */
7
+ sortKey?: string;
8
+ /** Columns with `allowSorting` unset or false are not offered. */
9
+ allowSorting?: boolean;
10
+ [key: string]: any;
11
+ }
12
+ /** One sort criterion. An empty field or direction is a row still being filled in. */
13
+ export interface Sort {
14
+ field: string;
15
+ direction: "asc" | "desc" | "";
16
+ }
17
+ export interface SortBuilderProps {
18
+ columns: SortColumn[];
19
+ sorts: Sort[];
20
+ onSortsChange: (sorts: Sort[]) => void;
21
+ /** Show Cancel and Apply. */
22
+ allowApply?: boolean;
23
+ allowAddSort?: boolean;
24
+ onApply?: () => void;
25
+ onCancel?: () => void;
26
+ /** Called by Clear All before the rows reset to one empty row. */
27
+ clearAllSorts?: () => void;
28
+ /**
29
+ * Disable Apply. It is also disabled while any row is missing a field or a
30
+ * direction, so an incomplete sort can't be applied.
31
+ */
32
+ isApplyDisabled?: boolean;
33
+ /** Class override for the Cancel button. */
34
+ cancelButtonClassName?: string;
35
+ /** Prefix for data-testid attributes (e.g. "om-sort"). None are emitted when unset. */
36
+ testIdPrefix?: string;
37
+ /** Which columns may be offered. Defaults to `allowSorting === true`. */
38
+ isSortable?: (column: SortColumn) => boolean;
39
+ }
40
+ /**
41
+ * The multi-column sort editor: one row per criterion (field + direction), drag
42
+ * to reorder, Add Sort, Clear All, and optional Cancel / Apply.
43
+ *
44
+ * Frozen to platform-ui's SortComponent, which it replaces. One difference: the
45
+ * app showed an error toast when Apply was pressed with an incomplete row; here
46
+ * Apply is simply disabled until every row has a field and a direction.
47
+ */
48
+ export declare const SortBuilder: FC<SortBuilderProps>;
49
+ //# sourceMappingURL=sort-builder.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sort-builder.d.ts","sourceRoot":"","sources":["../../../src/patterns/sort-builder/sort-builder.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAQhC,2EAA2E;AAC3E,MAAM,WAAW,UAAU;IACzB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,oEAAoE;IACpE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,kEAAkE;IAClE,YAAY,CAAC,EAAE,OAAO,CAAC;IAEvB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB;AAED,sFAAsF;AACtF,MAAM,WAAW,IAAI;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,KAAK,GAAG,MAAM,GAAG,EAAE,CAAC;CAChC;AAED,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,UAAU,EAAE,CAAC;IACtB,KAAK,EAAE,IAAI,EAAE,CAAC;IACd,aAAa,EAAE,CAAC,KAAK,EAAE,IAAI,EAAE,KAAK,IAAI,CAAC;IACvC,6BAA6B;IAC7B,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,kEAAkE;IAClE,aAAa,CAAC,EAAE,MAAM,IAAI,CAAC;IAC3B;;;OAGG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,4CAA4C;IAC5C,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,uFAAuF;IACvF,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,yEAAyE;IACzE,UAAU,CAAC,EAAE,CAAC,MAAM,EAAE,UAAU,KAAK,OAAO,CAAC;CAC9C;AAoHD;;;;;;;GAOG;AACH,eAAO,MAAM,WAAW,EAAE,EAAE,CAAC,gBAAgB,CA4G5C,CAAC"}
@@ -0,0 +1,188 @@
1
+ import { jsxs as c, jsx as t } from "react/jsx-runtime";
2
+ import { useRef as w } from "react";
3
+ import { Plus as B, Trash02 as I } from "@untitledui/icons";
4
+ import { cx as K } from "../../utils/cn.js";
5
+ import { Button as h } from "../../primitives/button/button.js";
6
+ import { useDragControls as M } from "../../node_modules/framer-motion/dist/es/gestures/drag/use-drag-controls.js";
7
+ import { Select as g } from "../../primitives/select/select.js";
8
+ import { ReorderGroup as E } from "../../node_modules/framer-motion/dist/es/components/Reorder/Group.js";
9
+ import { ReorderItem as W } from "../../node_modules/framer-motion/dist/es/components/Reorder/Item.js";
10
+ const _ = (a) => !!a.allowSorting;
11
+ function j() {
12
+ const a = w(/* @__PURE__ */ new WeakMap()), e = w(0);
13
+ return (l) => (a.current.has(l) || a.current.set(l, `sort-${e.current++}`), a.current.get(l));
14
+ }
15
+ const G = ({ className: a }) => /* @__PURE__ */ t("svg", { viewBox: "0 0 8 14", fill: "none", className: a, "aria-hidden": "true", children: [1.375, 6.625].flatMap(
16
+ (e) => [1.375, 6.625, 11.875].map((l) => /* @__PURE__ */ t("circle", { cx: e, cy: l, r: 0.75, stroke: "currentColor", strokeWidth: 1.25 }, `${e}-${l}`))
17
+ ) }), L = ({ sort: a, index: e, totalSorts: l, getAvailableColumns: u, updateSort: x, removeSort: d, testId: s }) => {
18
+ const n = M(), y = u(e).map((r) => ({ ...r, id: r.sortKey ?? r.key }));
19
+ return /* @__PURE__ */ c(
20
+ W,
21
+ {
22
+ value: a,
23
+ as: "div",
24
+ "data-testid": s("row"),
25
+ "data-row-index": s("row") ? e : void 0,
26
+ dragListener: !1,
27
+ dragControls: n,
28
+ className: "flex items-center gap-3 rounded-lg bg-primary",
29
+ style: { position: "relative" },
30
+ whileDrag: {
31
+ opacity: 0.85,
32
+ scale: 1.02,
33
+ boxShadow: "0 8px 24px rgba(0, 0, 0, 0.12)",
34
+ zIndex: 50
35
+ },
36
+ transition: { type: "spring", stiffness: 300, damping: 25 },
37
+ children: [
38
+ /* @__PURE__ */ c("div", { className: "flex flex-grow items-center gap-3", children: [
39
+ /* @__PURE__ */ t(
40
+ g,
41
+ {
42
+ "aria-label": "Sort field",
43
+ "data-testid": s("field-select"),
44
+ size: "sm",
45
+ placeholder: "Select field",
46
+ items: y,
47
+ selectedKey: a.field || null,
48
+ onSelectionChange: (r) => x(e, "field", String(r ?? "")),
49
+ className: "min-w-[220px]",
50
+ textStyles: "text-sm",
51
+ children: (r) => /* @__PURE__ */ t(g.Item, { id: r.id, children: r.label })
52
+ }
53
+ ),
54
+ /* @__PURE__ */ t(
55
+ g,
56
+ {
57
+ "aria-label": "Sort direction",
58
+ "data-testid": s("direction-select"),
59
+ size: "sm",
60
+ placeholder: "Select direction",
61
+ items: [
62
+ { id: "asc", label: "Ascending" },
63
+ { id: "desc", label: "Descending" }
64
+ ],
65
+ selectedKey: a.direction || null,
66
+ onSelectionChange: (r) => x(e, "direction", String(r ?? "")),
67
+ className: "min-w-[180px]",
68
+ textStyles: "text-sm",
69
+ children: (r) => /* @__PURE__ */ t(g.Item, { id: r.id, children: r.label })
70
+ }
71
+ )
72
+ ] }),
73
+ /* @__PURE__ */ t(
74
+ h,
75
+ {
76
+ isDisabled: l <= 1,
77
+ onClick: () => d(e),
78
+ color: "tertiary",
79
+ className: "flex-shrink-0 p-0",
80
+ size: "xs",
81
+ "aria-label": "Remove sort",
82
+ "data-testid": s("remove-button"),
83
+ children: /* @__PURE__ */ t(I, { className: "h-4 w-4 text-gray-cool-400 transition-colors hover:text-black" })
84
+ }
85
+ ),
86
+ /* @__PURE__ */ t(
87
+ "div",
88
+ {
89
+ onPointerDown: (r) => n.start(r),
90
+ className: "-ml-1 flex-shrink-0 cursor-grab touch-none select-none rounded text-gray-cool-400 active:cursor-grabbing",
91
+ "aria-label": "Drag to reorder sort criteria",
92
+ "data-testid": s("drag-handle"),
93
+ title: "Drag to reorder",
94
+ children: /* @__PURE__ */ t(G, { className: "pointer-events-none h-4 w-4" })
95
+ }
96
+ )
97
+ ]
98
+ }
99
+ );
100
+ }, V = ({
101
+ columns: a,
102
+ sorts: e,
103
+ onSortsChange: l,
104
+ allowApply: u = !1,
105
+ allowAddSort: x = !0,
106
+ onApply: d,
107
+ onCancel: s,
108
+ clearAllSorts: n,
109
+ isApplyDisabled: y = !1,
110
+ cancelButtonClassName: r,
111
+ testIdPrefix: v,
112
+ isSortable: S = _
113
+ }) => {
114
+ const k = j(), m = (i) => v ? `${v}-${i}` : void 0, b = a.filter(S), D = (i) => b.filter(
115
+ (o) => !e.some((f, p) => p !== i && f.field === (o.sortKey ?? o.key))
116
+ ), z = () => l([...e, { field: "", direction: "" }]), C = (i) => l(e.filter((o, f) => f !== i)), R = (i, o, f) => {
117
+ const p = [...e];
118
+ p[i] = { ...p[i], [o]: f }, l(p);
119
+ }, $ = () => {
120
+ e.length === 1 && e[0].field === "" && e[0].direction === "" || (n == null || n(), l([{ field: "", direction: "" }]));
121
+ }, N = e.length > 0 && e.every((i) => i.field !== "" && i.direction !== "");
122
+ return /* @__PURE__ */ c("div", { className: "flex flex-col", children: [
123
+ /* @__PURE__ */ t("div", { className: "px-5 py-3", children: /* @__PURE__ */ t("p", { className: "text-sm font-normal text-tertiary", children: "In the view, sort rows" }) }),
124
+ /* @__PURE__ */ c("div", { className: "flex max-h-[500px] flex-col gap-2 overflow-y-auto px-4 py-4 pt-0", children: [
125
+ /* @__PURE__ */ t(E, { as: "div", axis: "y", values: e, onReorder: l, className: "flex flex-col gap-2", children: e.map((i, o) => /* @__PURE__ */ t(
126
+ L,
127
+ {
128
+ sort: i,
129
+ index: o,
130
+ totalSorts: e.length,
131
+ getAvailableColumns: D,
132
+ updateSort: R,
133
+ removeSort: C,
134
+ testId: m
135
+ },
136
+ k(i)
137
+ )) }),
138
+ /* @__PURE__ */ c("div", { className: "flex items-center justify-between gap-2", children: [
139
+ /* @__PURE__ */ c("div", { className: "flex items-center gap-2", children: [
140
+ x && /* @__PURE__ */ t(
141
+ h,
142
+ {
143
+ isDisabled: e.length >= b.length,
144
+ color: "tertiary",
145
+ size: "xs",
146
+ className: "p-0 text-brand-600 hover:bg-primary",
147
+ onClick: z,
148
+ "data-testid": m("add-button"),
149
+ children: /* @__PURE__ */ c("div", { className: "flex items-center", children: [
150
+ /* @__PURE__ */ t(B, { size: 14 }),
151
+ /* @__PURE__ */ t("p", { className: "text-xs font-semibold", children: "Add Sort" })
152
+ ] })
153
+ }
154
+ ),
155
+ /* @__PURE__ */ t(h, { className: "p-0", color: "tertiary", size: "xs", onClick: $, "data-testid": m("clear-all"), children: "Clear All" })
156
+ ] }),
157
+ u && /* @__PURE__ */ c("div", { className: "mt-2 flex items-center gap-2", children: [
158
+ /* @__PURE__ */ t(
159
+ h,
160
+ {
161
+ color: "secondary",
162
+ className: K(r ?? "bg-secondary p-2"),
163
+ size: "xs",
164
+ onClick: s,
165
+ "data-testid": m("cancel"),
166
+ children: "Cancel"
167
+ }
168
+ ),
169
+ /* @__PURE__ */ t(
170
+ h,
171
+ {
172
+ color: "primary",
173
+ className: "p-2",
174
+ size: "xs",
175
+ onClick: () => N && (d == null ? void 0 : d()),
176
+ isDisabled: y || !N,
177
+ "data-testid": m("apply"),
178
+ children: "Apply"
179
+ }
180
+ )
181
+ ] })
182
+ ] })
183
+ ] })
184
+ ] });
185
+ };
186
+ export {
187
+ V as SortBuilder
188
+ };
@@ -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
  };
@@ -1,5 +1,6 @@
1
1
  import { FC } from 'react';
2
2
  import { LegacySortToolConfig } from './legacyToolbarTypes';
3
+ /** The toolbar's default sort panel: SortBuilder driven by a toolbar sort config. */
3
4
  export declare const BasicSortPanel: FC<{
4
5
  config: LegacySortToolConfig;
5
6
  }>;
@@ -1 +1 @@
1
- {"version":3,"file":"BasicSortPanel.d.ts","sourceRoot":"","sources":["../../../../src/patterns/table/toolbar/BasicSortPanel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAOhC,OAAO,KAAK,EAAgC,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAuG/F,eAAO,MAAM,cAAc,EAAE,EAAE,CAAC;IAAE,MAAM,EAAE,oBAAoB,CAAA;CAAE,CAmG/D,CAAC"}
1
+ {"version":3,"file":"BasicSortPanel.d.ts","sourceRoot":"","sources":["../../../../src/patterns/table/toolbar/BasicSortPanel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAEhC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAEjE,qFAAqF;AACrF,eAAO,MAAM,cAAc,EAAE,EAAE,CAAC;IAAE,MAAM,EAAE,oBAAoB,CAAA;CAAE,CAY/D,CAAC"}