doom-design-system 0.4.0 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import React from "react";
2
2
  interface ActionRowProps extends React.HTMLAttributes<HTMLDivElement> {
3
3
  icon: React.ReactNode;
4
4
  title: string;
@@ -1,4 +1,4 @@
1
- 'use client';
1
+ "use client";
2
2
  var __rest = (this && this.__rest) || function (s, e) {
3
3
  var t = {};
4
4
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
@@ -11,12 +11,12 @@ var __rest = (this && this.__rest) || function (s, e) {
11
11
  return t;
12
12
  };
13
13
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
14
- import { Text } from '../Text/Text.js';
15
- import { Flex } from '../Layout/Layout.js';
16
- import { ChevronRight } from 'lucide-react';
17
- import clsx from 'clsx';
18
- import styles from './ActionRow.module.css';
14
+ import { Text } from "../Text/Text.js";
15
+ import { Flex } from "../Layout/Layout.js";
16
+ import { ChevronRight } from "lucide-react";
17
+ import clsx from "clsx";
18
+ import styles from "./ActionRow.module.css";
19
19
  export function ActionRow(_a) {
20
20
  var { icon, title, description, onClick, className } = _a, props = __rest(_a, ["icon", "title", "description", "onClick", "className"]);
21
- return (_jsxs(Flex, Object.assign({ align: "center", gap: "1.5rem", onClick: onClick, className: clsx(styles.actionRow, className) }, props, { children: [_jsx("div", { className: styles.iconWrapper, children: icon }), _jsxs(Flex, { direction: "column", gap: "0.25rem", style: { flex: 1 }, children: [_jsx(Text, { variant: "h6", weight: "bold", children: title }), description && (_jsx(Text, { color: "muted", variant: "small", children: description }))] }), _jsx(ChevronRight, { size: 20, strokeWidth: 2.5, style: { color: 'var(--muted-foreground)' } })] })));
21
+ return (_jsxs(Flex, Object.assign({ align: "center", gap: 6, onClick: onClick, className: clsx(styles.actionRow, className) }, props, { children: [_jsx("div", { className: styles.iconWrapper, children: icon }), _jsxs(Flex, { direction: "column", gap: 1, style: { flex: 1 }, children: [_jsx(Text, { variant: "h6", weight: "bold", children: title }), description && (_jsx(Text, { color: "muted", variant: "small", children: description }))] }), _jsx(ChevronRight, { size: 20, strokeWidth: 2.5, style: { color: "var(--muted-foreground)" } })] })));
22
22
  }
@@ -2,7 +2,7 @@
2
2
  display: inline-flex;
3
3
  align-items: center;
4
4
  justify-content: center;
5
- border-radius: var(--radius-pill);
5
+ border-radius: var(--radius);
6
6
  font-weight: 700;
7
7
  text-transform: uppercase;
8
8
  border: 2px solid var(--card-border);
@@ -189,7 +189,7 @@ export const FileUpload = ({ label, helperText, accept, maxSize, multiple = fals
189
189
  }) }, handleDragHandlers, { children: [_jsxs(Switcher, { threshold: "xxs", className: clsx(styles.header, {
190
190
  [styles.errorHeader]: status === Status.Error,
191
191
  [styles.disabledHeader]: disabled,
192
- }), justify: "space-between", align: "center", gap: "var(--spacing-sm)", children: [_jsx("div", { className: styles.headerContent, children: _jsxs(Text, { className: styles.headerTitle, id: "upload-title", children: [label || "Upload Files", required && (_jsx("span", { className: styles.requiredMark, children: _jsx(Asterisk, { size: 14, "aria-label": "required" }) }))] }) }), _jsx(Badge, { variant: status === Status.Error
192
+ }), justify: "space-between", align: "center", gap: 2, children: [_jsx("div", { className: styles.headerContent, children: _jsxs(Text, { className: styles.headerTitle, id: "upload-title", children: [label || "Upload Files", required && (_jsx("span", { className: styles.requiredMark, children: _jsx(Asterisk, { size: 14, "aria-label": "required" }) }))] }) }), _jsx(Badge, { variant: status === Status.Error
193
193
  ? "error"
194
194
  : status === Status.HasFiles
195
195
  ? "success"
@@ -216,9 +216,9 @@ export const FileUpload = ({ label, helperText, accept, maxSize, multiple = fals
216
216
  e.preventDefault();
217
217
  handleClick();
218
218
  }
219
- }, role: "button", tabIndex: disabled ? -1 : 0, children: _jsxs(Stack, { gap: "var(--spacing-md)", align: "center", children: [_jsx("div", { className: styles.voidIconWrapper, "aria-hidden": "true", children: _jsx(Upload, { className: styles.icon, size: 48, strokeWidth: 2 }) }), _jsxs(Stack, { gap: "var(--spacing-xs)", align: "center", children: [_jsx(Text, { weight: "bold", className: styles.voidText, children: isDragging || isActive || forceActive
219
+ }, role: "button", tabIndex: disabled ? -1 : 0, children: _jsxs(Stack, { gap: 4, align: "center", children: [_jsx("div", { className: styles.voidIconWrapper, "aria-hidden": "true", children: _jsx(Upload, { className: styles.icon, size: 48, strokeWidth: 2 }) }), _jsxs(Stack, { gap: 1, align: "center", children: [_jsx(Text, { weight: "bold", className: styles.voidText, children: isDragging || isActive || forceActive
220
220
  ? "Drop files now"
221
- : "Drag and drop files" }), _jsx(Text, { variant: "small", className: styles.secondary, children: "or click to browse" })] }), helperText && (_jsx(Text, { variant: "small", className: styles.helperText, id: "upload-helper", children: helperText })), displayError && (_jsx(Text, { variant: "small", className: styles.errorText, id: "upload-error", children: displayError }))] }) })) : (_jsxs(Flex, { direction: "column", justify: "space-between", gap: "var(--spacing-md)", className: styles.fileList, children: [_jsx(Stack, { gap: "var(--spacing-sm)", children: files.map((file, index) => {
221
+ : "Drag and drop files" }), _jsx(Text, { variant: "small", className: styles.secondary, children: "or click to browse" })] }), helperText && (_jsx(Text, { variant: "small", className: styles.helperText, id: "upload-helper", children: helperText })), displayError && (_jsx(Text, { variant: "small", className: styles.errorText, id: "upload-error", children: displayError }))] }) })) : (_jsxs(Flex, { direction: "column", justify: "space-between", gap: 4, className: styles.fileList, children: [_jsx(Stack, { gap: 2, children: files.map((file, index) => {
222
222
  const previewUrl = previews[file.name];
223
223
  return (_jsx(Slat, { label: file.name, secondaryLabel: formatFileSize(file.size), prependContent: previewUrl ? (_jsx(PreviewImage, { src: previewUrl, alt: file.name })) : (getFileIcon(file.name)), appendContent: _jsx(Button, { type: "button", variant: "danger", size: "sm", onClick: (e) => {
224
224
  e.stopPropagation();
@@ -5,4 +5,4 @@ export interface ImageProps extends React.ImgHTMLAttributes<HTMLImageElement> {
5
5
  aspectRatio?: string | number;
6
6
  rounded?: boolean;
7
7
  }
8
- export declare function Image({ src, alt, className, fit, style, onLoad, onError, fallbackSrc, aspectRatio, rounded, ...props }: ImageProps): import("react/jsx-runtime").JSX.Element;
8
+ export declare function Image({ src, alt, className, fit, style, onLoad, onError, fallbackSrc, aspectRatio, rounded, width, height, ...props }: ImageProps): import("react/jsx-runtime").JSX.Element;
@@ -11,50 +11,81 @@ var __rest = (this && this.__rest) || function (s, e) {
11
11
  return t;
12
12
  };
13
13
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
14
- import { useState, useRef, useEffect } from "react";
14
+ import React, { useState, useEffect, useCallback } from "react";
15
15
  import clsx from "clsx";
16
16
  import styles from "./Image.module.css";
17
17
  import { Skeleton } from "../Skeleton/Skeleton.js";
18
18
  export function Image(_a) {
19
- var { src, alt, className, fit, style, onLoad, onError, fallbackSrc, aspectRatio, rounded = true } = _a, props = __rest(_a, ["src", "alt", "className", "fit", "style", "onLoad", "onError", "fallbackSrc", "aspectRatio", "rounded"]);
20
- const [isLoaded, setIsLoaded] = useState(false);
21
- const [hasError, setHasError] = useState(false);
22
- const [showSkeleton, setShowSkeleton] = useState(false);
23
- const timerRef = useRef(null);
19
+ var { src, alt, className, fit, style, onLoad, onError, fallbackSrc, aspectRatio, rounded = true, width, height } = _a, props = __rest(_a, ["src", "alt", "className", "fit", "style", "onLoad", "onError", "fallbackSrc", "aspectRatio", "rounded", "width", "height"]);
20
+ const [status, setStatus] = useState("loading");
21
+ const [showSkeleton, setShowSkeleton] = useState(true);
22
+ // Helper to extract intrinsic numeric value and convert to CSS
23
+ const toCssValue = (val) => {
24
+ if (val === undefined || val === null)
25
+ return undefined;
26
+ if (typeof val === "number")
27
+ return `${val}px`;
28
+ return val;
29
+ };
30
+ const getIntrinsicSize = (val) => {
31
+ if (typeof val === "number")
32
+ return val;
33
+ if (typeof val === "string" && !val.endsWith("%")) {
34
+ const parsed = parseFloat(val);
35
+ return isNaN(parsed) ? undefined : parsed;
36
+ }
37
+ return undefined;
38
+ };
39
+ const computedAspectRatio = React.useMemo(() => {
40
+ if (aspectRatio)
41
+ return aspectRatio;
42
+ const w = getIntrinsicSize(width);
43
+ const h = getIntrinsicSize(height);
44
+ return w && h ? `${w} / ${h}` : undefined;
45
+ }, [aspectRatio, width, height]);
46
+ // Reset state when source changes
24
47
  useEffect(() => {
25
- setIsLoaded(false);
26
- setHasError(false);
27
- setShowSkeleton(false);
28
- if (timerRef.current)
29
- clearTimeout(timerRef.current);
30
- timerRef.current = setTimeout(() => {
31
- setShowSkeleton(true);
32
- }, 150);
33
- return () => {
34
- if (timerRef.current)
35
- clearTimeout(timerRef.current);
36
- };
48
+ setStatus("loading");
49
+ setShowSkeleton(true);
37
50
  }, [src]);
38
- const handleLoad = (e) => {
39
- if (timerRef.current)
40
- clearTimeout(timerRef.current);
41
- setIsLoaded(true);
51
+ // When loaded, keep skeleton for a moment to allow cross-fade
52
+ useEffect(() => {
53
+ if (status === "loaded") {
54
+ const timer = setTimeout(() => {
55
+ setShowSkeleton(false);
56
+ }, 500); // 500ms delay to allow image to fade in completely
57
+ return () => clearTimeout(timer);
58
+ }
59
+ }, [status]);
60
+ const handleLoad = useCallback(async (e) => {
42
61
  onLoad === null || onLoad === void 0 ? void 0 : onLoad(e);
43
- };
44
- const handleError = (e) => {
45
- if (fallbackSrc && !hasError) {
46
- setHasError(true);
47
- return;
62
+ const img = e.currentTarget;
63
+ try {
64
+ if (img.decode) {
65
+ await img.decode();
66
+ }
67
+ }
68
+ catch (error) {
69
+ // ignore decode errors (e.g. invalid image data)
70
+ }
71
+ finally {
72
+ setStatus("loaded");
48
73
  }
49
- if (timerRef.current)
50
- clearTimeout(timerRef.current);
51
- setIsLoaded(true);
74
+ }, [onLoad]);
75
+ const handleError = useCallback((e) => {
76
+ if (fallbackSrc && status !== "error") {
77
+ // Prevents infinite loop if fallback also fails
78
+ if (e.currentTarget.src !== fallbackSrc) {
79
+ e.currentTarget.src = fallbackSrc;
80
+ return;
81
+ }
82
+ }
83
+ setStatus("error");
84
+ setShowSkeleton(false); // Remove skeleton immediately on error to show broken image icon or alt
52
85
  onError === null || onError === void 0 ? void 0 : onError(e);
53
- };
54
- return (_jsxs("div", { className: clsx(styles.wrapper, rounded && styles.rounded, className), style: Object.assign({ aspectRatio }, style), children: [!isLoaded && showSkeleton && (_jsx(Skeleton, { className: styles.skeleton, style: {
55
- position: "absolute",
56
- inset: 0,
57
- height: "100%",
58
- width: "100%",
59
- } })), _jsx("img", Object.assign({ src: hasError ? fallbackSrc : src, alt: alt, className: clsx(styles.image, fit && styles[`fit-${fit}`], showSkeleton && styles["with-transition"]), onLoad: handleLoad, onError: handleError, "data-loaded": isLoaded ? "true" : "false", style: { width: "100%", height: "100%" } }, props))] }));
86
+ }, [fallbackSrc, status, onError]);
87
+ return (_jsxs("div", { className: clsx(styles.wrapper, rounded && styles.rounded, className), style: Object.assign({ aspectRatio: computedAspectRatio, width: toCssValue(width), height: toCssValue(height) }, style), children: [_jsx("div", { className: clsx(styles.skeletonLayer, status === "loaded" && styles.fadeOut), "aria-hidden": "true", children: showSkeleton && (_jsx(Skeleton, { style: {
88
+ width: "100%",
89
+ height: "100%",
90
+ } })) }), _jsx("img", Object.assign({ src: src, alt: alt, className: clsx(styles.image, fit && styles[`fit-${fit}`], status === "loaded" ? styles.visible : styles.hidden), onLoad: handleLoad, onError: handleError, width: width, height: height }, props))] }));
60
91
  }
@@ -1,13 +1,16 @@
1
1
  .image {
2
2
  display: block;
3
- max-width: 100%;
4
- height: auto;
5
- }
6
- .image[data-loaded=false] {
3
+ width: 100%;
4
+ height: 100%;
7
5
  opacity: 0;
6
+ transition: opacity 0.5s ease-in-out;
7
+ background-color: transparent;
8
+ }
9
+ .image.visible {
10
+ opacity: 1;
8
11
  }
9
- .image.with-transition {
10
- transition: opacity 0.3s ease-in-out;
12
+ .image.hidden {
13
+ opacity: 0;
11
14
  }
12
15
  .image.fit-cover {
13
16
  object-fit: cover;
@@ -29,6 +32,22 @@
29
32
  position: relative;
30
33
  display: block;
31
34
  overflow: hidden;
35
+ background-color: var(--surface-accent);
36
+ isolation: isolate;
37
+ }
38
+
39
+ .skeletonLayer {
40
+ position: absolute;
41
+ inset: 0;
42
+ width: 100%;
43
+ height: 100%;
44
+ z-index: 1;
45
+ pointer-events: none;
46
+ transition: opacity 0.5s ease-in-out;
47
+ opacity: 1;
48
+ }
49
+ .skeletonLayer.fadeOut {
50
+ opacity: 0;
32
51
  }
33
52
 
34
53
  .rounded {
@@ -1,18 +1,32 @@
1
1
  import React, { ElementType } from "react";
2
+ declare const SPACING_MAP: {
3
+ readonly 0: "0";
4
+ readonly 1: "0.25rem";
5
+ readonly 2: "0.5rem";
6
+ readonly 3: "0.75rem";
7
+ readonly 4: "1rem";
8
+ readonly 5: "1.25rem";
9
+ readonly 6: "1.5rem";
10
+ readonly 8: "2rem";
11
+ readonly 10: "2.5rem";
12
+ readonly 12: "3rem";
13
+ readonly 16: "4rem";
14
+ };
15
+ export type Spacing = keyof typeof SPACING_MAP;
2
16
  interface LayoutProps extends React.HTMLAttributes<HTMLElement> {
3
17
  children?: React.ReactNode;
4
18
  as?: ElementType;
5
19
  }
6
20
  export interface GridProps extends LayoutProps {
7
21
  columns?: string | number;
8
- gap?: string | number;
22
+ gap?: Spacing;
9
23
  }
10
24
  export declare function Grid({ children, columns, gap, className, style, as: Component, ...props }: GridProps): import("react/jsx-runtime").JSX.Element;
11
25
  export interface FlexProps extends LayoutProps {
12
26
  direction?: "row" | "column" | "row-reverse" | "column-reverse";
13
27
  justify?: "flex-start" | "flex-end" | "center" | "space-between" | "space-around" | "space-evenly";
14
28
  align?: "flex-start" | "flex-end" | "center" | "stretch" | "baseline";
15
- gap?: string | number;
29
+ gap?: Spacing;
16
30
  wrap?: boolean | "wrap" | "nowrap" | "wrap-reverse";
17
31
  }
18
32
  export declare function Flex({ children, direction, justify, align, gap, wrap, className, style, as: Component, ...props }: FlexProps): import("react/jsx-runtime").JSX.Element;
@@ -13,20 +13,37 @@ var __rest = (this && this.__rest) || function (s, e) {
13
13
  import { jsx as _jsx } from "react/jsx-runtime";
14
14
  import clsx from "clsx";
15
15
  import styles from "./Layout.module.css";
16
+ // --- Tokens ---
17
+ const SPACING_MAP = {
18
+ 0: "0",
19
+ 1: "0.25rem",
20
+ 2: "0.5rem",
21
+ 3: "0.75rem",
22
+ 4: "1rem",
23
+ 5: "1.25rem",
24
+ 6: "1.5rem",
25
+ 8: "2rem",
26
+ 10: "2.5rem",
27
+ 12: "3rem",
28
+ 16: "4rem",
29
+ };
30
+ function resolveGap(gap) {
31
+ if (gap === undefined)
32
+ return undefined;
33
+ return SPACING_MAP[gap];
34
+ }
16
35
  export function Grid(_a) {
17
- var { children, columns = "1fr", gap = "1rem", className, style, as: Component = "div" } = _a, props = __rest(_a, ["children", "columns", "gap", "className", "style", "as"]);
36
+ var { children, columns = "1fr", gap = 4, className, style, as: Component = "div" } = _a, props = __rest(_a, ["children", "columns", "gap", "className", "style", "as"]);
18
37
  const gridTemplateColumns = typeof columns === "number" ? `repeat(${columns}, 1fr)` : columns;
19
- return (_jsx(Component, Object.assign({ className: clsx(styles.grid, className), style: Object.assign({ gridTemplateColumns,
20
- gap }, style) }, props, { children: children })));
38
+ return (_jsx(Component, Object.assign({ className: clsx(styles.grid, className), style: Object.assign({ gridTemplateColumns, gap: resolveGap(gap) }, style) }, props, { children: children })));
21
39
  }
22
40
  export function Flex(_a) {
23
- var { children, direction = "row", justify = "flex-start", align = "stretch", gap = "0", wrap = false, className, style, as: Component = "div" } = _a, props = __rest(_a, ["children", "direction", "justify", "align", "gap", "wrap", "className", "style", "as"]);
41
+ var { children, direction = "row", justify = "flex-start", align = "stretch", gap = 0, wrap = false, className, style, as: Component = "div" } = _a, props = __rest(_a, ["children", "direction", "justify", "align", "gap", "wrap", "className", "style", "as"]);
24
42
  const flexWrap = typeof wrap === "boolean" ? (wrap ? "wrap" : "nowrap") : wrap;
25
- return (_jsx(Component, Object.assign({ className: clsx(styles.flex, className), style: Object.assign({ flexDirection: direction, justifyContent: justify, alignItems: align, gap,
26
- flexWrap }, style) }, props, { children: children })));
43
+ return (_jsx(Component, Object.assign({ className: clsx(styles.flex, className), style: Object.assign({ flexDirection: direction, justifyContent: justify, alignItems: align, gap: resolveGap(gap), flexWrap }, style) }, props, { children: children })));
27
44
  }
28
45
  export function Stack(_a) {
29
- var { children, direction = "column", gap = "1rem", align = "stretch" } = _a, props = __rest(_a, ["children", "direction", "gap", "align"]);
46
+ var { children, direction = "column", gap = 4, align = "stretch" } = _a, props = __rest(_a, ["children", "direction", "gap", "align"]);
30
47
  return (_jsx(Flex, Object.assign({ direction: direction, gap: gap, align: align }, props, { children: children })));
31
48
  }
32
49
  export function Switcher(_a) {
@@ -31,7 +31,7 @@ export function ModalBody({ children, className, }) {
31
31
  return _jsx("div", { className: clsx(styles.body, className), children: children });
32
32
  }
33
33
  export function ModalFooter({ children, className, }) {
34
- return (_jsx(Flex, { justify: "flex-end", align: "center", gap: "var(--spacing-md)", className: clsx(styles.footer, className), children: children }));
34
+ return (_jsx(Flex, { justify: "flex-end", align: "center", gap: 4, className: clsx(styles.footer, className), children: children }));
35
35
  }
36
36
  export function Modal(_a) {
37
37
  var { isOpen, onClose, title, children, footer, className, style, variant = "default" } = _a, props = __rest(_a, ["isOpen", "onClose", "title", "children", "footer", "className", "style", "variant"]);
@@ -22,6 +22,6 @@ export const Slat = React.forwardRef((_a, ref) => {
22
22
  e.preventDefault();
23
23
  onClick(e);
24
24
  }
25
- } }, props, { children: _jsxs(Flex, { justify: "space-between", align: "center", gap: "var(--spacing-sm)", children: [_jsxs(Flex, { gap: "var(--spacing-sm)", align: "center", style: { flex: 1, minWidth: 0 }, children: [prependContent && (_jsx("div", { className: styles.prepend, children: prependContent })), _jsxs(Stack, { gap: 0, style: { flex: 1, minWidth: 0 }, children: [_jsx(Text, { className: styles.label, children: label }), secondaryLabel && (_jsx(Text, { variant: "small", className: styles.secondaryLabel, children: secondaryLabel }))] })] }), _jsx(Flex, { align: "center", gap: "var(--spacing-sm)", children: appendContent && (_jsx("div", { className: styles.append, children: appendContent })) })] }) })));
25
+ } }, props, { children: _jsxs(Flex, { justify: "space-between", align: "center", gap: 2, children: [_jsxs(Flex, { gap: 2, align: "center", style: { flex: 1, minWidth: 0 }, children: [prependContent && (_jsx("div", { className: styles.prepend, children: prependContent })), _jsxs(Stack, { gap: 0, style: { flex: 1, minWidth: 0 }, children: [_jsx(Text, { className: styles.label, children: label }), secondaryLabel && (_jsx(Text, { variant: "small", className: styles.secondaryLabel, children: secondaryLabel }))] })] }), _jsx(Flex, { align: "center", gap: 2, children: appendContent && (_jsx("div", { className: styles.append, children: appendContent })) })] }) })));
26
26
  });
27
27
  Slat.displayName = "Slat";
@@ -45,7 +45,7 @@ export function Table({ data, columns, enablePagination = true, enableFiltering
45
45
  overscan: 5,
46
46
  });
47
47
  const isVirtual = !!height;
48
- return (_jsxs("div", { className: clsx(styles.container, variant === "flat" && styles.flat, className), style: style, children: [enableFiltering && (_jsxs("div", { className: styles.toolbar, children: [_jsx("div", { style: { width: "300px" }, children: _jsx(Input, { placeholder: "Search...", value: globalFilter !== null && globalFilter !== void 0 ? globalFilter : "", onChange: (e) => setGlobalFilter(e.target.value) }) }), toolbarContent && (_jsx(Flex, { gap: "1rem", align: "center", children: toolbarContent }))] })), _jsxs("div", { ref: parentRef, tabIndex: 0, style: {
48
+ return (_jsxs("div", { className: clsx(styles.container, variant === "flat" && styles.flat, className), style: style, children: [enableFiltering && (_jsxs("div", { className: styles.toolbar, children: [_jsx("div", { style: { width: "300px" }, children: _jsx(Input, { placeholder: "Search...", value: globalFilter !== null && globalFilter !== void 0 ? globalFilter : "", onChange: (e) => setGlobalFilter(e.target.value) }) }), toolbarContent && (_jsx(Flex, { gap: 4, align: "center", children: toolbarContent }))] })), _jsxs("div", { ref: parentRef, tabIndex: 0, style: {
49
49
  height: height ? height : "auto",
50
50
  overflowY: height ? "auto" : "visible",
51
51
  overflowX: "auto",
@@ -68,7 +68,7 @@ export function Table({ data, columns, enablePagination = true, enableFiltering
68
68
  }), rowVirtualizer.getVirtualItems().length > 0 && (_jsx("tr", { style: {
69
69
  height: `${rowVirtualizer.getTotalSize() -
70
70
  rowVirtualizer.getVirtualItems()[rowVirtualizer.getVirtualItems().length - 1].end}px`,
71
- }, children: _jsx("td", { colSpan: columns.length, style: { border: 0, padding: 0 } }) }))] })) : (_jsx("tbody", { children: table.getRowModel().rows.map((row) => (_jsx("tr", { className: clsx(styles.tr, striped && styles.striped, "group"), children: row.getVisibleCells().map((cell) => (_jsx("td", { className: clsx(styles.td, styles[density]), children: flexRender(cell.column.columnDef.cell, cell.getContext()) }, cell.id))) }, row.id))) }))] }), table.getRowModel().rows.length === 0 && (_jsx("div", { className: styles.noResults, children: "No results found." }))] }), enablePagination && !isVirtual && (_jsx("div", { className: styles.paginationContainer, children: _jsxs(Flex, { gap: "1rem", align: "center", style: { width: "100%", justifyContent: "space-between" }, children: [_jsx("div", { style: { flexShrink: 0 }, children: _jsx(Select, { value: table.getState().pagination.pageSize, onChange: (e) => {
71
+ }, children: _jsx("td", { colSpan: columns.length, style: { border: 0, padding: 0 } }) }))] })) : (_jsx("tbody", { children: table.getRowModel().rows.map((row) => (_jsx("tr", { className: clsx(styles.tr, striped && styles.striped, "group"), children: row.getVisibleCells().map((cell) => (_jsx("td", { className: clsx(styles.td, styles[density]), children: flexRender(cell.column.columnDef.cell, cell.getContext()) }, cell.id))) }, row.id))) }))] }), table.getRowModel().rows.length === 0 && (_jsx("div", { className: styles.noResults, children: "No results found." }))] }), enablePagination && !isVirtual && (_jsx("div", { className: styles.paginationContainer, children: _jsxs(Flex, { gap: 4, align: "center", style: { width: "100%", justifyContent: "space-between" }, children: [_jsx("div", { style: { flexShrink: 0 }, children: _jsx(Select, { value: table.getState().pagination.pageSize, onChange: (e) => {
72
72
  table.setPageSize(Number(e.target.value));
73
73
  }, options: [
74
74
  { value: 10, label: "10 rows" },