@gridui/table 1.0.3 → 1.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
@@ -42,6 +42,13 @@ unique and match the row count; each key identifies the same record across updat
42
42
  Omitting keys retains positional identity for static tables. DataExplorer supplies
43
43
  its stable record IDs automatically.
44
44
 
45
+ Provide a stable, unique `DataTableColumn.key` when columns can be hidden or
46
+ reordered. Headers and cells retain their own component state across those
47
+ changes; omitted keys retain positional identity for static columns. Numeric
48
+ and string forms of the same key share React identity and cannot be duplicated.
49
+ DataExplorer supplies stable namespaced column identities, including its optional
50
+ selection and detail controls.
51
+
45
52
  The related `@gridui/data-cell` family provides DataValue, which separates a primary value from optional secondary context and supports
46
53
  monospace identifiers. DataBadge retains caller-supplied status text with neutral
47
54
  or accent tone. DataBar adds a decorative, bounded relative-volume mark without
@@ -57,3 +64,17 @@ These static React components require no additional hydration. The application o
57
64
  query logic, status text, content, and column labels. Load Theme, Table, and rendered data-cell styles
58
65
  through the application stylesheet.
59
66
 
67
+
68
+ ## Optional interactive compositions
69
+
70
+ A column may provide `header` content while retaining its required text `label`.
71
+ `sticky="start" | "end"` pins a column at its logical edge; `stickyOffset` is a
72
+ nonnegative pixel offset for preceding pinned columns. Callers own measured or
73
+ fixed widths and matching offsets. DataExplorer supplies those consistently.
74
+ Sticky cells retain opaque theme surfaces while the named table region scrolls.
75
+
76
+ `rowDetails` is an optional array matching `rows`. Each open entry contains a
77
+ unique nonempty `id` and `content`; null entries have no detail row. Details render
78
+ in a native row immediately after their owner and span all visible columns.
79
+ Applications supply expansion buttons with `aria-expanded` / `aria-controls` and
80
+ stable `rowKeys`. DataTable never fetches detail content or owns expansion state.
@@ -4,9 +4,9 @@
4
4
  * @namespace DataTable
5
5
  * @description Data Table
6
6
  */
7
- import type { DataTableBlockEdges, DataTableColumn, DataTableColumnGroup, DataTableInlineEdges, DataTableVariant } from "../shared/types";
7
+ import type { DataTableBlockEdges, DataTableColumn, DataTableColumnGroup, DataTableInlineEdges, DataTableRowDetail, DataTableVariant } from "../shared/types";
8
8
  import { type Responsive } from "@gridui/style-utils/responsive";
9
- import type { ComponentPropsWithRef, CSSProperties, FC, Key, ReactNode } from "react";
9
+ import { type ComponentPropsWithRef, type CSSProperties, type FC, type Key, type ReactNode } from "react";
10
10
  export type DataTableProps = Omit<ComponentPropsWithRef<"table">, "children"> & {
11
11
  readonly label: string;
12
12
  readonly columns: readonly DataTableColumn[];
@@ -15,6 +15,7 @@ export type DataTableProps = Omit<ComponentPropsWithRef<"table">, "children"> &
15
15
  readonly bodyId?: string;
16
16
  readonly rows?: readonly (readonly ReactNode[])[];
17
17
  readonly rowKeys?: readonly Key[];
18
+ readonly rowDetails?: readonly (DataTableRowDetail | null | undefined)[];
18
19
  readonly rowHeader?: boolean;
19
20
  readonly minWidth?: CSSProperties["minWidth"];
20
21
  readonly blockEdges?: Responsive<DataTableBlockEdges>;
package/dist/index.d.ts CHANGED
@@ -13,3 +13,4 @@ export type { DataTableColumn } from "./shared/types";
13
13
  export type { DataTableColumnGroup } from "./shared/types";
14
14
  export type { DataTableInlineEdges } from "./shared/types";
15
15
  export type { DataTableVariant } from "./shared/types";
16
+ export type { DataTableRowDetail } from "./shared/types";
package/dist/index.js CHANGED
@@ -43,6 +43,7 @@ var tableVariants = cva(tableStyles(), {
43
43
  import { useScrollbars } from "@gridui/overlay";
44
44
  import { cn as cn2 } from "@gridui/style-utils";
45
45
  import { resolveResponsive } from "@gridui/style-utils/responsive";
46
+ import { Fragment } from "react";
46
47
  import { jsx, jsxs } from "react/jsx-runtime";
47
48
  var DataTable = (props) => {
48
49
  const {
@@ -53,6 +54,7 @@ var DataTable = (props) => {
53
54
  bodyId,
54
55
  rows = [],
55
56
  rowKeys,
57
+ rowDetails,
56
58
  rowHeader = false,
57
59
  minWidth,
58
60
  inlineEdges = "both",
@@ -80,6 +82,37 @@ var DataTable = (props) => {
80
82
  }, 0) !== columns.length)) {
81
83
  throw new Error("DataTable column groups must cover every column with positive integer spans.");
82
84
  }
85
+ if (rowDetails && (rowDetails.length !== rows.length || columns.length === 0)) {
86
+ throw new RangeError("DataTable details must match rows and need at least one column.");
87
+ }
88
+ const detailIds = rowDetails?.flatMap((detail) => {
89
+ return detail ? [detail.id] : [];
90
+ }) ?? [];
91
+ if (detailIds.some((id) => {
92
+ return !id;
93
+ }) || new Set(detailIds).size !== detailIds.length) {
94
+ throw new Error("DataTable detail IDs must be nonempty and unique.");
95
+ }
96
+ const columnKeys = columns.map((column, index) => {
97
+ return column.key === void 0 ? `position:${index}` : `key:${String(column.key)}`;
98
+ });
99
+ if (new Set(columnKeys).size !== columnKeys.length) {
100
+ throw new Error("DataTable column keys must be unique.");
101
+ }
102
+ const columnStyle = (column) => {
103
+ if (!column?.sticky) {
104
+ return column?.sizing;
105
+ }
106
+ const offset = column.stickyOffset ?? 0;
107
+ if (!Number.isFinite(offset) || offset < 0) {
108
+ throw new RangeError("Sticky column offsets must be finite and nonnegative.");
109
+ }
110
+ return {
111
+ ...column.sizing,
112
+ position: "sticky",
113
+ [column.sticky === "start" ? "insetInlineStart" : "insetInlineEnd"]: offset
114
+ };
115
+ };
83
116
  return /* @__PURE__ */ jsx(
84
117
  "div",
85
118
  {
@@ -139,11 +172,12 @@ var DataTable = (props) => {
139
172
  "th",
140
173
  {
141
174
  scope: "col",
142
- style: column.sizing,
175
+ style: columnStyle(column),
176
+ "data-sticky": column.sticky,
143
177
  className: column.numeric ? "gridui-table-numeric" : void 0,
144
- children: column.label
178
+ children: column.header ?? column.label
145
179
  },
146
- index
180
+ columnKeys[index]
147
181
  );
148
182
  }) })
149
183
  ] }),
@@ -152,22 +186,40 @@ var DataTable = (props) => {
152
186
  {
153
187
  id: bodyId,
154
188
  children: rows.map((row, index) => {
155
- return /* @__PURE__ */ jsx(
156
- "tr",
189
+ const detail = rowDetails?.[index];
190
+ return /* @__PURE__ */ jsxs(
191
+ Fragment,
157
192
  {
158
- children: row.map((cell, cellIndex) => {
159
- const Cell = rowHeader && cellIndex === 0 ? "th" : "td";
160
- return /* @__PURE__ */ jsx(
161
- Cell,
193
+ children: [
194
+ /* @__PURE__ */ jsx("tr", { children: row.map((cell, cellIndex) => {
195
+ const Cell = rowHeader && cellIndex === 0 ? "th" : "td";
196
+ return /* @__PURE__ */ jsx(
197
+ Cell,
198
+ {
199
+ scope: Cell === "th" ? "row" : void 0,
200
+ style: columnStyle(columns[cellIndex]),
201
+ "data-sticky": columns[cellIndex]?.sticky,
202
+ className: columns[cellIndex]?.numeric ? "gridui-table-numeric" : void 0,
203
+ children: cell
204
+ },
205
+ columnKeys[cellIndex]
206
+ );
207
+ }) }),
208
+ detail && /* @__PURE__ */ jsx(
209
+ "tr",
162
210
  {
163
- scope: Cell === "th" ? "row" : void 0,
164
- style: columns[cellIndex]?.sizing,
165
- className: columns[cellIndex]?.numeric ? "gridui-table-numeric" : void 0,
166
- children: cell
167
- },
168
- cellIndex
169
- );
170
- })
211
+ id: detail.id,
212
+ className: "gridui-table-detail",
213
+ children: /* @__PURE__ */ jsx(
214
+ "td",
215
+ {
216
+ colSpan: columns.length,
217
+ children: detail.content
218
+ }
219
+ )
220
+ }
221
+ )
222
+ ]
171
223
  },
172
224
  rowKeys?.[index] ?? index
173
225
  );
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-min-w-0 gridui-u-max-w-full gridui-u-overflow-x-auto\",\n));\n\nexport const tableStyles = cva(cn(\n \"gridui-table\",\n \"gridui-u-w-full gridui-u-border-collapse gridui-u-type-data gridui-u-text-left gridui-u-text-foreground gridui-u-bg-background\",\n \"gridui-u-[&>thead>tr>th]:text-left gridui-u-[&>thead>tr>th]:text-muted gridui-u-[&>thead>tr>th]:font-medium gridui-u-[&>thead>tr>th]:bg-surface\",\n \"gridui-u-[&>:is(thead,tbody)>tr>:is(th,td)]:p-gridui-16 gridui-u-[&>:is(thead,tbody)>tr>:is(th,td)]:border gridui-u-[&>:is(thead,tbody)>tr>:is(th,td)]:border-solid gridui-u-[&>:is(thead,tbody)>tr>:is(th,td)]:border-border gridui-u-[&>:is(thead,tbody)>tr>:is(th,td)]:align-middle gridui-u-[&>:is(thead,tbody)>tr>:is(th,td)]:wrap-anywhere\",\n \"gridui-u-[&>:is(thead,tbody)>tr>:is(th,td):first-child]:[border-inline-start-width:var(--gridui-table-inline-edge-width)] gridui-u-[&>:is(thead,tbody)>tr>:is(th,td):last-child]:[border-inline-end-width:var(--gridui-table-inline-edge-width)]\",\n \"gridui-u-[&>thead>tr:first-child>th]:[border-block-start-width:var(--gridui-table-block-edge-width)]\",\n \"gridui-u-[&>tbody>tr:last-child>:is(th,td)]:[border-block-end-width:var(--gridui-table-block-edge-width)]\",\n \"gridui-u-[&:has(>_tbody:empty)_>_thead_>_tr:last-child_>_th]:[border-block-end-width:var(--gridui-table-block-edge-width)]\",\n \"gridui-u-[&>tbody>tr>th]:text-left gridui-u-[&>tbody>tr>th]:font-normal\",\n \"gridui-u-[&>tbody>tr:hover>:is(th,td)]:bg-surface\",\n \"gridui-u-[&>thead>.gridui-table-groups>th]:py-gridui-8 gridui-u-[&>thead>.gridui-table-groups>th]:text-left gridui-u-[&>thead>.gridui-table-groups>th]:text-foreground gridui-u-[&>thead>.gridui-table-groups>th]:bg-brand-tint gridui-u-[&>thead>.gridui-table-groups>th]:type-eyebrow\",\n \"gridui-u-[&>:is(thead,tbody)>tr>.gridui-table-numeric]:text-right gridui-u-[&>:is(thead,tbody)>tr>.gridui-table-numeric]:tabular-nums\",\n));\n\nexport const tableEditorialStyles = cva(cn(\n \"gridui-table-editorial\",\n \"gridui-u-[&>tbody>tr>:is(th,td)]:py-gridui-24\",\n));\n\nexport const tableStructuredStyles = cva(cn(\n \"gridui-table-structured\",\n \"gridui-u-[&>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 type { DataTableBlockEdges, DataTableColumn, DataTableColumnGroup, DataTableInlineEdges, DataTableVariant } from \"../shared/types\";\nimport { tableScrollStyles, tableVariants } from \"./style\";\nimport { useScrollbars } from \"@gridui/overlay\";\nimport { cn } from \"@gridui/style-utils\";\nimport { resolveResponsive, type Responsive } from \"@gridui/style-utils/responsive\";\nimport type { ComponentPropsWithRef, CSSProperties, FC, Key, ReactNode } from \"react\";\n\nexport type DataTableProps = Omit<ComponentPropsWithRef<\"table\">, \"children\"> & {\n readonly label: string;\n readonly columns: readonly DataTableColumn[];\n readonly columnGroups?: readonly DataTableColumnGroup[];\n readonly variant?: DataTableVariant;\n readonly bodyId?: string;\n readonly rows?: readonly (readonly ReactNode[])[];\n readonly rowKeys?: readonly Key[];\n readonly rowHeader?: boolean;\n readonly minWidth?: CSSProperties[\"minWidth\"];\n readonly blockEdges?: Responsive<DataTableBlockEdges>;\n readonly inlineEdges?: Responsive<DataTableInlineEdges>;\n};\n\nexport const DataTable: FC<DataTableProps> = (props: DataTableProps) => {\n const {\n label,\n columns,\n columnGroups,\n variant = \"editorial\",\n bodyId,\n rows = [],\n rowKeys,\n rowHeader = false,\n minWidth,\n inlineEdges = \"both\",\n blockEdges = \"both\",\n className,\n style,\n ...restProps\n } = props;\n const ref = useScrollbars<HTMLDivElement>();\n const block = resolveResponsive(blockEdges);\n const edges = resolveResponsive(inlineEdges);\n const invalidRowKeys = rowKeys\n && (rowKeys.length !== rows.length || new Set(rowKeys.map(String)).size !== rowKeys.length);\n if (invalidRowKeys) {\n throw new Error(\"DataTable row keys must be unique and match the rows.\");\n }\n if (rows.some((row) => {\n return row.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 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={index}\n scope=\"col\"\n style={column.sizing}\n className={column.numeric ? \"gridui-table-numeric\" : undefined}\n >\n {column.label}\n </th>);\n })}\n </tr>\n </thead>\n <tbody\n id={bodyId}\n >\n {rows.map((row, index) => {\n return (<tr\n key={rowKeys?.[index] ?? index}\n >\n {row.map((cell, cellIndex) => {\n const Cell = rowHeader && cellIndex === 0 ? \"th\" : \"td\";\n return (<Cell\n key={cellIndex}\n scope={Cell === \"th\" ? \"row\" : undefined}\n style={columns[cellIndex]?.sizing}\n className={columns[cellIndex]?.numeric ? \"gridui-table-numeric\" : undefined}\n >\n {cell}\n </Cell>);\n })}\n </tr>);\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-pointer-events-none\",\n));\n", "/**\n * @author WMXPY\n * @package Table\n * @namespace DataTablePlaceholder\n * @description Data Table Placeholder\n */\n\nimport { DataTable, type DataTableProps } from \"../data-table/data-table\";\nimport { tablePlaceholderStyles } from \"./style\";\nimport { cn } from \"@gridui/style-utils\";\nimport type { FC } from \"react\";\n\nexport type DataTablePlaceholderProps = Omit<DataTableProps, \"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 restProps.columns.map(() => {\n return \"\u2014\";\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;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACJ,CAAC;AAEM,IAAM,uBAAuB,IAAI;AAAA,EACpC;AAAA,EACA;AACJ,CAAC;AAEM,IAAM,wBAAwB,IAAI;AAAA,EACrC;AAAA,EACA;AACJ,CAAC;AAEM,IAAM,gBAAgB,IAAI,YAAY,GAAG;AAAA,EAC5C,UAAU;AAAA,IACN,SAAS;AAAA,MACL,WAA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AAA,sBAGJ,cAAI,IAAI,CAAC,MAAM,cAAc;AAC1B,8BAAM,OAAO,aAAa,cAAc,IAAI,OAAO;AACnD,+BAAQ;AAAA,0BAAC;AAAA;AAAA,4BAEL,OAAO,SAAS,OAAO,QAAQ;AAAA,4BAC/B,OAAO,QAAQ,SAAS,GAAG;AAAA,4BAC3B,WAAW,QAAQ,SAAS,GAAG,UAAU,yBAAyB;AAAA,4BAEjE;AAAA;AAAA,0BALI;AAAA,wBAMT;AAAA,sBACJ,CAAC;AAAA;AAAA,oBAZI,UAAU,KAAK,KAAK;AAAA,kBAa7B;AAAA,gBACJ,CAAC;AAAA;AAAA,YACL;AAAA;AAAA;AAAA,MACJ;AAAA;AAAA,EACJ;AACJ;;;AC1IA,SAAS,MAAAC,WAAU;AACnB,SAAS,OAAAC,YAAW;AAEb,IAAM,yBAAyBA,KAAID;AAAA,EACtC;AAAA,EACA;AACJ,CAAC;;;ACJD,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,UAAU,QAAQ,IAAI,MAAM;AAC/B,qBAAO;AAAA,YACX,CAAC;AAAA,UACL,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-min-w-0 gridui-u-max-w-full gridui-u-overflow-x-auto\",\n));\n\nexport const tableStyles = cva(cn(\n \"gridui-table\",\n \"gridui-u-w-full gridui-u-border-collapse gridui-u-type-data gridui-u-text-left gridui-u-text-foreground gridui-u-bg-background\",\n \"gridui-u-[&>thead>tr>th]:text-left gridui-u-[&>thead>tr>th]:text-muted gridui-u-[&>thead>tr>th]:font-medium gridui-u-[&>thead>tr>th]:bg-surface\",\n \"gridui-u-[&>:is(thead,tbody)>tr>:is(th,td)]:p-gridui-16 gridui-u-[&>:is(thead,tbody)>tr>:is(th,td)]:border gridui-u-[&>:is(thead,tbody)>tr>:is(th,td)]:border-solid gridui-u-[&>:is(thead,tbody)>tr>:is(th,td)]:border-border gridui-u-[&>:is(thead,tbody)>tr>:is(th,td)]:align-middle gridui-u-[&>:is(thead,tbody)>tr>:is(th,td)]:wrap-anywhere\",\n \"gridui-u-[&>:is(thead,tbody)>tr>:is(th,td):first-child]:[border-inline-start-width:var(--gridui-table-inline-edge-width)] gridui-u-[&>:is(thead,tbody)>tr>:is(th,td):last-child]:[border-inline-end-width:var(--gridui-table-inline-edge-width)]\",\n \"gridui-u-[&>thead>tr:first-child>th]:[border-block-start-width:var(--gridui-table-block-edge-width)]\",\n \"gridui-u-[&>tbody>tr:last-child>:is(th,td)]:[border-block-end-width:var(--gridui-table-block-edge-width)]\",\n \"gridui-u-[&:has(>_tbody:empty)_>_thead_>_tr:last-child_>_th]:[border-block-end-width:var(--gridui-table-block-edge-width)]\",\n \"gridui-u-[&>tbody>tr>th]:text-left gridui-u-[&>tbody>tr>th]:font-normal\",\n \"gridui-u-[&>tbody>tr:hover>:is(th,td)]:bg-surface\",\n \"gridui-u-[&>thead>.gridui-table-groups>th]:py-gridui-8 gridui-u-[&>thead>.gridui-table-groups>th]:text-left gridui-u-[&>thead>.gridui-table-groups>th]:text-foreground gridui-u-[&>thead>.gridui-table-groups>th]:bg-brand-tint gridui-u-[&>thead>.gridui-table-groups>th]:type-eyebrow\",\n \"gridui-u-[&>:is(thead,tbody)>tr>.gridui-table-numeric]:text-right gridui-u-[&>:is(thead,tbody)>tr>.gridui-table-numeric]:tabular-nums\",\n));\n\nexport const tableEditorialStyles = cva(cn(\n \"gridui-table-editorial\",\n \"gridui-u-[&>tbody>tr>:is(th,td)]:py-gridui-24\",\n));\n\nexport const tableStructuredStyles = cva(cn(\n \"gridui-table-structured\",\n \"gridui-u-[&>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 type { DataTableBlockEdges, DataTableColumn, DataTableColumnGroup, DataTableInlineEdges, DataTableRowDetail, DataTableVariant } from \"../shared/types\";\nimport { tableScrollStyles, tableVariants } from \"./style\";\nimport { useScrollbars } from \"@gridui/overlay\";\nimport { cn } from \"@gridui/style-utils\";\nimport { resolveResponsive, type Responsive } from \"@gridui/style-utils/responsive\";\nimport { type ComponentPropsWithRef, type CSSProperties, type FC, Fragment, type Key, type ReactNode } from \"react\";\n\nexport type DataTableProps = Omit<ComponentPropsWithRef<\"table\">, \"children\"> & {\n readonly label: string;\n readonly columns: readonly DataTableColumn[];\n readonly columnGroups?: readonly DataTableColumnGroup[];\n readonly variant?: DataTableVariant;\n readonly bodyId?: string;\n readonly rows?: readonly (readonly ReactNode[])[];\n readonly rowKeys?: readonly Key[];\n readonly rowDetails?: readonly (DataTableRowDetail | null | undefined)[];\n readonly rowHeader?: boolean;\n readonly minWidth?: CSSProperties[\"minWidth\"];\n readonly blockEdges?: Responsive<DataTableBlockEdges>;\n readonly inlineEdges?: Responsive<DataTableInlineEdges>;\n};\n\nexport const DataTable: FC<DataTableProps> = (props: DataTableProps) => {\n const {\n label,\n columns,\n columnGroups,\n variant = \"editorial\",\n bodyId,\n rows = [],\n rowKeys,\n rowDetails,\n rowHeader = false,\n minWidth,\n inlineEdges = \"both\",\n blockEdges = \"both\",\n className,\n style,\n ...restProps\n } = props;\n const ref = useScrollbars<HTMLDivElement>();\n const block = resolveResponsive(blockEdges);\n const edges = resolveResponsive(inlineEdges);\n const invalidRowKeys = rowKeys\n && (rowKeys.length !== rows.length || new Set(rowKeys.map(String)).size !== rowKeys.length);\n if (invalidRowKeys) {\n throw new Error(\"DataTable row keys must be unique and match the rows.\");\n }\n if (rows.some((row) => {\n return row.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 if (rowDetails && (rowDetails.length !== rows.length || columns.length === 0)) {\n throw new RangeError(\"DataTable details must match rows and need at least one column.\");\n }\n const detailIds = rowDetails?.flatMap(detail => {\n return detail ? [detail.id] : [];\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 detail = rowDetails?.[index];\n return (<Fragment\n key={rowKeys?.[index] ?? index}\n >\n <tr>\n {row.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-pointer-events-none\",\n));\n", "/**\n * @author WMXPY\n * @package Table\n * @namespace DataTablePlaceholder\n * @description Data Table Placeholder\n */\n\nimport { DataTable, type DataTableProps } from \"../data-table/data-table\";\nimport { tablePlaceholderStyles } from \"./style\";\nimport { cn } from \"@gridui/style-utils\";\nimport type { FC } from \"react\";\n\nexport type DataTablePlaceholderProps = Omit<DataTableProps, \"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 restProps.columns.map(() => {\n return \"\u2014\";\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;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACJ,CAAC;AAEM,IAAM,uBAAuB,IAAI;AAAA,EACpC;AAAA,EACA;AACJ,CAAC;AAEM,IAAM,wBAAwB,IAAI;AAAA,EACrC;AAAA,EACA;AACJ,CAAC;AAEM,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;;;ACzCD,SAAS,qBAAqB;AAC9B,SAAS,MAAAA,WAAU;AACnB,SAAS,yBAA0C;AACnD,SAAkE,gBAA0C;AA+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4BANI,WAAW,SAAS;AAAA,0BAO7B;AAAA,wBACJ,CAAC,GACL;AAAA,wBACC,UAAW;AAAA,0BAAC;AAAA;AAAA,4BACT,IAAI,OAAO;AAAA,4BACX,WAAU;AAAA,4BAEV;AAAA,8BAAC;AAAA;AAAA,gCACG,SAAS,QAAQ;AAAA,gCAEhB,iBAAO;AAAA;AAAA,4BACZ;AAAA;AAAA,wBACJ;AAAA;AAAA;AAAA,oBAzBK,UAAU,KAAK,KAAK;AAAA,kBA0B7B;AAAA,gBACJ,CAAC;AAAA;AAAA,YACL;AAAA;AAAA;AAAA,MACJ;AAAA;AAAA,EACJ;AACJ;;;AC1LA,SAAS,MAAAC,WAAU;AACnB,SAAS,OAAAC,YAAW;AAEb,IAAM,yBAAyBA,KAAID;AAAA,EACtC;AAAA,EACA;AACJ,CAAC;;;ACJD,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,UAAU,QAAQ,IAAI,MAAM;AAC/B,qBAAO;AAAA,YACX,CAAC;AAAA,UACL,CAAC;AAAA;AAAA,MACL;AAAA;AAAA,EACJ;AACJ;",
6
6
  "names": ["cn", "cn", "cva", "cn", "jsx"]
7
7
  }
@@ -4,7 +4,7 @@
4
4
  * @namespace Shared
5
5
  * @description Types
6
6
  */
7
- import type { CSSProperties } from "react";
7
+ import type { CSSProperties, Key, ReactNode } from "react";
8
8
  export type DataTableVariant = "editorial" | "structured";
9
9
  export type DataTableInlineEdges = "both" | "none";
10
10
  export type DataTableBlockEdges = "both" | "none";
@@ -13,7 +13,15 @@ export type DataTableColumnGroup = {
13
13
  readonly span: number;
14
14
  };
15
15
  export type DataTableColumn = {
16
+ readonly key?: Key;
16
17
  readonly label: string;
18
+ readonly header?: ReactNode;
19
+ readonly sticky?: "start" | "end";
20
+ readonly stickyOffset?: number;
17
21
  readonly numeric?: boolean;
18
22
  readonly sizing?: Pick<CSSProperties, "width" | "minWidth" | "maxWidth"> | undefined;
19
23
  };
24
+ export type DataTableRowDetail = {
25
+ readonly id: string;
26
+ readonly content: ReactNode;
27
+ };
package/dist/styles.css CHANGED
@@ -173,6 +173,13 @@
173
173
  --gridui-table-block-edge-width: 0px;
174
174
  }
175
175
  }
176
+ .gridui-table > tbody > tr > [data-sticky] {
177
+ z-index: 1;
178
+ background: var(--gridui-background);
179
+ }
180
+ .gridui-table > thead > tr > [data-sticky] {
181
+ z-index: 2;
182
+ }
176
183
  }
177
184
  @property --tw-ordinal {
178
185
  syntax: "*";
@@ -0,0 +1,71 @@
1
+ {
2
+ "schemaVersion": 1,
3
+ "name": "@gridui/table",
4
+ "version": "1.1.1",
5
+ "category": "core",
6
+ "description": "GridUI React table",
7
+ "usage": "Related families and their ownership are listed in the component ownership map.",
8
+ "documentation": [
9
+ "README.md"
10
+ ],
11
+ "exports": [
12
+ {
13
+ "name": "DataTable",
14
+ "kind": "component",
15
+ "importPath": "@gridui/table"
16
+ },
17
+ {
18
+ "name": "DataTableBlockEdges",
19
+ "kind": "type",
20
+ "importPath": "@gridui/table"
21
+ },
22
+ {
23
+ "name": "DataTableColumn",
24
+ "kind": "type",
25
+ "importPath": "@gridui/table"
26
+ },
27
+ {
28
+ "name": "DataTableColumnGroup",
29
+ "kind": "type",
30
+ "importPath": "@gridui/table"
31
+ },
32
+ {
33
+ "name": "DataTableInlineEdges",
34
+ "kind": "type",
35
+ "importPath": "@gridui/table"
36
+ },
37
+ {
38
+ "name": "DataTablePlaceholder",
39
+ "kind": "component",
40
+ "importPath": "@gridui/table"
41
+ },
42
+ {
43
+ "name": "DataTablePlaceholderProps",
44
+ "kind": "type",
45
+ "importPath": "@gridui/table"
46
+ },
47
+ {
48
+ "name": "DataTableProps",
49
+ "kind": "type",
50
+ "importPath": "@gridui/table"
51
+ },
52
+ {
53
+ "name": "DataTableRowDetail",
54
+ "kind": "type",
55
+ "importPath": "@gridui/table"
56
+ },
57
+ {
58
+ "name": "DataTableVariant",
59
+ "kind": "type",
60
+ "importPath": "@gridui/table"
61
+ }
62
+ ],
63
+ "styles": [
64
+ "@gridui/theme/styles.css",
65
+ "@gridui/overlay/styles.css",
66
+ "@gridui/table/styles.css"
67
+ ],
68
+ "examples": [
69
+ "https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-core/table/stories/data-table.stories.tsx"
70
+ ]
71
+ }
package/package.json CHANGED
@@ -1,12 +1,13 @@
1
1
  {
2
2
  "name": "@gridui/table",
3
- "version": "1.0.3",
3
+ "version": "1.1.1",
4
4
  "description": "GridUI React table",
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",
7
7
  "files": [
8
8
  "dist",
9
- "README.md"
9
+ "README.md",
10
+ "docs"
10
11
  ],
11
12
  "sideEffects": [
12
13
  "**/*.css"
@@ -26,17 +27,17 @@
26
27
  "react-dom": "^19.2.0"
27
28
  },
28
29
  "dependencies": {
29
- "@gridui/overlay": "^1.2.0",
30
- "@gridui/style-utils": "^2.2.0",
31
- "@gridui/theme": "^2.5.1",
30
+ "@gridui/overlay": "^1.2.2",
31
+ "@gridui/style-utils": "^2.2.2",
32
+ "@gridui/theme": "^2.5.3",
32
33
  "class-variance-authority": "0.7.1"
33
34
  },
34
35
  "devDependencies": {
35
36
  "@gridui-internal/configuration": "0.0.0-internal",
36
- "@gridui/data-cell": "1.0.2",
37
- "@gridui/loading-surface": "1.1.0",
37
+ "@gridui/data-cell": "1.0.4",
38
+ "@gridui/loading-surface": "1.1.2",
38
39
  "@jest/globals": "30.5.2",
39
- "@storybook/react-vite": "10.6.5",
40
+ "@storybook/react-vite": "10.6.6",
40
41
  "@types/jest": "30.0.0",
41
42
  "@types/node": "26.6.6",
42
43
  "@types/react": "19.3.0",