@stereopt/data-table 0.1.9 → 0.1.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +463 -33
- package/dist/index.js +459 -33
- package/dist/styles.css +457 -0
- package/package.json +5 -3
package/dist/index.cjs
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
2
3
|
var __defProp = Object.defineProperty;
|
|
3
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
5
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
8
|
var __export = (target, all) => {
|
|
7
9
|
for (var name in all)
|
|
@@ -15,6 +17,14 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
15
17
|
}
|
|
16
18
|
return to;
|
|
17
19
|
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
18
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
29
|
|
|
20
30
|
// src/index.ts
|
|
@@ -111,9 +121,404 @@ function TableCell({ className, ...props }) {
|
|
|
111
121
|
);
|
|
112
122
|
}
|
|
113
123
|
|
|
124
|
+
// src/components/ui/button.tsx
|
|
125
|
+
var import_class_variance_authority = require("class-variance-authority");
|
|
126
|
+
|
|
127
|
+
// node_modules/@radix-ui/react-slot/dist/index.mjs
|
|
128
|
+
var dist_exports = {};
|
|
129
|
+
__export(dist_exports, {
|
|
130
|
+
Root: () => Slot,
|
|
131
|
+
Slot: () => Slot,
|
|
132
|
+
Slottable: () => Slottable,
|
|
133
|
+
createSlot: () => createSlot,
|
|
134
|
+
createSlottable: () => createSlottable
|
|
135
|
+
});
|
|
136
|
+
var React2 = __toESM(require("react"), 1);
|
|
137
|
+
|
|
138
|
+
// node_modules/@radix-ui/react-compose-refs/dist/index.mjs
|
|
139
|
+
var React = __toESM(require("react"), 1);
|
|
140
|
+
function setRef(ref, value) {
|
|
141
|
+
if (typeof ref === "function") {
|
|
142
|
+
return ref(value);
|
|
143
|
+
} else if (ref !== null && ref !== void 0) {
|
|
144
|
+
ref.current = value;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
function composeRefs(...refs) {
|
|
148
|
+
return (node) => {
|
|
149
|
+
let hasCleanup = false;
|
|
150
|
+
const cleanups = refs.map((ref) => {
|
|
151
|
+
const cleanup = setRef(ref, node);
|
|
152
|
+
if (!hasCleanup && typeof cleanup == "function") {
|
|
153
|
+
hasCleanup = true;
|
|
154
|
+
}
|
|
155
|
+
return cleanup;
|
|
156
|
+
});
|
|
157
|
+
if (hasCleanup) {
|
|
158
|
+
return () => {
|
|
159
|
+
for (let i = 0; i < cleanups.length; i++) {
|
|
160
|
+
const cleanup = cleanups[i];
|
|
161
|
+
if (typeof cleanup == "function") {
|
|
162
|
+
cleanup();
|
|
163
|
+
} else {
|
|
164
|
+
setRef(refs[i], null);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
// node_modules/@radix-ui/react-slot/dist/index.mjs
|
|
173
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
174
|
+
// @__NO_SIDE_EFFECTS__
|
|
175
|
+
function createSlot(ownerName) {
|
|
176
|
+
const SlotClone = /* @__PURE__ */ createSlotClone(ownerName);
|
|
177
|
+
const Slot2 = React2.forwardRef((props, forwardedRef) => {
|
|
178
|
+
const { children, ...slotProps } = props;
|
|
179
|
+
const childrenArray = React2.Children.toArray(children);
|
|
180
|
+
const slottable = childrenArray.find(isSlottable);
|
|
181
|
+
if (slottable) {
|
|
182
|
+
const newElement = slottable.props.children;
|
|
183
|
+
const newChildren = childrenArray.map((child) => {
|
|
184
|
+
if (child === slottable) {
|
|
185
|
+
if (React2.Children.count(newElement) > 1) return React2.Children.only(null);
|
|
186
|
+
return React2.isValidElement(newElement) ? newElement.props.children : null;
|
|
187
|
+
} else {
|
|
188
|
+
return child;
|
|
189
|
+
}
|
|
190
|
+
});
|
|
191
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(SlotClone, { ...slotProps, ref: forwardedRef, children: React2.isValidElement(newElement) ? React2.cloneElement(newElement, void 0, newChildren) : null });
|
|
192
|
+
}
|
|
193
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(SlotClone, { ...slotProps, ref: forwardedRef, children });
|
|
194
|
+
});
|
|
195
|
+
Slot2.displayName = `${ownerName}.Slot`;
|
|
196
|
+
return Slot2;
|
|
197
|
+
}
|
|
198
|
+
var Slot = /* @__PURE__ */ createSlot("Slot");
|
|
199
|
+
// @__NO_SIDE_EFFECTS__
|
|
200
|
+
function createSlotClone(ownerName) {
|
|
201
|
+
const SlotClone = React2.forwardRef((props, forwardedRef) => {
|
|
202
|
+
const { children, ...slotProps } = props;
|
|
203
|
+
if (React2.isValidElement(children)) {
|
|
204
|
+
const childrenRef = getElementRef(children);
|
|
205
|
+
const props2 = mergeProps(slotProps, children.props);
|
|
206
|
+
if (children.type !== React2.Fragment) {
|
|
207
|
+
props2.ref = forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef;
|
|
208
|
+
}
|
|
209
|
+
return React2.cloneElement(children, props2);
|
|
210
|
+
}
|
|
211
|
+
return React2.Children.count(children) > 1 ? React2.Children.only(null) : null;
|
|
212
|
+
});
|
|
213
|
+
SlotClone.displayName = `${ownerName}.SlotClone`;
|
|
214
|
+
return SlotClone;
|
|
215
|
+
}
|
|
216
|
+
var SLOTTABLE_IDENTIFIER = /* @__PURE__ */ Symbol("radix.slottable");
|
|
217
|
+
// @__NO_SIDE_EFFECTS__
|
|
218
|
+
function createSlottable(ownerName) {
|
|
219
|
+
const Slottable2 = ({ children }) => {
|
|
220
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_jsx_runtime2.Fragment, { children });
|
|
221
|
+
};
|
|
222
|
+
Slottable2.displayName = `${ownerName}.Slottable`;
|
|
223
|
+
Slottable2.__radixId = SLOTTABLE_IDENTIFIER;
|
|
224
|
+
return Slottable2;
|
|
225
|
+
}
|
|
226
|
+
var Slottable = /* @__PURE__ */ createSlottable("Slottable");
|
|
227
|
+
function isSlottable(child) {
|
|
228
|
+
return React2.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER;
|
|
229
|
+
}
|
|
230
|
+
function mergeProps(slotProps, childProps) {
|
|
231
|
+
const overrideProps = { ...childProps };
|
|
232
|
+
for (const propName in childProps) {
|
|
233
|
+
const slotPropValue = slotProps[propName];
|
|
234
|
+
const childPropValue = childProps[propName];
|
|
235
|
+
const isHandler = /^on[A-Z]/.test(propName);
|
|
236
|
+
if (isHandler) {
|
|
237
|
+
if (slotPropValue && childPropValue) {
|
|
238
|
+
overrideProps[propName] = (...args) => {
|
|
239
|
+
const result = childPropValue(...args);
|
|
240
|
+
slotPropValue(...args);
|
|
241
|
+
return result;
|
|
242
|
+
};
|
|
243
|
+
} else if (slotPropValue) {
|
|
244
|
+
overrideProps[propName] = slotPropValue;
|
|
245
|
+
}
|
|
246
|
+
} else if (propName === "style") {
|
|
247
|
+
overrideProps[propName] = { ...slotPropValue, ...childPropValue };
|
|
248
|
+
} else if (propName === "className") {
|
|
249
|
+
overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(" ");
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
return { ...slotProps, ...overrideProps };
|
|
253
|
+
}
|
|
254
|
+
function getElementRef(element) {
|
|
255
|
+
let getter = Object.getOwnPropertyDescriptor(element.props, "ref")?.get;
|
|
256
|
+
let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
257
|
+
if (mayWarn) {
|
|
258
|
+
return element.ref;
|
|
259
|
+
}
|
|
260
|
+
getter = Object.getOwnPropertyDescriptor(element, "ref")?.get;
|
|
261
|
+
mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
262
|
+
if (mayWarn) {
|
|
263
|
+
return element.props.ref;
|
|
264
|
+
}
|
|
265
|
+
return element.props.ref || element.ref;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
// src/components/ui/button.tsx
|
|
269
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
270
|
+
var buttonVariants = (0, import_class_variance_authority.cva)(
|
|
271
|
+
"group/button inline-flex shrink-0 items-center justify-center rounded-lg border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
272
|
+
{
|
|
273
|
+
variants: {
|
|
274
|
+
variant: {
|
|
275
|
+
default: "bg-primary text-primary-foreground [a]:hover:bg-primary/80",
|
|
276
|
+
outline: "border-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",
|
|
277
|
+
secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80 aria-expanded:bg-secondary aria-expanded:text-secondary-foreground",
|
|
278
|
+
ghost: "hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50",
|
|
279
|
+
destructive: "bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40",
|
|
280
|
+
link: "text-primary underline-offset-4 hover:underline"
|
|
281
|
+
},
|
|
282
|
+
size: {
|
|
283
|
+
default: "h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",
|
|
284
|
+
xs: "h-6 gap-1 rounded-[min(var(--radius-md),10px)] px-2 text-xs in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3",
|
|
285
|
+
sm: "h-7 gap-1 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5",
|
|
286
|
+
lg: "h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",
|
|
287
|
+
icon: "size-8",
|
|
288
|
+
"icon-xs": "size-6 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-lg [&_svg:not([class*='size-'])]:size-3",
|
|
289
|
+
"icon-sm": "size-7 rounded-[min(var(--radius-md),12px)] in-data-[slot=button-group]:rounded-lg",
|
|
290
|
+
"icon-lg": "size-9"
|
|
291
|
+
}
|
|
292
|
+
},
|
|
293
|
+
defaultVariants: {
|
|
294
|
+
variant: "default",
|
|
295
|
+
size: "default"
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
);
|
|
299
|
+
function Button({
|
|
300
|
+
className,
|
|
301
|
+
variant = "default",
|
|
302
|
+
size = "default",
|
|
303
|
+
asChild = false,
|
|
304
|
+
...props
|
|
305
|
+
}) {
|
|
306
|
+
const Comp = asChild ? dist_exports.Root : "button";
|
|
307
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
308
|
+
Comp,
|
|
309
|
+
{
|
|
310
|
+
className: cn(buttonVariants({ variant, size, className })),
|
|
311
|
+
"data-size": size,
|
|
312
|
+
"data-slot": "button",
|
|
313
|
+
"data-variant": variant,
|
|
314
|
+
...props
|
|
315
|
+
}
|
|
316
|
+
);
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
// node_modules/lucide-react/dist/esm/createLucideIcon.js
|
|
320
|
+
var import_react2 = require("react");
|
|
321
|
+
|
|
322
|
+
// node_modules/lucide-react/dist/esm/shared/src/utils/mergeClasses.js
|
|
323
|
+
var mergeClasses = (...classes) => classes.filter((className, index, array) => {
|
|
324
|
+
return Boolean(className) && className.trim() !== "" && array.indexOf(className) === index;
|
|
325
|
+
}).join(" ").trim();
|
|
326
|
+
|
|
327
|
+
// node_modules/lucide-react/dist/esm/shared/src/utils/toKebabCase.js
|
|
328
|
+
var toKebabCase = (string) => string.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
|
|
329
|
+
|
|
330
|
+
// node_modules/lucide-react/dist/esm/shared/src/utils/toCamelCase.js
|
|
331
|
+
var toCamelCase = (string) => string.replace(
|
|
332
|
+
/^([A-Z])|[\s-_]+(\w)/g,
|
|
333
|
+
(match, p1, p2) => p2 ? p2.toUpperCase() : p1.toLowerCase()
|
|
334
|
+
);
|
|
335
|
+
|
|
336
|
+
// node_modules/lucide-react/dist/esm/shared/src/utils/toPascalCase.js
|
|
337
|
+
var toPascalCase = (string) => {
|
|
338
|
+
const camelCase = toCamelCase(string);
|
|
339
|
+
return camelCase.charAt(0).toUpperCase() + camelCase.slice(1);
|
|
340
|
+
};
|
|
341
|
+
|
|
342
|
+
// node_modules/lucide-react/dist/esm/Icon.js
|
|
343
|
+
var import_react = require("react");
|
|
344
|
+
|
|
345
|
+
// node_modules/lucide-react/dist/esm/defaultAttributes.js
|
|
346
|
+
var defaultAttributes = {
|
|
347
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
348
|
+
width: 24,
|
|
349
|
+
height: 24,
|
|
350
|
+
viewBox: "0 0 24 24",
|
|
351
|
+
fill: "none",
|
|
352
|
+
stroke: "currentColor",
|
|
353
|
+
strokeWidth: 2,
|
|
354
|
+
strokeLinecap: "round",
|
|
355
|
+
strokeLinejoin: "round"
|
|
356
|
+
};
|
|
357
|
+
|
|
358
|
+
// node_modules/lucide-react/dist/esm/shared/src/utils/hasA11yProp.js
|
|
359
|
+
var hasA11yProp = (props) => {
|
|
360
|
+
for (const prop in props) {
|
|
361
|
+
if (prop.startsWith("aria-") || prop === "role" || prop === "title") {
|
|
362
|
+
return true;
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
return false;
|
|
366
|
+
};
|
|
367
|
+
|
|
368
|
+
// node_modules/lucide-react/dist/esm/Icon.js
|
|
369
|
+
var Icon = (0, import_react.forwardRef)(
|
|
370
|
+
({
|
|
371
|
+
color = "currentColor",
|
|
372
|
+
size = 24,
|
|
373
|
+
strokeWidth = 2,
|
|
374
|
+
absoluteStrokeWidth,
|
|
375
|
+
className = "",
|
|
376
|
+
children,
|
|
377
|
+
iconNode,
|
|
378
|
+
...rest
|
|
379
|
+
}, ref) => (0, import_react.createElement)(
|
|
380
|
+
"svg",
|
|
381
|
+
{
|
|
382
|
+
ref,
|
|
383
|
+
...defaultAttributes,
|
|
384
|
+
width: size,
|
|
385
|
+
height: size,
|
|
386
|
+
stroke: color,
|
|
387
|
+
strokeWidth: absoluteStrokeWidth ? Number(strokeWidth) * 24 / Number(size) : strokeWidth,
|
|
388
|
+
className: mergeClasses("lucide", className),
|
|
389
|
+
...!children && !hasA11yProp(rest) && { "aria-hidden": "true" },
|
|
390
|
+
...rest
|
|
391
|
+
},
|
|
392
|
+
[
|
|
393
|
+
...iconNode.map(([tag, attrs]) => (0, import_react.createElement)(tag, attrs)),
|
|
394
|
+
...Array.isArray(children) ? children : [children]
|
|
395
|
+
]
|
|
396
|
+
)
|
|
397
|
+
);
|
|
398
|
+
|
|
399
|
+
// node_modules/lucide-react/dist/esm/createLucideIcon.js
|
|
400
|
+
var createLucideIcon = (iconName, iconNode) => {
|
|
401
|
+
const Component = (0, import_react2.forwardRef)(
|
|
402
|
+
({ className, ...props }, ref) => (0, import_react2.createElement)(Icon, {
|
|
403
|
+
ref,
|
|
404
|
+
iconNode,
|
|
405
|
+
className: mergeClasses(
|
|
406
|
+
`lucide-${toKebabCase(toPascalCase(iconName))}`,
|
|
407
|
+
`lucide-${iconName}`,
|
|
408
|
+
className
|
|
409
|
+
),
|
|
410
|
+
...props
|
|
411
|
+
})
|
|
412
|
+
);
|
|
413
|
+
Component.displayName = toPascalCase(iconName);
|
|
414
|
+
return Component;
|
|
415
|
+
};
|
|
416
|
+
|
|
417
|
+
// node_modules/lucide-react/dist/esm/icons/chevron-left.js
|
|
418
|
+
var __iconNode = [["path", { d: "m15 18-6-6 6-6", key: "1wnfg3" }]];
|
|
419
|
+
var ChevronLeft = createLucideIcon("chevron-left", __iconNode);
|
|
420
|
+
|
|
421
|
+
// node_modules/lucide-react/dist/esm/icons/chevron-right.js
|
|
422
|
+
var __iconNode2 = [["path", { d: "m9 18 6-6-6-6", key: "mthhwq" }]];
|
|
423
|
+
var ChevronRight = createLucideIcon("chevron-right", __iconNode2);
|
|
424
|
+
|
|
425
|
+
// node_modules/lucide-react/dist/esm/icons/chevrons-left.js
|
|
426
|
+
var __iconNode3 = [
|
|
427
|
+
["path", { d: "m11 17-5-5 5-5", key: "13zhaf" }],
|
|
428
|
+
["path", { d: "m18 17-5-5 5-5", key: "h8a8et" }]
|
|
429
|
+
];
|
|
430
|
+
var ChevronsLeft = createLucideIcon("chevrons-left", __iconNode3);
|
|
431
|
+
|
|
432
|
+
// node_modules/lucide-react/dist/esm/icons/chevrons-right.js
|
|
433
|
+
var __iconNode4 = [
|
|
434
|
+
["path", { d: "m6 17 5-5-5-5", key: "xnjwq" }],
|
|
435
|
+
["path", { d: "m13 17 5-5-5-5", key: "17xmmf" }]
|
|
436
|
+
];
|
|
437
|
+
var ChevronsRight = createLucideIcon("chevrons-right", __iconNode4);
|
|
438
|
+
|
|
439
|
+
// src/dataTable/pagination/DataTablePagination.tsx
|
|
440
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
441
|
+
function DataTablePagination({
|
|
442
|
+
table
|
|
443
|
+
}) {
|
|
444
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "flex items-center justify-between px-2 pt-4", children: [
|
|
445
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "text-muted-foreground flex-1 text-sm", children: [
|
|
446
|
+
table.getFilteredRowModel().rows.length,
|
|
447
|
+
" rows"
|
|
448
|
+
] }),
|
|
449
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "flex items-center space-x-6 lg:space-x-8", children: [
|
|
450
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "flex w-[100px] items-center justify-center text-sm font-medium", children: [
|
|
451
|
+
"Page ",
|
|
452
|
+
table.getState().pagination.pageIndex + 1,
|
|
453
|
+
" of",
|
|
454
|
+
" ",
|
|
455
|
+
table.getPageCount() || 1
|
|
456
|
+
] }),
|
|
457
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "flex items-center space-x-2", children: [
|
|
458
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
459
|
+
Button,
|
|
460
|
+
{
|
|
461
|
+
className: "hidden size-8 lg:flex",
|
|
462
|
+
disabled: !table.getCanPreviousPage(),
|
|
463
|
+
onClick: () => table.setPageIndex(0),
|
|
464
|
+
size: "icon",
|
|
465
|
+
variant: "outline",
|
|
466
|
+
children: [
|
|
467
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "sr-only", children: "Go to first page" }),
|
|
468
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ChevronsLeft, {})
|
|
469
|
+
]
|
|
470
|
+
}
|
|
471
|
+
),
|
|
472
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
473
|
+
Button,
|
|
474
|
+
{
|
|
475
|
+
className: "size-8",
|
|
476
|
+
disabled: !table.getCanPreviousPage(),
|
|
477
|
+
onClick: () => table.previousPage(),
|
|
478
|
+
size: "icon",
|
|
479
|
+
variant: "outline",
|
|
480
|
+
children: [
|
|
481
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "sr-only", children: "Go to previous page" }),
|
|
482
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ChevronLeft, {})
|
|
483
|
+
]
|
|
484
|
+
}
|
|
485
|
+
),
|
|
486
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
487
|
+
Button,
|
|
488
|
+
{
|
|
489
|
+
className: "size-8",
|
|
490
|
+
disabled: !table.getCanNextPage(),
|
|
491
|
+
onClick: () => table.nextPage(),
|
|
492
|
+
size: "icon",
|
|
493
|
+
variant: "outline",
|
|
494
|
+
children: [
|
|
495
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "sr-only", children: "Go to next page" }),
|
|
496
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ChevronRight, {})
|
|
497
|
+
]
|
|
498
|
+
}
|
|
499
|
+
),
|
|
500
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
501
|
+
Button,
|
|
502
|
+
{
|
|
503
|
+
className: "hidden size-8 lg:flex",
|
|
504
|
+
disabled: !table.getCanNextPage(),
|
|
505
|
+
onClick: () => table.setPageIndex(table.getPageCount() - 1),
|
|
506
|
+
size: "icon",
|
|
507
|
+
variant: "outline",
|
|
508
|
+
children: [
|
|
509
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "sr-only", children: "Go to last page" }),
|
|
510
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ChevronsRight, {})
|
|
511
|
+
]
|
|
512
|
+
}
|
|
513
|
+
)
|
|
514
|
+
] })
|
|
515
|
+
] })
|
|
516
|
+
] });
|
|
517
|
+
}
|
|
518
|
+
|
|
114
519
|
// src/dataTable/DataTable.tsx
|
|
115
520
|
var import_react_table = require("@tanstack/react-table");
|
|
116
|
-
var
|
|
521
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
117
522
|
function DataTable({
|
|
118
523
|
columns,
|
|
119
524
|
data,
|
|
@@ -132,42 +537,67 @@ function DataTable({
|
|
|
132
537
|
columnVisibility: config?.columnVisibility
|
|
133
538
|
}
|
|
134
539
|
});
|
|
135
|
-
return /* @__PURE__ */ (0,
|
|
136
|
-
/* @__PURE__ */ (0,
|
|
137
|
-
|
|
138
|
-
|
|
540
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "w-full", children: [
|
|
541
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "rounded-md border overflow-hidden", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Table, { children: [
|
|
542
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(TableHeader, { className: "bg-muted", children: table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(TableRow, { children: headerGroup.headers.map((header) => {
|
|
543
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
544
|
+
TableHead,
|
|
545
|
+
{
|
|
546
|
+
colSpan: header.colSpan,
|
|
547
|
+
style: { width: header.getSize() },
|
|
548
|
+
children: header.isPlaceholder ? null : (0, import_react_table.flexRender)(
|
|
549
|
+
header.column.columnDef.header,
|
|
550
|
+
header.getContext()
|
|
551
|
+
)
|
|
552
|
+
},
|
|
553
|
+
header.id
|
|
554
|
+
);
|
|
555
|
+
}) }, headerGroup.id)) }),
|
|
556
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(TableBody, { children: table.getRowModel().rows?.length ? table.getRowModel().rows.map((row) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
557
|
+
TableRow,
|
|
139
558
|
{
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
)
|
|
559
|
+
"data-state": row.getIsSelected() && "selected",
|
|
560
|
+
children: row.getVisibleCells().map((cell) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(TableCell, { className: "truncate max-w-0", children: (0, import_react_table.flexRender)(
|
|
561
|
+
cell.column.columnDef.cell,
|
|
562
|
+
cell.getContext()
|
|
563
|
+
) }, cell.id))
|
|
146
564
|
},
|
|
147
|
-
|
|
148
|
-
)
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
row.id
|
|
160
|
-
)) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(TableRow, { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
161
|
-
TableCell,
|
|
162
|
-
{
|
|
163
|
-
className: "h-24 text-center",
|
|
164
|
-
colSpan: columns.length,
|
|
165
|
-
children: "No results."
|
|
166
|
-
}
|
|
167
|
-
) }) })
|
|
168
|
-
] }) }) });
|
|
565
|
+
row.id
|
|
566
|
+
)) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(TableRow, { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
567
|
+
TableCell,
|
|
568
|
+
{
|
|
569
|
+
className: "h-24 text-center",
|
|
570
|
+
colSpan: columns.length,
|
|
571
|
+
children: "No results."
|
|
572
|
+
}
|
|
573
|
+
) }) })
|
|
574
|
+
] }) }),
|
|
575
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(DataTablePagination, { table })
|
|
576
|
+
] });
|
|
169
577
|
}
|
|
170
578
|
// Annotate the CommonJS export names for ESM import in node:
|
|
171
579
|
0 && (module.exports = {
|
|
172
580
|
DataTable
|
|
173
581
|
});
|
|
582
|
+
/*! Bundled license information:
|
|
583
|
+
|
|
584
|
+
lucide-react/dist/esm/shared/src/utils/mergeClasses.js:
|
|
585
|
+
lucide-react/dist/esm/shared/src/utils/toKebabCase.js:
|
|
586
|
+
lucide-react/dist/esm/shared/src/utils/toCamelCase.js:
|
|
587
|
+
lucide-react/dist/esm/shared/src/utils/toPascalCase.js:
|
|
588
|
+
lucide-react/dist/esm/defaultAttributes.js:
|
|
589
|
+
lucide-react/dist/esm/shared/src/utils/hasA11yProp.js:
|
|
590
|
+
lucide-react/dist/esm/Icon.js:
|
|
591
|
+
lucide-react/dist/esm/createLucideIcon.js:
|
|
592
|
+
lucide-react/dist/esm/icons/chevron-left.js:
|
|
593
|
+
lucide-react/dist/esm/icons/chevron-right.js:
|
|
594
|
+
lucide-react/dist/esm/icons/chevrons-left.js:
|
|
595
|
+
lucide-react/dist/esm/icons/chevrons-right.js:
|
|
596
|
+
lucide-react/dist/esm/lucide-react.js:
|
|
597
|
+
(**
|
|
598
|
+
* @license lucide-react v0.574.0 - ISC
|
|
599
|
+
*
|
|
600
|
+
* This source code is licensed under the ISC license.
|
|
601
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
602
|
+
*)
|
|
603
|
+
*/
|