@versini/ui-datagrid 0.8.0 → 0.8.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/dist/{DataGridBody/useColumnMeasurement.js → 131.js} +14 -7
  2. package/dist/298.js +215 -0
  3. package/dist/{DataGridConstants/DataGridConstants.js → 46.js} +1 -3
  4. package/dist/511.js +9 -0
  5. package/dist/926.js +15 -0
  6. package/dist/DataGrid/index.js +165 -7
  7. package/dist/DataGridAnimated/index.js +159 -6
  8. package/dist/DataGridBody/index.js +33 -4
  9. package/dist/DataGridCell/index.js +37 -4
  10. package/dist/DataGridCellSort/index.js +138 -4
  11. package/dist/DataGridConstants/index.js +2 -6
  12. package/dist/DataGridFooter/index.js +79 -4
  13. package/dist/DataGridHeader/index.js +110 -4
  14. package/dist/DataGridInfinite/index.js +312 -4
  15. package/dist/DataGridRow/index.js +89 -4
  16. package/dist/DataGridSorting/index.js +225 -7
  17. package/dist/utilities/classes.d.ts +7 -29
  18. package/package.json +3 -3
  19. package/dist/DataGrid/DataGrid.js +0 -183
  20. package/dist/DataGrid/DataGridContext.js +0 -16
  21. package/dist/DataGrid/DataGridTypes.js +0 -9
  22. package/dist/DataGridAnimated/AnimatedWrapper.js +0 -53
  23. package/dist/DataGridAnimated/useAnimatedHeight.js +0 -131
  24. package/dist/DataGridBody/DataGridBody.js +0 -55
  25. package/dist/DataGridBody/getBodyClass.js +0 -23
  26. package/dist/DataGridCell/DataGridCell.js +0 -51
  27. package/dist/DataGridCellSort/ButtonSort.js +0 -67
  28. package/dist/DataGridCellSort/DataGridCellSort.js +0 -111
  29. package/dist/DataGridFooter/DataGridFooter.js +0 -98
  30. package/dist/DataGridHeader/DataGridHeader.js +0 -129
  31. package/dist/DataGridInfinite/DataGridInfiniteBody.js +0 -334
  32. package/dist/DataGridRow/DataGridRow.js +0 -108
  33. package/dist/DataGridSorting/sortingUtils.js +0 -234
  34. package/dist/utilities/classes.js +0 -267
@@ -1,12 +1,6 @@
1
1
  import { type BlurEffect, type CellWrapperType, type ThemeMode } from "../DataGridConstants/DataGridConstants";
2
2
  /**
3
- * ============================================================================
4
- * Primitive Theme Mappings (reusable building blocks)
5
- * ============================================================================
6
- */
7
- /**
8
- * Text color classes based on theme mode. Used by: DataGrid wrapper, grid,
9
- * spinner, header/footer copy.
3
+ * Text color classes based on theme mode.
10
4
  */
11
5
  export declare const getTextColorClasses: ({ mode }: {
12
6
  mode: ThemeMode;
@@ -16,38 +10,30 @@ export declare const getTextColorClassesForHeaderFooter: ({ mode, hasBlur, }: {
16
10
  hasBlur: boolean;
17
11
  }) => string;
18
12
  /**
19
- * Surface background classes (main container backgrounds). Used by: DataGrid
20
- * wrapper.
13
+ * Surface background classes (main container backgrounds).
21
14
  */
22
15
  export declare const getSurfaceBackgroundClasses: ({ mode }: {
23
16
  mode: ThemeMode;
24
17
  }) => string;
25
18
  /**
26
- * Header/footer background classes (with optional blur transparency). Used by:
27
- * DataGridHeader, DataGridFooter.
19
+ * Header/footer background classes (with optional blur transparency).
28
20
  */
29
21
  export declare const getHeaderFooterBackgroundClasses: ({ hasBlur, sticky, }: {
30
22
  hasBlur: boolean;
31
23
  sticky: boolean;
32
24
  }) => string;
33
25
  /**
34
- * Border color classes for rows. Used by: DataGridRow.
26
+ * Border color classes for rows.
35
27
  */
36
28
  export declare const getBorderClasses: ({ mode }: {
37
29
  mode: ThemeMode;
38
30
  }) => string;
39
31
  /**
40
- * Blur effect classes for sticky elements. Used by: DataGridHeader,
41
- * DataGridFooter.
32
+ * Blur effect classes for sticky elements.
42
33
  */
43
34
  export declare const getBlurClasses: ({ blurEffect }: {
44
35
  blurEffect?: BlurEffect;
45
36
  }) => string;
46
- /**
47
- * ============================================================================
48
- * Composite Class Generators (component-specific combinations)
49
- * ============================================================================
50
- */
51
37
  /**
52
38
  * Loading text classes for loading state.
53
39
  */
@@ -95,8 +81,6 @@ export declare const getHeaderClasses: ({ className, stickyHeader, mode, blurEff
95
81
  }) => string;
96
82
  /**
97
83
  * Generates classes for the caption element inside DataGridHeader.
98
- * Needs explicit styling since the parent may use `display: contents`
99
- * when not sticky, which doesn't render a box and breaks CSS inheritance.
100
84
  */
101
85
  export declare const getCaptionClasses: ({ captionClassName, mode, hasBlur, stickyHeader, }: {
102
86
  captionClassName?: string;
@@ -104,9 +88,6 @@ export declare const getCaptionClasses: ({ captionClassName, mode, hasBlur, stic
104
88
  hasBlur: boolean;
105
89
  stickyHeader: boolean;
106
90
  }) => string;
107
- /**
108
- * Generates classes for the DataGridFooter.
109
- */
110
91
  /**
111
92
  * Generates classes for the DataGridFooter.
112
93
  */
@@ -117,9 +98,7 @@ export declare const getFooterClasses: ({ className, stickyFooter, mode, blurEff
117
98
  stickyFooter?: boolean;
118
99
  }) => string;
119
100
  /**
120
- * Generates classes for DataGridRow. When rowIndex is provided (e.g., from
121
- * DataGridInfiniteBody), explicit odd/even classes are used instead of CSS
122
- * :nth-child selectors, which don't work with wrapper elements.
101
+ * Generates classes for DataGridRow.
123
102
  */
124
103
  export declare const getRowClasses: ({ mode, className, cellWrapper, isLastRow, stickyHeader, stickyFooter, }: {
125
104
  mode: ThemeMode;
@@ -142,7 +121,6 @@ export declare const getCellClasses: ({ cellWrapper, className, compact, align,
142
121
  borderRight?: boolean;
143
122
  }) => string;
144
123
  /**
145
- * Returns the appropriate ARIA role for the cell based on the cell wrapper
146
- * type.
124
+ * Returns the appropriate ARIA role for the cell based on the cell wrapper type.
147
125
  */
148
126
  export declare const getCellRole: (cellWrapper?: CellWrapperType) => string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@versini/ui-datagrid",
3
- "version": "0.8.0",
3
+ "version": "0.8.2",
4
4
  "license": "MIT",
5
5
  "author": "Arno Versini",
6
6
  "publishConfig": {
@@ -87,7 +87,7 @@
87
87
  },
88
88
  "devDependencies": {
89
89
  "@testing-library/jest-dom": "6.9.1",
90
- "@versini/ui-button": "11.3.3",
90
+ "@versini/ui-button": "11.3.5",
91
91
  "@versini/ui-types": "8.3.0"
92
92
  },
93
93
  "dependencies": {
@@ -99,5 +99,5 @@
99
99
  "sideEffects": [
100
100
  "**/*.css"
101
101
  ],
102
- "gitHead": "17220b771f97115901ce34188fe98b911b75cfdc"
102
+ "gitHead": "e1f66fb685ddf40b22301f1fe766a2c56ddc4388"
103
103
  }
@@ -1,183 +0,0 @@
1
- /*!
2
- @versini/ui-datagrid v0.8.0
3
- © 2026 gizmette.com
4
- */
5
-
6
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
7
- import { useCallback, useMemo, useState } from "react";
8
- import { BlurEffects } from "../DataGridConstants/DataGridConstants.js";
9
- import { getDataGridClasses } from "../utilities/classes.js";
10
- import { DataGridContext } from "./DataGridContext.js";
11
-
12
- ;// CONCATENATED MODULE: external "react/jsx-runtime"
13
-
14
- ;// CONCATENATED MODULE: external "react"
15
-
16
- ;// CONCATENATED MODULE: external "../DataGridConstants/DataGridConstants.js"
17
-
18
- ;// CONCATENATED MODULE: external "../utilities/classes.js"
19
-
20
- ;// CONCATENATED MODULE: external "./DataGridContext.js"
21
-
22
- ;// CONCATENATED MODULE: ./src/DataGrid/DataGrid.tsx
23
-
24
-
25
-
26
-
27
-
28
- /* =============================================================================
29
- * DataGrid (main component)
30
- * ========================================================================== */ const DataGrid = ({ className, wrapperClassName, children, mode = "system", compact = false, stickyHeader = false, stickyFooter = false, blurEffect = BlurEffects.NONE, maxHeight, loading = false, columns, ...rest })=>{
31
- /**
32
- * Track registered header/footer components via context registration. Uses
33
- * counter-based tracking to properly handle multiple instances. Components
34
- * register themselves when they mount, regardless of nesting depth. This
35
- * replaces the previous displayName-based child inspection approach.
36
- */ const [headerCount, setHeaderCount] = useState(0);
37
- const [footerCount, setFooterCount] = useState(0);
38
- /**
39
- * Track measured heights of header/footer for dynamic padding. Reported by
40
- * DataGridHeader/Footer via ResizeObserver. This replaces the brittle
41
- * hard-coded Tailwind padding classes.
42
- */ const [headerHeight, setHeaderHeight] = useState(0);
43
- const [footerHeight, setFooterHeight] = useState(0);
44
- /**
45
- * Track measured column widths from the body. Used by sticky header/footer to
46
- * sync column widths since absolutely positioned elements can't use CSS
47
- * subgrid.
48
- */ const [measuredColumnWidths, setMeasuredColumnWidths] = useState([]);
49
- /**
50
- * Registration callbacks with stable references. Called by
51
- * DataGridHeader/DataGridFooter on mount/unmount. Uses increment/decrement to
52
- * handle multiple instances correctly.
53
- */ const registerHeader = useCallback(()=>setHeaderCount((c)=>c + 1), []);
54
- const unregisterHeader = useCallback(()=>setHeaderCount((c)=>c - 1), []);
55
- const registerFooter = useCallback(()=>setFooterCount((c)=>c + 1), []);
56
- const unregisterFooter = useCallback(()=>setFooterCount((c)=>c - 1), []);
57
- const hasRegisteredHeader = headerCount > 0;
58
- const hasRegisteredFooter = footerCount > 0;
59
- /**
60
- * Only apply sticky behavior if both the prop is true AND the corresponding
61
- * component exists. This prevents adding padding/styles for non-existent
62
- * headers/footers.
63
- */ const effectiveStickyHeader = stickyHeader && hasRegisteredHeader;
64
- const effectiveStickyFooter = stickyFooter && hasRegisteredFooter;
65
- /**
66
- * State to hold the caption ID registered by DataGridHeader. Used for
67
- * aria-labelledby on the grid element for accessibility.
68
- */ const [captionId, setCaptionId] = useState(undefined);
69
- const handleSetCaptionId = useCallback((id)=>{
70
- setCaptionId(id);
71
- }, []);
72
- const classes = useMemo(()=>getDataGridClasses({
73
- mode,
74
- className,
75
- wrapperClassName,
76
- stickyHeader: effectiveStickyHeader,
77
- stickyFooter: effectiveStickyFooter,
78
- loading: Boolean(loading)
79
- }), [
80
- mode,
81
- className,
82
- wrapperClassName,
83
- effectiveStickyHeader,
84
- effectiveStickyFooter,
85
- loading
86
- ]);
87
- const contextValue = useMemo(()=>({
88
- mode,
89
- compact,
90
- stickyHeader: effectiveStickyHeader,
91
- stickyFooter: effectiveStickyFooter,
92
- blurEffect,
93
- columns,
94
- measuredColumnWidths,
95
- setCaptionId: handleSetCaptionId,
96
- registerHeader,
97
- unregisterHeader,
98
- registerFooter,
99
- unregisterFooter,
100
- setHeaderHeight,
101
- setFooterHeight,
102
- setMeasuredColumnWidths
103
- }), [
104
- mode,
105
- compact,
106
- effectiveStickyHeader,
107
- effectiveStickyFooter,
108
- blurEffect,
109
- columns,
110
- measuredColumnWidths,
111
- handleSetCaptionId,
112
- registerHeader,
113
- unregisterHeader,
114
- registerFooter,
115
- unregisterFooter
116
- ]);
117
- const wrapperStyle = maxHeight ? {
118
- maxHeight: typeof maxHeight === "number" ? `${maxHeight}px` : maxHeight
119
- } : undefined;
120
- /**
121
- * Dynamic padding for scrollable content based on measured header/footer
122
- * heights. This replaces the brittle hard-coded Tailwind padding classes.
123
- */ const scrollableContentStyle = {
124
- ...wrapperStyle,
125
- paddingTop: effectiveStickyHeader ? headerHeight : undefined,
126
- paddingBottom: effectiveStickyFooter ? footerHeight : undefined
127
- };
128
- /**
129
- * When sticky header/footer is enabled, use Panel-like structure: - Outer
130
- * wrapper has overflow-hidden - Scrollable content area in the middle with
131
- * padding - Header/footer are absolutely positioned.
132
- */ const hasSticky = effectiveStickyHeader || effectiveStickyFooter;
133
- /**
134
- * When columns are provided, apply grid-template-columns at the grid level so
135
- * all rows can use subgrid to inherit the same column sizing.
136
- */ const gridStyle = columns ? {
137
- gridTemplateColumns: columns.join(" ")
138
- } : undefined;
139
- const gridContent = /*#__PURE__*/ jsx("div", {
140
- role: "grid",
141
- "aria-labelledby": captionId,
142
- className: classes.grid,
143
- style: gridStyle,
144
- ...rest,
145
- children: children
146
- });
147
- const loadingText = typeof loading === "string" ? loading : loading ? "Loading..." : null;
148
- return /*#__PURE__*/ jsx(DataGridContext.Provider, {
149
- value: contextValue,
150
- children: /*#__PURE__*/ jsxs("div", {
151
- className: classes.inner,
152
- children: [
153
- loading && /*#__PURE__*/ jsxs(Fragment, {
154
- children: [
155
- /*#__PURE__*/ jsx("div", {
156
- className: classes.overlay,
157
- "aria-hidden": "true"
158
- }),
159
- /*#__PURE__*/ jsx("div", {
160
- className: classes.loadingWrapper,
161
- children: /*#__PURE__*/ jsx("span", {
162
- className: classes.loadingText,
163
- role: "status",
164
- children: loadingText
165
- })
166
- })
167
- ]
168
- }),
169
- /*#__PURE__*/ jsx("div", {
170
- className: classes.wrapper,
171
- style: wrapperStyle,
172
- children: hasSticky ? /*#__PURE__*/ jsx("div", {
173
- className: classes.scrollableContent,
174
- style: scrollableContentStyle,
175
- children: gridContent
176
- }) : gridContent
177
- })
178
- ]
179
- })
180
- });
181
- };
182
-
183
- export { DataGrid };
@@ -1,16 +0,0 @@
1
- /*!
2
- @versini/ui-datagrid v0.8.0
3
- © 2026 gizmette.com
4
- */
5
-
6
- import { createContext } from "react";
7
-
8
- ;// CONCATENATED MODULE: external "react"
9
-
10
- ;// CONCATENATED MODULE: ./src/DataGrid/DataGridContext.ts
11
-
12
- const DataGridContext = createContext({
13
- mode: "system"
14
- });
15
-
16
- export { DataGridContext };
@@ -1,9 +0,0 @@
1
- /*!
2
- @versini/ui-datagrid v0.8.0
3
- © 2026 gizmette.com
4
- */
5
-
6
-
7
- ;// CONCATENATED MODULE: ./src/DataGrid/DataGridTypes.ts
8
-
9
-
@@ -1,53 +0,0 @@
1
- /*!
2
- @versini/ui-datagrid v0.8.0
3
- © 2026 gizmette.com
4
- */
5
-
6
- import { jsx } from "react/jsx-runtime";
7
- import { useAnimatedHeight } from "./useAnimatedHeight.js";
8
-
9
- ;// CONCATENATED MODULE: external "react/jsx-runtime"
10
-
11
- ;// CONCATENATED MODULE: external "./useAnimatedHeight.js"
12
-
13
- ;// CONCATENATED MODULE: ./src/DataGridAnimated/AnimatedWrapper.tsx
14
-
15
-
16
- /**
17
- * Wrapper component that animates height changes when content changes.
18
- *
19
- * @example
20
- * ```tsx
21
- * const [visibleCount, setVisibleCount] = useState(0);
22
- *
23
- * return (
24
- * <AnimatedWrapper dependency={visibleCount}>
25
- * <DataGrid maxHeight="400px" stickyHeader>
26
- * <DataGridInfiniteBody
27
- * data={largeData}
28
- * batchSize={25}
29
- * onVisibleCountChange={(count) => setVisibleCount(count)}
30
- * >
31
- * {(row) => (
32
- * <DataGridRow key={row.id}>...</DataGridRow>
33
- * )}
34
- * </DataGridInfiniteBody>
35
- * </DataGrid>
36
- * </AnimatedWrapper>
37
- * );
38
- * ```
39
- *
40
- */ const AnimatedWrapper = ({ children, dependency, duration, enabled = true, className })=>{
41
- const { ref, style } = useAnimatedHeight(dependency, {
42
- duration,
43
- enabled
44
- });
45
- return /*#__PURE__*/ jsx("div", {
46
- ref: ref,
47
- style: style,
48
- className: className,
49
- children: children
50
- });
51
- };
52
-
53
- export { AnimatedWrapper };
@@ -1,131 +0,0 @@
1
- /*!
2
- @versini/ui-datagrid v0.8.0
3
- © 2026 gizmette.com
4
- */
5
-
6
- import { useLayoutEffect, useRef, useState } from "react";
7
-
8
- ;// CONCATENATED MODULE: external "react"
9
-
10
- ;// CONCATENATED MODULE: ./src/DataGridAnimated/useAnimatedHeight.ts
11
-
12
- const DEFAULT_ANIMATION_DURATION = 300;
13
- /**
14
- * Hook that provides smooth height animations when content changes.
15
- *
16
- * Uses FLIP technique: captures height before render via a persistent ref, then
17
- * animates from old height to new height after the DOM updates.
18
- *
19
- * @param dependency - Value that triggers animation when changed.
20
- * @param options - Configuration options.
21
- *
22
- * @example
23
- * ```tsx
24
- * const items = useMemo(() => data.slice(0, visibleCount), [data, visibleCount]);
25
- * const { ref, style } = useAnimatedHeight(items.length);
26
- *
27
- * return (
28
- * <div ref={ref} style={style}>
29
- * {items.map((item) => <Row key={item.id} {...item} />)}
30
- * </div>
31
- * );
32
- * ```
33
- *
34
- */ function useAnimatedHeight(dependency, options) {
35
- const { duration = DEFAULT_ANIMATION_DURATION, enabled = true } = options ?? {};
36
- const ref = useRef(null);
37
- const [animationState, setAnimationState] = useState({
38
- height: "auto",
39
- isAnimating: false
40
- });
41
- /**
42
- * Track the last measured height persistently. This ref is updated AFTER each
43
- * animation completes, so it holds the "before" value when dependency changes.
44
- */ const lastHeightRef = useRef(0);
45
- const prevDependencyRef = useRef(dependency);
46
- const animationFrameRef = useRef(0);
47
- const timeoutRef = useRef(null);
48
- useLayoutEffect(()=>{
49
- if (!ref.current || !enabled) {
50
- return;
51
- }
52
- /**
53
- * On first render or when not animating, just record the current height.
54
- */ if (lastHeightRef.current === 0) {
55
- lastHeightRef.current = ref.current.offsetHeight;
56
- prevDependencyRef.current = dependency;
57
- return;
58
- }
59
- /**
60
- * If dependency hasn't changed, nothing to animate.
61
- */ if (prevDependencyRef.current === dependency) {
62
- return;
63
- }
64
- prevDependencyRef.current = dependency;
65
- const previousHeight = lastHeightRef.current;
66
- const newHeight = ref.current.scrollHeight;
67
- /**
68
- * Update the stored height for next time.
69
- */ lastHeightRef.current = newHeight;
70
- /**
71
- * If heights are the same or previous was 0, no animation needed.
72
- */ if (previousHeight === newHeight || previousHeight === 0) {
73
- return;
74
- }
75
- /**
76
- * Cancel any ongoing animation.
77
- */ if (timeoutRef.current) {
78
- clearTimeout(timeoutRef.current);
79
- }
80
- if (animationFrameRef.current) {
81
- cancelAnimationFrame(animationFrameRef.current);
82
- }
83
- /**
84
- * Lock to the previous height immediately.
85
- */ setAnimationState({
86
- height: previousHeight,
87
- isAnimating: true
88
- });
89
- /**
90
- * Use double RAF to ensure the browser has painted the locked height, then
91
- * transition to the new height.
92
- */ animationFrameRef.current = requestAnimationFrame(()=>{
93
- animationFrameRef.current = requestAnimationFrame(()=>{
94
- setAnimationState({
95
- height: newHeight,
96
- isAnimating: true
97
- });
98
- timeoutRef.current = setTimeout(()=>{
99
- setAnimationState({
100
- height: "auto",
101
- isAnimating: false
102
- });
103
- }, duration);
104
- });
105
- });
106
- return ()=>{
107
- if (timeoutRef.current) {
108
- clearTimeout(timeoutRef.current);
109
- }
110
- if (animationFrameRef.current) {
111
- cancelAnimationFrame(animationFrameRef.current);
112
- }
113
- };
114
- }, [
115
- dependency,
116
- duration,
117
- enabled
118
- ]);
119
- const style = enabled ? {
120
- height: animationState.height === "auto" ? "auto" : `${animationState.height}px`,
121
- overflow: animationState.isAnimating ? "hidden" : undefined,
122
- transition: animationState.isAnimating ? `height ${duration}ms ease-out` : undefined
123
- } : {};
124
- return {
125
- ref,
126
- style,
127
- isAnimating: animationState.isAnimating
128
- };
129
- }
130
-
131
- export { useAnimatedHeight };
@@ -1,55 +0,0 @@
1
- /*!
2
- @versini/ui-datagrid v0.8.0
3
- © 2026 gizmette.com
4
- */
5
-
6
- import { jsx } from "react/jsx-runtime";
7
- import { useContext, useRef } from "react";
8
- import { DataGridContext } from "../DataGrid/DataGridContext.js";
9
- import { CellWrapper } from "../DataGridConstants/index.js";
10
- import { getBodyClass } from "./getBodyClass.js";
11
- import { useColumnMeasurement } from "./useColumnMeasurement.js";
12
-
13
- ;// CONCATENATED MODULE: external "react/jsx-runtime"
14
-
15
- ;// CONCATENATED MODULE: external "react"
16
-
17
- ;// CONCATENATED MODULE: external "../DataGrid/DataGridContext.js"
18
-
19
- ;// CONCATENATED MODULE: external "../DataGridConstants/index.js"
20
-
21
- ;// CONCATENATED MODULE: external "./getBodyClass.js"
22
-
23
- ;// CONCATENATED MODULE: external "./useColumnMeasurement.js"
24
-
25
- ;// CONCATENATED MODULE: ./src/DataGridBody/DataGridBody.tsx
26
-
27
-
28
-
29
-
30
-
31
-
32
- /* =============================================================================
33
- * DataGridBody
34
- * ========================================================================== */ const DataGridBody = ({ className, children, ...rest })=>{
35
- const ctx = useContext(DataGridContext);
36
- const bodyRef = useRef(null);
37
- // Measure column widths for sticky header/footer sync.
38
- useColumnMeasurement(bodyRef, children);
39
- const bodyClass = getBodyClass(className);
40
- return /*#__PURE__*/ jsx(DataGridContext.Provider, {
41
- value: {
42
- ...ctx,
43
- cellWrapper: CellWrapper.BODY
44
- },
45
- children: /*#__PURE__*/ jsx("div", {
46
- ref: bodyRef,
47
- role: "rowgroup",
48
- className: bodyClass,
49
- ...rest,
50
- children: children
51
- })
52
- });
53
- };
54
-
55
- export { DataGridBody };
@@ -1,23 +0,0 @@
1
- /*!
2
- @versini/ui-datagrid v0.8.0
3
- © 2026 gizmette.com
4
- */
5
-
6
- import clsx from "clsx";
7
-
8
- ;// CONCATENATED MODULE: external "clsx"
9
-
10
- ;// CONCATENATED MODULE: ./src/DataGridBody/getBodyClass.ts
11
-
12
- /**
13
- * Get the CSS class for a DataGrid body element. Uses display:contents so the
14
- * body doesn't interfere with the grid flow. Rows will use subgrid when columns
15
- * are provided, or define their own grid otherwise.
16
- *
17
- * @param className - Additional class name to merge
18
- *
19
- */ function getBodyClass(className) {
20
- return clsx("contents", className);
21
- }
22
-
23
- export { getBodyClass };
@@ -1,51 +0,0 @@
1
- /*!
2
- @versini/ui-datagrid v0.8.0
3
- © 2026 gizmette.com
4
- */
5
-
6
- import { jsx } from "react/jsx-runtime";
7
- import { DataGridContext } from "../DataGrid/DataGridContext.js";
8
- import { getCellClasses, getCellRole } from "../utilities/classes.js";
9
-
10
- ;// CONCATENATED MODULE: external "react/jsx-runtime"
11
-
12
- ;// CONCATENATED MODULE: external "../DataGrid/DataGridContext.js"
13
-
14
- ;// CONCATENATED MODULE: external "../utilities/classes.js"
15
-
16
- ;// CONCATENATED MODULE: ./src/DataGridCell/DataGridCell.tsx
17
-
18
-
19
-
20
- /* =============================================================================
21
- * DataGridCell
22
- * ========================================================================== */ const DataGridCell = ({ className, children, align, borderLeft, borderRight, colSpan, style, ...rest })=>{
23
- return /*#__PURE__*/ jsx(DataGridContext.Consumer, {
24
- children: ({ mode, compact, cellWrapper })=>{
25
- const mainClasses = getCellClasses({
26
- cellWrapper,
27
- className,
28
- mode,
29
- compact,
30
- align,
31
- borderLeft,
32
- borderRight
33
- });
34
- const role = getCellRole(cellWrapper);
35
- // Apply grid-column span for colSpan > 1.
36
- const cellStyle = colSpan && colSpan > 1 ? {
37
- ...style,
38
- gridColumn: `span ${colSpan}`
39
- } : style;
40
- return /*#__PURE__*/ jsx("div", {
41
- role: role,
42
- className: mainClasses,
43
- style: cellStyle,
44
- ...rest,
45
- children: children
46
- });
47
- }
48
- });
49
- };
50
-
51
- export { DataGridCell };