@versini/ui-datagrid 0.2.0 → 0.2.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.
- package/README.md +101 -11
- package/dist/DataGrid/DataGrid.d.ts +1 -1
- package/dist/DataGrid/DataGrid.js +70 -35
- package/dist/DataGrid/DataGridContext.js +1 -1
- package/dist/DataGrid/index.js +1 -1
- package/dist/DataGrid/utilities.d.ts +9 -21
- package/dist/DataGrid/utilities.js +11 -47
- 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 +1 -1
- 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 +4 -1
- package/dist/DataGridFooter/DataGridFooter.js +12 -17
- package/dist/DataGridFooter/index.js +1 -1
- package/dist/DataGridHeader/DataGridHeader.d.ts +20 -7
- package/dist/DataGridHeader/DataGridHeader.js +99 -41
- 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.js +5 -18
- 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
package/README.md
CHANGED
|
@@ -4,6 +4,7 @@ A data grid component library for React built with div-based ARIA grid layout fo
|
|
|
4
4
|
|
|
5
5
|
- **Accessible**: Uses ARIA grid roles for screen reader support
|
|
6
6
|
- **Flexible Layout**: Div-based structure allows for complex styling
|
|
7
|
+
- **CSS Grid Columns**: Define column widths with CSS Grid track sizes
|
|
7
8
|
- **Infinite Scrolling**: Progressive loading with IntersectionObserver
|
|
8
9
|
- **Animated Height**: Smooth height transitions when content changes
|
|
9
10
|
- **Sorting**: Built-in sorting utilities and sortable column headers
|
|
@@ -56,7 +57,9 @@ import {
|
|
|
56
57
|
getNextSortConfig,
|
|
57
58
|
getOppositeSortDirection,
|
|
58
59
|
toggleSortDirection,
|
|
59
|
-
SortDirections
|
|
60
|
+
SortDirections,
|
|
61
|
+
type SortConfig,
|
|
62
|
+
type SortComparator
|
|
60
63
|
} from "@versini/ui-datagrid/sorting";
|
|
61
64
|
|
|
62
65
|
// Constants
|
|
@@ -99,6 +102,43 @@ function MyTable({ data }) {
|
|
|
99
102
|
}
|
|
100
103
|
```
|
|
101
104
|
|
|
105
|
+
## CSS Grid Columns
|
|
106
|
+
|
|
107
|
+
Use the `columns` prop to define column widths with CSS Grid track sizes:
|
|
108
|
+
|
|
109
|
+
```tsx
|
|
110
|
+
<DataGrid
|
|
111
|
+
columns={["200px", "1fr", "auto"]}
|
|
112
|
+
maxHeight="400px"
|
|
113
|
+
stickyHeader
|
|
114
|
+
>
|
|
115
|
+
<DataGridHeader caption="User List">
|
|
116
|
+
<DataGridRow>
|
|
117
|
+
<DataGridCell>Name</DataGridCell>
|
|
118
|
+
<DataGridCell>Email</DataGridCell>
|
|
119
|
+
<DataGridCell>Actions</DataGridCell>
|
|
120
|
+
</DataGridRow>
|
|
121
|
+
</DataGridHeader>
|
|
122
|
+
<DataGridBody>
|
|
123
|
+
{data.map((item) => (
|
|
124
|
+
<DataGridRow key={item.id}>
|
|
125
|
+
<DataGridCell>{item.name}</DataGridCell>
|
|
126
|
+
<DataGridCell>{item.email}</DataGridCell>
|
|
127
|
+
<DataGridCell>Edit</DataGridCell>
|
|
128
|
+
</DataGridRow>
|
|
129
|
+
))}
|
|
130
|
+
</DataGridBody>
|
|
131
|
+
</DataGrid>
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
Supported column values include:
|
|
135
|
+
- Fixed sizes: `"200px"`, `"10rem"`, `"5em"`
|
|
136
|
+
- Flexible sizes: `"1fr"`, `"2fr"`
|
|
137
|
+
- Auto sizing: `"auto"`, `"min-content"`, `"max-content"`
|
|
138
|
+
- Functions: `"minmax(100px, 1fr)"`, `"fit-content(200px)"`
|
|
139
|
+
- Repeat: `"repeat(3, 1fr)"`, `"repeat(auto-fill, minmax(100px, 1fr))"`
|
|
140
|
+
- CSS variables and calc: `"var(--col-width)"`, `"calc(100% - 200px)"`
|
|
141
|
+
|
|
102
142
|
## Infinite Scroll
|
|
103
143
|
|
|
104
144
|
For datasets with hundreds to thousands of rows, use progressive loading:
|
|
@@ -229,16 +269,66 @@ function MySortableTable({ data }) {
|
|
|
229
269
|
|
|
230
270
|
### DataGrid
|
|
231
271
|
|
|
232
|
-
| Prop
|
|
233
|
-
|
|
|
234
|
-
| `mode`
|
|
235
|
-
| `compact`
|
|
236
|
-
| `stickyHeader`
|
|
237
|
-
| `stickyFooter`
|
|
238
|
-
| `blurEffect`
|
|
239
|
-
| `maxHeight`
|
|
240
|
-
| `disabled`
|
|
241
|
-
| `
|
|
272
|
+
| Prop | Type | Default | Description |
|
|
273
|
+
| ------------------ | ----------------------------------------------- | ---------- | -------------------------------------------------- |
|
|
274
|
+
| `mode` | `'dark' \| 'light' \| 'system' \| 'alt-system'` | `'system'` | Theme mode |
|
|
275
|
+
| `compact` | `boolean` | `false` | Reduced padding |
|
|
276
|
+
| `stickyHeader` | `boolean` | `false` | Fixed header while scrolling |
|
|
277
|
+
| `stickyFooter` | `boolean` | `false` | Fixed footer while scrolling |
|
|
278
|
+
| `blurEffect` | `'none' \| 'small' \| 'medium' \| 'large'` | `'none'` | Blur intensity for sticky elements |
|
|
279
|
+
| `maxHeight` | `string` | - | Max height (required for sticky) |
|
|
280
|
+
| `disabled` | `boolean` | `false` | Show loading overlay with spinner |
|
|
281
|
+
| `columns` | `string[]` | - | CSS Grid track sizes for column widths |
|
|
282
|
+
| `summary` | `string` | - | Alternative text for screen readers |
|
|
283
|
+
| `className` | `string` | - | CSS class for the grid element |
|
|
284
|
+
| `wrapperClassName` | `string` | - | CSS class for the wrapper container |
|
|
285
|
+
|
|
286
|
+
### DataGridHeader
|
|
287
|
+
|
|
288
|
+
| Prop | Type | Default | Description |
|
|
289
|
+
| ------------------ | ----------- | ------- | --------------------------------- |
|
|
290
|
+
| `caption` | `ReactNode` | - | Caption/title displayed above header row |
|
|
291
|
+
| `captionClassName` | `string` | - | CSS class for the caption element |
|
|
292
|
+
| `className` | `string` | - | CSS class for the header |
|
|
293
|
+
|
|
294
|
+
### DataGridBody / DataGridFooter
|
|
295
|
+
|
|
296
|
+
| Prop | Type | Default | Description |
|
|
297
|
+
| ----------- | -------- | ------- | ------------------------ |
|
|
298
|
+
| `className` | `string` | - | CSS class for the element |
|
|
299
|
+
|
|
300
|
+
### DataGridRow
|
|
301
|
+
|
|
302
|
+
| Prop | Type | Default | Description |
|
|
303
|
+
| ----------- | --------- | ------- | ------------------------------------ |
|
|
304
|
+
| `active` | `boolean` | `false` | Show left border indicator |
|
|
305
|
+
| `className` | `string` | - | CSS class for the row |
|
|
306
|
+
|
|
307
|
+
### DataGridCell
|
|
308
|
+
|
|
309
|
+
| Prop | Type | Default | Description |
|
|
310
|
+
| ----------- | ------------------------------ | ------- | ----------------------------- |
|
|
311
|
+
| `align` | `'left' \| 'center' \| 'right'`| `'left'`| Horizontal alignment |
|
|
312
|
+
| `colSpan` | `number` | `1` | Number of columns to span |
|
|
313
|
+
| `active` | `boolean` | `false` | Show left border indicator |
|
|
314
|
+
| `className` | `string` | - | CSS class for the cell |
|
|
315
|
+
|
|
316
|
+
### DataGridCellSort
|
|
317
|
+
|
|
318
|
+
| Prop | Type | Default | Description |
|
|
319
|
+
| ----------------- | ----------------------------------------------- | -------------- | ------------------------------------ |
|
|
320
|
+
| `cellId` | `string` | **required** | Unique identifier for the column |
|
|
321
|
+
| `children` | `string` | **required** | Label text for the column header |
|
|
322
|
+
| `onSort` | `(cellId, direction?) => void` | - | Handler when sort button is clicked |
|
|
323
|
+
| `sortDirection` | `'asc' \| 'desc' \| false` | **required** | Current sort direction |
|
|
324
|
+
| `sortedCell` | `string` | **required** | ID of the currently sorted column |
|
|
325
|
+
| `align` | `'left' \| 'center' \| 'right'` | `'left'` | Horizontal alignment |
|
|
326
|
+
| `mode` | `'dark' \| 'light' \| 'system' \| 'alt-system'` | `'alt-system'` | Theme mode for sort button |
|
|
327
|
+
| `focusMode` | `'dark' \| 'light' \| 'system' \| 'alt-system'` | `'alt-system'` | Focus mode for sort button |
|
|
328
|
+
| `slotLeft` | `ReactNode` | - | Content to display left of label |
|
|
329
|
+
| `slotRight` | `ReactNode` | - | Content to display right of label |
|
|
330
|
+
| `className` | `string` | - | CSS class for the cell |
|
|
331
|
+
| `buttonClassName` | `string` | - | CSS class for the sort button |
|
|
242
332
|
|
|
243
333
|
### useInfiniteScroll
|
|
244
334
|
|
|
@@ -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.
|
|
2
|
+
@versini/ui-datagrid v0.2.2
|
|
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,47 +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,
|
|
40
84
|
hasColumns: Boolean(columns)
|
|
41
85
|
}), [
|
|
42
86
|
mode,
|
|
43
87
|
className,
|
|
44
88
|
wrapperClassName,
|
|
45
|
-
|
|
46
|
-
|
|
89
|
+
effectiveStickyHeader,
|
|
90
|
+
effectiveStickyFooter,
|
|
47
91
|
disabled,
|
|
48
|
-
|
|
92
|
+
hasCaption,
|
|
49
93
|
columns
|
|
50
94
|
]);
|
|
51
95
|
const contextValue = useMemo(()=>({
|
|
52
96
|
mode,
|
|
53
97
|
compact,
|
|
54
|
-
stickyHeader,
|
|
55
|
-
stickyFooter,
|
|
98
|
+
stickyHeader: effectiveStickyHeader,
|
|
99
|
+
stickyFooter: effectiveStickyFooter,
|
|
56
100
|
blurEffect,
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
columns
|
|
101
|
+
columns,
|
|
102
|
+
setCaptionId: handleSetCaptionId
|
|
60
103
|
}), [
|
|
61
104
|
mode,
|
|
62
105
|
compact,
|
|
63
|
-
|
|
64
|
-
|
|
106
|
+
effectiveStickyHeader,
|
|
107
|
+
effectiveStickyFooter,
|
|
65
108
|
blurEffect,
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
columns
|
|
109
|
+
columns,
|
|
110
|
+
handleSetCaptionId
|
|
69
111
|
]);
|
|
70
112
|
const wrapperStyle = maxHeight ? {
|
|
71
113
|
maxHeight: typeof maxHeight === "number" ? `${maxHeight}px` : maxHeight
|
|
@@ -74,7 +116,7 @@ import { getDataGridClasses } from "./utilities.js";
|
|
|
74
116
|
* When sticky header/footer is enabled, use Panel-like structure: - Outer
|
|
75
117
|
* wrapper has overflow-hidden - Scrollable content area in the middle with
|
|
76
118
|
* padding - Header/footer are absolutely positioned.
|
|
77
|
-
*/ const hasSticky =
|
|
119
|
+
*/ const hasSticky = effectiveStickyHeader || effectiveStickyFooter;
|
|
78
120
|
/**
|
|
79
121
|
* When columns are provided, apply grid-template-columns at the grid level
|
|
80
122
|
* so all rows can use subgrid to inherit the same column sizing.
|
|
@@ -83,8 +125,8 @@ import { getDataGridClasses } from "./utilities.js";
|
|
|
83
125
|
} : undefined;
|
|
84
126
|
const gridContent = /*#__PURE__*/ jsx("div", {
|
|
85
127
|
role: "grid",
|
|
128
|
+
"aria-labelledby": captionId,
|
|
86
129
|
className: classes.grid,
|
|
87
|
-
"aria-labelledby": caption ? captionId : undefined,
|
|
88
130
|
style: gridStyle,
|
|
89
131
|
...rest,
|
|
90
132
|
children: children
|
|
@@ -113,21 +155,14 @@ import { getDataGridClasses } from "./utilities.js";
|
|
|
113
155
|
})
|
|
114
156
|
]
|
|
115
157
|
}),
|
|
116
|
-
/*#__PURE__*/
|
|
158
|
+
/*#__PURE__*/ jsx("div", {
|
|
117
159
|
className: classes.wrapper,
|
|
118
160
|
style: wrapperStyle,
|
|
119
|
-
children:
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
}),
|
|
125
|
-
hasSticky ? /*#__PURE__*/ jsx("div", {
|
|
126
|
-
className: classes.scrollableContent,
|
|
127
|
-
style: wrapperStyle,
|
|
128
|
-
children: gridContent
|
|
129
|
-
}) : gridContent
|
|
130
|
-
]
|
|
161
|
+
children: hasSticky ? /*#__PURE__*/ jsx("div", {
|
|
162
|
+
className: classes.scrollableContent,
|
|
163
|
+
style: wrapperStyle,
|
|
164
|
+
children: gridContent
|
|
165
|
+
}) : gridContent
|
|
131
166
|
})
|
|
132
167
|
]
|
|
133
168
|
})
|
package/dist/DataGrid/index.js
CHANGED
|
@@ -1,22 +1,11 @@
|
|
|
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
|
|
20
9
|
*
|
|
21
10
|
* When columns prop is provided, the grid uses CSS Grid layout with subgrid
|
|
22
11
|
* support for proper column alignment across all rows.
|
|
@@ -37,10 +26,10 @@ export declare const getDataGridClasses: ({ mode, className, wrapperClassName, s
|
|
|
37
26
|
spinner: string;
|
|
38
27
|
wrapper: string;
|
|
39
28
|
/**
|
|
40
|
-
* Scrollable content area
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
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
|
|
44
33
|
*/
|
|
45
34
|
scrollableContent: string;
|
|
46
35
|
/**
|
|
@@ -48,5 +37,4 @@ export declare const getDataGridClasses: ({ mode, className, wrapperClassName, s
|
|
|
48
37
|
* consistent column alignment. Otherwise, use flexbox.
|
|
49
38
|
*/
|
|
50
39
|
grid: string;
|
|
51
|
-
caption: string;
|
|
52
40
|
};
|
|
@@ -1,18 +1,14 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
@versini/ui-datagrid v0.2.
|
|
2
|
+
@versini/ui-datagrid v0.2.2
|
|
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,37 +31,13 @@ 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
|
|
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
|
|
69
41
|
*
|
|
70
42
|
* When columns prop is provided, the grid uses CSS Grid layout with subgrid
|
|
71
43
|
* support for proper column alignment across all rows.
|
|
@@ -93,10 +65,10 @@ const getCaptionCopyClasses = ({ mode })=>{
|
|
|
93
65
|
"text-copy-dark dark:text-copy-light": mode === "alt-system"
|
|
94
66
|
}, wrapperClassName),
|
|
95
67
|
/**
|
|
96
|
-
* Scrollable content area
|
|
97
|
-
*
|
|
98
|
-
*
|
|
99
|
-
*
|
|
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
|
|
100
72
|
*/ scrollableContent: clsx("overflow-y-auto overflow-x-hidden rounded-[inherit]", {
|
|
101
73
|
"pt-10": stickyHeader && !hasCaption,
|
|
102
74
|
"pt-19": stickyHeader && hasCaption,
|
|
@@ -110,16 +82,8 @@ const getCaptionCopyClasses = ({ mode })=>{
|
|
|
110
82
|
"text-copy-dark": mode === "light",
|
|
111
83
|
"text-copy-light dark:text-copy-dark": mode === "system",
|
|
112
84
|
"text-copy-dark dark:text-copy-light": mode === "alt-system"
|
|
113
|
-
})
|
|
114
|
-
caption: clsx("py-2 text-sm text-center font-bold", {
|
|
115
|
-
// When stickyHeader is enabled, caption is absolutely positioned at top
|
|
116
|
-
"absolute left-0 right-0 z-20 top-0 rounded-t-lg": stickyHeader
|
|
117
|
-
}, getCaptionBackgroundClasses({
|
|
118
|
-
mode
|
|
119
|
-
}), getCaptionCopyClasses({
|
|
120
|
-
mode
|
|
121
|
-
}))
|
|
85
|
+
})
|
|
122
86
|
};
|
|
123
87
|
};
|
|
124
88
|
|
|
125
|
-
export {
|
|
89
|
+
export { getDataGridClasses };
|
|
@@ -13,4 +13,7 @@ export declare const getFooterClasses: ({ className, stickyFooter, mode, blurEff
|
|
|
13
13
|
hasColumns?: boolean;
|
|
14
14
|
stickyFooter?: boolean;
|
|
15
15
|
}) => string;
|
|
16
|
-
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.
|
|
2
|
+
@versini/ui-datagrid v0.2.2
|
|
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
|
|
|
@@ -37,7 +37,7 @@ import { BlurEffects, CellWrapper } from "../DataGridConstants/DataGridConstants
|
|
|
37
37
|
*/ if (hasColumns && !stickyFooter) {
|
|
38
38
|
return clsx("contents", className);
|
|
39
39
|
}
|
|
40
|
-
const hasBlur = blurEffect && blurEffect !== BlurEffects.NONE;
|
|
40
|
+
const hasBlur = Boolean(blurEffect && blurEffect !== BlurEffects.NONE);
|
|
41
41
|
return clsx("flex flex-col", {
|
|
42
42
|
/**
|
|
43
43
|
* Absolute positioning like Panel's footer: absolute left-0 right-0 z-20
|
|
@@ -47,18 +47,12 @@ import { BlurEffects, CellWrapper } from "../DataGridConstants/DataGridConstants
|
|
|
47
47
|
"shadow-[rgb(190_190_190_/20%)_0_-0.5rem_1rem]": stickyFooter && mode === "dark",
|
|
48
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",
|
|
49
49
|
"shadow-[rgb(65_65_65_/30%)_0_-0.5rem_1rem]": stickyFooter && mode === "light",
|
|
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
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
// Solid backgrounds when no blur effect.
|
|
57
|
-
"bg-table-head-dark": !hasBlur && stickyFooter && (mode === "dark" || mode === "system"),
|
|
58
|
-
"bg-table-head-light": !hasBlur && stickyFooter && (mode === "light" || mode === "alt-system"),
|
|
59
|
-
"dark:bg-table-head-light": !hasBlur && stickyFooter && mode === "system",
|
|
60
|
-
"dark:bg-table-head-dark": !hasBlur && stickyFooter && mode === "alt-system"
|
|
61
|
-
}, 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({
|
|
62
56
|
blurEffect
|
|
63
57
|
}), className);
|
|
64
58
|
};
|
|
@@ -88,5 +82,6 @@ import { BlurEffects, CellWrapper } from "../DataGridConstants/DataGridConstants
|
|
|
88
82
|
})
|
|
89
83
|
});
|
|
90
84
|
};
|
|
85
|
+
DataGridFooter.displayName = "DataGridFooter";
|
|
91
86
|
|
|
92
87
|
export { DataGridFooter, getFooterClasses };
|
|
@@ -1,18 +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
|
-
* Panel - header floats above the scrollable content.
|
|
4
|
+
* Generates classes for the DataGridHeader wrapper.
|
|
6
5
|
*
|
|
7
|
-
* When
|
|
8
|
-
*
|
|
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.
|
|
9
12
|
*/
|
|
10
|
-
export declare const getHeaderClasses: ({ className, stickyHeader, mode, blurEffect,
|
|
13
|
+
export declare const getHeaderClasses: ({ className, stickyHeader, mode, blurEffect, hasColumns, }: {
|
|
11
14
|
mode: ThemeMode;
|
|
12
15
|
blurEffect?: BlurEffect;
|
|
13
16
|
className?: string;
|
|
14
|
-
hasCaption?: boolean;
|
|
15
17
|
hasColumns?: boolean;
|
|
16
18
|
stickyHeader?: boolean;
|
|
17
19
|
}) => string;
|
|
18
|
-
|
|
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.
|
|
2
|
+
@versini/ui-datagrid v0.2.2
|
|
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,60 +28,115 @@ import { CellWrapper } from "../DataGridConstants/DataGridConstants.js";
|
|
|
25
28
|
|
|
26
29
|
|
|
27
30
|
|
|
31
|
+
|
|
28
32
|
/**
|
|
29
|
-
* Generates classes for the DataGridHeader.
|
|
30
|
-
* Panel - header floats above the scrollable content.
|
|
33
|
+
* Generates classes for the DataGridHeader wrapper.
|
|
31
34
|
*
|
|
32
|
-
* When
|
|
33
|
-
*
|
|
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);
|
|
35
43
|
/**
|
|
36
44
|
* When columns are provided and not sticky, use display:contents so the
|
|
37
45
|
* rowgroup doesn't interfere with the grid flow. The rows will use subgrid.
|
|
38
46
|
*/ if (hasColumns && !stickyHeader) {
|
|
39
|
-
return clsx("contents",
|
|
40
|
-
mode
|
|
41
|
-
|
|
47
|
+
return clsx("contents", getHeaderFooterBackgroundClasses({
|
|
48
|
+
mode,
|
|
49
|
+
hasBlur,
|
|
50
|
+
sticky: Boolean(stickyHeader)
|
|
51
|
+
}), getHeaderFooterCopyClasses({
|
|
42
52
|
mode
|
|
43
53
|
}), className);
|
|
44
54
|
}
|
|
45
55
|
return clsx("flex flex-col", {
|
|
46
|
-
|
|
47
|
-
"top-0": stickyHeader
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
}),
|
|
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({
|
|
53
63
|
mode
|
|
54
64
|
}), stickyHeader && getStickyBlurClasses({
|
|
55
65
|
blurEffect
|
|
56
66
|
}), className);
|
|
57
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
|
+
};
|
|
58
75
|
/* =============================================================================
|
|
59
76
|
* DataGridHeader
|
|
60
|
-
* ========================================================================== */ const DataGridHeader = ({ className, children, ...rest })=>{
|
|
77
|
+
* ========================================================================== */ const DataGridHeader = ({ caption, captionClassName, className, children, ...rest })=>{
|
|
78
|
+
const captionId = useId();
|
|
61
79
|
return /*#__PURE__*/ jsx(DataGridContext.Consumer, {
|
|
62
|
-
children: (ctx)=>/*#__PURE__*/ jsx(
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
className,
|
|
71
|
-
stickyHeader: ctx.stickyHeader,
|
|
72
|
-
mode: ctx.mode,
|
|
73
|
-
blurEffect: ctx.blurEffect,
|
|
74
|
-
hasCaption: ctx.hasCaption,
|
|
75
|
-
hasColumns: Boolean(ctx.columns)
|
|
76
|
-
}),
|
|
77
|
-
...rest,
|
|
78
|
-
children: children
|
|
79
|
-
})
|
|
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
|
|
80
88
|
})
|
|
81
89
|
});
|
|
82
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
|
+
};
|
|
83
141
|
|
|
84
|
-
export { DataGridHeader, getHeaderClasses };
|
|
142
|
+
export { DataGridHeader, getCaptionClasses, getHeaderClasses };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
@versini/ui-datagrid v0.2.
|
|
2
|
+
@versini/ui-datagrid v0.2.2
|
|
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,7 +46,7 @@ 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
|
/* =============================================================================
|
|
@@ -109,9 +98,7 @@ const getRowClasses = ({ mode, className, cellWrapper, stickyHeader, stickyFoote
|
|
|
109
98
|
className: getRowClasses({
|
|
110
99
|
mode,
|
|
111
100
|
className,
|
|
112
|
-
cellWrapper
|
|
113
|
-
stickyHeader,
|
|
114
|
-
stickyFooter
|
|
101
|
+
cellWrapper
|
|
115
102
|
}),
|
|
116
103
|
style: {
|
|
117
104
|
...rowStyle,
|
|
@@ -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.2
|
|
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.2.
|
|
3
|
+
"version": "0.2.2",
|
|
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": "f23e7cccc6798893b412edd01aec4d767ec94c9f"
|
|
98
98
|
}
|