@agentero/design-system 0.25.2 → 0.25.3
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.
|
@@ -594,7 +594,7 @@
|
|
|
594
594
|
<main>
|
|
595
595
|
<div class="wrap">
|
|
596
596
|
<div class="note ok" style="margin-bottom: 16px;">
|
|
597
|
-
Using <code>react-component-meta</code>. Generation took <strong>3.
|
|
597
|
+
Using <code>react-component-meta</code>. Generation took <strong>3.7s</strong>.
|
|
598
598
|
</div>
|
|
599
599
|
<h2 class="section-title">Components</h2>
|
|
600
600
|
<div class="grid" role="list">
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { cn as e } from "../../lib/utils.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { Pagination as t } from "../pagination/pagination.js";
|
|
4
|
+
import { Table as n } from "../table/index.js";
|
|
5
5
|
import { IconArrowUpward as r, IconSwapVert as i } from "./icons.js";
|
|
6
6
|
import { tv as a } from "tailwind-variants";
|
|
7
7
|
import { Fragment as o, jsx as s, jsxs as c } from "react/jsx-runtime";
|
|
@@ -57,24 +57,24 @@ var b = a({
|
|
|
57
57
|
left: "justify-start"
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
|
-
}), S = (e) => !!e.closest("a, button, [role=\"menu\"]"), C = ({ children:
|
|
60
|
+
}), S = (e) => !!e.closest("a, button, [role=\"menu\"]"), C = ({ children: t = /* @__PURE__ */ s(w, {}), size: a = "md", sticky: u = "header", embed: d = !0, enclosed: f = !1 }) => {
|
|
61
61
|
let { table: m, isLoading: h, scrollRef: g, onRowClick: v, rowHref: y, linkComponent: C } = _(), T = m.getAllColumns().length;
|
|
62
62
|
return /* @__PURE__ */ s("div", {
|
|
63
63
|
"data-slot": "data-table-loading-overlay",
|
|
64
64
|
className: e("flex min-h-0 flex-1 flex-col transition-opacity duration-150", h && "opacity-50"),
|
|
65
|
-
children: /* @__PURE__ */ c(
|
|
65
|
+
children: /* @__PURE__ */ c(n.Root, {
|
|
66
66
|
size: a,
|
|
67
67
|
sticky: u,
|
|
68
68
|
embed: d,
|
|
69
69
|
enclosed: f,
|
|
70
70
|
ref: g,
|
|
71
|
-
children: [/* @__PURE__ */ s(
|
|
72
|
-
let
|
|
71
|
+
children: [/* @__PURE__ */ s(n.Head, { children: m.getHeaderGroups().map((e) => /* @__PURE__ */ s(n.Row, { children: e.headers.map((e) => {
|
|
72
|
+
let t = e.column.columnDef.meta, a = e.column.getCanSort(), l = e.column.getIsSorted(), u = t?.style?.textAlign === "right" || t?.className?.includes("text-right") ? "right" : "left", d = e.isPlaceholder ? null : /* @__PURE__ */ c(o, { children: [p(e.column.columnDef.header, e.getContext()), a && /* @__PURE__ */ s("span", {
|
|
73
73
|
className: "size-4",
|
|
74
74
|
children: l ? /* @__PURE__ */ s(r, { className: b({ direction: l }) }) : /* @__PURE__ */ s(i, { className: "size-4" })
|
|
75
75
|
})] });
|
|
76
|
-
return /* @__PURE__ */ s(
|
|
77
|
-
...
|
|
76
|
+
return /* @__PURE__ */ s(n.Header, {
|
|
77
|
+
...t,
|
|
78
78
|
"aria-sort": a ? l === "asc" ? "ascending" : l === "desc" ? "descending" : "none" : void 0,
|
|
79
79
|
children: a ? /* @__PURE__ */ s("button", {
|
|
80
80
|
type: "button",
|
|
@@ -93,18 +93,18 @@ var b = a({
|
|
|
93
93
|
children: d
|
|
94
94
|
})
|
|
95
95
|
}, e.id);
|
|
96
|
-
}) }, e.id)) }), /* @__PURE__ */ s(
|
|
97
|
-
let r = y?.(
|
|
98
|
-
return /* @__PURE__ */ s(l, { children: /* @__PURE__ */ s(
|
|
96
|
+
}) }, e.id)) }), /* @__PURE__ */ s(n.Body, { children: m.getRowModel().rows.length ? m.getRowModel().rows.map((t) => {
|
|
97
|
+
let r = y?.(t.original), i = !!v || !!r;
|
|
98
|
+
return /* @__PURE__ */ s(l, { children: /* @__PURE__ */ s(n.Row, {
|
|
99
99
|
className: e("has-aria-expanded:bg-bg-default-base-secondary", i && "cursor-pointer"),
|
|
100
100
|
onClick: i ? (e) => {
|
|
101
|
-
S(e.target) || !e.currentTarget.contains(e.target) || (v ? v(
|
|
101
|
+
S(e.target) || !e.currentTarget.contains(e.target) || (v ? v(t.original) : r && e.currentTarget.querySelector("[data-row-link]")?.click());
|
|
102
102
|
} : void 0,
|
|
103
|
-
children:
|
|
103
|
+
children: t.getVisibleCells().map((e, t) => {
|
|
104
104
|
let i = e.column.columnDef.meta;
|
|
105
|
-
return /* @__PURE__ */ c(
|
|
105
|
+
return /* @__PURE__ */ c(n.Cell, {
|
|
106
106
|
...i,
|
|
107
|
-
children: [
|
|
107
|
+
children: [t === 0 && r && /* @__PURE__ */ s(C, {
|
|
108
108
|
href: r,
|
|
109
109
|
"data-row-link": !0,
|
|
110
110
|
className: "hidden",
|
|
@@ -113,13 +113,13 @@ var b = a({
|
|
|
113
113
|
}), p(e.column.columnDef.cell, e.getContext())]
|
|
114
114
|
}, e.id);
|
|
115
115
|
})
|
|
116
|
-
}) },
|
|
117
|
-
}) : h ? null : /* @__PURE__ */ s(
|
|
116
|
+
}) }, t.id);
|
|
117
|
+
}) : h ? null : /* @__PURE__ */ s(n.Row, { children: /* @__PURE__ */ s(n.Cell, {
|
|
118
118
|
colSpan: T,
|
|
119
119
|
children: /* @__PURE__ */ s("div", {
|
|
120
120
|
"data-slot": "table-empty-state",
|
|
121
121
|
className: "whitespace-normal",
|
|
122
|
-
children:
|
|
122
|
+
children: t
|
|
123
123
|
})
|
|
124
124
|
}) }) })]
|
|
125
125
|
})
|
|
@@ -139,11 +139,11 @@ var w = () => /* @__PURE__ */ s("div", {
|
|
|
139
139
|
});
|
|
140
140
|
T.displayName = "DataTable.Footer";
|
|
141
141
|
var E = (e) => {
|
|
142
|
-
let { scrollRef:
|
|
143
|
-
return /* @__PURE__ */ s(
|
|
142
|
+
let { scrollRef: n } = _();
|
|
143
|
+
return /* @__PURE__ */ s(t, {
|
|
144
144
|
...e,
|
|
145
|
-
onPageChange: (
|
|
146
|
-
|
|
145
|
+
onPageChange: (t) => {
|
|
146
|
+
n.current?.scrollTo({ top: 0 }), e.onPageChange(t);
|
|
147
147
|
}
|
|
148
148
|
});
|
|
149
149
|
};
|
|
@@ -1,144 +1,5 @@
|
|
|
1
1
|
export { useDataTable } from './data-table';
|
|
2
2
|
export type { DataTableColumnMeta, PaginationState } from './data-table';
|
|
3
|
-
/**
|
|
4
|
-
* @deprecated Import from `@agentero/design-system/table` instead — that entry
|
|
5
|
-
* point carries no `@tanstack/react-table` dependency.
|
|
6
|
-
*/
|
|
7
|
-
export declare const Table: {
|
|
8
|
-
Root: {
|
|
9
|
-
({ children, ref, ...variants }: import('react').PropsWithChildren<import('.').TableRootProps>): import("react/jsx-runtime").JSX.Element;
|
|
10
|
-
displayName: string;
|
|
11
|
-
};
|
|
12
|
-
Head: {
|
|
13
|
-
({ children, ...props }: import('react').PropsWithChildren<import('react').HTMLAttributes<HTMLTableSectionElement>>): import("react/jsx-runtime").JSX.Element;
|
|
14
|
-
displayName: string;
|
|
15
|
-
};
|
|
16
|
-
Body: {
|
|
17
|
-
({ children, ...props }: import('react').PropsWithChildren<import('react').HTMLAttributes<HTMLTableSectionElement>>): import("react/jsx-runtime").JSX.Element;
|
|
18
|
-
displayName: string;
|
|
19
|
-
};
|
|
20
|
-
Row: {
|
|
21
|
-
({ className, ...props }: import('react').ComponentProps<"tr">): import("react/jsx-runtime").JSX.Element;
|
|
22
|
-
displayName: string;
|
|
23
|
-
};
|
|
24
|
-
Header: {
|
|
25
|
-
({ className, ...props }: import('react').PropsWithChildren<import('react').HTMLAttributes<HTMLTableCellElement>>): import("react/jsx-runtime").JSX.Element;
|
|
26
|
-
displayName: string;
|
|
27
|
-
};
|
|
28
|
-
Cell: {
|
|
29
|
-
({ className, ...props }: import('react').PropsWithChildren<import('react').TdHTMLAttributes<HTMLTableCellElement>>): import("react/jsx-runtime").JSX.Element;
|
|
30
|
-
displayName: string;
|
|
31
|
-
};
|
|
32
|
-
ExpandButton: {
|
|
33
|
-
({ toggleExpanded, isExpanded, className, ...props }: {
|
|
34
|
-
toggleExpanded: () => void;
|
|
35
|
-
isExpanded: boolean;
|
|
36
|
-
} & {
|
|
37
|
-
children?: import('react').ReactNode;
|
|
38
|
-
variant?: import('../button').ButtonVariantType;
|
|
39
|
-
size?: import('../button').ButtonSizeType;
|
|
40
|
-
status?: "danger";
|
|
41
|
-
loading?: boolean;
|
|
42
|
-
disabled?: boolean;
|
|
43
|
-
iconOnly?: boolean;
|
|
44
|
-
rounded?: boolean;
|
|
45
|
-
align?: "center" | "start" | "end" | "justify";
|
|
46
|
-
fitContent?: boolean;
|
|
47
|
-
ref?: import('react').Ref<HTMLButtonElement | HTMLAnchorElement>;
|
|
48
|
-
} & import('react').ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
49
|
-
asChild?: boolean;
|
|
50
|
-
}): import("react/jsx-runtime").JSX.Element;
|
|
51
|
-
displayName: string;
|
|
52
|
-
};
|
|
53
|
-
ExpandedRow: {
|
|
54
|
-
({ className, ...props }: import('react').PropsWithChildren<import('react').HTMLAttributes<HTMLTableRowElement>>): import("react/jsx-runtime").JSX.Element;
|
|
55
|
-
displayName: string;
|
|
56
|
-
};
|
|
57
|
-
RowActions: {
|
|
58
|
-
({ children }: import('react').PropsWithChildren): import("react/jsx-runtime").JSX.Element;
|
|
59
|
-
displayName: string;
|
|
60
|
-
};
|
|
61
|
-
};
|
|
62
|
-
/**
|
|
63
|
-
* @deprecated Import from `@agentero/design-system/table` instead.
|
|
64
|
-
*/
|
|
65
|
-
export declare const tableRecipe: import('tailwind-variants').TVReturnType<{
|
|
66
|
-
size: {
|
|
67
|
-
sm: {};
|
|
68
|
-
md: {};
|
|
69
|
-
lg: {};
|
|
70
|
-
};
|
|
71
|
-
embed: {
|
|
72
|
-
true: {
|
|
73
|
-
root: string;
|
|
74
|
-
};
|
|
75
|
-
};
|
|
76
|
-
enclosed: {
|
|
77
|
-
true: {
|
|
78
|
-
root: string;
|
|
79
|
-
};
|
|
80
|
-
};
|
|
81
|
-
sticky: {
|
|
82
|
-
header: {};
|
|
83
|
-
headerAndFooter: {};
|
|
84
|
-
};
|
|
85
|
-
}, {
|
|
86
|
-
root: string[];
|
|
87
|
-
scroll: string;
|
|
88
|
-
table: string;
|
|
89
|
-
}, undefined, {
|
|
90
|
-
size: {
|
|
91
|
-
sm: {};
|
|
92
|
-
md: {};
|
|
93
|
-
lg: {};
|
|
94
|
-
};
|
|
95
|
-
embed: {
|
|
96
|
-
true: {
|
|
97
|
-
root: string;
|
|
98
|
-
};
|
|
99
|
-
};
|
|
100
|
-
enclosed: {
|
|
101
|
-
true: {
|
|
102
|
-
root: string;
|
|
103
|
-
};
|
|
104
|
-
};
|
|
105
|
-
sticky: {
|
|
106
|
-
header: {};
|
|
107
|
-
headerAndFooter: {};
|
|
108
|
-
};
|
|
109
|
-
}, {
|
|
110
|
-
root: string[];
|
|
111
|
-
scroll: string;
|
|
112
|
-
table: string;
|
|
113
|
-
}, import('tailwind-variants').TVReturnType<{
|
|
114
|
-
size: {
|
|
115
|
-
sm: {};
|
|
116
|
-
md: {};
|
|
117
|
-
lg: {};
|
|
118
|
-
};
|
|
119
|
-
embed: {
|
|
120
|
-
true: {
|
|
121
|
-
root: string;
|
|
122
|
-
};
|
|
123
|
-
};
|
|
124
|
-
enclosed: {
|
|
125
|
-
true: {
|
|
126
|
-
root: string;
|
|
127
|
-
};
|
|
128
|
-
};
|
|
129
|
-
sticky: {
|
|
130
|
-
header: {};
|
|
131
|
-
headerAndFooter: {};
|
|
132
|
-
};
|
|
133
|
-
}, {
|
|
134
|
-
root: string[];
|
|
135
|
-
scroll: string;
|
|
136
|
-
table: string;
|
|
137
|
-
}, undefined, unknown, unknown, undefined>>;
|
|
138
|
-
/**
|
|
139
|
-
* @deprecated Import from `@agentero/design-system/table` instead.
|
|
140
|
-
*/
|
|
141
|
-
export type { TableRootProps } from '../table';
|
|
142
3
|
export declare const DataTable: {
|
|
143
4
|
Root: {
|
|
144
5
|
<TData extends import('@tanstack/table-core').RowData>({ children, isLoading, onRowClick, rowHref, linkComponent, ...tableOptions }: import('react').PropsWithChildren<{
|
|
@@ -239,10 +100,10 @@ export declare const DataTable: {
|
|
|
239
100
|
};
|
|
240
101
|
Table: {
|
|
241
102
|
({ children, size, sticky, embed, enclosed }: {
|
|
242
|
-
size?: import('
|
|
243
|
-
sticky?: import('
|
|
244
|
-
embed?: import('
|
|
245
|
-
enclosed?: import('
|
|
103
|
+
size?: import('../table').TableRootProps["size"];
|
|
104
|
+
sticky?: import('../table').TableRootProps["sticky"];
|
|
105
|
+
embed?: import('../table').TableRootProps["embed"];
|
|
106
|
+
enclosed?: import('../table').TableRootProps["enclosed"];
|
|
246
107
|
} & {
|
|
247
108
|
children?: import('react').ReactNode | undefined;
|
|
248
109
|
}): import("react/jsx-runtime").JSX.Element;
|
package/src/data-table/index.js
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Table as t } from "../table/index.js";
|
|
3
|
-
import { DataTablePagination as n, DataTableTable as r, Footer as i, Root as a, ToolBar as o, useDataTable as s } from "./data-table.js";
|
|
1
|
+
import { DataTablePagination as e, DataTableTable as t, Footer as n, Root as r, ToolBar as i, useDataTable as a } from "./data-table.js";
|
|
4
2
|
//#region src/data-table/index.ts
|
|
5
|
-
var
|
|
6
|
-
Root:
|
|
7
|
-
ToolBar:
|
|
8
|
-
Table:
|
|
9
|
-
Footer:
|
|
10
|
-
Pagination:
|
|
3
|
+
var o = {
|
|
4
|
+
Root: r,
|
|
5
|
+
ToolBar: i,
|
|
6
|
+
Table: t,
|
|
7
|
+
Footer: n,
|
|
8
|
+
Pagination: e
|
|
11
9
|
};
|
|
12
10
|
//#endregion
|
|
13
|
-
export {
|
|
11
|
+
export { o as DataTable, a as useDataTable };
|