@versini/ui-datagrid 0.1.1 → 0.2.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.
- package/dist/DataGrid/DataGrid.d.ts +1 -1
- package/dist/DataGrid/DataGrid.js +79 -33
- package/dist/DataGrid/DataGridContext.js +1 -1
- package/dist/DataGrid/index.js +1 -1
- package/dist/DataGrid/utilities.d.ts +18 -22
- package/dist/DataGrid/utilities.js +19 -49
- package/dist/DataGridAnimated/AnimatedWrapper.js +1 -1
- package/dist/DataGridAnimated/index.js +1 -1
- package/dist/DataGridAnimated/useAnimatedHeight.js +1 -1
- package/dist/DataGridBody/DataGridBody.js +10 -4
- package/dist/DataGridBody/index.js +1 -1
- package/dist/DataGridCell/DataGridCell.js +1 -1
- package/dist/DataGridCell/index.js +1 -1
- package/dist/DataGridCellSort/DataGridCellSort.js +1 -1
- package/dist/DataGridCellSort/index.js +1 -1
- package/dist/DataGridConstants/DataGridConstants.js +1 -1
- package/dist/DataGridConstants/index.js +1 -1
- package/dist/DataGridFooter/DataGridFooter.d.ts +9 -2
- package/dist/DataGridFooter/DataGridFooter.js +25 -20
- package/dist/DataGridFooter/index.js +1 -1
- package/dist/DataGridHeader/DataGridHeader.d.ts +22 -5
- package/dist/DataGridHeader/DataGridHeader.js +107 -35
- package/dist/DataGridHeader/index.js +1 -1
- package/dist/DataGridInfinite/InfiniteScrollMarker.js +1 -1
- package/dist/DataGridInfinite/index.js +1 -1
- package/dist/DataGridInfinite/useInfiniteScroll.js +1 -1
- package/dist/DataGridRow/DataGridRow.d.ts +1 -1
- package/dist/DataGridRow/DataGridRow.js +48 -24
- package/dist/DataGridRow/index.js +1 -1
- package/dist/DataGridSorting/index.js +1 -1
- package/dist/DataGridSorting/sortingUtils.js +1 -1
- package/dist/common/utilities.d.ts +15 -0
- package/dist/common/utilities.js +48 -0
- package/package.json +2 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { DataGridProps } from "./DataGridTypes";
|
|
2
|
-
export declare const DataGrid: ({
|
|
2
|
+
export declare const DataGrid: ({ className, wrapperClassName, children, mode, compact, stickyHeader, stickyFooter, blurEffect, maxHeight, disabled, columns, ...rest }: DataGridProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
@versini/ui-datagrid v0.
|
|
2
|
+
@versini/ui-datagrid v0.2.1
|
|
3
3
|
© 2026 gizmette.com
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
-
import {
|
|
7
|
+
import { Children, isValidElement, useCallback, useMemo, useState } from "react";
|
|
8
8
|
import { BlurEffects } from "../DataGridConstants/DataGridConstants.js";
|
|
9
9
|
import { DataGridContext } from "./DataGridContext.js";
|
|
10
10
|
import { getDataGridClasses } from "./utilities.js";
|
|
@@ -25,43 +25,89 @@ import { getDataGridClasses } from "./utilities.js";
|
|
|
25
25
|
|
|
26
26
|
|
|
27
27
|
|
|
28
|
+
/**
|
|
29
|
+
* Helper to check component type by displayName.
|
|
30
|
+
* This allows tree-shaking since we don't need to import the actual component.
|
|
31
|
+
*/ const isComponentType = (child, displayName)=>{
|
|
32
|
+
if (!/*#__PURE__*/ isValidElement(child)) {
|
|
33
|
+
return false;
|
|
34
|
+
}
|
|
35
|
+
const type = child.type;
|
|
36
|
+
return type?.displayName === displayName;
|
|
37
|
+
};
|
|
28
38
|
/* =============================================================================
|
|
29
39
|
* DataGrid (main component)
|
|
30
|
-
* ========================================================================== */ const DataGrid = ({
|
|
31
|
-
|
|
40
|
+
* ========================================================================== */ const DataGrid = ({ className, wrapperClassName, children, mode = "system", compact = false, stickyHeader = false, stickyFooter = false, blurEffect = BlurEffects.NONE, maxHeight, disabled = false, columns, ...rest })=>{
|
|
41
|
+
/**
|
|
42
|
+
* Auto-detect if DataGridHeader and DataGridFooter children exist.
|
|
43
|
+
* This prevents applying sticky styles when the component doesn't exist.
|
|
44
|
+
* Uses displayName comparison to enable tree-shaking.
|
|
45
|
+
*/ const hasHeader = useMemo(()=>{
|
|
46
|
+
return Children.toArray(children).some((child)=>isComponentType(child, "DataGridHeader"));
|
|
47
|
+
}, [
|
|
48
|
+
children
|
|
49
|
+
]);
|
|
50
|
+
const hasFooter = useMemo(()=>{
|
|
51
|
+
return Children.toArray(children).some((child)=>isComponentType(child, "DataGridFooter"));
|
|
52
|
+
}, [
|
|
53
|
+
children
|
|
54
|
+
]);
|
|
55
|
+
/**
|
|
56
|
+
* Only apply sticky behavior if both the prop is true AND the
|
|
57
|
+
* corresponding component exists. This prevents adding padding/styles
|
|
58
|
+
* for non-existent headers/footers.
|
|
59
|
+
*/ const effectiveStickyHeader = stickyHeader && hasHeader;
|
|
60
|
+
const effectiveStickyFooter = stickyFooter && hasFooter;
|
|
61
|
+
/**
|
|
62
|
+
* Auto-detect if any DataGridHeader child has a caption prop.
|
|
63
|
+
* This eliminates the need for a separate hasCaption prop.
|
|
64
|
+
*/ const hasCaption = useMemo(()=>{
|
|
65
|
+
return Children.toArray(children).some((child)=>isComponentType(child, "DataGridHeader") && /*#__PURE__*/ isValidElement(child) && Boolean(child.props.caption));
|
|
66
|
+
}, [
|
|
67
|
+
children
|
|
68
|
+
]);
|
|
69
|
+
/**
|
|
70
|
+
* State to hold the caption ID registered by DataGridHeader.
|
|
71
|
+
* Used for aria-labelledby on the grid element for accessibility.
|
|
72
|
+
*/ const [captionId, setCaptionId] = useState(undefined);
|
|
73
|
+
const handleSetCaptionId = useCallback((id)=>{
|
|
74
|
+
setCaptionId(id);
|
|
75
|
+
}, []);
|
|
32
76
|
const classes = useMemo(()=>getDataGridClasses({
|
|
33
77
|
mode,
|
|
34
78
|
className,
|
|
35
79
|
wrapperClassName,
|
|
36
|
-
stickyHeader,
|
|
37
|
-
stickyFooter,
|
|
80
|
+
stickyHeader: effectiveStickyHeader,
|
|
81
|
+
stickyFooter: effectiveStickyFooter,
|
|
38
82
|
disabled,
|
|
39
|
-
hasCaption
|
|
83
|
+
hasCaption,
|
|
84
|
+
hasColumns: Boolean(columns)
|
|
40
85
|
}), [
|
|
41
86
|
mode,
|
|
42
87
|
className,
|
|
43
88
|
wrapperClassName,
|
|
44
|
-
|
|
45
|
-
|
|
89
|
+
effectiveStickyHeader,
|
|
90
|
+
effectiveStickyFooter,
|
|
46
91
|
disabled,
|
|
47
|
-
|
|
92
|
+
hasCaption,
|
|
93
|
+
columns
|
|
48
94
|
]);
|
|
49
95
|
const contextValue = useMemo(()=>({
|
|
50
96
|
mode,
|
|
51
97
|
compact,
|
|
52
|
-
stickyHeader,
|
|
53
|
-
stickyFooter,
|
|
98
|
+
stickyHeader: effectiveStickyHeader,
|
|
99
|
+
stickyFooter: effectiveStickyFooter,
|
|
54
100
|
blurEffect,
|
|
55
|
-
|
|
56
|
-
|
|
101
|
+
columns,
|
|
102
|
+
setCaptionId: handleSetCaptionId
|
|
57
103
|
}), [
|
|
58
104
|
mode,
|
|
59
105
|
compact,
|
|
60
|
-
|
|
61
|
-
|
|
106
|
+
effectiveStickyHeader,
|
|
107
|
+
effectiveStickyFooter,
|
|
62
108
|
blurEffect,
|
|
63
|
-
|
|
64
|
-
|
|
109
|
+
columns,
|
|
110
|
+
handleSetCaptionId
|
|
65
111
|
]);
|
|
66
112
|
const wrapperStyle = maxHeight ? {
|
|
67
113
|
maxHeight: typeof maxHeight === "number" ? `${maxHeight}px` : maxHeight
|
|
@@ -70,11 +116,18 @@ import { getDataGridClasses } from "./utilities.js";
|
|
|
70
116
|
* When sticky header/footer is enabled, use Panel-like structure: - Outer
|
|
71
117
|
* wrapper has overflow-hidden - Scrollable content area in the middle with
|
|
72
118
|
* padding - Header/footer are absolutely positioned.
|
|
73
|
-
*/ const hasSticky =
|
|
119
|
+
*/ const hasSticky = effectiveStickyHeader || effectiveStickyFooter;
|
|
120
|
+
/**
|
|
121
|
+
* When columns are provided, apply grid-template-columns at the grid level
|
|
122
|
+
* so all rows can use subgrid to inherit the same column sizing.
|
|
123
|
+
*/ const gridStyle = columns ? {
|
|
124
|
+
gridTemplateColumns: columns.join(" ")
|
|
125
|
+
} : undefined;
|
|
74
126
|
const gridContent = /*#__PURE__*/ jsx("div", {
|
|
75
127
|
role: "grid",
|
|
128
|
+
"aria-labelledby": captionId,
|
|
76
129
|
className: classes.grid,
|
|
77
|
-
|
|
130
|
+
style: gridStyle,
|
|
78
131
|
...rest,
|
|
79
132
|
children: children
|
|
80
133
|
});
|
|
@@ -102,21 +155,14 @@ import { getDataGridClasses } from "./utilities.js";
|
|
|
102
155
|
})
|
|
103
156
|
]
|
|
104
157
|
}),
|
|
105
|
-
/*#__PURE__*/
|
|
158
|
+
/*#__PURE__*/ jsx("div", {
|
|
106
159
|
className: classes.wrapper,
|
|
107
160
|
style: wrapperStyle,
|
|
108
|
-
children:
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
}),
|
|
114
|
-
hasSticky ? /*#__PURE__*/ jsx("div", {
|
|
115
|
-
className: classes.scrollableContent,
|
|
116
|
-
style: wrapperStyle,
|
|
117
|
-
children: gridContent
|
|
118
|
-
}) : gridContent
|
|
119
|
-
]
|
|
161
|
+
children: hasSticky ? /*#__PURE__*/ jsx("div", {
|
|
162
|
+
className: classes.scrollableContent,
|
|
163
|
+
style: wrapperStyle,
|
|
164
|
+
children: gridContent
|
|
165
|
+
}) : gridContent
|
|
120
166
|
})
|
|
121
167
|
]
|
|
122
168
|
})
|
package/dist/DataGrid/index.js
CHANGED
|
@@ -1,28 +1,21 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
/**
|
|
3
|
-
* Common classes for sticky header/footer with optional blur effect.
|
|
4
|
-
*/
|
|
5
|
-
export declare const getStickyBlurClasses: ({ blurEffect, }: {
|
|
6
|
-
blurEffect?: BlurEffect;
|
|
7
|
-
}) => string;
|
|
8
|
-
export declare const getCaptionBackgroundClasses: ({ mode }: {
|
|
9
|
-
mode: ThemeMode;
|
|
10
|
-
}) => string;
|
|
11
|
-
export declare const getCaptionCopyClasses: ({ mode }: {
|
|
12
|
-
mode: ThemeMode;
|
|
13
|
-
}) => string;
|
|
1
|
+
import { type ThemeMode } from "../DataGridConstants/DataGridConstants";
|
|
14
2
|
/**
|
|
15
3
|
* Generates classes for the main DataGrid wrapper and grid. When sticky
|
|
16
|
-
* header/footer is enabled
|
|
4
|
+
* header/footer is enabled:
|
|
17
5
|
* - Outer wrapper has overflow-hidden
|
|
18
|
-
* - Scrollable area is a separate inner container
|
|
19
|
-
* - Header/footer
|
|
6
|
+
* - Scrollable area is a separate inner container with padding for header/footer
|
|
7
|
+
* - Header/footer use position:absolute to overlay scrollbar
|
|
8
|
+
* - Padding is auto-calculated based on whether caption is present
|
|
9
|
+
*
|
|
10
|
+
* When columns prop is provided, the grid uses CSS Grid layout with subgrid
|
|
11
|
+
* support for proper column alignment across all rows.
|
|
20
12
|
*/
|
|
21
|
-
export declare const getDataGridClasses: ({ mode, className, wrapperClassName, stickyHeader, stickyFooter, disabled, hasCaption, }: {
|
|
13
|
+
export declare const getDataGridClasses: ({ mode, className, wrapperClassName, stickyHeader, stickyFooter, disabled, hasCaption, hasColumns, }: {
|
|
22
14
|
mode: ThemeMode;
|
|
23
15
|
className?: string;
|
|
24
16
|
disabled?: boolean;
|
|
25
17
|
hasCaption?: boolean;
|
|
18
|
+
hasColumns?: boolean;
|
|
26
19
|
stickyFooter?: boolean;
|
|
27
20
|
stickyHeader?: boolean;
|
|
28
21
|
wrapperClassName?: string;
|
|
@@ -33,12 +26,15 @@ export declare const getDataGridClasses: ({ mode, className, wrapperClassName, s
|
|
|
33
26
|
spinner: string;
|
|
34
27
|
wrapper: string;
|
|
35
28
|
/**
|
|
36
|
-
* Scrollable content area
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
29
|
+
* Scrollable content area with padding for absolute-positioned header/footer.
|
|
30
|
+
* Header height varies based on whether caption is present:
|
|
31
|
+
* - pt-10 (40px): header row only
|
|
32
|
+
* - pt-19 (76px): header row + caption
|
|
40
33
|
*/
|
|
41
34
|
scrollableContent: string;
|
|
35
|
+
/**
|
|
36
|
+
* When columns are provided, use CSS Grid so rows can use subgrid for
|
|
37
|
+
* consistent column alignment. Otherwise, use flexbox.
|
|
38
|
+
*/
|
|
42
39
|
grid: string;
|
|
43
|
-
caption: string;
|
|
44
40
|
};
|
|
@@ -1,18 +1,14 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
@versini/ui-datagrid v0.
|
|
2
|
+
@versini/ui-datagrid v0.2.1
|
|
3
3
|
© 2026 gizmette.com
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import clsx from "clsx";
|
|
7
|
-
import { BlurEffects } from "../DataGridConstants/DataGridConstants.js";
|
|
8
7
|
|
|
9
8
|
;// CONCATENATED MODULE: external "clsx"
|
|
10
9
|
|
|
11
|
-
;// CONCATENATED MODULE: external "../DataGridConstants/DataGridConstants.js"
|
|
12
|
-
|
|
13
10
|
;// CONCATENATED MODULE: ./src/DataGrid/utilities.ts
|
|
14
11
|
|
|
15
|
-
|
|
16
12
|
/**
|
|
17
13
|
* Generates classes for the loading spinner.
|
|
18
14
|
*/ const getSpinnerClasses = ({ mode })=>{
|
|
@@ -35,38 +31,17 @@ import { BlurEffects } from "../DataGridConstants/DataGridConstants.js";
|
|
|
35
31
|
})
|
|
36
32
|
};
|
|
37
33
|
};
|
|
38
|
-
/**
|
|
39
|
-
* Common classes for sticky header/footer with optional blur effect.
|
|
40
|
-
*/ const getStickyBlurClasses = ({ blurEffect })=>{
|
|
41
|
-
return clsx({
|
|
42
|
-
"backdrop-blur-sm": blurEffect === BlurEffects.SMALL,
|
|
43
|
-
"backdrop-blur-md": blurEffect === BlurEffects.MEDIUM,
|
|
44
|
-
"backdrop-blur-lg": blurEffect === BlurEffects.LARGE
|
|
45
|
-
});
|
|
46
|
-
};
|
|
47
|
-
const getCaptionBackgroundClasses = ({ mode })=>{
|
|
48
|
-
return clsx({
|
|
49
|
-
"bg-surface-darker": mode === "dark" || mode === "system",
|
|
50
|
-
"bg-surface-light": mode === "light" || mode === "alt-system",
|
|
51
|
-
"dark:bg-surface-light": mode === "system",
|
|
52
|
-
"dark:bg-surface-darker": mode === "alt-system"
|
|
53
|
-
});
|
|
54
|
-
};
|
|
55
|
-
const getCaptionCopyClasses = ({ mode })=>{
|
|
56
|
-
return clsx({
|
|
57
|
-
"text-copy-light": mode === "dark",
|
|
58
|
-
"text-copy-dark": mode === "light",
|
|
59
|
-
"text-copy-light dark:text-copy-dark": mode === "system",
|
|
60
|
-
"text-copy-dark dark:text-copy-light": mode === "alt-system"
|
|
61
|
-
});
|
|
62
|
-
};
|
|
63
34
|
/**
|
|
64
35
|
* Generates classes for the main DataGrid wrapper and grid. When sticky
|
|
65
|
-
* header/footer is enabled
|
|
36
|
+
* header/footer is enabled:
|
|
66
37
|
* - Outer wrapper has overflow-hidden
|
|
67
|
-
* - Scrollable area is a separate inner container
|
|
68
|
-
* - Header/footer
|
|
69
|
-
|
|
38
|
+
* - Scrollable area is a separate inner container with padding for header/footer
|
|
39
|
+
* - Header/footer use position:absolute to overlay scrollbar
|
|
40
|
+
* - Padding is auto-calculated based on whether caption is present
|
|
41
|
+
*
|
|
42
|
+
* When columns prop is provided, the grid uses CSS Grid layout with subgrid
|
|
43
|
+
* support for proper column alignment across all rows.
|
|
44
|
+
*/ const getDataGridClasses = ({ mode, className, wrapperClassName, stickyHeader, stickyFooter, disabled, hasCaption, hasColumns })=>{
|
|
70
45
|
const overlayClasses = disabled ? getOverlayClasses({
|
|
71
46
|
mode
|
|
72
47
|
}) : null;
|
|
@@ -90,30 +65,25 @@ const getCaptionCopyClasses = ({ mode })=>{
|
|
|
90
65
|
"text-copy-dark dark:text-copy-light": mode === "alt-system"
|
|
91
66
|
}, wrapperClassName),
|
|
92
67
|
/**
|
|
93
|
-
* Scrollable content area
|
|
94
|
-
*
|
|
95
|
-
*
|
|
96
|
-
*
|
|
68
|
+
* Scrollable content area with padding for absolute-positioned header/footer.
|
|
69
|
+
* Header height varies based on whether caption is present:
|
|
70
|
+
* - pt-10 (40px): header row only
|
|
71
|
+
* - pt-19 (76px): header row + caption
|
|
97
72
|
*/ scrollableContent: clsx("overflow-y-auto overflow-x-hidden rounded-[inherit]", {
|
|
98
73
|
"pt-10": stickyHeader && !hasCaption,
|
|
99
74
|
"pt-19": stickyHeader && hasCaption,
|
|
100
75
|
"pb-10": stickyFooter
|
|
101
76
|
}),
|
|
102
|
-
|
|
77
|
+
/**
|
|
78
|
+
* When columns are provided, use CSS Grid so rows can use subgrid for
|
|
79
|
+
* consistent column alignment. Otherwise, use flexbox.
|
|
80
|
+
*/ grid: clsx("my-0 w-full text-left text-sm", hasColumns ? "grid" : "flex flex-col", className, {
|
|
103
81
|
"text-copy-light": mode === "dark",
|
|
104
82
|
"text-copy-dark": mode === "light",
|
|
105
83
|
"text-copy-light dark:text-copy-dark": mode === "system",
|
|
106
84
|
"text-copy-dark dark:text-copy-light": mode === "alt-system"
|
|
107
|
-
})
|
|
108
|
-
caption: clsx("py-2 text-sm text-center font-bold", {
|
|
109
|
-
// When stickyHeader is enabled, caption is absolutely positioned at top
|
|
110
|
-
"absolute left-0 right-0 z-20 top-0 rounded-t-lg": stickyHeader
|
|
111
|
-
}, getCaptionBackgroundClasses({
|
|
112
|
-
mode
|
|
113
|
-
}), getCaptionCopyClasses({
|
|
114
|
-
mode
|
|
115
|
-
}))
|
|
85
|
+
})
|
|
116
86
|
};
|
|
117
87
|
};
|
|
118
88
|
|
|
119
|
-
export {
|
|
89
|
+
export { getDataGridClasses };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
@versini/ui-datagrid v0.
|
|
2
|
+
@versini/ui-datagrid v0.2.1
|
|
3
3
|
© 2026 gizmette.com
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -25,18 +25,24 @@ import { CellWrapper } from "../DataGridConstants/index.js";
|
|
|
25
25
|
* DataGridBody
|
|
26
26
|
* ========================================================================== */ const DataGridBody = ({ className, children, ...rest })=>{
|
|
27
27
|
return /*#__PURE__*/ jsx(DataGridContext.Consumer, {
|
|
28
|
-
children: (ctx)
|
|
28
|
+
children: (ctx)=>{
|
|
29
|
+
/**
|
|
30
|
+
* When columns are provided, use display:contents so the body
|
|
31
|
+
* doesn't interfere with the grid flow. Rows will use subgrid.
|
|
32
|
+
*/ const bodyClass = ctx.columns ? clsx("contents", className) : clsx("flex flex-col", className);
|
|
33
|
+
return /*#__PURE__*/ jsx(DataGridContext.Provider, {
|
|
29
34
|
value: {
|
|
30
35
|
...ctx,
|
|
31
36
|
cellWrapper: CellWrapper.BODY
|
|
32
37
|
},
|
|
33
38
|
children: /*#__PURE__*/ jsx("div", {
|
|
34
39
|
role: "rowgroup",
|
|
35
|
-
className:
|
|
40
|
+
className: bodyClass,
|
|
36
41
|
...rest,
|
|
37
42
|
children: children
|
|
38
43
|
})
|
|
39
|
-
})
|
|
44
|
+
});
|
|
45
|
+
}
|
|
40
46
|
});
|
|
41
47
|
};
|
|
42
48
|
|
|
@@ -2,11 +2,18 @@ import type { DataGridFooterProps } from "../DataGrid/DataGridTypes";
|
|
|
2
2
|
import { type BlurEffect, type ThemeMode } from "../DataGridConstants/DataGridConstants";
|
|
3
3
|
/**
|
|
4
4
|
* Generates classes for the DataGridFooter.
|
|
5
|
+
*
|
|
6
|
+
* When columns are provided (subgrid mode), uses display:contents so the
|
|
7
|
+
* footer doesn't break the parent grid flow.
|
|
5
8
|
*/
|
|
6
|
-
export declare const getFooterClasses: ({ className, stickyFooter, mode, blurEffect, }: {
|
|
9
|
+
export declare const getFooterClasses: ({ className, stickyFooter, mode, blurEffect, hasColumns, }: {
|
|
7
10
|
mode: ThemeMode;
|
|
8
11
|
blurEffect?: BlurEffect;
|
|
9
12
|
className?: string;
|
|
13
|
+
hasColumns?: boolean;
|
|
10
14
|
stickyFooter?: boolean;
|
|
11
15
|
}) => string;
|
|
12
|
-
export declare const DataGridFooter:
|
|
16
|
+
export declare const DataGridFooter: {
|
|
17
|
+
({ className, children, ...rest }: DataGridFooterProps): import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
displayName: string;
|
|
19
|
+
};
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
@versini/ui-datagrid v0.
|
|
2
|
+
@versini/ui-datagrid v0.2.1
|
|
3
3
|
© 2026 gizmette.com
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import { jsx } from "react/jsx-runtime";
|
|
7
7
|
import clsx from "clsx";
|
|
8
|
+
import { getHeaderFooterBackgroundClasses, getStickyBlurClasses } from "../common/utilities.js";
|
|
8
9
|
import { DataGridContext } from "../DataGrid/DataGridContext.js";
|
|
9
|
-
import { getStickyBlurClasses } from "../DataGrid/utilities.js";
|
|
10
10
|
import { BlurEffects, CellWrapper } from "../DataGridConstants/DataGridConstants.js";
|
|
11
11
|
|
|
12
12
|
;// CONCATENATED MODULE: external "react/jsx-runtime"
|
|
13
13
|
|
|
14
14
|
;// CONCATENATED MODULE: external "clsx"
|
|
15
15
|
|
|
16
|
-
;// CONCATENATED MODULE: external "../
|
|
16
|
+
;// CONCATENATED MODULE: external "../common/utilities.js"
|
|
17
17
|
|
|
18
|
-
;// CONCATENATED MODULE: external "../DataGrid/
|
|
18
|
+
;// CONCATENATED MODULE: external "../DataGrid/DataGridContext.js"
|
|
19
19
|
|
|
20
20
|
;// CONCATENATED MODULE: external "../DataGridConstants/DataGridConstants.js"
|
|
21
21
|
|
|
@@ -27,8 +27,17 @@ import { BlurEffects, CellWrapper } from "../DataGridConstants/DataGridConstants
|
|
|
27
27
|
|
|
28
28
|
/**
|
|
29
29
|
* Generates classes for the DataGridFooter.
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
*
|
|
31
|
+
* When columns are provided (subgrid mode), uses display:contents so the
|
|
32
|
+
* footer doesn't break the parent grid flow.
|
|
33
|
+
*/ const getFooterClasses = ({ className, stickyFooter, mode, blurEffect, hasColumns })=>{
|
|
34
|
+
/**
|
|
35
|
+
* When columns are provided and not sticky, use display:contents so the
|
|
36
|
+
* rowgroup doesn't interfere with the grid flow. The rows will use subgrid.
|
|
37
|
+
*/ if (hasColumns && !stickyFooter) {
|
|
38
|
+
return clsx("contents", className);
|
|
39
|
+
}
|
|
40
|
+
const hasBlur = Boolean(blurEffect && blurEffect !== BlurEffects.NONE);
|
|
32
41
|
return clsx("flex flex-col", {
|
|
33
42
|
/**
|
|
34
43
|
* Absolute positioning like Panel's footer: absolute left-0 right-0 z-20
|
|
@@ -38,18 +47,12 @@ import { BlurEffects, CellWrapper } from "../DataGridConstants/DataGridConstants
|
|
|
38
47
|
"shadow-[rgb(190_190_190_/20%)_0_-0.5rem_1rem]": stickyFooter && mode === "dark",
|
|
39
48
|
"shadow-[rgb(190_190_190_/20%)_0_-0.5rem_1rem] dark:shadow-[rgb(65_65_65_/30%)_0_-0.5rem_1rem]": stickyFooter && mode === "system",
|
|
40
49
|
"shadow-[rgb(65_65_65_/30%)_0_-0.5rem_1rem]": stickyFooter && mode === "light",
|
|
41
|
-
"shadow-[rgb(65_65_65_/30%)_0_-0.5rem_1rem] dark:shadow-[rgb(190_190_190_/20%)_0_-0.5rem_1rem]": stickyFooter && mode === "alt-system"
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
// Solid backgrounds when no blur effect.
|
|
48
|
-
"bg-table-head-dark": !hasBlur && stickyFooter && (mode === "dark" || mode === "system"),
|
|
49
|
-
"bg-table-head-light": !hasBlur && stickyFooter && (mode === "light" || mode === "alt-system"),
|
|
50
|
-
"dark:bg-table-head-light": !hasBlur && stickyFooter && mode === "system",
|
|
51
|
-
"dark:bg-table-head-dark": !hasBlur && stickyFooter && mode === "alt-system"
|
|
52
|
-
}, stickyFooter && getStickyBlurClasses({
|
|
50
|
+
"shadow-[rgb(65_65_65_/30%)_0_-0.5rem_1rem] dark:shadow-[rgb(190_190_190_/20%)_0_-0.5rem_1rem]": stickyFooter && mode === "alt-system"
|
|
51
|
+
}, getHeaderFooterBackgroundClasses({
|
|
52
|
+
mode,
|
|
53
|
+
hasBlur,
|
|
54
|
+
sticky: Boolean(stickyFooter)
|
|
55
|
+
}), stickyFooter && getStickyBlurClasses({
|
|
53
56
|
blurEffect
|
|
54
57
|
}), className);
|
|
55
58
|
};
|
|
@@ -57,7 +60,7 @@ import { BlurEffects, CellWrapper } from "../DataGridConstants/DataGridConstants
|
|
|
57
60
|
* DataGridFooter
|
|
58
61
|
* ========================================================================== */ const DataGridFooter = ({ className, children, ...rest })=>{
|
|
59
62
|
return /*#__PURE__*/ jsx(DataGridContext.Consumer, {
|
|
60
|
-
children: ({ mode, stickyFooter, blurEffect })=>/*#__PURE__*/ jsx(DataGridContext.Consumer, {
|
|
63
|
+
children: ({ mode, stickyFooter, blurEffect, columns })=>/*#__PURE__*/ jsx(DataGridContext.Consumer, {
|
|
61
64
|
children: (ctx)=>/*#__PURE__*/ jsx(DataGridContext.Provider, {
|
|
62
65
|
value: {
|
|
63
66
|
...ctx,
|
|
@@ -69,7 +72,8 @@ import { BlurEffects, CellWrapper } from "../DataGridConstants/DataGridConstants
|
|
|
69
72
|
className,
|
|
70
73
|
stickyFooter,
|
|
71
74
|
mode,
|
|
72
|
-
blurEffect
|
|
75
|
+
blurEffect,
|
|
76
|
+
hasColumns: Boolean(columns)
|
|
73
77
|
}),
|
|
74
78
|
...rest,
|
|
75
79
|
children: children
|
|
@@ -78,5 +82,6 @@ import { BlurEffects, CellWrapper } from "../DataGridConstants/DataGridConstants
|
|
|
78
82
|
})
|
|
79
83
|
});
|
|
80
84
|
};
|
|
85
|
+
DataGridFooter.displayName = "DataGridFooter";
|
|
81
86
|
|
|
82
87
|
export { DataGridFooter, getFooterClasses };
|
|
@@ -1,14 +1,31 @@
|
|
|
1
1
|
import type { DataGridHeaderProps } from "../DataGrid/DataGridTypes";
|
|
2
2
|
import { type BlurEffect, type ThemeMode } from "../DataGridConstants/DataGridConstants";
|
|
3
3
|
/**
|
|
4
|
-
* Generates classes for the DataGridHeader.
|
|
5
|
-
*
|
|
4
|
+
* Generates classes for the DataGridHeader wrapper.
|
|
5
|
+
*
|
|
6
|
+
* When stickyHeader is true, uses position:absolute so the header overlays
|
|
7
|
+
* the scrollbar area. The parent DataGrid auto-detects caption presence and
|
|
8
|
+
* applies appropriate padding to the scrollable content.
|
|
9
|
+
*
|
|
10
|
+
* When columns are provided (subgrid mode) and not sticky, uses display:contents
|
|
11
|
+
* so the header doesn't break the parent grid flow.
|
|
6
12
|
*/
|
|
7
|
-
export declare const getHeaderClasses: ({ className, stickyHeader, mode, blurEffect,
|
|
13
|
+
export declare const getHeaderClasses: ({ className, stickyHeader, mode, blurEffect, hasColumns, }: {
|
|
8
14
|
mode: ThemeMode;
|
|
9
15
|
blurEffect?: BlurEffect;
|
|
10
16
|
className?: string;
|
|
11
|
-
|
|
17
|
+
hasColumns?: boolean;
|
|
12
18
|
stickyHeader?: boolean;
|
|
13
19
|
}) => string;
|
|
14
|
-
|
|
20
|
+
/**
|
|
21
|
+
* Generates classes for the caption element inside DataGridHeader.
|
|
22
|
+
* When hasColumns is true (subgrid mode), adds col-span-full to span all columns.
|
|
23
|
+
*/
|
|
24
|
+
export declare const getCaptionClasses: ({ captionClassName, hasColumns, }: {
|
|
25
|
+
captionClassName?: string;
|
|
26
|
+
hasColumns?: boolean;
|
|
27
|
+
}) => string;
|
|
28
|
+
export declare const DataGridHeader: {
|
|
29
|
+
({ caption, captionClassName, className, children, ...rest }: DataGridHeaderProps): import("react/jsx-runtime").JSX.Element;
|
|
30
|
+
displayName: string;
|
|
31
|
+
};
|
|
@@ -1,21 +1,24 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
@versini/ui-datagrid v0.
|
|
2
|
+
@versini/ui-datagrid v0.2.1
|
|
3
3
|
© 2026 gizmette.com
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import { jsx } from "react/jsx-runtime";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
7
|
import clsx from "clsx";
|
|
8
|
+
import { useEffect, useId } from "react";
|
|
9
|
+
import { getHeaderFooterBackgroundClasses, getHeaderFooterCopyClasses, getStickyBlurClasses } from "../common/utilities.js";
|
|
8
10
|
import { DataGridContext } from "../DataGrid/DataGridContext.js";
|
|
9
|
-
import {
|
|
10
|
-
import { CellWrapper } from "../DataGridConstants/DataGridConstants.js";
|
|
11
|
+
import { BlurEffects, CellWrapper } from "../DataGridConstants/DataGridConstants.js";
|
|
11
12
|
|
|
12
13
|
;// CONCATENATED MODULE: external "react/jsx-runtime"
|
|
13
14
|
|
|
14
15
|
;// CONCATENATED MODULE: external "clsx"
|
|
15
16
|
|
|
16
|
-
;// CONCATENATED MODULE: external "
|
|
17
|
+
;// CONCATENATED MODULE: external "react"
|
|
18
|
+
|
|
19
|
+
;// CONCATENATED MODULE: external "../common/utilities.js"
|
|
17
20
|
|
|
18
|
-
;// CONCATENATED MODULE: external "../DataGrid/
|
|
21
|
+
;// CONCATENATED MODULE: external "../DataGrid/DataGridContext.js"
|
|
19
22
|
|
|
20
23
|
;// CONCATENATED MODULE: external "../DataGridConstants/DataGridConstants.js"
|
|
21
24
|
|
|
@@ -25,46 +28,115 @@ import { CellWrapper } from "../DataGridConstants/DataGridConstants.js";
|
|
|
25
28
|
|
|
26
29
|
|
|
27
30
|
|
|
31
|
+
|
|
28
32
|
/**
|
|
29
|
-
* Generates classes for the DataGridHeader.
|
|
30
|
-
*
|
|
31
|
-
|
|
33
|
+
* Generates classes for the DataGridHeader wrapper.
|
|
34
|
+
*
|
|
35
|
+
* When stickyHeader is true, uses position:absolute so the header overlays
|
|
36
|
+
* the scrollbar area. The parent DataGrid auto-detects caption presence and
|
|
37
|
+
* applies appropriate padding to the scrollable content.
|
|
38
|
+
*
|
|
39
|
+
* When columns are provided (subgrid mode) and not sticky, uses display:contents
|
|
40
|
+
* so the header doesn't break the parent grid flow.
|
|
41
|
+
*/ const getHeaderClasses = ({ className, stickyHeader, mode, blurEffect, hasColumns })=>{
|
|
42
|
+
const hasBlur = Boolean(blurEffect && blurEffect !== BlurEffects.NONE);
|
|
43
|
+
/**
|
|
44
|
+
* When columns are provided and not sticky, use display:contents so the
|
|
45
|
+
* rowgroup doesn't interfere with the grid flow. The rows will use subgrid.
|
|
46
|
+
*/ if (hasColumns && !stickyHeader) {
|
|
47
|
+
return clsx("contents", getHeaderFooterBackgroundClasses({
|
|
48
|
+
mode,
|
|
49
|
+
hasBlur,
|
|
50
|
+
sticky: Boolean(stickyHeader)
|
|
51
|
+
}), getHeaderFooterCopyClasses({
|
|
52
|
+
mode
|
|
53
|
+
}), className);
|
|
54
|
+
}
|
|
32
55
|
return clsx("flex flex-col", {
|
|
33
|
-
|
|
34
|
-
"top-0": stickyHeader
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
}),
|
|
56
|
+
// Absolute positioning to overlay scrollbar, matching footer behavior
|
|
57
|
+
"absolute left-0 right-0 z-20 top-0 rounded-t-lg": stickyHeader
|
|
58
|
+
}, getHeaderFooterBackgroundClasses({
|
|
59
|
+
mode,
|
|
60
|
+
hasBlur,
|
|
61
|
+
sticky: Boolean(stickyHeader)
|
|
62
|
+
}), getHeaderFooterCopyClasses({
|
|
40
63
|
mode
|
|
41
64
|
}), stickyHeader && getStickyBlurClasses({
|
|
42
65
|
blurEffect
|
|
43
66
|
}), className);
|
|
44
67
|
};
|
|
68
|
+
/**
|
|
69
|
+
* Generates classes for the caption element inside DataGridHeader.
|
|
70
|
+
* When hasColumns is true (subgrid mode), adds col-span-full to span all columns.
|
|
71
|
+
*/ const getCaptionClasses = ({ captionClassName, hasColumns })=>{
|
|
72
|
+
return clsx("py-2 text-sm text-center font-bold", // In subgrid mode, caption needs to span all columns
|
|
73
|
+
hasColumns && "col-span-full", captionClassName);
|
|
74
|
+
};
|
|
45
75
|
/* =============================================================================
|
|
46
76
|
* DataGridHeader
|
|
47
|
-
* ========================================================================== */ const DataGridHeader = ({ className, children, ...rest })=>{
|
|
77
|
+
* ========================================================================== */ const DataGridHeader = ({ caption, captionClassName, className, children, ...rest })=>{
|
|
78
|
+
const captionId = useId();
|
|
48
79
|
return /*#__PURE__*/ jsx(DataGridContext.Consumer, {
|
|
49
|
-
children: (ctx)=>/*#__PURE__*/ jsx(
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
className,
|
|
58
|
-
stickyHeader: ctx.stickyHeader,
|
|
59
|
-
mode: ctx.mode,
|
|
60
|
-
blurEffect: ctx.blurEffect,
|
|
61
|
-
hasCaption: ctx.hasCaption
|
|
62
|
-
}),
|
|
63
|
-
...rest,
|
|
64
|
-
children: children
|
|
65
|
-
})
|
|
80
|
+
children: (ctx)=>/*#__PURE__*/ jsx(DataGridHeaderInner, {
|
|
81
|
+
caption: caption,
|
|
82
|
+
captionClassName: captionClassName,
|
|
83
|
+
captionId: captionId,
|
|
84
|
+
className: className,
|
|
85
|
+
ctx: ctx,
|
|
86
|
+
...rest,
|
|
87
|
+
children: children
|
|
66
88
|
})
|
|
67
89
|
});
|
|
68
90
|
};
|
|
91
|
+
DataGridHeader.displayName = "DataGridHeader";
|
|
92
|
+
/**
|
|
93
|
+
* Inner component to handle the useEffect for registering captionId.
|
|
94
|
+
* Separated to avoid hooks inside Consumer render prop.
|
|
95
|
+
*/ const DataGridHeaderInner = ({ caption, captionClassName, captionId, className, ctx, children, ...rest })=>{
|
|
96
|
+
const hasColumns = Boolean(ctx.columns);
|
|
97
|
+
// Register the caption ID with the parent DataGrid for aria-labelledby
|
|
98
|
+
useEffect(()=>{
|
|
99
|
+
if (caption && ctx.setCaptionId) {
|
|
100
|
+
ctx.setCaptionId(captionId);
|
|
101
|
+
}
|
|
102
|
+
return ()=>{
|
|
103
|
+
if (ctx.setCaptionId) {
|
|
104
|
+
ctx.setCaptionId(undefined);
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
}, [
|
|
108
|
+
caption,
|
|
109
|
+
captionId,
|
|
110
|
+
ctx.setCaptionId
|
|
111
|
+
]);
|
|
112
|
+
return /*#__PURE__*/ jsx(DataGridContext.Provider, {
|
|
113
|
+
value: {
|
|
114
|
+
...ctx,
|
|
115
|
+
cellWrapper: CellWrapper.HEADER
|
|
116
|
+
},
|
|
117
|
+
children: /*#__PURE__*/ jsxs("div", {
|
|
118
|
+
role: "rowgroup",
|
|
119
|
+
className: getHeaderClasses({
|
|
120
|
+
className,
|
|
121
|
+
stickyHeader: ctx.stickyHeader,
|
|
122
|
+
mode: ctx.mode,
|
|
123
|
+
blurEffect: ctx.blurEffect,
|
|
124
|
+
hasColumns
|
|
125
|
+
}),
|
|
126
|
+
...rest,
|
|
127
|
+
children: [
|
|
128
|
+
caption && /*#__PURE__*/ jsx("div", {
|
|
129
|
+
id: captionId,
|
|
130
|
+
className: getCaptionClasses({
|
|
131
|
+
captionClassName,
|
|
132
|
+
hasColumns
|
|
133
|
+
}),
|
|
134
|
+
children: caption
|
|
135
|
+
}),
|
|
136
|
+
children
|
|
137
|
+
]
|
|
138
|
+
})
|
|
139
|
+
});
|
|
140
|
+
};
|
|
69
141
|
|
|
70
|
-
export { DataGridHeader, getHeaderClasses };
|
|
142
|
+
export { DataGridHeader, getCaptionClasses, getHeaderClasses };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { DataGridRowProps } from "../DataGrid/DataGridTypes";
|
|
2
|
-
export declare const DataGridRow: ({ className, children, ...rest }: DataGridRowProps) => import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export declare const DataGridRow: ({ className, children, style: userStyle, ...rest }: DataGridRowProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
@versini/ui-datagrid v0.
|
|
2
|
+
@versini/ui-datagrid v0.2.1
|
|
3
3
|
© 2026 gizmette.com
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -25,25 +25,14 @@ import { CellWrapper } from "../DataGridConstants/index.js";
|
|
|
25
25
|
|
|
26
26
|
|
|
27
27
|
|
|
28
|
-
const getRowClasses = ({ mode, className, cellWrapper
|
|
28
|
+
const getRowClasses = ({ mode, className, cellWrapper })=>{
|
|
29
29
|
// Always use CSS Grid for proper column alignment, with vertical centering
|
|
30
30
|
const layoutClass = "grid items-center";
|
|
31
31
|
if (cellWrapper === CellWrapper.HEADER || cellWrapper === CellWrapper.FOOTER) {
|
|
32
32
|
/**
|
|
33
33
|
* When in a sticky header/footer, don't apply background to row since the
|
|
34
34
|
* background is applied to the rowgroup for blur effect to work.
|
|
35
|
-
*/
|
|
36
|
-
if (isSticky) {
|
|
37
|
-
// No background on row - it's on the rowgroup.
|
|
38
|
-
return clsx(layoutClass, className);
|
|
39
|
-
}
|
|
40
|
-
// Non-sticky header/footer still gets background on row.
|
|
41
|
-
return clsx(layoutClass, {
|
|
42
|
-
"bg-table-head-dark": mode === "dark" || mode === "system",
|
|
43
|
-
"bg-table-head-light": mode === "light" || mode === "alt-system",
|
|
44
|
-
"dark:bg-table-head-light": mode === "system",
|
|
45
|
-
"dark:bg-table-head-dark": mode === "alt-system"
|
|
46
|
-
}, className);
|
|
35
|
+
*/ return clsx(layoutClass, className);
|
|
47
36
|
}
|
|
48
37
|
return clsx(layoutClass, "border-b last:border-0", {
|
|
49
38
|
"border-table-dark": mode === "dark" || mode === "system",
|
|
@@ -57,29 +46,64 @@ const getRowClasses = ({ mode, className, cellWrapper, stickyHeader, stickyFoote
|
|
|
57
46
|
"odd:bg-table-dark-odd even:bg-table-dark-even dark:odd:bg-table-light-odd dark:even:bg-table-light-even": mode === "system",
|
|
58
47
|
"hover:bg-table-dark-hover dark:hover:bg-table-light-hover": mode === "system",
|
|
59
48
|
"odd:bg-table-light-odd even:bg-table-light-even dark:odd:bg-table-dark-odd dark:even:bg-table-dark-even": mode === "alt-system",
|
|
60
|
-
"hover:bg-table-light-hover dark
|
|
49
|
+
"hover:bg-table-light-hover dark::hover:bg-table-dark-hover": mode === "alt-system"
|
|
61
50
|
}, className);
|
|
62
51
|
};
|
|
63
52
|
/* =============================================================================
|
|
64
53
|
* DataGridRow
|
|
65
|
-
* ========================================================================== */ const DataGridRow = ({ className, children, ...rest })=>{
|
|
54
|
+
* ========================================================================== */ const DataGridRow = ({ className, children, style: userStyle, ...rest })=>{
|
|
66
55
|
// Count the number of direct children to determine column count
|
|
67
56
|
const columnCount = react.Children.count(children);
|
|
68
57
|
return /*#__PURE__*/ jsx(DataGridContext.Consumer, {
|
|
69
|
-
children: ({ mode, cellWrapper, stickyHeader, stickyFooter })=>{
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
58
|
+
children: ({ mode, cellWrapper, stickyHeader, stickyFooter, columns })=>{
|
|
59
|
+
/**
|
|
60
|
+
* Determine if this row is inside a sticky header/footer.
|
|
61
|
+
* Sticky elements are absolutely positioned and outside the main grid
|
|
62
|
+
* flow, so they can't use subgrid.
|
|
63
|
+
*/ const isInStickyHeader = cellWrapper === CellWrapper.HEADER && stickyHeader;
|
|
64
|
+
const isInStickyFooter = cellWrapper === CellWrapper.FOOTER && stickyFooter;
|
|
65
|
+
const isInStickyContext = isInStickyHeader || isInStickyFooter;
|
|
66
|
+
/**
|
|
67
|
+
* When columns are provided AND the row is inside the grid flow
|
|
68
|
+
* (not in a sticky header/footer), use CSS subgrid to inherit the
|
|
69
|
+
* column sizing from the parent grid.
|
|
70
|
+
*
|
|
71
|
+
* For sticky headers/footers, use the explicit column template since
|
|
72
|
+
* they're absolutely positioned outside the main grid.
|
|
73
|
+
*
|
|
74
|
+
* When columns are not provided, fall back to the original behavior
|
|
75
|
+
* where each row defines its own equal-width columns.
|
|
76
|
+
*/ let rowStyle;
|
|
77
|
+
if (columns) {
|
|
78
|
+
if (isInStickyContext) {
|
|
79
|
+
// Sticky elements can't use subgrid, use explicit template
|
|
80
|
+
rowStyle = {
|
|
81
|
+
gridTemplateColumns: columns.join(" ")
|
|
82
|
+
};
|
|
83
|
+
} else {
|
|
84
|
+
// Normal flow: use subgrid to inherit from parent grid
|
|
85
|
+
rowStyle = {
|
|
86
|
+
gridColumn: "1 / -1",
|
|
87
|
+
gridTemplateColumns: "subgrid"
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
} else {
|
|
91
|
+
// No columns prop: use equal-width columns
|
|
92
|
+
rowStyle = {
|
|
93
|
+
gridTemplateColumns: `repeat(${columnCount}, minmax(0, 1fr))`
|
|
94
|
+
};
|
|
95
|
+
}
|
|
73
96
|
return /*#__PURE__*/ jsx("div", {
|
|
74
97
|
role: "row",
|
|
75
98
|
className: getRowClasses({
|
|
76
99
|
mode,
|
|
77
100
|
className,
|
|
78
|
-
cellWrapper
|
|
79
|
-
stickyHeader,
|
|
80
|
-
stickyFooter
|
|
101
|
+
cellWrapper
|
|
81
102
|
}),
|
|
82
|
-
style:
|
|
103
|
+
style: {
|
|
104
|
+
...rowStyle,
|
|
105
|
+
...userStyle
|
|
106
|
+
},
|
|
83
107
|
...rest,
|
|
84
108
|
children: children
|
|
85
109
|
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type BlurEffect, type ThemeMode } from "../DataGridConstants/DataGridConstants";
|
|
2
|
+
export declare const getHeaderFooterBackgroundClasses: ({ mode, hasBlur, sticky, }: {
|
|
3
|
+
mode: ThemeMode;
|
|
4
|
+
hasBlur: boolean;
|
|
5
|
+
sticky: boolean;
|
|
6
|
+
}) => string;
|
|
7
|
+
export declare const getHeaderFooterCopyClasses: ({ mode }: {
|
|
8
|
+
mode: ThemeMode;
|
|
9
|
+
}) => string;
|
|
10
|
+
/**
|
|
11
|
+
* Common classes for sticky header/footer with optional blur effect.
|
|
12
|
+
*/
|
|
13
|
+
export declare const getStickyBlurClasses: ({ blurEffect, }: {
|
|
14
|
+
blurEffect?: BlurEffect;
|
|
15
|
+
}) => string;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
@versini/ui-datagrid v0.2.1
|
|
3
|
+
© 2026 gizmette.com
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import clsx from "clsx";
|
|
7
|
+
import { BlurEffects } from "../DataGridConstants/DataGridConstants.js";
|
|
8
|
+
|
|
9
|
+
;// CONCATENATED MODULE: external "clsx"
|
|
10
|
+
|
|
11
|
+
;// CONCATENATED MODULE: external "../DataGridConstants/DataGridConstants.js"
|
|
12
|
+
|
|
13
|
+
;// CONCATENATED MODULE: ./src/common/utilities.ts
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
const getHeaderFooterBackgroundClasses = ({ mode, hasBlur, sticky })=>{
|
|
17
|
+
return clsx({
|
|
18
|
+
// Semi-transparent backgrounds for blur effect.
|
|
19
|
+
"bg-surface-darkest/50": hasBlur && sticky && (mode === "dark" || mode === "system"),
|
|
20
|
+
"bg-surface-light/50": hasBlur && sticky && (mode === "light" || mode === "alt-system"),
|
|
21
|
+
"dark:bg-surface-light/50": hasBlur && sticky && mode === "system",
|
|
22
|
+
"dark:bg-surface-darkest/50": hasBlur && sticky && mode === "alt-system",
|
|
23
|
+
// Solid backgrounds when no blur effect.
|
|
24
|
+
"bg-surface-darkest": !hasBlur && (mode === "dark" || mode === "system"),
|
|
25
|
+
"bg-surface-light": !hasBlur && (mode === "light" || mode === "alt-system"),
|
|
26
|
+
"dark:bg-surface-light": !hasBlur && mode === "system",
|
|
27
|
+
"dark:bg-surface-darkest": !hasBlur && mode === "alt-system"
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
const getHeaderFooterCopyClasses = ({ mode })=>{
|
|
31
|
+
return clsx({
|
|
32
|
+
"text-copy-light": mode === "dark",
|
|
33
|
+
"text-copy-dark": mode === "light",
|
|
34
|
+
"text-copy-light dark:text-copy-dark": mode === "system",
|
|
35
|
+
"text-copy-dark dark:text-copy-light": mode === "alt-system"
|
|
36
|
+
});
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* Common classes for sticky header/footer with optional blur effect.
|
|
40
|
+
*/ const getStickyBlurClasses = ({ blurEffect })=>{
|
|
41
|
+
return clsx({
|
|
42
|
+
"backdrop-blur-sm": blurEffect === BlurEffects.SMALL,
|
|
43
|
+
"backdrop-blur-md": blurEffect === BlurEffects.MEDIUM,
|
|
44
|
+
"backdrop-blur-lg": blurEffect === BlurEffects.LARGE
|
|
45
|
+
});
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export { getHeaderFooterBackgroundClasses, getHeaderFooterCopyClasses, getStickyBlurClasses };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@versini/ui-datagrid",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "Arno Versini",
|
|
6
6
|
"publishConfig": {
|
|
@@ -94,5 +94,5 @@
|
|
|
94
94
|
"sideEffects": [
|
|
95
95
|
"**/*.css"
|
|
96
96
|
],
|
|
97
|
-
"gitHead": "
|
|
97
|
+
"gitHead": "7c76dd8543839e693f0ad12980f8de01ad2ab123"
|
|
98
98
|
}
|