@cfx-dev/ui-components 2.1.0 → 2.1.1
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 +42 -42
- package/package.json +1 -1
package/dist/assets/Table.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.
|
|
1
|
+
._root_13qg4_1 table{width:100%;border-collapse:collapse;border-radius:var(--border-radius-small);overflow:hidden}._root_13qg4_1 th,._root_13qg4_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_13qg4_1 ._radio_13qg4_14{text-align:center;min-width:calc(var(--quant) * 8.75)}._root_13qg4_1 ._radio_13qg4_14 button{display:inline-flex}._root_13qg4_1 ._pointer_13qg4_21{cursor:pointer}._root_13qg4_1 ._selectedRow_13qg4_24{background-color:rgba(var(--color-secondary),.4);box-shadow:0 -1px rgba(var(--color-primary),1) inset}._root_13qg4_1 th{position:sticky;top:0;z-index:0;background-color:rgba(var(--color-bg-light),1)}._root_13qg4_1 th ._headerContent_13qg4_34{display:flex;align-items:center;flex-direction:row;justify-content:space-between}._root_13qg4_1 th ._headerContent_13qg4_34._sortable_13qg4_40._empty_13qg4_40{justify-content:flex-end}._root_13qg4_1 th ._sortButton_13qg4_43{opacity:.5;padding:calc(var(--quant) * 2)}._root_13qg4_1 th:hover ._sortButton_13qg4_43{opacity:1}._root_13qg4_1 tr{box-shadow:0 -1px rgba(var(--color-bg-light),1) inset;box-sizing:border-box}._root_13qg4_1 tr:hover{background-color:rgba(var(--color-secondary),.2)}._root_13qg4_1 tr:hover:not(._selectedRow_13qg4_24){box-shadow:none}._root_13qg4_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
|
|
1
|
+
import { jsx as t, jsxs as C } from "react/jsx-runtime";
|
|
2
|
+
import l, { useState as k } from "react";
|
|
3
|
+
import g from "../Checkbox/Checkbox.js";
|
|
4
4
|
import B from "../IconButton/IconButton.js";
|
|
5
5
|
import { Text as v } from "../Text/Text.js";
|
|
6
|
-
import { clsx as
|
|
7
|
-
import '../../assets/Table.css';const $ = "
|
|
6
|
+
import { clsx as y } from "../../utils/clsx.js";
|
|
7
|
+
import '../../assets/Table.css';const $ = "_root_13qg4_1", T = "_radio_13qg4_14", j = "_pointer_13qg4_21", z = "_selectedRow_13qg4_24", A = "_headerContent_13qg4_34", E = "_sortable_13qg4_40", O = "_empty_13qg4_40", S = "_sortButton_13qg4_43", r = {
|
|
8
8
|
root: $,
|
|
9
9
|
radio: T,
|
|
10
|
-
pointer:
|
|
11
|
-
selectedRow:
|
|
12
|
-
headerContent:
|
|
13
|
-
sortable:
|
|
14
|
-
empty:
|
|
15
|
-
sortButton:
|
|
10
|
+
pointer: j,
|
|
11
|
+
selectedRow: z,
|
|
12
|
+
headerContent: A,
|
|
13
|
+
sortable: E,
|
|
14
|
+
empty: O,
|
|
15
|
+
sortButton: S
|
|
16
16
|
};
|
|
17
|
-
function
|
|
17
|
+
function F(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 = y(r.headerContent, {
|
|
24
24
|
[r.sortable]: e.sortable,
|
|
25
25
|
[r.empty]: !e.text
|
|
26
26
|
});
|
|
@@ -29,7 +29,7 @@ function V(h) {
|
|
|
29
29
|
{
|
|
30
30
|
className: e.sortable ? r.pointer : void 0,
|
|
31
31
|
onClick: e.sortable ? s : void 0,
|
|
32
|
-
children: /* @__PURE__ */
|
|
32
|
+
children: /* @__PURE__ */ C("div", { className: b, children: [
|
|
33
33
|
/* @__PURE__ */ t(v, { color: "secondary", weight: "bold", uppercase: !0, size: "xxsmall", children: e.text }),
|
|
34
34
|
!!e.sortable && /* @__PURE__ */ t(
|
|
35
35
|
B,
|
|
@@ -44,7 +44,7 @@ function V(h) {
|
|
|
44
44
|
}
|
|
45
45
|
);
|
|
46
46
|
}
|
|
47
|
-
function
|
|
47
|
+
function H(h) {
|
|
48
48
|
const {
|
|
49
49
|
index: e,
|
|
50
50
|
includeRadio: o = !1,
|
|
@@ -58,18 +58,18 @@ function q(h) {
|
|
|
58
58
|
);
|
|
59
59
|
}, [a, e]), _ = l.useCallback(() => {
|
|
60
60
|
a(e);
|
|
61
|
-
}, [a, e]), p =
|
|
61
|
+
}, [a, e]), p = y({
|
|
62
62
|
[r.selectedRow]: s === e,
|
|
63
63
|
[r.pointer]: o
|
|
64
64
|
});
|
|
65
|
-
return /* @__PURE__ */
|
|
65
|
+
return /* @__PURE__ */ C(
|
|
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
|
+
g,
|
|
73
73
|
{
|
|
74
74
|
size: "small",
|
|
75
75
|
onCheckedChange: f,
|
|
@@ -78,15 +78,15 @@ function q(h) {
|
|
|
78
78
|
}
|
|
79
79
|
) }),
|
|
80
80
|
b.map((n, u) => {
|
|
81
|
-
let
|
|
82
|
-
return l.isValidElement(n) ?
|
|
81
|
+
let d;
|
|
82
|
+
return l.isValidElement(n) ? d = n : m ? d = l.createElement(m, { item: n }) : d = String(n), /* @__PURE__ */ t("td", { children: d }, `item-${u}`);
|
|
83
83
|
})
|
|
84
84
|
]
|
|
85
85
|
},
|
|
86
86
|
`row-${e}`
|
|
87
87
|
);
|
|
88
88
|
}
|
|
89
|
-
function
|
|
89
|
+
function L({
|
|
90
90
|
headers: h = [],
|
|
91
91
|
data: e = [],
|
|
92
92
|
includeRadio: o = !1,
|
|
@@ -97,49 +97,49 @@ function M({
|
|
|
97
97
|
sortOrder: f = "asc",
|
|
98
98
|
onSortChange: _
|
|
99
99
|
}) {
|
|
100
|
-
const [p, n] =
|
|
101
|
-
const
|
|
102
|
-
|
|
103
|
-
}, [_, u,
|
|
100
|
+
const [p, n] = k(m), [u, d] = k(a), [w, x] = k(f), q = l.useCallback((c) => {
|
|
101
|
+
const R = u === c && w === "asc" ? "desc" : "asc";
|
|
102
|
+
d(c), x(R), _ == null || _(c, R);
|
|
103
|
+
}, [_, u, w]), N = l.useCallback(
|
|
104
104
|
(c) => {
|
|
105
|
-
const
|
|
106
|
-
n(
|
|
105
|
+
const i = c === p ? null : c;
|
|
106
|
+
n(i), s == null || s(i);
|
|
107
107
|
},
|
|
108
108
|
[s, p]
|
|
109
109
|
);
|
|
110
110
|
return l.useEffect(() => {
|
|
111
111
|
n(m);
|
|
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
|
+
x(f);
|
|
116
|
+
}, [f]), /* @__PURE__ */ t("div", { className: r.root, children: /* @__PURE__ */ C("table", { children: [
|
|
117
|
+
/* @__PURE__ */ t("thead", { children: /* @__PURE__ */ C("tr", { children: [
|
|
118
118
|
o && /* @__PURE__ */ t("th", { "aria-label": "Select Row" }),
|
|
119
|
-
h.map((c,
|
|
120
|
-
|
|
119
|
+
h.map((c, i) => /* @__PURE__ */ t(
|
|
120
|
+
F,
|
|
121
121
|
{
|
|
122
122
|
item: c,
|
|
123
|
-
onSortClick:
|
|
123
|
+
onSortClick: q
|
|
124
124
|
},
|
|
125
|
-
`header-${
|
|
125
|
+
`header-${i}`
|
|
126
126
|
))
|
|
127
127
|
] }) }),
|
|
128
|
-
/* @__PURE__ */ t("tbody", { children: e.map((c,
|
|
129
|
-
|
|
128
|
+
/* @__PURE__ */ t("tbody", { children: e.map((c, i) => /* @__PURE__ */ t(
|
|
129
|
+
H,
|
|
130
130
|
{
|
|
131
|
-
index:
|
|
131
|
+
index: i,
|
|
132
132
|
item: c,
|
|
133
133
|
includeRadio: o,
|
|
134
134
|
selectedRow: p,
|
|
135
|
-
onSelectChange:
|
|
135
|
+
onSelectChange: N,
|
|
136
136
|
dataContainer: b
|
|
137
137
|
},
|
|
138
|
-
`row-${
|
|
138
|
+
`row-${i}`
|
|
139
139
|
)) })
|
|
140
140
|
] }) });
|
|
141
141
|
}
|
|
142
142
|
export {
|
|
143
|
-
|
|
144
|
-
|
|
143
|
+
L as Table,
|
|
144
|
+
F as TableHeaderItem
|
|
145
145
|
};
|