@gridui/data-explorer 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 +19 -2
- package/dist/data-explorer/data-explorer.d.ts +44 -0
- package/dist/data-explorer/model.d.ts +40 -0
- package/dist/data-explorer/style.d.ts +10 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.js +393 -0
- package/dist/index.js.map +7 -0
- package/dist/styles.css +164 -0
- package/package.json +53 -3
package/README.md
CHANGED
|
@@ -1,3 +1,20 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @gridui/data-explorer
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Dashboard family. Public API: `DataExplorer`, `DataExplorerColumn`, `DataExplorerFilter`, `DataExplorerProps`, `DataExplorerRow`, `DataExplorerState`, `DataExplorerValue`.
|
|
4
|
+
|
|
5
|
+
Import components from `@gridui/data-explorer` and load `@gridui/data-explorer/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
|
+
## Task compositions and lower-package APIs
|
|
11
|
+
|
|
12
|
+
DataExplorer, Composer, and ApprovalPanel remain in Layout because they
|
|
13
|
+
coordinate multiple lower-package contracts. See
|
|
14
|
+
[task workspace compositions](../../docs/usage/task-workspace.md) for controlled state,
|
|
15
|
+
callbacks, and application responsibilities.
|
|
16
|
+
|
|
17
|
+
Standalone [InlineNotice](../../packages-core/inline-notice/docs/inline-notice.md) comes from Data.
|
|
18
|
+
[Collection items](../../packages-core/collection/docs/collection.md),
|
|
19
|
+
[FollowScroll](../../packages-core/follow-scroll/docs/follow-scroll.md), and
|
|
20
|
+
[Breadcrumb/Pagination](../../docs/usage/navigation.md) come from Controls.
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author WMXPY
|
|
3
|
+
* @package Data Explorer
|
|
4
|
+
* @namespace DataExplorer
|
|
5
|
+
* @description Data Explorer
|
|
6
|
+
*/
|
|
7
|
+
import { type DataExplorerColumn, type DataExplorerFilter, type DataExplorerRow, type DataExplorerState, type DataExplorerValue } from "./model";
|
|
8
|
+
import type { ComponentPropsWithRef, FC, ReactNode } from "react";
|
|
9
|
+
export type DataExplorerProps = Omit<ComponentPropsWithRef<"section">, "children"> & {
|
|
10
|
+
readonly rows: readonly DataExplorerRow[];
|
|
11
|
+
readonly columns: readonly DataExplorerColumn[];
|
|
12
|
+
readonly state: DataExplorerState;
|
|
13
|
+
readonly onStateChange: (state: DataExplorerState) => void;
|
|
14
|
+
readonly filter?: DataExplorerFilter;
|
|
15
|
+
readonly pageSize?: number;
|
|
16
|
+
readonly selectedIds?: readonly string[];
|
|
17
|
+
readonly onSelectionChange?: (ids: readonly string[]) => void;
|
|
18
|
+
readonly actions?: readonly {
|
|
19
|
+
readonly label: string;
|
|
20
|
+
readonly onAction: (ids: readonly string[]) => void;
|
|
21
|
+
readonly disabled?: boolean;
|
|
22
|
+
}[];
|
|
23
|
+
readonly renderCell?: (value: DataExplorerValue | undefined, row: DataExplorerRow, column: DataExplorerColumn) => ReactNode;
|
|
24
|
+
readonly busy?: boolean;
|
|
25
|
+
readonly notice?: ReactNode;
|
|
26
|
+
readonly labels: {
|
|
27
|
+
readonly table: string;
|
|
28
|
+
readonly search: string;
|
|
29
|
+
readonly sort: string;
|
|
30
|
+
readonly unsorted: string;
|
|
31
|
+
readonly ascending: string;
|
|
32
|
+
readonly descending: string;
|
|
33
|
+
readonly all: string;
|
|
34
|
+
readonly selection: string;
|
|
35
|
+
readonly selectPage: string;
|
|
36
|
+
readonly selectRow: (row: DataExplorerRow) => string;
|
|
37
|
+
readonly selected: (count: number) => string;
|
|
38
|
+
readonly previous: string;
|
|
39
|
+
readonly next: string;
|
|
40
|
+
readonly page: (page: number, pages: number, total: number) => string;
|
|
41
|
+
readonly empty: string;
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
export declare const DataExplorer: FC<DataExplorerProps>;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author WMXPY
|
|
3
|
+
* @package Data Explorer
|
|
4
|
+
* @namespace DataExplorer
|
|
5
|
+
* @description Model
|
|
6
|
+
*/
|
|
7
|
+
export type DataExplorerValue = string | number | null;
|
|
8
|
+
export type DataExplorerRow = {
|
|
9
|
+
readonly id: string;
|
|
10
|
+
readonly values: Readonly<Record<string, DataExplorerValue>>;
|
|
11
|
+
};
|
|
12
|
+
export type DataExplorerColumn = {
|
|
13
|
+
readonly key: string;
|
|
14
|
+
readonly label: string;
|
|
15
|
+
readonly numeric?: boolean;
|
|
16
|
+
};
|
|
17
|
+
export type DataExplorerState = {
|
|
18
|
+
readonly query: string;
|
|
19
|
+
readonly filterValue: string;
|
|
20
|
+
readonly sort: {
|
|
21
|
+
readonly key: string;
|
|
22
|
+
readonly direction: "ascending" | "descending";
|
|
23
|
+
} | null;
|
|
24
|
+
readonly page: number;
|
|
25
|
+
};
|
|
26
|
+
export type DataExplorerFilter = {
|
|
27
|
+
readonly key: string;
|
|
28
|
+
readonly label: string;
|
|
29
|
+
readonly options: readonly {
|
|
30
|
+
readonly value: string;
|
|
31
|
+
readonly label: string;
|
|
32
|
+
}[];
|
|
33
|
+
};
|
|
34
|
+
export declare const selectExplorerRows: (rows: readonly DataExplorerRow[], columns: readonly DataExplorerColumn[], state: DataExplorerState, pageSize: number, filter?: DataExplorerFilter) => {
|
|
35
|
+
rows: DataExplorerRow[];
|
|
36
|
+
total: number;
|
|
37
|
+
page: number;
|
|
38
|
+
pageCount: number;
|
|
39
|
+
};
|
|
40
|
+
export declare const selectExplorerPage: (selectedIds: readonly string[], pageIds: readonly string[], checked: boolean) => string[];
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author WMXPY
|
|
3
|
+
* @package Data Explorer
|
|
4
|
+
* @namespace DataExplorer
|
|
5
|
+
* @description Style
|
|
6
|
+
*/
|
|
7
|
+
export declare const explorerStyles: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
|
8
|
+
export declare const explorerToolbarStyles: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
|
9
|
+
export declare const explorerLabelStyles: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
|
10
|
+
export declare const explorerFooterStyles: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author WMXPY
|
|
3
|
+
* @package Data Explorer
|
|
4
|
+
* @namespace Root
|
|
5
|
+
* @description Index
|
|
6
|
+
*/
|
|
7
|
+
export type { DataExplorerProps } from "./data-explorer/data-explorer";
|
|
8
|
+
export { DataExplorer } from "./data-explorer/data-explorer";
|
|
9
|
+
export type { DataExplorerColumn } from "./data-explorer/model";
|
|
10
|
+
export type { DataExplorerFilter } from "./data-explorer/model";
|
|
11
|
+
export type { DataExplorerRow } from "./data-explorer/model";
|
|
12
|
+
export type { DataExplorerState } from "./data-explorer/model";
|
|
13
|
+
export type { DataExplorerValue } from "./data-explorer/model";
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,393 @@
|
|
|
1
|
+
// src/data-explorer/model.ts
|
|
2
|
+
var compareValues = (left, right, direction) => {
|
|
3
|
+
if (left === null || left === void 0) {
|
|
4
|
+
return right === null || right === void 0 ? 0 : 1;
|
|
5
|
+
}
|
|
6
|
+
if (right === null || right === void 0) {
|
|
7
|
+
return -1;
|
|
8
|
+
}
|
|
9
|
+
let comparison = 0;
|
|
10
|
+
if (typeof left === "number" && typeof right === "number") {
|
|
11
|
+
comparison = left - right;
|
|
12
|
+
} else if (String(left) < String(right)) {
|
|
13
|
+
comparison = -1;
|
|
14
|
+
} else if (String(left) > String(right)) {
|
|
15
|
+
comparison = 1;
|
|
16
|
+
}
|
|
17
|
+
return direction === "ascending" ? comparison : -comparison;
|
|
18
|
+
};
|
|
19
|
+
var selectExplorerRows = (rows, columns, state, pageSize, filter) => {
|
|
20
|
+
const validPageSize = Number.isInteger(pageSize) && pageSize > 0;
|
|
21
|
+
const validPage = Number.isInteger(state.page) && state.page >= 0;
|
|
22
|
+
if (!validPageSize || !validPage) {
|
|
23
|
+
throw new RangeError("DataExplorer needs a positive integer pageSize and a non-negative integer page.");
|
|
24
|
+
}
|
|
25
|
+
const rowIds = rows.map((row) => {
|
|
26
|
+
return row.id;
|
|
27
|
+
});
|
|
28
|
+
const columnKeys = columns.map((column) => {
|
|
29
|
+
return column.key;
|
|
30
|
+
});
|
|
31
|
+
const hasDuplicateRows = new Set(rowIds).size !== rows.length;
|
|
32
|
+
const hasDuplicateColumns = new Set(columnKeys).size !== columns.length;
|
|
33
|
+
if (hasDuplicateRows || hasDuplicateColumns) {
|
|
34
|
+
throw new Error("DataExplorer row ids and column keys must be unique.");
|
|
35
|
+
}
|
|
36
|
+
const query = state.query.trim().toLowerCase();
|
|
37
|
+
const filtered = rows.filter((row) => {
|
|
38
|
+
const matchesQuery = !query || columns.some((column) => {
|
|
39
|
+
const cellText = String(row.values[column.key] ?? "").toLowerCase();
|
|
40
|
+
return cellText.includes(query);
|
|
41
|
+
});
|
|
42
|
+
const matchesFilter = !filter || !state.filterValue || String(row.values[filter.key] ?? "") === state.filterValue;
|
|
43
|
+
return matchesQuery && matchesFilter;
|
|
44
|
+
});
|
|
45
|
+
const sort = state.sort;
|
|
46
|
+
if (sort && columnKeys.includes(sort.key)) {
|
|
47
|
+
filtered.sort((left, right) => {
|
|
48
|
+
return compareValues(left.values[sort.key], right.values[sort.key], sort.direction);
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
const pageCount = Math.max(1, Math.ceil(filtered.length / pageSize));
|
|
52
|
+
const page = Math.min(state.page, pageCount - 1);
|
|
53
|
+
return {
|
|
54
|
+
rows: filtered.slice(page * pageSize, (page + 1) * pageSize),
|
|
55
|
+
total: filtered.length,
|
|
56
|
+
page,
|
|
57
|
+
pageCount
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
var selectExplorerPage = (selectedIds, pageIds, checked) => {
|
|
61
|
+
const selected = new Set(selectedIds);
|
|
62
|
+
for (const id of pageIds) {
|
|
63
|
+
if (checked) {
|
|
64
|
+
selected.add(id);
|
|
65
|
+
} else {
|
|
66
|
+
selected.delete(id);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
return [...selected];
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
// src/data-explorer/style.ts
|
|
73
|
+
import { cva } from "class-variance-authority";
|
|
74
|
+
var explorerStyles = cva("min-w-0 border border-border bg-background text-foreground");
|
|
75
|
+
var explorerToolbarStyles = cva("flex min-w-0 flex-wrap items-end gap-gridui-16 border-b border-border p-gridui-16 [&_label]:min-h-11");
|
|
76
|
+
var explorerLabelStyles = cva("flex min-w-0 flex-1 basis-40 flex-col gap-gridui-4 text-muted type-caption");
|
|
77
|
+
var explorerFooterStyles = cva("flex flex-wrap items-center justify-between gap-gridui-8 border-t border-border p-gridui-16");
|
|
78
|
+
|
|
79
|
+
// src/data-explorer/data-explorer.tsx
|
|
80
|
+
import { Button } from "@gridui/button";
|
|
81
|
+
import { Checkbox } from "@gridui/choice";
|
|
82
|
+
import { Input } from "@gridui/input";
|
|
83
|
+
import { Select } from "@gridui/select";
|
|
84
|
+
import { cn } from "@gridui/style-utils";
|
|
85
|
+
import { DataTable } from "@gridui/table";
|
|
86
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
87
|
+
var DataExplorer = (props) => {
|
|
88
|
+
const {
|
|
89
|
+
rows,
|
|
90
|
+
columns,
|
|
91
|
+
state,
|
|
92
|
+
onStateChange,
|
|
93
|
+
filter,
|
|
94
|
+
pageSize = 10,
|
|
95
|
+
selectedIds = [],
|
|
96
|
+
onSelectionChange,
|
|
97
|
+
actions = [],
|
|
98
|
+
renderCell,
|
|
99
|
+
busy = false,
|
|
100
|
+
notice,
|
|
101
|
+
labels,
|
|
102
|
+
className,
|
|
103
|
+
...restProps
|
|
104
|
+
} = props;
|
|
105
|
+
const view = selectExplorerRows(rows, columns, state, pageSize, filter);
|
|
106
|
+
const existingRowIds = new Set(rows.map((row) => {
|
|
107
|
+
return row.id;
|
|
108
|
+
}));
|
|
109
|
+
const selectedRowIds = [...new Set(selectedIds)].filter((id) => {
|
|
110
|
+
return existingRowIds.has(id);
|
|
111
|
+
});
|
|
112
|
+
const pageIds = view.rows.map((row) => {
|
|
113
|
+
return row.id;
|
|
114
|
+
});
|
|
115
|
+
const selectedPageCount = pageIds.filter((id) => {
|
|
116
|
+
return selectedRowIds.includes(id);
|
|
117
|
+
}).length;
|
|
118
|
+
const updateState = (changes) => {
|
|
119
|
+
if (!busy) {
|
|
120
|
+
onStateChange({
|
|
121
|
+
...state,
|
|
122
|
+
...changes
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
const tableColumns = columns.map((column) => {
|
|
127
|
+
return {
|
|
128
|
+
label: column.label,
|
|
129
|
+
...column.numeric !== void 0 ? { numeric: column.numeric } : {}
|
|
130
|
+
};
|
|
131
|
+
});
|
|
132
|
+
if (onSelectionChange) {
|
|
133
|
+
tableColumns.unshift({ label: labels.selection });
|
|
134
|
+
}
|
|
135
|
+
const tableRows = view.rows.map((row) => {
|
|
136
|
+
const cells = columns.map((column) => {
|
|
137
|
+
const value = row.values[column.key];
|
|
138
|
+
if (renderCell) {
|
|
139
|
+
return renderCell(value, row, column);
|
|
140
|
+
}
|
|
141
|
+
return value ?? "";
|
|
142
|
+
});
|
|
143
|
+
if (onSelectionChange) {
|
|
144
|
+
cells.unshift(/* @__PURE__ */ jsx(
|
|
145
|
+
Checkbox,
|
|
146
|
+
{
|
|
147
|
+
"aria-label": labels.selectRow(row),
|
|
148
|
+
checked: selectedRowIds.includes(row.id),
|
|
149
|
+
disabled: busy,
|
|
150
|
+
onCheckedChange: (checked) => {
|
|
151
|
+
const nextSelection = selectExplorerPage(selectedRowIds, [row.id], checked);
|
|
152
|
+
onSelectionChange(nextSelection);
|
|
153
|
+
}
|
|
154
|
+
},
|
|
155
|
+
"select"
|
|
156
|
+
));
|
|
157
|
+
}
|
|
158
|
+
return cells;
|
|
159
|
+
});
|
|
160
|
+
return /* @__PURE__ */ jsxs(
|
|
161
|
+
"section",
|
|
162
|
+
{
|
|
163
|
+
...restProps,
|
|
164
|
+
"aria-label": labels.table,
|
|
165
|
+
className: cn(explorerStyles(), className),
|
|
166
|
+
children: [
|
|
167
|
+
/* @__PURE__ */ jsxs(
|
|
168
|
+
"div",
|
|
169
|
+
{
|
|
170
|
+
className: explorerToolbarStyles(),
|
|
171
|
+
children: [
|
|
172
|
+
/* @__PURE__ */ jsxs(
|
|
173
|
+
"label",
|
|
174
|
+
{
|
|
175
|
+
className: explorerLabelStyles(),
|
|
176
|
+
children: [
|
|
177
|
+
labels.search,
|
|
178
|
+
/* @__PURE__ */ jsx(
|
|
179
|
+
Input,
|
|
180
|
+
{
|
|
181
|
+
type: "search",
|
|
182
|
+
value: state.query,
|
|
183
|
+
disabled: busy,
|
|
184
|
+
onValueChange: (query) => {
|
|
185
|
+
updateState({
|
|
186
|
+
query,
|
|
187
|
+
page: 0
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
)
|
|
192
|
+
]
|
|
193
|
+
}
|
|
194
|
+
),
|
|
195
|
+
filter && /* @__PURE__ */ jsxs(
|
|
196
|
+
"label",
|
|
197
|
+
{
|
|
198
|
+
className: explorerLabelStyles(),
|
|
199
|
+
children: [
|
|
200
|
+
filter.label,
|
|
201
|
+
/* @__PURE__ */ jsx(
|
|
202
|
+
Select,
|
|
203
|
+
{
|
|
204
|
+
"aria-label": filter.label,
|
|
205
|
+
value: state.filterValue,
|
|
206
|
+
disabled: busy,
|
|
207
|
+
options: [
|
|
208
|
+
{
|
|
209
|
+
value: "",
|
|
210
|
+
label: labels.all
|
|
211
|
+
},
|
|
212
|
+
...filter.options
|
|
213
|
+
],
|
|
214
|
+
onValueChange: (filterValue) => {
|
|
215
|
+
updateState({
|
|
216
|
+
filterValue,
|
|
217
|
+
page: 0
|
|
218
|
+
});
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
)
|
|
222
|
+
]
|
|
223
|
+
}
|
|
224
|
+
),
|
|
225
|
+
/* @__PURE__ */ jsxs(
|
|
226
|
+
"label",
|
|
227
|
+
{
|
|
228
|
+
className: explorerLabelStyles(),
|
|
229
|
+
children: [
|
|
230
|
+
labels.sort,
|
|
231
|
+
/* @__PURE__ */ jsx(
|
|
232
|
+
Select,
|
|
233
|
+
{
|
|
234
|
+
"aria-label": labels.sort,
|
|
235
|
+
value: state.sort?.key ?? "",
|
|
236
|
+
disabled: busy,
|
|
237
|
+
options: [
|
|
238
|
+
{
|
|
239
|
+
value: "",
|
|
240
|
+
label: labels.unsorted
|
|
241
|
+
},
|
|
242
|
+
...columns.map((column) => {
|
|
243
|
+
return {
|
|
244
|
+
value: column.key,
|
|
245
|
+
label: column.label
|
|
246
|
+
};
|
|
247
|
+
})
|
|
248
|
+
],
|
|
249
|
+
onValueChange: (key) => {
|
|
250
|
+
updateState({
|
|
251
|
+
sort: key ? {
|
|
252
|
+
key,
|
|
253
|
+
direction: "ascending"
|
|
254
|
+
} : null,
|
|
255
|
+
page: 0
|
|
256
|
+
});
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
)
|
|
260
|
+
]
|
|
261
|
+
}
|
|
262
|
+
),
|
|
263
|
+
/* @__PURE__ */ jsx(
|
|
264
|
+
Button,
|
|
265
|
+
{
|
|
266
|
+
variant: "secondary",
|
|
267
|
+
disabled: busy || !state.sort,
|
|
268
|
+
onClick: () => {
|
|
269
|
+
if (state.sort) {
|
|
270
|
+
updateState({
|
|
271
|
+
sort: {
|
|
272
|
+
...state.sort,
|
|
273
|
+
direction: state.sort.direction === "ascending" ? "descending" : "ascending"
|
|
274
|
+
},
|
|
275
|
+
page: 0
|
|
276
|
+
});
|
|
277
|
+
}
|
|
278
|
+
},
|
|
279
|
+
children: state.sort?.direction === "descending" ? labels.descending : labels.ascending
|
|
280
|
+
}
|
|
281
|
+
)
|
|
282
|
+
]
|
|
283
|
+
}
|
|
284
|
+
),
|
|
285
|
+
onSelectionChange && /* @__PURE__ */ jsxs(
|
|
286
|
+
"div",
|
|
287
|
+
{
|
|
288
|
+
className: explorerToolbarStyles(),
|
|
289
|
+
children: [
|
|
290
|
+
/* @__PURE__ */ jsxs("label", { children: [
|
|
291
|
+
/* @__PURE__ */ jsx(
|
|
292
|
+
Checkbox,
|
|
293
|
+
{
|
|
294
|
+
checked: pageIds.length > 0 && selectedPageCount === pageIds.length,
|
|
295
|
+
indeterminate: selectedPageCount > 0 && selectedPageCount < pageIds.length,
|
|
296
|
+
disabled: busy || pageIds.length === 0,
|
|
297
|
+
onCheckedChange: (checked) => {
|
|
298
|
+
onSelectionChange(selectExplorerPage(selectedRowIds, pageIds, checked));
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
),
|
|
302
|
+
" ",
|
|
303
|
+
labels.selectPage
|
|
304
|
+
] }),
|
|
305
|
+
/* @__PURE__ */ jsx(
|
|
306
|
+
"span",
|
|
307
|
+
{
|
|
308
|
+
role: "status",
|
|
309
|
+
children: labels.selected(selectedRowIds.length)
|
|
310
|
+
}
|
|
311
|
+
),
|
|
312
|
+
actions.map((action) => {
|
|
313
|
+
return /* @__PURE__ */ jsx(
|
|
314
|
+
Button,
|
|
315
|
+
{
|
|
316
|
+
variant: "secondary",
|
|
317
|
+
disabled: busy || selectedRowIds.length === 0 || action.disabled,
|
|
318
|
+
onClick: () => {
|
|
319
|
+
action.onAction(selectedRowIds);
|
|
320
|
+
},
|
|
321
|
+
children: action.label
|
|
322
|
+
},
|
|
323
|
+
action.label
|
|
324
|
+
);
|
|
325
|
+
})
|
|
326
|
+
]
|
|
327
|
+
}
|
|
328
|
+
),
|
|
329
|
+
notice,
|
|
330
|
+
/* @__PURE__ */ jsxs(
|
|
331
|
+
"div",
|
|
332
|
+
{
|
|
333
|
+
"aria-busy": busy,
|
|
334
|
+
children: [
|
|
335
|
+
/* @__PURE__ */ jsx(
|
|
336
|
+
DataTable,
|
|
337
|
+
{
|
|
338
|
+
label: labels.table,
|
|
339
|
+
variant: "structured",
|
|
340
|
+
columns: tableColumns,
|
|
341
|
+
rows: tableRows,
|
|
342
|
+
rowKeys: pageIds
|
|
343
|
+
}
|
|
344
|
+
),
|
|
345
|
+
view.rows.length === 0 && !busy && /* @__PURE__ */ jsx("p", { children: labels.empty })
|
|
346
|
+
]
|
|
347
|
+
}
|
|
348
|
+
),
|
|
349
|
+
/* @__PURE__ */ jsxs(
|
|
350
|
+
"div",
|
|
351
|
+
{
|
|
352
|
+
className: explorerFooterStyles(),
|
|
353
|
+
children: [
|
|
354
|
+
/* @__PURE__ */ jsx(
|
|
355
|
+
Button,
|
|
356
|
+
{
|
|
357
|
+
variant: "secondary",
|
|
358
|
+
disabled: busy || view.page === 0,
|
|
359
|
+
onClick: () => {
|
|
360
|
+
updateState({ page: view.page - 1 });
|
|
361
|
+
},
|
|
362
|
+
children: labels.previous
|
|
363
|
+
}
|
|
364
|
+
),
|
|
365
|
+
/* @__PURE__ */ jsx(
|
|
366
|
+
"span",
|
|
367
|
+
{
|
|
368
|
+
role: "status",
|
|
369
|
+
children: labels.page(view.page + 1, view.pageCount, view.total)
|
|
370
|
+
}
|
|
371
|
+
),
|
|
372
|
+
/* @__PURE__ */ jsx(
|
|
373
|
+
Button,
|
|
374
|
+
{
|
|
375
|
+
variant: "secondary",
|
|
376
|
+
disabled: busy || view.page + 1 >= view.pageCount,
|
|
377
|
+
onClick: () => {
|
|
378
|
+
updateState({ page: view.page + 1 });
|
|
379
|
+
},
|
|
380
|
+
children: labels.next
|
|
381
|
+
}
|
|
382
|
+
)
|
|
383
|
+
]
|
|
384
|
+
}
|
|
385
|
+
)
|
|
386
|
+
]
|
|
387
|
+
}
|
|
388
|
+
);
|
|
389
|
+
};
|
|
390
|
+
export {
|
|
391
|
+
DataExplorer
|
|
392
|
+
};
|
|
393
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/data-explorer/model.ts", "../src/data-explorer/style.ts", "../src/data-explorer/data-explorer.tsx"],
|
|
4
|
+
"sourcesContent": ["/**\n * @author WMXPY\n * @package Data Explorer\n * @namespace DataExplorer\n * @description Model\n */\n\nexport type DataExplorerValue = string | number | null;\n\nexport type DataExplorerRow = {\n readonly id: string;\n readonly values: Readonly<Record<string, DataExplorerValue>>;\n};\n\nexport type DataExplorerColumn = {\n readonly key: string;\n readonly label: string;\n readonly numeric?: boolean;\n};\n\nexport type DataExplorerState = {\n readonly query: string;\n readonly filterValue: string;\n readonly sort: {\n readonly key: string;\n readonly direction: \"ascending\" | \"descending\";\n } | null;\n readonly page: number;\n};\n\nexport type DataExplorerFilter = {\n readonly key: string;\n readonly label: string;\n readonly options: readonly {\n readonly value: string;\n readonly label: string;\n }[];\n};\n\nconst compareValues = (\n left: DataExplorerValue | undefined,\n right: DataExplorerValue | undefined,\n direction: \"ascending\" | \"descending\",\n): number => {\n // Missing values stay last in either direction; equal values preserve input order.\n if (left === null || left === undefined) {\n return right === null || right === undefined ? 0 : 1;\n }\n if (right === null || right === undefined) {\n return -1;\n }\n let comparison = 0;\n if (typeof left === \"number\" && typeof right === \"number\") {\n comparison = left - right;\n } else if (String(left) < String(right)) {\n comparison = -1;\n } else if (String(left) > String(right)) {\n comparison = 1;\n }\n return direction === \"ascending\" ? comparison : -comparison;\n};\n\nexport const selectExplorerRows = (\n rows: readonly DataExplorerRow[],\n columns: readonly DataExplorerColumn[],\n state: DataExplorerState,\n pageSize: number,\n filter?: DataExplorerFilter,\n) => {\n const validPageSize = Number.isInteger(pageSize) && pageSize > 0;\n const validPage = Number.isInteger(state.page) && state.page >= 0;\n if (!validPageSize || !validPage) {\n throw new RangeError(\"DataExplorer needs a positive integer pageSize and a non-negative integer page.\");\n }\n const rowIds = rows.map(row => {\n return row.id;\n });\n const columnKeys = columns.map(column => {\n return column.key;\n });\n const hasDuplicateRows = new Set(rowIds).size !== rows.length;\n const hasDuplicateColumns = new Set(columnKeys).size !== columns.length;\n if (hasDuplicateRows || hasDuplicateColumns) {\n throw new Error(\"DataExplorer row ids and column keys must be unique.\");\n }\n const query = state.query.trim().toLowerCase();\n const filtered = rows.filter(row => {\n const matchesQuery = !query || columns.some(column => {\n const cellText = String(row.values[column.key] ?? \"\").toLowerCase();\n return cellText.includes(query);\n });\n const matchesFilter = !filter || !state.filterValue\n || String(row.values[filter.key] ?? \"\") === state.filterValue;\n return matchesQuery && matchesFilter;\n });\n const sort = state.sort;\n if (sort && columnKeys.includes(sort.key)) {\n filtered.sort((left, right) => {\n return compareValues(left.values[sort.key], right.values[sort.key], sort.direction);\n });\n }\n const pageCount = Math.max(1, Math.ceil(filtered.length / pageSize));\n const page = Math.min(state.page, pageCount - 1);\n return {\n rows: filtered.slice(page * pageSize, (page + 1) * pageSize),\n total: filtered.length,\n page,\n pageCount,\n };\n};\n\nexport const selectExplorerPage = (\n selectedIds: readonly string[],\n pageIds: readonly string[],\n checked: boolean,\n): string[] => {\n const selected = new Set(selectedIds);\n for (const id of pageIds) {\n if (checked) {\n selected.add(id);\n } else {\n selected.delete(id);\n }\n }\n return [...selected];\n};\n", "/**\n * @author WMXPY\n * @package Data Explorer\n * @namespace DataExplorer\n * @description Style\n */\n\nimport { cva } from \"class-variance-authority\";\n\nexport const explorerStyles = cva(\"min-w-0 border border-border bg-background text-foreground\");\n\nexport const explorerToolbarStyles = cva(\"flex min-w-0 flex-wrap items-end gap-gridui-16 border-b border-border p-gridui-16 [&_label]:min-h-11\");\n\nexport const explorerLabelStyles = cva(\"flex min-w-0 flex-1 basis-40 flex-col gap-gridui-4 text-muted type-caption\");\n\nexport const explorerFooterStyles = cva(\"flex flex-wrap items-center justify-between gap-gridui-8 border-t border-border p-gridui-16\");\n", "/**\n * @author WMXPY\n * @package Data Explorer\n * @namespace DataExplorer\n * @description Data Explorer\n */\n\nimport { type DataExplorerColumn, type DataExplorerFilter, type DataExplorerRow, type DataExplorerState, type DataExplorerValue, selectExplorerPage, selectExplorerRows } from \"./model\";\nimport { explorerFooterStyles, explorerLabelStyles, explorerStyles, explorerToolbarStyles } from \"./style\";\nimport { Button } from \"@gridui/button\";\nimport { Checkbox } from \"@gridui/choice\";\nimport { Input } from \"@gridui/input\";\nimport { Select } from \"@gridui/select\";\nimport { cn } from \"@gridui/style-utils\";\nimport { DataTable } from \"@gridui/table\";\nimport type { ComponentPropsWithRef, FC, ReactNode } from \"react\";\n\nexport type DataExplorerProps = Omit<ComponentPropsWithRef<\"section\">, \"children\"> & {\n readonly rows: readonly DataExplorerRow[];\n readonly columns: readonly DataExplorerColumn[];\n readonly state: DataExplorerState;\n readonly onStateChange: (state: DataExplorerState) => void;\n readonly filter?: DataExplorerFilter;\n readonly pageSize?: number;\n readonly selectedIds?: readonly string[];\n readonly onSelectionChange?: (ids: readonly string[]) => void;\n readonly actions?: readonly {\n readonly label: string;\n readonly onAction: (ids: readonly string[]) => void;\n readonly disabled?: boolean;\n }[];\n readonly renderCell?: (\n value: DataExplorerValue | undefined,\n row: DataExplorerRow,\n column: DataExplorerColumn,\n ) => ReactNode;\n readonly busy?: boolean;\n readonly notice?: ReactNode;\n readonly labels: {\n readonly table: string;\n readonly search: string;\n readonly sort: string;\n readonly unsorted: string;\n readonly ascending: string;\n readonly descending: string;\n readonly all: string;\n readonly selection: string;\n readonly selectPage: string;\n readonly selectRow: (row: DataExplorerRow) => string;\n readonly selected: (count: number) => string;\n readonly previous: string;\n readonly next: string;\n readonly page: (page: number, pages: number, total: number) => string;\n readonly empty: string;\n };\n};\n\nexport const DataExplorer: FC<DataExplorerProps> = (props: DataExplorerProps) => {\n const {\n rows,\n columns,\n state,\n onStateChange,\n filter,\n pageSize = 10,\n selectedIds = [],\n onSelectionChange,\n actions = [],\n renderCell,\n busy = false,\n notice,\n labels,\n className,\n ...restProps\n } = props;\n const view = selectExplorerRows(rows, columns, state, pageSize, filter);\n const existingRowIds = new Set(rows.map(row => {\n return row.id;\n }));\n const selectedRowIds = [...new Set(selectedIds)].filter(id => {\n return existingRowIds.has(id);\n });\n const pageIds = view.rows.map(row => {\n return row.id;\n });\n const selectedPageCount = pageIds.filter(id => {\n return selectedRowIds.includes(id);\n }).length;\n const updateState = (changes: Partial<DataExplorerState>) => {\n if (!busy) {\n onStateChange({\n ...state,\n ...changes,\n });\n }\n };\n const tableColumns = columns.map(column => {\n return {\n label: column.label,\n ...(column.numeric !== undefined ? { numeric: column.numeric } : {}),\n };\n });\n if (onSelectionChange) {\n tableColumns.unshift({ label: labels.selection });\n }\n const tableRows = view.rows.map(row => {\n const cells = columns.map(column => {\n const value = row.values[column.key];\n if (renderCell) {\n return renderCell(value, row, column);\n }\n return value ?? \"\";\n });\n if (onSelectionChange) {\n cells.unshift((<Checkbox\n key=\"select\"\n aria-label={labels.selectRow(row)}\n checked={selectedRowIds.includes(row.id)}\n disabled={busy}\n onCheckedChange={checked => {\n const nextSelection = selectExplorerPage(selectedRowIds, [row.id], checked);\n onSelectionChange(nextSelection);\n }}\n />));\n }\n return cells;\n });\n return (<section\n {...restProps}\n aria-label={labels.table}\n className={cn(explorerStyles(), className)}\n >\n <div\n className={explorerToolbarStyles()}\n >\n <label\n className={explorerLabelStyles()}\n >\n {labels.search}\n <Input\n type=\"search\"\n value={state.query}\n disabled={busy}\n onValueChange={query => {\n updateState({\n query,\n page: 0,\n });\n }}\n />\n </label>\n {filter && (<label\n className={explorerLabelStyles()}\n >\n {filter.label}\n <Select\n aria-label={filter.label}\n value={state.filterValue}\n disabled={busy}\n options={[\n {\n value: \"\",\n label: labels.all,\n },\n ...filter.options,\n ]}\n onValueChange={filterValue => {\n updateState({\n filterValue,\n page: 0,\n });\n }}\n />\n </label>)}\n <label\n className={explorerLabelStyles()}\n >\n {labels.sort}\n <Select\n aria-label={labels.sort}\n value={state.sort?.key ?? \"\"}\n disabled={busy}\n options={[\n {\n value: \"\",\n label: labels.unsorted,\n },\n ...columns.map(column => {\n return {\n value: column.key,\n label: column.label,\n };\n }),\n ]}\n onValueChange={key => {\n updateState({\n sort: key ? {\n key,\n direction: \"ascending\",\n } : null,\n page: 0,\n });\n }}\n />\n </label>\n <Button\n variant=\"secondary\"\n disabled={busy || !state.sort}\n onClick={() => {\n if (state.sort) {\n updateState({\n sort: {\n ...state.sort,\n direction: state.sort.direction === \"ascending\" ? \"descending\" : \"ascending\",\n },\n page: 0,\n });\n }\n }}\n >\n {state.sort?.direction === \"descending\" ? labels.descending : labels.ascending}\n </Button>\n </div>\n {onSelectionChange && (<div\n className={explorerToolbarStyles()}\n >\n <label>\n <Checkbox\n checked={pageIds.length > 0 && selectedPageCount === pageIds.length}\n indeterminate={selectedPageCount > 0 && selectedPageCount < pageIds.length}\n disabled={busy || pageIds.length === 0}\n onCheckedChange={checked => {\n onSelectionChange(selectExplorerPage(selectedRowIds, pageIds, checked));\n }}\n />\n {\" \"}\n {labels.selectPage}\n </label>\n <span\n role=\"status\"\n >\n {labels.selected(selectedRowIds.length)}\n </span>\n {actions.map(action => {\n return (<Button\n key={action.label}\n variant=\"secondary\"\n disabled={busy || selectedRowIds.length === 0 || action.disabled}\n onClick={() => {\n action.onAction(selectedRowIds);\n }}\n >\n {action.label}\n </Button>);\n })}\n </div>)}\n {notice}\n <div\n aria-busy={busy}\n >\n <DataTable\n label={labels.table}\n variant=\"structured\"\n columns={tableColumns}\n rows={tableRows}\n rowKeys={pageIds}\n />\n {view.rows.length === 0 && !busy && (<p>\n {labels.empty}\n </p>)}\n </div>\n <div\n className={explorerFooterStyles()}\n >\n <Button\n variant=\"secondary\"\n disabled={busy || view.page === 0}\n onClick={() => {\n updateState({ page: view.page - 1 });\n }}\n >\n {labels.previous}\n </Button>\n <span\n role=\"status\"\n >\n {labels.page(view.page + 1, view.pageCount, view.total)}\n </span>\n <Button\n variant=\"secondary\"\n disabled={busy || view.page + 1 >= view.pageCount}\n onClick={() => {\n updateState({ page: view.page + 1 });\n }}\n >\n {labels.next}\n </Button>\n </div>\n </section>);\n};\n"],
|
|
5
|
+
"mappings": ";AAuCA,IAAM,gBAAgB,CAClB,MACA,OACA,cACS;AAET,MAAI,SAAS,QAAQ,SAAS,QAAW;AACrC,WAAO,UAAU,QAAQ,UAAU,SAAY,IAAI;AAAA,EACvD;AACA,MAAI,UAAU,QAAQ,UAAU,QAAW;AACvC,WAAO;AAAA,EACX;AACA,MAAI,aAAa;AACjB,MAAI,OAAO,SAAS,YAAY,OAAO,UAAU,UAAU;AACvD,iBAAa,OAAO;AAAA,EACxB,WAAW,OAAO,IAAI,IAAI,OAAO,KAAK,GAAG;AACrC,iBAAa;AAAA,EACjB,WAAW,OAAO,IAAI,IAAI,OAAO,KAAK,GAAG;AACrC,iBAAa;AAAA,EACjB;AACA,SAAO,cAAc,cAAc,aAAa,CAAC;AACrD;AAEO,IAAM,qBAAqB,CAC9B,MACA,SACA,OACA,UACA,WACC;AACD,QAAM,gBAAgB,OAAO,UAAU,QAAQ,KAAK,WAAW;AAC/D,QAAM,YAAY,OAAO,UAAU,MAAM,IAAI,KAAK,MAAM,QAAQ;AAChE,MAAI,CAAC,iBAAiB,CAAC,WAAW;AAC9B,UAAM,IAAI,WAAW,iFAAiF;AAAA,EAC1G;AACA,QAAM,SAAS,KAAK,IAAI,SAAO;AAC3B,WAAO,IAAI;AAAA,EACf,CAAC;AACD,QAAM,aAAa,QAAQ,IAAI,YAAU;AACrC,WAAO,OAAO;AAAA,EAClB,CAAC;AACD,QAAM,mBAAmB,IAAI,IAAI,MAAM,EAAE,SAAS,KAAK;AACvD,QAAM,sBAAsB,IAAI,IAAI,UAAU,EAAE,SAAS,QAAQ;AACjE,MAAI,oBAAoB,qBAAqB;AACzC,UAAM,IAAI,MAAM,sDAAsD;AAAA,EAC1E;AACA,Q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AK,WAAW,KAAK,CAAC,QAAS,oBAAC,OACjC,iBAAO,OACZ;AAAA;AAAA;AAAA,QACJ;AAAA,QACA;AAAA,UAAC;AAAA;AAAA,YACG,WAAW,qBAAqB;AAAA,YAEhC;AAAA;AAAA,gBAAC;AAAA;AAAA,kBACG,SAAQ;AAAA,kBACR,UAAU,QAAQ,KAAK,SAAS;AAAA,kBAChC,SAAS,MAAM;AACX,gCAAY,EAAE,MAAM,KAAK,OAAO,EAAE,CAAC;AAAA,kBACvC;AAAA,kBAEC,iBAAO;AAAA;AAAA,cACZ;AAAA,cACA;AAAA,gBAAC;AAAA;AAAA,kBACG,MAAK;AAAA,kBAEJ,iBAAO,KAAK,KAAK,OAAO,GAAG,KAAK,WAAW,KAAK,KAAK;AAAA;AAAA,cAC1D;AAAA,cACA;AAAA,gBAAC;AAAA;AAAA,kBACG,SAAQ;AAAA,kBACR,UAAU,QAAQ,KAAK,OAAO,KAAK,KAAK;AAAA,kBACxC,SAAS,MAAM;AACX,gCAAY,EAAE,MAAM,KAAK,OAAO,EAAE,CAAC;AAAA,kBACvC;AAAA,kBAEC,iBAAO;AAAA;AAAA,cACZ;AAAA;AAAA;AAAA,QACJ;AAAA;AAAA;AAAA,EACJ;AACJ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/dist/styles.css
ADDED
|
@@ -0,0 +1,164 @@
|
|
|
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
|
+
--spacing: 0.25rem;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
@layer utilities {
|
|
10
|
+
.flex {
|
|
11
|
+
display: flex;
|
|
12
|
+
}
|
|
13
|
+
.table {
|
|
14
|
+
display: table;
|
|
15
|
+
}
|
|
16
|
+
.min-w-0 {
|
|
17
|
+
min-width: 0px;
|
|
18
|
+
}
|
|
19
|
+
.flex-1 {
|
|
20
|
+
flex: 1;
|
|
21
|
+
}
|
|
22
|
+
.basis-40 {
|
|
23
|
+
flex-basis: calc(var(--spacing) * 40);
|
|
24
|
+
}
|
|
25
|
+
.flex-col {
|
|
26
|
+
flex-direction: column;
|
|
27
|
+
}
|
|
28
|
+
.flex-wrap {
|
|
29
|
+
flex-wrap: wrap;
|
|
30
|
+
}
|
|
31
|
+
.items-center {
|
|
32
|
+
align-items: center;
|
|
33
|
+
}
|
|
34
|
+
.items-end {
|
|
35
|
+
align-items: flex-end;
|
|
36
|
+
}
|
|
37
|
+
.justify-between {
|
|
38
|
+
justify-content: space-between;
|
|
39
|
+
}
|
|
40
|
+
.gap-gridui-4 {
|
|
41
|
+
gap: var(--gridui-space-4);
|
|
42
|
+
}
|
|
43
|
+
.gap-gridui-8 {
|
|
44
|
+
gap: var(--gridui-space-8);
|
|
45
|
+
}
|
|
46
|
+
.gap-gridui-16 {
|
|
47
|
+
gap: var(--gridui-space-16);
|
|
48
|
+
}
|
|
49
|
+
.border {
|
|
50
|
+
border-style: var(--tw-border-style);
|
|
51
|
+
border-width: 1px;
|
|
52
|
+
}
|
|
53
|
+
.border-t {
|
|
54
|
+
border-top-style: var(--tw-border-style);
|
|
55
|
+
border-top-width: 1px;
|
|
56
|
+
}
|
|
57
|
+
.border-b {
|
|
58
|
+
border-bottom-style: var(--tw-border-style);
|
|
59
|
+
border-bottom-width: 1px;
|
|
60
|
+
}
|
|
61
|
+
.border-border {
|
|
62
|
+
border-color: var(--gridui-border);
|
|
63
|
+
}
|
|
64
|
+
.bg-background {
|
|
65
|
+
background-color: var(--gridui-background);
|
|
66
|
+
}
|
|
67
|
+
.p-gridui-16 {
|
|
68
|
+
padding: var(--gridui-space-16);
|
|
69
|
+
}
|
|
70
|
+
.type-caption {
|
|
71
|
+
font: var(--gridui-type-caption);
|
|
72
|
+
letter-spacing: normal;
|
|
73
|
+
}
|
|
74
|
+
.text-foreground {
|
|
75
|
+
color: var(--gridui-foreground);
|
|
76
|
+
}
|
|
77
|
+
.text-muted {
|
|
78
|
+
color: var(--gridui-muted);
|
|
79
|
+
}
|
|
80
|
+
.\!filter {
|
|
81
|
+
filter: var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,) !important;
|
|
82
|
+
}
|
|
83
|
+
.\[\&_label\]\:min-h-11 label {
|
|
84
|
+
min-height: calc(var(--spacing) * 11);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
@property --tw-border-style {
|
|
88
|
+
syntax: "*";
|
|
89
|
+
inherits: false;
|
|
90
|
+
initial-value: solid;
|
|
91
|
+
}
|
|
92
|
+
@property --tw-blur {
|
|
93
|
+
syntax: "*";
|
|
94
|
+
inherits: false;
|
|
95
|
+
}
|
|
96
|
+
@property --tw-brightness {
|
|
97
|
+
syntax: "*";
|
|
98
|
+
inherits: false;
|
|
99
|
+
}
|
|
100
|
+
@property --tw-contrast {
|
|
101
|
+
syntax: "*";
|
|
102
|
+
inherits: false;
|
|
103
|
+
}
|
|
104
|
+
@property --tw-grayscale {
|
|
105
|
+
syntax: "*";
|
|
106
|
+
inherits: false;
|
|
107
|
+
}
|
|
108
|
+
@property --tw-hue-rotate {
|
|
109
|
+
syntax: "*";
|
|
110
|
+
inherits: false;
|
|
111
|
+
}
|
|
112
|
+
@property --tw-invert {
|
|
113
|
+
syntax: "*";
|
|
114
|
+
inherits: false;
|
|
115
|
+
}
|
|
116
|
+
@property --tw-opacity {
|
|
117
|
+
syntax: "*";
|
|
118
|
+
inherits: false;
|
|
119
|
+
}
|
|
120
|
+
@property --tw-saturate {
|
|
121
|
+
syntax: "*";
|
|
122
|
+
inherits: false;
|
|
123
|
+
}
|
|
124
|
+
@property --tw-sepia {
|
|
125
|
+
syntax: "*";
|
|
126
|
+
inherits: false;
|
|
127
|
+
}
|
|
128
|
+
@property --tw-drop-shadow {
|
|
129
|
+
syntax: "*";
|
|
130
|
+
inherits: false;
|
|
131
|
+
}
|
|
132
|
+
@property --tw-drop-shadow-color {
|
|
133
|
+
syntax: "*";
|
|
134
|
+
inherits: false;
|
|
135
|
+
}
|
|
136
|
+
@property --tw-drop-shadow-alpha {
|
|
137
|
+
syntax: "<percentage>";
|
|
138
|
+
inherits: false;
|
|
139
|
+
initial-value: 100%;
|
|
140
|
+
}
|
|
141
|
+
@property --tw-drop-shadow-size {
|
|
142
|
+
syntax: "*";
|
|
143
|
+
inherits: false;
|
|
144
|
+
}
|
|
145
|
+
@layer properties {
|
|
146
|
+
@supports ((-webkit-hyphens: none) and (not (margin-trim: inline))) or ((-moz-orient: inline) and (not (color:rgb(from red r g b)))) {
|
|
147
|
+
*, ::before, ::after, ::backdrop {
|
|
148
|
+
--tw-border-style: solid;
|
|
149
|
+
--tw-blur: initial;
|
|
150
|
+
--tw-brightness: initial;
|
|
151
|
+
--tw-contrast: initial;
|
|
152
|
+
--tw-grayscale: initial;
|
|
153
|
+
--tw-hue-rotate: initial;
|
|
154
|
+
--tw-invert: initial;
|
|
155
|
+
--tw-opacity: initial;
|
|
156
|
+
--tw-saturate: initial;
|
|
157
|
+
--tw-sepia: initial;
|
|
158
|
+
--tw-drop-shadow: initial;
|
|
159
|
+
--tw-drop-shadow-color: initial;
|
|
160
|
+
--tw-drop-shadow-alpha: 100%;
|
|
161
|
+
--tw-drop-shadow-size: initial;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,56 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gridui/data-explorer",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "GridUI React data explorer",
|
|
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/button": "^2.1.1",
|
|
30
|
+
"@gridui/choice": "^1.0.0",
|
|
31
|
+
"@gridui/input": "^1.0.0",
|
|
32
|
+
"@gridui/select": "^1.0.0",
|
|
33
|
+
"@gridui/style-utils": "^2.1.2",
|
|
34
|
+
"@gridui/table": "^1.0.0",
|
|
35
|
+
"@gridui/theme": "^2.1.2",
|
|
36
|
+
"class-variance-authority": "0.7.1"
|
|
37
|
+
},
|
|
38
|
+
"devDependencies": {
|
|
39
|
+
"@gridui-internal/configuration": "0.0.0",
|
|
40
|
+
"@jest/globals": "30.5.2",
|
|
41
|
+
"@types/jest": "30.0.0",
|
|
42
|
+
"@types/node": "26.6.5",
|
|
43
|
+
"@types/react": "19.3.0",
|
|
44
|
+
"@types/react-dom": "19.3.0",
|
|
45
|
+
"jest": "30.5.2",
|
|
46
|
+
"react": "19.3.1",
|
|
47
|
+
"react-dom": "19.3.1",
|
|
48
|
+
"typescript": "6.0.3"
|
|
49
|
+
},
|
|
50
|
+
"scripts": {
|
|
51
|
+
"build": "node ../../scripts/compilation/package.ts",
|
|
52
|
+
"compile": "tsc --project tsconfig.json",
|
|
53
|
+
"test": "jest",
|
|
54
|
+
"coverage": "jest --coverage"
|
|
55
|
+
}
|
|
6
56
|
}
|