@rttui/skin-anocca 0.0.0 → 1.0.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/CHANGELOG.md ADDED
@@ -0,0 +1,15 @@
1
+ # @rttui/skin-anocca
2
+
3
+ ## 1.0.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Fix dependencies
8
+ - Updated dependencies
9
+ - @rttui/core@1.0.1
10
+
11
+ ## 1.0.0
12
+
13
+ ### Major Changes
14
+
15
+ - First release
@@ -0,0 +1,3 @@
1
+ import { Skin } from "@rttui/core";
2
+ declare const AnoccaSkin: Skin;
3
+ export { AnoccaSkin };
@@ -0,0 +1,207 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.AnoccaSkin = void 0;
7
+ const jsx_runtime_1 = require("react/jsx-runtime");
8
+ const material_1 = require("@mui/material");
9
+ const core_1 = require("@rttui/core");
10
+ const react_1 = __importDefault(require("react"));
11
+ const react_table_1 = require("@tanstack/react-table");
12
+ const AnoccaSkin = {
13
+ rowHeight: 32,
14
+ headerRowHeight: 32,
15
+ footerRowHeight: 32,
16
+ OuterContainer: ({ children }) => {
17
+ const { width, height, tableContainerRef } = (0, core_1.useTableContext)();
18
+ const cssVars = (0, core_1.useTableCssVars)();
19
+ return ((0, jsx_runtime_1.jsx)(material_1.Paper, { ref: tableContainerRef, className: "outer-container", elevation: 2, sx: {
20
+ overflow: "auto",
21
+ width: width + "px",
22
+ height: height + "px",
23
+ position: "relative",
24
+ contain: "paint",
25
+ willChange: "transform",
26
+ borderRadius: 1,
27
+ ...cssVars,
28
+ }, children: children }));
29
+ },
30
+ TableScroller: () => {
31
+ return ((0, jsx_runtime_1.jsx)("div", { className: "table-scroller", style: {
32
+ width: "var(--table-width)",
33
+ height: "calc(var(--table-height) + var(--header-height) + var(--footer-height))",
34
+ position: "absolute",
35
+ } }));
36
+ },
37
+ TableHeader: ({ children }) => {
38
+ return ((0, jsx_runtime_1.jsx)(material_1.TableHead, { component: "div", className: "thead", sx: {
39
+ position: "sticky",
40
+ top: 0,
41
+ width: "var(--table-width)",
42
+ zIndex: 2,
43
+ backgroundColor: (theme) => theme.palette.background.paper,
44
+ boxShadow: (theme) => `0 1px 0 ${theme.palette.divider}`,
45
+ }, children: children }));
46
+ },
47
+ TableFooter: ({ children }) => {
48
+ return ((0, jsx_runtime_1.jsx)(material_1.TableFooter, { component: "div", className: "table-footer", sx: {
49
+ position: "sticky",
50
+ bottom: -1,
51
+ width: "var(--table-width)",
52
+ zIndex: 2,
53
+ backgroundColor: (theme) => theme.palette.background.paper,
54
+ boxShadow: (theme) => `0 -1px 0 ${theme.palette.divider}`,
55
+ }, children: children }));
56
+ },
57
+ HeaderRow: TableHeaderRow,
58
+ HeaderCell: (props) => {
59
+ return (0, jsx_runtime_1.jsx)(TableHeaderCell, { ...props });
60
+ },
61
+ TableBody: ({ children }) => {
62
+ return ((0, jsx_runtime_1.jsx)(material_1.TableBody, { component: "div", className: "table-body", sx: { position: "relative", width: "var(--table-width)" }, children: children }));
63
+ },
64
+ PinnedRows: ({ children, position, pinned }) => {
65
+ if (pinned.length === 0) {
66
+ return null;
67
+ }
68
+ const style = {
69
+ position: "sticky",
70
+ zIndex: 3,
71
+ };
72
+ if (position === "top") {
73
+ style.top = "var(--header-height)";
74
+ style.borderBottom = (theme) => `1px solid ${theme.palette.divider}`;
75
+ style.boxShadow =
76
+ "0 4px 8px -4px rgba(0, 0, 0, 0.15), 0 6px 12px -6px rgba(0, 0, 0, 0.1)";
77
+ }
78
+ else if (position === "bottom") {
79
+ style.bottom = "var(--footer-height)";
80
+ style.borderTop = (theme) => `1px solid ${theme.palette.divider}`;
81
+ style.boxShadow =
82
+ "0 -4px 8px -4px rgba(0, 0, 0, 0.15), 0 -6px 12px -6px rgba(0, 0, 0, 0.1)";
83
+ }
84
+ const Component = position === "top" ? material_1.TableHead : material_1.TableFooter;
85
+ return ((0, jsx_runtime_1.jsx)(Component, { component: "div", className: `sticky-${position}-rows`, sx: style, children: children }));
86
+ },
87
+ PinnedCols: ({ children, position, pinned }) => {
88
+ if (pinned.length === 0) {
89
+ return null;
90
+ }
91
+ const style = {
92
+ position: "sticky",
93
+ zIndex: 3,
94
+ display: "flex",
95
+ };
96
+ if (position === "left") {
97
+ style.left = 0;
98
+ style.boxShadow =
99
+ "4px 0 8px -4px rgba(0, 0, 0, 0.15), 6px 0 12px -6px rgba(0, 0, 0, 0.1)";
100
+ }
101
+ else if (position === "right") {
102
+ style.right = 0;
103
+ style.borderLeft = (theme) => `1px solid ${theme.palette.divider}`;
104
+ style.boxShadow =
105
+ "-4px 0 8px -4px rgba(0, 0, 0, 0.15), -6px 0 12px -6px rgba(0, 0, 0, 0.1)";
106
+ }
107
+ return ((0, jsx_runtime_1.jsx)(material_1.Box, { component: "div", className: `sticky-${position}-cols`, sx: style, children: children }));
108
+ },
109
+ TableRowWrapper: react_1.default.forwardRef(({ children, flatIndex, dndStyle }, ref) => {
110
+ const theme = (0, material_1.useTheme)();
111
+ const backgroundColor = (theme) => {
112
+ const baseColor = flatIndex % 2 === 0
113
+ ? theme.palette.background.paper
114
+ : theme.palette.mode === "dark"
115
+ ? theme.palette.grey[900]
116
+ : theme.palette.grey[100];
117
+ return baseColor;
118
+ };
119
+ const vars = {
120
+ "--row-background-color": backgroundColor(theme),
121
+ };
122
+ return ((0, jsx_runtime_1.jsx)(material_1.Box, { sx: {
123
+ ...dndStyle,
124
+ ...vars,
125
+ }, "data-index": flatIndex, ref: ref, children: children }));
126
+ }),
127
+ TableRow: ({ children }) => {
128
+ return ((0, jsx_runtime_1.jsx)(material_1.TableRow, { component: "div", className: "table-row", sx: {
129
+ position: "relative",
130
+ width: "var(--table-width)",
131
+ display: "flex",
132
+ height: "var(--row-height)",
133
+ zIndex: 1,
134
+ boxSizing: "border-box",
135
+ backgroundColor: "var(--row-background-color)",
136
+ }, children: children }));
137
+ },
138
+ TableRowExpandedContent: ({ children }) => {
139
+ const { table } = (0, core_1.useTableContext)();
140
+ return ((0, jsx_runtime_1.jsx)(material_1.TableRow, { component: "div", className: "expanded-row", sx: {
141
+ backgroundColor: (theme) => theme.palette.background.default,
142
+ }, children: (0, jsx_runtime_1.jsx)(material_1.TableCell, { component: "div", className: "expanded-cell", colSpan: table.getAllLeafColumns().length, sx: {
143
+ padding: 2,
144
+ }, children: children }) }));
145
+ },
146
+ Cell: ({ children, header }) => {
147
+ const { isPinned } = header;
148
+ return ((0, jsx_runtime_1.jsx)(material_1.TableCell, { className: "td", component: "div", sx: {
149
+ height: "var(--row-height)",
150
+ width: header.width,
151
+ overflow: "hidden",
152
+ textOverflow: "ellipsis",
153
+ whiteSpace: "nowrap",
154
+ zIndex: isPinned ? 5 : 0,
155
+ boxSizing: "border-box",
156
+ alignItems: "center",
157
+ gap: "8px",
158
+ display: "flex",
159
+ justifyContent: "flex-start",
160
+ alignContent: "center",
161
+ padding: "6px 12px",
162
+ backgroundColor: "var(--row-background-color)",
163
+ borderBottom: "none",
164
+ flexShrink: 0,
165
+ position: "relative",
166
+ borderRight: (theme) => `1px solid ${theme.palette.divider}`,
167
+ ".table-row:hover &": {
168
+ backgroundColor: (theme) => {
169
+ // Always use solid background colors for all cells on hover
170
+ return theme.palette.mode === "dark"
171
+ ? "#1e1e52" // Dark blue solid color
172
+ : "#E3F2FD"; // Light blue solid color
173
+ },
174
+ zIndex: isPinned ? 2 : 0,
175
+ },
176
+ }, children: children }));
177
+ },
178
+ };
179
+ exports.AnoccaSkin = AnoccaSkin;
180
+ function TableHeaderCell({ headerId, isPinned, width, header, type, }) {
181
+ return ((0, jsx_runtime_1.jsx)(material_1.TableCell, { component: "div", className: "th", "data-header-id": headerId, "data-is-pinned": isPinned, sx: {
182
+ transition: "background-color 0.2s ease",
183
+ whiteSpace: "nowrap",
184
+ zIndex: isPinned ? 1 : 0,
185
+ display: "flex",
186
+ overflow: "hidden",
187
+ height: "var(--header-row-height)",
188
+ width,
189
+ position: "relative",
190
+ flexShrink: 0,
191
+ alignItems: "center",
192
+ gap: "8px",
193
+ justifyContent: "space-between",
194
+ padding: "6px 12px",
195
+ boxSizing: "border-box",
196
+ fontWeight: 600,
197
+ backgroundColor: isPinned
198
+ ? (theme) => theme.palette.background.paper
199
+ : "transparent",
200
+ borderRight: (theme) => `1px solid ${theme.palette.divider}`,
201
+ }, children: (0, jsx_runtime_1.jsx)("div", { style: { flex: 1, display: "flex", justifyContent: "flex-start" }, children: header && !header.isPlaceholder
202
+ ? (0, react_table_1.flexRender)(header.column.columnDef[type], header.getContext())
203
+ : null }) }));
204
+ }
205
+ function TableHeaderRow({ children }) {
206
+ return ((0, jsx_runtime_1.jsx)(material_1.TableRow, { component: "div", sx: { height: "var(--row-height)", display: "flex" }, children: children }));
207
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "name": "@rttui/skin-anocca",
3
+ "version": "1.0.1",
4
+ "type": "commonjs"
5
+ }
@@ -0,0 +1,3 @@
1
+ import { Skin } from "@rttui/core";
2
+ declare const AnoccaSkin: Skin;
3
+ export { AnoccaSkin };
@@ -0,0 +1,201 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { Box, Paper, TableBody, TableCell, TableFooter, TableHead, TableRow, useTheme, } from "@mui/material";
3
+ import { useTableContext, useTableCssVars, } from "@rttui/core";
4
+ import React from "react";
5
+ import { flexRender } from "@tanstack/react-table";
6
+ const AnoccaSkin = {
7
+ rowHeight: 32,
8
+ headerRowHeight: 32,
9
+ footerRowHeight: 32,
10
+ OuterContainer: ({ children }) => {
11
+ const { width, height, tableContainerRef } = useTableContext();
12
+ const cssVars = useTableCssVars();
13
+ return (_jsx(Paper, { ref: tableContainerRef, className: "outer-container", elevation: 2, sx: {
14
+ overflow: "auto",
15
+ width: width + "px",
16
+ height: height + "px",
17
+ position: "relative",
18
+ contain: "paint",
19
+ willChange: "transform",
20
+ borderRadius: 1,
21
+ ...cssVars,
22
+ }, children: children }));
23
+ },
24
+ TableScroller: () => {
25
+ return (_jsx("div", { className: "table-scroller", style: {
26
+ width: "var(--table-width)",
27
+ height: "calc(var(--table-height) + var(--header-height) + var(--footer-height))",
28
+ position: "absolute",
29
+ } }));
30
+ },
31
+ TableHeader: ({ children }) => {
32
+ return (_jsx(TableHead, { component: "div", className: "thead", sx: {
33
+ position: "sticky",
34
+ top: 0,
35
+ width: "var(--table-width)",
36
+ zIndex: 2,
37
+ backgroundColor: (theme) => theme.palette.background.paper,
38
+ boxShadow: (theme) => `0 1px 0 ${theme.palette.divider}`,
39
+ }, children: children }));
40
+ },
41
+ TableFooter: ({ children }) => {
42
+ return (_jsx(TableFooter, { component: "div", className: "table-footer", sx: {
43
+ position: "sticky",
44
+ bottom: -1,
45
+ width: "var(--table-width)",
46
+ zIndex: 2,
47
+ backgroundColor: (theme) => theme.palette.background.paper,
48
+ boxShadow: (theme) => `0 -1px 0 ${theme.palette.divider}`,
49
+ }, children: children }));
50
+ },
51
+ HeaderRow: TableHeaderRow,
52
+ HeaderCell: (props) => {
53
+ return _jsx(TableHeaderCell, { ...props });
54
+ },
55
+ TableBody: ({ children }) => {
56
+ return (_jsx(TableBody, { component: "div", className: "table-body", sx: { position: "relative", width: "var(--table-width)" }, children: children }));
57
+ },
58
+ PinnedRows: ({ children, position, pinned }) => {
59
+ if (pinned.length === 0) {
60
+ return null;
61
+ }
62
+ const style = {
63
+ position: "sticky",
64
+ zIndex: 3,
65
+ };
66
+ if (position === "top") {
67
+ style.top = "var(--header-height)";
68
+ style.borderBottom = (theme) => `1px solid ${theme.palette.divider}`;
69
+ style.boxShadow =
70
+ "0 4px 8px -4px rgba(0, 0, 0, 0.15), 0 6px 12px -6px rgba(0, 0, 0, 0.1)";
71
+ }
72
+ else if (position === "bottom") {
73
+ style.bottom = "var(--footer-height)";
74
+ style.borderTop = (theme) => `1px solid ${theme.palette.divider}`;
75
+ style.boxShadow =
76
+ "0 -4px 8px -4px rgba(0, 0, 0, 0.15), 0 -6px 12px -6px rgba(0, 0, 0, 0.1)";
77
+ }
78
+ const Component = position === "top" ? TableHead : TableFooter;
79
+ return (_jsx(Component, { component: "div", className: `sticky-${position}-rows`, sx: style, children: children }));
80
+ },
81
+ PinnedCols: ({ children, position, pinned }) => {
82
+ if (pinned.length === 0) {
83
+ return null;
84
+ }
85
+ const style = {
86
+ position: "sticky",
87
+ zIndex: 3,
88
+ display: "flex",
89
+ };
90
+ if (position === "left") {
91
+ style.left = 0;
92
+ style.boxShadow =
93
+ "4px 0 8px -4px rgba(0, 0, 0, 0.15), 6px 0 12px -6px rgba(0, 0, 0, 0.1)";
94
+ }
95
+ else if (position === "right") {
96
+ style.right = 0;
97
+ style.borderLeft = (theme) => `1px solid ${theme.palette.divider}`;
98
+ style.boxShadow =
99
+ "-4px 0 8px -4px rgba(0, 0, 0, 0.15), -6px 0 12px -6px rgba(0, 0, 0, 0.1)";
100
+ }
101
+ return (_jsx(Box, { component: "div", className: `sticky-${position}-cols`, sx: style, children: children }));
102
+ },
103
+ TableRowWrapper: React.forwardRef(({ children, flatIndex, dndStyle }, ref) => {
104
+ const theme = useTheme();
105
+ const backgroundColor = (theme) => {
106
+ const baseColor = flatIndex % 2 === 0
107
+ ? theme.palette.background.paper
108
+ : theme.palette.mode === "dark"
109
+ ? theme.palette.grey[900]
110
+ : theme.palette.grey[100];
111
+ return baseColor;
112
+ };
113
+ const vars = {
114
+ "--row-background-color": backgroundColor(theme),
115
+ };
116
+ return (_jsx(Box, { sx: {
117
+ ...dndStyle,
118
+ ...vars,
119
+ }, "data-index": flatIndex, ref: ref, children: children }));
120
+ }),
121
+ TableRow: ({ children }) => {
122
+ return (_jsx(TableRow, { component: "div", className: "table-row", sx: {
123
+ position: "relative",
124
+ width: "var(--table-width)",
125
+ display: "flex",
126
+ height: "var(--row-height)",
127
+ zIndex: 1,
128
+ boxSizing: "border-box",
129
+ backgroundColor: "var(--row-background-color)",
130
+ }, children: children }));
131
+ },
132
+ TableRowExpandedContent: ({ children }) => {
133
+ const { table } = useTableContext();
134
+ return (_jsx(TableRow, { component: "div", className: "expanded-row", sx: {
135
+ backgroundColor: (theme) => theme.palette.background.default,
136
+ }, children: _jsx(TableCell, { component: "div", className: "expanded-cell", colSpan: table.getAllLeafColumns().length, sx: {
137
+ padding: 2,
138
+ }, children: children }) }));
139
+ },
140
+ Cell: ({ children, header }) => {
141
+ const { isPinned } = header;
142
+ return (_jsx(TableCell, { className: "td", component: "div", sx: {
143
+ height: "var(--row-height)",
144
+ width: header.width,
145
+ overflow: "hidden",
146
+ textOverflow: "ellipsis",
147
+ whiteSpace: "nowrap",
148
+ zIndex: isPinned ? 5 : 0,
149
+ boxSizing: "border-box",
150
+ alignItems: "center",
151
+ gap: "8px",
152
+ display: "flex",
153
+ justifyContent: "flex-start",
154
+ alignContent: "center",
155
+ padding: "6px 12px",
156
+ backgroundColor: "var(--row-background-color)",
157
+ borderBottom: "none",
158
+ flexShrink: 0,
159
+ position: "relative",
160
+ borderRight: (theme) => `1px solid ${theme.palette.divider}`,
161
+ ".table-row:hover &": {
162
+ backgroundColor: (theme) => {
163
+ // Always use solid background colors for all cells on hover
164
+ return theme.palette.mode === "dark"
165
+ ? "#1e1e52" // Dark blue solid color
166
+ : "#E3F2FD"; // Light blue solid color
167
+ },
168
+ zIndex: isPinned ? 2 : 0,
169
+ },
170
+ }, children: children }));
171
+ },
172
+ };
173
+ function TableHeaderCell({ headerId, isPinned, width, header, type, }) {
174
+ return (_jsx(TableCell, { component: "div", className: "th", "data-header-id": headerId, "data-is-pinned": isPinned, sx: {
175
+ transition: "background-color 0.2s ease",
176
+ whiteSpace: "nowrap",
177
+ zIndex: isPinned ? 1 : 0,
178
+ display: "flex",
179
+ overflow: "hidden",
180
+ height: "var(--header-row-height)",
181
+ width,
182
+ position: "relative",
183
+ flexShrink: 0,
184
+ alignItems: "center",
185
+ gap: "8px",
186
+ justifyContent: "space-between",
187
+ padding: "6px 12px",
188
+ boxSizing: "border-box",
189
+ fontWeight: 600,
190
+ backgroundColor: isPinned
191
+ ? (theme) => theme.palette.background.paper
192
+ : "transparent",
193
+ borderRight: (theme) => `1px solid ${theme.palette.divider}`,
194
+ }, children: _jsx("div", { style: { flex: 1, display: "flex", justifyContent: "flex-start" }, children: header && !header.isPlaceholder
195
+ ? flexRender(header.column.columnDef[type], header.getContext())
196
+ : null }) }));
197
+ }
198
+ export { AnoccaSkin };
199
+ function TableHeaderRow({ children }) {
200
+ return (_jsx(TableRow, { component: "div", sx: { height: "var(--row-height)", display: "flex" }, children: children }));
201
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "name": "@rttui/skin-anocca",
3
+ "version": "1.0.1",
4
+ "type": "module"
5
+ }
@@ -0,0 +1,3 @@
1
+ import { Skin } from "@rttui/core";
2
+ declare const AnoccaSkin: Skin;
3
+ export { AnoccaSkin };
package/package.json CHANGED
@@ -1,6 +1,20 @@
1
1
  {
2
2
  "name": "@rttui/skin-anocca",
3
- "version": "0.0.0",
4
- "private": false,
5
- "type": "module"
3
+ "version": "1.0.1",
4
+ "main": "./dist/cjs/index.js",
5
+ "dependencies": {
6
+ "@rttui/core": "1.0.1"
7
+ },
8
+ "module": "./dist/mjs/index.js",
9
+ "types": "./dist/types/index.d.ts",
10
+ "exports": {
11
+ ".": {
12
+ "types": "./dist/types/index.d.ts",
13
+ "require": "./dist/cjs/index.js",
14
+ "import": "./dist/mjs/index.js"
15
+ }
16
+ },
17
+ "publishConfig": {
18
+ "access": "public"
19
+ }
6
20
  }
package/src/index.tsx ADDED
@@ -0,0 +1,348 @@
1
+ import {
2
+ Box,
3
+ Paper,
4
+ SxProps,
5
+ TableBody,
6
+ TableCell,
7
+ TableFooter,
8
+ TableHead,
9
+ TableRow,
10
+ Theme,
11
+ useTheme,
12
+ } from "@mui/material";
13
+ import {
14
+ Skin,
15
+ useTableContext,
16
+ useTableCssVars,
17
+ VirtualHeader,
18
+ } from "@rttui/core";
19
+ import React from "react";
20
+ import { flexRender } from "@tanstack/react-table";
21
+
22
+ const AnoccaSkin: Skin = {
23
+ rowHeight: 32,
24
+ headerRowHeight: 32,
25
+ footerRowHeight: 32,
26
+ OuterContainer: ({ children }) => {
27
+ const { width, height, tableContainerRef } = useTableContext();
28
+ const cssVars = useTableCssVars();
29
+
30
+ return (
31
+ <Paper
32
+ ref={tableContainerRef}
33
+ className="outer-container"
34
+ elevation={2}
35
+ sx={{
36
+ overflow: "auto",
37
+ width: width + "px",
38
+ height: height + "px",
39
+ position: "relative",
40
+ contain: "paint",
41
+ willChange: "transform",
42
+ borderRadius: 1,
43
+ ...cssVars,
44
+ }}
45
+ >
46
+ {children}
47
+ </Paper>
48
+ );
49
+ },
50
+ TableScroller: () => {
51
+ return (
52
+ <div
53
+ className="table-scroller"
54
+ style={{
55
+ width: "var(--table-width)",
56
+ height:
57
+ "calc(var(--table-height) + var(--header-height) + var(--footer-height))",
58
+ position: "absolute",
59
+ }}
60
+ ></div>
61
+ );
62
+ },
63
+ TableHeader: ({ children }) => {
64
+ return (
65
+ <TableHead
66
+ component="div"
67
+ className="thead"
68
+ sx={{
69
+ position: "sticky",
70
+ top: 0,
71
+ width: "var(--table-width)",
72
+ zIndex: 2,
73
+ backgroundColor: (theme) => theme.palette.background.paper,
74
+ boxShadow: (theme) => `0 1px 0 ${theme.palette.divider}`,
75
+ }}
76
+ >
77
+ {children}
78
+ </TableHead>
79
+ );
80
+ },
81
+ TableFooter: ({ children }) => {
82
+ return (
83
+ <TableFooter
84
+ component="div"
85
+ className="table-footer"
86
+ sx={{
87
+ position: "sticky",
88
+ bottom: -1,
89
+ width: "var(--table-width)",
90
+ zIndex: 2,
91
+ backgroundColor: (theme) => theme.palette.background.paper,
92
+ boxShadow: (theme) => `0 -1px 0 ${theme.palette.divider}`,
93
+ }}
94
+ >
95
+ {children}
96
+ </TableFooter>
97
+ );
98
+ },
99
+ HeaderRow: TableHeaderRow,
100
+ HeaderCell: (props) => {
101
+ return <TableHeaderCell {...props} />;
102
+ },
103
+ TableBody: ({ children }) => {
104
+ return (
105
+ <TableBody
106
+ component="div"
107
+ className="table-body"
108
+ sx={{ position: "relative", width: "var(--table-width)" }}
109
+ >
110
+ {children}
111
+ </TableBody>
112
+ );
113
+ },
114
+ PinnedRows: ({ children, position, pinned }) => {
115
+ if (pinned.length === 0) {
116
+ return null;
117
+ }
118
+
119
+ const style: SxProps<Theme> = {
120
+ position: "sticky",
121
+ zIndex: 3,
122
+ };
123
+ if (position === "top") {
124
+ style.top = "var(--header-height)";
125
+ style.borderBottom = (theme) => `1px solid ${theme.palette.divider}`;
126
+ style.boxShadow =
127
+ "0 4px 8px -4px rgba(0, 0, 0, 0.15), 0 6px 12px -6px rgba(0, 0, 0, 0.1)";
128
+ } else if (position === "bottom") {
129
+ style.bottom = "var(--footer-height)";
130
+ style.borderTop = (theme) => `1px solid ${theme.palette.divider}`;
131
+ style.boxShadow =
132
+ "0 -4px 8px -4px rgba(0, 0, 0, 0.15), 0 -6px 12px -6px rgba(0, 0, 0, 0.1)";
133
+ }
134
+
135
+ const Component = position === "top" ? TableHead : TableFooter;
136
+
137
+ return (
138
+ <Component
139
+ component="div"
140
+ className={`sticky-${position}-rows`}
141
+ sx={style}
142
+ >
143
+ {children}
144
+ </Component>
145
+ );
146
+ },
147
+ PinnedCols: ({ children, position, pinned }) => {
148
+ if (pinned.length === 0) {
149
+ return null;
150
+ }
151
+
152
+ const style: SxProps<Theme> = {
153
+ position: "sticky",
154
+ zIndex: 3,
155
+ display: "flex",
156
+ };
157
+
158
+ if (position === "left") {
159
+ style.left = 0;
160
+ style.boxShadow =
161
+ "4px 0 8px -4px rgba(0, 0, 0, 0.15), 6px 0 12px -6px rgba(0, 0, 0, 0.1)";
162
+ } else if (position === "right") {
163
+ style.right = 0;
164
+ style.borderLeft = (theme) => `1px solid ${theme.palette.divider}`;
165
+ style.boxShadow =
166
+ "-4px 0 8px -4px rgba(0, 0, 0, 0.15), -6px 0 12px -6px rgba(0, 0, 0, 0.1)";
167
+ }
168
+
169
+ return (
170
+ <Box component="div" className={`sticky-${position}-cols`} sx={style}>
171
+ {children}
172
+ </Box>
173
+ );
174
+ },
175
+
176
+ TableRowWrapper: React.forwardRef(
177
+ ({ children, flatIndex, dndStyle }, ref) => {
178
+ const theme = useTheme();
179
+ const backgroundColor = (theme: Theme) => {
180
+ const baseColor =
181
+ flatIndex % 2 === 0
182
+ ? theme.palette.background.paper
183
+ : theme.palette.mode === "dark"
184
+ ? theme.palette.grey[900]
185
+ : theme.palette.grey[100];
186
+ return baseColor;
187
+ };
188
+
189
+ const vars: Record<string, string> = {
190
+ "--row-background-color": backgroundColor(theme),
191
+ };
192
+
193
+ return (
194
+ <Box
195
+ sx={{
196
+ ...dndStyle,
197
+ ...vars,
198
+ }}
199
+ data-index={flatIndex}
200
+ ref={ref}
201
+ >
202
+ {children}
203
+ </Box>
204
+ );
205
+ },
206
+ ),
207
+ TableRow: ({ children }) => {
208
+ return (
209
+ <TableRow
210
+ component="div"
211
+ className="table-row"
212
+ sx={{
213
+ position: "relative",
214
+ width: "var(--table-width)",
215
+ display: "flex",
216
+ height: "var(--row-height)",
217
+ zIndex: 1,
218
+ boxSizing: "border-box",
219
+ backgroundColor: "var(--row-background-color)",
220
+ }}
221
+ >
222
+ {children}
223
+ </TableRow>
224
+ );
225
+ },
226
+ TableRowExpandedContent: ({ children }) => {
227
+ const { table } = useTableContext();
228
+ return (
229
+ <TableRow
230
+ component="div"
231
+ className="expanded-row"
232
+ sx={{
233
+ backgroundColor: (theme) => theme.palette.background.default,
234
+ }}
235
+ >
236
+ <TableCell
237
+ component="div"
238
+ className="expanded-cell"
239
+ colSpan={table.getAllLeafColumns().length}
240
+ sx={{
241
+ padding: 2,
242
+ }}
243
+ >
244
+ {children}
245
+ </TableCell>
246
+ </TableRow>
247
+ );
248
+ },
249
+ Cell: ({ children, header }) => {
250
+ const { isPinned } = header;
251
+ return (
252
+ <TableCell
253
+ className="td"
254
+ component="div"
255
+ sx={{
256
+ height: "var(--row-height)",
257
+ width: header.width,
258
+ overflow: "hidden",
259
+ textOverflow: "ellipsis",
260
+ whiteSpace: "nowrap",
261
+ zIndex: isPinned ? 5 : 0,
262
+ boxSizing: "border-box",
263
+ alignItems: "center",
264
+ gap: "8px",
265
+ display: "flex",
266
+ justifyContent: "flex-start",
267
+ alignContent: "center",
268
+ padding: "6px 12px",
269
+ backgroundColor: "var(--row-background-color)",
270
+ borderBottom: "none",
271
+ flexShrink: 0,
272
+ position: "relative",
273
+ borderRight: (theme) => `1px solid ${theme.palette.divider}`,
274
+ ".table-row:hover &": {
275
+ backgroundColor: (theme) => {
276
+ // Always use solid background colors for all cells on hover
277
+ return theme.palette.mode === "dark"
278
+ ? "#1e1e52" // Dark blue solid color
279
+ : "#E3F2FD"; // Light blue solid color
280
+ },
281
+ zIndex: isPinned ? 2 : 0,
282
+ },
283
+ }}
284
+ >
285
+ {children}
286
+ </TableCell>
287
+ );
288
+ },
289
+ };
290
+
291
+ function TableHeaderCell({
292
+ headerId,
293
+ isPinned,
294
+ width,
295
+ header,
296
+ type,
297
+ }: VirtualHeader & {
298
+ type: "header" | "footer";
299
+ }) {
300
+ return (
301
+ <TableCell
302
+ component="div"
303
+ className="th"
304
+ data-header-id={headerId}
305
+ data-is-pinned={isPinned}
306
+ sx={{
307
+ transition: "background-color 0.2s ease",
308
+ whiteSpace: "nowrap",
309
+ zIndex: isPinned ? 1 : 0,
310
+ display: "flex",
311
+ overflow: "hidden",
312
+ height: "var(--header-row-height)",
313
+ width,
314
+ position: "relative",
315
+ flexShrink: 0,
316
+ alignItems: "center",
317
+ gap: "8px",
318
+ justifyContent: "space-between",
319
+ padding: "6px 12px",
320
+ boxSizing: "border-box",
321
+ fontWeight: 600,
322
+ backgroundColor: isPinned
323
+ ? (theme) => theme.palette.background.paper
324
+ : "transparent",
325
+ borderRight: (theme) => `1px solid ${theme.palette.divider}`,
326
+ }}
327
+ >
328
+ <div style={{ flex: 1, display: "flex", justifyContent: "flex-start" }}>
329
+ {header && !header.isPlaceholder
330
+ ? flexRender(header.column.columnDef[type], header.getContext())
331
+ : null}
332
+ </div>
333
+ </TableCell>
334
+ );
335
+ }
336
+
337
+ export { AnoccaSkin };
338
+
339
+ function TableHeaderRow({ children }: { children: React.ReactNode }) {
340
+ return (
341
+ <TableRow
342
+ component="div"
343
+ sx={{ height: "var(--row-height)", display: "flex" }}
344
+ >
345
+ {children}
346
+ </TableRow>
347
+ );
348
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "extends": "./tsconfig.json",
3
+ "compilerOptions": {
4
+ "module": "commonjs",
5
+ "outDir": "dist/cjs"
6
+ }
7
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,34 @@
1
+ {
2
+ "compilerOptions": {
3
+ "allowJs": true,
4
+ "allowSyntheticDefaultImports": true,
5
+ "baseUrl": "src",
6
+ "target": "ESNext",
7
+ "declaration": true,
8
+ "esModuleInterop": true,
9
+ "inlineSourceMap": false,
10
+ "lib": [
11
+ "esnext",
12
+ "dom"
13
+ ],
14
+ "listEmittedFiles": false,
15
+ "jsx": "react-jsx",
16
+ "listFiles": false,
17
+ "moduleResolution": "node",
18
+ "noFallthroughCasesInSwitch": true,
19
+ "pretty": true,
20
+ "resolveJsonModule": true,
21
+ "rootDir": "src",
22
+ "skipLibCheck": true,
23
+ "strict": true,
24
+ "traceResolution": false
25
+ },
26
+ "compileOnSave": false,
27
+ "exclude": [
28
+ "node_modules",
29
+ "dist"
30
+ ],
31
+ "include": [
32
+ "src"
33
+ ]
34
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "extends": "./tsconfig.json",
3
+ "compilerOptions": {
4
+ "module": "preserve",
5
+ "outDir": "dist/mjs"
6
+ }
7
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "extends": "./tsconfig.json",
3
+ "compilerOptions": {
4
+ "declaration": true,
5
+ "outDir": "dist/types",
6
+ "emitDeclarationOnly": true,
7
+ "declarationDir": "dist/types"
8
+ }
9
+ }
package/README.md DELETED
@@ -1,2 +0,0 @@
1
- # @rttui/skin-anocca
2
- Published soon