@gridui/table 2.0.1 → 3.1.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/README.md +21 -4
- package/dist/data-table/table-types.d.ts +12 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +76 -33
- package/dist/index.js.map +2 -2
- package/dist/styles.css +107 -57
- package/docs/catalog.json +21 -4
- package/docs/reference/README.md +5 -0
- package/docs/reference/data-table-placeholder.md +123 -0
- package/docs/reference/data-table.md +135 -0
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
# @gridui/table
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Data family. Public API: `DataTable`, `DataTableBlockEdges`, `DataTableColumn`, `DataTableColumnGroup`, `DataTableInlineEdges`, `DataTablePlaceholder`, `DataTablePlaceholderProps`, `DataTableProps`, `DataTableRow`, `DataTableRowDetail`, `DataTableVariant`.
|
|
4
4
|
|
|
5
5
|
Import components from `@gridui/table` and load `@gridui/table/styles.css` after Theme.
|
|
6
6
|
Load styles for any composed dependency used by this family. Applications own routes, labels, state persistence, and branding.
|
|
7
7
|
|
|
8
|
-
See [component ownership](https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/docs/component-ownership.md) and [release history](https://github.com/sudo-ui/GridUI-React-Monorepo/tree/main/packages-
|
|
8
|
+
See [component ownership](https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/docs/component-ownership.md) and [release history](https://github.com/sudo-ui/GridUI-React-Monorepo/tree/main/packages-data/table/.changeset/history).
|
|
9
9
|
|
|
10
10
|
## Data presentation
|
|
11
11
|
|
|
12
12
|
Related families and their ownership are listed in the
|
|
13
13
|
[component ownership map](https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/docs/component-ownership.md).
|
|
14
14
|
|
|
15
|
-
`@gridui/table` owns DataTable and geometry-preserving table placeholders. Metric
|
|
15
|
+
`@gridui/table` owns DataTable and geometry-preserving table placeholders. Metric and data cells have their own Data families. Loading surfaces, notices, and rail profiles remain Core families.
|
|
16
16
|
DataTable provides a named,
|
|
17
17
|
keyboard-focusable horizontal scroll region, scoped column headers, optional
|
|
18
18
|
initial rows, and a stable tbody ID. Each `DataTableColumn` defines its `label`,
|
|
@@ -33,7 +33,7 @@ the same values and responsive syntax, defaulting to `"both"`. This includes
|
|
|
33
33
|
grouped headers and empty tables. For a flush table whose enclosing frame owns
|
|
34
34
|
all four edges, set both edge props to `"none"`; restore `"both"` at the
|
|
35
35
|
breakpoint where table-row padding returns. Internal cell lines remain visible.
|
|
36
|
-
It accepts a scalar or `{ base, md?, lg? }`, using 40rem and 64rem breakpoints
|
|
36
|
+
It accepts a scalar or `{ base, sm?, md?, lg? }`, using 40rem, 48rem, and 64rem breakpoints
|
|
37
37
|
and inheriting omitted values. Callers declare matching table-row padding;
|
|
38
38
|
DataTable does not infer its enclosing layout.
|
|
39
39
|
|
|
@@ -76,3 +76,20 @@ Each row may include a `detail` with a unique nonempty `id` and `content`.
|
|
|
76
76
|
Details render in a native row immediately after their owner and span all
|
|
77
77
|
visible columns. Applications supply expansion buttons with `aria-expanded`
|
|
78
78
|
and `aria-controls`, stable row keys, and the expanded detail content.
|
|
79
|
+
|
|
80
|
+
[Component reference](docs/reference/README.md) contains focused API pages for each public component.
|
|
81
|
+
|
|
82
|
+
## Independent presentation and totals
|
|
83
|
+
|
|
84
|
+
Optional rowLines and columnLines control internal separators independently.
|
|
85
|
+
Header/body and footer boundaries remain structural separators. density accepts
|
|
86
|
+
compact or comfortable; headerSurface and rowHeaderSurface accept plain or muted.
|
|
87
|
+
Explicit options override the corresponding editorial/structured default.
|
|
88
|
+
striped tracks records rather than physical rows, so expanded details retain the
|
|
89
|
+
owner's stripe. rows may carry selected for presentation; callers own controls
|
|
90
|
+
and selection semantics. Selected and striped surfaces also cover sticky cells.
|
|
91
|
+
|
|
92
|
+
footerRows supplies keyed cell arrays for a native tfoot. Footer cells follow
|
|
93
|
+
column order, numeric alignment, sizing, sticky offsets and external-edge rules.
|
|
94
|
+
No aggregation is performed. Footer keys must be unique and every footer row
|
|
95
|
+
must match the columns. DataTablePlaceholder accepts the same presentation props.
|
|
@@ -30,8 +30,18 @@ export type DataTableRow = {
|
|
|
30
30
|
readonly key?: Key;
|
|
31
31
|
readonly cells: readonly ReactNode[];
|
|
32
32
|
readonly detail?: DataTableRowDetail;
|
|
33
|
+
readonly selected?: boolean;
|
|
33
34
|
};
|
|
34
|
-
export type
|
|
35
|
+
export type DataTablePresentation = {
|
|
36
|
+
readonly rowLines?: boolean;
|
|
37
|
+
readonly columnLines?: boolean;
|
|
38
|
+
readonly density?: "comfortable" | "compact";
|
|
39
|
+
readonly headerSurface?: "plain" | "muted";
|
|
40
|
+
readonly rowHeaderSurface?: "plain" | "muted";
|
|
41
|
+
readonly striped?: boolean;
|
|
42
|
+
};
|
|
43
|
+
export type DataTableFooterRow = Pick<DataTableRow, "key" | "cells">;
|
|
44
|
+
export type DataTableOptions = DataTablePresentation & Omit<ComponentPropsWithRef<"table">, "children"> & {
|
|
35
45
|
readonly label: string;
|
|
36
46
|
readonly columns: readonly DataTableColumn[];
|
|
37
47
|
readonly columnGroups?: readonly DataTableColumnGroup[];
|
|
@@ -39,6 +49,7 @@ export type DataTableOptions = Omit<ComponentPropsWithRef<"table">, "children">
|
|
|
39
49
|
readonly bodyId?: string;
|
|
40
50
|
readonly rows?: readonly DataTableRow[];
|
|
41
51
|
readonly rowHeader?: boolean;
|
|
52
|
+
readonly footerRows?: readonly DataTableFooterRow[];
|
|
42
53
|
readonly minWidth?: CSSProperties["minWidth"];
|
|
43
54
|
readonly blockEdges?: Responsive<DataTableBlockEdges>;
|
|
44
55
|
readonly inlineEdges?: Responsive<DataTableInlineEdges>;
|
package/dist/index.d.ts
CHANGED
|
@@ -13,5 +13,6 @@ export type { DataTableInlineEdges } from "./data-table/table-types";
|
|
|
13
13
|
export type { DataTableVariant } from "./data-table/table-types";
|
|
14
14
|
export type { DataTableRowDetail } from "./data-table/table-types";
|
|
15
15
|
export type { DataTableRow } from "./data-table/table-types";
|
|
16
|
+
export type { DataTableFooterRow, DataTablePresentation } from "./data-table/table-types";
|
|
16
17
|
export type { DataTablePlaceholderProps } from "./data-table-placeholder/data-table-placeholder";
|
|
17
18
|
export { DataTablePlaceholder } from "./data-table-placeholder/data-table-placeholder";
|
package/dist/index.js
CHANGED
|
@@ -8,25 +8,14 @@ var tableScrollStyles = cva(cn(
|
|
|
8
8
|
var tableStyles = cva(cn(
|
|
9
9
|
"gridui-table",
|
|
10
10
|
"gridui-u-table--w-full gridui-u-table--border-collapse gridui-u-table--type-data gridui-u-table--text-left gridui-u-table--text-foreground gridui-u-table--bg-background",
|
|
11
|
-
"gridui-u-table--[&>thead>tr>th]:text-left gridui-u-table--[&>thead>tr>th]:text-muted gridui-u-table--[&>thead>tr>th]:font-medium
|
|
12
|
-
"gridui-u-table--[&>:is(thead,tbody
|
|
13
|
-
"gridui-u-table--[&>:is(thead,tbody)>tr>:is(th,td):first-child]:[border-inline-start-width:var(--gridui-table-inline-edge-width)] gridui-u-table--[&>:is(thead,tbody)>tr>:is(th,td):last-child]:[border-inline-end-width:var(--gridui-table-inline-edge-width)]",
|
|
14
|
-
"gridui-u-table--[&>thead>tr:first-child>th]:[border-block-start-width:var(--gridui-table-block-edge-width)]",
|
|
15
|
-
"gridui-u-table--[&>tbody>tr:last-child>:is(th,td)]:[border-block-end-width:var(--gridui-table-block-edge-width)]",
|
|
16
|
-
"gridui-u-table--[&:has(>_tbody:empty)_>_thead_>_tr:last-child_>_th]:[border-block-end-width:var(--gridui-table-block-edge-width)]",
|
|
11
|
+
"gridui-u-table--[&>thead>tr>th]:text-left gridui-u-table--[&>thead>tr>th]:text-muted gridui-u-table--[&>thead>tr>th]:font-medium",
|
|
12
|
+
"gridui-u-table--[&>:is(thead,tbody,tfoot)>tr>:is(th,td)]:align-middle gridui-u-table--[&>:is(thead,tbody,tfoot)>tr>:is(th,td)]:wrap-anywhere",
|
|
17
13
|
"gridui-u-table--[&>tbody>tr>th]:text-left gridui-u-table--[&>tbody>tr>th]:font-normal",
|
|
18
|
-
"gridui-u-table--[&>
|
|
19
|
-
"gridui-u-table--[
|
|
20
|
-
"gridui-u-table--[&>:is(thead,tbody)>tr>.gridui-table-numeric]:text-right gridui-u-table--[&>:is(thead,tbody)>tr>.gridui-table-numeric]:tabular-nums"
|
|
21
|
-
));
|
|
22
|
-
var tableEditorialStyles = cva(cn(
|
|
23
|
-
"gridui-table-editorial",
|
|
24
|
-
"gridui-u-table--[&>tbody>tr>:is(th,td)]:py-gridui-24"
|
|
25
|
-
));
|
|
26
|
-
var tableStructuredStyles = cva(cn(
|
|
27
|
-
"gridui-table-structured",
|
|
28
|
-
"gridui-u-table--[&>tbody>tr>th]:bg-surface"
|
|
14
|
+
"gridui-u-table--[&>thead>.gridui-table-groups>th]:text-left gridui-u-table--[&>thead>.gridui-table-groups>th]:text-foreground gridui-u-table--[&>thead>.gridui-table-groups>th]:type-eyebrow",
|
|
15
|
+
"gridui-u-table--[&>:is(thead,tbody,tfoot)>tr>.gridui-table-numeric]:text-right gridui-u-table--[&>:is(thead,tbody,tfoot)>tr>.gridui-table-numeric]:tabular-nums"
|
|
29
16
|
));
|
|
17
|
+
var tableEditorialStyles = cva(cn("gridui-table-editorial"));
|
|
18
|
+
var tableStructuredStyles = cva(cn("gridui-table-structured"));
|
|
30
19
|
var tableVariants = cva(tableStyles(), {
|
|
31
20
|
variants: {
|
|
32
21
|
variant: {
|
|
@@ -54,6 +43,13 @@ var DataTable = (props) => {
|
|
|
54
43
|
bodyId,
|
|
55
44
|
rows = [],
|
|
56
45
|
rowHeader = false,
|
|
46
|
+
footerRows = [],
|
|
47
|
+
rowLines,
|
|
48
|
+
columnLines,
|
|
49
|
+
density,
|
|
50
|
+
headerSurface,
|
|
51
|
+
rowHeaderSurface,
|
|
52
|
+
striped = false,
|
|
57
53
|
minWidth,
|
|
58
54
|
inlineEdges = "both",
|
|
59
55
|
blockEdges = "both",
|
|
@@ -71,7 +67,10 @@ var DataTable = (props) => {
|
|
|
71
67
|
if (new Set(rowKeys).size !== rowKeys.length) {
|
|
72
68
|
throw new Error("DataTable row keys must be unique.");
|
|
73
69
|
}
|
|
74
|
-
if (
|
|
70
|
+
if ([
|
|
71
|
+
...rows,
|
|
72
|
+
...footerRows
|
|
73
|
+
].some((row) => {
|
|
75
74
|
return row.cells.length !== columns.length;
|
|
76
75
|
})) {
|
|
77
76
|
throw new RangeError("DataTable rows must match the declared columns.");
|
|
@@ -83,6 +82,12 @@ var DataTable = (props) => {
|
|
|
83
82
|
}, 0) !== columns.length)) {
|
|
84
83
|
throw new Error("DataTable column groups must cover every column with positive integer spans.");
|
|
85
84
|
}
|
|
85
|
+
const footerKeys = footerRows.map((row, index) => {
|
|
86
|
+
return row.key === void 0 ? `position:${index}` : `key:${String(row.key)}`;
|
|
87
|
+
});
|
|
88
|
+
if (new Set(footerKeys).size !== footerKeys.length) {
|
|
89
|
+
throw new Error("DataTable footer row keys must be unique.");
|
|
90
|
+
}
|
|
86
91
|
const detailIds = rows.flatMap((row) => {
|
|
87
92
|
return row.detail ? [row.detail.id] : [];
|
|
88
93
|
});
|
|
@@ -127,10 +132,17 @@ var DataTable = (props) => {
|
|
|
127
132
|
{
|
|
128
133
|
...restProps,
|
|
129
134
|
"aria-label": label,
|
|
135
|
+
"data-row-lines": rowLines,
|
|
136
|
+
"data-column-lines": columnLines,
|
|
137
|
+
"data-density": density,
|
|
138
|
+
"data-header-surface": headerSurface,
|
|
139
|
+
"data-row-header-surface": rowHeaderSurface,
|
|
130
140
|
"data-block-edges": block.base,
|
|
141
|
+
"data-block-edges-sm": block.sm,
|
|
131
142
|
"data-block-edges-md": block.md,
|
|
132
143
|
"data-block-edges-lg": block.lg,
|
|
133
144
|
"data-inline-edges": edges.base,
|
|
145
|
+
"data-inline-edges-sm": edges.sm,
|
|
134
146
|
"data-inline-edges-md": edges.md,
|
|
135
147
|
"data-inline-edges-lg": edges.lg,
|
|
136
148
|
style: {
|
|
@@ -192,24 +204,33 @@ var DataTable = (props) => {
|
|
|
192
204
|
Fragment,
|
|
193
205
|
{
|
|
194
206
|
children: [
|
|
195
|
-
/* @__PURE__ */ jsx(
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
207
|
+
/* @__PURE__ */ jsx(
|
|
208
|
+
"tr",
|
|
209
|
+
{
|
|
210
|
+
"data-selected": row.selected || void 0,
|
|
211
|
+
"data-striped": striped && index % 2 === 1 || void 0,
|
|
212
|
+
children: cells.map((cell, cellIndex) => {
|
|
213
|
+
const Cell = rowHeader && cellIndex === 0 ? "th" : "td";
|
|
214
|
+
return /* @__PURE__ */ jsx(
|
|
215
|
+
Cell,
|
|
216
|
+
{
|
|
217
|
+
scope: Cell === "th" ? "row" : void 0,
|
|
218
|
+
style: columnStyle(columns[cellIndex]),
|
|
219
|
+
"data-sticky": columns[cellIndex]?.sticky,
|
|
220
|
+
className: columns[cellIndex]?.numeric ? "gridui-table-numeric" : void 0,
|
|
221
|
+
children: cell
|
|
222
|
+
},
|
|
223
|
+
columnKeys[cellIndex]
|
|
224
|
+
);
|
|
225
|
+
})
|
|
226
|
+
}
|
|
227
|
+
),
|
|
209
228
|
detail && /* @__PURE__ */ jsx(
|
|
210
229
|
"tr",
|
|
211
230
|
{
|
|
212
231
|
id: detail.id,
|
|
232
|
+
"data-selected": row.selected || void 0,
|
|
233
|
+
"data-striped": striped && index % 2 === 1 || void 0,
|
|
213
234
|
className: "gridui-table-detail",
|
|
214
235
|
children: /* @__PURE__ */ jsx(
|
|
215
236
|
"td",
|
|
@@ -226,7 +247,29 @@ var DataTable = (props) => {
|
|
|
226
247
|
);
|
|
227
248
|
})
|
|
228
249
|
}
|
|
229
|
-
)
|
|
250
|
+
),
|
|
251
|
+
footerRows.length > 0 && /* @__PURE__ */ jsx("tfoot", { children: footerRows.map((row, index) => {
|
|
252
|
+
return /* @__PURE__ */ jsx(
|
|
253
|
+
"tr",
|
|
254
|
+
{
|
|
255
|
+
children: row.cells.map((cell, cellIndex) => {
|
|
256
|
+
const Cell = cellIndex === 0 ? "th" : "td";
|
|
257
|
+
return /* @__PURE__ */ jsx(
|
|
258
|
+
Cell,
|
|
259
|
+
{
|
|
260
|
+
scope: cellIndex === 0 ? "row" : void 0,
|
|
261
|
+
style: columnStyle(columns[cellIndex]),
|
|
262
|
+
"data-sticky": columns[cellIndex]?.sticky,
|
|
263
|
+
className: columns[cellIndex]?.numeric ? "gridui-table-numeric" : void 0,
|
|
264
|
+
children: cell
|
|
265
|
+
},
|
|
266
|
+
columnKeys[cellIndex]
|
|
267
|
+
);
|
|
268
|
+
})
|
|
269
|
+
},
|
|
270
|
+
footerKeys[index]
|
|
271
|
+
);
|
|
272
|
+
}) })
|
|
230
273
|
]
|
|
231
274
|
}
|
|
232
275
|
)
|
package/dist/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/data-table/style.ts", "../src/data-table/data-table.tsx", "../src/data-table-placeholder/style.ts", "../src/data-table-placeholder/data-table-placeholder.tsx"],
|
|
4
|
-
"sourcesContent": ["/**\n * @author WMXPY\n * @package Table\n * @namespace DataTable\n * @description Style\n */\n\nimport { cn } from \"@gridui/style-utils\";\nimport { cva } from \"class-variance-authority\";\n\nexport const tableScrollStyles = cva(cn(\n \"gridui-table-scroll\",\n \"gridui-u-table--min-w-0 gridui-u-table--max-w-full gridui-u-table--overflow-x-auto\",\n));\n\nexport const tableStyles = cva(cn(\n \"gridui-table\",\n \"gridui-u-table--w-full gridui-u-table--border-collapse gridui-u-table--type-data gridui-u-table--text-left gridui-u-table--text-foreground gridui-u-table--bg-background\",\n \"gridui-u-table--[&>thead>tr>th]:text-left gridui-u-table--[&>thead>tr>th]:text-muted gridui-u-table--[&>thead>tr>th]:font-medium gridui-u-table--[&>thead>tr>th]:bg-surface\",\n \"gridui-u-table--[&>:is(thead,tbody)>tr>:is(th,td)]:p-gridui-16 gridui-u-table--[&>:is(thead,tbody)>tr>:is(th,td)]:border gridui-u-table--[&>:is(thead,tbody)>tr>:is(th,td)]:border-solid gridui-u-table--[&>:is(thead,tbody)>tr>:is(th,td)]:border-border gridui-u-table--[&>:is(thead,tbody)>tr>:is(th,td)]:align-middle gridui-u-table--[&>:is(thead,tbody)>tr>:is(th,td)]:wrap-anywhere\",\n \"gridui-u-table--[&>:is(thead,tbody)>tr>:is(th,td):first-child]:[border-inline-start-width:var(--gridui-table-inline-edge-width)] gridui-u-table--[&>:is(thead,tbody)>tr>:is(th,td):last-child]:[border-inline-end-width:var(--gridui-table-inline-edge-width)]\",\n \"gridui-u-table--[&>thead>tr:first-child>th]:[border-block-start-width:var(--gridui-table-block-edge-width)]\",\n \"gridui-u-table--[&>tbody>tr:last-child>:is(th,td)]:[border-block-end-width:var(--gridui-table-block-edge-width)]\",\n \"gridui-u-table--[&:has(>_tbody:empty)_>_thead_>_tr:last-child_>_th]:[border-block-end-width:var(--gridui-table-block-edge-width)]\",\n \"gridui-u-table--[&>tbody>tr>th]:text-left gridui-u-table--[&>tbody>tr>th]:font-normal\",\n \"gridui-u-table--[&>tbody>tr:hover>:is(th,td)]:bg-surface\",\n \"gridui-u-table--[&>thead>.gridui-table-groups>th]:py-gridui-8 gridui-u-table--[&>thead>.gridui-table-groups>th]:text-left gridui-u-table--[&>thead>.gridui-table-groups>th]:text-foreground gridui-u-table--[&>thead>.gridui-table-groups>th]:bg-brand-tint gridui-u-table--[&>thead>.gridui-table-groups>th]:type-eyebrow\",\n \"gridui-u-table--[&>:is(thead,tbody)>tr>.gridui-table-numeric]:text-right gridui-u-table--[&>:is(thead,tbody)>tr>.gridui-table-numeric]:tabular-nums\",\n));\n\nexport const tableEditorialStyles = cva(cn(\n \"gridui-table-editorial\",\n \"gridui-u-table--[&>tbody>tr>:is(th,td)]:py-gridui-24\",\n));\n\nexport const tableStructuredStyles = cva(cn(\n \"gridui-table-structured\",\n \"gridui-u-table--[&>tbody>tr>th]:bg-surface\",\n));\n\nexport const tableVariants = cva(tableStyles(), {\n variants: {\n variant: {\n editorial: tableEditorialStyles(),\n structured: tableStructuredStyles(),\n },\n },\n defaultVariants: {\n variant: \"editorial\",\n },\n});\n", "/**\n * @author WMXPY\n * @package Table\n * @namespace DataTable\n * @description Data Table\n */\n\nimport { tableScrollStyles, tableVariants } from \"./style\";\nimport type { DataTableColumn, DataTableOptions } from \"./table-types\";\nimport { useInteractionOutline, useScrollbars } from \"@gridui/overlay\";\nimport { cn } from \"@gridui/style-utils\";\nimport { resolveResponsive } from \"@gridui/style-utils/responsive\";\nimport { type CSSProperties, type FC, Fragment } from \"react\";\n\nexport type DataTableProps = DataTableOptions;\n\nexport const DataTable: FC<DataTableProps> = (props: DataTableProps) => {\n const {\n label,\n columns,\n columnGroups,\n variant = \"editorial\",\n bodyId,\n rows = [],\n rowHeader = false,\n minWidth,\n inlineEdges = \"both\",\n blockEdges = \"both\",\n className,\n style,\n ...restProps\n } = props;\n const scrollbarRef = useScrollbars<HTMLDivElement>();\n const ref = useInteractionOutline({ ref: scrollbarRef });\n const block = resolveResponsive(blockEdges);\n const edges = resolveResponsive(inlineEdges);\n const rowKeys = rows.map((row, index) => {\n return row.key === undefined ? `position:${index}` : `key:${String(row.key)}`;\n });\n if (new Set(rowKeys).size !== rowKeys.length) {\n throw new Error(\"DataTable row keys must be unique.\");\n }\n if (rows.some((row) => {\n return row.cells.length !== columns.length;\n })) {\n throw new RangeError(\"DataTable rows must match the declared columns.\");\n }\n if (columnGroups && (columnGroups.some((group) => {\n return !Number.isInteger(group.span) || group.span < 1;\n }) || columnGroups.reduce((total, group) => {\n return total + group.span;\n }, 0) !== columns.length)) {\n throw new Error(\"DataTable column groups must cover every column with positive integer spans.\");\n }\n const detailIds = rows.flatMap(row => {\n return row.detail ? [row.detail.id] : [];\n });\n if (detailIds.length > 0 && columns.length === 0) {\n throw new RangeError(\"DataTable details need at least one column.\");\n }\n if (detailIds.some(id => {\n return !id;\n }) || new Set(detailIds).size !== detailIds.length) {\n throw new Error(\"DataTable detail IDs must be nonempty and unique.\");\n }\n const columnKeys = columns.map((column, index) => {\n return column.key === undefined ? `position:${index}` : `key:${String(column.key)}`;\n });\n if (new Set(columnKeys).size !== columnKeys.length) {\n throw new Error(\"DataTable column keys must be unique.\");\n }\n const columnStyle = (column: DataTableColumn | undefined): CSSProperties | undefined => {\n if (!column?.sticky) {\n return column?.sizing;\n }\n const offset = column.stickyOffset ?? 0;\n if (!Number.isFinite(offset) || offset < 0) {\n throw new RangeError(\"Sticky column offsets must be finite and nonnegative.\");\n }\n return {\n ...column.sizing,\n position: \"sticky\",\n [column.sticky === \"start\" ? \"insetInlineStart\" : \"insetInlineEnd\"]: offset,\n };\n };\n return (<div\n ref={ref}\n className={cn(tableScrollStyles())}\n role=\"region\"\n aria-label={label}\n tabIndex={0}\n >\n <table\n {...restProps}\n aria-label={label}\n data-block-edges={block.base}\n data-block-edges-md={block.md}\n data-block-edges-lg={block.lg}\n data-inline-edges={edges.base}\n data-inline-edges-md={edges.md}\n data-inline-edges-lg={edges.lg}\n style={{\n minWidth,\n ...style,\n }}\n className={cn(tableVariants({\n variant,\n }), className)}\n >\n {columnGroups?.map((group, index) => {\n return (<colgroup\n key={index}\n span={group.span}\n />);\n })}\n <thead>\n {columnGroups && (<tr\n className=\"gridui-table-groups\"\n >\n {columnGroups.map((group, index) => {\n return (<th\n key={index}\n scope=\"colgroup\"\n colSpan={group.span}\n >\n {group.label}\n </th>);\n })}\n </tr>)}\n <tr>\n {columns.map((column, index) => {\n return (<th\n key={columnKeys[index]}\n scope=\"col\"\n style={columnStyle(column)}\n data-sticky={column.sticky}\n className={column.numeric ? \"gridui-table-numeric\" : undefined}\n >\n {column.header ?? column.label}\n </th>);\n })}\n </tr>\n </thead>\n <tbody\n id={bodyId}\n >\n {rows.map((row, index) => {\n const { cells, detail } = row;\n return (<Fragment\n key={rowKeys[index]}\n >\n <tr>\n {cells.map((cell, cellIndex) => {\n const Cell = rowHeader && cellIndex === 0 ? \"th\" : \"td\";\n return (<Cell\n key={columnKeys[cellIndex]}\n scope={Cell === \"th\" ? \"row\" : undefined}\n style={columnStyle(columns[cellIndex])}\n data-sticky={columns[cellIndex]?.sticky}\n className={columns[cellIndex]?.numeric ? \"gridui-table-numeric\" : undefined}\n >\n {cell}\n </Cell>);\n })}\n </tr>\n {detail && (<tr\n id={detail.id}\n className=\"gridui-table-detail\"\n >\n <td\n colSpan={columns.length}\n >\n {detail.content}\n </td>\n </tr>)}\n </Fragment>);\n })}\n </tbody>\n </table>\n </div>);\n};\n", "/**\n * @author WMXPY\n * @package Table\n * @namespace DataTablePlaceholder\n * @description Style\n */\n\nimport { cn } from \"@gridui/style-utils\";\nimport { cva } from \"class-variance-authority\";\n\nexport const tablePlaceholderStyles = cva(cn(\n \"gridui-table-placeholder\",\n \"gridui-u-table--pointer-events-none\",\n));\n", "/**\n * @author WMXPY\n * @package Table\n * @namespace DataTablePlaceholder\n * @description Data Table Placeholder\n */\n\nimport { DataTable } from \"../data-table/data-table\";\nimport type { DataTableOptions } from \"../data-table/table-types\";\nimport { tablePlaceholderStyles } from \"./style\";\nimport { cn } from \"@gridui/style-utils\";\nimport type { FC } from \"react\";\n\nexport type DataTablePlaceholderProps = Omit<DataTableOptions, \"rows\"> & {\n readonly rowCount?: number;\n};\n\nexport const DataTablePlaceholder: FC<DataTablePlaceholderProps> = (props: DataTablePlaceholderProps) => {\n const { rowCount = 5, ...restProps } = props;\n return (<div\n className={cn(tablePlaceholderStyles())}\n aria-hidden=\"true\"\n inert\n >\n <DataTable\n {...restProps}\n rows={Array.from({ length: rowCount }, () => {\n return {\n cells: restProps.columns.map(() => {\n return \"\u2014\";\n }),\n };\n })}\n />\n </div>);\n};\n"],
|
|
5
|
-
"mappings": ";AAOA,SAAS,UAAU;AACnB,SAAS,WAAW;AAEb,IAAM,oBAAoB,IAAI;AAAA,EACjC;AAAA,EACA;AACJ,CAAC;AAEM,IAAM,cAAc,IAAI;AAAA,EAC3B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;
|
|
4
|
+
"sourcesContent": ["/**\n * @author WMXPY\n * @package Table\n * @namespace DataTable\n * @description Style\n */\n\nimport { cn } from \"@gridui/style-utils\";\nimport { cva } from \"class-variance-authority\";\n\nexport const tableScrollStyles = cva(cn(\n \"gridui-table-scroll\",\n \"gridui-u-table--min-w-0 gridui-u-table--max-w-full gridui-u-table--overflow-x-auto\",\n));\n\nexport const tableStyles = cva(cn(\n \"gridui-table\",\n \"gridui-u-table--w-full gridui-u-table--border-collapse gridui-u-table--type-data gridui-u-table--text-left gridui-u-table--text-foreground gridui-u-table--bg-background\",\n \"gridui-u-table--[&>thead>tr>th]:text-left gridui-u-table--[&>thead>tr>th]:text-muted gridui-u-table--[&>thead>tr>th]:font-medium\",\n \"gridui-u-table--[&>:is(thead,tbody,tfoot)>tr>:is(th,td)]:align-middle gridui-u-table--[&>:is(thead,tbody,tfoot)>tr>:is(th,td)]:wrap-anywhere\",\n \"gridui-u-table--[&>tbody>tr>th]:text-left gridui-u-table--[&>tbody>tr>th]:font-normal\",\n \"gridui-u-table--[&>thead>.gridui-table-groups>th]:text-left gridui-u-table--[&>thead>.gridui-table-groups>th]:text-foreground gridui-u-table--[&>thead>.gridui-table-groups>th]:type-eyebrow\",\n \"gridui-u-table--[&>:is(thead,tbody,tfoot)>tr>.gridui-table-numeric]:text-right gridui-u-table--[&>:is(thead,tbody,tfoot)>tr>.gridui-table-numeric]:tabular-nums\",\n));\n\nexport const tableEditorialStyles = cva(cn(\"gridui-table-editorial\"));\n\nexport const tableStructuredStyles = cva(cn(\"gridui-table-structured\"));\n\nexport const tableVariants = cva(tableStyles(), {\n variants: {\n variant: {\n editorial: tableEditorialStyles(),\n structured: tableStructuredStyles(),\n },\n },\n defaultVariants: {\n variant: \"editorial\",\n },\n});\n", "/**\n * @author WMXPY\n * @package Table\n * @namespace DataTable\n * @description Data Table\n */\n\nimport { tableScrollStyles, tableVariants } from \"./style\";\nimport type { DataTableColumn, DataTableOptions } from \"./table-types\";\nimport { useInteractionOutline, useScrollbars } from \"@gridui/overlay\";\nimport { cn } from \"@gridui/style-utils\";\nimport { resolveResponsive } from \"@gridui/style-utils/responsive\";\nimport { type CSSProperties, type FC, Fragment } from \"react\";\n\nexport type DataTableProps = DataTableOptions;\n\nexport const DataTable: FC<DataTableProps> = (props: DataTableProps) => {\n const {\n label,\n columns,\n columnGroups,\n variant = \"editorial\",\n bodyId,\n rows = [],\n rowHeader = false,\n footerRows = [],\n rowLines,\n columnLines,\n density,\n headerSurface,\n rowHeaderSurface,\n striped = false,\n minWidth,\n inlineEdges = \"both\",\n blockEdges = \"both\",\n className,\n style,\n ...restProps\n } = props;\n const scrollbarRef = useScrollbars<HTMLDivElement>();\n const ref = useInteractionOutline({ ref: scrollbarRef });\n const block = resolveResponsive(blockEdges);\n const edges = resolveResponsive(inlineEdges);\n const rowKeys = rows.map((row, index) => {\n return row.key === undefined ? `position:${index}` : `key:${String(row.key)}`;\n });\n if (new Set(rowKeys).size !== rowKeys.length) {\n throw new Error(\"DataTable row keys must be unique.\");\n }\n if ([\n ...rows,\n ...footerRows,\n ].some((row) => {\n return row.cells.length !== columns.length;\n })) {\n throw new RangeError(\"DataTable rows must match the declared columns.\");\n }\n if (columnGroups && (columnGroups.some((group) => {\n return !Number.isInteger(group.span) || group.span < 1;\n }) || columnGroups.reduce((total, group) => {\n return total + group.span;\n }, 0) !== columns.length)) {\n throw new Error(\"DataTable column groups must cover every column with positive integer spans.\");\n }\n const footerKeys = footerRows.map((row, index) => {\n return row.key === undefined ? `position:${index}` : `key:${String(row.key)}`;\n });\n if (new Set(footerKeys).size !== footerKeys.length) {\n throw new Error(\"DataTable footer row keys must be unique.\");\n }\n const detailIds = rows.flatMap(row => {\n return row.detail ? [row.detail.id] : [];\n });\n if (detailIds.length > 0 && columns.length === 0) {\n throw new RangeError(\"DataTable details need at least one column.\");\n }\n if (detailIds.some(id => {\n return !id;\n }) || new Set(detailIds).size !== detailIds.length) {\n throw new Error(\"DataTable detail IDs must be nonempty and unique.\");\n }\n const columnKeys = columns.map((column, index) => {\n return column.key === undefined ? `position:${index}` : `key:${String(column.key)}`;\n });\n if (new Set(columnKeys).size !== columnKeys.length) {\n throw new Error(\"DataTable column keys must be unique.\");\n }\n const columnStyle = (column: DataTableColumn | undefined): CSSProperties | undefined => {\n if (!column?.sticky) {\n return column?.sizing;\n }\n const offset = column.stickyOffset ?? 0;\n if (!Number.isFinite(offset) || offset < 0) {\n throw new RangeError(\"Sticky column offsets must be finite and nonnegative.\");\n }\n return {\n ...column.sizing,\n position: \"sticky\",\n [column.sticky === \"start\" ? \"insetInlineStart\" : \"insetInlineEnd\"]: offset,\n };\n };\n return (<div\n ref={ref}\n className={cn(tableScrollStyles())}\n role=\"region\"\n aria-label={label}\n tabIndex={0}\n >\n <table\n {...restProps}\n aria-label={label}\n data-row-lines={rowLines}\n data-column-lines={columnLines}\n data-density={density}\n data-header-surface={headerSurface}\n data-row-header-surface={rowHeaderSurface}\n data-block-edges={block.base}\n data-block-edges-sm={block.sm}\n data-block-edges-md={block.md}\n data-block-edges-lg={block.lg}\n data-inline-edges={edges.base}\n data-inline-edges-sm={edges.sm}\n data-inline-edges-md={edges.md}\n data-inline-edges-lg={edges.lg}\n style={{\n minWidth,\n ...style,\n }}\n className={cn(tableVariants({\n variant,\n }), className)}\n >\n {columnGroups?.map((group, index) => {\n return (<colgroup\n key={index}\n span={group.span}\n />);\n })}\n <thead>\n {columnGroups && (<tr\n className=\"gridui-table-groups\"\n >\n {columnGroups.map((group, index) => {\n return (<th\n key={index}\n scope=\"colgroup\"\n colSpan={group.span}\n >\n {group.label}\n </th>);\n })}\n </tr>)}\n <tr>\n {columns.map((column, index) => {\n return (<th\n key={columnKeys[index]}\n scope=\"col\"\n style={columnStyle(column)}\n data-sticky={column.sticky}\n className={column.numeric ? \"gridui-table-numeric\" : undefined}\n >\n {column.header ?? column.label}\n </th>);\n })}\n </tr>\n </thead>\n <tbody\n id={bodyId}\n >\n {rows.map((row, index) => {\n const { cells, detail } = row;\n return (<Fragment\n key={rowKeys[index]}\n >\n <tr\n data-selected={row.selected || undefined}\n data-striped={striped && index % 2 === 1 || undefined}\n >\n {cells.map((cell, cellIndex) => {\n const Cell = rowHeader && cellIndex === 0 ? \"th\" : \"td\";\n return (<Cell\n key={columnKeys[cellIndex]}\n scope={Cell === \"th\" ? \"row\" : undefined}\n style={columnStyle(columns[cellIndex])}\n data-sticky={columns[cellIndex]?.sticky}\n className={columns[cellIndex]?.numeric ? \"gridui-table-numeric\" : undefined}\n >\n {cell}\n </Cell>);\n })}\n </tr>\n {detail && (<tr\n id={detail.id}\n data-selected={row.selected || undefined}\n data-striped={striped && index % 2 === 1 || undefined}\n className=\"gridui-table-detail\"\n >\n <td\n colSpan={columns.length}\n >\n {detail.content}\n </td>\n </tr>)}\n </Fragment>);\n })}\n </tbody>\n {footerRows.length > 0 && (<tfoot>\n {footerRows.map((row, index) => {\n return (<tr\n key={footerKeys[index]}\n >\n {row.cells.map((cell, cellIndex) => {\n const Cell = cellIndex === 0 ? \"th\" : \"td\";\n return (<Cell\n key={columnKeys[cellIndex]}\n scope={cellIndex === 0 ? \"row\" : undefined}\n style={columnStyle(columns[cellIndex])}\n data-sticky={columns[cellIndex]?.sticky}\n className={columns[cellIndex]?.numeric ? \"gridui-table-numeric\" : undefined}\n >\n {cell}\n </Cell>);\n })}\n </tr>);\n })}\n </tfoot>)}\n </table>\n </div>);\n};\n", "/**\n * @author WMXPY\n * @package Table\n * @namespace DataTablePlaceholder\n * @description Style\n */\n\nimport { cn } from \"@gridui/style-utils\";\nimport { cva } from \"class-variance-authority\";\n\nexport const tablePlaceholderStyles = cva(cn(\n \"gridui-table-placeholder\",\n \"gridui-u-table--pointer-events-none\",\n));\n", "/**\n * @author WMXPY\n * @package Table\n * @namespace DataTablePlaceholder\n * @description Data Table Placeholder\n */\n\nimport { DataTable } from \"../data-table/data-table\";\nimport type { DataTableOptions } from \"../data-table/table-types\";\nimport { tablePlaceholderStyles } from \"./style\";\nimport { cn } from \"@gridui/style-utils\";\nimport type { FC } from \"react\";\n\nexport type DataTablePlaceholderProps = Omit<DataTableOptions, \"rows\"> & {\n readonly rowCount?: number;\n};\n\nexport const DataTablePlaceholder: FC<DataTablePlaceholderProps> = (props: DataTablePlaceholderProps) => {\n const { rowCount = 5, ...restProps } = props;\n return (<div\n className={cn(tablePlaceholderStyles())}\n aria-hidden=\"true\"\n inert\n >\n <DataTable\n {...restProps}\n rows={Array.from({ length: rowCount }, () => {\n return {\n cells: restProps.columns.map(() => {\n return \"\u2014\";\n }),\n };\n })}\n />\n </div>);\n};\n"],
|
|
5
|
+
"mappings": ";AAOA,SAAS,UAAU;AACnB,SAAS,WAAW;AAEb,IAAM,oBAAoB,IAAI;AAAA,EACjC;AAAA,EACA;AACJ,CAAC;AAEM,IAAM,cAAc,IAAI;AAAA,EAC3B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACJ,CAAC;AAEM,IAAM,uBAAuB,IAAI,GAAG,wBAAwB,CAAC;AAE7D,IAAM,wBAAwB,IAAI,GAAG,yBAAyB,CAAC;AAE/D,IAAM,gBAAgB,IAAI,YAAY,GAAG;AAAA,EAC5C,UAAU;AAAA,IACN,SAAS;AAAA,MACL,WAAW,qBAAqB;AAAA,MAChC,YAAY,sBAAsB;AAAA,IACtC;AAAA,EACJ;AAAA,EACA,iBAAiB;AAAA,IACb,SAAS;AAAA,EACb;AACJ,CAAC;;;AC9BD,SAAS,uBAAuB,qBAAqB;AACrD,SAAS,MAAAA,WAAU;AACnB,SAAS,yBAAyB;AAClC,SAAsC,gBAAgB;AAyH9B,cAKZ,YALY;AArHjB,I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HANGED
|
@@ -40,54 +40,19 @@
|
|
|
40
40
|
.gridui-u-table--text-foreground {
|
|
41
41
|
color: var(--gridui-foreground);
|
|
42
42
|
}
|
|
43
|
-
.gridui-u-table--\[
|
|
44
|
-
border-block-end-width: var(--gridui-table-block-edge-width);
|
|
45
|
-
}
|
|
46
|
-
.gridui-u-table--\[\&\>\:is\(thead\,tbody\)\>tr\>\.gridui-table-numeric\]\:text-right > :is(thead, tbody) > tr > .gridui-table-numeric {
|
|
43
|
+
.gridui-u-table--\[\&\>\:is\(thead\,tbody\,tfoot\)\>tr\>\.gridui-table-numeric\]\:text-right > :is(thead, tbody, tfoot) > tr > .gridui-table-numeric {
|
|
47
44
|
text-align: right;
|
|
48
45
|
}
|
|
49
|
-
.gridui-u-table--\[\&\>\:is\(thead\,tbody\)\>tr\>\.gridui-table-numeric\]\:tabular-nums > :is(thead, tbody) > tr > .gridui-table-numeric {
|
|
46
|
+
.gridui-u-table--\[\&\>\:is\(thead\,tbody\,tfoot\)\>tr\>\.gridui-table-numeric\]\:tabular-nums > :is(thead, tbody, tfoot) > tr > .gridui-table-numeric {
|
|
50
47
|
--tw-numeric-spacing: tabular-nums;
|
|
51
48
|
font-variant-numeric: var(--tw-ordinal, ) var(--tw-slashed-zero, ) var(--tw-numeric-figure, ) var(--tw-numeric-spacing, ) var(--tw-numeric-fraction, );
|
|
52
49
|
}
|
|
53
|
-
.gridui-u-table--\[\&\>\:is\(thead\,tbody\)\>tr\>\:is\(th\,td\)\]\:
|
|
54
|
-
border-style: var(--tw-border-style);
|
|
55
|
-
border-width: 1px;
|
|
56
|
-
}
|
|
57
|
-
.gridui-u-table--\[\&\>\:is\(thead\,tbody\)\>tr\>\:is\(th\,td\)\]\:border-solid > :is(thead, tbody) > tr > :is(th, td) {
|
|
58
|
-
--tw-border-style: solid;
|
|
59
|
-
border-style: solid;
|
|
60
|
-
}
|
|
61
|
-
.gridui-u-table--\[\&\>\:is\(thead\,tbody\)\>tr\>\:is\(th\,td\)\]\:border-border > :is(thead, tbody) > tr > :is(th, td) {
|
|
62
|
-
border-color: var(--gridui-border);
|
|
63
|
-
}
|
|
64
|
-
.gridui-u-table--\[\&\>\:is\(thead\,tbody\)\>tr\>\:is\(th\,td\)\]\:p-gridui-16 > :is(thead, tbody) > tr > :is(th, td) {
|
|
65
|
-
padding: var(--gridui-space-16);
|
|
66
|
-
}
|
|
67
|
-
.gridui-u-table--\[\&\>\:is\(thead\,tbody\)\>tr\>\:is\(th\,td\)\]\:align-middle > :is(thead, tbody) > tr > :is(th, td) {
|
|
50
|
+
.gridui-u-table--\[\&\>\:is\(thead\,tbody\,tfoot\)\>tr\>\:is\(th\,td\)\]\:align-middle > :is(thead, tbody, tfoot) > tr > :is(th, td) {
|
|
68
51
|
vertical-align: middle;
|
|
69
52
|
}
|
|
70
|
-
.gridui-u-table--\[\&\>\:is\(thead\,tbody\)\>tr\>\:is\(th\,td\)\]\:wrap-anywhere > :is(thead, tbody) > tr > :is(th, td) {
|
|
53
|
+
.gridui-u-table--\[\&\>\:is\(thead\,tbody\,tfoot\)\>tr\>\:is\(th\,td\)\]\:wrap-anywhere > :is(thead, tbody, tfoot) > tr > :is(th, td) {
|
|
71
54
|
overflow-wrap: anywhere;
|
|
72
55
|
}
|
|
73
|
-
.gridui-u-table--\[\&\>\:is\(thead\,tbody\)\>tr\>\:is\(th\,td\)\:first-child\]\:\[border-inline-start-width\:var\(--gridui-table-inline-edge-width\)\] > :is(thead, tbody) > tr > :is(th, td):first-child {
|
|
74
|
-
border-inline-start-width: var(--gridui-table-inline-edge-width);
|
|
75
|
-
}
|
|
76
|
-
.gridui-u-table--\[\&\>\:is\(thead\,tbody\)\>tr\>\:is\(th\,td\)\:last-child\]\:\[border-inline-end-width\:var\(--gridui-table-inline-edge-width\)\] > :is(thead, tbody) > tr > :is(th, td):last-child {
|
|
77
|
-
border-inline-end-width: var(--gridui-table-inline-edge-width);
|
|
78
|
-
}
|
|
79
|
-
.gridui-u-table--\[\&\>tbody\>tr\:hover\>\:is\(th\,td\)\]\:bg-surface > tbody > tr:hover > :is(th, td) {
|
|
80
|
-
background-color: var(--gridui-surface);
|
|
81
|
-
}
|
|
82
|
-
.gridui-u-table--\[\&\>tbody\>tr\:last-child\>\:is\(th\,td\)\]\:\[border-block-end-width\:var\(--gridui-table-block-edge-width\)\] > tbody > tr:last-child > :is(th, td) {
|
|
83
|
-
border-block-end-width: var(--gridui-table-block-edge-width);
|
|
84
|
-
}
|
|
85
|
-
.gridui-u-table--\[\&\>tbody\>tr\>\:is\(th\,td\)\]\:py-gridui-24 > tbody > tr > :is(th, td) {
|
|
86
|
-
padding-block: var(--gridui-space-24);
|
|
87
|
-
}
|
|
88
|
-
.gridui-u-table--\[\&\>tbody\>tr\>th\]\:bg-surface > tbody > tr > th {
|
|
89
|
-
background-color: var(--gridui-surface);
|
|
90
|
-
}
|
|
91
56
|
.gridui-u-table--\[\&\>tbody\>tr\>th\]\:text-left > tbody > tr > th {
|
|
92
57
|
text-align: left;
|
|
93
58
|
}
|
|
@@ -95,12 +60,6 @@
|
|
|
95
60
|
--tw-font-weight: var(--font-weight-normal);
|
|
96
61
|
font-weight: var(--font-weight-normal);
|
|
97
62
|
}
|
|
98
|
-
.gridui-u-table--\[\&\>thead\>\.gridui-table-groups\>th\]\:bg-brand-tint > thead > .gridui-table-groups > th {
|
|
99
|
-
background-color: var(--gridui-brand-tint);
|
|
100
|
-
}
|
|
101
|
-
.gridui-u-table--\[\&\>thead\>\.gridui-table-groups\>th\]\:py-gridui-8 > thead > .gridui-table-groups > th {
|
|
102
|
-
padding-block: var(--gridui-space-8);
|
|
103
|
-
}
|
|
104
63
|
.gridui-u-table--\[\&\>thead\>\.gridui-table-groups\>th\]\:text-left > thead > .gridui-table-groups > th {
|
|
105
64
|
text-align: left;
|
|
106
65
|
}
|
|
@@ -111,12 +70,6 @@
|
|
|
111
70
|
.gridui-u-table--\[\&\>thead\>\.gridui-table-groups\>th\]\:text-foreground > thead > .gridui-table-groups > th {
|
|
112
71
|
color: var(--gridui-foreground);
|
|
113
72
|
}
|
|
114
|
-
.gridui-u-table--\[\&\>thead\>tr\:first-child\>th\]\:\[border-block-start-width\:var\(--gridui-table-block-edge-width\)\] > thead > tr:first-child > th {
|
|
115
|
-
border-block-start-width: var(--gridui-table-block-edge-width);
|
|
116
|
-
}
|
|
117
|
-
.gridui-u-table--\[\&\>thead\>tr\>th\]\:bg-surface > thead > tr > th {
|
|
118
|
-
background-color: var(--gridui-surface);
|
|
119
|
-
}
|
|
120
73
|
.gridui-u-table--\[\&\>thead\>tr\>th\]\:text-left > thead > tr > th {
|
|
121
74
|
text-align: left;
|
|
122
75
|
}
|
|
@@ -129,13 +82,54 @@
|
|
|
129
82
|
}
|
|
130
83
|
}
|
|
131
84
|
@layer components {
|
|
85
|
+
.gridui-table > :is(thead, tbody, tfoot) > tr > :is(th, td) {
|
|
86
|
+
padding: 1rem;
|
|
87
|
+
border: 1px solid var(--gridui-border);
|
|
88
|
+
}
|
|
89
|
+
.gridui-table > :is(thead, tbody, tfoot) > tr > :is(th, td):first-child {
|
|
90
|
+
border-inline-start-width: var(--gridui-table-inline-edge-width);
|
|
91
|
+
}
|
|
92
|
+
.gridui-table > :is(thead, tbody, tfoot) > tr > :is(th, td):last-child {
|
|
93
|
+
border-inline-end-width: var(--gridui-table-inline-edge-width);
|
|
94
|
+
}
|
|
95
|
+
.gridui-table > thead > tr > th {
|
|
96
|
+
background: var(--gridui-surface);
|
|
97
|
+
}
|
|
98
|
+
.gridui-table-editorial > tbody > tr > :is(th, td) {
|
|
99
|
+
padding-block: 1.5rem;
|
|
100
|
+
}
|
|
101
|
+
.gridui-table-structured > tbody > tr > th, .gridui-table > tbody > tr:hover > :is(th, td) {
|
|
102
|
+
background: var(--gridui-surface);
|
|
103
|
+
}
|
|
104
|
+
.gridui-table > thead > .gridui-table-groups > th {
|
|
105
|
+
padding-block: 0.5rem;
|
|
106
|
+
background: var(--gridui-brand-tint);
|
|
107
|
+
}
|
|
108
|
+
.gridui-table > thead > tr:first-child > th {
|
|
109
|
+
border-block-start-width: var(--gridui-table-block-edge-width);
|
|
110
|
+
}
|
|
111
|
+
.gridui-table > tbody > tr:last-child > :is(th, td), .gridui-table:has(> tbody:empty) > thead > tr:last-child > th {
|
|
112
|
+
border-block-end-width: var(--gridui-table-block-edge-width);
|
|
113
|
+
}
|
|
132
114
|
.gridui-table {
|
|
133
115
|
--gridui-table-inline-edge-width: 1px;
|
|
116
|
+
--gridui-table-selection-offset: 2px;
|
|
117
|
+
}
|
|
118
|
+
.gridui-table:dir(rtl) {
|
|
119
|
+
--gridui-table-selection-offset: -2px;
|
|
134
120
|
}
|
|
135
121
|
.gridui-table[data-inline-edges="none"] {
|
|
136
122
|
--gridui-table-inline-edge-width: 0px;
|
|
137
123
|
}
|
|
138
124
|
@media (min-width: 40rem) {
|
|
125
|
+
.gridui-table[data-inline-edges-sm="both"] {
|
|
126
|
+
--gridui-table-inline-edge-width: 1px;
|
|
127
|
+
}
|
|
128
|
+
.gridui-table[data-inline-edges-sm="none"] {
|
|
129
|
+
--gridui-table-inline-edge-width: 0px;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
@media (min-width: 48rem) {
|
|
139
133
|
.gridui-table[data-inline-edges-md="both"] {
|
|
140
134
|
--gridui-table-inline-edge-width: 1px;
|
|
141
135
|
}
|
|
@@ -158,6 +152,14 @@
|
|
|
158
152
|
--gridui-table-block-edge-width: 0px;
|
|
159
153
|
}
|
|
160
154
|
@media (min-width: 40rem) {
|
|
155
|
+
.gridui-table[data-block-edges-sm="both"] {
|
|
156
|
+
--gridui-table-block-edge-width: 1px;
|
|
157
|
+
}
|
|
158
|
+
.gridui-table[data-block-edges-sm="none"] {
|
|
159
|
+
--gridui-table-block-edge-width: 0px;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
@media (min-width: 48rem) {
|
|
161
163
|
.gridui-table[data-block-edges-md="both"] {
|
|
162
164
|
--gridui-table-block-edge-width: 1px;
|
|
163
165
|
}
|
|
@@ -180,6 +182,60 @@
|
|
|
180
182
|
.gridui-table > thead > tr > [data-sticky] {
|
|
181
183
|
z-index: 2;
|
|
182
184
|
}
|
|
185
|
+
.gridui-table[data-density="compact"] > :is(thead, tbody, tfoot) > tr > :is(th, td) {
|
|
186
|
+
padding-block: 0.5rem;
|
|
187
|
+
}
|
|
188
|
+
.gridui-table[data-density="comfortable"] > :is(thead, tbody, tfoot) > tr > :is(th, td) {
|
|
189
|
+
padding-block: 1.5rem;
|
|
190
|
+
}
|
|
191
|
+
.gridui-table[data-row-lines="false"] > tbody > tr:not(:last-child) > :is(th, td) {
|
|
192
|
+
border-block-end-width: 0;
|
|
193
|
+
}
|
|
194
|
+
.gridui-table[data-row-lines="false"] > tbody > tr:not(:first-child) > :is(th, td) {
|
|
195
|
+
border-block-start-width: 0;
|
|
196
|
+
}
|
|
197
|
+
.gridui-table[data-column-lines="false"] > :is(thead, tbody, tfoot) > tr > :is(th, td):not(:first-child) {
|
|
198
|
+
border-inline-start-width: 0;
|
|
199
|
+
}
|
|
200
|
+
.gridui-table[data-column-lines="false"] > :is(thead, tbody, tfoot) > tr > :is(th, td):not(:last-child) {
|
|
201
|
+
border-inline-end-width: 0;
|
|
202
|
+
}
|
|
203
|
+
.gridui-table[data-header-surface="plain"] > thead > tr > th {
|
|
204
|
+
background: var(--gridui-background);
|
|
205
|
+
}
|
|
206
|
+
.gridui-table[data-header-surface="muted"] > thead > tr > th {
|
|
207
|
+
background: var(--gridui-surface);
|
|
208
|
+
}
|
|
209
|
+
.gridui-table[data-row-header-surface="plain"] > tbody > tr > th {
|
|
210
|
+
background: var(--gridui-background);
|
|
211
|
+
}
|
|
212
|
+
.gridui-table[data-row-header-surface="muted"] > tbody > tr > th {
|
|
213
|
+
background: var(--gridui-surface);
|
|
214
|
+
}
|
|
215
|
+
.gridui-table > tbody > tr[data-striped] > :is(th, td) {
|
|
216
|
+
background: var(--gridui-surface);
|
|
217
|
+
}
|
|
218
|
+
.gridui-table > tbody > tr[data-selected] > :is(th, td) {
|
|
219
|
+
background: var(--gridui-accent-background);
|
|
220
|
+
@supports (color: color-mix(in lab, red, red)) {
|
|
221
|
+
background: color-mix(in srgb, var(--gridui-accent-background) 10%, var(--gridui-background));
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
.gridui-table > tbody > tr[data-selected] > :is(th, td):first-child {
|
|
225
|
+
box-shadow: inset var(--gridui-table-selection-offset) 0 var(--gridui-accent-background);
|
|
226
|
+
}
|
|
227
|
+
.gridui-table > tfoot > tr > :is(th, td) {
|
|
228
|
+
background: var(--gridui-surface);
|
|
229
|
+
}
|
|
230
|
+
.gridui-table > tfoot > tr > [data-sticky] {
|
|
231
|
+
z-index: 1;
|
|
232
|
+
}
|
|
233
|
+
.gridui-table:has(> tfoot) > tbody > tr:last-child > :is(th, td), .gridui-table:has(> tfoot):has(> tbody:empty) > thead > tr:last-child > th {
|
|
234
|
+
border-block-end-width: 1px;
|
|
235
|
+
}
|
|
236
|
+
.gridui-table > tfoot > tr:last-child > :is(th, td) {
|
|
237
|
+
border-block-end-width: var(--gridui-table-block-edge-width);
|
|
238
|
+
}
|
|
183
239
|
}
|
|
184
240
|
@property --tw-ordinal {
|
|
185
241
|
syntax: "*";
|
|
@@ -201,11 +257,6 @@
|
|
|
201
257
|
syntax: "*";
|
|
202
258
|
inherits: false;
|
|
203
259
|
}
|
|
204
|
-
@property --tw-border-style {
|
|
205
|
-
syntax: "*";
|
|
206
|
-
inherits: false;
|
|
207
|
-
initial-value: solid;
|
|
208
|
-
}
|
|
209
260
|
@property --tw-font-weight {
|
|
210
261
|
syntax: "*";
|
|
211
262
|
inherits: false;
|
|
@@ -218,7 +269,6 @@
|
|
|
218
269
|
--tw-numeric-figure: initial;
|
|
219
270
|
--tw-numeric-spacing: initial;
|
|
220
271
|
--tw-numeric-fraction: initial;
|
|
221
|
-
--tw-border-style: solid;
|
|
222
272
|
--tw-font-weight: initial;
|
|
223
273
|
}
|
|
224
274
|
}
|
package/docs/catalog.json
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": 1,
|
|
3
3
|
"name": "@gridui/table",
|
|
4
|
-
"version": "
|
|
5
|
-
"category": "
|
|
4
|
+
"version": "3.1.0",
|
|
5
|
+
"category": "data",
|
|
6
6
|
"description": "GridUI React table",
|
|
7
7
|
"usage": "Related families and their ownership are listed in the component ownership map.",
|
|
8
8
|
"documentation": [
|
|
9
|
-
"README.md"
|
|
9
|
+
"README.md",
|
|
10
|
+
"docs/reference/README.md",
|
|
11
|
+
"docs/reference/data-table-placeholder.md",
|
|
12
|
+
"docs/reference/data-table.md"
|
|
10
13
|
],
|
|
11
14
|
"exports": [
|
|
12
15
|
{
|
|
@@ -29,6 +32,11 @@
|
|
|
29
32
|
"kind": "type",
|
|
30
33
|
"importPath": "@gridui/table"
|
|
31
34
|
},
|
|
35
|
+
{
|
|
36
|
+
"name": "DataTableFooterRow",
|
|
37
|
+
"kind": "type",
|
|
38
|
+
"importPath": "@gridui/table"
|
|
39
|
+
},
|
|
32
40
|
{
|
|
33
41
|
"name": "DataTableInlineEdges",
|
|
34
42
|
"kind": "type",
|
|
@@ -44,6 +52,11 @@
|
|
|
44
52
|
"kind": "type",
|
|
45
53
|
"importPath": "@gridui/table"
|
|
46
54
|
},
|
|
55
|
+
{
|
|
56
|
+
"name": "DataTablePresentation",
|
|
57
|
+
"kind": "type",
|
|
58
|
+
"importPath": "@gridui/table"
|
|
59
|
+
},
|
|
47
60
|
{
|
|
48
61
|
"name": "DataTableProps",
|
|
49
62
|
"kind": "type",
|
|
@@ -71,6 +84,10 @@
|
|
|
71
84
|
"@gridui/table/styles.css"
|
|
72
85
|
],
|
|
73
86
|
"examples": [
|
|
74
|
-
"https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-
|
|
87
|
+
"https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-data/table/stories/getting-started.mdx",
|
|
88
|
+
"https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-data/table/stories/loading-details.mdx",
|
|
89
|
+
"https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-data/table/stories/readable-tables.mdx",
|
|
90
|
+
"https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-data/table/stories/wide-tables.mdx",
|
|
91
|
+
"https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-data/table/stories/data-table.stories.tsx"
|
|
75
92
|
]
|
|
76
93
|
}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
<!-- Generated from public Props and owned stories. Run pnpm docs:storybook. -->
|
|
2
|
+
# DataTablePlaceholder
|
|
3
|
+
|
|
4
|
+
Compose DataTablePlaceholder with DataTable inside the same @gridui/table component family.
|
|
5
|
+
|
|
6
|
+
Import from ``@gridui/table`` and load Theme before this family's stylesheet.
|
|
7
|
+
|
|
8
|
+
```tsx
|
|
9
|
+
import { DataTablePlaceholder } from "@gridui/table";
|
|
10
|
+
import "@gridui/theme/styles.css";
|
|
11
|
+
import "@gridui/table/styles.css";
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
Read the [package contract](https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-data/table/README.md) for shared behavior and stylesheet dependencies.
|
|
15
|
+
|
|
16
|
+
The [working composition](https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-data/table/stories/data-table.stories.tsx) demonstrates required context, state, and related components. Use View code in Storybook to inspect the actual implementation.
|
|
17
|
+
|
|
18
|
+
## API
|
|
19
|
+
|
|
20
|
+
The public Props type is the source of these signatures. Defaults below are explicit implementation defaults; story presets are separate. Native attributes remain available through the exported Props type.
|
|
21
|
+
|
|
22
|
+
### label
|
|
23
|
+
|
|
24
|
+
``string`` · Required
|
|
25
|
+
|
|
26
|
+
### variant
|
|
27
|
+
|
|
28
|
+
``DataTableVariant | undefined`` · Optional
|
|
29
|
+
|
|
30
|
+
Visual variant.
|
|
31
|
+
|
|
32
|
+
### onFocus
|
|
33
|
+
|
|
34
|
+
``(event: FocusEvent<HTMLTableElement, Element>): void`` · Optional
|
|
35
|
+
|
|
36
|
+
Called when the corresponding interaction occurs; inspect the arguments in Actions.
|
|
37
|
+
|
|
38
|
+
### onBlur
|
|
39
|
+
|
|
40
|
+
``(event: FocusEvent<HTMLTableElement, Element>): void`` · Optional
|
|
41
|
+
|
|
42
|
+
Called when the corresponding interaction occurs; inspect the arguments in Actions.
|
|
43
|
+
|
|
44
|
+
### onChange
|
|
45
|
+
|
|
46
|
+
``(event: ChangeEvent<HTMLTableElement, Element>): void`` · Optional
|
|
47
|
+
|
|
48
|
+
Called when the corresponding interaction occurs; inspect the arguments in Actions.
|
|
49
|
+
|
|
50
|
+
### onSubmit
|
|
51
|
+
|
|
52
|
+
``(event: SubmitEvent<HTMLTableElement>): void`` · Optional
|
|
53
|
+
|
|
54
|
+
Called when the corresponding interaction occurs; inspect the arguments in Actions.
|
|
55
|
+
|
|
56
|
+
### onClick
|
|
57
|
+
|
|
58
|
+
``(event: MouseEvent<HTMLTableElement, MouseEvent>): void`` · Optional
|
|
59
|
+
|
|
60
|
+
Called when the corresponding interaction occurs; inspect the arguments in Actions.
|
|
61
|
+
|
|
62
|
+
### minWidth
|
|
63
|
+
|
|
64
|
+
``Property.MinWidth<string | number> | undefined`` · Optional
|
|
65
|
+
|
|
66
|
+
### rowLines
|
|
67
|
+
|
|
68
|
+
``boolean | undefined`` · Optional
|
|
69
|
+
|
|
70
|
+
### columnLines
|
|
71
|
+
|
|
72
|
+
``boolean | undefined`` · Optional
|
|
73
|
+
|
|
74
|
+
### density
|
|
75
|
+
|
|
76
|
+
``"compact" | "comfortable" | undefined`` · Optional
|
|
77
|
+
|
|
78
|
+
### headerSurface
|
|
79
|
+
|
|
80
|
+
``"plain" | "muted" | undefined`` · Optional
|
|
81
|
+
|
|
82
|
+
### rowHeaderSurface
|
|
83
|
+
|
|
84
|
+
``"plain" | "muted" | undefined`` · Optional
|
|
85
|
+
|
|
86
|
+
### striped
|
|
87
|
+
|
|
88
|
+
``boolean | undefined`` · Optional
|
|
89
|
+
|
|
90
|
+
### columns
|
|
91
|
+
|
|
92
|
+
``readonly DataTableColumn[]`` · Required
|
|
93
|
+
|
|
94
|
+
### columnGroups
|
|
95
|
+
|
|
96
|
+
``readonly DataTableColumnGroup[] | undefined`` · Optional
|
|
97
|
+
|
|
98
|
+
### bodyId
|
|
99
|
+
|
|
100
|
+
``string | undefined`` · Optional
|
|
101
|
+
|
|
102
|
+
### rowHeader
|
|
103
|
+
|
|
104
|
+
``boolean | undefined`` · Optional
|
|
105
|
+
|
|
106
|
+
### footerRows
|
|
107
|
+
|
|
108
|
+
``readonly DataTableFooterRow[] | undefined`` · Optional
|
|
109
|
+
|
|
110
|
+
### blockEdges
|
|
111
|
+
|
|
112
|
+
``Responsive<DataTableBlockEdges> | undefined`` · Optional
|
|
113
|
+
|
|
114
|
+
### inlineEdges
|
|
115
|
+
|
|
116
|
+
``Responsive<DataTableInlineEdges> | undefined`` · Optional
|
|
117
|
+
|
|
118
|
+
### rowCount
|
|
119
|
+
|
|
120
|
+
``number | undefined`` · Optional
|
|
121
|
+
|
|
122
|
+
Default: ``5``
|
|
123
|
+
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
<!-- Generated from public Props and owned stories. Run pnpm docs:storybook. -->
|
|
2
|
+
# DataTable
|
|
3
|
+
|
|
4
|
+
Displays structured records in rows and columns. Use it for information users need to scan and compare across shared fields.
|
|
5
|
+
|
|
6
|
+
Import from ``@gridui/table`` and load Theme before this family's stylesheet.
|
|
7
|
+
|
|
8
|
+
```tsx
|
|
9
|
+
import { DataTable } from "@gridui/table";
|
|
10
|
+
import "@gridui/theme/styles.css";
|
|
11
|
+
import "@gridui/table/styles.css";
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
Read the [package contract](https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-data/table/README.md) for shared behavior and stylesheet dependencies.
|
|
15
|
+
|
|
16
|
+
The [working composition](https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-data/table/stories/data-table.stories.tsx) demonstrates required context, state, and related components. Use View code in Storybook to inspect the actual implementation.
|
|
17
|
+
|
|
18
|
+
## API
|
|
19
|
+
|
|
20
|
+
The public Props type is the source of these signatures. Defaults below are explicit implementation defaults; story presets are separate. Native attributes remain available through the exported Props type.
|
|
21
|
+
|
|
22
|
+
### rowLines
|
|
23
|
+
|
|
24
|
+
``boolean | undefined`` · Optional
|
|
25
|
+
|
|
26
|
+
### columnLines
|
|
27
|
+
|
|
28
|
+
``boolean | undefined`` · Optional
|
|
29
|
+
|
|
30
|
+
### density
|
|
31
|
+
|
|
32
|
+
``"compact" | "comfortable" | undefined`` · Optional
|
|
33
|
+
|
|
34
|
+
### headerSurface
|
|
35
|
+
|
|
36
|
+
``"plain" | "muted" | undefined`` · Optional
|
|
37
|
+
|
|
38
|
+
### rowHeaderSurface
|
|
39
|
+
|
|
40
|
+
``"plain" | "muted" | undefined`` · Optional
|
|
41
|
+
|
|
42
|
+
### striped
|
|
43
|
+
|
|
44
|
+
``boolean | undefined`` · Optional
|
|
45
|
+
|
|
46
|
+
Default: ``false``
|
|
47
|
+
|
|
48
|
+
### onFocus
|
|
49
|
+
|
|
50
|
+
``(event: FocusEvent<HTMLTableElement, Element>): void`` · Optional
|
|
51
|
+
|
|
52
|
+
Called when the corresponding interaction occurs; inspect the arguments in Actions.
|
|
53
|
+
|
|
54
|
+
### onBlur
|
|
55
|
+
|
|
56
|
+
``(event: FocusEvent<HTMLTableElement, Element>): void`` · Optional
|
|
57
|
+
|
|
58
|
+
Called when the corresponding interaction occurs; inspect the arguments in Actions.
|
|
59
|
+
|
|
60
|
+
### onChange
|
|
61
|
+
|
|
62
|
+
``(event: ChangeEvent<HTMLTableElement, Element>): void`` · Optional
|
|
63
|
+
|
|
64
|
+
Called when the corresponding interaction occurs; inspect the arguments in Actions.
|
|
65
|
+
|
|
66
|
+
### onSubmit
|
|
67
|
+
|
|
68
|
+
``(event: SubmitEvent<HTMLTableElement>): void`` · Optional
|
|
69
|
+
|
|
70
|
+
Called when the corresponding interaction occurs; inspect the arguments in Actions.
|
|
71
|
+
|
|
72
|
+
### onClick
|
|
73
|
+
|
|
74
|
+
``(event: MouseEvent<HTMLTableElement, MouseEvent>): void`` · Optional
|
|
75
|
+
|
|
76
|
+
Called when the corresponding interaction occurs; inspect the arguments in Actions.
|
|
77
|
+
|
|
78
|
+
### label
|
|
79
|
+
|
|
80
|
+
``string`` · Required
|
|
81
|
+
|
|
82
|
+
### columns
|
|
83
|
+
|
|
84
|
+
``readonly DataTableColumn[]`` · Required
|
|
85
|
+
|
|
86
|
+
### columnGroups
|
|
87
|
+
|
|
88
|
+
``readonly DataTableColumnGroup[] | undefined`` · Optional
|
|
89
|
+
|
|
90
|
+
### variant
|
|
91
|
+
|
|
92
|
+
``DataTableVariant | undefined`` · Optional
|
|
93
|
+
|
|
94
|
+
Default: ``"editorial"``
|
|
95
|
+
|
|
96
|
+
Visual variant.
|
|
97
|
+
|
|
98
|
+
### bodyId
|
|
99
|
+
|
|
100
|
+
``string | undefined`` · Optional
|
|
101
|
+
|
|
102
|
+
### rows
|
|
103
|
+
|
|
104
|
+
``readonly DataTableRow[] | undefined`` · Optional
|
|
105
|
+
|
|
106
|
+
Default: ``[]``
|
|
107
|
+
|
|
108
|
+
### rowHeader
|
|
109
|
+
|
|
110
|
+
``boolean | undefined`` · Optional
|
|
111
|
+
|
|
112
|
+
Default: ``false``
|
|
113
|
+
|
|
114
|
+
### footerRows
|
|
115
|
+
|
|
116
|
+
``readonly DataTableFooterRow[] | undefined`` · Optional
|
|
117
|
+
|
|
118
|
+
Default: ``[]``
|
|
119
|
+
|
|
120
|
+
### minWidth
|
|
121
|
+
|
|
122
|
+
``Property.MinWidth<string | number> | undefined`` · Optional
|
|
123
|
+
|
|
124
|
+
### blockEdges
|
|
125
|
+
|
|
126
|
+
``Responsive<DataTableBlockEdges> | undefined`` · Optional
|
|
127
|
+
|
|
128
|
+
Default: ``"both"``
|
|
129
|
+
|
|
130
|
+
### inlineEdges
|
|
131
|
+
|
|
132
|
+
``Responsive<DataTableInlineEdges> | undefined`` · Optional
|
|
133
|
+
|
|
134
|
+
Default: ``"both"``
|
|
135
|
+
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gridui/table",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.1.0",
|
|
4
4
|
"description": "GridUI React table",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"type": "module",
|
|
@@ -27,15 +27,15 @@
|
|
|
27
27
|
"react-dom": "^19.2.0"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@gridui/overlay": "^2.
|
|
31
|
-
"@gridui/style-utils": "^
|
|
32
|
-
"@gridui/theme": "^2.5.
|
|
30
|
+
"@gridui/overlay": "^2.1.0",
|
|
31
|
+
"@gridui/style-utils": "^4.0.0",
|
|
32
|
+
"@gridui/theme": "^2.5.4",
|
|
33
33
|
"class-variance-authority": "0.7.1"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@gridui-internal/configuration": "0.0.0-internal",
|
|
37
|
-
"@gridui/data-cell": "1.0
|
|
38
|
-
"@gridui/loading-surface": "1.1.
|
|
37
|
+
"@gridui/data-cell": "1.1.0",
|
|
38
|
+
"@gridui/loading-surface": "1.1.5",
|
|
39
39
|
"@jest/globals": "30.5.2",
|
|
40
40
|
"@storybook/react-vite": "10.6.6",
|
|
41
41
|
"@types/jest": "30.0.0",
|