@gridui/table 0.0.0-stage → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +58 -2
- package/dist/data-table/data-table.d.ts +23 -0
- package/dist/data-table/style.d.ts +13 -0
- package/dist/data-table-placeholder/data-table-placeholder.d.ts +12 -0
- package/dist/data-table-placeholder/style.d.ts +7 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.js +218 -0
- package/dist/index.js.map +7 -0
- package/dist/shared/types.d.ts +19 -0
- package/dist/styles.css +224 -0
- package/package.json +48 -3
package/README.md
CHANGED
|
@@ -1,3 +1,59 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @gridui/table
|
|
2
|
+
|
|
3
|
+
Core family. Public API: `DataTable`, `DataTableBlockEdges`, `DataTableColumn`, `DataTableColumnGroup`, `DataTableInlineEdges`, `DataTablePlaceholder`, `DataTablePlaceholderProps`, `DataTableProps`, `DataTableVariant`.
|
|
4
|
+
|
|
5
|
+
Import components from `@gridui/table` and load `@gridui/table/styles.css` after Theme.
|
|
6
|
+
Load styles for any composed dependency used by this family. Applications own routes, labels, state persistence, and branding.
|
|
7
|
+
|
|
8
|
+
See [component ownership](../../docs/component-ownership.md) and [release history](.changeset/history/).
|
|
9
|
+
|
|
10
|
+
## Data presentation
|
|
11
|
+
|
|
12
|
+
Source groups and test placement are documented in the
|
|
13
|
+
[Data package README](../../docs/component-ownership.md).
|
|
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.
|
|
16
|
+
DataTable provides a named,
|
|
17
|
+
keyboard-focusable horizontal scroll region, scoped column headers, optional
|
|
18
|
+
initial rows, and a stable tbody ID. Each `DataTableColumn` defines its `label`,
|
|
19
|
+
optional `numeric` alignment, and optional `sizing` for width/minWidth/maxWidth.
|
|
20
|
+
Columns default to left alignment. There are no parallel positional alignment or
|
|
21
|
+
sizing props. `rowHeader` makes the first body cell a scoped row header.
|
|
22
|
+
`minWidth` controls the whole table; column sizing applies only to leaf headers
|
|
23
|
+
and body cells, never to grouped headers. DataTable retains both `editorial` (default) and `structured` variants. Both use
|
|
24
|
+
square cells with continuous horizontal and vertical grid boundaries. Editorial
|
|
25
|
+
rows have more reading space; structured rows are compact and emphasize row
|
|
26
|
+
headers. Optional `columnGroups` use labeled positive integer spans that must
|
|
27
|
+
cover all columns. Native colgroups and scoped group headers preserve the table
|
|
28
|
+
relationships; mixed numeric alignment never applies to group headings.
|
|
29
|
+
`inlineEdges` defaults to `"both"`; `"none"` delegates the two outer inline
|
|
30
|
+
cell boundaries to an enclosing frame while retaining internal lines.
|
|
31
|
+
`blockEdges` independently controls the top and bottom outer boundaries with
|
|
32
|
+
the same values and responsive syntax, defaulting to `"both"`. This includes
|
|
33
|
+
grouped headers and empty tables. For a flush table whose enclosing frame owns
|
|
34
|
+
all four edges, set both edge props to `"none"`; restore `"both"` at the
|
|
35
|
+
breakpoint where table-row padding returns. Internal cell lines remain visible.
|
|
36
|
+
It accepts a scalar or `{ base, md?, lg? }`, using 40rem and 64rem breakpoints
|
|
37
|
+
and inheriting omitted values. Callers declare matching table-row padding;
|
|
38
|
+
DataTable does not infer its enclosing layout.
|
|
39
|
+
|
|
40
|
+
Supply `rowKeys` alongside `rows` for editable or reordered records. Keys must be
|
|
41
|
+
unique and match the row count; each key identifies the same record across updates.
|
|
42
|
+
Omitting keys retains positional identity for static tables. DataExplorer supplies
|
|
43
|
+
its stable record IDs automatically.
|
|
44
|
+
|
|
45
|
+
The related `@gridui/data-cell` family provides DataValue, which separates a primary value from optional secondary context and supports
|
|
46
|
+
monospace identifiers. DataBadge retains caller-supplied status text with neutral
|
|
47
|
+
or accent tone. DataBar adds a decorative, bounded relative-volume mark without
|
|
48
|
+
replacing the displayed value; partial periods use a dashed fill and still need
|
|
49
|
+
a visible caller-owned coverage label. Source information uses the shared
|
|
50
|
+
[Controls Disclosure](../../docs/component-ownership.md); applications own
|
|
51
|
+
its source content and compact cell spacing. These
|
|
52
|
+
components use shared semantic theme tokens, so site brand colors and appearance
|
|
53
|
+
changes update both table variants together. They contain no domain copy, source
|
|
54
|
+
queries, sorting, or filtering logic.
|
|
55
|
+
|
|
56
|
+
These static React components require no additional hydration. The application owns
|
|
57
|
+
query logic, status text, content, and column labels. Load Theme, Table, and rendered data-cell styles
|
|
58
|
+
through the application stylesheet.
|
|
2
59
|
|
|
3
|
-
This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author WMXPY
|
|
3
|
+
* @package Table
|
|
4
|
+
* @namespace DataTable
|
|
5
|
+
* @description Data Table
|
|
6
|
+
*/
|
|
7
|
+
import type { DataTableBlockEdges, DataTableColumn, DataTableColumnGroup, DataTableInlineEdges, DataTableVariant } from "../shared/types";
|
|
8
|
+
import { type Responsive } from "@gridui/style-utils/responsive";
|
|
9
|
+
import type { ComponentPropsWithRef, CSSProperties, FC, Key, ReactNode } from "react";
|
|
10
|
+
export type DataTableProps = Omit<ComponentPropsWithRef<"table">, "children"> & {
|
|
11
|
+
readonly label: string;
|
|
12
|
+
readonly columns: readonly DataTableColumn[];
|
|
13
|
+
readonly columnGroups?: readonly DataTableColumnGroup[];
|
|
14
|
+
readonly variant?: DataTableVariant;
|
|
15
|
+
readonly bodyId?: string;
|
|
16
|
+
readonly rows?: readonly (readonly ReactNode[])[];
|
|
17
|
+
readonly rowKeys?: readonly Key[];
|
|
18
|
+
readonly rowHeader?: boolean;
|
|
19
|
+
readonly minWidth?: CSSProperties["minWidth"];
|
|
20
|
+
readonly blockEdges?: Responsive<DataTableBlockEdges>;
|
|
21
|
+
readonly inlineEdges?: Responsive<DataTableInlineEdges>;
|
|
22
|
+
};
|
|
23
|
+
export declare const DataTable: FC<DataTableProps>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author WMXPY
|
|
3
|
+
* @package Table
|
|
4
|
+
* @namespace DataTable
|
|
5
|
+
* @description Style
|
|
6
|
+
*/
|
|
7
|
+
export declare const tableScrollStyles: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
|
8
|
+
export declare const tableStyles: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
|
9
|
+
export declare const tableEditorialStyles: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
|
10
|
+
export declare const tableStructuredStyles: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
|
11
|
+
export declare const tableVariants: (props?: ({
|
|
12
|
+
variant?: "editorial" | "structured" | null | undefined;
|
|
13
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author WMXPY
|
|
3
|
+
* @package Table
|
|
4
|
+
* @namespace DataTablePlaceholder
|
|
5
|
+
* @description Data Table Placeholder
|
|
6
|
+
*/
|
|
7
|
+
import { type DataTableProps } from "../data-table/data-table";
|
|
8
|
+
import type { FC } from "react";
|
|
9
|
+
export type DataTablePlaceholderProps = Omit<DataTableProps, "rows"> & {
|
|
10
|
+
readonly rowCount?: number;
|
|
11
|
+
};
|
|
12
|
+
export declare const DataTablePlaceholder: FC<DataTablePlaceholderProps>;
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author WMXPY
|
|
3
|
+
* @package Table
|
|
4
|
+
* @namespace Root
|
|
5
|
+
* @description Index
|
|
6
|
+
*/
|
|
7
|
+
export type { DataTableProps } from "./data-table/data-table";
|
|
8
|
+
export { DataTable } from "./data-table/data-table";
|
|
9
|
+
export type { DataTablePlaceholderProps } from "./data-table-placeholder/data-table-placeholder";
|
|
10
|
+
export { DataTablePlaceholder } from "./data-table-placeholder/data-table-placeholder";
|
|
11
|
+
export type { DataTableBlockEdges } from "./shared/types";
|
|
12
|
+
export type { DataTableColumn } from "./shared/types";
|
|
13
|
+
export type { DataTableColumnGroup } from "./shared/types";
|
|
14
|
+
export type { DataTableInlineEdges } from "./shared/types";
|
|
15
|
+
export type { DataTableVariant } from "./shared/types";
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
// src/data-table/style.ts
|
|
2
|
+
import { cn } from "@gridui/style-utils";
|
|
3
|
+
import { cva } from "class-variance-authority";
|
|
4
|
+
var tableScrollStyles = cva(cn(
|
|
5
|
+
"gridui-table-scroll",
|
|
6
|
+
"min-w-0 max-w-full overflow-x-auto"
|
|
7
|
+
));
|
|
8
|
+
var tableStyles = cva(cn(
|
|
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"
|
|
21
|
+
));
|
|
22
|
+
var tableEditorialStyles = cva(cn(
|
|
23
|
+
"gridui-table-editorial",
|
|
24
|
+
"[&>tbody>tr>:is(th,td)]:py-gridui-24"
|
|
25
|
+
));
|
|
26
|
+
var tableStructuredStyles = cva(cn(
|
|
27
|
+
"gridui-table-structured",
|
|
28
|
+
"[&>tbody>tr>th]:bg-surface"
|
|
29
|
+
));
|
|
30
|
+
var tableVariants = cva(tableStyles(), {
|
|
31
|
+
variants: {
|
|
32
|
+
variant: {
|
|
33
|
+
editorial: tableEditorialStyles(),
|
|
34
|
+
structured: tableStructuredStyles()
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
defaultVariants: {
|
|
38
|
+
variant: "editorial"
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
// src/data-table/data-table.tsx
|
|
43
|
+
import { cn as cn2 } from "@gridui/style-utils";
|
|
44
|
+
import { resolveResponsive } from "@gridui/style-utils/responsive";
|
|
45
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
46
|
+
var DataTable = (props) => {
|
|
47
|
+
const {
|
|
48
|
+
label,
|
|
49
|
+
columns,
|
|
50
|
+
columnGroups,
|
|
51
|
+
variant = "editorial",
|
|
52
|
+
bodyId,
|
|
53
|
+
rows = [],
|
|
54
|
+
rowKeys,
|
|
55
|
+
rowHeader = false,
|
|
56
|
+
minWidth,
|
|
57
|
+
inlineEdges = "both",
|
|
58
|
+
blockEdges = "both",
|
|
59
|
+
className,
|
|
60
|
+
style,
|
|
61
|
+
...restProps
|
|
62
|
+
} = props;
|
|
63
|
+
const block = resolveResponsive(blockEdges);
|
|
64
|
+
const edges = resolveResponsive(inlineEdges);
|
|
65
|
+
const invalidRowKeys = rowKeys && (rowKeys.length !== rows.length || new Set(rowKeys.map(String)).size !== rowKeys.length);
|
|
66
|
+
if (invalidRowKeys) {
|
|
67
|
+
throw new Error("DataTable row keys must be unique and match the rows.");
|
|
68
|
+
}
|
|
69
|
+
if (rows.some((row) => {
|
|
70
|
+
return row.length !== columns.length;
|
|
71
|
+
})) {
|
|
72
|
+
throw new RangeError("DataTable rows must match the declared columns.");
|
|
73
|
+
}
|
|
74
|
+
if (columnGroups && (columnGroups.some((group) => {
|
|
75
|
+
return !Number.isInteger(group.span) || group.span < 1;
|
|
76
|
+
}) || columnGroups.reduce((total, group) => {
|
|
77
|
+
return total + group.span;
|
|
78
|
+
}, 0) !== columns.length)) {
|
|
79
|
+
throw new Error("DataTable column groups must cover every column with positive integer spans.");
|
|
80
|
+
}
|
|
81
|
+
return /* @__PURE__ */ jsx(
|
|
82
|
+
"div",
|
|
83
|
+
{
|
|
84
|
+
className: cn2(tableScrollStyles()),
|
|
85
|
+
role: "region",
|
|
86
|
+
"aria-label": label,
|
|
87
|
+
tabIndex: 0,
|
|
88
|
+
children: /* @__PURE__ */ jsxs(
|
|
89
|
+
"table",
|
|
90
|
+
{
|
|
91
|
+
...restProps,
|
|
92
|
+
"aria-label": label,
|
|
93
|
+
"data-block-edges": block.base,
|
|
94
|
+
"data-block-edges-md": block.md,
|
|
95
|
+
"data-block-edges-lg": block.lg,
|
|
96
|
+
"data-inline-edges": edges.base,
|
|
97
|
+
"data-inline-edges-md": edges.md,
|
|
98
|
+
"data-inline-edges-lg": edges.lg,
|
|
99
|
+
style: {
|
|
100
|
+
minWidth,
|
|
101
|
+
...style
|
|
102
|
+
},
|
|
103
|
+
className: cn2(tableVariants({
|
|
104
|
+
variant
|
|
105
|
+
}), className),
|
|
106
|
+
children: [
|
|
107
|
+
columnGroups?.map((group, index) => {
|
|
108
|
+
return /* @__PURE__ */ jsx(
|
|
109
|
+
"colgroup",
|
|
110
|
+
{
|
|
111
|
+
span: group.span
|
|
112
|
+
},
|
|
113
|
+
index
|
|
114
|
+
);
|
|
115
|
+
}),
|
|
116
|
+
/* @__PURE__ */ jsxs("thead", { children: [
|
|
117
|
+
columnGroups && /* @__PURE__ */ jsx(
|
|
118
|
+
"tr",
|
|
119
|
+
{
|
|
120
|
+
className: "gridui-table-groups",
|
|
121
|
+
children: columnGroups.map((group, index) => {
|
|
122
|
+
return /* @__PURE__ */ jsx(
|
|
123
|
+
"th",
|
|
124
|
+
{
|
|
125
|
+
scope: "colgroup",
|
|
126
|
+
colSpan: group.span,
|
|
127
|
+
children: group.label
|
|
128
|
+
},
|
|
129
|
+
index
|
|
130
|
+
);
|
|
131
|
+
})
|
|
132
|
+
}
|
|
133
|
+
),
|
|
134
|
+
/* @__PURE__ */ jsx("tr", { children: columns.map((column, index) => {
|
|
135
|
+
return /* @__PURE__ */ jsx(
|
|
136
|
+
"th",
|
|
137
|
+
{
|
|
138
|
+
scope: "col",
|
|
139
|
+
style: column.sizing,
|
|
140
|
+
className: column.numeric ? "gridui-table-numeric" : void 0,
|
|
141
|
+
children: column.label
|
|
142
|
+
},
|
|
143
|
+
index
|
|
144
|
+
);
|
|
145
|
+
}) })
|
|
146
|
+
] }),
|
|
147
|
+
/* @__PURE__ */ jsx(
|
|
148
|
+
"tbody",
|
|
149
|
+
{
|
|
150
|
+
id: bodyId,
|
|
151
|
+
children: rows.map((row, index) => {
|
|
152
|
+
return /* @__PURE__ */ jsx(
|
|
153
|
+
"tr",
|
|
154
|
+
{
|
|
155
|
+
children: row.map((cell, cellIndex) => {
|
|
156
|
+
const Cell = rowHeader && cellIndex === 0 ? "th" : "td";
|
|
157
|
+
return /* @__PURE__ */ jsx(
|
|
158
|
+
Cell,
|
|
159
|
+
{
|
|
160
|
+
scope: Cell === "th" ? "row" : void 0,
|
|
161
|
+
style: columns[cellIndex]?.sizing,
|
|
162
|
+
className: columns[cellIndex]?.numeric ? "gridui-table-numeric" : void 0,
|
|
163
|
+
children: cell
|
|
164
|
+
},
|
|
165
|
+
cellIndex
|
|
166
|
+
);
|
|
167
|
+
})
|
|
168
|
+
},
|
|
169
|
+
rowKeys?.[index] ?? index
|
|
170
|
+
);
|
|
171
|
+
})
|
|
172
|
+
}
|
|
173
|
+
)
|
|
174
|
+
]
|
|
175
|
+
}
|
|
176
|
+
)
|
|
177
|
+
}
|
|
178
|
+
);
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
// src/data-table-placeholder/style.ts
|
|
182
|
+
import { cn as cn3 } from "@gridui/style-utils";
|
|
183
|
+
import { cva as cva2 } from "class-variance-authority";
|
|
184
|
+
var tablePlaceholderStyles = cva2(cn3(
|
|
185
|
+
"gridui-table-placeholder",
|
|
186
|
+
"pointer-events-none"
|
|
187
|
+
));
|
|
188
|
+
|
|
189
|
+
// src/data-table-placeholder/data-table-placeholder.tsx
|
|
190
|
+
import { cn as cn4 } from "@gridui/style-utils";
|
|
191
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
192
|
+
var DataTablePlaceholder = (props) => {
|
|
193
|
+
const { rowCount = 5, ...restProps } = props;
|
|
194
|
+
return /* @__PURE__ */ jsx2(
|
|
195
|
+
"div",
|
|
196
|
+
{
|
|
197
|
+
className: cn4(tablePlaceholderStyles()),
|
|
198
|
+
"aria-hidden": "true",
|
|
199
|
+
inert: true,
|
|
200
|
+
children: /* @__PURE__ */ jsx2(
|
|
201
|
+
DataTable,
|
|
202
|
+
{
|
|
203
|
+
...restProps,
|
|
204
|
+
rows: Array.from({ length: rowCount }, () => {
|
|
205
|
+
return restProps.columns.map(() => {
|
|
206
|
+
return "\u2014";
|
|
207
|
+
});
|
|
208
|
+
})
|
|
209
|
+
}
|
|
210
|
+
)
|
|
211
|
+
}
|
|
212
|
+
);
|
|
213
|
+
};
|
|
214
|
+
export {
|
|
215
|
+
DataTable,
|
|
216
|
+
DataTablePlaceholder
|
|
217
|
+
};
|
|
218
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 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"],
|
|
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,EAC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AACJ;",
|
|
6
|
+
"names": ["cn", "cn", "cva", "cn", "jsx"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author WMXPY
|
|
3
|
+
* @package Table
|
|
4
|
+
* @namespace Shared
|
|
5
|
+
* @description Types
|
|
6
|
+
*/
|
|
7
|
+
import type { CSSProperties } from "react";
|
|
8
|
+
export type DataTableVariant = "editorial" | "structured";
|
|
9
|
+
export type DataTableInlineEdges = "both" | "none";
|
|
10
|
+
export type DataTableBlockEdges = "both" | "none";
|
|
11
|
+
export type DataTableColumnGroup = {
|
|
12
|
+
readonly label: string;
|
|
13
|
+
readonly span: number;
|
|
14
|
+
};
|
|
15
|
+
export type DataTableColumn = {
|
|
16
|
+
readonly label: string;
|
|
17
|
+
readonly numeric?: boolean;
|
|
18
|
+
readonly sizing?: Pick<CSSProperties, "width" | "minWidth" | "maxWidth"> | undefined;
|
|
19
|
+
};
|
package/dist/styles.css
ADDED
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */
|
|
2
|
+
@layer properties;
|
|
3
|
+
@layer theme, base, components, utilities;
|
|
4
|
+
@layer theme {
|
|
5
|
+
:root, :host {
|
|
6
|
+
--font-weight-normal: 400;
|
|
7
|
+
--font-weight-medium: 500;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
@layer utilities {
|
|
11
|
+
.pointer-events-none {
|
|
12
|
+
pointer-events: none;
|
|
13
|
+
}
|
|
14
|
+
.block {
|
|
15
|
+
display: block;
|
|
16
|
+
}
|
|
17
|
+
.table {
|
|
18
|
+
display: table;
|
|
19
|
+
}
|
|
20
|
+
.w-full {
|
|
21
|
+
width: 100%;
|
|
22
|
+
}
|
|
23
|
+
.max-w-full {
|
|
24
|
+
max-width: 100%;
|
|
25
|
+
}
|
|
26
|
+
.min-w-0 {
|
|
27
|
+
min-width: 0px;
|
|
28
|
+
}
|
|
29
|
+
.border-collapse {
|
|
30
|
+
border-collapse: collapse;
|
|
31
|
+
}
|
|
32
|
+
.overflow-x-auto {
|
|
33
|
+
overflow-x: auto;
|
|
34
|
+
}
|
|
35
|
+
.bg-background {
|
|
36
|
+
background-color: var(--gridui-background);
|
|
37
|
+
}
|
|
38
|
+
.text-left {
|
|
39
|
+
text-align: left;
|
|
40
|
+
}
|
|
41
|
+
.type-data {
|
|
42
|
+
font: var(--gridui-type-data);
|
|
43
|
+
letter-spacing: normal;
|
|
44
|
+
font-variant-numeric: tabular-nums;
|
|
45
|
+
}
|
|
46
|
+
.text-foreground {
|
|
47
|
+
color: var(--gridui-foreground);
|
|
48
|
+
}
|
|
49
|
+
.\[\&\: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
|
+
border-block-end-width: var(--gridui-table-block-edge-width);
|
|
51
|
+
}
|
|
52
|
+
.\[\&\>\:is\(thead\,tbody\)\>tr\>\.gridui-table-numeric\]\:text-right > :is(thead, tbody) > tr > .gridui-table-numeric {
|
|
53
|
+
text-align: right;
|
|
54
|
+
}
|
|
55
|
+
.\[\&\>\:is\(thead\,tbody\)\>tr\>\.gridui-table-numeric\]\:tabular-nums > :is(thead, tbody) > tr > .gridui-table-numeric {
|
|
56
|
+
--tw-numeric-spacing: tabular-nums;
|
|
57
|
+
font-variant-numeric: var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,);
|
|
58
|
+
}
|
|
59
|
+
.\[\&\>\:is\(thead\,tbody\)\>tr\>\:is\(th\,td\)\]\:border > :is(thead, tbody) > tr > :is(th, td) {
|
|
60
|
+
border-style: var(--tw-border-style);
|
|
61
|
+
border-width: 1px;
|
|
62
|
+
}
|
|
63
|
+
.\[\&\>\:is\(thead\,tbody\)\>tr\>\:is\(th\,td\)\]\:border-solid > :is(thead, tbody) > tr > :is(th, td) {
|
|
64
|
+
--tw-border-style: solid;
|
|
65
|
+
border-style: solid;
|
|
66
|
+
}
|
|
67
|
+
.\[\&\>\:is\(thead\,tbody\)\>tr\>\:is\(th\,td\)\]\:border-border > :is(thead, tbody) > tr > :is(th, td) {
|
|
68
|
+
border-color: var(--gridui-border);
|
|
69
|
+
}
|
|
70
|
+
.\[\&\>\:is\(thead\,tbody\)\>tr\>\:is\(th\,td\)\]\:p-gridui-16 > :is(thead, tbody) > tr > :is(th, td) {
|
|
71
|
+
padding: var(--gridui-space-16);
|
|
72
|
+
}
|
|
73
|
+
.\[\&\>\:is\(thead\,tbody\)\>tr\>\:is\(th\,td\)\]\:align-middle > :is(thead, tbody) > tr > :is(th, td) {
|
|
74
|
+
vertical-align: middle;
|
|
75
|
+
}
|
|
76
|
+
.\[\&\>\:is\(thead\,tbody\)\>tr\>\:is\(th\,td\)\]\:wrap-anywhere > :is(thead, tbody) > tr > :is(th, td) {
|
|
77
|
+
overflow-wrap: anywhere;
|
|
78
|
+
}
|
|
79
|
+
.\[\&\>\: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
|
+
border-inline-start-width: var(--gridui-table-inline-edge-width);
|
|
81
|
+
}
|
|
82
|
+
.\[\&\>\: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
|
+
border-inline-end-width: var(--gridui-table-inline-edge-width);
|
|
84
|
+
}
|
|
85
|
+
.\[\&\>tbody\>tr\:hover\>\:is\(th\,td\)\]\:bg-surface > tbody > tr:hover > :is(th, td) {
|
|
86
|
+
background-color: var(--gridui-surface);
|
|
87
|
+
}
|
|
88
|
+
.\[\&\>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
|
+
border-block-end-width: var(--gridui-table-block-edge-width);
|
|
90
|
+
}
|
|
91
|
+
.\[\&\>tbody\>tr\>\:is\(th\,td\)\]\:py-gridui-24 > tbody > tr > :is(th, td) {
|
|
92
|
+
padding-block: var(--gridui-space-24);
|
|
93
|
+
}
|
|
94
|
+
.\[\&\>tbody\>tr\>th\]\:bg-surface > tbody > tr > th {
|
|
95
|
+
background-color: var(--gridui-surface);
|
|
96
|
+
}
|
|
97
|
+
.\[\&\>tbody\>tr\>th\]\:text-left > tbody > tr > th {
|
|
98
|
+
text-align: left;
|
|
99
|
+
}
|
|
100
|
+
.\[\&\>tbody\>tr\>th\]\:font-normal > tbody > tr > th {
|
|
101
|
+
--tw-font-weight: var(--font-weight-normal);
|
|
102
|
+
font-weight: var(--font-weight-normal);
|
|
103
|
+
}
|
|
104
|
+
.\[\&\>thead\>\.gridui-table-groups\>th\]\:bg-brand-tint > thead > .gridui-table-groups > th {
|
|
105
|
+
background-color: var(--gridui-brand-tint);
|
|
106
|
+
}
|
|
107
|
+
.\[\&\>thead\>\.gridui-table-groups\>th\]\:py-gridui-8 > thead > .gridui-table-groups > th {
|
|
108
|
+
padding-block: var(--gridui-space-8);
|
|
109
|
+
}
|
|
110
|
+
.\[\&\>thead\>\.gridui-table-groups\>th\]\:text-left > thead > .gridui-table-groups > th {
|
|
111
|
+
text-align: left;
|
|
112
|
+
}
|
|
113
|
+
.\[\&\>thead\>\.gridui-table-groups\>th\]\:type-eyebrow > thead > .gridui-table-groups > th {
|
|
114
|
+
font: var(--gridui-type-eyebrow);
|
|
115
|
+
letter-spacing: 0.08em;
|
|
116
|
+
}
|
|
117
|
+
.\[\&\>thead\>\.gridui-table-groups\>th\]\:text-foreground > thead > .gridui-table-groups > th {
|
|
118
|
+
color: var(--gridui-foreground);
|
|
119
|
+
}
|
|
120
|
+
.\[\&\>thead\>tr\:first-child\>th\]\:\[border-block-start-width\:var\(--gridui-table-block-edge-width\)\] > thead > tr:first-child > th {
|
|
121
|
+
border-block-start-width: var(--gridui-table-block-edge-width);
|
|
122
|
+
}
|
|
123
|
+
.\[\&\>thead\>tr\>th\]\:bg-surface > thead > tr > th {
|
|
124
|
+
background-color: var(--gridui-surface);
|
|
125
|
+
}
|
|
126
|
+
.\[\&\>thead\>tr\>th\]\:text-left > thead > tr > th {
|
|
127
|
+
text-align: left;
|
|
128
|
+
}
|
|
129
|
+
.\[\&\>thead\>tr\>th\]\:font-medium > thead > tr > th {
|
|
130
|
+
--tw-font-weight: var(--font-weight-medium);
|
|
131
|
+
font-weight: var(--font-weight-medium);
|
|
132
|
+
}
|
|
133
|
+
.\[\&\>thead\>tr\>th\]\:text-muted > thead > tr > th {
|
|
134
|
+
color: var(--gridui-muted);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
@layer components {
|
|
138
|
+
.gridui-table {
|
|
139
|
+
--gridui-table-inline-edge-width: 1px;
|
|
140
|
+
}
|
|
141
|
+
.gridui-table[data-inline-edges="none"] {
|
|
142
|
+
--gridui-table-inline-edge-width: 0px;
|
|
143
|
+
}
|
|
144
|
+
@media (min-width: 40rem) {
|
|
145
|
+
.gridui-table[data-inline-edges-md="both"] {
|
|
146
|
+
--gridui-table-inline-edge-width: 1px;
|
|
147
|
+
}
|
|
148
|
+
.gridui-table[data-inline-edges-md="none"] {
|
|
149
|
+
--gridui-table-inline-edge-width: 0px;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
@media (min-width: 64rem) {
|
|
153
|
+
.gridui-table[data-inline-edges-lg="both"] {
|
|
154
|
+
--gridui-table-inline-edge-width: 1px;
|
|
155
|
+
}
|
|
156
|
+
.gridui-table[data-inline-edges-lg="none"] {
|
|
157
|
+
--gridui-table-inline-edge-width: 0px;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
.gridui-table {
|
|
161
|
+
--gridui-table-block-edge-width: 1px;
|
|
162
|
+
}
|
|
163
|
+
.gridui-table[data-block-edges="none"] {
|
|
164
|
+
--gridui-table-block-edge-width: 0px;
|
|
165
|
+
}
|
|
166
|
+
@media (min-width: 40rem) {
|
|
167
|
+
.gridui-table[data-block-edges-md="both"] {
|
|
168
|
+
--gridui-table-block-edge-width: 1px;
|
|
169
|
+
}
|
|
170
|
+
.gridui-table[data-block-edges-md="none"] {
|
|
171
|
+
--gridui-table-block-edge-width: 0px;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
@media (min-width: 64rem) {
|
|
175
|
+
.gridui-table[data-block-edges-lg="both"] {
|
|
176
|
+
--gridui-table-block-edge-width: 1px;
|
|
177
|
+
}
|
|
178
|
+
.gridui-table[data-block-edges-lg="none"] {
|
|
179
|
+
--gridui-table-block-edge-width: 0px;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
@property --tw-ordinal {
|
|
184
|
+
syntax: "*";
|
|
185
|
+
inherits: false;
|
|
186
|
+
}
|
|
187
|
+
@property --tw-slashed-zero {
|
|
188
|
+
syntax: "*";
|
|
189
|
+
inherits: false;
|
|
190
|
+
}
|
|
191
|
+
@property --tw-numeric-figure {
|
|
192
|
+
syntax: "*";
|
|
193
|
+
inherits: false;
|
|
194
|
+
}
|
|
195
|
+
@property --tw-numeric-spacing {
|
|
196
|
+
syntax: "*";
|
|
197
|
+
inherits: false;
|
|
198
|
+
}
|
|
199
|
+
@property --tw-numeric-fraction {
|
|
200
|
+
syntax: "*";
|
|
201
|
+
inherits: false;
|
|
202
|
+
}
|
|
203
|
+
@property --tw-border-style {
|
|
204
|
+
syntax: "*";
|
|
205
|
+
inherits: false;
|
|
206
|
+
initial-value: solid;
|
|
207
|
+
}
|
|
208
|
+
@property --tw-font-weight {
|
|
209
|
+
syntax: "*";
|
|
210
|
+
inherits: false;
|
|
211
|
+
}
|
|
212
|
+
@layer properties {
|
|
213
|
+
@supports ((-webkit-hyphens: none) and (not (margin-trim: inline))) or ((-moz-orient: inline) and (not (color:rgb(from red r g b)))) {
|
|
214
|
+
*, ::before, ::after, ::backdrop {
|
|
215
|
+
--tw-ordinal: initial;
|
|
216
|
+
--tw-slashed-zero: initial;
|
|
217
|
+
--tw-numeric-figure: initial;
|
|
218
|
+
--tw-numeric-spacing: initial;
|
|
219
|
+
--tw-numeric-fraction: initial;
|
|
220
|
+
--tw-border-style: solid;
|
|
221
|
+
--tw-font-weight: initial;
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,51 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gridui/table",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "GridUI React table",
|
|
5
|
+
"license": "UNLICENSED",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"files": [
|
|
8
|
+
"dist",
|
|
9
|
+
"README.md"
|
|
10
|
+
],
|
|
11
|
+
"sideEffects": [
|
|
12
|
+
"**/*.css"
|
|
13
|
+
],
|
|
14
|
+
"exports": {
|
|
15
|
+
".": {
|
|
16
|
+
"types": "./dist/index.d.ts",
|
|
17
|
+
"import": "./dist/index.js"
|
|
18
|
+
},
|
|
19
|
+
"./styles.css": "./dist/styles.css"
|
|
20
|
+
},
|
|
21
|
+
"publishConfig": {
|
|
22
|
+
"access": "public"
|
|
23
|
+
},
|
|
24
|
+
"peerDependencies": {
|
|
25
|
+
"react": "^19.2.0",
|
|
26
|
+
"react-dom": "^19.2.0"
|
|
27
|
+
},
|
|
28
|
+
"dependencies": {
|
|
29
|
+
"@gridui/style-utils": "^2.1.2",
|
|
30
|
+
"@gridui/theme": "^2.1.2",
|
|
31
|
+
"class-variance-authority": "0.7.1"
|
|
32
|
+
},
|
|
33
|
+
"devDependencies": {
|
|
34
|
+
"@gridui-internal/configuration": "0.0.0",
|
|
35
|
+
"@jest/globals": "30.5.2",
|
|
36
|
+
"@types/jest": "30.0.0",
|
|
37
|
+
"@types/node": "26.6.5",
|
|
38
|
+
"@types/react": "19.3.0",
|
|
39
|
+
"@types/react-dom": "19.3.0",
|
|
40
|
+
"jest": "30.5.2",
|
|
41
|
+
"react": "19.3.1",
|
|
42
|
+
"react-dom": "19.3.1",
|
|
43
|
+
"typescript": "6.0.3"
|
|
44
|
+
},
|
|
45
|
+
"scripts": {
|
|
46
|
+
"build": "node ../../scripts/compilation/package.ts",
|
|
47
|
+
"compile": "tsc --project tsconfig.json",
|
|
48
|
+
"test": "jest",
|
|
49
|
+
"coverage": "jest --coverage"
|
|
50
|
+
}
|
|
6
51
|
}
|