@cfx-dev/ui-components 2.1.11 → 2.1.12
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/assets/Table.css +1 -1
- package/dist/components/Table/Table.js +37 -37
- package/package.json +1 -1
package/dist/assets/Table.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.
|
|
1
|
+
._root_1v0yo_1 table{width:100%;border-collapse:collapse;border-radius:var(--border-radius-small);overflow:hidden}._root_1v0yo_1 th,._root_1v0yo_1 td{text-align:left;padding:calc(var(--quant) * 1.5) calc(var(--quant) * .75);color:#fff;height:calc(var(--quant) * 8.75);box-sizing:border-box}._root_1v0yo_1 ._radio_1v0yo_14{text-align:center;padding:calc(var(--quant) * .25)}._root_1v0yo_1 ._radio_1v0yo_14 button{display:inline-flex}._root_1v0yo_1 ._pointer_1v0yo_21{cursor:pointer}._root_1v0yo_1 ._selectedRow_1v0yo_24{background-color:rgba(var(--color-secondary),.4);box-shadow:0 -1px rgba(var(--color-primary),1) inset}._root_1v0yo_1 th{position:sticky;top:0;z-index:0;background-color:rgba(var(--color-bg-light),1)}._root_1v0yo_1 th ._headerContent_1v0yo_34{display:flex;align-items:center;flex-direction:row;justify-content:space-between}._root_1v0yo_1 th ._headerContent_1v0yo_34._sortable_1v0yo_40._empty_1v0yo_40{justify-content:flex-end}._root_1v0yo_1 th ._sortButton_1v0yo_43{opacity:.5;padding:calc(var(--quant) * 2)}._root_1v0yo_1 th:hover ._sortButton_1v0yo_43{opacity:1}._root_1v0yo_1 tr{box-shadow:0 -1px rgba(var(--color-bg-light),1) inset;box-sizing:border-box}._root_1v0yo_1 tr:hover{background-color:rgba(var(--color-secondary),.2)}._root_1v0yo_1 tr:hover:not(._selectedRow_1v0yo_24){box-shadow:none}._root_1v0yo_1 tr:last-child{border-bottom-left-radius:var(--border-radius-small);border-bottom-right-radius:var(--border-radius-small)}
|
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import { jsx as t, jsxs as
|
|
2
|
-
import l, { useState as
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import { Text as
|
|
6
|
-
import { clsx as
|
|
7
|
-
import '../../assets/Table.css';const
|
|
8
|
-
root:
|
|
9
|
-
radio:
|
|
10
|
-
pointer:
|
|
11
|
-
selectedRow:
|
|
12
|
-
headerContent:
|
|
13
|
-
sortable:
|
|
14
|
-
empty:
|
|
15
|
-
sortButton:
|
|
1
|
+
import { jsx as t, jsxs as y } from "react/jsx-runtime";
|
|
2
|
+
import l, { useState as C } from "react";
|
|
3
|
+
import B from "../Checkbox/Checkbox.js";
|
|
4
|
+
import $ from "../IconButton/IconButton.js";
|
|
5
|
+
import { Text as T } from "../Text/Text.js";
|
|
6
|
+
import { clsx as x } from "../../utils/clsx.js";
|
|
7
|
+
import '../../assets/Table.css';const j = "_root_1v0yo_1", z = "_radio_1v0yo_14", A = "_pointer_1v0yo_21", E = "_selectedRow_1v0yo_24", O = "_headerContent_1v0yo_34", S = "_sortable_1v0yo_40", F = "_empty_1v0yo_40", H = "_sortButton_1v0yo_43", r = {
|
|
8
|
+
root: j,
|
|
9
|
+
radio: z,
|
|
10
|
+
pointer: A,
|
|
11
|
+
selectedRow: E,
|
|
12
|
+
headerContent: O,
|
|
13
|
+
sortable: S,
|
|
14
|
+
empty: F,
|
|
15
|
+
sortButton: H
|
|
16
16
|
};
|
|
17
|
-
function
|
|
17
|
+
function V(h) {
|
|
18
18
|
const {
|
|
19
19
|
item: e,
|
|
20
20
|
onSortClick: o
|
|
21
21
|
} = h, s = l.useCallback(() => {
|
|
22
22
|
o && o(e.sortKey || e.text);
|
|
23
|
-
}, [e.sortKey, e.text, o]), b =
|
|
23
|
+
}, [e.sortKey, e.text, o]), b = x(r.headerContent, {
|
|
24
24
|
[r.sortable]: e.sortable,
|
|
25
25
|
[r.empty]: !e.text
|
|
26
26
|
});
|
|
@@ -29,10 +29,10 @@ function F(h) {
|
|
|
29
29
|
{
|
|
30
30
|
className: e.sortable ? r.pointer : void 0,
|
|
31
31
|
onClick: e.sortable ? s : void 0,
|
|
32
|
-
children: /* @__PURE__ */
|
|
33
|
-
/* @__PURE__ */ t(
|
|
32
|
+
children: /* @__PURE__ */ y("div", { className: b, children: [
|
|
33
|
+
/* @__PURE__ */ t(T, { color: "secondary", weight: "bold", uppercase: !0, size: "xxsmall", children: e.text }),
|
|
34
34
|
!!e.sortable && /* @__PURE__ */ t(
|
|
35
|
-
|
|
35
|
+
$,
|
|
36
36
|
{
|
|
37
37
|
className: r.sortButton,
|
|
38
38
|
color: "secondary",
|
|
@@ -44,7 +44,7 @@ function F(h) {
|
|
|
44
44
|
}
|
|
45
45
|
);
|
|
46
46
|
}
|
|
47
|
-
function
|
|
47
|
+
function q(h) {
|
|
48
48
|
const {
|
|
49
49
|
index: e,
|
|
50
50
|
includeRadio: o = !1,
|
|
@@ -58,18 +58,18 @@ function H(h) {
|
|
|
58
58
|
);
|
|
59
59
|
}, [a, e]), _ = l.useCallback(() => {
|
|
60
60
|
a(e);
|
|
61
|
-
}, [a, e]), p =
|
|
61
|
+
}, [a, e]), p = x({
|
|
62
62
|
[r.selectedRow]: s === e,
|
|
63
63
|
[r.pointer]: o
|
|
64
64
|
});
|
|
65
|
-
return /* @__PURE__ */
|
|
65
|
+
return /* @__PURE__ */ y(
|
|
66
66
|
"tr",
|
|
67
67
|
{
|
|
68
68
|
className: p,
|
|
69
69
|
onClick: o ? _ : void 0,
|
|
70
70
|
children: [
|
|
71
71
|
o && /* @__PURE__ */ t("td", { className: r.radio, children: /* @__PURE__ */ t(
|
|
72
|
-
|
|
72
|
+
B,
|
|
73
73
|
{
|
|
74
74
|
size: "small",
|
|
75
75
|
onCheckedChange: f,
|
|
@@ -86,7 +86,7 @@ function H(h) {
|
|
|
86
86
|
`row-${e}`
|
|
87
87
|
);
|
|
88
88
|
}
|
|
89
|
-
function
|
|
89
|
+
function M({
|
|
90
90
|
headers: h = [],
|
|
91
91
|
data: e = [],
|
|
92
92
|
includeRadio: o = !1,
|
|
@@ -97,10 +97,10 @@ function L({
|
|
|
97
97
|
sortOrder: f = "asc",
|
|
98
98
|
onSortChange: _
|
|
99
99
|
}) {
|
|
100
|
-
const [p, n] =
|
|
101
|
-
const
|
|
102
|
-
d(c),
|
|
103
|
-
}, [_, u,
|
|
100
|
+
const [p, n] = C(m), [u, d] = C(a), [k, v] = C(f), R = l.useCallback((c) => {
|
|
101
|
+
const w = u === c && k === "asc" ? "desc" : "asc";
|
|
102
|
+
d(c), v(w), _ == null || _(c, w);
|
|
103
|
+
}, [_, u, k]), N = l.useCallback(
|
|
104
104
|
(c) => {
|
|
105
105
|
const i = c === p ? null : c;
|
|
106
106
|
n(i), s == null || s(i);
|
|
@@ -112,21 +112,21 @@ function L({
|
|
|
112
112
|
}, [m]), l.useEffect(() => {
|
|
113
113
|
d(a);
|
|
114
114
|
}, [a]), l.useEffect(() => {
|
|
115
|
-
|
|
116
|
-
}, [f]), /* @__PURE__ */ t("div", { className: r.root, children: /* @__PURE__ */
|
|
117
|
-
/* @__PURE__ */ t("thead", { children: /* @__PURE__ */
|
|
115
|
+
v(f);
|
|
116
|
+
}, [f]), /* @__PURE__ */ t("div", { className: r.root, children: /* @__PURE__ */ y("table", { children: [
|
|
117
|
+
/* @__PURE__ */ t("thead", { children: /* @__PURE__ */ y("tr", { children: [
|
|
118
118
|
o && /* @__PURE__ */ t("th", { "aria-label": "Select Row" }),
|
|
119
119
|
h.map((c, i) => /* @__PURE__ */ t(
|
|
120
|
-
|
|
120
|
+
V,
|
|
121
121
|
{
|
|
122
122
|
item: c,
|
|
123
|
-
onSortClick:
|
|
123
|
+
onSortClick: R
|
|
124
124
|
},
|
|
125
125
|
`header-${i}`
|
|
126
126
|
))
|
|
127
127
|
] }) }),
|
|
128
128
|
/* @__PURE__ */ t("tbody", { children: e.map((c, i) => /* @__PURE__ */ t(
|
|
129
|
-
|
|
129
|
+
q,
|
|
130
130
|
{
|
|
131
131
|
index: i,
|
|
132
132
|
item: c,
|
|
@@ -140,6 +140,6 @@ function L({
|
|
|
140
140
|
] }) });
|
|
141
141
|
}
|
|
142
142
|
export {
|
|
143
|
-
|
|
144
|
-
|
|
143
|
+
M as Table,
|
|
144
|
+
V as TableHeaderItem
|
|
145
145
|
};
|