@ai-matrx/design-system 0.14.3 → 0.15.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 (106) hide show
  1. package/CHANGELOG.md +54 -0
  2. package/README.md +32 -0
  3. package/dist/data-table/copy-helpers.cjs +149 -0
  4. package/dist/data-table/copy-helpers.cjs.map +1 -0
  5. package/dist/data-table/copy-helpers.d.cts +31 -0
  6. package/dist/data-table/copy-helpers.d.ts +31 -0
  7. package/dist/data-table/copy-helpers.js +127 -0
  8. package/dist/data-table/copy-helpers.js.map +1 -0
  9. package/dist/data-table/copy-types.cjs +19 -0
  10. package/dist/data-table/copy-types.cjs.map +1 -0
  11. package/dist/data-table/copy-types.d.cts +137 -0
  12. package/dist/data-table/copy-types.d.ts +137 -0
  13. package/dist/data-table/copy-types.js +1 -0
  14. package/dist/data-table/copy-types.js.map +1 -0
  15. package/dist/data-table/data-row-inspector.cjs +1016 -0
  16. package/dist/data-table/data-row-inspector.cjs.map +1 -0
  17. package/dist/data-table/data-row-inspector.d.cts +34 -0
  18. package/dist/data-table/data-row-inspector.d.ts +34 -0
  19. package/dist/data-table/data-row-inspector.js +988 -0
  20. package/dist/data-table/data-row-inspector.js.map +1 -0
  21. package/dist/data-table/data-row-window.cjs +1136 -0
  22. package/dist/data-table/data-row-window.cjs.map +1 -0
  23. package/dist/data-table/data-row-window.d.cts +29 -0
  24. package/dist/data-table/data-row-window.d.ts +29 -0
  25. package/dist/data-table/data-row-window.js +1110 -0
  26. package/dist/data-table/data-row-window.js.map +1 -0
  27. package/dist/data-table/filter-engine.cjs +314 -0
  28. package/dist/data-table/filter-engine.cjs.map +1 -0
  29. package/dist/data-table/filter-engine.d.cts +35 -0
  30. package/dist/data-table/filter-engine.d.ts +35 -0
  31. package/dist/data-table/filter-engine.js +292 -0
  32. package/dist/data-table/filter-engine.js.map +1 -0
  33. package/dist/data-table/host.cjs +40 -0
  34. package/dist/data-table/host.cjs.map +1 -0
  35. package/dist/data-table/host.d.cts +73 -0
  36. package/dist/data-table/host.d.ts +73 -0
  37. package/dist/data-table/host.js +20 -0
  38. package/dist/data-table/host.js.map +1 -0
  39. package/dist/data-table/index.cjs +7198 -0
  40. package/dist/data-table/index.cjs.map +1 -0
  41. package/dist/data-table/index.d.cts +27 -0
  42. package/dist/data-table/index.d.ts +27 -0
  43. package/dist/data-table/index.js +7202 -0
  44. package/dist/data-table/index.js.map +1 -0
  45. package/dist/data-table/infer-filter.cjs +111 -0
  46. package/dist/data-table/infer-filter.cjs.map +1 -0
  47. package/dist/data-table/infer-filter.d.cts +17 -0
  48. package/dist/data-table/infer-filter.d.ts +17 -0
  49. package/dist/data-table/infer-filter.js +89 -0
  50. package/dist/data-table/infer-filter.js.map +1 -0
  51. package/dist/data-table/layered-filters.cjs +249 -0
  52. package/dist/data-table/layered-filters.cjs.map +1 -0
  53. package/dist/data-table/layered-filters.d.cts +3 -0
  54. package/dist/data-table/layered-filters.d.ts +3 -0
  55. package/dist/data-table/layered-filters.js +229 -0
  56. package/dist/data-table/layered-filters.js.map +1 -0
  57. package/dist/data-table/pagination.cjs +595 -0
  58. package/dist/data-table/pagination.cjs.map +1 -0
  59. package/dist/data-table/pagination.d.cts +34 -0
  60. package/dist/data-table/pagination.d.ts +34 -0
  61. package/dist/data-table/pagination.js +563 -0
  62. package/dist/data-table/pagination.js.map +1 -0
  63. package/dist/data-table/query-control.cjs +126 -0
  64. package/dist/data-table/query-control.cjs.map +1 -0
  65. package/dist/data-table/query-control.d.cts +32 -0
  66. package/dist/data-table/query-control.d.ts +32 -0
  67. package/dist/data-table/query-control.js +104 -0
  68. package/dist/data-table/query-control.js.map +1 -0
  69. package/dist/data-table/scroll-pagination.cjs +222 -0
  70. package/dist/data-table/scroll-pagination.cjs.map +1 -0
  71. package/dist/data-table/scroll-pagination.d.cts +37 -0
  72. package/dist/data-table/scroll-pagination.d.ts +37 -0
  73. package/dist/data-table/scroll-pagination.js +202 -0
  74. package/dist/data-table/scroll-pagination.js.map +1 -0
  75. package/dist/data-table/types.cjs +19 -0
  76. package/dist/data-table/types.cjs.map +1 -0
  77. package/dist/data-table/types.d.cts +3 -0
  78. package/dist/data-table/types.d.ts +3 -0
  79. package/dist/data-table/types.js +1 -0
  80. package/dist/data-table/types.js.map +1 -0
  81. package/dist/data-table/url-state.cjs +201 -0
  82. package/dist/data-table/url-state.cjs.map +1 -0
  83. package/dist/data-table/url-state.d.cts +33 -0
  84. package/dist/data-table/url-state.d.ts +33 -0
  85. package/dist/data-table/url-state.js +184 -0
  86. package/dist/data-table/url-state.js.map +1 -0
  87. package/dist/data-table/uuid-cell.cjs +371 -0
  88. package/dist/data-table/uuid-cell.cjs.map +1 -0
  89. package/dist/data-table/uuid-cell.d.cts +31 -0
  90. package/dist/data-table/uuid-cell.d.ts +31 -0
  91. package/dist/data-table/uuid-cell.js +345 -0
  92. package/dist/data-table/uuid-cell.js.map +1 -0
  93. package/dist/data-table/xlsx.cjs +100 -0
  94. package/dist/data-table/xlsx.cjs.map +1 -0
  95. package/dist/data-table/xlsx.d.cts +16 -0
  96. package/dist/data-table/xlsx.d.ts +16 -0
  97. package/dist/data-table/xlsx.js +70 -0
  98. package/dist/data-table/xlsx.js.map +1 -0
  99. package/dist/index.cjs +9 -5
  100. package/dist/index.cjs.map +1 -1
  101. package/dist/index.js +9 -5
  102. package/dist/index.js.map +1 -1
  103. package/dist/styles.css +22 -0
  104. package/dist/types-ClaxTaXq.d.ts +798 -0
  105. package/dist/types-XXbVB1sh.d.cts +798 -0
  106. package/package.json +164 -1
@@ -0,0 +1,595 @@
1
+ "use client";
2
+ "use strict";
3
+ "use client";
4
+ var __create = Object.create;
5
+ var __defProp = Object.defineProperty;
6
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
7
+ var __getOwnPropNames = Object.getOwnPropertyNames;
8
+ var __getProtoOf = Object.getPrototypeOf;
9
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
10
+ var __export = (target, all) => {
11
+ for (var name in all)
12
+ __defProp(target, name, { get: all[name], enumerable: true });
13
+ };
14
+ var __copyProps = (to, from, except, desc) => {
15
+ if (from && typeof from === "object" || typeof from === "function") {
16
+ for (let key of __getOwnPropNames(from))
17
+ if (!__hasOwnProp.call(to, key) && key !== except)
18
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
19
+ }
20
+ return to;
21
+ };
22
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
23
+ // If the importer is in node compatibility mode or this is not an ESM
24
+ // file that has been converted to a CommonJS file using a Babel-
25
+ // compatible transform (i.e. "__esModule" has not been set), then set
26
+ // "default" to the CommonJS "module.exports" for node compatibility.
27
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
28
+ mod
29
+ ));
30
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
31
+
32
+ // src/data-table/pagination.tsx
33
+ var pagination_exports = {};
34
+ __export(pagination_exports, {
35
+ default: () => GenericTablePagination
36
+ });
37
+ module.exports = __toCommonJS(pagination_exports);
38
+
39
+ // src/button.tsx
40
+ var import_react_slot = require("@radix-ui/react-slot");
41
+ var import_class_variance_authority = require("class-variance-authority");
42
+ var React = __toESM(require("react"), 1);
43
+
44
+ // src/cn.ts
45
+ var import_clsx = require("clsx");
46
+ var import_tailwind_merge = require("tailwind-merge");
47
+ function cn(...inputs) {
48
+ return (0, import_tailwind_merge.twMerge)((0, import_clsx.clsx)(inputs));
49
+ }
50
+
51
+ // src/button.tsx
52
+ var import_jsx_runtime = require("react/jsx-runtime");
53
+ var buttonVariants = (0, import_class_variance_authority.cva)(
54
+ "inline-flex cursor-pointer items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all duration-200 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-0 disabled:pointer-events-none disabled:opacity-50 active:scale-[0.98] [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
55
+ {
56
+ variants: {
57
+ variant: {
58
+ default: "bg-primary text-primary-foreground shadow-sm hover:bg-primary/90",
59
+ /**
60
+ * An explicit spelling of `default`, identical by construction. It is
61
+ * not decoration: matrx-frontend's `ButtonMine` fork carried it, ~17
62
+ * call sites say `variant="primary"`, and the alternative to keeping
63
+ * the word was a host shim translating a prop — the massage C22 bans.
64
+ */
65
+ primary: "bg-primary text-primary-foreground shadow-sm hover:bg-primary/90",
66
+ destructive: "bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",
67
+ /** The affirmative twin of `destructive` — confirm, approve, publish. */
68
+ success: "bg-success text-success-foreground shadow-sm hover:bg-success/90",
69
+ outline: "border border-border bg-card shadow-sm hover:bg-accent hover:text-accent-foreground",
70
+ secondary: "bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",
71
+ ghost: "hover:bg-accent hover:text-accent-foreground",
72
+ link: "text-primary underline-offset-4 hover:underline",
73
+ subtle: "border border-transparent bg-muted/50 text-foreground hover:border-border hover:bg-muted"
74
+ },
75
+ /**
76
+ * ONE size scale, xs → 3xl, plus the two icon boxes. The top and bottom
77
+ * of the scale came in from matrx-frontend's `ButtonMine` fork (2026-09-07):
78
+ * a dense toolbar needs `xs`, and a marketing/hero call to action needs
79
+ * `xl`+. A host that has to reach outside this scale forks the button,
80
+ * which is exactly how `ButtonMine` was born.
81
+ */
82
+ size: {
83
+ xs: "h-6 rounded-md px-1 text-xs",
84
+ sm: "h-8 rounded-md px-3 text-xs",
85
+ default: "h-9 px-4 py-2",
86
+ /** An explicit spelling of `default` (the fork's middle rung). */
87
+ md: "h-9 px-4 py-2",
88
+ lg: "h-10 rounded-md px-6",
89
+ xl: "h-12 px-8 py-3 text-base",
90
+ "2xl": "h-14 px-10 py-3 text-base",
91
+ "3xl": "h-16 px-12 py-3 text-base",
92
+ icon: "h-9 w-9",
93
+ "icon-sm": "h-7 w-7",
94
+ /** A circular icon box — an avatar-shaped control, not a square one. */
95
+ roundIcon: "h-8 w-8 rounded-full p-0"
96
+ }
97
+ },
98
+ defaultVariants: {
99
+ variant: "default",
100
+ size: "default"
101
+ }
102
+ }
103
+ );
104
+ var Button = React.forwardRef(
105
+ ({ className, variant, size, asChild = false, ...props }, ref) => {
106
+ const Component = asChild ? import_react_slot.Slot : "button";
107
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
108
+ Component,
109
+ {
110
+ className: cn(buttonVariants({ variant, size, className })),
111
+ ref,
112
+ ...props
113
+ }
114
+ );
115
+ }
116
+ );
117
+ Button.displayName = "Button";
118
+
119
+ // src/data-table/icons.tsx
120
+ var import_jsx_runtime2 = require("react/jsx-runtime");
121
+ function Icon({ children, ...props }) {
122
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", "aria-hidden": "true", ...props, children });
123
+ }
124
+ var ChevronLeft = (p) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Icon, { ...p, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "m15 18-6-6 6-6" }) });
125
+ var ChevronRight = (p) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Icon, { ...p, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "m9 18 6-6-6-6" }) });
126
+ var ChevronsLeft = (p) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Icon, { ...p, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "m11 18-6-6 6-6m8 12-6-6 6-6" }) });
127
+ var ChevronsRight = (p) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Icon, { ...p, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "m5 18 6-6-6-6m8 12 6-6-6-6" }) });
128
+
129
+ // src/select.tsx
130
+ var SelectPrimitive = __toESM(require("@radix-ui/react-select"), 1);
131
+ var import_class_variance_authority2 = require("class-variance-authority");
132
+ var React3 = __toESM(require("react"), 1);
133
+
134
+ // src/motion.ts
135
+ var MOTION_OVERLAY = "matrx-motion-overlay";
136
+ var MOTION_DIALOG = "matrx-motion-dialog";
137
+ var POPPER_OFFSET = "matrx-popper-offset";
138
+ var MOTION_BOTTOM_SHEET = "matrx-motion-bottom-sheet";
139
+ var MOTION_POPPER = "matrx-motion-popper";
140
+ var MOTION_SHEET = {
141
+ top: "matrx-motion-sheet-top",
142
+ bottom: "matrx-motion-sheet-bottom",
143
+ left: "matrx-motion-sheet-left",
144
+ right: "matrx-motion-sheet-right",
145
+ center: "matrx-motion-sheet-center"
146
+ };
147
+ var MOTION_PULSE = "matrx-pulse";
148
+ var MOTION_SPIN = "matrx-spin";
149
+ var ALL_MOTION_CLASSES = [
150
+ MOTION_OVERLAY,
151
+ MOTION_DIALOG,
152
+ MOTION_BOTTOM_SHEET,
153
+ MOTION_POPPER,
154
+ ...Object.values(MOTION_SHEET),
155
+ MOTION_PULSE,
156
+ MOTION_SPIN
157
+ ];
158
+
159
+ // src/icons.tsx
160
+ var import_jsx_runtime3 = require("react/jsx-runtime");
161
+ function radixProps(props) {
162
+ return {
163
+ xmlns: "http://www.w3.org/2000/svg",
164
+ viewBox: "0 0 15 15",
165
+ width: 15,
166
+ height: 15,
167
+ fill: "none",
168
+ "aria-hidden": true,
169
+ ...props
170
+ };
171
+ }
172
+ function CheckIcon(props) {
173
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("svg", { ...radixProps(props), children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
174
+ "path",
175
+ {
176
+ d: "M11.4669 3.72684C11.7558 3.91574 11.8369 4.30308 11.648 4.59198L7.39799 11.092C7.29783 11.2452 7.13556 11.3467 6.95402 11.3699C6.77247 11.3931 6.58989 11.3355 6.45446 11.2124L3.70446 8.71241C3.44905 8.48022 3.43023 8.08494 3.66242 7.82953C3.89461 7.57412 4.28989 7.55529 4.5453 7.78749L6.75292 9.79441L10.6018 3.90792C10.7907 3.61902 11.178 3.53795 11.4669 3.72684Z",
177
+ fill: "currentColor",
178
+ fillRule: "evenodd",
179
+ clipRule: "evenodd"
180
+ }
181
+ ) });
182
+ }
183
+ function RadixChevronDownIcon(props) {
184
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("svg", { ...radixProps(props), children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
185
+ "path",
186
+ {
187
+ d: "M3.13523 6.15803C3.3241 5.95657 3.64052 5.94637 3.84197 6.13523L7.5 9.56464L11.158 6.13523C11.3595 5.94637 11.6759 5.95657 11.8648 6.15803C12.0536 6.35949 12.0434 6.67591 11.842 6.86477L7.84197 10.6148C7.64964 10.7951 7.35036 10.7951 7.15803 10.6148L3.15803 6.86477C2.95657 6.67591 2.94637 6.35949 3.13523 6.15803Z",
188
+ fill: "currentColor",
189
+ fillRule: "evenodd",
190
+ clipRule: "evenodd"
191
+ }
192
+ ) });
193
+ }
194
+ function RadixChevronUpIcon(props) {
195
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("svg", { ...radixProps(props), children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
196
+ "path",
197
+ {
198
+ d: "M3.13523 8.84197C3.3241 9.04343 3.64052 9.05363 3.84197 8.86477L7.5 5.43536L11.158 8.86477C11.3595 9.05363 11.6759 9.04343 11.8648 8.84197C12.0536 8.64051 12.0434 8.32409 11.842 8.13523L7.84197 4.38523C7.64964 4.20492 7.35036 4.20492 7.15803 4.38523L3.15803 8.13523C2.95657 8.32409 2.94637 8.64051 3.13523 8.84197Z",
199
+ fill: "currentColor",
200
+ fillRule: "evenodd",
201
+ clipRule: "evenodd"
202
+ }
203
+ ) });
204
+ }
205
+
206
+ // src/portal-container.tsx
207
+ var React2 = __toESM(require("react"), 1);
208
+ var import_jsx_runtime4 = require("react/jsx-runtime");
209
+ var CONTEXT_SLOT = /* @__PURE__ */ Symbol.for("ai-matrx.design-system.portal-container-context");
210
+ var contextRegistry = globalThis;
211
+ var PortalContainerContext = contextRegistry[CONTEXT_SLOT] ??= React2.createContext(void 0);
212
+ function usePortalContainer(explicit) {
213
+ const injected = React2.useContext(PortalContainerContext);
214
+ if (explicit !== void 0) {
215
+ return explicit ?? void 0;
216
+ }
217
+ return injected ?? void 0;
218
+ }
219
+
220
+ // src/select.tsx
221
+ var import_jsx_runtime5 = require("react/jsx-runtime");
222
+ var Select = SelectPrimitive.Root;
223
+ var SelectValue = SelectPrimitive.Value;
224
+ var selectTriggerVariants = (0, import_class_variance_authority2.cva)(
225
+ "flex w-full items-center justify-between whitespace-nowrap rounded-md border border-border bg-card text-sm shadow-sm ring-offset-background placeholder:text-muted-foreground transition-colors hover:bg-accent hover:border-accent-foreground/20 focus:outline-none focus:ring-1 focus:ring-primary/30 focus:border-primary/40 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",
226
+ {
227
+ variants: {
228
+ size: {
229
+ sm: "h-7 px-2 py-1 text-xs",
230
+ default: "h-9 px-3 py-1",
231
+ lg: "h-10 px-3 py-2"
232
+ }
233
+ },
234
+ defaultVariants: {
235
+ size: "default"
236
+ }
237
+ }
238
+ );
239
+ var SelectTrigger = React3.forwardRef(({ className, children, hideArrow = false, size, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
240
+ SelectPrimitive.Trigger,
241
+ {
242
+ ref,
243
+ className: cn(selectTriggerVariants({ size, className })),
244
+ ...props,
245
+ children: [
246
+ children,
247
+ !hideArrow && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(SelectPrimitive.Icon, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(RadixChevronDownIcon, { className: "h-4 w-4 opacity-50" }) })
248
+ ]
249
+ }
250
+ ));
251
+ SelectTrigger.displayName = SelectPrimitive.Trigger.displayName;
252
+ var SelectScrollUpButton = React3.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
253
+ SelectPrimitive.ScrollUpButton,
254
+ {
255
+ ref,
256
+ className: cn(
257
+ "flex cursor-default items-center justify-center py-1",
258
+ className
259
+ ),
260
+ ...props,
261
+ children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(RadixChevronUpIcon, {})
262
+ }
263
+ ));
264
+ SelectScrollUpButton.displayName = SelectPrimitive.ScrollUpButton.displayName;
265
+ var SelectScrollDownButton = React3.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
266
+ SelectPrimitive.ScrollDownButton,
267
+ {
268
+ ref,
269
+ className: cn(
270
+ "flex cursor-default items-center justify-center py-1",
271
+ className
272
+ ),
273
+ ...props,
274
+ children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(RadixChevronDownIcon, {})
275
+ }
276
+ ));
277
+ SelectScrollDownButton.displayName = SelectPrimitive.ScrollDownButton.displayName;
278
+ var SelectContent = React3.forwardRef(
279
+ ({
280
+ className,
281
+ children,
282
+ position = "popper",
283
+ container,
284
+ animated = true,
285
+ ...props
286
+ }, ref) => {
287
+ const portalContainer = usePortalContainer(container);
288
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(SelectPrimitive.Portal, { container: portalContainer, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
289
+ SelectPrimitive.Content,
290
+ {
291
+ ref,
292
+ className: cn(
293
+ "relative z-[10001] max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md",
294
+ animated && MOTION_POPPER,
295
+ // The resting gap from the trigger. It is the `translate` property
296
+ // (POPPER_OFFSET), never Tailwind translate utilities: those compose
297
+ // with `transform` on a v4 host and are REPLACED by it on a v3 one,
298
+ // so on v3 the animation ate the gap and the surface snapped 4px at
299
+ // the end. Same law as the centred dialog card — see motion.ts.
300
+ position === "popper" && POPPER_OFFSET,
301
+ className
302
+ ),
303
+ position,
304
+ ...props,
305
+ children: [
306
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(SelectScrollUpButton, {}),
307
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
308
+ SelectPrimitive.Viewport,
309
+ {
310
+ className: cn(
311
+ "p-0.5 overflow-y-auto",
312
+ position === "popper" && "w-full min-w-[var(--radix-select-trigger-width)] max-h-[var(--radix-select-content-available-height)]"
313
+ ),
314
+ children
315
+ }
316
+ ),
317
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(SelectScrollDownButton, {})
318
+ ]
319
+ }
320
+ ) });
321
+ }
322
+ );
323
+ SelectContent.displayName = SelectPrimitive.Content.displayName;
324
+ var SelectLabel = React3.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
325
+ SelectPrimitive.Label,
326
+ {
327
+ ref,
328
+ className: cn("px-2 py-1.5 text-sm font-semibold", className),
329
+ ...props
330
+ }
331
+ ));
332
+ SelectLabel.displayName = SelectPrimitive.Label.displayName;
333
+ var SelectItem = React3.forwardRef(({ className, children, description, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
334
+ SelectPrimitive.Item,
335
+ {
336
+ ref,
337
+ className: cn(
338
+ "relative flex w-full cursor-default select-none rounded-sm py-1 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
339
+ description ? "flex-col items-start gap-0.5 py-1.5" : "items-center",
340
+ className
341
+ ),
342
+ ...props,
343
+ children: [
344
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "absolute right-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(SelectPrimitive.ItemIndicator, { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(CheckIcon, { className: "h-4 w-4" }) }) }),
345
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(SelectPrimitive.ItemText, { children }),
346
+ description ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "block text-xs leading-snug text-muted-foreground", children: description }) : null
347
+ ]
348
+ }
349
+ ));
350
+ SelectItem.displayName = SelectPrimitive.Item.displayName;
351
+ var SelectSeparator = React3.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
352
+ SelectPrimitive.Separator,
353
+ {
354
+ ref,
355
+ className: cn("-mx-1 my-1 h-px bg-muted", className),
356
+ ...props
357
+ }
358
+ ));
359
+ SelectSeparator.displayName = SelectPrimitive.Separator.displayName;
360
+
361
+ // src/data-table/pagination.tsx
362
+ var import_jsx_runtime6 = require("react/jsx-runtime");
363
+ function GenericTablePagination({
364
+ totalItems,
365
+ itemsPerPage,
366
+ currentPage,
367
+ onPageChange,
368
+ onItemsPerPageChange,
369
+ pageSizeOptions = [5, 10, 25, 50, 100],
370
+ className = "",
371
+ showItemsPerPageSelect = true,
372
+ showPageInfo = true,
373
+ showPageControls = true,
374
+ maxPagesToShow = 5,
375
+ containerClassName = "",
376
+ selectContainerClassName = "",
377
+ infoContainerClassName = "",
378
+ controlsContainerClassName = "",
379
+ pageButtonClassName = "",
380
+ pageActiveButtonClassName = "",
381
+ navButtonClassName = "",
382
+ allValue = totalItems,
383
+ allOptionLabel = "All",
384
+ showAllOption = true,
385
+ layoutType = "grid",
386
+ labelFormat,
387
+ compact = false,
388
+ hideEntriesInfo = false
389
+ }) {
390
+ const positivePageSizes = pageSizeOptions.filter((size) => size > 0);
391
+ const availablePageSizes = itemsPerPage > 0 && !positivePageSizes.includes(itemsPerPage) ? [...positivePageSizes, itemsPerPage].sort((a, b) => a - b) : positivePageSizes;
392
+ const effectiveItemsPerPage = itemsPerPage === 0 ? Math.max(totalItems, 1) : Math.max(itemsPerPage, 1);
393
+ const totalPages = Math.max(1, Math.ceil(totalItems / effectiveItemsPerPage));
394
+ const getPageNumbers = (limit = maxPagesToShow) => {
395
+ let startPage = Math.max(1, currentPage - Math.floor(limit / 2));
396
+ const endPage = Math.min(totalPages, startPage + limit - 1);
397
+ startPage = Math.max(1, endPage - limit + 1);
398
+ return Array.from(
399
+ { length: endPage - startPage + 1 },
400
+ (_, i) => startPage + i
401
+ );
402
+ };
403
+ const isFirstPageDisabled = currentPage <= 1;
404
+ const isLastPageDisabled = currentPage >= totalPages;
405
+ const startItem = totalItems === 0 ? 0 : (currentPage - 1) * effectiveItemsPerPage + 1;
406
+ const endItem = Math.min(currentPage * effectiveItemsPerPage, totalItems);
407
+ const defaultLabelFormat = (start, end, total) => {
408
+ return compact ? `${start}-${end} of ${total}` : `Showing ${start} to ${end} of ${total} entries`;
409
+ };
410
+ const formatLabel = labelFormat || defaultLabelFormat;
411
+ const buttonSize = compact ? "sm" : "icon";
412
+ const compactButtonClass = "relative isolate h-11 w-11 min-w-11 border-0 bg-transparent p-0 text-xs shadow-none before:absolute before:inset-1.5 before:z-0 before:rounded-md before:border before:border-border before:bg-card before:content-[''] hover:bg-transparent hover:before:bg-accent disabled:bg-transparent disabled:before:opacity-40 [&_svg]:relative [&_svg]:z-10 lg:h-7 lg:min-h-7 lg:w-7 lg:min-w-7 lg:border lg:border-input lg:bg-background lg:before:hidden lg:hover:bg-accent";
413
+ const compactActiveButtonClass = "text-primary-foreground before:border-primary before:bg-primary hover:before:bg-primary/90 lg:border-primary lg:bg-primary lg:hover:bg-primary/90";
414
+ const containerClass = cn(
415
+ "w-full items-center border-t border-border",
416
+ layoutType === "grid" ? "grid grid-cols-[auto_minmax(0,1fr)_auto]" : "flex flex-nowrap justify-between",
417
+ compact ? "h-11 gap-0 px-0 py-0 lg:h-8" : "gap-1 px-2 py-1 sm:gap-4 sm:px-3",
418
+ className,
419
+ containerClassName
420
+ );
421
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { "data-matrx-table-footer": true, className: containerClass, children: [
422
+ showItemsPerPageSelect && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
423
+ "div",
424
+ {
425
+ className: cn(
426
+ "flex min-w-0 justify-start",
427
+ !compact && "sm:p-1",
428
+ selectContainerClassName
429
+ ),
430
+ children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
431
+ Select,
432
+ {
433
+ value: itemsPerPage.toString(),
434
+ onValueChange: (value) => onItemsPerPageChange(parseInt(value)),
435
+ children: [
436
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
437
+ SelectTrigger,
438
+ {
439
+ "aria-label": "Rows per page",
440
+ className: cn(
441
+ "focus:ring-0",
442
+ compact ? "relative isolate h-11 w-14 border-0 bg-transparent px-2 text-xs before:absolute before:inset-x-1 before:inset-y-1.5 before:z-0 before:rounded-md before:border before:border-border before:bg-card before:content-[''] hover:before:bg-accent [&>*]:relative [&>*]:z-10 lg:h-7 lg:min-h-7 lg:w-16 lg:border lg:border-input lg:bg-background lg:px-2 lg:before:hidden" : "h-8 w-[3.75rem] text-xs sm:w-36 sm:text-sm"
443
+ ),
444
+ children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(SelectValue, { placeholder: itemsPerPage.toString() })
445
+ }
446
+ ),
447
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(SelectContent, { children: [
448
+ availablePageSizes.map((size) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(SelectItem, { value: size.toString(), children: size }, size)),
449
+ showAllOption ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(SelectItem, { value: allValue.toString(), children: allOptionLabel }) : null
450
+ ] })
451
+ ]
452
+ }
453
+ )
454
+ }
455
+ ),
456
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
457
+ "div",
458
+ {
459
+ className: cn("flex min-w-0 justify-center", infoContainerClassName),
460
+ children: showPageInfo && !hideEntriesInfo && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
461
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("span", { className: "truncate text-[10px] tabular-nums text-muted-foreground sm:hidden", children: [
462
+ startItem,
463
+ "-",
464
+ endItem,
465
+ " / ",
466
+ totalItems
467
+ ] }),
468
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
469
+ "span",
470
+ {
471
+ className: `hidden whitespace-nowrap ${compact ? "text-xs" : "text-sm"} text-muted-foreground sm:inline`,
472
+ children: formatLabel(startItem, endItem, totalItems)
473
+ }
474
+ )
475
+ ] })
476
+ }
477
+ ),
478
+ showPageControls && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
479
+ "div",
480
+ {
481
+ className: cn(
482
+ "flex min-w-0 items-center justify-end",
483
+ compact ? "gap-0" : "gap-0.5 sm:gap-1",
484
+ controlsContainerClassName
485
+ ),
486
+ children: [
487
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
488
+ Button,
489
+ {
490
+ variant: "outline",
491
+ size: buttonSize,
492
+ "aria-label": "First page",
493
+ title: "First page",
494
+ onClick: () => onPageChange(1),
495
+ disabled: isFirstPageDisabled,
496
+ className: cn(
497
+ "hidden sm:inline-flex",
498
+ compact ? compactButtonClass : "h-8 w-8 p-0",
499
+ navButtonClassName
500
+ ),
501
+ children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(ChevronsLeft, { className: compact ? "h-3.5 w-3.5" : "h-4 w-4" })
502
+ }
503
+ ),
504
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
505
+ Button,
506
+ {
507
+ variant: "outline",
508
+ size: buttonSize,
509
+ "aria-label": "Previous page",
510
+ title: "Previous page",
511
+ onClick: () => onPageChange(currentPage - 1),
512
+ disabled: isFirstPageDisabled,
513
+ className: cn(
514
+ compact ? compactButtonClass : "h-8 w-8 p-0",
515
+ navButtonClassName
516
+ ),
517
+ children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(ChevronLeft, { className: compact ? "h-3.5 w-3.5" : "h-4 w-4" })
518
+ }
519
+ ),
520
+ getPageNumbers(3).map((page) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
521
+ Button,
522
+ {
523
+ variant: currentPage === page ? "default" : "outline",
524
+ size: buttonSize,
525
+ "aria-label": `Page ${page}`,
526
+ "aria-current": currentPage === page ? "page" : void 0,
527
+ onClick: () => onPageChange(page),
528
+ className: cn(
529
+ "sm:hidden",
530
+ page === currentPage ? "inline-flex" : "hidden min-[360px]:inline-flex",
531
+ compact ? compactButtonClass : "h-8 w-8 p-0",
532
+ compact && page === currentPage && compactActiveButtonClass,
533
+ page === currentPage ? pageActiveButtonClassName : pageButtonClassName
534
+ ),
535
+ children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "relative z-10", children: page })
536
+ },
537
+ `mobile-${page}`
538
+ )),
539
+ getPageNumbers().map((page) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
540
+ Button,
541
+ {
542
+ variant: currentPage === page ? "default" : "outline",
543
+ size: buttonSize,
544
+ "aria-label": `Page ${page}`,
545
+ "aria-current": currentPage === page ? "page" : void 0,
546
+ onClick: () => onPageChange(page),
547
+ className: cn(
548
+ "hidden sm:inline-flex",
549
+ compact ? compactButtonClass : "h-8 w-8 p-0",
550
+ compact && page === currentPage && compactActiveButtonClass,
551
+ currentPage === page ? pageActiveButtonClassName : pageButtonClassName
552
+ ),
553
+ children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "relative z-10", children: page })
554
+ },
555
+ `desktop-${page}`
556
+ )),
557
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
558
+ Button,
559
+ {
560
+ variant: "outline",
561
+ size: buttonSize,
562
+ "aria-label": "Next page",
563
+ title: "Next page",
564
+ onClick: () => onPageChange(currentPage + 1),
565
+ disabled: isLastPageDisabled,
566
+ className: cn(
567
+ compact ? compactButtonClass : "h-8 w-8 p-0",
568
+ navButtonClassName
569
+ ),
570
+ children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(ChevronRight, { className: compact ? "h-3.5 w-3.5" : "h-4 w-4" })
571
+ }
572
+ ),
573
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
574
+ Button,
575
+ {
576
+ variant: "outline",
577
+ size: buttonSize,
578
+ "aria-label": "Last page",
579
+ title: "Last page",
580
+ onClick: () => onPageChange(totalPages),
581
+ disabled: isLastPageDisabled,
582
+ className: cn(
583
+ "hidden sm:inline-flex",
584
+ compact ? compactButtonClass : "h-8 w-8 p-0",
585
+ navButtonClassName
586
+ ),
587
+ children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(ChevronsRight, { className: compact ? "h-3.5 w-3.5" : "h-4 w-4" })
588
+ }
589
+ )
590
+ ]
591
+ }
592
+ )
593
+ ] });
594
+ }
595
+ //# sourceMappingURL=pagination.cjs.map