@caspeco/casper-ui-library 8.2.0 → 8.2.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/dist/components/combobox/combobox-menu.d.ts.map +1 -1
- package/dist/components/combobox/combobox-menu.js +7 -6
- package/dist/components/table/table-content.d.ts +2 -1
- package/dist/components/table/table-content.d.ts.map +1 -1
- package/dist/components/table/table-content.js +105 -83
- package/dist/components/table/table-header-row.d.ts.map +1 -1
- package/dist/components/table/table-header-row.js +147 -119
- package/dist/components/table/table-row.d.ts.map +1 -1
- package/dist/components/table/table-row.js +42 -43
- package/dist/test-utils/hooks/index.d.ts +2 -0
- package/dist/test-utils/hooks/index.d.ts.map +1 -0
- package/dist/test-utils/hooks/setup-mock-resize-observer.d.ts +2 -0
- package/dist/test-utils/hooks/setup-mock-resize-observer.d.ts.map +1 -0
- package/dist/theme/theme-config/components/table-theme.d.ts.map +1 -1
- package/dist/theme/theme-config/components/table-theme.js +40 -20
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"combobox-menu.d.ts","sourceRoot":"","sources":["../../../lib/components/combobox/combobox-menu.tsx"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EACX,kBAAkB,EAIlB,MAAM,SAAS,CAAC;AA2CjB,wBAAgB,qBAAqB,CAAC,EACrC,cAAc,EACd,SAAS,GACT,EAAE;IACF,cAAc,EAAE,OAAO,CAAC;IACxB,SAAS,EAAE,OAAO,CAAC;CACnB,2CAEA;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,kBAAkB,
|
|
1
|
+
{"version":3,"file":"combobox-menu.d.ts","sourceRoot":"","sources":["../../../lib/components/combobox/combobox-menu.tsx"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EACX,kBAAkB,EAIlB,MAAM,SAAS,CAAC;AA2CjB,wBAAgB,qBAAqB,CAAC,EACrC,cAAc,EACd,SAAS,GACT,EAAE;IACF,cAAc,EAAE,OAAO,CAAC;IACxB,SAAS,EAAE,OAAO,CAAC;CACnB,2CAEA;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,kBAAkB,2CAkGrD"}
|
|
@@ -130,6 +130,7 @@ function pe(o) {
|
|
|
130
130
|
backgroundColor: d.Surface,
|
|
131
131
|
padding: `${c.Small} ${c.Medium}`,
|
|
132
132
|
borderTop: `${N.XSmall} ${d.OnSurfaceBorder}`,
|
|
133
|
+
tabIndex: -1,
|
|
133
134
|
children: l
|
|
134
135
|
}
|
|
135
136
|
)
|
|
@@ -179,9 +180,9 @@ const A = ({
|
|
|
179
180
|
p.stopPropagation(), p.preventDefault(), s(r);
|
|
180
181
|
};
|
|
181
182
|
i.length > 0 && (i[i.length - 1] -= 1);
|
|
182
|
-
const m = P++,
|
|
183
|
+
const m = P++, I = r.children && r.children.length > 0, B = !I || r.isSelectableParent;
|
|
183
184
|
let $ = e.some((p) => p.id === r.id);
|
|
184
|
-
return a &&
|
|
185
|
+
return a && I && !r.isSelectableParent && w(r, e) && ($ = !0), /* @__PURE__ */ g(T, { children: [
|
|
185
186
|
/* @__PURE__ */ g(
|
|
186
187
|
A,
|
|
187
188
|
{
|
|
@@ -227,7 +228,7 @@ const A = ({
|
|
|
227
228
|
}),
|
|
228
229
|
/* @__PURE__ */ n(H, { item: r, asPlainText: !0, highlightQuery: x })
|
|
229
230
|
] }),
|
|
230
|
-
|
|
231
|
+
B ? /* @__PURE__ */ n(X, { isSingleSelect: k, isChecked: $ }) : a && !k && /* @__PURE__ */ n(W, { isIndeterminate: S(r), isChecked: $ })
|
|
231
232
|
]
|
|
232
233
|
}
|
|
233
234
|
),
|
|
@@ -253,7 +254,7 @@ const A = ({
|
|
|
253
254
|
e.stopPropagation(), e.preventDefault(), s(i);
|
|
254
255
|
};
|
|
255
256
|
return o.map((e, i) => {
|
|
256
|
-
const r = t.some((f) => f.id === e.id), v = e.children?.length, m = e.id === "_back",
|
|
257
|
+
const r = t.some((f) => f.id === e.id), v = e.children?.length, m = e.id === "_back", I = x.opened[x.opened.length - 1], B = e.id === I?.id, $ = m ? /* @__PURE__ */ g(y, { gap: c.XSmall, alignItems: "center", children: [
|
|
257
258
|
/* @__PURE__ */ n(z, { icon: D.Back, size: F.Small }),
|
|
258
259
|
e.label
|
|
259
260
|
] }) : /* @__PURE__ */ g(_, { children: [
|
|
@@ -264,7 +265,7 @@ const A = ({
|
|
|
264
265
|
] }, f)),
|
|
265
266
|
/* @__PURE__ */ n(H, { item: e, asPlainText: w })
|
|
266
267
|
] }),
|
|
267
|
-
P ? void 0 : v && !
|
|
268
|
+
P ? void 0 : v && !B && !S ? /* @__PURE__ */ n(
|
|
268
269
|
z,
|
|
269
270
|
{
|
|
270
271
|
icon: D.Forward,
|
|
@@ -272,7 +273,7 @@ const A = ({
|
|
|
272
273
|
color: d.OnBackgroundSubdued
|
|
273
274
|
}
|
|
274
275
|
) : /* @__PURE__ */ n(X, { isSingleSelect: b, isChecked: r })
|
|
275
|
-
] }), p = u.length > 0 && u.length - 1 === i && u.length < o.length, M = !P && !S && (p || (m ||
|
|
276
|
+
] }), p = u.length > 0 && u.length - 1 === i && u.length < o.length, M = !P && !S && (p || (m || B));
|
|
276
277
|
return /* @__PURE__ */ g(T, { children: [
|
|
277
278
|
/* @__PURE__ */ n(
|
|
278
279
|
A,
|
|
@@ -48,7 +48,8 @@ export interface TableContentProps<TData extends TableData = TableData> {
|
|
|
48
48
|
*/
|
|
49
49
|
portalContainerRef?: React.RefObject<HTMLElement | null>;
|
|
50
50
|
}
|
|
51
|
-
|
|
51
|
+
type TableContentInnerProps<TData extends TableData> = TableContentProps<TData> & ThemeStyleProps;
|
|
52
|
+
declare const TableContentInner: <TData extends TableData>({ virtualization, ...props }: TableContentInnerProps<TData>) => import("react/jsx-runtime").JSX.Element;
|
|
52
53
|
/**
|
|
53
54
|
* Renders table rows and columns with support for row interactions, nested data, and virtualization.
|
|
54
55
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"table-content.d.ts","sourceRoot":"","sources":["../../../lib/components/table/table-content.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAO/C,OAAO,KAAK,EAAE,SAAS,EAAE,QAAQ,IAAI,YAAY,EAAE,MAAM,SAAS,CAAC;AAEnE,UAAU,qBAAqB;IAC9B;;;OAGG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAE3B;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,iBAAiB,CAAC,KAAK,SAAS,SAAS,GAAG,SAAS;IACrE;;OAEG;IACH,UAAU,CAAC,EAAE,CACZ,GAAG,EAAE,YAAY,CAAC,KAAK,CAAC,EACxB,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC,mBAAmB,CAAC,GAAG,KAAK,CAAC,aAAa,CAAC,mBAAmB,CAAC,KACnF,IAAI,CAAC;IAEV;;OAEG;IACH,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAE/B;;OAEG;IACH,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAElC;;;OAGG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAE5B;;OAEG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IAExB;;OAEG;IACH,cAAc,CAAC,EAAE,qBAAqB,CAAC;IACvC;;OAEG;IACH,kBAAkB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC;CACzD;AAED,QAAA,MAAM,iBAAiB,GAAI,KAAK,SAAS,SAAS,EAAE
|
|
1
|
+
{"version":3,"file":"table-content.d.ts","sourceRoot":"","sources":["../../../lib/components/table/table-content.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAO/C,OAAO,KAAK,EAAE,SAAS,EAAE,QAAQ,IAAI,YAAY,EAAE,MAAM,SAAS,CAAC;AAEnE,UAAU,qBAAqB;IAC9B;;;OAGG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAE3B;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,iBAAiB,CAAC,KAAK,SAAS,SAAS,GAAG,SAAS;IACrE;;OAEG;IACH,UAAU,CAAC,EAAE,CACZ,GAAG,EAAE,YAAY,CAAC,KAAK,CAAC,EACxB,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC,mBAAmB,CAAC,GAAG,KAAK,CAAC,aAAa,CAAC,mBAAmB,CAAC,KACnF,IAAI,CAAC;IAEV;;OAEG;IACH,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAE/B;;OAEG;IACH,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAElC;;;OAGG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAE5B;;OAEG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IAExB;;OAEG;IACH,cAAc,CAAC,EAAE,qBAAqB,CAAC;IACvC;;OAEG;IACH,kBAAkB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC;CACzD;AAED,KAAK,sBAAsB,CAAC,KAAK,SAAS,SAAS,IAAI,iBAAiB,CAAC,KAAK,CAAC,GAAG,eAAe,CAAC;AAElG,QAAA,MAAM,iBAAiB,GAAI,KAAK,SAAS,SAAS,EAAE,8BAGjD,sBAAsB,CAAC,KAAK,CAAC,4CAM/B,CAAC;AAuLF;;;;GAIG;AACH,eAAO,MAAM,YAAY,EAA8B,OAAO,iBAAiB,CAAC"}
|
|
@@ -1,25 +1,21 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { useVirtualizer as
|
|
4
|
-
import { memo as
|
|
5
|
-
import { useTableContext as
|
|
6
|
-
import { TableHeaderRow as
|
|
7
|
-
import { TableRow as
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
...
|
|
1
|
+
import { jsx as e, jsxs as C } from "react/jsx-runtime";
|
|
2
|
+
import { Tbody as w, Box as y, Table as v, Thead as H } from "@chakra-ui/react";
|
|
3
|
+
import { useVirtualizer as B } from "../../node_modules/@tanstack/react-virtual/dist/esm/index.js";
|
|
4
|
+
import { memo as I, useMemo as h, useRef as k } from "react";
|
|
5
|
+
import { useTableContext as g } from "./table-context.js";
|
|
6
|
+
import { TableHeaderRow as D } from "./table-header-row.js";
|
|
7
|
+
import { TableRow as x } from "./table-row.js";
|
|
8
|
+
const M = ({
|
|
9
|
+
virtualization: l,
|
|
10
|
+
...i
|
|
11
|
+
}) => l ? /* @__PURE__ */ e(_, { ...i, virtualization: l }) : /* @__PURE__ */ e(j, { ...i }), _ = ({
|
|
12
|
+
onClickRow: l,
|
|
13
|
+
onRowClickIndication: i,
|
|
14
|
+
showRowHoverStyle: d = !0,
|
|
15
|
+
virtualization: r,
|
|
16
|
+
...o
|
|
17
17
|
}) => {
|
|
18
|
-
const t =
|
|
19
|
-
position: "sticky",
|
|
20
|
-
top: 0,
|
|
21
|
-
zIndex: 1
|
|
22
|
-
} : {}, [h]), c = u(
|
|
18
|
+
const t = g(), n = k(null), s = h(
|
|
23
19
|
() => t.table.getRowModel().rows,
|
|
24
20
|
// The dependencies are needed to ensure that the rows are recalculated when any of these change
|
|
25
21
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
@@ -30,82 +26,108 @@ const q = ({
|
|
|
30
26
|
t.sorting,
|
|
31
27
|
t.data
|
|
32
28
|
]
|
|
33
|
-
),
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
29
|
+
), R = h(() => {
|
|
30
|
+
const u = r.estimateRowHeight ?? 40, b = r.overscan ?? 5;
|
|
31
|
+
return {
|
|
32
|
+
count: s.length,
|
|
33
|
+
getScrollElement: () => n.current,
|
|
34
|
+
estimateSize: () => u,
|
|
35
|
+
overscan: b,
|
|
36
|
+
enabled: !0,
|
|
37
|
+
onChange: (f, c) => {
|
|
38
|
+
c && n.current && document.activeElement !== n.current && n.current.focus();
|
|
42
39
|
}
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
40
|
+
};
|
|
41
|
+
}, [r.estimateRowHeight, r.overscan, s]), p = B(R), a = p.getVirtualItems(), V = () => {
|
|
42
|
+
const u = a.length > 0 ? a[0]?.start ?? 0 : 0, b = a.length > 0 ? p.getTotalSize() - (a[a.length - 1]?.end ?? 0) : 0, m = s[0]?.getVisibleCells().length ?? t.table.getVisibleLeafColumns().length;
|
|
43
|
+
return /* @__PURE__ */ C(w, { children: [
|
|
44
|
+
u > 0 && /* @__PURE__ */ e("tr", { style: { height: `${u}px` }, "aria-hidden": "true", children: /* @__PURE__ */ e("td", { colSpan: m }) }),
|
|
45
|
+
a.map((f) => {
|
|
46
|
+
const c = s[f.index];
|
|
47
|
+
if (!c) return null;
|
|
48
|
+
const S = c.getVisibleCells();
|
|
49
49
|
return /* @__PURE__ */ e(
|
|
50
|
-
|
|
50
|
+
x,
|
|
51
51
|
{
|
|
52
|
-
row:
|
|
53
|
-
visibleCells:
|
|
54
|
-
onClickRow:
|
|
55
|
-
onRowClickIndication:
|
|
56
|
-
showRowHoverStyle:
|
|
52
|
+
row: c,
|
|
53
|
+
visibleCells: S,
|
|
54
|
+
onClickRow: l,
|
|
55
|
+
onRowClickIndication: i,
|
|
56
|
+
showRowHoverStyle: d
|
|
57
57
|
},
|
|
58
|
-
|
|
59
|
-
);
|
|
60
|
-
}) });
|
|
61
|
-
const o = n.length > 0 ? n[0]?.start ?? 0 : 0, d = n.length > 0 ? C.getTotalSize() - (n[n.length - 1]?.end ?? 0) : 0, V = c[0]?.getVisibleCells().length ?? t.table.getVisibleLeafColumns().length;
|
|
62
|
-
return /* @__PURE__ */ S(y, { children: [
|
|
63
|
-
o > 0 && /* @__PURE__ */ e("tr", { style: { height: `${o}px` }, "aria-hidden": "true", children: /* @__PURE__ */ e("td", { colSpan: V }) }),
|
|
64
|
-
n.map((s) => {
|
|
65
|
-
const r = c[s.index];
|
|
66
|
-
if (!r) return null;
|
|
67
|
-
const j = r.getVisibleCells();
|
|
68
|
-
return /* @__PURE__ */ e(
|
|
69
|
-
v,
|
|
70
|
-
{
|
|
71
|
-
row: r,
|
|
72
|
-
visibleCells: j,
|
|
73
|
-
onClickRow: m,
|
|
74
|
-
onRowClickIndication: b,
|
|
75
|
-
showRowHoverStyle: g
|
|
76
|
-
},
|
|
77
|
-
r.id
|
|
58
|
+
c.id
|
|
78
59
|
);
|
|
79
60
|
}),
|
|
80
|
-
|
|
61
|
+
b > 0 && /* @__PURE__ */ e("tr", { style: { height: `${b}px` }, "aria-hidden": "true", children: /* @__PURE__ */ e("td", { colSpan: m }) })
|
|
81
62
|
] });
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
{
|
|
86
|
-
headerGroup: o,
|
|
87
|
-
hideTableHeaderDropdown: w,
|
|
88
|
-
portalContainerRef: R
|
|
89
|
-
},
|
|
90
|
-
o.id
|
|
91
|
-
)) }),
|
|
92
|
-
_()
|
|
93
|
-
] });
|
|
94
|
-
return l ? /* @__PURE__ */ e(
|
|
95
|
-
$,
|
|
63
|
+
};
|
|
64
|
+
return /* @__PURE__ */ e(
|
|
65
|
+
y,
|
|
96
66
|
{
|
|
97
|
-
ref:
|
|
67
|
+
ref: n,
|
|
98
68
|
overflowY: "auto",
|
|
99
|
-
height:
|
|
69
|
+
height: r.height ?? "600px",
|
|
100
70
|
position: "relative",
|
|
101
71
|
tabIndex: -1,
|
|
102
72
|
outline: "none",
|
|
103
73
|
_focus: { outline: "none", boxShadow: "none" },
|
|
104
74
|
_focusVisible: { outline: "none", boxShadow: "none" },
|
|
105
|
-
children: T
|
|
75
|
+
children: /* @__PURE__ */ e(T, { ...o, children: V() })
|
|
106
76
|
}
|
|
107
|
-
)
|
|
108
|
-
},
|
|
77
|
+
);
|
|
78
|
+
}, j = ({
|
|
79
|
+
onClickRow: l,
|
|
80
|
+
onRowClickIndication: i,
|
|
81
|
+
showRowHoverStyle: d = !0,
|
|
82
|
+
...r
|
|
83
|
+
}) => {
|
|
84
|
+
const o = g(), t = h(
|
|
85
|
+
() => o.table.getRowModel().rows,
|
|
86
|
+
// The dependencies are needed to ensure that the rows are recalculated when any of these change
|
|
87
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
88
|
+
[
|
|
89
|
+
o.expanded,
|
|
90
|
+
o.breakingContentState,
|
|
91
|
+
o.columnVisibility,
|
|
92
|
+
o.sorting,
|
|
93
|
+
o.data
|
|
94
|
+
]
|
|
95
|
+
);
|
|
96
|
+
return /* @__PURE__ */ e(T, { ...r, children: /* @__PURE__ */ e(w, { children: t.map((n) => {
|
|
97
|
+
const s = n.getVisibleCells();
|
|
98
|
+
return /* @__PURE__ */ e(
|
|
99
|
+
x,
|
|
100
|
+
{
|
|
101
|
+
row: n,
|
|
102
|
+
visibleCells: s,
|
|
103
|
+
onClickRow: l,
|
|
104
|
+
onRowClickIndication: i,
|
|
105
|
+
showRowHoverStyle: d
|
|
106
|
+
},
|
|
107
|
+
n.id
|
|
108
|
+
);
|
|
109
|
+
}) }) });
|
|
110
|
+
}, T = ({
|
|
111
|
+
hideTableHeaderDropdown: l,
|
|
112
|
+
stickyHeaders: i,
|
|
113
|
+
portalContainerRef: d,
|
|
114
|
+
children: r,
|
|
115
|
+
...o
|
|
116
|
+
}) => {
|
|
117
|
+
const t = g();
|
|
118
|
+
return /* @__PURE__ */ C(v, { ...o, id: t.id, children: [
|
|
119
|
+
/* @__PURE__ */ e(H, { "data-sticky-headers": i, children: t.table.getHeaderGroups().map((n) => /* @__PURE__ */ e(
|
|
120
|
+
D,
|
|
121
|
+
{
|
|
122
|
+
headerGroup: n,
|
|
123
|
+
hideTableHeaderDropdown: l,
|
|
124
|
+
portalContainerRef: d
|
|
125
|
+
},
|
|
126
|
+
n.id
|
|
127
|
+
)) }),
|
|
128
|
+
r
|
|
129
|
+
] });
|
|
130
|
+
}, q = I(M);
|
|
109
131
|
export {
|
|
110
|
-
|
|
132
|
+
q as TableContent
|
|
111
133
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"table-header-row.d.ts","sourceRoot":"","sources":["../../../lib/components/table/table-header-row.tsx"],"names":[],"mappings":"AAGA,OAAO,
|
|
1
|
+
{"version":3,"file":"table-header-row.d.ts","sourceRoot":"","sources":["../../../lib/components/table/table-header-row.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAwC,KAAK,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAoB/F,OAAO,KAAK,EAAmB,SAAS,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAEpE,KAAK,mBAAmB,CAAC,KAAK,SAAS,SAAS,IAAI;IACnD,WAAW,EAAE,WAAW,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC;IAC1C,uBAAuB,EAAE,OAAO,GAAG,SAAS,CAAC;CAC7C,CAAC;AAEF,QAAA,MAAM,uBAAuB,GAAI,KAAK,SAAS,SAAS,EAAE,+DAIvD,mBAAmB,CAAC,KAAK,CAAC,GAAG;IAAE,kBAAkB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,CAAA;CAAE,4CAiD3F,CAAC;AAuPF,eAAO,MAAM,cAAc,EAAoC,OAAO,uBAAuB,CAAC"}
|
|
@@ -1,159 +1,187 @@
|
|
|
1
|
-
import { jsx as e, Fragment as
|
|
2
|
-
import { Tr as
|
|
3
|
-
import { flexRender as
|
|
4
|
-
import { memo as
|
|
5
|
-
import { useTableContext as
|
|
6
|
-
import { TableHeaderDropdown as
|
|
7
|
-
import { translations as
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import { Divider as
|
|
11
|
-
import { Menu as
|
|
12
|
-
import { MenuButton as
|
|
13
|
-
import { Icons as
|
|
14
|
-
import { MenuList as
|
|
15
|
-
import { Checkbox as
|
|
16
|
-
import { MenuItem as
|
|
17
|
-
import { IconButton as
|
|
18
|
-
import { Button as
|
|
19
|
-
import { ThemeColorVariable as
|
|
20
|
-
const
|
|
21
|
-
headerGroup:
|
|
22
|
-
hideTableHeaderDropdown:
|
|
23
|
-
portalContainerRef:
|
|
1
|
+
import { jsx as e, Fragment as b, jsxs as C } from "react/jsx-runtime";
|
|
2
|
+
import { Tr as A, Th as B, useMediaQuery as z, Portal as D } from "@chakra-ui/react";
|
|
3
|
+
import { flexRender as V } from "../../node_modules/@tanstack/react-table/build/lib/index.js";
|
|
4
|
+
import { memo as H, useRef as L, useCallback as R, useLayoutEffect as P, useMemo as F } from "react";
|
|
5
|
+
import { useTableContext as f } from "./table-context.js";
|
|
6
|
+
import { TableHeaderDropdown as O } from "./table-header-dropdown.js";
|
|
7
|
+
import { translations as v } from "./translations.js";
|
|
8
|
+
import { Flex as I } from "../flex/flex.js";
|
|
9
|
+
import { Box as S } from "../box/box.js";
|
|
10
|
+
import { Divider as N } from "../divider/divider.js";
|
|
11
|
+
import { Menu as j } from "../menu/menu.js";
|
|
12
|
+
import { MenuButton as E } from "../menu/menu-button.js";
|
|
13
|
+
import { Icons as y } from "../icon/types.js";
|
|
14
|
+
import { MenuList as $ } from "../menu/menu-list.js";
|
|
15
|
+
import { Checkbox as W } from "../checkbox/checkbox.js";
|
|
16
|
+
import { MenuItem as Q } from "../menu/menu-item.js";
|
|
17
|
+
import { IconButton as X } from "../icon-button/icon-button.js";
|
|
18
|
+
import { Button as q } from "../button/button.js";
|
|
19
|
+
import { ThemeColorVariable as g, ThemeSpaceVariable as p, ThemeFontSizeVariable as G, ThemeFontVariable as J } from "../../theme/theme-types.js";
|
|
20
|
+
const K = ({
|
|
21
|
+
headerGroup: t,
|
|
22
|
+
hideTableHeaderDropdown: o,
|
|
23
|
+
portalContainerRef: s
|
|
24
24
|
}) => {
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
position: l ? "sticky" : "relative",
|
|
29
|
-
left: l ? `${t.getStart("left")}px` : void 0,
|
|
30
|
-
backgroundColor: l ? d.Background : void 0,
|
|
31
|
-
zIndex: l ? 1 : 0,
|
|
32
|
-
width: t.getSize(),
|
|
33
|
-
maxWidth: t.getSize()
|
|
34
|
-
};
|
|
35
|
-
}, []), c = (n.selectedRowIds?.length ?? 0) > 0 && (n.selectionActions?.length ?? 0) > 0;
|
|
36
|
-
return /* @__PURE__ */ e(u, { children: /* @__PURE__ */ e(B, { children: c ? /* @__PURE__ */ e(
|
|
37
|
-
b,
|
|
25
|
+
const i = f(), c = !!i.getRowActions, l = (i.selectedRowIds?.length ?? 0) > 0 && (i.selectionActions?.length ?? 0) > 0;
|
|
26
|
+
return /* @__PURE__ */ e(b, { children: /* @__PURE__ */ e(A, { children: l ? /* @__PURE__ */ e(
|
|
27
|
+
B,
|
|
38
28
|
{
|
|
39
|
-
colSpan:
|
|
29
|
+
colSpan: t.headers.length,
|
|
40
30
|
sx: {
|
|
41
31
|
cursor: "default",
|
|
42
32
|
"& div:hover": {
|
|
43
33
|
backgroundColor: "transparent !important"
|
|
44
34
|
},
|
|
45
35
|
"div span": {
|
|
46
|
-
color:
|
|
36
|
+
color: g.OnBackground
|
|
47
37
|
}
|
|
48
38
|
},
|
|
49
39
|
zIndex: 1,
|
|
50
40
|
style: {
|
|
51
|
-
borderBottom: `1px solid ${
|
|
52
|
-
paddingLeft:
|
|
41
|
+
borderBottom: `1px solid ${g.OnBackgroundBorder}`,
|
|
42
|
+
paddingLeft: c ? "24px" : void 0
|
|
53
43
|
},
|
|
54
|
-
children: /* @__PURE__ */ e(
|
|
44
|
+
children: /* @__PURE__ */ e(M, { showSelectAll: !0, children: /* @__PURE__ */ e(Z, {}) })
|
|
55
45
|
}
|
|
56
|
-
) : /* @__PURE__ */ e(
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
46
|
+
) : /* @__PURE__ */ e(b, { children: t.headers.map((n) => /* @__PURE__ */ e(
|
|
47
|
+
U,
|
|
48
|
+
{
|
|
49
|
+
header: n,
|
|
50
|
+
hideTableHeaderDropdown: o,
|
|
51
|
+
applyActionMenuPadding: c,
|
|
52
|
+
portalContainerRef: s,
|
|
53
|
+
isFirstColumn: n.column.getIndex() === 0
|
|
54
|
+
},
|
|
55
|
+
n.id
|
|
56
|
+
)) }) }, t.id) });
|
|
57
|
+
}, U = ({
|
|
58
|
+
header: t,
|
|
59
|
+
hideTableHeaderDropdown: o,
|
|
60
|
+
applyActionMenuPadding: s,
|
|
61
|
+
portalContainerRef: i,
|
|
62
|
+
isFirstColumn: c = !1
|
|
63
|
+
}) => {
|
|
64
|
+
const l = L(null), n = f(), { column: r } = t, m = R((d) => {
|
|
65
|
+
const a = d.getIsPinned(), u = d.getSize();
|
|
66
|
+
return {
|
|
67
|
+
position: a ? "sticky" : "relative",
|
|
68
|
+
left: a ? `${d.getStart("left")}px` : void 0,
|
|
69
|
+
backgroundColor: a ? g.Background : void 0,
|
|
70
|
+
zIndex: a ? 1 : 0,
|
|
71
|
+
width: u,
|
|
72
|
+
maxWidth: u
|
|
73
|
+
};
|
|
74
|
+
}, []);
|
|
75
|
+
return P(() => {
|
|
76
|
+
const d = l.current;
|
|
77
|
+
if (!d) return;
|
|
78
|
+
const a = r.id, u = (h) => {
|
|
79
|
+
h > 0 && n.table.getState().columnSizing[a] !== h && n.table.setColumnSizing((w) => ({ ...w, [a]: h }));
|
|
80
|
+
}, k = new ResizeObserver((h) => {
|
|
81
|
+
const w = h[0];
|
|
82
|
+
if (!w) return;
|
|
83
|
+
const T = w.borderBoxSize?.[0]?.inlineSize ?? d.getBoundingClientRect().width;
|
|
84
|
+
u(T);
|
|
85
|
+
});
|
|
86
|
+
return k.observe(d), u(d.getBoundingClientRect().width), () => k.disconnect();
|
|
87
|
+
}, []), /* @__PURE__ */ e(
|
|
88
|
+
B,
|
|
89
|
+
{
|
|
90
|
+
ref: l,
|
|
91
|
+
className: "tableHeaderCell",
|
|
92
|
+
isNumeric: r.columnDef.meta?.isNumeric,
|
|
93
|
+
zIndex: r.getIsPinned() ? 2 : 1,
|
|
94
|
+
style: {
|
|
95
|
+
...m(r),
|
|
96
|
+
borderBottom: `1px solid ${g.OnBackgroundBorder}`,
|
|
97
|
+
paddingLeft: c && s ? "24px" : void 0
|
|
84
98
|
},
|
|
85
|
-
t.
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
99
|
+
children: /* @__PURE__ */ e(M, { showSelectAll: n.canSelectRows && c, children: /* @__PURE__ */ e(b, { children: o ? /* @__PURE__ */ e(S, { paddingLeft: p.Small, children: V(t.column.columnDef.header, t.getContext()) }) : /* @__PURE__ */ e(
|
|
100
|
+
O,
|
|
101
|
+
{
|
|
102
|
+
header: t,
|
|
103
|
+
breakingContentState: n.breakingContentState,
|
|
104
|
+
columnVisibility: n.columnVisibility,
|
|
105
|
+
headerGroup: n.table.getHeaderGroups(),
|
|
106
|
+
localeString: n.localeString,
|
|
107
|
+
setBreakingContentState: n.setBreakingContentState,
|
|
108
|
+
setSorting: n.setSorting,
|
|
109
|
+
sorting: n.sorting,
|
|
110
|
+
onBreakingContentChange: n.onBreakingContentChange,
|
|
111
|
+
portalContainerRef: i
|
|
112
|
+
}
|
|
113
|
+
) }) })
|
|
114
|
+
}
|
|
115
|
+
);
|
|
116
|
+
}, M = ({ showSelectAll: t, children: o }) => t ? /* @__PURE__ */ C(I, { w: "100%", align: "center", children: [
|
|
117
|
+
/* @__PURE__ */ e(S, { justifyContent: "center", alignItems: "center", children: /* @__PURE__ */ e(Y, {}) }),
|
|
118
|
+
o
|
|
119
|
+
] }) : /* @__PURE__ */ e(b, { children: o }), Y = () => {
|
|
120
|
+
const t = f(), o = R(
|
|
121
|
+
(c) => {
|
|
122
|
+
const l = c.target.checked, n = t.getSelectableRowIds();
|
|
123
|
+
l ? t.setSelectedRowIds((r) => [.../* @__PURE__ */ new Set([...r, ...n])]) : t.setSelectedRowIds((r) => r.filter((m) => !n.includes(m)));
|
|
96
124
|
},
|
|
97
|
-
[
|
|
98
|
-
), { allIsSelected:
|
|
99
|
-
const
|
|
125
|
+
[t]
|
|
126
|
+
), { allIsSelected: s, shouldShowIndeterminateState: i } = F(() => {
|
|
127
|
+
const l = t.table.getRowModel().flatRows, n = new Set(t.selectedRowIds), r = t.getSelectableRowIds(), m = r.length > 0 && r.every((a) => n.has(a)), d = l.some((a) => n.has(a.id));
|
|
100
128
|
return {
|
|
101
|
-
allIsSelected:
|
|
102
|
-
shouldShowIndeterminateState:
|
|
129
|
+
allIsSelected: m,
|
|
130
|
+
shouldShowIndeterminateState: d && !m
|
|
103
131
|
};
|
|
104
|
-
}, [
|
|
132
|
+
}, [t]);
|
|
105
133
|
return /* @__PURE__ */ e(
|
|
106
|
-
|
|
134
|
+
W,
|
|
107
135
|
{
|
|
108
|
-
isChecked:
|
|
109
|
-
isIndeterminate:
|
|
110
|
-
onChange:
|
|
136
|
+
isChecked: s,
|
|
137
|
+
isIndeterminate: i,
|
|
138
|
+
onChange: o
|
|
111
139
|
}
|
|
112
140
|
);
|
|
113
|
-
},
|
|
114
|
-
const { localeString:
|
|
115
|
-
return /* @__PURE__ */
|
|
116
|
-
|
|
141
|
+
}, Z = () => {
|
|
142
|
+
const { localeString: t, selectedRowIds: o = [], selectionActions: s = [] } = f(), i = v[t], [c] = z("(min-width: 48em)"), l = s.length > 3 || !c, n = o.length === 1 ? i.selectedSingular.replace("{count}", "1") : i.selected.replace("{count}", o.length.toString());
|
|
143
|
+
return /* @__PURE__ */ C(
|
|
144
|
+
I,
|
|
117
145
|
{
|
|
118
|
-
gap:
|
|
146
|
+
gap: p.Medium,
|
|
119
147
|
align: "center",
|
|
120
148
|
alignContent: "center",
|
|
121
|
-
marginBottom:
|
|
149
|
+
marginBottom: p.XSmall,
|
|
122
150
|
children: [
|
|
123
151
|
/* @__PURE__ */ e(
|
|
124
|
-
|
|
152
|
+
S,
|
|
125
153
|
{
|
|
126
|
-
pl:
|
|
127
|
-
color:
|
|
128
|
-
fontFamily:
|
|
129
|
-
fontSize:
|
|
154
|
+
pl: p.Small,
|
|
155
|
+
color: g.OnBackground,
|
|
156
|
+
fontFamily: J.Body,
|
|
157
|
+
fontSize: G.Medium,
|
|
130
158
|
whiteSpace: "nowrap",
|
|
131
159
|
style: { fontVariantNumeric: "normal" },
|
|
132
|
-
children:
|
|
160
|
+
children: n
|
|
133
161
|
}
|
|
134
162
|
),
|
|
135
|
-
/* @__PURE__ */ e(
|
|
136
|
-
/* @__PURE__ */ e(
|
|
137
|
-
/* @__PURE__ */ e(
|
|
138
|
-
/* @__PURE__ */ e(
|
|
139
|
-
] }) :
|
|
163
|
+
/* @__PURE__ */ e(S, { children: /* @__PURE__ */ e(N, { orientation: "vertical", height: "20px" }) }),
|
|
164
|
+
/* @__PURE__ */ e(I, { gap: p.Small, align: "center", children: l ? /* @__PURE__ */ C(j, { children: [
|
|
165
|
+
/* @__PURE__ */ e(E, { variant: "ghost", rightIcon: y.TreeViewCollapse, children: i.action }),
|
|
166
|
+
/* @__PURE__ */ e(D, { children: /* @__PURE__ */ e($, { children: s.map((r) => /* @__PURE__ */ e(x, { isMenuItem: !0, action: r }, r.name)) }) })
|
|
167
|
+
] }) : s.map((r) => /* @__PURE__ */ e(x, { isMenuItem: !1, action: r }, r.name)) })
|
|
140
168
|
]
|
|
141
169
|
}
|
|
142
170
|
);
|
|
143
|
-
},
|
|
144
|
-
const { selectedRowIds:
|
|
145
|
-
|
|
146
|
-
}, [
|
|
147
|
-
return
|
|
148
|
-
|
|
171
|
+
}, x = ({ isMenuItem: t, action: o }) => {
|
|
172
|
+
const { selectedRowIds: s, localeString: i } = f(), c = v[i], l = R(() => {
|
|
173
|
+
o.onClick(s || []);
|
|
174
|
+
}, [o, s]);
|
|
175
|
+
return t ? /* @__PURE__ */ e(Q, { onClick: l, children: o.variant === "delete" ? /* @__PURE__ */ e(S, { as: "span", color: g.Error, children: o.name }) : o.name }) : o.variant === "delete" ? /* @__PURE__ */ e(
|
|
176
|
+
X,
|
|
149
177
|
{
|
|
150
|
-
onClick:
|
|
151
|
-
icon:
|
|
152
|
-
"aria-label":
|
|
178
|
+
onClick: l,
|
|
179
|
+
icon: y.Delete,
|
|
180
|
+
"aria-label": c.deleteSelectedRows,
|
|
153
181
|
variant: "ghost"
|
|
154
182
|
}
|
|
155
|
-
) : /* @__PURE__ */ e(
|
|
156
|
-
},
|
|
183
|
+
) : /* @__PURE__ */ e(q, { onClick: l, variant: "ghost", children: o.name });
|
|
184
|
+
}, we = H(K);
|
|
157
185
|
export {
|
|
158
|
-
|
|
186
|
+
we as TableHeaderRow
|
|
159
187
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"table-row.d.ts","sourceRoot":"","sources":["../../../lib/components/table/table-row.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"table-row.d.ts","sourceRoot":"","sources":["../../../lib/components/table/table-row.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAIvD,OAAO,KAAK,EAAE,SAAS,EAAE,QAAQ,IAAI,YAAY,EAAE,MAAM,SAAS,CAAC;AAEnE,KAAK,aAAa,CAAC,KAAK,SAAS,SAAS,IAAI;IAC7C,GAAG,EAAE,GAAG,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC;IAC9B,YAAY,EAAE,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC,EAAE,CAAC;IACnD,UAAU,CAAC,EAAE,CACZ,GAAG,EAAE,YAAY,CAAC,KAAK,CAAC,EACxB,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC,mBAAmB,CAAC,GAAG,KAAK,CAAC,aAAa,CAAC,mBAAmB,CAAC,KACnF,IAAI,CAAC;IACV,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAC/B,CAAC;AAEF,QAAA,MAAM,aAAa,GAAI,KAAK,SAAS,SAAS,EAAE,6EAM7C,aAAa,CAAC,KAAK,CAAC,4CA0EtB,CAAC;AAEF,eAAO,MAAM,QAAQ,EAA0B,OAAO,aAAa,CAAC"}
|
|
@@ -1,60 +1,59 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { Tr as
|
|
3
|
-
import { memo as
|
|
4
|
-
import { TableCell as
|
|
5
|
-
import { useTableContext as
|
|
6
|
-
import { ThemeColorVariable as r } from "../../theme/theme-types.js";
|
|
1
|
+
import { jsx as s } from "react/jsx-runtime";
|
|
2
|
+
import { Tr as p } from "@chakra-ui/react";
|
|
3
|
+
import { memo as h, useCallback as d, useMemo as f } from "react";
|
|
4
|
+
import { TableCell as x } from "./table-cell.js";
|
|
5
|
+
import { useTableContext as S } from "./table-context.js";
|
|
7
6
|
const I = ({
|
|
8
|
-
row:
|
|
9
|
-
visibleCells:
|
|
7
|
+
row: e,
|
|
8
|
+
visibleCells: o,
|
|
10
9
|
onClickRow: n,
|
|
11
|
-
showRowHoverStyle:
|
|
12
|
-
onRowClickIndication:
|
|
10
|
+
showRowHoverStyle: l,
|
|
11
|
+
onRowClickIndication: i
|
|
13
12
|
}) => {
|
|
14
|
-
const
|
|
15
|
-
(
|
|
16
|
-
n && (
|
|
13
|
+
const a = S(), c = d(
|
|
14
|
+
(t) => {
|
|
15
|
+
n && (t.key === "Enter" || t.key === " ") && (t.preventDefault(), n(e.original, t));
|
|
17
16
|
},
|
|
18
|
-
[n,
|
|
19
|
-
),
|
|
20
|
-
(
|
|
21
|
-
|
|
17
|
+
[n, e.original]
|
|
18
|
+
), g = d(
|
|
19
|
+
(t) => {
|
|
20
|
+
t.stopPropagation(), e.getToggleSelectedHandler(), n && n(e.original, t), i && a.setRowHighlight({ [t.currentTarget.id]: !0 });
|
|
22
21
|
},
|
|
23
|
-
[
|
|
24
|
-
),
|
|
25
|
-
return /* @__PURE__ */
|
|
26
|
-
|
|
22
|
+
[e, n, i, a]
|
|
23
|
+
), u = f(() => e.getIsSelected() || a.selectedRowIds?.includes(e.id), [e, a.rowHighlight, a.selectedRowIds]), m = a.getRowActions?.(e.original), b = (t) => a.disableSelectionCheckbox?.(t) ?? !1;
|
|
24
|
+
return /* @__PURE__ */ s(
|
|
25
|
+
p,
|
|
27
26
|
{
|
|
28
|
-
id:
|
|
27
|
+
id: e.id,
|
|
29
28
|
tabIndex: n ? 0 : void 0,
|
|
30
|
-
onClick:
|
|
31
|
-
onKeyDown:
|
|
32
|
-
borderTop: t.depth > 0 ? "none" : `1px solid ${r.OnBackgroundBorder}`,
|
|
29
|
+
onClick: g,
|
|
30
|
+
onKeyDown: c,
|
|
33
31
|
cursor: n ? "pointer" : void 0,
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
32
|
+
"data-row-selected": u,
|
|
33
|
+
"data-allow-hovered": l,
|
|
34
|
+
"data-is-root-level": e.depth === 0,
|
|
35
|
+
children: o.map((t) => {
|
|
36
|
+
const r = t.column.getIndex() === 0;
|
|
37
|
+
return /* @__PURE__ */ s(
|
|
38
|
+
x,
|
|
40
39
|
{
|
|
41
|
-
cell:
|
|
42
|
-
visibleCells:
|
|
43
|
-
row:
|
|
44
|
-
rowIsExpanded:
|
|
45
|
-
breakingContentState:
|
|
46
|
-
localeString:
|
|
47
|
-
actionMenu:
|
|
48
|
-
canSelectRows:
|
|
49
|
-
isCheckboxDisabled:
|
|
40
|
+
cell: t,
|
|
41
|
+
visibleCells: o,
|
|
42
|
+
row: e,
|
|
43
|
+
rowIsExpanded: e.getIsExpanded(),
|
|
44
|
+
breakingContentState: a.breakingContentState,
|
|
45
|
+
localeString: a.localeString,
|
|
46
|
+
actionMenu: r ? m : void 0,
|
|
47
|
+
canSelectRows: a.canSelectRows && r,
|
|
48
|
+
isCheckboxDisabled: b(e)
|
|
50
49
|
},
|
|
51
|
-
|
|
50
|
+
t.id
|
|
52
51
|
);
|
|
53
52
|
})
|
|
54
53
|
},
|
|
55
|
-
|
|
54
|
+
e.id
|
|
56
55
|
);
|
|
57
|
-
}, M =
|
|
56
|
+
}, M = h(I);
|
|
58
57
|
export {
|
|
59
58
|
M as TableRow
|
|
60
59
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../lib/test-utils/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,8BAA8B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setup-mock-resize-observer.d.ts","sourceRoot":"","sources":["../../../lib/test-utils/hooks/setup-mock-resize-observer.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,uBAAuB,YAYnC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"table-theme.d.ts","sourceRoot":"","sources":["../../../../lib/theme/theme-config/components/table-theme.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,yBAAyB,EAA8C,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"table-theme.d.ts","sourceRoot":"","sources":["../../../../lib/theme/theme-config/components/table-theme.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,yBAAyB,EAA8C,MAAM,kBAAkB,CAAC;AA0G9G,eAAO,MAAM,WAAW,EAAE,yBAExB,CAAC"}
|
|
@@ -1,15 +1,22 @@
|
|
|
1
1
|
import { createMultiStyleConfigHelpers as a, defineStyle as e } from "@chakra-ui/react";
|
|
2
|
-
import { ThemeColorVariable as o, ThemeSpaceVariable as
|
|
3
|
-
import { ThemeFontSizeToken as
|
|
4
|
-
import { tableAnatomy as
|
|
5
|
-
const { definePartsStyle:
|
|
2
|
+
import { ThemeColorVariable as o, ThemeSpaceVariable as t, ThemeFontVariable as n } from "../../theme-types.js";
|
|
3
|
+
import { ThemeFontSizeToken as r } from "../theme-tokens.js";
|
|
4
|
+
import { tableAnatomy as d } from "../../../packages/casper-ui-library/node_modules/@chakra-ui/anatomy/dist/esm/components.js";
|
|
5
|
+
const { definePartsStyle: l, defineMultiStyleConfig: i } = a(d.keys), c = e({
|
|
6
6
|
position: "relative",
|
|
7
7
|
fontFamily: n.Body,
|
|
8
|
-
fontSize:
|
|
8
|
+
fontSize: r.Small,
|
|
9
|
+
thead: {
|
|
10
|
+
'&[data-sticky-headers="true"]': {
|
|
11
|
+
position: "sticky",
|
|
12
|
+
top: 0,
|
|
13
|
+
zIndex: 5
|
|
14
|
+
}
|
|
15
|
+
},
|
|
9
16
|
th: {
|
|
10
17
|
padding: "0px",
|
|
11
18
|
position: "relative",
|
|
12
|
-
fontSize:
|
|
19
|
+
fontSize: r.Small,
|
|
13
20
|
height: "40px",
|
|
14
21
|
color: o.OnBackgroundSubdued,
|
|
15
22
|
fontWeight: 400,
|
|
@@ -22,10 +29,10 @@ const { definePartsStyle: d, defineMultiStyleConfig: i } = a(l.keys), p = e({
|
|
|
22
29
|
},
|
|
23
30
|
td: {
|
|
24
31
|
color: o.OnBackground,
|
|
25
|
-
padding: `0px 0px 0px ${
|
|
32
|
+
padding: `0px 0px 0px ${t.Small}`,
|
|
26
33
|
borderRight: `1px solid ${o.OnBackgroundBorder}`,
|
|
27
34
|
height: "40px",
|
|
28
|
-
gap:
|
|
35
|
+
gap: t.XSmall,
|
|
29
36
|
_last: {
|
|
30
37
|
borderRight: "none"
|
|
31
38
|
},
|
|
@@ -37,7 +44,7 @@ const { definePartsStyle: d, defineMultiStyleConfig: i } = a(l.keys), p = e({
|
|
|
37
44
|
tr: {
|
|
38
45
|
borderColor: o.OnBackgroundBorder
|
|
39
46
|
}
|
|
40
|
-
}),
|
|
47
|
+
}), p = e({
|
|
41
48
|
cursor: "pointer",
|
|
42
49
|
backgroundColor: o.Surface,
|
|
43
50
|
div: {
|
|
@@ -48,29 +55,42 @@ const { definePartsStyle: d, defineMultiStyleConfig: i } = a(l.keys), p = e({
|
|
|
48
55
|
}
|
|
49
56
|
}), s = e({
|
|
50
57
|
color: o.OnBackground
|
|
51
|
-
}),
|
|
52
|
-
borderTop: "
|
|
58
|
+
}), b = e({
|
|
59
|
+
borderTop: "none",
|
|
53
60
|
_first: {
|
|
54
61
|
borderTop: "none"
|
|
55
62
|
},
|
|
56
63
|
_last: {
|
|
57
64
|
borderBottom: "1px solid",
|
|
58
65
|
borderColor: o.OnBackgroundBorder
|
|
66
|
+
},
|
|
67
|
+
'&[data-row-selected="true"]': {
|
|
68
|
+
backgroundColor: o.AccentHoverAlpha
|
|
69
|
+
},
|
|
70
|
+
_hover: {
|
|
71
|
+
// Show action menu button on row hover
|
|
72
|
+
".action-menu-button": { opacity: 1 },
|
|
73
|
+
'&[data-allow-hovered="true"]': {
|
|
74
|
+
backgroundColor: o.AccentHoverAlpha
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
'&[data-is-root-level="true"]:not(:first-of-type)': {
|
|
78
|
+
borderTop: `1px solid ${o.OnBackgroundBorder}`
|
|
59
79
|
}
|
|
60
|
-
}),
|
|
80
|
+
}), u = e({
|
|
61
81
|
tr: {
|
|
62
82
|
zIndex: 10,
|
|
63
83
|
backgroundColor: o.OnBackgroundSubdued
|
|
64
84
|
}
|
|
65
|
-
}),
|
|
66
|
-
table:
|
|
85
|
+
}), g = l({
|
|
86
|
+
table: c,
|
|
67
87
|
tfoot: s,
|
|
68
|
-
th:
|
|
69
|
-
tr:
|
|
70
|
-
thead:
|
|
71
|
-
}),
|
|
72
|
-
baseStyle:
|
|
88
|
+
th: p,
|
|
89
|
+
tr: b,
|
|
90
|
+
thead: u
|
|
91
|
+
}), k = i({
|
|
92
|
+
baseStyle: g
|
|
73
93
|
});
|
|
74
94
|
export {
|
|
75
|
-
|
|
95
|
+
k as tableConfig
|
|
76
96
|
};
|