@gridui/table 3.0.0 → 3.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,18 +1,18 @@
1
1
  # @gridui/table
2
2
 
3
- Core family. Public API: `DataTable`, `DataTableBlockEdges`, `DataTableColumn`, `DataTableColumnGroup`, `DataTableInlineEdges`, `DataTablePlaceholder`, `DataTablePlaceholderProps`, `DataTableProps`, `DataTableRow`, `DataTableRowDetail`, `DataTableVariant`.
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-core/table/.changeset/history).
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, data cells, loading surfaces, notices, and rail profiles each have their own Core family.
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`,
@@ -78,3 +78,18 @@ visible columns. Applications supply expansion buttons with `aria-expanded`
78
78
  and `aria-controls`, stable row keys, and the expanded detail content.
79
79
 
80
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.
@@ -6,6 +6,10 @@
6
6
  */
7
7
  export declare const tableScrollStyles: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
8
8
  export declare const tableStyles: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
9
+ export declare const tableCellStyles: (props?: ({
10
+ numeric?: boolean | null | undefined;
11
+ sticky?: "start" | "end" | null | undefined;
12
+ } & import("class-variance-authority/types").ClassProp) | undefined) => string;
9
13
  export declare const tableEditorialStyles: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
10
14
  export declare const tableStructuredStyles: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
11
15
  export declare const tableVariants: (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 DataTableOptions = Omit<ComponentPropsWithRef<"table">, "children"> & {
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,27 @@ 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 gridui-u-table--[&>thead>tr>th]:bg-surface",
12
- "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",
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--[&>tbody>tr:hover>:is(th,td)]:bg-surface",
19
- "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",
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 tableCellStyles = cva("", {
18
+ variants: {
19
+ numeric: {
20
+ false: null,
21
+ true: "gridui-table-numeric"
22
+ },
23
+ sticky: {
24
+ start: "gridui-u-table--[--gridui-table-cell-position:sticky] gridui-u-table--[--gridui-table-cell-start:var(--gridui-table-cell-offset)]",
25
+ end: "gridui-u-table--[--gridui-table-cell-position:sticky] gridui-u-table--[--gridui-table-cell-end:var(--gridui-table-cell-offset)]"
26
+ }
27
+ },
28
+ defaultVariants: { numeric: false }
29
+ });
30
+ var tableEditorialStyles = cva(cn("gridui-table-editorial"));
31
+ var tableStructuredStyles = cva(cn("gridui-table-structured"));
30
32
  var tableVariants = cva(tableStyles(), {
31
33
  variants: {
32
34
  variant: {
@@ -54,6 +56,13 @@ var DataTable = (props) => {
54
56
  bodyId,
55
57
  rows = [],
56
58
  rowHeader = false,
59
+ footerRows = [],
60
+ rowLines,
61
+ columnLines,
62
+ density,
63
+ headerSurface,
64
+ rowHeaderSurface,
65
+ striped = false,
57
66
  minWidth,
58
67
  inlineEdges = "both",
59
68
  blockEdges = "both",
@@ -71,7 +80,10 @@ var DataTable = (props) => {
71
80
  if (new Set(rowKeys).size !== rowKeys.length) {
72
81
  throw new Error("DataTable row keys must be unique.");
73
82
  }
74
- if (rows.some((row) => {
83
+ if ([
84
+ ...rows,
85
+ ...footerRows
86
+ ].some((row) => {
75
87
  return row.cells.length !== columns.length;
76
88
  })) {
77
89
  throw new RangeError("DataTable rows must match the declared columns.");
@@ -83,6 +95,12 @@ var DataTable = (props) => {
83
95
  }, 0) !== columns.length)) {
84
96
  throw new Error("DataTable column groups must cover every column with positive integer spans.");
85
97
  }
98
+ const footerKeys = footerRows.map((row, index) => {
99
+ return row.key === void 0 ? `position:${index}` : `key:${String(row.key)}`;
100
+ });
101
+ if (new Set(footerKeys).size !== footerKeys.length) {
102
+ throw new Error("DataTable footer row keys must be unique.");
103
+ }
86
104
  const detailIds = rows.flatMap((row) => {
87
105
  return row.detail ? [row.detail.id] : [];
88
106
  });
@@ -110,8 +128,13 @@ var DataTable = (props) => {
110
128
  }
111
129
  return {
112
130
  ...column.sizing,
113
- position: "sticky",
114
- [column.sticky === "start" ? "insetInlineStart" : "insetInlineEnd"]: offset
131
+ "--gridui-table-cell-offset": `${offset}px`,
132
+ position: "var(--gridui-table-cell-position)",
133
+ ...column.sticky === "start" ? {
134
+ insetInlineStart: "var(--gridui-table-cell-start)"
135
+ } : {
136
+ insetInlineEnd: "var(--gridui-table-cell-end)"
137
+ }
115
138
  };
116
139
  };
117
140
  return /* @__PURE__ */ jsx(
@@ -127,6 +150,11 @@ var DataTable = (props) => {
127
150
  {
128
151
  ...restProps,
129
152
  "aria-label": label,
153
+ "data-row-lines": rowLines,
154
+ "data-column-lines": columnLines,
155
+ "data-density": density,
156
+ "data-header-surface": headerSurface,
157
+ "data-row-header-surface": rowHeaderSurface,
130
158
  "data-block-edges": block.base,
131
159
  "data-block-edges-sm": block.sm,
132
160
  "data-block-edges-md": block.md,
@@ -177,7 +205,10 @@ var DataTable = (props) => {
177
205
  scope: "col",
178
206
  style: columnStyle(column),
179
207
  "data-sticky": column.sticky,
180
- className: column.numeric ? "gridui-table-numeric" : void 0,
208
+ className: tableCellStyles({
209
+ numeric: column.numeric,
210
+ sticky: column.sticky
211
+ }) || void 0,
181
212
  children: column.header ?? column.label
182
213
  },
183
214
  columnKeys[index]
@@ -194,24 +225,36 @@ var DataTable = (props) => {
194
225
  Fragment,
195
226
  {
196
227
  children: [
197
- /* @__PURE__ */ jsx("tr", { children: cells.map((cell, cellIndex) => {
198
- const Cell = rowHeader && cellIndex === 0 ? "th" : "td";
199
- return /* @__PURE__ */ jsx(
200
- Cell,
201
- {
202
- scope: Cell === "th" ? "row" : void 0,
203
- style: columnStyle(columns[cellIndex]),
204
- "data-sticky": columns[cellIndex]?.sticky,
205
- className: columns[cellIndex]?.numeric ? "gridui-table-numeric" : void 0,
206
- children: cell
207
- },
208
- columnKeys[cellIndex]
209
- );
210
- }) }),
228
+ /* @__PURE__ */ jsx(
229
+ "tr",
230
+ {
231
+ "data-selected": row.selected || void 0,
232
+ "data-striped": striped && index % 2 === 1 || void 0,
233
+ children: cells.map((cell, cellIndex) => {
234
+ const Cell = rowHeader && cellIndex === 0 ? "th" : "td";
235
+ return /* @__PURE__ */ jsx(
236
+ Cell,
237
+ {
238
+ scope: Cell === "th" ? "row" : void 0,
239
+ style: columnStyle(columns[cellIndex]),
240
+ "data-sticky": columns[cellIndex]?.sticky,
241
+ className: tableCellStyles({
242
+ numeric: columns[cellIndex]?.numeric,
243
+ sticky: columns[cellIndex]?.sticky
244
+ }) || void 0,
245
+ children: cell
246
+ },
247
+ columnKeys[cellIndex]
248
+ );
249
+ })
250
+ }
251
+ ),
211
252
  detail && /* @__PURE__ */ jsx(
212
253
  "tr",
213
254
  {
214
255
  id: detail.id,
256
+ "data-selected": row.selected || void 0,
257
+ "data-striped": striped && index % 2 === 1 || void 0,
215
258
  className: "gridui-table-detail",
216
259
  children: /* @__PURE__ */ jsx(
217
260
  "td",
@@ -228,7 +271,32 @@ var DataTable = (props) => {
228
271
  );
229
272
  })
230
273
  }
231
- )
274
+ ),
275
+ footerRows.length > 0 && /* @__PURE__ */ jsx("tfoot", { children: footerRows.map((row, index) => {
276
+ return /* @__PURE__ */ jsx(
277
+ "tr",
278
+ {
279
+ children: row.cells.map((cell, cellIndex) => {
280
+ const Cell = cellIndex === 0 ? "th" : "td";
281
+ return /* @__PURE__ */ jsx(
282
+ Cell,
283
+ {
284
+ scope: cellIndex === 0 ? "row" : void 0,
285
+ style: columnStyle(columns[cellIndex]),
286
+ "data-sticky": columns[cellIndex]?.sticky,
287
+ className: tableCellStyles({
288
+ numeric: columns[cellIndex]?.numeric,
289
+ sticky: columns[cellIndex]?.sticky
290
+ }) || void 0,
291
+ children: cell
292
+ },
293
+ columnKeys[cellIndex]
294
+ );
295
+ })
296
+ },
297
+ footerKeys[index]
298
+ );
299
+ }) })
232
300
  ]
233
301
  }
234
302
  )
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-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 {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;A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SAAS,MAAAE,WAAU;AAcX,gBAAAC,YAAA;AAPD,IAAM,uBAAsD,CAAC,UAAqC;AACrG,QAAM,EAAE,WAAW,GAAG,GAAG,UAAU,IAAI;AACvC,SAAQ,gBAAAA;AAAA,IAAC;AAAA;AAAA,MACL,WAAWD,IAAG,uBAAuB,CAAC;AAAA,MACtC,eAAY;AAAA,MACZ,OAAK;AAAA,MAEL,0BAAAC;AAAA,QAAC;AAAA;AAAA,UACI,GAAG;AAAA,UACJ,MAAM,MAAM,KAAK,EAAE,QAAQ,SAAS,GAAG,MAAM;AACzC,mBAAO;AAAA,cACH,OAAO,UAAU,QAAQ,IAAI,MAAM;AAC/B,uBAAO;AAAA,cACX,CAAC;AAAA,YACL;AAAA,UACJ,CAAC;AAAA;AAAA,MACL;AAAA;AAAA,EACJ;AACJ;",
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 tableCellStyles = cva(\"\", {\n variants: {\n numeric: {\n false: null,\n true: \"gridui-table-numeric\",\n },\n sticky: {\n start: \"gridui-u-table--[--gridui-table-cell-position:sticky] gridui-u-table--[--gridui-table-cell-start:var(--gridui-table-cell-offset)]\",\n end: \"gridui-u-table--[--gridui-table-cell-position:sticky] gridui-u-table--[--gridui-table-cell-end:var(--gridui-table-cell-offset)]\",\n },\n },\n defaultVariants: { numeric: false },\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 { tableCellStyles, 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 & {\n \"--gridui-table-cell-offset\"?: string;\n }) | 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 \"--gridui-table-cell-offset\": `${offset}px`,\n position: \"var(--gridui-table-cell-position)\" as CSSProperties[\"position\"],\n ...(column.sticky === \"start\" ? {\n insetInlineStart: \"var(--gridui-table-cell-start)\",\n } : {\n insetInlineEnd: \"var(--gridui-table-cell-end)\",\n }),\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={tableCellStyles({\n numeric: column.numeric,\n sticky: column.sticky,\n }) || 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={tableCellStyles({\n numeric: columns[cellIndex]?.numeric,\n sticky: columns[cellIndex]?.sticky,\n }) || 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={tableCellStyles({\n numeric: columns[cellIndex]?.numeric,\n sticky: columns[cellIndex]?.sticky,\n }) || 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,kBAAkB,IAAI,IAAI;AAAA,EACnC,UAAU;AAAA,IACN,SAAS;AAAA,MACL,OAAO;AAAA,MACP,MAAM;AAAA,IACV;AAAA,IACA,QAAQ;AAAA,MACJ,OAAO;AAAA,MACP,KAAK;AAAA,IACT;AAAA,EACJ;AAAA,EACA,iBAAiB,EAAE,SAAS,MAAM;AACtC,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;;;AC5CD,SAAS,uBAAuB,qBAAqB;AACrD,SAAS,MAAAA,WAAU;AACnB,SAAS,yBAAyB;AAClC,SAAsC,gBAAgB;AAgI9B,cAKZ,YALY;AA5HjB,IAAM,YAAgC,CAAC,UAA0B;AACpE,QAAM;AAAA,IACF;AAAA,IACA;AAAA,IACA;AAAA,IACA,UAAU;AAAA,IACV;AAAA,IACA,OAAO,CAAC;AAAA,IACR,YAAY;AAAA,IACZ,aAAa,CAAC;AAAA,IACd;AAAA,IACA;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;AAAA;AAAA,MACL;AAAA;AAAA,EACJ;AACJ;",
6
6
  "names": ["cn", "cn", "cva", "cn", "jsx"]
7
7
  }
package/dist/styles.css CHANGED
@@ -40,54 +40,28 @@
40
40
  .gridui-u-table--text-foreground {
41
41
  color: var(--gridui-foreground);
42
42
  }
43
- .gridui-u-table--\[\&\:has\(\>_tbody\:empty\)_\>_thead_\>_tr\:last-child_\>_th\]\:\[border-block-end-width\:var\(--gridui-table-block-edge-width\)\]:has( > tbody:empty) > thead > tr:last-child > th {
44
- border-block-end-width: var(--gridui-table-block-edge-width);
43
+ .gridui-u-table--\[--gridui-table-cell-end\:var\(--gridui-table-cell-offset\)\] {
44
+ --gridui-table-cell-end: var(--gridui-table-cell-offset);
45
+ }
46
+ .gridui-u-table--\[--gridui-table-cell-position\:sticky\] {
47
+ --gridui-table-cell-position: sticky;
45
48
  }
46
- .gridui-u-table--\[\&\>\:is\(thead\,tbody\)\>tr\>\.gridui-table-numeric\]\:text-right > :is(thead, tbody) > tr > .gridui-table-numeric {
49
+ .gridui-u-table--\[--gridui-table-cell-start\:var\(--gridui-table-cell-offset\)\] {
50
+ --gridui-table-cell-start: var(--gridui-table-cell-offset);
51
+ }
52
+ .gridui-u-table--\[\&\>\:is\(thead\,tbody\,tfoot\)\>tr\>\.gridui-table-numeric\]\:text-right > :is(thead, tbody, tfoot) > tr > .gridui-table-numeric {
47
53
  text-align: right;
48
54
  }
49
- .gridui-u-table--\[\&\>\:is\(thead\,tbody\)\>tr\>\.gridui-table-numeric\]\:tabular-nums > :is(thead, tbody) > tr > .gridui-table-numeric {
55
+ .gridui-u-table--\[\&\>\:is\(thead\,tbody\,tfoot\)\>tr\>\.gridui-table-numeric\]\:tabular-nums > :is(thead, tbody, tfoot) > tr > .gridui-table-numeric {
50
56
  --tw-numeric-spacing: tabular-nums;
51
57
  font-variant-numeric: var(--tw-ordinal, ) var(--tw-slashed-zero, ) var(--tw-numeric-figure, ) var(--tw-numeric-spacing, ) var(--tw-numeric-fraction, );
52
58
  }
53
- .gridui-u-table--\[\&\>\:is\(thead\,tbody\)\>tr\>\:is\(th\,td\)\]\:border > :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) {
59
+ .gridui-u-table--\[\&\>\:is\(thead\,tbody\,tfoot\)\>tr\>\:is\(th\,td\)\]\:align-middle > :is(thead, tbody, tfoot) > tr > :is(th, td) {
68
60
  vertical-align: middle;
69
61
  }
70
- .gridui-u-table--\[\&\>\:is\(thead\,tbody\)\>tr\>\:is\(th\,td\)\]\:wrap-anywhere > :is(thead, tbody) > tr > :is(th, td) {
62
+ .gridui-u-table--\[\&\>\:is\(thead\,tbody\,tfoot\)\>tr\>\:is\(th\,td\)\]\:wrap-anywhere > :is(thead, tbody, tfoot) > tr > :is(th, td) {
71
63
  overflow-wrap: anywhere;
72
64
  }
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
65
  .gridui-u-table--\[\&\>tbody\>tr\>th\]\:text-left > tbody > tr > th {
92
66
  text-align: left;
93
67
  }
@@ -95,12 +69,6 @@
95
69
  --tw-font-weight: var(--font-weight-normal);
96
70
  font-weight: var(--font-weight-normal);
97
71
  }
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
72
  .gridui-u-table--\[\&\>thead\>\.gridui-table-groups\>th\]\:text-left > thead > .gridui-table-groups > th {
105
73
  text-align: left;
106
74
  }
@@ -111,12 +79,6 @@
111
79
  .gridui-u-table--\[\&\>thead\>\.gridui-table-groups\>th\]\:text-foreground > thead > .gridui-table-groups > th {
112
80
  color: var(--gridui-foreground);
113
81
  }
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
82
  .gridui-u-table--\[\&\>thead\>tr\>th\]\:text-left > thead > tr > th {
121
83
  text-align: left;
122
84
  }
@@ -129,8 +91,41 @@
129
91
  }
130
92
  }
131
93
  @layer components {
94
+ .gridui-table > :is(thead, tbody, tfoot) > tr > :is(th, td) {
95
+ padding: 1rem;
96
+ border: 1px solid var(--gridui-border);
97
+ }
98
+ .gridui-table > :is(thead, tbody, tfoot) > tr > :is(th, td):first-child {
99
+ border-inline-start-width: var(--gridui-table-inline-edge-width);
100
+ }
101
+ .gridui-table > :is(thead, tbody, tfoot) > tr > :is(th, td):last-child {
102
+ border-inline-end-width: var(--gridui-table-inline-edge-width);
103
+ }
104
+ .gridui-table > thead > tr > th {
105
+ background: var(--gridui-surface);
106
+ }
107
+ .gridui-table-editorial > tbody > tr > :is(th, td) {
108
+ padding-block: 1.5rem;
109
+ }
110
+ .gridui-table-structured > tbody > tr > th, .gridui-table > tbody > tr:hover > :is(th, td) {
111
+ background: var(--gridui-surface);
112
+ }
113
+ .gridui-table > thead > .gridui-table-groups > th {
114
+ padding-block: 0.5rem;
115
+ background: var(--gridui-brand-tint);
116
+ }
117
+ .gridui-table > thead > tr:first-child > th {
118
+ border-block-start-width: var(--gridui-table-block-edge-width);
119
+ }
120
+ .gridui-table > tbody > tr:last-child > :is(th, td), .gridui-table:has(> tbody:empty) > thead > tr:last-child > th {
121
+ border-block-end-width: var(--gridui-table-block-edge-width);
122
+ }
132
123
  .gridui-table {
133
124
  --gridui-table-inline-edge-width: 1px;
125
+ --gridui-table-selection-offset: 2px;
126
+ }
127
+ .gridui-table:dir(rtl) {
128
+ --gridui-table-selection-offset: -2px;
134
129
  }
135
130
  .gridui-table[data-inline-edges="none"] {
136
131
  --gridui-table-inline-edge-width: 0px;
@@ -196,6 +191,60 @@
196
191
  .gridui-table > thead > tr > [data-sticky] {
197
192
  z-index: 2;
198
193
  }
194
+ .gridui-table[data-density="compact"] > :is(thead, tbody, tfoot) > tr > :is(th, td) {
195
+ padding-block: 0.5rem;
196
+ }
197
+ .gridui-table[data-density="comfortable"] > :is(thead, tbody, tfoot) > tr > :is(th, td) {
198
+ padding-block: 1.5rem;
199
+ }
200
+ .gridui-table[data-row-lines="false"] > tbody > tr:not(:last-child) > :is(th, td) {
201
+ border-block-end-width: 0;
202
+ }
203
+ .gridui-table[data-row-lines="false"] > tbody > tr:not(:first-child) > :is(th, td) {
204
+ border-block-start-width: 0;
205
+ }
206
+ .gridui-table[data-column-lines="false"] > :is(thead, tbody, tfoot) > tr > :is(th, td):not(:first-child) {
207
+ border-inline-start-width: 0;
208
+ }
209
+ .gridui-table[data-column-lines="false"] > :is(thead, tbody, tfoot) > tr > :is(th, td):not(:last-child) {
210
+ border-inline-end-width: 0;
211
+ }
212
+ .gridui-table[data-header-surface="plain"] > thead > tr > th {
213
+ background: var(--gridui-background);
214
+ }
215
+ .gridui-table[data-header-surface="muted"] > thead > tr > th {
216
+ background: var(--gridui-surface);
217
+ }
218
+ .gridui-table[data-row-header-surface="plain"] > tbody > tr > th {
219
+ background: var(--gridui-background);
220
+ }
221
+ .gridui-table[data-row-header-surface="muted"] > tbody > tr > th {
222
+ background: var(--gridui-surface);
223
+ }
224
+ .gridui-table > tbody > tr[data-striped] > :is(th, td) {
225
+ background: var(--gridui-surface);
226
+ }
227
+ .gridui-table > tbody > tr[data-selected] > :is(th, td) {
228
+ background: var(--gridui-accent-background);
229
+ @supports (color: color-mix(in lab, red, red)) {
230
+ background: color-mix(in srgb, var(--gridui-accent-background) 10%, var(--gridui-background));
231
+ }
232
+ }
233
+ .gridui-table > tbody > tr[data-selected] > :is(th, td):first-child {
234
+ box-shadow: inset var(--gridui-table-selection-offset) 0 var(--gridui-accent-background);
235
+ }
236
+ .gridui-table > tfoot > tr > :is(th, td) {
237
+ background: var(--gridui-surface);
238
+ }
239
+ .gridui-table > tfoot > tr > [data-sticky] {
240
+ z-index: 1;
241
+ }
242
+ .gridui-table:has(> tfoot) > tbody > tr:last-child > :is(th, td), .gridui-table:has(> tfoot):has(> tbody:empty) > thead > tr:last-child > th {
243
+ border-block-end-width: 1px;
244
+ }
245
+ .gridui-table > tfoot > tr:last-child > :is(th, td) {
246
+ border-block-end-width: var(--gridui-table-block-edge-width);
247
+ }
199
248
  }
200
249
  @property --tw-ordinal {
201
250
  syntax: "*";
@@ -217,11 +266,6 @@
217
266
  syntax: "*";
218
267
  inherits: false;
219
268
  }
220
- @property --tw-border-style {
221
- syntax: "*";
222
- inherits: false;
223
- initial-value: solid;
224
- }
225
269
  @property --tw-font-weight {
226
270
  syntax: "*";
227
271
  inherits: false;
@@ -234,7 +278,6 @@
234
278
  --tw-numeric-figure: initial;
235
279
  --tw-numeric-spacing: initial;
236
280
  --tw-numeric-fraction: initial;
237
- --tw-border-style: solid;
238
281
  --tw-font-weight: initial;
239
282
  }
240
283
  }
package/docs/catalog.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
3
  "name": "@gridui/table",
4
- "version": "3.0.0",
5
- "category": "core",
4
+ "version": "3.1.1",
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": [
@@ -32,6 +32,11 @@
32
32
  "kind": "type",
33
33
  "importPath": "@gridui/table"
34
34
  },
35
+ {
36
+ "name": "DataTableFooterRow",
37
+ "kind": "type",
38
+ "importPath": "@gridui/table"
39
+ },
35
40
  {
36
41
  "name": "DataTableInlineEdges",
37
42
  "kind": "type",
@@ -47,6 +52,11 @@
47
52
  "kind": "type",
48
53
  "importPath": "@gridui/table"
49
54
  },
55
+ {
56
+ "name": "DataTablePresentation",
57
+ "kind": "type",
58
+ "importPath": "@gridui/table"
59
+ },
50
60
  {
51
61
  "name": "DataTableProps",
52
62
  "kind": "type",
@@ -74,9 +84,10 @@
74
84
  "@gridui/table/styles.css"
75
85
  ],
76
86
  "examples": [
77
- "https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-core/table/stories/loading-details.mdx",
78
- "https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-core/table/stories/readable-tables.mdx",
79
- "https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-core/table/stories/wide-tables.mdx",
80
- "https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-core/table/stories/data-table.stories.tsx"
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"
81
92
  ]
82
93
  }
@@ -1,7 +1,7 @@
1
1
  <!-- Generated from public Props and owned stories. Run pnpm docs:storybook. -->
2
2
  # DataTablePlaceholder
3
3
 
4
- Public DataTablePlaceholder component from @gridui/table. See the package guide for its composition contract.
4
+ Compose DataTablePlaceholder with DataTable inside the same @gridui/table component family.
5
5
 
6
6
  Import from ``@gridui/table`` and load Theme before this family's stylesheet.
7
7
 
@@ -11,7 +11,9 @@ import "@gridui/theme/styles.css";
11
11
  import "@gridui/table/styles.css";
12
12
  ```
13
13
 
14
- Read the [package contract](https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-core/table/README.md) for shared behavior and stylesheet dependencies.
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.
15
17
 
16
18
  ## API
17
19
 
@@ -61,6 +63,30 @@ Called when the corresponding interaction occurs; inspect the arguments in Actio
61
63
 
62
64
  ``Property.MinWidth<string | number> | undefined`` · Optional
63
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
+
64
90
  ### columns
65
91
 
66
92
  ``readonly DataTableColumn[]`` · Required
@@ -77,6 +103,10 @@ Called when the corresponding interaction occurs; inspect the arguments in Actio
77
103
 
78
104
  ``boolean | undefined`` · Optional
79
105
 
106
+ ### footerRows
107
+
108
+ ``readonly DataTableFooterRow[] | undefined`` · Optional
109
+
80
110
  ### blockEdges
81
111
 
82
112
  ``Responsive<DataTableBlockEdges> | undefined`` · Optional
@@ -11,14 +11,40 @@ import "@gridui/theme/styles.css";
11
11
  import "@gridui/table/styles.css";
12
12
  ```
13
13
 
14
- Read the [package contract](https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-core/table/README.md) for shared behavior and stylesheet dependencies.
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
15
 
16
- The [working composition](https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-core/table/stories/data-table.stories.tsx) demonstrates required context, state, and related components. Use View code in Storybook to inspect the actual implementation.
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
17
 
18
18
  ## API
19
19
 
20
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
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
+
22
48
  ### onFocus
23
49
 
24
50
  ``(event: FocusEvent<HTMLTableElement, Element>): void`` · Optional
@@ -85,6 +111,12 @@ Default: ``[]``
85
111
 
86
112
  Default: ``false``
87
113
 
114
+ ### footerRows
115
+
116
+ ``readonly DataTableFooterRow[] | undefined`` · Optional
117
+
118
+ Default: ``[]``
119
+
88
120
  ### minWidth
89
121
 
90
122
  ``Property.MinWidth<string | number> | undefined`` · Optional
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gridui/table",
3
- "version": "3.0.0",
3
+ "version": "3.1.1",
4
4
  "description": "GridUI React table",
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",
@@ -27,17 +27,17 @@
27
27
  "react-dom": "^19.2.0"
28
28
  },
29
29
  "dependencies": {
30
- "@gridui/overlay": "^2.0.0",
30
+ "@gridui/overlay": "^2.2.0",
31
31
  "@gridui/style-utils": "^4.0.0",
32
- "@gridui/theme": "^2.5.3",
32
+ "@gridui/theme": "^2.6.0",
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.6",
37
+ "@gridui/data-cell": "1.1.1",
38
38
  "@gridui/loading-surface": "1.1.5",
39
39
  "@jest/globals": "30.5.2",
40
- "@storybook/react-vite": "10.6.6",
40
+ "@storybook/react-vite": "10.6.7",
41
41
  "@types/jest": "30.0.0",
42
42
  "@types/node": "26.6.6",
43
43
  "@types/react": "19.3.0",
@@ -50,7 +50,6 @@
50
50
  "scripts": {
51
51
  "build": "node ../../scripts/compilation/package.ts",
52
52
  "compile": "tsc --project tsconfig.json",
53
- "test": "jest",
54
- "coverage": "jest --coverage"
53
+ "test": "jest"
55
54
  }
56
55
  }