@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,563 @@
1
+ "use client";
2
+ "use client";
3
+
4
+ // src/button.tsx
5
+ import { Slot } from "@radix-ui/react-slot";
6
+ import { cva } from "class-variance-authority";
7
+ import * as React from "react";
8
+
9
+ // src/cn.ts
10
+ import { clsx } from "clsx";
11
+ import { twMerge } from "tailwind-merge";
12
+ function cn(...inputs) {
13
+ return twMerge(clsx(inputs));
14
+ }
15
+
16
+ // src/button.tsx
17
+ import { jsx } from "react/jsx-runtime";
18
+ var buttonVariants = cva(
19
+ "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",
20
+ {
21
+ variants: {
22
+ variant: {
23
+ default: "bg-primary text-primary-foreground shadow-sm hover:bg-primary/90",
24
+ /**
25
+ * An explicit spelling of `default`, identical by construction. It is
26
+ * not decoration: matrx-frontend's `ButtonMine` fork carried it, ~17
27
+ * call sites say `variant="primary"`, and the alternative to keeping
28
+ * the word was a host shim translating a prop — the massage C22 bans.
29
+ */
30
+ primary: "bg-primary text-primary-foreground shadow-sm hover:bg-primary/90",
31
+ destructive: "bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",
32
+ /** The affirmative twin of `destructive` — confirm, approve, publish. */
33
+ success: "bg-success text-success-foreground shadow-sm hover:bg-success/90",
34
+ outline: "border border-border bg-card shadow-sm hover:bg-accent hover:text-accent-foreground",
35
+ secondary: "bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",
36
+ ghost: "hover:bg-accent hover:text-accent-foreground",
37
+ link: "text-primary underline-offset-4 hover:underline",
38
+ subtle: "border border-transparent bg-muted/50 text-foreground hover:border-border hover:bg-muted"
39
+ },
40
+ /**
41
+ * ONE size scale, xs → 3xl, plus the two icon boxes. The top and bottom
42
+ * of the scale came in from matrx-frontend's `ButtonMine` fork (2026-09-07):
43
+ * a dense toolbar needs `xs`, and a marketing/hero call to action needs
44
+ * `xl`+. A host that has to reach outside this scale forks the button,
45
+ * which is exactly how `ButtonMine` was born.
46
+ */
47
+ size: {
48
+ xs: "h-6 rounded-md px-1 text-xs",
49
+ sm: "h-8 rounded-md px-3 text-xs",
50
+ default: "h-9 px-4 py-2",
51
+ /** An explicit spelling of `default` (the fork's middle rung). */
52
+ md: "h-9 px-4 py-2",
53
+ lg: "h-10 rounded-md px-6",
54
+ xl: "h-12 px-8 py-3 text-base",
55
+ "2xl": "h-14 px-10 py-3 text-base",
56
+ "3xl": "h-16 px-12 py-3 text-base",
57
+ icon: "h-9 w-9",
58
+ "icon-sm": "h-7 w-7",
59
+ /** A circular icon box — an avatar-shaped control, not a square one. */
60
+ roundIcon: "h-8 w-8 rounded-full p-0"
61
+ }
62
+ },
63
+ defaultVariants: {
64
+ variant: "default",
65
+ size: "default"
66
+ }
67
+ }
68
+ );
69
+ var Button = React.forwardRef(
70
+ ({ className, variant, size, asChild = false, ...props }, ref) => {
71
+ const Component = asChild ? Slot : "button";
72
+ return /* @__PURE__ */ jsx(
73
+ Component,
74
+ {
75
+ className: cn(buttonVariants({ variant, size, className })),
76
+ ref,
77
+ ...props
78
+ }
79
+ );
80
+ }
81
+ );
82
+ Button.displayName = "Button";
83
+
84
+ // src/data-table/icons.tsx
85
+ import { jsx as jsx2, jsxs } from "react/jsx-runtime";
86
+ function Icon({ children, ...props }) {
87
+ return /* @__PURE__ */ jsx2("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", "aria-hidden": "true", ...props, children });
88
+ }
89
+ var ChevronLeft = (p) => /* @__PURE__ */ jsx2(Icon, { ...p, children: /* @__PURE__ */ jsx2("path", { d: "m15 18-6-6 6-6" }) });
90
+ var ChevronRight = (p) => /* @__PURE__ */ jsx2(Icon, { ...p, children: /* @__PURE__ */ jsx2("path", { d: "m9 18 6-6-6-6" }) });
91
+ var ChevronsLeft = (p) => /* @__PURE__ */ jsx2(Icon, { ...p, children: /* @__PURE__ */ jsx2("path", { d: "m11 18-6-6 6-6m8 12-6-6 6-6" }) });
92
+ var ChevronsRight = (p) => /* @__PURE__ */ jsx2(Icon, { ...p, children: /* @__PURE__ */ jsx2("path", { d: "m5 18 6-6-6-6m8 12 6-6-6-6" }) });
93
+
94
+ // src/select.tsx
95
+ import * as SelectPrimitive from "@radix-ui/react-select";
96
+ import { cva as cva2 } from "class-variance-authority";
97
+ import * as React3 from "react";
98
+
99
+ // src/motion.ts
100
+ var MOTION_OVERLAY = "matrx-motion-overlay";
101
+ var MOTION_DIALOG = "matrx-motion-dialog";
102
+ var POPPER_OFFSET = "matrx-popper-offset";
103
+ var MOTION_BOTTOM_SHEET = "matrx-motion-bottom-sheet";
104
+ var MOTION_POPPER = "matrx-motion-popper";
105
+ var MOTION_SHEET = {
106
+ top: "matrx-motion-sheet-top",
107
+ bottom: "matrx-motion-sheet-bottom",
108
+ left: "matrx-motion-sheet-left",
109
+ right: "matrx-motion-sheet-right",
110
+ center: "matrx-motion-sheet-center"
111
+ };
112
+ var MOTION_PULSE = "matrx-pulse";
113
+ var MOTION_SPIN = "matrx-spin";
114
+ var ALL_MOTION_CLASSES = [
115
+ MOTION_OVERLAY,
116
+ MOTION_DIALOG,
117
+ MOTION_BOTTOM_SHEET,
118
+ MOTION_POPPER,
119
+ ...Object.values(MOTION_SHEET),
120
+ MOTION_PULSE,
121
+ MOTION_SPIN
122
+ ];
123
+
124
+ // src/icons.tsx
125
+ import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
126
+ function radixProps(props) {
127
+ return {
128
+ xmlns: "http://www.w3.org/2000/svg",
129
+ viewBox: "0 0 15 15",
130
+ width: 15,
131
+ height: 15,
132
+ fill: "none",
133
+ "aria-hidden": true,
134
+ ...props
135
+ };
136
+ }
137
+ function CheckIcon(props) {
138
+ return /* @__PURE__ */ jsx3("svg", { ...radixProps(props), children: /* @__PURE__ */ jsx3(
139
+ "path",
140
+ {
141
+ 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",
142
+ fill: "currentColor",
143
+ fillRule: "evenodd",
144
+ clipRule: "evenodd"
145
+ }
146
+ ) });
147
+ }
148
+ function RadixChevronDownIcon(props) {
149
+ return /* @__PURE__ */ jsx3("svg", { ...radixProps(props), children: /* @__PURE__ */ jsx3(
150
+ "path",
151
+ {
152
+ 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",
153
+ fill: "currentColor",
154
+ fillRule: "evenodd",
155
+ clipRule: "evenodd"
156
+ }
157
+ ) });
158
+ }
159
+ function RadixChevronUpIcon(props) {
160
+ return /* @__PURE__ */ jsx3("svg", { ...radixProps(props), children: /* @__PURE__ */ jsx3(
161
+ "path",
162
+ {
163
+ 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",
164
+ fill: "currentColor",
165
+ fillRule: "evenodd",
166
+ clipRule: "evenodd"
167
+ }
168
+ ) });
169
+ }
170
+
171
+ // src/portal-container.tsx
172
+ import * as React2 from "react";
173
+ import { jsx as jsx4 } from "react/jsx-runtime";
174
+ var CONTEXT_SLOT = /* @__PURE__ */ Symbol.for("ai-matrx.design-system.portal-container-context");
175
+ var contextRegistry = globalThis;
176
+ var PortalContainerContext = contextRegistry[CONTEXT_SLOT] ??= React2.createContext(void 0);
177
+ function usePortalContainer(explicit) {
178
+ const injected = React2.useContext(PortalContainerContext);
179
+ if (explicit !== void 0) {
180
+ return explicit ?? void 0;
181
+ }
182
+ return injected ?? void 0;
183
+ }
184
+
185
+ // src/select.tsx
186
+ import { jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
187
+ var Select = SelectPrimitive.Root;
188
+ var SelectValue = SelectPrimitive.Value;
189
+ var selectTriggerVariants = cva2(
190
+ "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",
191
+ {
192
+ variants: {
193
+ size: {
194
+ sm: "h-7 px-2 py-1 text-xs",
195
+ default: "h-9 px-3 py-1",
196
+ lg: "h-10 px-3 py-2"
197
+ }
198
+ },
199
+ defaultVariants: {
200
+ size: "default"
201
+ }
202
+ }
203
+ );
204
+ var SelectTrigger = React3.forwardRef(({ className, children, hideArrow = false, size, ...props }, ref) => /* @__PURE__ */ jsxs3(
205
+ SelectPrimitive.Trigger,
206
+ {
207
+ ref,
208
+ className: cn(selectTriggerVariants({ size, className })),
209
+ ...props,
210
+ children: [
211
+ children,
212
+ !hideArrow && /* @__PURE__ */ jsx5(SelectPrimitive.Icon, { asChild: true, children: /* @__PURE__ */ jsx5(RadixChevronDownIcon, { className: "h-4 w-4 opacity-50" }) })
213
+ ]
214
+ }
215
+ ));
216
+ SelectTrigger.displayName = SelectPrimitive.Trigger.displayName;
217
+ var SelectScrollUpButton = React3.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx5(
218
+ SelectPrimitive.ScrollUpButton,
219
+ {
220
+ ref,
221
+ className: cn(
222
+ "flex cursor-default items-center justify-center py-1",
223
+ className
224
+ ),
225
+ ...props,
226
+ children: /* @__PURE__ */ jsx5(RadixChevronUpIcon, {})
227
+ }
228
+ ));
229
+ SelectScrollUpButton.displayName = SelectPrimitive.ScrollUpButton.displayName;
230
+ var SelectScrollDownButton = React3.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx5(
231
+ SelectPrimitive.ScrollDownButton,
232
+ {
233
+ ref,
234
+ className: cn(
235
+ "flex cursor-default items-center justify-center py-1",
236
+ className
237
+ ),
238
+ ...props,
239
+ children: /* @__PURE__ */ jsx5(RadixChevronDownIcon, {})
240
+ }
241
+ ));
242
+ SelectScrollDownButton.displayName = SelectPrimitive.ScrollDownButton.displayName;
243
+ var SelectContent = React3.forwardRef(
244
+ ({
245
+ className,
246
+ children,
247
+ position = "popper",
248
+ container,
249
+ animated = true,
250
+ ...props
251
+ }, ref) => {
252
+ const portalContainer = usePortalContainer(container);
253
+ return /* @__PURE__ */ jsx5(SelectPrimitive.Portal, { container: portalContainer, children: /* @__PURE__ */ jsxs3(
254
+ SelectPrimitive.Content,
255
+ {
256
+ ref,
257
+ className: cn(
258
+ "relative z-[10001] max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md",
259
+ animated && MOTION_POPPER,
260
+ // The resting gap from the trigger. It is the `translate` property
261
+ // (POPPER_OFFSET), never Tailwind translate utilities: those compose
262
+ // with `transform` on a v4 host and are REPLACED by it on a v3 one,
263
+ // so on v3 the animation ate the gap and the surface snapped 4px at
264
+ // the end. Same law as the centred dialog card — see motion.ts.
265
+ position === "popper" && POPPER_OFFSET,
266
+ className
267
+ ),
268
+ position,
269
+ ...props,
270
+ children: [
271
+ /* @__PURE__ */ jsx5(SelectScrollUpButton, {}),
272
+ /* @__PURE__ */ jsx5(
273
+ SelectPrimitive.Viewport,
274
+ {
275
+ className: cn(
276
+ "p-0.5 overflow-y-auto",
277
+ position === "popper" && "w-full min-w-[var(--radix-select-trigger-width)] max-h-[var(--radix-select-content-available-height)]"
278
+ ),
279
+ children
280
+ }
281
+ ),
282
+ /* @__PURE__ */ jsx5(SelectScrollDownButton, {})
283
+ ]
284
+ }
285
+ ) });
286
+ }
287
+ );
288
+ SelectContent.displayName = SelectPrimitive.Content.displayName;
289
+ var SelectLabel = React3.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx5(
290
+ SelectPrimitive.Label,
291
+ {
292
+ ref,
293
+ className: cn("px-2 py-1.5 text-sm font-semibold", className),
294
+ ...props
295
+ }
296
+ ));
297
+ SelectLabel.displayName = SelectPrimitive.Label.displayName;
298
+ var SelectItem = React3.forwardRef(({ className, children, description, ...props }, ref) => /* @__PURE__ */ jsxs3(
299
+ SelectPrimitive.Item,
300
+ {
301
+ ref,
302
+ className: cn(
303
+ "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",
304
+ description ? "flex-col items-start gap-0.5 py-1.5" : "items-center",
305
+ className
306
+ ),
307
+ ...props,
308
+ children: [
309
+ /* @__PURE__ */ jsx5("span", { className: "absolute right-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ jsx5(SelectPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx5(CheckIcon, { className: "h-4 w-4" }) }) }),
310
+ /* @__PURE__ */ jsx5(SelectPrimitive.ItemText, { children }),
311
+ description ? /* @__PURE__ */ jsx5("span", { className: "block text-xs leading-snug text-muted-foreground", children: description }) : null
312
+ ]
313
+ }
314
+ ));
315
+ SelectItem.displayName = SelectPrimitive.Item.displayName;
316
+ var SelectSeparator = React3.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx5(
317
+ SelectPrimitive.Separator,
318
+ {
319
+ ref,
320
+ className: cn("-mx-1 my-1 h-px bg-muted", className),
321
+ ...props
322
+ }
323
+ ));
324
+ SelectSeparator.displayName = SelectPrimitive.Separator.displayName;
325
+
326
+ // src/data-table/pagination.tsx
327
+ import { Fragment, jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
328
+ function GenericTablePagination({
329
+ totalItems,
330
+ itemsPerPage,
331
+ currentPage,
332
+ onPageChange,
333
+ onItemsPerPageChange,
334
+ pageSizeOptions = [5, 10, 25, 50, 100],
335
+ className = "",
336
+ showItemsPerPageSelect = true,
337
+ showPageInfo = true,
338
+ showPageControls = true,
339
+ maxPagesToShow = 5,
340
+ containerClassName = "",
341
+ selectContainerClassName = "",
342
+ infoContainerClassName = "",
343
+ controlsContainerClassName = "",
344
+ pageButtonClassName = "",
345
+ pageActiveButtonClassName = "",
346
+ navButtonClassName = "",
347
+ allValue = totalItems,
348
+ allOptionLabel = "All",
349
+ showAllOption = true,
350
+ layoutType = "grid",
351
+ labelFormat,
352
+ compact = false,
353
+ hideEntriesInfo = false
354
+ }) {
355
+ const positivePageSizes = pageSizeOptions.filter((size) => size > 0);
356
+ const availablePageSizes = itemsPerPage > 0 && !positivePageSizes.includes(itemsPerPage) ? [...positivePageSizes, itemsPerPage].sort((a, b) => a - b) : positivePageSizes;
357
+ const effectiveItemsPerPage = itemsPerPage === 0 ? Math.max(totalItems, 1) : Math.max(itemsPerPage, 1);
358
+ const totalPages = Math.max(1, Math.ceil(totalItems / effectiveItemsPerPage));
359
+ const getPageNumbers = (limit = maxPagesToShow) => {
360
+ let startPage = Math.max(1, currentPage - Math.floor(limit / 2));
361
+ const endPage = Math.min(totalPages, startPage + limit - 1);
362
+ startPage = Math.max(1, endPage - limit + 1);
363
+ return Array.from(
364
+ { length: endPage - startPage + 1 },
365
+ (_, i) => startPage + i
366
+ );
367
+ };
368
+ const isFirstPageDisabled = currentPage <= 1;
369
+ const isLastPageDisabled = currentPage >= totalPages;
370
+ const startItem = totalItems === 0 ? 0 : (currentPage - 1) * effectiveItemsPerPage + 1;
371
+ const endItem = Math.min(currentPage * effectiveItemsPerPage, totalItems);
372
+ const defaultLabelFormat = (start, end, total) => {
373
+ return compact ? `${start}-${end} of ${total}` : `Showing ${start} to ${end} of ${total} entries`;
374
+ };
375
+ const formatLabel = labelFormat || defaultLabelFormat;
376
+ const buttonSize = compact ? "sm" : "icon";
377
+ 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";
378
+ 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";
379
+ const containerClass = cn(
380
+ "w-full items-center border-t border-border",
381
+ layoutType === "grid" ? "grid grid-cols-[auto_minmax(0,1fr)_auto]" : "flex flex-nowrap justify-between",
382
+ compact ? "h-11 gap-0 px-0 py-0 lg:h-8" : "gap-1 px-2 py-1 sm:gap-4 sm:px-3",
383
+ className,
384
+ containerClassName
385
+ );
386
+ return /* @__PURE__ */ jsxs4("div", { "data-matrx-table-footer": true, className: containerClass, children: [
387
+ showItemsPerPageSelect && /* @__PURE__ */ jsx6(
388
+ "div",
389
+ {
390
+ className: cn(
391
+ "flex min-w-0 justify-start",
392
+ !compact && "sm:p-1",
393
+ selectContainerClassName
394
+ ),
395
+ children: /* @__PURE__ */ jsxs4(
396
+ Select,
397
+ {
398
+ value: itemsPerPage.toString(),
399
+ onValueChange: (value) => onItemsPerPageChange(parseInt(value)),
400
+ children: [
401
+ /* @__PURE__ */ jsx6(
402
+ SelectTrigger,
403
+ {
404
+ "aria-label": "Rows per page",
405
+ className: cn(
406
+ "focus:ring-0",
407
+ 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"
408
+ ),
409
+ children: /* @__PURE__ */ jsx6(SelectValue, { placeholder: itemsPerPage.toString() })
410
+ }
411
+ ),
412
+ /* @__PURE__ */ jsxs4(SelectContent, { children: [
413
+ availablePageSizes.map((size) => /* @__PURE__ */ jsx6(SelectItem, { value: size.toString(), children: size }, size)),
414
+ showAllOption ? /* @__PURE__ */ jsx6(SelectItem, { value: allValue.toString(), children: allOptionLabel }) : null
415
+ ] })
416
+ ]
417
+ }
418
+ )
419
+ }
420
+ ),
421
+ /* @__PURE__ */ jsx6(
422
+ "div",
423
+ {
424
+ className: cn("flex min-w-0 justify-center", infoContainerClassName),
425
+ children: showPageInfo && !hideEntriesInfo && /* @__PURE__ */ jsxs4(Fragment, { children: [
426
+ /* @__PURE__ */ jsxs4("span", { className: "truncate text-[10px] tabular-nums text-muted-foreground sm:hidden", children: [
427
+ startItem,
428
+ "-",
429
+ endItem,
430
+ " / ",
431
+ totalItems
432
+ ] }),
433
+ /* @__PURE__ */ jsx6(
434
+ "span",
435
+ {
436
+ className: `hidden whitespace-nowrap ${compact ? "text-xs" : "text-sm"} text-muted-foreground sm:inline`,
437
+ children: formatLabel(startItem, endItem, totalItems)
438
+ }
439
+ )
440
+ ] })
441
+ }
442
+ ),
443
+ showPageControls && /* @__PURE__ */ jsxs4(
444
+ "div",
445
+ {
446
+ className: cn(
447
+ "flex min-w-0 items-center justify-end",
448
+ compact ? "gap-0" : "gap-0.5 sm:gap-1",
449
+ controlsContainerClassName
450
+ ),
451
+ children: [
452
+ /* @__PURE__ */ jsx6(
453
+ Button,
454
+ {
455
+ variant: "outline",
456
+ size: buttonSize,
457
+ "aria-label": "First page",
458
+ title: "First page",
459
+ onClick: () => onPageChange(1),
460
+ disabled: isFirstPageDisabled,
461
+ className: cn(
462
+ "hidden sm:inline-flex",
463
+ compact ? compactButtonClass : "h-8 w-8 p-0",
464
+ navButtonClassName
465
+ ),
466
+ children: /* @__PURE__ */ jsx6(ChevronsLeft, { className: compact ? "h-3.5 w-3.5" : "h-4 w-4" })
467
+ }
468
+ ),
469
+ /* @__PURE__ */ jsx6(
470
+ Button,
471
+ {
472
+ variant: "outline",
473
+ size: buttonSize,
474
+ "aria-label": "Previous page",
475
+ title: "Previous page",
476
+ onClick: () => onPageChange(currentPage - 1),
477
+ disabled: isFirstPageDisabled,
478
+ className: cn(
479
+ compact ? compactButtonClass : "h-8 w-8 p-0",
480
+ navButtonClassName
481
+ ),
482
+ children: /* @__PURE__ */ jsx6(ChevronLeft, { className: compact ? "h-3.5 w-3.5" : "h-4 w-4" })
483
+ }
484
+ ),
485
+ getPageNumbers(3).map((page) => /* @__PURE__ */ jsx6(
486
+ Button,
487
+ {
488
+ variant: currentPage === page ? "default" : "outline",
489
+ size: buttonSize,
490
+ "aria-label": `Page ${page}`,
491
+ "aria-current": currentPage === page ? "page" : void 0,
492
+ onClick: () => onPageChange(page),
493
+ className: cn(
494
+ "sm:hidden",
495
+ page === currentPage ? "inline-flex" : "hidden min-[360px]:inline-flex",
496
+ compact ? compactButtonClass : "h-8 w-8 p-0",
497
+ compact && page === currentPage && compactActiveButtonClass,
498
+ page === currentPage ? pageActiveButtonClassName : pageButtonClassName
499
+ ),
500
+ children: /* @__PURE__ */ jsx6("span", { className: "relative z-10", children: page })
501
+ },
502
+ `mobile-${page}`
503
+ )),
504
+ getPageNumbers().map((page) => /* @__PURE__ */ jsx6(
505
+ Button,
506
+ {
507
+ variant: currentPage === page ? "default" : "outline",
508
+ size: buttonSize,
509
+ "aria-label": `Page ${page}`,
510
+ "aria-current": currentPage === page ? "page" : void 0,
511
+ onClick: () => onPageChange(page),
512
+ className: cn(
513
+ "hidden sm:inline-flex",
514
+ compact ? compactButtonClass : "h-8 w-8 p-0",
515
+ compact && page === currentPage && compactActiveButtonClass,
516
+ currentPage === page ? pageActiveButtonClassName : pageButtonClassName
517
+ ),
518
+ children: /* @__PURE__ */ jsx6("span", { className: "relative z-10", children: page })
519
+ },
520
+ `desktop-${page}`
521
+ )),
522
+ /* @__PURE__ */ jsx6(
523
+ Button,
524
+ {
525
+ variant: "outline",
526
+ size: buttonSize,
527
+ "aria-label": "Next page",
528
+ title: "Next page",
529
+ onClick: () => onPageChange(currentPage + 1),
530
+ disabled: isLastPageDisabled,
531
+ className: cn(
532
+ compact ? compactButtonClass : "h-8 w-8 p-0",
533
+ navButtonClassName
534
+ ),
535
+ children: /* @__PURE__ */ jsx6(ChevronRight, { className: compact ? "h-3.5 w-3.5" : "h-4 w-4" })
536
+ }
537
+ ),
538
+ /* @__PURE__ */ jsx6(
539
+ Button,
540
+ {
541
+ variant: "outline",
542
+ size: buttonSize,
543
+ "aria-label": "Last page",
544
+ title: "Last page",
545
+ onClick: () => onPageChange(totalPages),
546
+ disabled: isLastPageDisabled,
547
+ className: cn(
548
+ "hidden sm:inline-flex",
549
+ compact ? compactButtonClass : "h-8 w-8 p-0",
550
+ navButtonClassName
551
+ ),
552
+ children: /* @__PURE__ */ jsx6(ChevronsRight, { className: compact ? "h-3.5 w-3.5" : "h-4 w-4" })
553
+ }
554
+ )
555
+ ]
556
+ }
557
+ )
558
+ ] });
559
+ }
560
+ export {
561
+ GenericTablePagination as default
562
+ };
563
+ //# sourceMappingURL=pagination.js.map