@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,67 +0,0 @@
1
- /*!
2
- @versini/ui-datagrid v0.8.0
3
- © 2026 gizmette.com
4
- */
5
-
6
- import { jsx, jsxs } from "react/jsx-runtime";
7
- import clsx from "clsx";
8
- import { BlurEffects } from "../DataGridConstants/index.js";
9
- import { getTextColorClassesForHeaderFooter } from "../utilities/classes.js";
10
-
11
- ;// CONCATENATED MODULE: external "react/jsx-runtime"
12
-
13
- ;// CONCATENATED MODULE: external "clsx"
14
-
15
- ;// CONCATENATED MODULE: external "../DataGridConstants/index.js"
16
-
17
- ;// CONCATENATED MODULE: external "../utilities/classes.js"
18
-
19
- ;// CONCATENATED MODULE: ./src/DataGridCellSort/ButtonSort.tsx
20
-
21
-
22
-
23
-
24
- const getActiveIndicatorClasses = (active)=>{
25
- if (!active) {
26
- return "";
27
- }
28
- return clsx("relative", "focus-within:static", "focus-within:after:border-transparent", "after:absolute", "after:content-['']", "after:border-b-2", "after:-bottom-1", "after:left-0", "after:right-0", // the small border at the bottom of the button when it is active (sorted)
29
- "after:border-table-light");
30
- };
31
- const ButtonSort = ({ active = false, className, onClick, labelRight, children, blurEffect, mode })=>{
32
- const hasBlur = Boolean(blurEffect && blurEffect !== BlurEffects.NONE);
33
- const buttonClasses = clsx(// Base styles
34
- "flex items-center", // Size - small
35
- "h-6 px-1 sm:px-2", // Font
36
- "text-sm font-bold", // Radius - small
37
- "rounded-xs", // Text color
38
- getTextColorClassesForHeaderFooter({
39
- mode,
40
- hasBlur
41
- }), // Focus styles
42
- "focus:outline", "focus:outline-2", "focus:outline-offset-2", "focus:outline-focus-medium", // Hover styles
43
- "hover:text-copy-light-hover", "hover:bg-action-darker-hover", // Active styles
44
- "active:text-copy-medium-active", "active:bg-action-dark-active", // Custom className
45
- className);
46
- const wrapperClasses = getActiveIndicatorClasses(active);
47
- return /*#__PURE__*/ jsx("div", {
48
- className: wrapperClasses,
49
- children: /*#__PURE__*/ jsxs("button", {
50
- className: buttonClasses,
51
- type: "button",
52
- onClick: onClick,
53
- children: [
54
- /*#__PURE__*/ jsx("span", {
55
- className: "text-copy-light",
56
- children: children
57
- }),
58
- labelRight && /*#__PURE__*/ jsx("span", {
59
- className: "pl-2",
60
- children: labelRight
61
- })
62
- ]
63
- })
64
- });
65
- };
66
-
67
- export { ButtonSort };
@@ -1,111 +0,0 @@
1
- /*!
2
- @versini/ui-datagrid v0.8.0
3
- © 2026 gizmette.com
4
- */
5
-
6
- import { jsx, jsxs } from "react/jsx-runtime";
7
- import { IconSort, IconSortDown, IconSortUp } from "@versini/ui-icons";
8
- import clsx from "clsx";
9
- import { DataGridContext } from "../DataGrid/DataGridContext.js";
10
- import { getCellClasses } from "../utilities/classes.js";
11
- import { ButtonSort } from "./ButtonSort.js";
12
-
13
- ;// CONCATENATED MODULE: external "react/jsx-runtime"
14
-
15
- ;// CONCATENATED MODULE: external "@versini/ui-icons"
16
-
17
- ;// CONCATENATED MODULE: external "clsx"
18
-
19
- ;// CONCATENATED MODULE: external "../DataGrid/DataGridContext.js"
20
-
21
- ;// CONCATENATED MODULE: external "../utilities/classes.js"
22
-
23
- ;// CONCATENATED MODULE: external "./ButtonSort.js"
24
-
25
- ;// CONCATENATED MODULE: ./src/DataGridCellSort/DataGridCellSort.tsx
26
-
27
-
28
-
29
-
30
-
31
-
32
- /* =============================================================================
33
- * DataGridCellSort
34
- * ========================================================================== */ const DataGridCellSort = ({ className, children, cellId, onSort, sortDirection, sortedCell, slotLeft, slotRight, buttonClassName, align, ...rest })=>{
35
- const isSorted = sortedCell === cellId;
36
- const handleSort = ()=>{
37
- if (onSort) {
38
- // Convert false to undefined for the callback.
39
- const currentDirection = isSorted && sortDirection ? sortDirection : undefined;
40
- onSort(cellId, currentDirection);
41
- }
42
- };
43
- const getSortIcon = ()=>{
44
- if (isSorted && sortDirection === "asc") {
45
- return /*#__PURE__*/ jsx(IconSortUp, {
46
- size: "size-4",
47
- monotone: true
48
- });
49
- }
50
- if (isSorted && sortDirection === "desc") {
51
- return /*#__PURE__*/ jsx(IconSortDown, {
52
- size: "size-4",
53
- monotone: true
54
- });
55
- }
56
- return /*#__PURE__*/ jsx(IconSort, {
57
- size: "size-4",
58
- monotone: true
59
- });
60
- };
61
- const getAriaSort = ()=>{
62
- if (isSorted && sortDirection === "asc") {
63
- return "ascending";
64
- }
65
- if (isSorted && sortDirection === "desc") {
66
- return "descending";
67
- }
68
- return "other";
69
- };
70
- return /*#__PURE__*/ jsx(DataGridContext.Consumer, {
71
- children: ({ mode, compact, cellWrapper, blurEffect })=>{
72
- const mainClasses = getCellClasses({
73
- cellWrapper,
74
- className,
75
- mode,
76
- compact,
77
- align
78
- });
79
- // Flex container for alignment of button within the cell.
80
- const contentClasses = clsx("flex", {
81
- "justify-start": align === "left" || !align,
82
- "justify-center": align === "center",
83
- "justify-end": align === "right"
84
- });
85
- return /*#__PURE__*/ jsx("div", {
86
- className: mainClasses,
87
- role: "columnheader",
88
- "aria-sort": getAriaSort(),
89
- ...rest,
90
- children: /*#__PURE__*/ jsxs("div", {
91
- className: contentClasses,
92
- children: [
93
- slotLeft,
94
- /*#__PURE__*/ jsx(ButtonSort, {
95
- mode: mode,
96
- blurEffect: blurEffect,
97
- active: isSorted,
98
- className: buttonClassName,
99
- onClick: handleSort,
100
- labelRight: children,
101
- children: getSortIcon()
102
- }),
103
- slotRight
104
- ]
105
- })
106
- });
107
- }
108
- });
109
- };
110
-
111
- export { DataGridCellSort };
@@ -1,98 +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 { useEffect, useLayoutEffect, useRef } from "react";
8
- import { DataGridContext } from "../DataGrid/DataGridContext.js";
9
- import { CellWrapper } from "../DataGridConstants/DataGridConstants.js";
10
- import { getFooterClasses } from "../utilities/classes.js";
11
-
12
- ;// CONCATENATED MODULE: external "react/jsx-runtime"
13
-
14
- ;// CONCATENATED MODULE: external "react"
15
-
16
- ;// CONCATENATED MODULE: external "../DataGrid/DataGridContext.js"
17
-
18
- ;// CONCATENATED MODULE: external "../DataGridConstants/DataGridConstants.js"
19
-
20
- ;// CONCATENATED MODULE: external "../utilities/classes.js"
21
-
22
- ;// CONCATENATED MODULE: ./src/DataGridFooter/DataGridFooter.tsx
23
-
24
-
25
-
26
-
27
-
28
- /* =============================================================================
29
- * DataGridFooter
30
- * ========================================================================== */ const DataGridFooter = ({ className, children, ...rest })=>{
31
- return /*#__PURE__*/ jsx(DataGridContext.Consumer, {
32
- children: (ctx)=>/*#__PURE__*/ jsx(DataGridFooterInner, {
33
- className: className,
34
- ctx: ctx,
35
- ...rest,
36
- children: children
37
- })
38
- });
39
- };
40
- DataGridFooter.displayName = "DataGridFooter";
41
- /**
42
- * Inner component to handle the useEffect for registering footer. Separated to
43
- * avoid hooks inside Consumer render prop.
44
- */ const DataGridFooterInner = ({ className, ctx, children, ...rest })=>{
45
- const footerRef = useRef(null);
46
- /**
47
- * Register this footer with the parent DataGrid on mount. This enables sticky
48
- * footer behavior regardless of nesting depth.
49
- */ useEffect(()=>{
50
- ctx.registerFooter?.();
51
- return ()=>{
52
- ctx.unregisterFooter?.();
53
- };
54
- }, [
55
- ctx.registerFooter,
56
- ctx.unregisterFooter
57
- ]);
58
- /**
59
- * Measure and report footer height for dynamic padding calculation. Uses
60
- * ResizeObserver to handle dynamic content changes.
61
- */ useLayoutEffect(()=>{
62
- const element = footerRef.current;
63
- if (!element || !ctx.stickyFooter || !ctx.setFooterHeight) {
64
- return;
65
- }
66
- const observer = new ResizeObserver((entries)=>{
67
- const height = entries[0]?.borderBoxSize?.[0]?.blockSize;
68
- if (height !== undefined) {
69
- ctx.setFooterHeight?.(height);
70
- }
71
- });
72
- observer.observe(element);
73
- return ()=>observer.disconnect();
74
- }, [
75
- ctx.stickyFooter,
76
- ctx.setFooterHeight
77
- ]);
78
- return /*#__PURE__*/ jsx(DataGridContext.Provider, {
79
- value: {
80
- ...ctx,
81
- cellWrapper: CellWrapper.FOOTER
82
- },
83
- children: /*#__PURE__*/ jsx("div", {
84
- ref: footerRef,
85
- role: "rowgroup",
86
- className: getFooterClasses({
87
- className,
88
- stickyFooter: ctx.stickyFooter,
89
- mode: ctx.mode,
90
- blurEffect: ctx.blurEffect
91
- }),
92
- ...rest,
93
- children: children
94
- })
95
- });
96
- };
97
-
98
- export { DataGridFooter };
@@ -1,129 +0,0 @@
1
- /*!
2
- @versini/ui-datagrid v0.8.0
3
- © 2026 gizmette.com
4
- */
5
-
6
- import { jsx, jsxs } from "react/jsx-runtime";
7
- import { useEffect, useId, useLayoutEffect, useRef } from "react";
8
- import { DataGridContext } from "../DataGrid/DataGridContext.js";
9
- import { CellWrapper } from "../DataGridConstants/DataGridConstants.js";
10
- import { getCaptionClasses, getHeaderClasses } from "../utilities/classes.js";
11
-
12
- ;// CONCATENATED MODULE: external "react/jsx-runtime"
13
-
14
- ;// CONCATENATED MODULE: external "react"
15
-
16
- ;// CONCATENATED MODULE: external "../DataGrid/DataGridContext.js"
17
-
18
- ;// CONCATENATED MODULE: external "../DataGridConstants/DataGridConstants.js"
19
-
20
- ;// CONCATENATED MODULE: external "../utilities/classes.js"
21
-
22
- ;// CONCATENATED MODULE: ./src/DataGridHeader/DataGridHeader.tsx
23
-
24
-
25
-
26
-
27
-
28
- /* =============================================================================
29
- * DataGridHeader
30
- * ========================================================================== */ const DataGridHeader = ({ caption, captionClassName, className, children, ...rest })=>{
31
- const captionId = useId();
32
- return /*#__PURE__*/ jsx(DataGridContext.Consumer, {
33
- children: (ctx)=>/*#__PURE__*/ jsx(DataGridHeaderInner, {
34
- caption: caption,
35
- captionClassName: captionClassName,
36
- captionId: captionId,
37
- className: className,
38
- ctx: ctx,
39
- ...rest,
40
- children: children
41
- })
42
- });
43
- };
44
- DataGridHeader.displayName = "DataGridHeader";
45
- /**
46
- * Inner component to handle the useEffect for registering captionId and header.
47
- * Separated to avoid hooks inside Consumer render prop.
48
- */ const DataGridHeaderInner = ({ caption, captionClassName, captionId, className, ctx, children, ...rest })=>{
49
- const headerRef = useRef(null);
50
- /**
51
- * Register this header with the parent DataGrid on mount. This enables sticky
52
- * header behavior regardless of nesting depth.
53
- */ useEffect(()=>{
54
- ctx.registerHeader?.();
55
- return ()=>{
56
- ctx.unregisterHeader?.();
57
- };
58
- }, [
59
- ctx.registerHeader,
60
- ctx.unregisterHeader
61
- ]);
62
- // Register the caption ID with the parent DataGrid for aria-labelledby.
63
- useEffect(()=>{
64
- if (caption && ctx.setCaptionId) {
65
- ctx.setCaptionId(captionId);
66
- }
67
- return ()=>{
68
- if (ctx.setCaptionId) {
69
- ctx.setCaptionId(undefined);
70
- }
71
- };
72
- }, [
73
- caption,
74
- captionId,
75
- ctx.setCaptionId
76
- ]);
77
- /**
78
- * Measure and report header height for dynamic padding calculation. Uses
79
- * ResizeObserver to handle dynamic content changes (text wrapping, etc.).
80
- */ useLayoutEffect(()=>{
81
- const element = headerRef.current;
82
- if (!element || !ctx.stickyHeader || !ctx.setHeaderHeight) {
83
- return;
84
- }
85
- const observer = new ResizeObserver((entries)=>{
86
- const height = entries[0]?.borderBoxSize?.[0]?.blockSize;
87
- if (height !== undefined) {
88
- ctx.setHeaderHeight?.(height);
89
- }
90
- });
91
- observer.observe(element);
92
- return ()=>observer.disconnect();
93
- }, [
94
- ctx.stickyHeader,
95
- ctx.setHeaderHeight
96
- ]);
97
- return /*#__PURE__*/ jsx(DataGridContext.Provider, {
98
- value: {
99
- ...ctx,
100
- cellWrapper: CellWrapper.HEADER
101
- },
102
- children: /*#__PURE__*/ jsxs("div", {
103
- ref: headerRef,
104
- role: "rowgroup",
105
- className: getHeaderClasses({
106
- className,
107
- stickyHeader: ctx.stickyHeader,
108
- mode: ctx.mode,
109
- blurEffect: ctx.blurEffect
110
- }),
111
- ...rest,
112
- children: [
113
- caption && /*#__PURE__*/ jsx("div", {
114
- id: captionId,
115
- className: getCaptionClasses({
116
- captionClassName,
117
- mode: ctx.mode,
118
- hasBlur: Boolean(ctx.blurEffect && ctx.blurEffect !== "none"),
119
- stickyHeader: Boolean(ctx.stickyHeader)
120
- }),
121
- children: caption
122
- }),
123
- children
124
- ]
125
- })
126
- });
127
- };
128
-
129
- export { DataGridHeader };