@gridui/table 1.0.0 → 1.0.2
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 +4 -4
- package/dist/index.js +15 -15
- package/dist/index.js.map +1 -1
- package/dist/styles.css +37 -43
- package/package.json +8 -5
package/README.md
CHANGED
|
@@ -5,12 +5,12 @@ Core family. Public API: `DataTable`, `DataTableBlockEdges`, `DataTableColumn`,
|
|
|
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](
|
|
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).
|
|
9
9
|
|
|
10
10
|
## Data presentation
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
[
|
|
12
|
+
Related families and their ownership are listed in the
|
|
13
|
+
[component ownership map](https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/docs/component-ownership.md).
|
|
14
14
|
|
|
15
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.
|
|
16
16
|
DataTable provides a named,
|
|
@@ -47,7 +47,7 @@ monospace identifiers. DataBadge retains caller-supplied status text with neutra
|
|
|
47
47
|
or accent tone. DataBar adds a decorative, bounded relative-volume mark without
|
|
48
48
|
replacing the displayed value; partial periods use a dashed fill and still need
|
|
49
49
|
a visible caller-owned coverage label. Source information uses the shared
|
|
50
|
-
[
|
|
50
|
+
[Disclosure](https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-core/disclosure/README.md); applications own
|
|
51
51
|
its source content and compact cell spacing. These
|
|
52
52
|
components use shared semantic theme tokens, so site brand colors and appearance
|
|
53
53
|
changes update both table variants together. They contain no domain copy, source
|
package/dist/index.js
CHANGED
|
@@ -3,29 +3,29 @@ import { cn } from "@gridui/style-utils";
|
|
|
3
3
|
import { cva } from "class-variance-authority";
|
|
4
4
|
var tableScrollStyles = cva(cn(
|
|
5
5
|
"gridui-table-scroll",
|
|
6
|
-
"min-w-0 max-w-full overflow-x-auto"
|
|
6
|
+
"gridui-u-min-w-0 gridui-u-max-w-full gridui-u-overflow-x-auto"
|
|
7
7
|
));
|
|
8
8
|
var tableStyles = cva(cn(
|
|
9
9
|
"gridui-table",
|
|
10
|
-
"w-full border-collapse type-data text-left text-foreground bg-background",
|
|
11
|
-
"[&>thead>tr>th]:text-left [&>thead>tr>th]:text-muted [&>thead>tr>th]:font-medium [&>thead>tr>th]:bg-surface",
|
|
12
|
-
"[&>:is(thead,tbody)>tr>:is(th,td)]:p-gridui-16 [&>:is(thead,tbody)>tr>:is(th,td)]:border [&>:is(thead,tbody)>tr>:is(th,td)]:border-solid [&>:is(thead,tbody)>tr>:is(th,td)]:border-border [&>:is(thead,tbody)>tr>:is(th,td)]:align-middle [&>:is(thead,tbody)>tr>:is(th,td)]:wrap-anywhere",
|
|
13
|
-
"[&>: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):last-child]:[border-inline-end-width:var(--gridui-table-inline-edge-width)]",
|
|
14
|
-
"[&>thead>tr:first-child>th]:[border-block-start-width:var(--gridui-table-block-edge-width)]",
|
|
15
|
-
"[&>tbody>tr:last-child>:is(th,td)]:[border-block-end-width:var(--gridui-table-block-edge-width)]",
|
|
16
|
-
"[&:has(>_tbody:empty)_>_thead_>_tr:last-child_>_th]:[border-block-end-width:var(--gridui-table-block-edge-width)]",
|
|
17
|
-
"[&>tbody>tr>th]:text-left [&>tbody>tr>th]:font-normal",
|
|
18
|
-
"[&>tbody>tr:hover>:is(th,td)]:bg-surface",
|
|
19
|
-
"[&>thead>.gridui-table-groups>th]:py-gridui-8 [&>thead>.gridui-table-groups>th]:text-left [&>thead>.gridui-table-groups>th]:text-foreground [&>thead>.gridui-table-groups>th]:bg-brand-tint [&>thead>.gridui-table-groups>th]:type-eyebrow",
|
|
20
|
-
"[&>:is(thead,tbody)>tr>.gridui-table-numeric]:text-right [&>:is(thead,tbody)>tr>.gridui-table-numeric]:tabular-nums"
|
|
10
|
+
"gridui-u-w-full gridui-u-border-collapse gridui-u-type-data gridui-u-text-left gridui-u-text-foreground gridui-u-bg-background",
|
|
11
|
+
"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",
|
|
12
|
+
"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",
|
|
13
|
+
"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)]",
|
|
14
|
+
"gridui-u-[&>thead>tr:first-child>th]:[border-block-start-width:var(--gridui-table-block-edge-width)]",
|
|
15
|
+
"gridui-u-[&>tbody>tr:last-child>:is(th,td)]:[border-block-end-width:var(--gridui-table-block-edge-width)]",
|
|
16
|
+
"gridui-u-[&:has(>_tbody:empty)_>_thead_>_tr:last-child_>_th]:[border-block-end-width:var(--gridui-table-block-edge-width)]",
|
|
17
|
+
"gridui-u-[&>tbody>tr>th]:text-left gridui-u-[&>tbody>tr>th]:font-normal",
|
|
18
|
+
"gridui-u-[&>tbody>tr:hover>:is(th,td)]:bg-surface",
|
|
19
|
+
"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",
|
|
20
|
+
"gridui-u-[&>:is(thead,tbody)>tr>.gridui-table-numeric]:text-right gridui-u-[&>:is(thead,tbody)>tr>.gridui-table-numeric]:tabular-nums"
|
|
21
21
|
));
|
|
22
22
|
var tableEditorialStyles = cva(cn(
|
|
23
23
|
"gridui-table-editorial",
|
|
24
|
-
"[&>tbody>tr>:is(th,td)]:py-gridui-24"
|
|
24
|
+
"gridui-u-[&>tbody>tr>:is(th,td)]:py-gridui-24"
|
|
25
25
|
));
|
|
26
26
|
var tableStructuredStyles = cva(cn(
|
|
27
27
|
"gridui-table-structured",
|
|
28
|
-
"[&>tbody>tr>th]:bg-surface"
|
|
28
|
+
"gridui-u-[&>tbody>tr>th]:bg-surface"
|
|
29
29
|
));
|
|
30
30
|
var tableVariants = cva(tableStyles(), {
|
|
31
31
|
variants: {
|
|
@@ -183,7 +183,7 @@ import { cn as cn3 } from "@gridui/style-utils";
|
|
|
183
183
|
import { cva as cva2 } from "class-variance-authority";
|
|
184
184
|
var tablePlaceholderStyles = cva2(cn3(
|
|
185
185
|
"gridui-table-placeholder",
|
|
186
|
-
"pointer-events-none"
|
|
186
|
+
"gridui-u-pointer-events-none"
|
|
187
187
|
));
|
|
188
188
|
|
|
189
189
|
// src/data-table-placeholder/data-table-placeholder.tsx
|
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 \"min-w-0 max-w-full overflow-x-auto\",\n));\n\nexport const tableStyles = cva(cn(\n \"gridui-table\",\n \"w-full border-collapse type-data text-left text-foreground bg-background\",\n \"[&>thead>tr>th]:text-left [&>thead>tr>th]:text-muted [&>thead>tr>th]:font-medium [&>thead>tr>th]:bg-surface\",\n \"[&>:is(thead,tbody)>tr>:is(th,td)]:p-gridui-16 [&>:is(thead,tbody)>tr>:is(th,td)]:border [&>:is(thead,tbody)>tr>:is(th,td)]:border-solid [&>:is(thead,tbody)>tr>:is(th,td)]:border-border [&>:is(thead,tbody)>tr>:is(th,td)]:align-middle [&>:is(thead,tbody)>tr>:is(th,td)]:wrap-anywhere\",\n \"[&>: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):last-child]:[border-inline-end-width:var(--gridui-table-inline-edge-width)]\",\n \"[&>thead>tr:first-child>th]:[border-block-start-width:var(--gridui-table-block-edge-width)]\",\n \"[&>tbody>tr:last-child>:is(th,td)]:[border-block-end-width:var(--gridui-table-block-edge-width)]\",\n \"[&:has(>_tbody:empty)_>_thead_>_tr:last-child_>_th]:[border-block-end-width:var(--gridui-table-block-edge-width)]\",\n \"[&>tbody>tr>th]:text-left [&>tbody>tr>th]:font-normal\",\n \"[&>tbody>tr:hover>:is(th,td)]:bg-surface\",\n \"[&>thead>.gridui-table-groups>th]:py-gridui-8 [&>thead>.gridui-table-groups>th]:text-left [&>thead>.gridui-table-groups>th]:text-foreground [&>thead>.gridui-table-groups>th]:bg-brand-tint [&>thead>.gridui-table-groups>th]:type-eyebrow\",\n \"[&>:is(thead,tbody)>tr>.gridui-table-numeric]:text-right [&>:is(thead,tbody)>tr>.gridui-table-numeric]:tabular-nums\",\n));\n\nexport const tableEditorialStyles = cva(cn(\n \"gridui-table-editorial\",\n \"[&>tbody>tr>:is(th,td)]:py-gridui-24\",\n));\n\nexport const tableStructuredStyles = cva(cn(\n \"gridui-table-structured\",\n \"[&>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 { 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 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 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 \"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"],
|
|
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 { 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 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 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
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,MAAAA,WAAU;AACnB,SAAS,yBAA0C;AA6E3B,cAKZ,YALY;AA5DjB,IAAM,YAAgC,CAAC,UAA0B;AACpE,QAAM;AAAA,IACF;AAAA,IACA;AAAA,IACA;AAAA,IACA,UAAU;AAAA,IACV;AAAA,IACA,OAAO,CAAC;AAAA,IACR;AAAA,IACA,YAAY;AAAA,IAC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AA;AAAA,MACJ;AAAA;AAAA,EACJ;AACJ;;;ACvIA,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
|
}
|
package/dist/styles.css
CHANGED
|
@@ -8,129 +8,123 @@
|
|
|
8
8
|
}
|
|
9
9
|
}
|
|
10
10
|
@layer utilities {
|
|
11
|
-
.pointer-events-none {
|
|
11
|
+
.gridui-u-pointer-events-none {
|
|
12
12
|
pointer-events: none;
|
|
13
13
|
}
|
|
14
|
-
.
|
|
15
|
-
display: block;
|
|
16
|
-
}
|
|
17
|
-
.table {
|
|
18
|
-
display: table;
|
|
19
|
-
}
|
|
20
|
-
.w-full {
|
|
14
|
+
.gridui-u-w-full {
|
|
21
15
|
width: 100%;
|
|
22
16
|
}
|
|
23
|
-
.max-w-full {
|
|
17
|
+
.gridui-u-max-w-full {
|
|
24
18
|
max-width: 100%;
|
|
25
19
|
}
|
|
26
|
-
.min-w-0 {
|
|
20
|
+
.gridui-u-min-w-0 {
|
|
27
21
|
min-width: 0px;
|
|
28
22
|
}
|
|
29
|
-
.border-collapse {
|
|
23
|
+
.gridui-u-border-collapse {
|
|
30
24
|
border-collapse: collapse;
|
|
31
25
|
}
|
|
32
|
-
.overflow-x-auto {
|
|
26
|
+
.gridui-u-overflow-x-auto {
|
|
33
27
|
overflow-x: auto;
|
|
34
28
|
}
|
|
35
|
-
.bg-background {
|
|
29
|
+
.gridui-u-bg-background {
|
|
36
30
|
background-color: var(--gridui-background);
|
|
37
31
|
}
|
|
38
|
-
.text-left {
|
|
32
|
+
.gridui-u-text-left {
|
|
39
33
|
text-align: left;
|
|
40
34
|
}
|
|
41
|
-
.type-data {
|
|
35
|
+
.gridui-u-type-data {
|
|
42
36
|
font: var(--gridui-type-data);
|
|
43
37
|
letter-spacing: normal;
|
|
44
38
|
font-variant-numeric: tabular-nums;
|
|
45
39
|
}
|
|
46
|
-
.text-foreground {
|
|
40
|
+
.gridui-u-text-foreground {
|
|
47
41
|
color: var(--gridui-foreground);
|
|
48
42
|
}
|
|
49
|
-
|
|
43
|
+
.gridui-u-\[\&\: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 {
|
|
50
44
|
border-block-end-width: var(--gridui-table-block-edge-width);
|
|
51
45
|
}
|
|
52
|
-
|
|
46
|
+
.gridui-u-\[\&\>\:is\(thead\,tbody\)\>tr\>\.gridui-table-numeric\]\:text-right > :is(thead, tbody) > tr > .gridui-table-numeric {
|
|
53
47
|
text-align: right;
|
|
54
48
|
}
|
|
55
|
-
|
|
49
|
+
.gridui-u-\[\&\>\:is\(thead\,tbody\)\>tr\>\.gridui-table-numeric\]\:tabular-nums > :is(thead, tbody) > tr > .gridui-table-numeric {
|
|
56
50
|
--tw-numeric-spacing: tabular-nums;
|
|
57
51
|
font-variant-numeric: var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,);
|
|
58
52
|
}
|
|
59
|
-
|
|
53
|
+
.gridui-u-\[\&\>\:is\(thead\,tbody\)\>tr\>\:is\(th\,td\)\]\:border > :is(thead, tbody) > tr > :is(th, td) {
|
|
60
54
|
border-style: var(--tw-border-style);
|
|
61
55
|
border-width: 1px;
|
|
62
56
|
}
|
|
63
|
-
|
|
57
|
+
.gridui-u-\[\&\>\:is\(thead\,tbody\)\>tr\>\:is\(th\,td\)\]\:border-solid > :is(thead, tbody) > tr > :is(th, td) {
|
|
64
58
|
--tw-border-style: solid;
|
|
65
59
|
border-style: solid;
|
|
66
60
|
}
|
|
67
|
-
|
|
61
|
+
.gridui-u-\[\&\>\:is\(thead\,tbody\)\>tr\>\:is\(th\,td\)\]\:border-border > :is(thead, tbody) > tr > :is(th, td) {
|
|
68
62
|
border-color: var(--gridui-border);
|
|
69
63
|
}
|
|
70
|
-
|
|
64
|
+
.gridui-u-\[\&\>\:is\(thead\,tbody\)\>tr\>\:is\(th\,td\)\]\:p-gridui-16 > :is(thead, tbody) > tr > :is(th, td) {
|
|
71
65
|
padding: var(--gridui-space-16);
|
|
72
66
|
}
|
|
73
|
-
|
|
67
|
+
.gridui-u-\[\&\>\:is\(thead\,tbody\)\>tr\>\:is\(th\,td\)\]\:align-middle > :is(thead, tbody) > tr > :is(th, td) {
|
|
74
68
|
vertical-align: middle;
|
|
75
69
|
}
|
|
76
|
-
|
|
70
|
+
.gridui-u-\[\&\>\:is\(thead\,tbody\)\>tr\>\:is\(th\,td\)\]\:wrap-anywhere > :is(thead, tbody) > tr > :is(th, td) {
|
|
77
71
|
overflow-wrap: anywhere;
|
|
78
72
|
}
|
|
79
|
-
|
|
73
|
+
.gridui-u-\[\&\>\: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 {
|
|
80
74
|
border-inline-start-width: var(--gridui-table-inline-edge-width);
|
|
81
75
|
}
|
|
82
|
-
|
|
76
|
+
.gridui-u-\[\&\>\: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 {
|
|
83
77
|
border-inline-end-width: var(--gridui-table-inline-edge-width);
|
|
84
78
|
}
|
|
85
|
-
|
|
79
|
+
.gridui-u-\[\&\>tbody\>tr\:hover\>\:is\(th\,td\)\]\:bg-surface > tbody > tr:hover > :is(th, td) {
|
|
86
80
|
background-color: var(--gridui-surface);
|
|
87
81
|
}
|
|
88
|
-
|
|
82
|
+
.gridui-u-\[\&\>tbody\>tr\:last-child\>\:is\(th\,td\)\]\:\[border-block-end-width\:var\(--gridui-table-block-edge-width\)\] > tbody > tr:last-child > :is(th, td) {
|
|
89
83
|
border-block-end-width: var(--gridui-table-block-edge-width);
|
|
90
84
|
}
|
|
91
|
-
|
|
85
|
+
.gridui-u-\[\&\>tbody\>tr\>\:is\(th\,td\)\]\:py-gridui-24 > tbody > tr > :is(th, td) {
|
|
92
86
|
padding-block: var(--gridui-space-24);
|
|
93
87
|
}
|
|
94
|
-
|
|
88
|
+
.gridui-u-\[\&\>tbody\>tr\>th\]\:bg-surface > tbody > tr > th {
|
|
95
89
|
background-color: var(--gridui-surface);
|
|
96
90
|
}
|
|
97
|
-
|
|
91
|
+
.gridui-u-\[\&\>tbody\>tr\>th\]\:text-left > tbody > tr > th {
|
|
98
92
|
text-align: left;
|
|
99
93
|
}
|
|
100
|
-
|
|
94
|
+
.gridui-u-\[\&\>tbody\>tr\>th\]\:font-normal > tbody > tr > th {
|
|
101
95
|
--tw-font-weight: var(--font-weight-normal);
|
|
102
96
|
font-weight: var(--font-weight-normal);
|
|
103
97
|
}
|
|
104
|
-
|
|
98
|
+
.gridui-u-\[\&\>thead\>\.gridui-table-groups\>th\]\:bg-brand-tint > thead > .gridui-table-groups > th {
|
|
105
99
|
background-color: var(--gridui-brand-tint);
|
|
106
100
|
}
|
|
107
|
-
|
|
101
|
+
.gridui-u-\[\&\>thead\>\.gridui-table-groups\>th\]\:py-gridui-8 > thead > .gridui-table-groups > th {
|
|
108
102
|
padding-block: var(--gridui-space-8);
|
|
109
103
|
}
|
|
110
|
-
|
|
104
|
+
.gridui-u-\[\&\>thead\>\.gridui-table-groups\>th\]\:text-left > thead > .gridui-table-groups > th {
|
|
111
105
|
text-align: left;
|
|
112
106
|
}
|
|
113
|
-
|
|
107
|
+
.gridui-u-\[\&\>thead\>\.gridui-table-groups\>th\]\:type-eyebrow > thead > .gridui-table-groups > th {
|
|
114
108
|
font: var(--gridui-type-eyebrow);
|
|
115
109
|
letter-spacing: 0.08em;
|
|
116
110
|
}
|
|
117
|
-
|
|
111
|
+
.gridui-u-\[\&\>thead\>\.gridui-table-groups\>th\]\:text-foreground > thead > .gridui-table-groups > th {
|
|
118
112
|
color: var(--gridui-foreground);
|
|
119
113
|
}
|
|
120
|
-
|
|
114
|
+
.gridui-u-\[\&\>thead\>tr\:first-child\>th\]\:\[border-block-start-width\:var\(--gridui-table-block-edge-width\)\] > thead > tr:first-child > th {
|
|
121
115
|
border-block-start-width: var(--gridui-table-block-edge-width);
|
|
122
116
|
}
|
|
123
|
-
|
|
117
|
+
.gridui-u-\[\&\>thead\>tr\>th\]\:bg-surface > thead > tr > th {
|
|
124
118
|
background-color: var(--gridui-surface);
|
|
125
119
|
}
|
|
126
|
-
|
|
120
|
+
.gridui-u-\[\&\>thead\>tr\>th\]\:text-left > thead > tr > th {
|
|
127
121
|
text-align: left;
|
|
128
122
|
}
|
|
129
|
-
|
|
123
|
+
.gridui-u-\[\&\>thead\>tr\>th\]\:font-medium > thead > tr > th {
|
|
130
124
|
--tw-font-weight: var(--font-weight-medium);
|
|
131
125
|
font-weight: var(--font-weight-medium);
|
|
132
126
|
}
|
|
133
|
-
|
|
127
|
+
.gridui-u-\[\&\>thead\>tr\>th\]\:text-muted > thead > tr > th {
|
|
134
128
|
color: var(--gridui-muted);
|
|
135
129
|
}
|
|
136
130
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gridui/table",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "GridUI React table",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"type": "module",
|
|
@@ -26,15 +26,18 @@
|
|
|
26
26
|
"react-dom": "^19.2.0"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@gridui/style-utils": "^2.1.
|
|
30
|
-
"@gridui/theme": "^2.
|
|
29
|
+
"@gridui/style-utils": "^2.1.4",
|
|
30
|
+
"@gridui/theme": "^2.3.2",
|
|
31
31
|
"class-variance-authority": "0.7.1"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
|
-
"@gridui-internal/configuration": "0.0.0",
|
|
34
|
+
"@gridui-internal/configuration": "0.0.0-internal",
|
|
35
|
+
"@gridui/data-cell": "1.0.2",
|
|
36
|
+
"@gridui/loading-surface": "1.0.2",
|
|
35
37
|
"@jest/globals": "30.5.2",
|
|
38
|
+
"@storybook/react-vite": "10.6.5",
|
|
36
39
|
"@types/jest": "30.0.0",
|
|
37
|
-
"@types/node": "26.6.
|
|
40
|
+
"@types/node": "26.6.6",
|
|
38
41
|
"@types/react": "19.3.0",
|
|
39
42
|
"@types/react-dom": "19.3.0",
|
|
40
43
|
"jest": "30.5.2",
|