@konstructio/ui 0.1.2-alpha.24 → 0.1.2-alpha.26
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/Dropdown/components/List/List.js +82 -90
- package/dist/components/Dropdown/components/ListItem/ListItem.js +48 -44
- package/dist/components/Dropdown/components/Wrapper.js +1 -2
- package/dist/components/Dropdown/contexts/dropdown.context.js +1 -0
- package/dist/components/Dropdown/contexts/dropdown.provider.js +45 -40
- package/dist/components/VirtualizedTable/components/Actions/Actions.js +57 -25
- package/dist/components/VirtualizedTable/components/Body/Body.js +34 -31
- package/dist/index.d.ts +6 -1
- package/dist/package.json +1 -1
- package/package.json +1 -1
|
@@ -1,145 +1,137 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { S as
|
|
3
|
-
import { d as
|
|
4
|
-
import { forwardRef as
|
|
5
|
-
import { Loading as
|
|
6
|
-
import { cn as
|
|
7
|
-
import { useNavigationUlList as
|
|
8
|
-
import { ListItem as
|
|
9
|
-
import { listVariants as
|
|
10
|
-
import { DEFAULT_LIST_SIZE as
|
|
11
|
-
import { useDropdownContext as
|
|
12
|
-
const
|
|
1
|
+
import { jsxs as H, jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { S as V } from "../../../../index-BtQfgaSF.js";
|
|
3
|
+
import { d as Z } from "../../../../debounce-BFejQm9P.js";
|
|
4
|
+
import { forwardRef as B, useRef as w, useState as G, useImperativeHandle as J, useMemo as K, useEffect as M } from "react";
|
|
5
|
+
import { Loading as Q } from "../../../Loading/Loading.js";
|
|
6
|
+
import { cn as a } from "../../../../utils/index.js";
|
|
7
|
+
import { useNavigationUlList as R } from "../../hooks/useNavigationList.js";
|
|
8
|
+
import { ListItem as v } from "../ListItem/ListItem.js";
|
|
9
|
+
import { listVariants as W } from "./List.variants.js";
|
|
10
|
+
import { DEFAULT_LIST_SIZE as X } from "../../constants/pagination.js";
|
|
11
|
+
import { useDropdownContext as Y } from "../../contexts/dropdown.hook.js";
|
|
12
|
+
const ue = B(
|
|
13
13
|
({
|
|
14
14
|
additionalOptions: k,
|
|
15
15
|
className: C,
|
|
16
|
-
inputRef:
|
|
17
|
-
isLoading:
|
|
18
|
-
itemClassName:
|
|
19
|
-
name:
|
|
20
|
-
searchable:
|
|
21
|
-
listItemSecondRowClassName:
|
|
16
|
+
inputRef: i,
|
|
17
|
+
isLoading: F,
|
|
18
|
+
itemClassName: l,
|
|
19
|
+
name: N,
|
|
20
|
+
searchable: b = !1,
|
|
21
|
+
listItemSecondRowClassName: c,
|
|
22
22
|
wrapperInputRef: I,
|
|
23
|
-
isInfiniteScrollEnabled:
|
|
24
|
-
onFetchMoreOptions:
|
|
25
|
-
},
|
|
26
|
-
const
|
|
27
|
-
isOpen:
|
|
28
|
-
searchTerm:
|
|
29
|
-
canFilter:
|
|
30
|
-
canContinueFetching:
|
|
31
|
-
page:
|
|
32
|
-
options:
|
|
23
|
+
isInfiniteScrollEnabled: u,
|
|
24
|
+
onFetchMoreOptions: f
|
|
25
|
+
}, O) => {
|
|
26
|
+
const s = w(null), m = w(null), [p, L] = G(!1), {
|
|
27
|
+
isOpen: T,
|
|
28
|
+
searchTerm: g,
|
|
29
|
+
canFilter: j,
|
|
30
|
+
canContinueFetching: n,
|
|
31
|
+
page: E,
|
|
32
|
+
options: x,
|
|
33
|
+
isTyping: y,
|
|
33
34
|
setOptions: P,
|
|
34
35
|
setPage: S,
|
|
35
|
-
setCanContinueFetching:
|
|
36
|
-
} =
|
|
37
|
-
|
|
38
|
-
const
|
|
39
|
-
const t =
|
|
36
|
+
setCanContinueFetching: D
|
|
37
|
+
} = Y();
|
|
38
|
+
J(O, () => s.current, [s]);
|
|
39
|
+
const d = b && j ? x.filter((e) => {
|
|
40
|
+
const t = g.toLowerCase();
|
|
40
41
|
return (typeof e.label == "string" ? e.label.toLowerCase() : "").includes(t);
|
|
41
|
-
}) :
|
|
42
|
-
|
|
43
|
-
ulRef:
|
|
42
|
+
}) : x;
|
|
43
|
+
R({
|
|
44
|
+
ulRef: s,
|
|
44
45
|
wrapperInputRef: I,
|
|
45
|
-
searchable:
|
|
46
|
-
filteredOptions:
|
|
46
|
+
searchable: b,
|
|
47
|
+
filteredOptions: d
|
|
47
48
|
});
|
|
48
|
-
const
|
|
49
|
-
(e, t,
|
|
50
|
-
),
|
|
51
|
-
|
|
49
|
+
const U = d.filter(
|
|
50
|
+
(e, t, r) => t === r.findIndex((h) => h.value === e.value)
|
|
51
|
+
), _ = d.length === 0, q = K(
|
|
52
|
+
() => Z(async (e) => {
|
|
52
53
|
const [t] = e;
|
|
53
|
-
if (t.isIntersecting)
|
|
54
|
+
if (t.isIntersecting && !p && f && n)
|
|
54
55
|
try {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
S(s), T(q), P([...h, ...v]);
|
|
63
|
-
}
|
|
56
|
+
L(!0);
|
|
57
|
+
const r = E + 1, { data: h, hasMore: z } = await f({
|
|
58
|
+
page: r,
|
|
59
|
+
pageSize: X,
|
|
60
|
+
termOfSearch: g
|
|
61
|
+
});
|
|
62
|
+
S(r), D(z), P((A) => [...A, ...h]);
|
|
64
63
|
} catch {
|
|
65
64
|
console.error("Error fetching more options");
|
|
66
65
|
} finally {
|
|
67
|
-
|
|
66
|
+
L(!1);
|
|
68
67
|
}
|
|
69
68
|
}, 100),
|
|
70
|
-
[
|
|
69
|
+
[p, f, g]
|
|
71
70
|
);
|
|
72
|
-
return
|
|
73
|
-
if (
|
|
74
|
-
const e = new IntersectionObserver(
|
|
71
|
+
return M(() => {
|
|
72
|
+
if (u && n && m.current && !y) {
|
|
73
|
+
const e = new IntersectionObserver(q, {
|
|
75
74
|
threshold: 0.1
|
|
76
75
|
});
|
|
77
|
-
return e.observe(
|
|
76
|
+
return e.observe(m.current), () => e.disconnect();
|
|
78
77
|
}
|
|
79
|
-
}, [
|
|
80
|
-
d,
|
|
81
|
-
l,
|
|
82
|
-
m,
|
|
83
|
-
n,
|
|
84
|
-
o,
|
|
85
|
-
g
|
|
86
|
-
]), /* @__PURE__ */ z(
|
|
78
|
+
}, [u, n, p, y]), /* @__PURE__ */ H(
|
|
87
79
|
"ul",
|
|
88
80
|
{
|
|
89
|
-
ref:
|
|
90
|
-
title:
|
|
81
|
+
ref: s,
|
|
82
|
+
title: N,
|
|
91
83
|
role: "listbox",
|
|
92
|
-
className:
|
|
93
|
-
"data-state":
|
|
84
|
+
className: a(W({ className: C })),
|
|
85
|
+
"data-state": T ? "open" : "closed",
|
|
94
86
|
children: [
|
|
95
|
-
|
|
96
|
-
|
|
87
|
+
F ? /* @__PURE__ */ o(
|
|
88
|
+
v,
|
|
97
89
|
{
|
|
98
|
-
className:
|
|
90
|
+
className: a("select-none", l),
|
|
99
91
|
isClickable: !1,
|
|
100
|
-
inputRef:
|
|
92
|
+
inputRef: i,
|
|
101
93
|
value: "Loading...",
|
|
102
94
|
label: "Loading...",
|
|
103
|
-
listItemSecondRowClassName:
|
|
95
|
+
listItemSecondRowClassName: c
|
|
104
96
|
}
|
|
105
|
-
) :
|
|
106
|
-
|
|
97
|
+
) : _ ? /* @__PURE__ */ o(
|
|
98
|
+
v,
|
|
107
99
|
{
|
|
108
|
-
className:
|
|
100
|
+
className: a("select-none", l),
|
|
109
101
|
isClickable: !1,
|
|
110
|
-
inputRef:
|
|
102
|
+
inputRef: i,
|
|
111
103
|
value: "No options",
|
|
112
104
|
label: "No options",
|
|
113
|
-
listItemSecondRowClassName:
|
|
105
|
+
listItemSecondRowClassName: c
|
|
114
106
|
}
|
|
115
|
-
) :
|
|
116
|
-
|
|
107
|
+
) : U.map((e) => /* @__PURE__ */ o(
|
|
108
|
+
v,
|
|
117
109
|
{
|
|
118
|
-
className:
|
|
110
|
+
className: a("select-none", l),
|
|
119
111
|
isClickable: !0,
|
|
120
|
-
inputRef:
|
|
121
|
-
listItemSecondRowClassName:
|
|
112
|
+
inputRef: i,
|
|
113
|
+
listItemSecondRowClassName: c,
|
|
122
114
|
...e
|
|
123
115
|
},
|
|
124
116
|
e.value
|
|
125
117
|
)),
|
|
126
|
-
|
|
118
|
+
u && n && /* @__PURE__ */ o(
|
|
127
119
|
"li",
|
|
128
120
|
{
|
|
129
|
-
ref:
|
|
121
|
+
ref: m,
|
|
130
122
|
role: "option",
|
|
131
123
|
"data-action": "true",
|
|
132
124
|
className: "flex items-center justify-center py-3",
|
|
133
125
|
onClick: (e) => e.stopPropagation(),
|
|
134
|
-
children: /* @__PURE__ */
|
|
126
|
+
children: /* @__PURE__ */ o(Q, { className: "w-4 h-4 text-aurora-500 select-none" })
|
|
135
127
|
}
|
|
136
128
|
),
|
|
137
|
-
k?.map((e, t) => /* @__PURE__ */
|
|
129
|
+
k?.map((e, t) => /* @__PURE__ */ o("li", { role: "option", "data-action": "true", children: /* @__PURE__ */ o(V, { className: "flex p-2 w-full h-full gap-1 items-center text-sm [&>svg]:w-3.5 [&>svg]:h-3.5 [&>svg]:shrink-0 cursor-pointer select-none hover:bg-gray-50 hover:dark:bg-slate-700 focus:outline-0", children: e }) }, t))
|
|
138
130
|
]
|
|
139
131
|
}
|
|
140
132
|
);
|
|
141
133
|
}
|
|
142
134
|
);
|
|
143
135
|
export {
|
|
144
|
-
|
|
136
|
+
ue as List
|
|
145
137
|
};
|
|
@@ -1,89 +1,93 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { useRef as
|
|
3
|
-
import { Typography as
|
|
4
|
-
import { cn as
|
|
5
|
-
import { listItemVariants as
|
|
6
|
-
import { useDropdownContext as
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
import { jsxs as g, jsx as l } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as y, useCallback as m } from "react";
|
|
3
|
+
import { Typography as w } from "../../../Typography/Typography.js";
|
|
4
|
+
import { cn as f } from "../../../../utils/index.js";
|
|
5
|
+
import { listItemVariants as C } from "./ListItem.variants.js";
|
|
6
|
+
import { useDropdownContext as L } from "../../contexts/dropdown.hook.js";
|
|
7
|
+
function I(r, n) {
|
|
8
|
+
const o = n.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), c = new RegExp(`(${o})`, "gi");
|
|
9
|
+
return r.split(c).map((t, a) => t.toLowerCase() === n.toLowerCase() ? /* @__PURE__ */ l(
|
|
10
|
+
"mark",
|
|
11
|
+
{
|
|
12
|
+
className: "bg-transparent font-semibold text-slate-800 dark:text-slate-50",
|
|
13
|
+
children: t
|
|
14
|
+
},
|
|
15
|
+
a
|
|
16
|
+
) : /* @__PURE__ */ l("span", { children: t }, a));
|
|
17
|
+
}
|
|
18
|
+
const $ = ({
|
|
19
|
+
isClickable: r,
|
|
20
|
+
className: n,
|
|
21
|
+
inputRef: o,
|
|
22
|
+
listItemSecondRowClassName: c,
|
|
12
23
|
...t
|
|
13
24
|
}) => {
|
|
14
|
-
const { searchTerm: a, highlightSearchEnabled:
|
|
25
|
+
const { searchTerm: a, highlightSearchEnabled: d, setValue: h, toggleOpen: u } = L(), p = y(null), i = m(
|
|
15
26
|
(e) => {
|
|
16
|
-
|
|
27
|
+
h(e.value, o), u(!1);
|
|
17
28
|
},
|
|
18
|
-
[
|
|
19
|
-
),
|
|
20
|
-
(e,
|
|
21
|
-
e.key === "Enter" && (e.stopPropagation(),
|
|
29
|
+
[h, u]
|
|
30
|
+
), x = m(
|
|
31
|
+
(e, s) => {
|
|
32
|
+
e.key === "Enter" && (e.stopPropagation(), i(s));
|
|
22
33
|
},
|
|
23
|
-
[
|
|
24
|
-
),
|
|
25
|
-
(e,
|
|
34
|
+
[i]
|
|
35
|
+
), b = m(
|
|
36
|
+
(e, s) => {
|
|
26
37
|
if (typeof e != "string")
|
|
27
38
|
return e;
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
className: "bg-transparent font-semibold text-slate-800 dark:text-slate-50",
|
|
32
|
-
children: s
|
|
33
|
-
},
|
|
34
|
-
s
|
|
35
|
-
) : s) : [e];
|
|
36
|
-
return /* @__PURE__ */ d(
|
|
37
|
-
C,
|
|
39
|
+
const k = d && a.length > 0 ? I(e, a) : [e];
|
|
40
|
+
return /* @__PURE__ */ g(
|
|
41
|
+
w,
|
|
38
42
|
{
|
|
39
43
|
variant: "body2",
|
|
40
44
|
className: "text-zinc-700 dark:text-slate-50 font-medium",
|
|
41
45
|
children: [
|
|
42
|
-
|
|
43
|
-
|
|
46
|
+
k,
|
|
47
|
+
s ? /* @__PURE__ */ l(
|
|
44
48
|
"span",
|
|
45
49
|
{
|
|
46
|
-
className:
|
|
50
|
+
className: f(
|
|
47
51
|
"block font-normal text-sm text-slate-800 dark:text-slate-50",
|
|
48
|
-
|
|
52
|
+
c
|
|
49
53
|
),
|
|
50
|
-
children:
|
|
54
|
+
children: s
|
|
51
55
|
}
|
|
52
56
|
) : null
|
|
53
57
|
]
|
|
54
58
|
}
|
|
55
59
|
);
|
|
56
60
|
},
|
|
57
|
-
[
|
|
61
|
+
[d, a]
|
|
58
62
|
);
|
|
59
|
-
return /* @__PURE__ */
|
|
63
|
+
return /* @__PURE__ */ g(
|
|
60
64
|
"li",
|
|
61
65
|
{
|
|
62
|
-
ref:
|
|
66
|
+
ref: p,
|
|
63
67
|
role: "option",
|
|
64
68
|
"data-action": "false",
|
|
65
|
-
className:
|
|
69
|
+
className: f(C({ className: n })),
|
|
66
70
|
tabIndex: 0,
|
|
67
71
|
onClick: (e) => {
|
|
68
|
-
|
|
72
|
+
r && (i(t), e.stopPropagation());
|
|
69
73
|
},
|
|
70
|
-
onKeyDown: (e) =>
|
|
74
|
+
onKeyDown: (e) => x(e, t),
|
|
71
75
|
children: [
|
|
72
76
|
t.leftIcon ? /* @__PURE__ */ l(
|
|
73
77
|
"span",
|
|
74
78
|
{
|
|
75
|
-
className:
|
|
79
|
+
className: f("w-4 h-4 flex justify-center", {
|
|
76
80
|
"items-center": !t.subLabel,
|
|
77
81
|
"items-baseline -translate-y-2": !!t.subLabel
|
|
78
82
|
}),
|
|
79
83
|
children: t.leftIcon
|
|
80
84
|
}
|
|
81
85
|
) : null,
|
|
82
|
-
|
|
86
|
+
b(t.label, t.subLabel)
|
|
83
87
|
]
|
|
84
88
|
}
|
|
85
89
|
);
|
|
86
90
|
};
|
|
87
91
|
export {
|
|
88
|
-
|
|
92
|
+
$ as ListItem
|
|
89
93
|
};
|
|
@@ -44,7 +44,6 @@ const fe = [
|
|
|
44
44
|
isOpen: f,
|
|
45
45
|
searchTerm: G,
|
|
46
46
|
value: o,
|
|
47
|
-
// canFilter,
|
|
48
47
|
options: n,
|
|
49
48
|
setValue: c,
|
|
50
49
|
setSearchTerm: J,
|
|
@@ -64,7 +63,7 @@ const fe = [
|
|
|
64
63
|
}, [x, n, c, o]);
|
|
65
64
|
const S = (r) => {
|
|
66
65
|
const p = r.target.value;
|
|
67
|
-
K(!0),
|
|
66
|
+
K(!0), c(""), J(p ?? ""), q?.(p);
|
|
68
67
|
const b = n.find(
|
|
69
68
|
(X) => X.value.toLocaleLowerCase() === p.toLocaleLowerCase()
|
|
70
69
|
);
|
|
@@ -1,53 +1,58 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useState as e, useRef as
|
|
3
|
-
import { DropdownContext as
|
|
4
|
-
import { useToggle as
|
|
5
|
-
const
|
|
6
|
-
children:
|
|
7
|
-
value:
|
|
8
|
-
name:
|
|
9
|
-
highlightSearch:
|
|
10
|
-
options:
|
|
1
|
+
import { jsx as G } from "react/jsx-runtime";
|
|
2
|
+
import { useState as e, useRef as f, useCallback as p, useEffect as T } from "react";
|
|
3
|
+
import { DropdownContext as L } from "./dropdown.context.js";
|
|
4
|
+
import { useToggle as N } from "../../../hooks/useToggle.js";
|
|
5
|
+
const c = 1, O = 300, U = ({
|
|
6
|
+
children: d,
|
|
7
|
+
value: C,
|
|
8
|
+
name: i,
|
|
9
|
+
highlightSearch: E = !1,
|
|
10
|
+
options: n,
|
|
11
11
|
onChange: a,
|
|
12
|
-
onBlur:
|
|
12
|
+
onBlur: u
|
|
13
13
|
}) => {
|
|
14
|
-
const [
|
|
15
|
-
(
|
|
16
|
-
|
|
14
|
+
const [v, l] = e(n), F = f(E), [P, g] = N(!1), [D, I] = e(""), [S, b] = e(!0), [x, o] = e(!0), [A, s] = e(c), [_, h] = e(!1), t = f(void 0), w = p(
|
|
15
|
+
(r, m) => {
|
|
16
|
+
m?.current && (m.current.value = r), t.current && clearTimeout(t.current), h(!0), o(!0), s(c), a?.({ target: { value: r, name: i ?? "" } }), u?.(), t.current = setTimeout(() => {
|
|
17
|
+
h(!1);
|
|
18
|
+
}, O);
|
|
17
19
|
},
|
|
18
|
-
[a,
|
|
19
|
-
),
|
|
20
|
-
(
|
|
21
|
-
|
|
20
|
+
[a, i, u]
|
|
21
|
+
), y = p(
|
|
22
|
+
(r) => {
|
|
23
|
+
g(r), o(!0), s(c);
|
|
22
24
|
},
|
|
23
|
-
[
|
|
25
|
+
[g]
|
|
24
26
|
);
|
|
25
|
-
return
|
|
26
|
-
|
|
27
|
-
}, [
|
|
28
|
-
|
|
27
|
+
return T(() => {
|
|
28
|
+
l(n);
|
|
29
|
+
}, [n.length]), T(() => () => {
|
|
30
|
+
t.current && clearTimeout(t.current);
|
|
31
|
+
}, []), /* @__PURE__ */ G(
|
|
32
|
+
L.Provider,
|
|
29
33
|
{
|
|
30
34
|
value: {
|
|
31
|
-
highlightSearchEnabled:
|
|
32
|
-
isOpen:
|
|
33
|
-
searchTerm:
|
|
34
|
-
value:
|
|
35
|
-
canFilter:
|
|
36
|
-
canContinueFetching:
|
|
37
|
-
page:
|
|
38
|
-
options:
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
35
|
+
highlightSearchEnabled: F.current,
|
|
36
|
+
isOpen: P,
|
|
37
|
+
searchTerm: D,
|
|
38
|
+
value: C,
|
|
39
|
+
canFilter: S,
|
|
40
|
+
canContinueFetching: x,
|
|
41
|
+
page: A,
|
|
42
|
+
options: v,
|
|
43
|
+
isTyping: _,
|
|
44
|
+
setOptions: l,
|
|
45
|
+
setPage: s,
|
|
46
|
+
setCanContinueFetching: o,
|
|
47
|
+
setCanFilter: b,
|
|
48
|
+
setSearchTerm: I,
|
|
49
|
+
setValue: w,
|
|
50
|
+
toggleOpen: y
|
|
46
51
|
},
|
|
47
|
-
children:
|
|
52
|
+
children: d
|
|
48
53
|
}
|
|
49
54
|
);
|
|
50
55
|
};
|
|
51
56
|
export {
|
|
52
|
-
|
|
57
|
+
U as DropdownProvider
|
|
53
58
|
};
|
|
@@ -1,40 +1,72 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { Button as
|
|
3
|
-
import { cn as
|
|
4
|
-
import { E as
|
|
5
|
-
const
|
|
6
|
-
actions:
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
import { jsxs as i, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { Button as t } from "../../../Button/Button.js";
|
|
3
|
+
import { cn as r } from "../../../../utils/index.js";
|
|
4
|
+
import { E as u } from "../../../../ellipsis-vertical-BVPtjl5f.js";
|
|
5
|
+
const w = ({
|
|
6
|
+
actions: a,
|
|
7
|
+
wrapperClassName: l,
|
|
8
|
+
triggerButtonClassName: s,
|
|
9
|
+
iconTriggerButtonClassName: n,
|
|
10
|
+
wrapperActionsClassName: c,
|
|
11
|
+
wrapperContentActionsClassName: d,
|
|
12
|
+
...h
|
|
13
|
+
}) => a ? /* @__PURE__ */ i("div", { className: r("relative group", l), children: [
|
|
14
|
+
/* @__PURE__ */ i(
|
|
15
|
+
t,
|
|
11
16
|
{
|
|
12
17
|
variant: "text",
|
|
13
18
|
shape: "circle",
|
|
14
19
|
size: "large",
|
|
15
|
-
className:
|
|
20
|
+
className: r(
|
|
21
|
+
"text-slate-400 group-hover:text-slate-800 group-hover:bg-aurora-50",
|
|
22
|
+
s
|
|
23
|
+
),
|
|
16
24
|
role: "presentation",
|
|
17
25
|
children: [
|
|
18
|
-
/* @__PURE__ */ e(
|
|
26
|
+
/* @__PURE__ */ e(
|
|
27
|
+
u,
|
|
28
|
+
{
|
|
29
|
+
"aria-hidden": "true",
|
|
30
|
+
className: r("w-7 h-7", n)
|
|
31
|
+
}
|
|
32
|
+
),
|
|
19
33
|
/* @__PURE__ */ e("span", { className: "sr-only", children: "Show Actions" })
|
|
20
34
|
]
|
|
21
35
|
}
|
|
22
36
|
),
|
|
23
|
-
/* @__PURE__ */ e(
|
|
24
|
-
|
|
37
|
+
/* @__PURE__ */ e(
|
|
38
|
+
"div",
|
|
25
39
|
{
|
|
26
|
-
className:
|
|
27
|
-
"
|
|
28
|
-
|
|
40
|
+
className: r(
|
|
41
|
+
"absolute top-full right-0 w-[215px] hidden group-hover:block z-10",
|
|
42
|
+
c
|
|
29
43
|
),
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
44
|
+
children: /* @__PURE__ */ e(
|
|
45
|
+
"div",
|
|
46
|
+
{
|
|
47
|
+
className: r(
|
|
48
|
+
"bg-white mt-0.5 py-2 rounded-lg shadow-lg border border-zinc-100 animate-in fade-in-0",
|
|
49
|
+
d
|
|
50
|
+
),
|
|
51
|
+
children: a.map(({ label: o, className: p, onClick: m }) => /* @__PURE__ */ e(
|
|
52
|
+
t,
|
|
53
|
+
{
|
|
54
|
+
className: r(
|
|
55
|
+
"w-full text-slate-800 cursor-pointer p-0 h-9 flex gap-2 text-sm font-normal justify-start hover:bg-gray-50 hover:text-slate-800 rounded-none px-6",
|
|
56
|
+
p
|
|
57
|
+
),
|
|
58
|
+
variant: "text",
|
|
59
|
+
asChild: !0,
|
|
60
|
+
role: "presentation",
|
|
61
|
+
children: /* @__PURE__ */ e(t, { onClick: () => m(h.row.original), children: o })
|
|
62
|
+
},
|
|
63
|
+
o
|
|
64
|
+
))
|
|
65
|
+
}
|
|
66
|
+
)
|
|
67
|
+
}
|
|
68
|
+
)
|
|
37
69
|
] }) : null;
|
|
38
70
|
export {
|
|
39
|
-
|
|
71
|
+
w as Actions
|
|
40
72
|
};
|
|
@@ -1,48 +1,51 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { f as
|
|
3
|
-
import { Skeleton as
|
|
1
|
+
import { jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { f as y } from "../../../../index-CSWGJT-v.js";
|
|
3
|
+
import { Skeleton as x } from "../Skeleton/Skeleton.js";
|
|
4
4
|
import { cn as b } from "../../../../utils/index.js";
|
|
5
|
-
import { useTableContext as
|
|
6
|
-
const
|
|
5
|
+
import { useTableContext as D } from "../../contexts/table.hook.js";
|
|
6
|
+
const _ = ({
|
|
7
7
|
isLoading: d,
|
|
8
8
|
showPagination: a
|
|
9
9
|
}) => {
|
|
10
|
-
const { table:
|
|
11
|
-
if (d ||
|
|
12
|
-
return /* @__PURE__ */
|
|
13
|
-
const
|
|
14
|
-
return /* @__PURE__ */
|
|
15
|
-
const { meta: n = {} } =
|
|
16
|
-
return /* @__PURE__ */
|
|
10
|
+
const { table: s, pageSize: i, tableFetching: p } = D();
|
|
11
|
+
if (d || p)
|
|
12
|
+
return /* @__PURE__ */ e(x, { numberOfRows: i, table: s });
|
|
13
|
+
const r = s.getRowModel().rows ?? [];
|
|
14
|
+
return /* @__PURE__ */ e("tbody", { className: "text-slate-800 text-sm font-normal relative", children: r.map(({ id: o, original: l, getVisibleCells: u }, m) => {
|
|
15
|
+
const { meta: n = {} } = l, c = u();
|
|
16
|
+
return /* @__PURE__ */ e(
|
|
17
17
|
"tr",
|
|
18
18
|
{
|
|
19
19
|
className: b(
|
|
20
20
|
"border-b border-b-gray-200 last:border-b-transparent bg-transparent",
|
|
21
21
|
n.className
|
|
22
22
|
),
|
|
23
|
-
"data-row-id":
|
|
23
|
+
"data-row-id": o,
|
|
24
24
|
...n.attributes ?? {},
|
|
25
|
-
children:
|
|
26
|
-
"
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
25
|
+
children: c.map(({ id: g, column: t, getContext: h }, f) => {
|
|
26
|
+
const N = typeof t.columnDef.meta?.className == "function" ? t.columnDef.meta?.className(l) : t.columnDef.meta?.className;
|
|
27
|
+
return /* @__PURE__ */ e(
|
|
28
|
+
"td",
|
|
29
|
+
{
|
|
30
|
+
className: b(
|
|
31
|
+
"px-4 py-1 text-sm bg-white",
|
|
32
|
+
N,
|
|
33
|
+
{
|
|
34
|
+
"[tr:last-child_&:first-of-type]:rounded-bl-lg": m === r.length - 1 && f === 0 || !a,
|
|
35
|
+
"[tr:last-child_&:last-of-type]:rounded-br-lg": m === r.length - 1 && f === c.length - 1 || !a
|
|
36
|
+
}
|
|
37
|
+
),
|
|
38
|
+
...t.columnDef.meta?.attributes ?? {},
|
|
39
|
+
children: y(t.columnDef.cell, h())
|
|
40
|
+
},
|
|
41
|
+
g
|
|
42
|
+
);
|
|
43
|
+
})
|
|
41
44
|
},
|
|
42
|
-
|
|
45
|
+
o
|
|
43
46
|
);
|
|
44
47
|
}) });
|
|
45
48
|
};
|
|
46
49
|
export {
|
|
47
|
-
|
|
50
|
+
_ as Body
|
|
48
51
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -645,6 +645,11 @@ declare type Props_4<TData extends RowData_2> = VariantProps<typeof virtualizeTa
|
|
|
645
645
|
|
|
646
646
|
declare type Props_5<TData extends RowData> = CellContext<TData, unknown> & {
|
|
647
647
|
actions: Action<TData>[];
|
|
648
|
+
iconTriggerButtonClassName?: string;
|
|
649
|
+
triggerButtonClassName?: string;
|
|
650
|
+
wrapperActionsClassName?: string;
|
|
651
|
+
wrapperClassName?: string;
|
|
652
|
+
wrapperContentActionsClassName?: string;
|
|
648
653
|
};
|
|
649
654
|
|
|
650
655
|
export declare const Radio: FC<RadioProps>;
|
|
@@ -980,7 +985,7 @@ export { }
|
|
|
980
985
|
|
|
981
986
|
declare module '@tanstack/react-table' {
|
|
982
987
|
interface ColumnMeta<TData extends RowData, TValue> {
|
|
983
|
-
className?: string;
|
|
988
|
+
className?: string | ((row: TData) => string);
|
|
984
989
|
attributes?: Record<string, string | number | boolean>;
|
|
985
990
|
headerClassName?: string;
|
|
986
991
|
}
|
package/dist/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@konstructio/ui",
|
|
3
3
|
"description": "A set of reusable and customizable React components built for konstruct.io",
|
|
4
4
|
"private": false,
|
|
5
|
-
"version": "0.1.2-alpha.
|
|
5
|
+
"version": "0.1.2-alpha.25",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"main": "dist/index.js",
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@konstructio/ui",
|
|
3
3
|
"description": "A set of reusable and customizable React components built for konstruct.io",
|
|
4
4
|
"private": false,
|
|
5
|
-
"version": "0.1.2-alpha.
|
|
5
|
+
"version": "0.1.2-alpha.26",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"main": "dist/index.js",
|