@versini/ui-table 6.5.1 → 6.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Table/Table.d.ts +8 -0
- package/dist/Table/Table.js +213 -0
- package/dist/Table/TableContext.d.ts +8 -0
- package/dist/Table/TableContext.js +20 -0
- package/dist/Table/utilities.d.ts +60 -0
- package/dist/Table/utilities.js +137 -0
- package/dist/TableConstants/TableConstants.d.ts +5 -0
- package/dist/TableConstants/TableConstants.js +14 -0
- package/dist/index.d.ts +2 -136
- package/dist/index.js +15 -21
- package/package.json +12 -12
- package/dist/components/Table/Table.js +0 -405
- package/dist/components/TableConstants/TableConstants.js +0 -7
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { TableBodyProps, TableCellProps, TableCellSortProps, TableHeadProps, TableProps, TableRowProps } from "./TableTypes";
|
|
2
|
+
export declare const Table: ({ children, mode, caption, compact, disabled, summary, className, wrapperClassName, maxHeight, stickyHeader, stickyFooter, ...otherProps }: TableProps) => import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
export declare const TableHead: ({ children, className, ...otherProps }: TableHeadProps) => import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
export declare const TableFooter: ({ children, className, ...otherProps }: TableHeadProps) => import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
export declare const TableBody: ({ children, ...otherProps }: TableBodyProps) => import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export declare const TableRow: ({ children, className, ...otherProps }: TableRowProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export declare const TableCell: ({ children, component, className, align, ...otherProps }: TableCellProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export declare const TableCellSort: ({ align, children, buttonClassName, className, component, focusMode, mode, onClick, sortDirection, sortedCell, cellId, ...otherProps }: TableCellSortProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
@versini/ui-table v6.6.0
|
|
3
|
+
© 2025 gizmette.com
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
import { ButtonSort_private } from "@versini/ui-button/private";
|
|
8
|
+
import { IconSort, IconSortDown, IconSortUp } from "@versini/ui-icons";
|
|
9
|
+
import { useContext } from "react";
|
|
10
|
+
import { TableContext } from "./TableContext.js";
|
|
11
|
+
import { CELL_WRAPPER_BODY, CELL_WRAPPER_FOOTER, CELL_WRAPPER_HEAD, TableCellSortDirections, getTableCellClasses, getTableCellSortButtonClasses, getTableClasses, getTableFooterClasses, getTableHeadClasses, getTableRowClasses } from "./utilities.js";
|
|
12
|
+
|
|
13
|
+
;// CONCATENATED MODULE: external "react/jsx-runtime"
|
|
14
|
+
|
|
15
|
+
;// CONCATENATED MODULE: external "@versini/ui-button/private"
|
|
16
|
+
|
|
17
|
+
;// CONCATENATED MODULE: external "@versini/ui-icons"
|
|
18
|
+
|
|
19
|
+
;// CONCATENATED MODULE: external "react"
|
|
20
|
+
|
|
21
|
+
;// CONCATENATED MODULE: external "./TableContext.js"
|
|
22
|
+
|
|
23
|
+
;// CONCATENATED MODULE: external "./utilities.js"
|
|
24
|
+
|
|
25
|
+
;// CONCATENATED MODULE: ./src/components/Table/Table.tsx
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
const Table = ({ children, mode = "system", caption, compact, disabled = false, summary, className, wrapperClassName, maxHeight, stickyHeader, stickyFooter, ...otherProps })=>{
|
|
33
|
+
const tableClass = getTableClasses({
|
|
34
|
+
mode,
|
|
35
|
+
className,
|
|
36
|
+
wrapperClassName,
|
|
37
|
+
stickyHeader,
|
|
38
|
+
stickyFooter,
|
|
39
|
+
disabled
|
|
40
|
+
});
|
|
41
|
+
return /*#__PURE__*/ jsx(TableContext.Provider, {
|
|
42
|
+
value: {
|
|
43
|
+
mode,
|
|
44
|
+
stickyHeader,
|
|
45
|
+
stickyFooter,
|
|
46
|
+
compact
|
|
47
|
+
},
|
|
48
|
+
children: /*#__PURE__*/ jsx("div", {
|
|
49
|
+
className: tableClass.wrapper,
|
|
50
|
+
...maxHeight && {
|
|
51
|
+
style: {
|
|
52
|
+
maxHeight
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
children: disabled ? /*#__PURE__*/ jsxs(Fragment, {
|
|
56
|
+
children: [
|
|
57
|
+
/*#__PURE__*/ jsx("div", {
|
|
58
|
+
className: tableClass.spinnerWrapper,
|
|
59
|
+
children: /*#__PURE__*/ jsx("div", {
|
|
60
|
+
className: tableClass.spinner,
|
|
61
|
+
role: "status",
|
|
62
|
+
children: /*#__PURE__*/ jsx("span", {
|
|
63
|
+
className: "sr-only",
|
|
64
|
+
children: "Loading..."
|
|
65
|
+
})
|
|
66
|
+
})
|
|
67
|
+
}),
|
|
68
|
+
/*#__PURE__*/ jsxs("div", {
|
|
69
|
+
className: tableClass.inner,
|
|
70
|
+
children: [
|
|
71
|
+
/*#__PURE__*/ jsx("div", {
|
|
72
|
+
className: tableClass.overlay
|
|
73
|
+
}),
|
|
74
|
+
/*#__PURE__*/ jsxs("table", {
|
|
75
|
+
className: tableClass.table,
|
|
76
|
+
summary: summary,
|
|
77
|
+
...disabled && {
|
|
78
|
+
"aria-disabled": "true"
|
|
79
|
+
},
|
|
80
|
+
...otherProps,
|
|
81
|
+
children: [
|
|
82
|
+
caption && /*#__PURE__*/ jsx("caption", {
|
|
83
|
+
className: tableClass.caption,
|
|
84
|
+
children: caption
|
|
85
|
+
}),
|
|
86
|
+
children
|
|
87
|
+
]
|
|
88
|
+
})
|
|
89
|
+
]
|
|
90
|
+
})
|
|
91
|
+
]
|
|
92
|
+
}) : /*#__PURE__*/ jsxs("table", {
|
|
93
|
+
className: tableClass.table,
|
|
94
|
+
summary: summary,
|
|
95
|
+
...otherProps,
|
|
96
|
+
children: [
|
|
97
|
+
caption && /*#__PURE__*/ jsx("caption", {
|
|
98
|
+
className: tableClass.caption,
|
|
99
|
+
children: caption
|
|
100
|
+
}),
|
|
101
|
+
children
|
|
102
|
+
]
|
|
103
|
+
})
|
|
104
|
+
})
|
|
105
|
+
});
|
|
106
|
+
};
|
|
107
|
+
const TableHead = ({ children, className, ...otherProps })=>{
|
|
108
|
+
const context = useContext(TableContext);
|
|
109
|
+
context.cellWrapper = CELL_WRAPPER_HEAD;
|
|
110
|
+
const tableHeadClass = getTableHeadClasses({
|
|
111
|
+
className,
|
|
112
|
+
mode: context.mode,
|
|
113
|
+
stickyHeader: context.stickyHeader
|
|
114
|
+
});
|
|
115
|
+
return /*#__PURE__*/ jsx("thead", {
|
|
116
|
+
className: tableHeadClass,
|
|
117
|
+
...otherProps,
|
|
118
|
+
children: children
|
|
119
|
+
});
|
|
120
|
+
};
|
|
121
|
+
const TableFooter = ({ children, className, ...otherProps })=>{
|
|
122
|
+
const context = useContext(TableContext);
|
|
123
|
+
context.cellWrapper = CELL_WRAPPER_FOOTER;
|
|
124
|
+
const tableFooterClass = getTableFooterClasses({
|
|
125
|
+
className,
|
|
126
|
+
mode: context.mode,
|
|
127
|
+
stickyFooter: context.stickyFooter
|
|
128
|
+
});
|
|
129
|
+
return /*#__PURE__*/ jsx("tfoot", {
|
|
130
|
+
className: tableFooterClass,
|
|
131
|
+
...otherProps,
|
|
132
|
+
children: children
|
|
133
|
+
});
|
|
134
|
+
};
|
|
135
|
+
const TableBody = ({ children, ...otherProps })=>{
|
|
136
|
+
const context = useContext(TableContext);
|
|
137
|
+
context.cellWrapper = CELL_WRAPPER_BODY;
|
|
138
|
+
return /*#__PURE__*/ jsx("tbody", {
|
|
139
|
+
...otherProps,
|
|
140
|
+
children: children
|
|
141
|
+
});
|
|
142
|
+
};
|
|
143
|
+
const TableRow = ({ children, className, ...otherProps })=>{
|
|
144
|
+
const context = useContext(TableContext);
|
|
145
|
+
const rowClass = getTableRowClasses({
|
|
146
|
+
mode: context.mode,
|
|
147
|
+
cellWrapper: context.cellWrapper,
|
|
148
|
+
className
|
|
149
|
+
});
|
|
150
|
+
return /*#__PURE__*/ jsx("tr", {
|
|
151
|
+
className: rowClass,
|
|
152
|
+
...otherProps,
|
|
153
|
+
children: children
|
|
154
|
+
});
|
|
155
|
+
};
|
|
156
|
+
const TableCell = ({ children, component, className, align, ...otherProps })=>{
|
|
157
|
+
const context = useContext(TableContext);
|
|
158
|
+
const Component = component || (context.cellWrapper === CELL_WRAPPER_HEAD ? "th" : "td");
|
|
159
|
+
const { mainClasses, alignClasses } = getTableCellClasses({
|
|
160
|
+
cellWrapper: context.cellWrapper,
|
|
161
|
+
className,
|
|
162
|
+
mode: context.mode,
|
|
163
|
+
compact: context.compact,
|
|
164
|
+
align
|
|
165
|
+
});
|
|
166
|
+
return align ? /*#__PURE__*/ jsx(Component, {
|
|
167
|
+
className: mainClasses,
|
|
168
|
+
...otherProps,
|
|
169
|
+
children: /*#__PURE__*/ jsx("div", {
|
|
170
|
+
className: alignClasses,
|
|
171
|
+
children: children
|
|
172
|
+
})
|
|
173
|
+
}) : /*#__PURE__*/ jsx(Component, {
|
|
174
|
+
className: mainClasses,
|
|
175
|
+
...otherProps,
|
|
176
|
+
children: children
|
|
177
|
+
});
|
|
178
|
+
};
|
|
179
|
+
const TableCellSort = ({ align, children, buttonClassName, className, component, focusMode = "alt-system", mode = "alt-system", onClick, sortDirection, sortedCell, cellId, ...otherProps })=>{
|
|
180
|
+
const buttonClass = getTableCellSortButtonClasses({
|
|
181
|
+
buttonClassName
|
|
182
|
+
});
|
|
183
|
+
return /*#__PURE__*/ jsx(TableCell, {
|
|
184
|
+
component: component,
|
|
185
|
+
className: className,
|
|
186
|
+
role: "columnheader",
|
|
187
|
+
"aria-sort": sortDirection === TableCellSortDirections.ASC && sortedCell === cellId ? "ascending" : sortDirection === TableCellSortDirections.DESC && sortedCell === cellId ? "descending" : "other",
|
|
188
|
+
...otherProps,
|
|
189
|
+
children: /*#__PURE__*/ jsx(ButtonSort_private, {
|
|
190
|
+
active: sortedCell === cellId,
|
|
191
|
+
className: buttonClass,
|
|
192
|
+
onClick: onClick,
|
|
193
|
+
align: align,
|
|
194
|
+
noBorder: true,
|
|
195
|
+
focusMode: focusMode,
|
|
196
|
+
mode: mode,
|
|
197
|
+
fullWidth: true,
|
|
198
|
+
labelRight: children,
|
|
199
|
+
children: sortDirection === TableCellSortDirections.ASC && sortedCell === cellId ? /*#__PURE__*/ jsx(IconSortUp, {
|
|
200
|
+
className: "size-4",
|
|
201
|
+
monotone: true
|
|
202
|
+
}) : sortDirection === TableCellSortDirections.DESC && sortedCell === cellId ? /*#__PURE__*/ jsx(IconSortDown, {
|
|
203
|
+
className: "size-4",
|
|
204
|
+
monotone: true
|
|
205
|
+
}) : /*#__PURE__*/ jsx(IconSort, {
|
|
206
|
+
className: "size-4",
|
|
207
|
+
monotone: true
|
|
208
|
+
})
|
|
209
|
+
})
|
|
210
|
+
});
|
|
211
|
+
};
|
|
212
|
+
|
|
213
|
+
export { Table, TableBody, TableCell, TableCellSort, TableFooter, TableHead, TableRow };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
@versini/ui-table v6.6.0
|
|
3
|
+
© 2025 gizmette.com
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import react from "react";
|
|
7
|
+
|
|
8
|
+
;// CONCATENATED MODULE: external "react"
|
|
9
|
+
|
|
10
|
+
;// CONCATENATED MODULE: ./src/components/Table/TableContext.ts
|
|
11
|
+
|
|
12
|
+
const TableContext = react.createContext({
|
|
13
|
+
mode: "light",
|
|
14
|
+
cellWrapper: "thead",
|
|
15
|
+
stickyHeader: false,
|
|
16
|
+
stickyFooter: false,
|
|
17
|
+
compact: false
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
export { TableContext };
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { TableCellSortDirections } from "../TableConstants/TableConstants";
|
|
2
|
+
export declare const CELL_WRAPPER_HEAD = "thead";
|
|
3
|
+
export declare const CELL_WRAPPER_FOOTER = "tfoot";
|
|
4
|
+
export declare const CELL_WRAPPER_BODY = "tbody";
|
|
5
|
+
export { TableCellSortDirections };
|
|
6
|
+
export declare const getTableSpinnerClasses: ({ mode }: {
|
|
7
|
+
mode: string;
|
|
8
|
+
}) => string;
|
|
9
|
+
export declare const getTableOverlayClasses: ({ mode }: {
|
|
10
|
+
mode: string;
|
|
11
|
+
}) => {
|
|
12
|
+
inner: string;
|
|
13
|
+
overlay: string;
|
|
14
|
+
spinnerWrapper: string;
|
|
15
|
+
spinner: string;
|
|
16
|
+
};
|
|
17
|
+
export declare const getTableClasses: ({ mode, className, wrapperClassName, stickyHeader, stickyFooter, disabled, }: {
|
|
18
|
+
mode: string;
|
|
19
|
+
className?: string;
|
|
20
|
+
disabled?: boolean;
|
|
21
|
+
stickyFooter?: boolean;
|
|
22
|
+
stickyHeader?: boolean;
|
|
23
|
+
wrapperClassName?: string;
|
|
24
|
+
}) => {
|
|
25
|
+
overlay: string;
|
|
26
|
+
inner: string;
|
|
27
|
+
spinnerWrapper: string;
|
|
28
|
+
spinner: string;
|
|
29
|
+
wrapper: string;
|
|
30
|
+
table: string;
|
|
31
|
+
caption: string;
|
|
32
|
+
};
|
|
33
|
+
export declare const getTableHeadClasses: ({ className, stickyHeader, mode, }: {
|
|
34
|
+
mode: string;
|
|
35
|
+
className?: string;
|
|
36
|
+
stickyHeader?: boolean;
|
|
37
|
+
}) => string;
|
|
38
|
+
export declare const getTableFooterClasses: ({ className, stickyFooter, mode, }: {
|
|
39
|
+
mode: string;
|
|
40
|
+
className?: string;
|
|
41
|
+
stickyFooter?: boolean;
|
|
42
|
+
}) => string;
|
|
43
|
+
export declare const getTableRowClasses: ({ mode, className, cellWrapper, }: {
|
|
44
|
+
mode: string;
|
|
45
|
+
cellWrapper?: string;
|
|
46
|
+
className?: string;
|
|
47
|
+
}) => string;
|
|
48
|
+
export declare const getTableCellClasses: ({ cellWrapper, className, compact, mode, align, }: {
|
|
49
|
+
mode: string;
|
|
50
|
+
cellWrapper?: string;
|
|
51
|
+
className?: string;
|
|
52
|
+
compact?: boolean;
|
|
53
|
+
align?: "left" | "center" | "right";
|
|
54
|
+
}) => {
|
|
55
|
+
alignClasses: string;
|
|
56
|
+
mainClasses: string;
|
|
57
|
+
};
|
|
58
|
+
export declare const getTableCellSortButtonClasses: ({ buttonClassName, }: {
|
|
59
|
+
buttonClassName?: string;
|
|
60
|
+
}) => string;
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
@versini/ui-table v6.6.0
|
|
3
|
+
© 2025 gizmette.com
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import clsx from "clsx";
|
|
7
|
+
import { TableCellSortDirections } from "../TableConstants/TableConstants.js";
|
|
8
|
+
|
|
9
|
+
;// CONCATENATED MODULE: external "clsx"
|
|
10
|
+
|
|
11
|
+
;// CONCATENATED MODULE: external "../TableConstants/TableConstants.js"
|
|
12
|
+
|
|
13
|
+
;// CONCATENATED MODULE: ./src/components/Table/utilities.ts
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
const CELL_WRAPPER_HEAD = "thead";
|
|
17
|
+
const CELL_WRAPPER_FOOTER = "tfoot";
|
|
18
|
+
const CELL_WRAPPER_BODY = "tbody";
|
|
19
|
+
// Re-export moved constant for backward compatibility (tree-shakable now)
|
|
20
|
+
|
|
21
|
+
const getTableSpinnerClasses = ({ mode })=>{
|
|
22
|
+
return clsx("size-8", "align-[-0.125em]", "border-4", "inline-block animate-spin rounded-full border-solid border-current border-r-transparent motion-reduce:animate-[spin_1.5s_linear_infinite]", {
|
|
23
|
+
"text-copy-dark": mode === "light",
|
|
24
|
+
"text-copy-light": mode === "dark",
|
|
25
|
+
"text-copy-dark dark:text-copy-light": mode === "alt-system",
|
|
26
|
+
"text-copy-light dark:text-copy-dark": mode === "system"
|
|
27
|
+
});
|
|
28
|
+
};
|
|
29
|
+
const getTableOverlayClasses = ({ mode })=>{
|
|
30
|
+
return {
|
|
31
|
+
inner: "relative",
|
|
32
|
+
overlay: clsx("absolute inset-0 z-20 cursor-not-allowed", "backdrop-blur-xs bg-white/30 dark:bg-black/30"),
|
|
33
|
+
spinnerWrapper: clsx("absolute z-30 top-0 left-0 right-0 h-[min(100%,100vh)]", "flex items-center justify-center", "pointer-events-none"),
|
|
34
|
+
spinner: getTableSpinnerClasses({
|
|
35
|
+
mode
|
|
36
|
+
})
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
const getTableClasses = ({ mode, className, wrapperClassName, stickyHeader, stickyFooter, disabled })=>{
|
|
40
|
+
const overlayClasses = disabled ? getTableOverlayClasses({
|
|
41
|
+
mode
|
|
42
|
+
}) : null;
|
|
43
|
+
return {
|
|
44
|
+
overlay: overlayClasses?.overlay ?? "",
|
|
45
|
+
inner: overlayClasses?.inner ?? "",
|
|
46
|
+
spinnerWrapper: overlayClasses?.spinnerWrapper ?? "",
|
|
47
|
+
spinner: overlayClasses?.spinner ?? "",
|
|
48
|
+
wrapper: clsx("not-prose relative w-full rounded-lg shadow-md", {
|
|
49
|
+
"overflow-x-auto": !stickyHeader && !stickyFooter && !disabled,
|
|
50
|
+
"overflow-y-scroll": (stickyHeader || stickyFooter) && !disabled,
|
|
51
|
+
"overflow-hidden": disabled,
|
|
52
|
+
"bg-surface-darker": mode === "dark" || mode === "system",
|
|
53
|
+
"bg-surface-light": mode === "light" || mode === "alt-system",
|
|
54
|
+
"dark:bg-surface-light": mode === "system",
|
|
55
|
+
"dark:bg-surface-darker": mode === "alt-system",
|
|
56
|
+
"text-copy-light": mode === "dark",
|
|
57
|
+
"text-copy-dark": mode === "light",
|
|
58
|
+
"text-copy-light dark:text-copy-dark": mode === "system",
|
|
59
|
+
"text-copy-dark dark:text-copy-light": mode === "alt-system"
|
|
60
|
+
}, wrapperClassName),
|
|
61
|
+
table: clsx("my-0 w-full text-left text-sm", className, {
|
|
62
|
+
"text-copy-light": mode === "dark",
|
|
63
|
+
"text-copy-dark": mode === "light",
|
|
64
|
+
"text-copy-light dark:text-copy-dark": mode === "system",
|
|
65
|
+
"text-copy-dark dark:text-copy-light": mode === "alt-system"
|
|
66
|
+
}),
|
|
67
|
+
caption: clsx("py-2 text-sm font-bold", {
|
|
68
|
+
"text-copy-light": mode === "dark",
|
|
69
|
+
"text-copy-dark": mode === "light",
|
|
70
|
+
"text-copy-light dark:text-copy-dark": mode === "system",
|
|
71
|
+
"text-copy-dark dark:text-copy-light": mode === "alt-system"
|
|
72
|
+
})
|
|
73
|
+
};
|
|
74
|
+
};
|
|
75
|
+
const getTableHeadClasses = ({ className, stickyHeader, mode })=>{
|
|
76
|
+
return clsx({
|
|
77
|
+
"sticky top-0 z-10": stickyHeader,
|
|
78
|
+
"shadow-[rgb(190_190_190_/20%)_0_0.5rem_1rem]": stickyHeader && mode === "dark",
|
|
79
|
+
"shadow-[rgb(190_190_190_/20%)_0_0.5rem_1rem] dark:shadow-[rgb(65_65_65_/30%)_0_0.5rem_1rem]": stickyHeader && mode === "system",
|
|
80
|
+
"shadow-[rgb(65_65_65_/30%)_0_0.5rem_1rem]": stickyHeader && mode === "light",
|
|
81
|
+
"shadow-[rgb(65_65_65_/30%)_0_0.5rem_1rem] dark:shadow-[rgb(190_190_190_/20%)_0_0.5rem_1rem]": stickyHeader && mode === "alt-system"
|
|
82
|
+
}, className);
|
|
83
|
+
};
|
|
84
|
+
const getTableFooterClasses = ({ className, stickyFooter, mode })=>{
|
|
85
|
+
return clsx({
|
|
86
|
+
"sticky bottom-0 z-10": stickyFooter,
|
|
87
|
+
"shadow-[rgb(190_190_190_/20%)_0_-0.5rem_1rem]": stickyFooter && mode === "dark",
|
|
88
|
+
"shadow-[rgb(190_190_190_/20%)_0_-0.5rem_1rem] dark:shadow-[rgb(65_65_65_/30%)_0_-0.5rem_1rem]": stickyFooter && mode === "system",
|
|
89
|
+
"shadow-[rgb(65_65_65_/30%)_0_-0.5rem_1rem]": stickyFooter && mode === "light",
|
|
90
|
+
"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"
|
|
91
|
+
}, className);
|
|
92
|
+
};
|
|
93
|
+
const getTableRowClasses = ({ mode, className, cellWrapper })=>{
|
|
94
|
+
if (cellWrapper === CELL_WRAPPER_HEAD || cellWrapper === CELL_WRAPPER_FOOTER) {
|
|
95
|
+
return clsx({
|
|
96
|
+
"bg-table-head-dark": mode === "dark" || mode === "system",
|
|
97
|
+
"bg-table-head-light": mode === "light" || mode === "alt-system",
|
|
98
|
+
"dark:bg-table-head-light": mode === "system",
|
|
99
|
+
"dark:bg-table-head-dark": mode === "alt-system"
|
|
100
|
+
}, className);
|
|
101
|
+
}
|
|
102
|
+
return clsx("border-b last:border-0", {
|
|
103
|
+
"hover:bg-table-dark-odd/50! hover:dark:bg-table-light-odd/50!": mode === "alt-system" || mode === "light",
|
|
104
|
+
"hover:bg-table-light-odd/50! hover:dark:bg-table-dark-odd/50!": mode === "system" || mode === "dark",
|
|
105
|
+
"border-table-dark": mode === "dark" || mode === "system",
|
|
106
|
+
"odd:bg-table-dark-odd even:bg-table-dark-even": mode === "dark",
|
|
107
|
+
"border-table-light": mode === "light" || mode === "alt-system",
|
|
108
|
+
"odd:bg-table-light-odd even:bg-table-light-even": mode === "light",
|
|
109
|
+
"dark:border-table-light": mode === "system",
|
|
110
|
+
"odd:bg-table-dark-odd even:bg-table-dark-even dark:odd:bg-table-light-odd dark:even:bg-table-light-even": mode === "system",
|
|
111
|
+
"dark:border-table-dark": mode === "alt-system",
|
|
112
|
+
"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"
|
|
113
|
+
}, className);
|
|
114
|
+
};
|
|
115
|
+
const getTableCellClasses = ({ cellWrapper, className, compact, mode, align })=>{
|
|
116
|
+
return {
|
|
117
|
+
alignClasses: clsx({
|
|
118
|
+
"flex justify-start text-left": align === "left",
|
|
119
|
+
"flex justify-center text-center": align === "center",
|
|
120
|
+
"flex justify-end text-right": align === "right"
|
|
121
|
+
}),
|
|
122
|
+
mainClasses: clsx({
|
|
123
|
+
"text-copy-light": mode === "dark" || mode === "system",
|
|
124
|
+
"text-copy-dark": mode === "light" || mode === "alt-system",
|
|
125
|
+
"dark:text-copy-dark": mode === "system",
|
|
126
|
+
"dark:text-copy-light": mode === "alt-system",
|
|
127
|
+
"px-4 py-3": !compact && (cellWrapper === CELL_WRAPPER_HEAD || cellWrapper === CELL_WRAPPER_FOOTER),
|
|
128
|
+
"p-4": !compact && cellWrapper === CELL_WRAPPER_BODY,
|
|
129
|
+
"px-2 py-1.5": compact
|
|
130
|
+
}, className)
|
|
131
|
+
};
|
|
132
|
+
};
|
|
133
|
+
const getTableCellSortButtonClasses = ({ buttonClassName })=>{
|
|
134
|
+
return clsx("rounded-none text-sm", buttonClassName);
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
export { CELL_WRAPPER_BODY, CELL_WRAPPER_FOOTER, CELL_WRAPPER_HEAD, TableCellSortDirections, getTableCellClasses, getTableCellSortButtonClasses, getTableClasses, getTableFooterClasses, getTableHeadClasses, getTableOverlayClasses, getTableRowClasses, getTableSpinnerClasses };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
@versini/ui-table v6.6.0
|
|
3
|
+
© 2025 gizmette.com
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
;// CONCATENATED MODULE: ./src/components/TableConstants/TableConstants.tsx
|
|
8
|
+
// Side-effect free constants for ui-table.
|
|
9
|
+
const TableCellSortDirections = {
|
|
10
|
+
ASC: "asc",
|
|
11
|
+
DESC: "desc"
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export { TableCellSortDirections };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,136 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
declare const TableCellSortDirections: {
|
|
5
|
-
readonly ASC: "asc";
|
|
6
|
-
readonly DESC: "desc";
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
type TableProps = {
|
|
10
|
-
/**
|
|
11
|
-
* This attribute defines the caption (or title) of a table.
|
|
12
|
-
*/
|
|
13
|
-
caption?: React.ReactNode;
|
|
14
|
-
/**
|
|
15
|
-
* If true, the table will be smaller.
|
|
16
|
-
*/
|
|
17
|
-
compact?: boolean;
|
|
18
|
-
/**
|
|
19
|
-
* If true, a frosty overlay will be placed above the table,
|
|
20
|
-
* blocking all interactions (sorting, scrolling, etc.).
|
|
21
|
-
* The table content remains visible but slightly blurred.
|
|
22
|
-
* @default false
|
|
23
|
-
*/
|
|
24
|
-
disabled?: boolean;
|
|
25
|
-
/**
|
|
26
|
-
* The max height of the table. It follows the CSS max-height property.
|
|
27
|
-
* Note: It is required to configure 'maxHeight' prop for the prop
|
|
28
|
-
* 'stickyHeader' to work.
|
|
29
|
-
*/
|
|
30
|
-
maxHeight?: string;
|
|
31
|
-
/**
|
|
32
|
-
* The mode of table. It defines the color of the table.
|
|
33
|
-
*/
|
|
34
|
-
mode?: "dark" | "light" | "system" | "alt-system";
|
|
35
|
-
/**
|
|
36
|
-
* If true, the table footer will be sticky.
|
|
37
|
-
* Note: It is required to configure 'maxHeight' prop for the prop
|
|
38
|
-
* 'stickyHeader' to work.
|
|
39
|
-
*/
|
|
40
|
-
stickyFooter?: boolean;
|
|
41
|
-
/**
|
|
42
|
-
* If true, the table header will be sticky.
|
|
43
|
-
* Note: It is required to configure 'maxHeight' prop for the prop
|
|
44
|
-
* 'stickyHeader' to work.
|
|
45
|
-
*/
|
|
46
|
-
stickyHeader?: boolean;
|
|
47
|
-
/**
|
|
48
|
-
* This attribute defines an alternative text that summarizes
|
|
49
|
-
* the content of the table. It is not visible but will be
|
|
50
|
-
* read out loud by screen readers to represent the table.
|
|
51
|
-
*/
|
|
52
|
-
summary?: string;
|
|
53
|
-
/**
|
|
54
|
-
* CSS class to apply to the table wrapper.
|
|
55
|
-
*/
|
|
56
|
-
wrapperClassName?: string;
|
|
57
|
-
} & React.HTMLAttributes<HTMLTableElement>;
|
|
58
|
-
|
|
59
|
-
type TableRowProps = React.HTMLAttributes<HTMLTableRowElement>;
|
|
60
|
-
type TableBodyProps = React.HTMLAttributes<HTMLTableSectionElement>;
|
|
61
|
-
type TableHeadProps = React.HTMLAttributes<HTMLTableSectionElement>;
|
|
62
|
-
|
|
63
|
-
type TableCellProps = {
|
|
64
|
-
/**
|
|
65
|
-
* The type of cell.
|
|
66
|
-
* @default "td"
|
|
67
|
-
*/
|
|
68
|
-
component?: "td" | "th";
|
|
69
|
-
/**
|
|
70
|
-
* Whether to align the cell content to the left, center, or right.
|
|
71
|
-
*/
|
|
72
|
-
align?: "left" | "center" | "right";
|
|
73
|
-
} & React.ThHTMLAttributes<HTMLTableCellElement> &
|
|
74
|
-
React.TdHTMLAttributes<HTMLTableCellElement>;
|
|
75
|
-
|
|
76
|
-
type TableCellSortProps = {
|
|
77
|
-
/**
|
|
78
|
-
* Unique identifier for the cell. This string will have to be onClick
|
|
79
|
-
* handler to sort on this particular cell.
|
|
80
|
-
*/
|
|
81
|
-
cellId: string;
|
|
82
|
-
/**
|
|
83
|
-
* The label of the cell.
|
|
84
|
-
*/
|
|
85
|
-
children: string;
|
|
86
|
-
/**
|
|
87
|
-
* The handler to be called when the cell is clicked.
|
|
88
|
-
*/
|
|
89
|
-
onClick: (event: React.MouseEvent<unknown>) => void;
|
|
90
|
-
/**
|
|
91
|
-
* The direction of the sort.
|
|
92
|
-
*/
|
|
93
|
-
sortDirection:
|
|
94
|
-
| typeof TableCellSortDirections.ASC
|
|
95
|
-
| typeof TableCellSortDirections.DESC
|
|
96
|
-
| false;
|
|
97
|
-
/**
|
|
98
|
-
* The cellId that is currently sorted.
|
|
99
|
-
*/
|
|
100
|
-
sortedCell: string;
|
|
101
|
-
/**
|
|
102
|
-
* Whether to align the cell content to the left, center, or right.
|
|
103
|
-
*/
|
|
104
|
-
align?: "left" | "center" | "right";
|
|
105
|
-
/**
|
|
106
|
-
* CSS class to apply to the button within the sort table cell.
|
|
107
|
-
*/
|
|
108
|
-
buttonClassName?: string;
|
|
109
|
-
/**
|
|
110
|
-
* The type of cell.
|
|
111
|
-
* @default "td"
|
|
112
|
-
*/
|
|
113
|
-
component?: "td" | "th";
|
|
114
|
-
/**
|
|
115
|
-
* Pass through to the underlying ButtonIcon.
|
|
116
|
-
* The type of focus for the Button. This will change the color
|
|
117
|
-
* of the focus ring around the Button.
|
|
118
|
-
*/
|
|
119
|
-
focusMode?: "system" | "light" | "dark" | "alt-system";
|
|
120
|
-
/**
|
|
121
|
-
* Pass through to the underlying ButtonIcon.
|
|
122
|
-
* The mode of Button. This will change the color of the Button.
|
|
123
|
-
*/
|
|
124
|
-
mode?: "system" | "light" | "dark" | "alt-system";
|
|
125
|
-
} & React.ThHTMLAttributes<HTMLTableCellElement> &
|
|
126
|
-
React.TdHTMLAttributes<HTMLTableCellElement>;
|
|
127
|
-
|
|
128
|
-
declare const Table: ({ children, mode, caption, compact, disabled, summary, className, wrapperClassName, maxHeight, stickyHeader, stickyFooter, ...otherProps }: TableProps) => react_jsx_runtime.JSX.Element;
|
|
129
|
-
declare const TableHead: ({ children, className, ...otherProps }: TableHeadProps) => react_jsx_runtime.JSX.Element;
|
|
130
|
-
declare const TableFooter: ({ children, className, ...otherProps }: TableHeadProps) => react_jsx_runtime.JSX.Element;
|
|
131
|
-
declare const TableBody: ({ children, ...otherProps }: TableBodyProps) => react_jsx_runtime.JSX.Element;
|
|
132
|
-
declare const TableRow: ({ children, className, ...otherProps }: TableRowProps) => react_jsx_runtime.JSX.Element;
|
|
133
|
-
declare const TableCell: ({ children, component, className, align, ...otherProps }: TableCellProps) => react_jsx_runtime.JSX.Element;
|
|
134
|
-
declare const TableCellSort: ({ align, children, buttonClassName, className, component, focusMode, mode, onClick, sortDirection, sortedCell, cellId, ...otherProps }: TableCellSortProps) => react_jsx_runtime.JSX.Element;
|
|
135
|
-
|
|
136
|
-
export { Table, TableBody, TableCell, TableCellSort, TableCellSortDirections, TableFooter, TableHead, TableRow };
|
|
1
|
+
export * from "./Table/Table";
|
|
2
|
+
export { TableCellSortDirections } from "./TableConstants/TableConstants";
|
package/dist/index.js
CHANGED
|
@@ -1,21 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
i as TableCellSort,
|
|
17
|
-
n as TableCellSortDirections,
|
|
18
|
-
_ as TableFooter,
|
|
19
|
-
t as TableHead,
|
|
20
|
-
b as TableRow
|
|
21
|
-
};
|
|
1
|
+
/*!
|
|
2
|
+
@versini/ui-table v6.6.0
|
|
3
|
+
© 2025 gizmette.com
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { TableCellSortDirections } from "./TableConstants/TableConstants.js";
|
|
7
|
+
export * from "./Table/Table.js";
|
|
8
|
+
|
|
9
|
+
;// CONCATENATED MODULE: external "./TableConstants/TableConstants.js"
|
|
10
|
+
|
|
11
|
+
;// CONCATENATED MODULE: ./src/components/index.ts
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
export { TableCellSortDirections };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@versini/ui-table",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.6.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "Arno Versini",
|
|
6
6
|
"publishConfig": {
|
|
@@ -14,12 +14,12 @@
|
|
|
14
14
|
"type": "module",
|
|
15
15
|
"exports": {
|
|
16
16
|
"./constants": {
|
|
17
|
-
"types": "./dist/
|
|
18
|
-
"import": "./dist/
|
|
17
|
+
"types": "./dist/TableConstants/TableConstants.d.ts",
|
|
18
|
+
"import": "./dist/TableConstants/TableConstants.js"
|
|
19
19
|
},
|
|
20
20
|
"./table": {
|
|
21
|
-
"types": "./dist/
|
|
22
|
-
"import": "./dist/
|
|
21
|
+
"types": "./dist/Table/Table.d.ts",
|
|
22
|
+
"import": "./dist/Table/Table.js"
|
|
23
23
|
}
|
|
24
24
|
},
|
|
25
25
|
"files": [
|
|
@@ -28,13 +28,13 @@
|
|
|
28
28
|
],
|
|
29
29
|
"scripts": {
|
|
30
30
|
"build:check": "tsc",
|
|
31
|
-
"build:js": "
|
|
32
|
-
"build:types": "
|
|
33
|
-
"build": "npm-run-all --serial clean build:check build:js
|
|
31
|
+
"build:js": "rslib build",
|
|
32
|
+
"build:types": "echo 'Types now built with rslib'",
|
|
33
|
+
"build": "npm-run-all --serial clean build:check build:js",
|
|
34
34
|
"clean": "rimraf dist tmp coverage",
|
|
35
|
-
"dev:js": "
|
|
36
|
-
"dev:types": "
|
|
37
|
-
"dev": "
|
|
35
|
+
"dev:js": "rslib build --watch",
|
|
36
|
+
"dev:types": "echo 'Types now watched with rslib'",
|
|
37
|
+
"dev": "rslib build --watch",
|
|
38
38
|
"lint": "biome lint src",
|
|
39
39
|
"lint:fix": "biome check src --write --no-errors-on-unmatched",
|
|
40
40
|
"prettier": "biome check --write --no-errors-on-unmatched",
|
|
@@ -58,5 +58,5 @@
|
|
|
58
58
|
"sideEffects": [
|
|
59
59
|
"**/*.css"
|
|
60
60
|
],
|
|
61
|
-
"gitHead": "
|
|
61
|
+
"gitHead": "e260e7a18f24f614e7e93d868c357a5bf2ffd0d9"
|
|
62
62
|
}
|
|
@@ -1,405 +0,0 @@
|
|
|
1
|
-
import { jsxs as _, jsx as l, Fragment as w } from "react/jsx-runtime";
|
|
2
|
-
import { ButtonSort_private as C } from "@versini/ui-button/private";
|
|
3
|
-
import o from "clsx";
|
|
4
|
-
import N, { useContext as y } from "react";
|
|
5
|
-
import { TableCellSortDirections as k } from "../TableConstants/TableConstants.js";
|
|
6
|
-
try {
|
|
7
|
-
window.__VERSINI_UI_ICONS__ || (window.__VERSINI_UI_ICONS__ = {
|
|
8
|
-
version: "4.15.1",
|
|
9
|
-
buildTime: "11/03/2025 07:21 PM EST",
|
|
10
|
-
homepage: "https://github.com/aversini/ui-icons",
|
|
11
|
-
license: "MIT"
|
|
12
|
-
});
|
|
13
|
-
} catch {
|
|
14
|
-
}
|
|
15
|
-
try {
|
|
16
|
-
window.__VERSINI_UI_SVGICON__ || (window.__VERSINI_UI_SVGICON__ = {
|
|
17
|
-
version: "4.3.0",
|
|
18
|
-
buildTime: "11/03/2025 07:21 PM EST",
|
|
19
|
-
homepage: "https://github.com/aversini/ui-icons",
|
|
20
|
-
license: "MIT"
|
|
21
|
-
});
|
|
22
|
-
} catch {
|
|
23
|
-
}
|
|
24
|
-
const x = ({ children: t, fill: r, viewBox: e, className: a, defaultViewBox: s, size: n, title: c, semantic: b = !1, ...i }) => {
|
|
25
|
-
const h = o(n, a);
|
|
26
|
-
return /* @__PURE__ */ _("svg", {
|
|
27
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
28
|
-
className: h,
|
|
29
|
-
viewBox: e || s,
|
|
30
|
-
fill: r || "currentColor",
|
|
31
|
-
role: "img",
|
|
32
|
-
"aria-hidden": !b,
|
|
33
|
-
focusable: !1,
|
|
34
|
-
...i,
|
|
35
|
-
children: [
|
|
36
|
-
c && b && /* @__PURE__ */ l("title", {
|
|
37
|
-
children: c
|
|
38
|
-
}),
|
|
39
|
-
t
|
|
40
|
-
]
|
|
41
|
-
});
|
|
42
|
-
}, S = ({ className: t, viewBox: r, title: e, monotone: a, ...s }) => /* @__PURE__ */ _(x, {
|
|
43
|
-
defaultViewBox: "0 0 576 512",
|
|
44
|
-
size: "size-5",
|
|
45
|
-
viewBox: r,
|
|
46
|
-
className: t,
|
|
47
|
-
title: e || "Sort",
|
|
48
|
-
...s,
|
|
49
|
-
children: [
|
|
50
|
-
/* @__PURE__ */ l("path", {
|
|
51
|
-
d: "M297.4 137.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0l41.3-41.4V448c0 17.7 14.3 32 32 32s32-14.3 32-32V141.3l41.4 41.4c12.5 12.5 32.8 12.5 45.3 0 6.2-6.2 9.4-14.4 9.4-22.6s-3.1-16.4-9.4-22.6l-96-96c-6.3-6.4-14.5-9.5-22.7-9.5s-16.4 3.1-22.6 9.4z",
|
|
52
|
-
opacity: a ? "1" : "0.4"
|
|
53
|
-
}),
|
|
54
|
-
/* @__PURE__ */ l("path", {
|
|
55
|
-
d: "M137.4 470.6c12.5 12.5 32.8 12.5 45.3 0l96-96c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L192 370.7V64c0-17.7-14.3-32-32-32s-32 14.3-32 32v306.7l-41.4-41.3c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3l96 96z"
|
|
56
|
-
})
|
|
57
|
-
]
|
|
58
|
-
}), T = ({ className: t, viewBox: r, title: e, monotone: a, ...s }) => /* @__PURE__ */ _(x, {
|
|
59
|
-
defaultViewBox: "0 0 576 512",
|
|
60
|
-
size: "size-5",
|
|
61
|
-
viewBox: r,
|
|
62
|
-
className: t,
|
|
63
|
-
title: e || "Sort Down",
|
|
64
|
-
...s,
|
|
65
|
-
children: [
|
|
66
|
-
/* @__PURE__ */ l("path", {
|
|
67
|
-
d: "M288 64c0-17.7 14.3-32 32-32h224c17.7 0 32 14.3 32 32s-14.3 32-32 32H320c-17.7 0-32-14.3-32-32m0 128c0-17.7 14.3-32 32-32h160c17.7 0 32 14.3 32 32s-14.3 32-32 32H320c-17.7 0-32-14.3-32-32m0 128c0-17.7 14.3-32 32-32h96c17.7 0 32 14.3 32 32s-14.3 32-32 32h-96c-17.7 0-32-14.3-32-32m0 128c0-17.7 14.3-32 32-32h32c17.7 0 32 14.3 32 32s-14.3 32-32 32h-32c-17.7 0-32-14.3-32-32",
|
|
68
|
-
opacity: a ? "1" : "0.4"
|
|
69
|
-
}),
|
|
70
|
-
/* @__PURE__ */ l("path", {
|
|
71
|
-
d: "M128 480c9 0 17.5-3.8 23.6-10.4l88-96c11.9-13 11.1-33.3-2-45.2s-33.3-11.1-45.2 2L160 365.7V64c0-17.7-14.3-32-32-32S96 46.3 96 64v301.7l-32.4-35.3c-11.9-13-32.2-13.9-45.2-2s-13.9 32.2-2 45.2l88 96c6.1 6.6 14.6 10.4 23.6 10.4"
|
|
72
|
-
})
|
|
73
|
-
]
|
|
74
|
-
}), I = ({ className: t, viewBox: r, title: e, monotone: a, ...s }) => /* @__PURE__ */ _(x, {
|
|
75
|
-
defaultViewBox: "0 0 576 512",
|
|
76
|
-
size: "size-5",
|
|
77
|
-
viewBox: r,
|
|
78
|
-
className: t,
|
|
79
|
-
title: e || "Sort Up",
|
|
80
|
-
...s,
|
|
81
|
-
children: [
|
|
82
|
-
/* @__PURE__ */ l("path", {
|
|
83
|
-
d: "M288 64c0-17.7 14.3-32 32-32h32c17.7 0 32 14.3 32 32s-14.3 32-32 32h-32c-17.7 0-32-14.3-32-32m0 128c0-17.7 14.3-32 32-32h96c17.7 0 32 14.3 32 32s-14.3 32-32 32h-96c-17.7 0-32-14.3-32-32m0 128c0-17.7 14.3-32 32-32h160c17.7 0 32 14.3 32 32s-14.3 32-32 32H320c-17.7 0-32-14.3-32-32m0 128c0-17.7 14.3-32 32-32h224c17.7 0 32 14.3 32 32s-14.3 32-32 32H320c-17.7 0-32-14.3-32-32",
|
|
84
|
-
opacity: a ? "1" : "0.4"
|
|
85
|
-
}),
|
|
86
|
-
/* @__PURE__ */ l("path", {
|
|
87
|
-
d: "M128 32c9 0 17.5 3.8 23.6 10.4l88 96c11.9 13 11.1 33.3-2 45.2s-33.3 11.1-45.2-2L160 146.3V448c0 17.7-14.3 32-32 32s-32-14.3-32-32V146.3l-32.4 35.3c-11.9 13-32.2 13.9-45.2 2s-13.9-32.2-2-45.2l88-96C110.5 35.8 119 32 128 32"
|
|
88
|
-
})
|
|
89
|
-
]
|
|
90
|
-
}), g = N.createContext({
|
|
91
|
-
mode: "light",
|
|
92
|
-
cellWrapper: "thead",
|
|
93
|
-
stickyHeader: !1,
|
|
94
|
-
stickyFooter: !1,
|
|
95
|
-
compact: !1
|
|
96
|
-
}), u = "thead", v = "tfoot", f = "tbody", z = ({ mode: t }) => o(
|
|
97
|
-
"size-8",
|
|
98
|
-
"align-[-0.125em]",
|
|
99
|
-
"border-4",
|
|
100
|
-
"inline-block animate-spin rounded-full border-solid border-current border-r-transparent motion-reduce:animate-[spin_1.5s_linear_infinite]",
|
|
101
|
-
{
|
|
102
|
-
"text-copy-dark": t === "light",
|
|
103
|
-
"text-copy-light": t === "dark",
|
|
104
|
-
"text-copy-dark dark:text-copy-light": t === "alt-system",
|
|
105
|
-
"text-copy-light dark:text-copy-dark": t === "system"
|
|
106
|
-
}
|
|
107
|
-
), E = ({ mode: t }) => ({
|
|
108
|
-
inner: "relative",
|
|
109
|
-
overlay: o(
|
|
110
|
-
"absolute inset-0 z-20 cursor-not-allowed",
|
|
111
|
-
"backdrop-blur-xs bg-white/30 dark:bg-black/30"
|
|
112
|
-
),
|
|
113
|
-
spinnerWrapper: o(
|
|
114
|
-
"absolute z-30 top-0 left-0 right-0 h-[min(100%,100vh)]",
|
|
115
|
-
"flex items-center justify-center",
|
|
116
|
-
"pointer-events-none"
|
|
117
|
-
),
|
|
118
|
-
spinner: z({ mode: t })
|
|
119
|
-
}), R = ({
|
|
120
|
-
mode: t,
|
|
121
|
-
className: r,
|
|
122
|
-
wrapperClassName: e,
|
|
123
|
-
stickyHeader: a,
|
|
124
|
-
stickyFooter: s,
|
|
125
|
-
disabled: n
|
|
126
|
-
}) => {
|
|
127
|
-
const c = n ? E({ mode: t }) : null;
|
|
128
|
-
return {
|
|
129
|
-
overlay: c?.overlay ?? "",
|
|
130
|
-
inner: c?.inner ?? "",
|
|
131
|
-
spinnerWrapper: c?.spinnerWrapper ?? "",
|
|
132
|
-
spinner: c?.spinner ?? "",
|
|
133
|
-
wrapper: o(
|
|
134
|
-
"not-prose relative w-full rounded-lg shadow-md",
|
|
135
|
-
{
|
|
136
|
-
"overflow-x-auto": !a && !s && !n,
|
|
137
|
-
"overflow-y-scroll": (a || s) && !n,
|
|
138
|
-
"overflow-hidden": n,
|
|
139
|
-
"bg-surface-darker": t === "dark" || t === "system",
|
|
140
|
-
"bg-surface-light": t === "light" || t === "alt-system",
|
|
141
|
-
"dark:bg-surface-light": t === "system",
|
|
142
|
-
"dark:bg-surface-darker": t === "alt-system",
|
|
143
|
-
"text-copy-light": t === "dark",
|
|
144
|
-
"text-copy-dark": t === "light",
|
|
145
|
-
"text-copy-light dark:text-copy-dark": t === "system",
|
|
146
|
-
"text-copy-dark dark:text-copy-light": t === "alt-system"
|
|
147
|
-
},
|
|
148
|
-
e
|
|
149
|
-
),
|
|
150
|
-
table: o("my-0 w-full text-left text-sm", r, {
|
|
151
|
-
"text-copy-light": t === "dark",
|
|
152
|
-
"text-copy-dark": t === "light",
|
|
153
|
-
"text-copy-light dark:text-copy-dark": t === "system",
|
|
154
|
-
"text-copy-dark dark:text-copy-light": t === "alt-system"
|
|
155
|
-
}),
|
|
156
|
-
caption: o("py-2 text-sm font-bold", {
|
|
157
|
-
"text-copy-light": t === "dark",
|
|
158
|
-
"text-copy-dark": t === "light",
|
|
159
|
-
"text-copy-light dark:text-copy-dark": t === "system",
|
|
160
|
-
"text-copy-dark dark:text-copy-light": t === "alt-system"
|
|
161
|
-
})
|
|
162
|
-
};
|
|
163
|
-
}, V = ({
|
|
164
|
-
className: t,
|
|
165
|
-
stickyHeader: r,
|
|
166
|
-
mode: e
|
|
167
|
-
}) => o(
|
|
168
|
-
{
|
|
169
|
-
"sticky top-0 z-10": r,
|
|
170
|
-
"shadow-[rgb(190_190_190_/20%)_0_0.5rem_1rem]": r && e === "dark",
|
|
171
|
-
"shadow-[rgb(190_190_190_/20%)_0_0.5rem_1rem] dark:shadow-[rgb(65_65_65_/30%)_0_0.5rem_1rem]": r && e === "system",
|
|
172
|
-
"shadow-[rgb(65_65_65_/30%)_0_0.5rem_1rem]": r && e === "light",
|
|
173
|
-
"shadow-[rgb(65_65_65_/30%)_0_0.5rem_1rem] dark:shadow-[rgb(190_190_190_/20%)_0_0.5rem_1rem]": r && e === "alt-system"
|
|
174
|
-
},
|
|
175
|
-
t
|
|
176
|
-
), W = ({
|
|
177
|
-
className: t,
|
|
178
|
-
stickyFooter: r,
|
|
179
|
-
mode: e
|
|
180
|
-
}) => o(
|
|
181
|
-
{
|
|
182
|
-
"sticky bottom-0 z-10": r,
|
|
183
|
-
"shadow-[rgb(190_190_190_/20%)_0_-0.5rem_1rem]": r && e === "dark",
|
|
184
|
-
"shadow-[rgb(190_190_190_/20%)_0_-0.5rem_1rem] dark:shadow-[rgb(65_65_65_/30%)_0_-0.5rem_1rem]": r && e === "system",
|
|
185
|
-
"shadow-[rgb(65_65_65_/30%)_0_-0.5rem_1rem]": r && e === "light",
|
|
186
|
-
"shadow-[rgb(65_65_65_/30%)_-0_0.5rem_1rem] dark:shadow-[rgb(190_190_190_/20%)_0_-0.5rem_1rem]": r && e === "alt-system"
|
|
187
|
-
},
|
|
188
|
-
t
|
|
189
|
-
), B = ({
|
|
190
|
-
mode: t,
|
|
191
|
-
className: r,
|
|
192
|
-
cellWrapper: e
|
|
193
|
-
}) => e === u || e === v ? o(
|
|
194
|
-
{
|
|
195
|
-
"bg-table-head-dark": t === "dark" || t === "system",
|
|
196
|
-
"bg-table-head-light": t === "light" || t === "alt-system",
|
|
197
|
-
"dark:bg-table-head-light": t === "system",
|
|
198
|
-
"dark:bg-table-head-dark": t === "alt-system"
|
|
199
|
-
},
|
|
200
|
-
r
|
|
201
|
-
) : o(
|
|
202
|
-
"border-b last:border-0",
|
|
203
|
-
{
|
|
204
|
-
"hover:bg-table-dark-odd/50! hover:dark:bg-table-light-odd/50!": t === "alt-system" || t === "light",
|
|
205
|
-
"hover:bg-table-light-odd/50! hover:dark:bg-table-dark-odd/50!": t === "system" || t === "dark",
|
|
206
|
-
"border-table-dark": t === "dark" || t === "system",
|
|
207
|
-
"odd:bg-table-dark-odd even:bg-table-dark-even": t === "dark",
|
|
208
|
-
"border-table-light": t === "light" || t === "alt-system",
|
|
209
|
-
"odd:bg-table-light-odd even:bg-table-light-even": t === "light",
|
|
210
|
-
"dark:border-table-light": t === "system",
|
|
211
|
-
"odd:bg-table-dark-odd even:bg-table-dark-even dark:odd:bg-table-light-odd dark:even:bg-table-light-even": t === "system",
|
|
212
|
-
"dark:border-table-dark": t === "alt-system",
|
|
213
|
-
"odd:bg-table-light-odd even:bg-table-light-even dark:odd:bg-table-dark-odd dark:even:bg-table-dark-even": t === "alt-system"
|
|
214
|
-
},
|
|
215
|
-
r
|
|
216
|
-
), L = ({
|
|
217
|
-
cellWrapper: t,
|
|
218
|
-
className: r,
|
|
219
|
-
compact: e,
|
|
220
|
-
mode: a,
|
|
221
|
-
align: s
|
|
222
|
-
}) => ({
|
|
223
|
-
alignClasses: o({
|
|
224
|
-
"flex justify-start text-left": s === "left",
|
|
225
|
-
"flex justify-center text-center": s === "center",
|
|
226
|
-
"flex justify-end text-right": s === "right"
|
|
227
|
-
}),
|
|
228
|
-
mainClasses: o(
|
|
229
|
-
{
|
|
230
|
-
"text-copy-light": a === "dark" || a === "system",
|
|
231
|
-
"text-copy-dark": a === "light" || a === "alt-system",
|
|
232
|
-
"dark:text-copy-dark": a === "system",
|
|
233
|
-
"dark:text-copy-light": a === "alt-system",
|
|
234
|
-
"px-4 py-3": !e && (t === u || t === v),
|
|
235
|
-
"p-4": !e && t === f,
|
|
236
|
-
"px-2 py-1.5": e
|
|
237
|
-
},
|
|
238
|
-
r
|
|
239
|
-
)
|
|
240
|
-
}), M = ({
|
|
241
|
-
buttonClassName: t
|
|
242
|
-
}) => o("rounded-none text-sm", t), H = ({
|
|
243
|
-
children: t,
|
|
244
|
-
mode: r = "system",
|
|
245
|
-
caption: e,
|
|
246
|
-
compact: a,
|
|
247
|
-
disabled: s = !1,
|
|
248
|
-
summary: n,
|
|
249
|
-
className: c,
|
|
250
|
-
wrapperClassName: b,
|
|
251
|
-
maxHeight: i,
|
|
252
|
-
stickyHeader: h,
|
|
253
|
-
stickyFooter: p,
|
|
254
|
-
...m
|
|
255
|
-
}) => {
|
|
256
|
-
const d = R({
|
|
257
|
-
mode: r,
|
|
258
|
-
className: c,
|
|
259
|
-
wrapperClassName: b,
|
|
260
|
-
stickyHeader: h,
|
|
261
|
-
stickyFooter: p,
|
|
262
|
-
disabled: s
|
|
263
|
-
});
|
|
264
|
-
return /* @__PURE__ */ l(
|
|
265
|
-
g.Provider,
|
|
266
|
-
{
|
|
267
|
-
value: { mode: r, stickyHeader: h, stickyFooter: p, compact: a },
|
|
268
|
-
children: /* @__PURE__ */ l(
|
|
269
|
-
"div",
|
|
270
|
-
{
|
|
271
|
-
className: d.wrapper,
|
|
272
|
-
...i && {
|
|
273
|
-
style: { maxHeight: i }
|
|
274
|
-
},
|
|
275
|
-
children: s ? /* @__PURE__ */ _(w, { children: [
|
|
276
|
-
/* @__PURE__ */ l("div", { className: d.spinnerWrapper, children: /* @__PURE__ */ l("div", { className: d.spinner, role: "status", children: /* @__PURE__ */ l("span", { className: "sr-only", children: "Loading..." }) }) }),
|
|
277
|
-
/* @__PURE__ */ _("div", { className: d.inner, children: [
|
|
278
|
-
/* @__PURE__ */ l("div", { className: d.overlay }),
|
|
279
|
-
/* @__PURE__ */ _(
|
|
280
|
-
"table",
|
|
281
|
-
{
|
|
282
|
-
className: d.table,
|
|
283
|
-
summary: n,
|
|
284
|
-
...s && { "aria-disabled": "true" },
|
|
285
|
-
...m,
|
|
286
|
-
children: [
|
|
287
|
-
e && /* @__PURE__ */ l("caption", { className: d.caption, children: e }),
|
|
288
|
-
t
|
|
289
|
-
]
|
|
290
|
-
}
|
|
291
|
-
)
|
|
292
|
-
] })
|
|
293
|
-
] }) : /* @__PURE__ */ _("table", { className: d.table, summary: n, ...m, children: [
|
|
294
|
-
e && /* @__PURE__ */ l("caption", { className: d.caption, children: e }),
|
|
295
|
-
t
|
|
296
|
-
] })
|
|
297
|
-
}
|
|
298
|
-
)
|
|
299
|
-
}
|
|
300
|
-
);
|
|
301
|
-
}, F = ({
|
|
302
|
-
children: t,
|
|
303
|
-
className: r,
|
|
304
|
-
...e
|
|
305
|
-
}) => {
|
|
306
|
-
const a = y(g);
|
|
307
|
-
a.cellWrapper = u;
|
|
308
|
-
const s = V({
|
|
309
|
-
className: r,
|
|
310
|
-
mode: a.mode,
|
|
311
|
-
stickyHeader: a.stickyHeader
|
|
312
|
-
});
|
|
313
|
-
return /* @__PURE__ */ l("thead", { className: s, ...e, children: t });
|
|
314
|
-
}, G = ({
|
|
315
|
-
children: t,
|
|
316
|
-
className: r,
|
|
317
|
-
...e
|
|
318
|
-
}) => {
|
|
319
|
-
const a = y(g);
|
|
320
|
-
a.cellWrapper = v;
|
|
321
|
-
const s = W({
|
|
322
|
-
className: r,
|
|
323
|
-
mode: a.mode,
|
|
324
|
-
stickyFooter: a.stickyFooter
|
|
325
|
-
});
|
|
326
|
-
return /* @__PURE__ */ l("tfoot", { className: s, ...e, children: t });
|
|
327
|
-
}, Y = ({ children: t, ...r }) => {
|
|
328
|
-
const e = y(g);
|
|
329
|
-
return e.cellWrapper = f, /* @__PURE__ */ l("tbody", { ...r, children: t });
|
|
330
|
-
}, q = ({
|
|
331
|
-
children: t,
|
|
332
|
-
className: r,
|
|
333
|
-
...e
|
|
334
|
-
}) => {
|
|
335
|
-
const a = y(g), s = B({
|
|
336
|
-
mode: a.mode,
|
|
337
|
-
cellWrapper: a.cellWrapper,
|
|
338
|
-
className: r
|
|
339
|
-
});
|
|
340
|
-
return /* @__PURE__ */ l("tr", { className: s, ...e, children: t });
|
|
341
|
-
}, O = ({
|
|
342
|
-
children: t,
|
|
343
|
-
component: r,
|
|
344
|
-
className: e,
|
|
345
|
-
align: a,
|
|
346
|
-
...s
|
|
347
|
-
}) => {
|
|
348
|
-
const n = y(g), c = r || (n.cellWrapper === u ? "th" : "td"), { mainClasses: b, alignClasses: i } = L({
|
|
349
|
-
cellWrapper: n.cellWrapper,
|
|
350
|
-
className: e,
|
|
351
|
-
mode: n.mode,
|
|
352
|
-
compact: n.compact,
|
|
353
|
-
align: a
|
|
354
|
-
});
|
|
355
|
-
return a ? /* @__PURE__ */ l(c, { className: b, ...s, children: /* @__PURE__ */ l("div", { className: i, children: t }) }) : /* @__PURE__ */ l(c, { className: b, ...s, children: t });
|
|
356
|
-
}, J = ({
|
|
357
|
-
align: t,
|
|
358
|
-
children: r,
|
|
359
|
-
buttonClassName: e,
|
|
360
|
-
className: a,
|
|
361
|
-
component: s,
|
|
362
|
-
focusMode: n = "alt-system",
|
|
363
|
-
mode: c = "alt-system",
|
|
364
|
-
onClick: b,
|
|
365
|
-
sortDirection: i,
|
|
366
|
-
sortedCell: h,
|
|
367
|
-
cellId: p,
|
|
368
|
-
...m
|
|
369
|
-
}) => {
|
|
370
|
-
const d = M({ buttonClassName: e });
|
|
371
|
-
return /* @__PURE__ */ l(
|
|
372
|
-
O,
|
|
373
|
-
{
|
|
374
|
-
component: s,
|
|
375
|
-
className: a,
|
|
376
|
-
role: "columnheader",
|
|
377
|
-
"aria-sort": i === k.ASC && h === p ? "ascending" : i === k.DESC && h === p ? "descending" : "other",
|
|
378
|
-
...m,
|
|
379
|
-
children: /* @__PURE__ */ l(
|
|
380
|
-
C,
|
|
381
|
-
{
|
|
382
|
-
active: h === p,
|
|
383
|
-
className: d,
|
|
384
|
-
onClick: b,
|
|
385
|
-
align: t,
|
|
386
|
-
noBorder: !0,
|
|
387
|
-
focusMode: n,
|
|
388
|
-
mode: c,
|
|
389
|
-
fullWidth: !0,
|
|
390
|
-
labelRight: r,
|
|
391
|
-
children: i === k.ASC && h === p ? /* @__PURE__ */ l(I, { className: "size-4", monotone: !0 }) : i === k.DESC && h === p ? /* @__PURE__ */ l(T, { className: "size-4", monotone: !0 }) : /* @__PURE__ */ l(S, { className: "size-4", monotone: !0 })
|
|
392
|
-
}
|
|
393
|
-
)
|
|
394
|
-
}
|
|
395
|
-
);
|
|
396
|
-
};
|
|
397
|
-
export {
|
|
398
|
-
H as Table,
|
|
399
|
-
Y as TableBody,
|
|
400
|
-
O as TableCell,
|
|
401
|
-
J as TableCellSort,
|
|
402
|
-
G as TableFooter,
|
|
403
|
-
F as TableHead,
|
|
404
|
-
q as TableRow
|
|
405
|
-
};
|