@konstructio/ui 0.1.2-alpha.22 → 0.1.2-alpha.24
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/Dropdown.js +37 -31
- package/dist/components/Dropdown/components/List/List.js +128 -66
- package/dist/components/Dropdown/components/Wrapper.js +136 -135
- package/dist/components/Dropdown/constants/index.js +4 -0
- package/dist/components/Dropdown/constants/pagination.js +4 -0
- package/dist/components/Dropdown/contexts/dropdown.context.js +16 -0
- package/dist/components/Dropdown/contexts/dropdown.provider.js +43 -20
- package/dist/components/Dropdown/hooks/useDropdown.js +72 -31
- package/dist/components/Dropdown/hooks/useNavigationList.js +28 -40
- package/dist/components/VirtualizedTable/VirtualizedTable.js +20 -19
- package/dist/components/VirtualizedTable/components/Body/Body.js +33 -25
- package/dist/components/VirtualizedTable/components/Pagination/Pagination.js +20 -19
- package/dist/components/VirtualizedTable/components/Skeleton/Skeleton.js +46 -31
- package/dist/index.d.ts +18 -2
- package/dist/package.json +17 -17
- package/dist/styles.css +1 -1
- package/dist/utils/index.js +534 -501
- package/package.json +17 -17
|
@@ -4,6 +4,22 @@ const t = e({
|
|
|
4
4
|
isOpen: !1,
|
|
5
5
|
searchTerm: "",
|
|
6
6
|
value: void 0,
|
|
7
|
+
canFilter: !0,
|
|
8
|
+
canContinueFetching: !0,
|
|
9
|
+
page: 1,
|
|
10
|
+
options: [],
|
|
11
|
+
setOptions() {
|
|
12
|
+
throw new Error("setOptions function must be overridden");
|
|
13
|
+
},
|
|
14
|
+
setPage() {
|
|
15
|
+
throw new Error("setPage function must be overridden");
|
|
16
|
+
},
|
|
17
|
+
setCanContinueFetching() {
|
|
18
|
+
throw new Error("setCanContinueFetching function must be overridden");
|
|
19
|
+
},
|
|
20
|
+
setCanFilter() {
|
|
21
|
+
throw new Error("setCanFilter function must be overridden");
|
|
22
|
+
},
|
|
7
23
|
setSearchTerm() {
|
|
8
24
|
throw new Error("setSearchTerm function must be overridden");
|
|
9
25
|
},
|
|
@@ -1,30 +1,53 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import {
|
|
3
|
-
import { DropdownContext as
|
|
4
|
-
import { useToggle as
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { jsx as w } from "react/jsx-runtime";
|
|
2
|
+
import { useState as e, useRef as A, useCallback as u, useEffect as I } from "react";
|
|
3
|
+
import { DropdownContext as O } from "./dropdown.context.js";
|
|
4
|
+
import { useToggle as _ } from "../../../hooks/useToggle.js";
|
|
5
|
+
const s = 1, N = ({
|
|
6
|
+
children: p,
|
|
7
|
+
value: m,
|
|
8
|
+
name: c,
|
|
9
|
+
highlightSearch: f = !1,
|
|
10
|
+
options: r,
|
|
11
|
+
onChange: a,
|
|
12
|
+
onBlur: g
|
|
13
|
+
}) => {
|
|
14
|
+
const [d, i] = e(r), C = A(f), [T, l] = _(!1), [E, F] = e(""), [v, P] = e(!0), [S, n] = e(!0), [b, o] = e(s), x = u(
|
|
15
|
+
(t, h) => {
|
|
16
|
+
h?.current && (h.current.value = t), n(!0), o(s), a?.({ target: { value: t, name: c ?? "" } }), g?.();
|
|
9
17
|
},
|
|
10
|
-
[
|
|
18
|
+
[a, c, g]
|
|
19
|
+
), D = u(
|
|
20
|
+
(t) => {
|
|
21
|
+
l(t), n(!0), o(s);
|
|
22
|
+
},
|
|
23
|
+
[l]
|
|
11
24
|
);
|
|
12
|
-
return
|
|
13
|
-
|
|
25
|
+
return I(() => {
|
|
26
|
+
i(r);
|
|
27
|
+
}, [r.length]), /* @__PURE__ */ w(
|
|
28
|
+
O.Provider,
|
|
14
29
|
{
|
|
15
30
|
value: {
|
|
16
|
-
highlightSearchEnabled:
|
|
17
|
-
isOpen:
|
|
18
|
-
searchTerm:
|
|
19
|
-
value:
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
31
|
+
highlightSearchEnabled: C.current,
|
|
32
|
+
isOpen: T,
|
|
33
|
+
searchTerm: E,
|
|
34
|
+
value: m,
|
|
35
|
+
canFilter: v,
|
|
36
|
+
canContinueFetching: S,
|
|
37
|
+
page: b,
|
|
38
|
+
options: d,
|
|
39
|
+
setOptions: i,
|
|
40
|
+
setPage: o,
|
|
41
|
+
setCanContinueFetching: n,
|
|
42
|
+
setCanFilter: P,
|
|
43
|
+
setSearchTerm: F,
|
|
44
|
+
setValue: x,
|
|
45
|
+
toggleOpen: D
|
|
23
46
|
},
|
|
24
|
-
children:
|
|
47
|
+
children: p
|
|
25
48
|
}
|
|
26
49
|
);
|
|
27
50
|
};
|
|
28
51
|
export {
|
|
29
|
-
|
|
52
|
+
N as DropdownProvider
|
|
30
53
|
};
|
|
@@ -1,20 +1,22 @@
|
|
|
1
|
-
import { useRef as
|
|
2
|
-
import { useDropdownContext as
|
|
3
|
-
const
|
|
4
|
-
ulRef:
|
|
5
|
-
inputRef:
|
|
6
|
-
disabled:
|
|
1
|
+
import { useRef as m, useEffect as l, useCallback as b } from "react";
|
|
2
|
+
import { useDropdownContext as L } from "../contexts/dropdown.hook.js";
|
|
3
|
+
const y = ({
|
|
4
|
+
ulRef: f,
|
|
5
|
+
inputRef: t,
|
|
6
|
+
disabled: w,
|
|
7
|
+
internalValue: i,
|
|
8
|
+
onBlur: g
|
|
7
9
|
}) => {
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
const e = new AbortController(),
|
|
11
|
-
|
|
12
|
-
},
|
|
13
|
-
|
|
10
|
+
const r = m(null), a = m(null), { value: c, setSearchTerm: v, setCanFilter: u, toggleOpen: n } = L();
|
|
11
|
+
l(() => {
|
|
12
|
+
const e = new AbortController(), o = (d) => {
|
|
13
|
+
d.key === "Escape" && n(!1);
|
|
14
|
+
}, s = (d) => {
|
|
15
|
+
r.current?.contains(d.target) || n(!1);
|
|
14
16
|
};
|
|
15
|
-
return document.addEventListener("keydown",
|
|
17
|
+
return document.addEventListener("keydown", o, {
|
|
16
18
|
signal: e.signal
|
|
17
|
-
}), document.addEventListener("mousedown",
|
|
19
|
+
}), document.addEventListener("mousedown", s, {
|
|
18
20
|
signal: e.signal
|
|
19
21
|
}), document.addEventListener(
|
|
20
22
|
"visibilitychange",
|
|
@@ -24,39 +26,78 @@ const b = ({
|
|
|
24
26
|
{
|
|
25
27
|
signal: e.signal
|
|
26
28
|
}
|
|
27
|
-
),
|
|
28
|
-
"
|
|
29
|
+
), a.current?.addEventListener(
|
|
30
|
+
"focusin",
|
|
29
31
|
() => {
|
|
30
|
-
|
|
32
|
+
w || n(!0);
|
|
31
33
|
},
|
|
32
34
|
{ signal: e.signal }
|
|
33
35
|
), () => {
|
|
34
36
|
e.abort();
|
|
35
37
|
};
|
|
36
|
-
}, [n,
|
|
38
|
+
}, [n, r]), l(() => {
|
|
37
39
|
const e = new AbortController();
|
|
38
|
-
return
|
|
40
|
+
return a.current?.addEventListener(
|
|
39
41
|
"keydown",
|
|
40
|
-
(
|
|
41
|
-
if (
|
|
42
|
-
const
|
|
43
|
-
|
|
42
|
+
(o) => {
|
|
43
|
+
if (o.key === "ArrowDown") {
|
|
44
|
+
const s = f.current?.querySelector("li");
|
|
45
|
+
s && s.focus();
|
|
44
46
|
}
|
|
45
47
|
},
|
|
46
48
|
{ signal: e.signal }
|
|
47
49
|
), () => {
|
|
48
50
|
e.abort();
|
|
49
51
|
};
|
|
50
|
-
}, [
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
52
|
+
}, [a, f]), l(() => {
|
|
53
|
+
const e = new AbortController();
|
|
54
|
+
return t?.current?.addEventListener(
|
|
55
|
+
"focusin",
|
|
56
|
+
() => {
|
|
57
|
+
v(i?.value ?? ""), u(!1);
|
|
58
|
+
},
|
|
59
|
+
{ signal: e.signal }
|
|
60
|
+
), t?.current?.addEventListener(
|
|
61
|
+
"focusout",
|
|
62
|
+
() => {
|
|
63
|
+
u(!0);
|
|
64
|
+
},
|
|
65
|
+
{ signal: e.signal }
|
|
66
|
+
), a.current?.addEventListener(
|
|
67
|
+
"focus",
|
|
68
|
+
() => {
|
|
69
|
+
u(!1);
|
|
70
|
+
},
|
|
71
|
+
{ signal: e.signal }
|
|
72
|
+
), r.current?.addEventListener(
|
|
73
|
+
"focusout",
|
|
74
|
+
(o) => {
|
|
75
|
+
r.current?.contains(o.relatedTarget) || n(!1);
|
|
76
|
+
},
|
|
77
|
+
{ signal: e.signal }
|
|
78
|
+
), () => {
|
|
79
|
+
e.abort();
|
|
80
|
+
};
|
|
81
|
+
}, [c]), l(() => {
|
|
82
|
+
t?.current && (t.current.value = c && i?.value || "");
|
|
83
|
+
}, [i, c]), l(() => {
|
|
84
|
+
const e = new AbortController();
|
|
85
|
+
return r.current?.addEventListener("focusout", (o) => {
|
|
86
|
+
const s = o.relatedTarget;
|
|
87
|
+
(!s || !r.current?.contains(s)) && (t?.current?.value || g?.());
|
|
88
|
+
}), () => {
|
|
89
|
+
e.abort();
|
|
90
|
+
};
|
|
91
|
+
}, [n, r, v, g, c]);
|
|
92
|
+
const E = b(() => {
|
|
93
|
+
n(!0), requestAnimationFrame(() => t?.current?.focus());
|
|
94
|
+
}, [t, n]);
|
|
54
95
|
return {
|
|
55
|
-
wrapperRef:
|
|
56
|
-
wrapperInputRef:
|
|
57
|
-
handleOpen:
|
|
96
|
+
wrapperRef: r,
|
|
97
|
+
wrapperInputRef: a,
|
|
98
|
+
handleOpen: E
|
|
58
99
|
};
|
|
59
100
|
};
|
|
60
101
|
export {
|
|
61
|
-
|
|
102
|
+
y as useDropdown
|
|
62
103
|
};
|
|
@@ -1,62 +1,50 @@
|
|
|
1
|
-
import { useRef as g, useEffect as
|
|
2
|
-
import { useDropdownContext as
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
wrapperRef: a
|
|
1
|
+
import { useRef as g, useEffect as a } from "react";
|
|
2
|
+
import { useDropdownContext as k } from "../contexts/dropdown.hook.js";
|
|
3
|
+
const A = ({
|
|
4
|
+
searchable: o,
|
|
5
|
+
ulRef: n,
|
|
6
|
+
wrapperInputRef: e,
|
|
7
|
+
filteredOptions: f
|
|
9
8
|
}) => {
|
|
10
|
-
const r = g(0), { isOpen:
|
|
11
|
-
|
|
12
|
-
const
|
|
13
|
-
(
|
|
14
|
-
),
|
|
15
|
-
r.current <
|
|
16
|
-
},
|
|
17
|
-
r.current > 0 ? (r.current = r.current - 1,
|
|
9
|
+
const r = g(0), { isOpen: s } = k();
|
|
10
|
+
a(() => {
|
|
11
|
+
const m = n.current?.querySelectorAll("li") ?? [], t = Array.from(m).filter(
|
|
12
|
+
(c) => c.getAttribute("data-action") !== "true"
|
|
13
|
+
), u = new AbortController(), i = () => {
|
|
14
|
+
r.current < t.length - 1 ? (r.current = r.current + 1, t[r.current].focus()) : (r.current = 0, t[0].focus());
|
|
15
|
+
}, l = () => {
|
|
16
|
+
r.current > 0 ? (r.current = r.current - 1, t[r.current].focus()) : (r.current = 0, e?.current && o ? e.current.querySelector("input")?.focus() : e.current?.focus());
|
|
18
17
|
};
|
|
19
|
-
return
|
|
18
|
+
return n.current?.addEventListener(
|
|
20
19
|
"keydown",
|
|
21
|
-
(
|
|
22
|
-
switch (
|
|
20
|
+
(c) => {
|
|
21
|
+
switch (c.preventDefault(), c.key) {
|
|
23
22
|
case "ArrowDown": {
|
|
24
|
-
|
|
23
|
+
i();
|
|
25
24
|
break;
|
|
26
25
|
}
|
|
27
26
|
case "Tab": {
|
|
28
|
-
|
|
27
|
+
c.shiftKey ? l() : i();
|
|
29
28
|
break;
|
|
30
29
|
}
|
|
31
30
|
case "ArrowUp": {
|
|
32
|
-
r.current === 0 ?
|
|
31
|
+
r.current === 0 ? e.current?.focus() : l();
|
|
33
32
|
break;
|
|
34
33
|
}
|
|
35
34
|
case "Enter": {
|
|
36
|
-
|
|
35
|
+
t[r.current]?.click();
|
|
37
36
|
break;
|
|
38
37
|
}
|
|
39
38
|
}
|
|
40
39
|
},
|
|
41
|
-
{ signal:
|
|
40
|
+
{ signal: u.signal }
|
|
42
41
|
), () => {
|
|
43
|
-
|
|
42
|
+
u.abort();
|
|
44
43
|
};
|
|
45
|
-
}, [
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
"mouseenter",
|
|
49
|
-
() => {
|
|
50
|
-
(t.current?.querySelectorAll("li") ?? []).forEach((o) => o.blur());
|
|
51
|
-
},
|
|
52
|
-
{ signal: c.signal }
|
|
53
|
-
), () => {
|
|
54
|
-
c.abort();
|
|
55
|
-
};
|
|
56
|
-
}, [t, a]), i(() => {
|
|
57
|
-
f || (r.current = 0);
|
|
58
|
-
}, [f]);
|
|
44
|
+
}, [n, r, e, o, f.length]), a(() => {
|
|
45
|
+
s || (r.current = 0);
|
|
46
|
+
}, [s]);
|
|
59
47
|
};
|
|
60
48
|
export {
|
|
61
|
-
|
|
49
|
+
A as useNavigationUlList
|
|
62
50
|
};
|
|
@@ -4,12 +4,12 @@ import { cn as c } from "../../utils/index.js";
|
|
|
4
4
|
import { TableProvider as K } from "./contexts/table.provider.js";
|
|
5
5
|
import { Filter as M } from "./components/Filter/Filter.js";
|
|
6
6
|
import { WrapperBody as W } from "./components/WrapperBody/WrapperBody.js";
|
|
7
|
-
import { Header as
|
|
8
|
-
import { Body as
|
|
9
|
-
import { Pagination as
|
|
10
|
-
import { TruncateText as
|
|
11
|
-
import { Actions as
|
|
12
|
-
const
|
|
7
|
+
import { Header as k } from "./components/Header/Header.js";
|
|
8
|
+
import { Body as q } from "./components/Body/Body.js";
|
|
9
|
+
import { Pagination as C } from "./components/Pagination/Pagination.js";
|
|
10
|
+
import { TruncateText as F } from "./components/TruncateText/TruncateText.js";
|
|
11
|
+
import { Actions as G } from "./components/Actions/Actions.js";
|
|
12
|
+
const J = ({
|
|
13
13
|
id: n,
|
|
14
14
|
ariaLabel: f,
|
|
15
15
|
columns: p,
|
|
@@ -26,8 +26,8 @@ const G = ({
|
|
|
26
26
|
queryOptions: z,
|
|
27
27
|
// Pagination
|
|
28
28
|
showPagination: B,
|
|
29
|
-
showTotalItems:
|
|
30
|
-
showDropdownPagination:
|
|
29
|
+
showTotalItems: t,
|
|
30
|
+
showDropdownPagination: a,
|
|
31
31
|
showDotPagination: l,
|
|
32
32
|
showFormPagination: m,
|
|
33
33
|
pageSizes: V,
|
|
@@ -41,8 +41,8 @@ const G = ({
|
|
|
41
41
|
}) => {
|
|
42
42
|
const e = I(
|
|
43
43
|
() => B || [
|
|
44
|
-
a,
|
|
45
44
|
t,
|
|
45
|
+
a,
|
|
46
46
|
l,
|
|
47
47
|
m
|
|
48
48
|
].some(Boolean),
|
|
@@ -82,37 +82,38 @@ const G = ({
|
|
|
82
82
|
"aria-label": f,
|
|
83
83
|
children: [
|
|
84
84
|
/* @__PURE__ */ r(
|
|
85
|
-
|
|
85
|
+
k,
|
|
86
86
|
{
|
|
87
87
|
className: N,
|
|
88
88
|
classNameArrows: x,
|
|
89
89
|
classNameActiveArrows: T
|
|
90
90
|
}
|
|
91
91
|
),
|
|
92
|
-
/* @__PURE__ */ r(
|
|
92
|
+
/* @__PURE__ */ r(q, { isLoading: o, showPagination: e })
|
|
93
93
|
]
|
|
94
94
|
}
|
|
95
95
|
)
|
|
96
96
|
}
|
|
97
97
|
),
|
|
98
98
|
e && /* @__PURE__ */ r(
|
|
99
|
-
|
|
99
|
+
C,
|
|
100
100
|
{
|
|
101
|
-
showTotalItems:
|
|
102
|
-
showDropdownPagination:
|
|
101
|
+
showTotalItems: t,
|
|
102
|
+
showDropdownPagination: a,
|
|
103
103
|
showDotPagination: l,
|
|
104
104
|
showFormPagination: m,
|
|
105
|
-
pageSizes: V
|
|
105
|
+
pageSizes: V,
|
|
106
|
+
isLoading: o
|
|
106
107
|
}
|
|
107
108
|
)
|
|
108
109
|
] })
|
|
109
110
|
}
|
|
110
111
|
);
|
|
111
|
-
}, i =
|
|
112
|
+
}, i = J;
|
|
112
113
|
i.displayName = "KonstructVirtualizedTable";
|
|
113
|
-
i.TruncateText =
|
|
114
|
-
i.Actions =
|
|
114
|
+
i.TruncateText = F;
|
|
115
|
+
i.Actions = G;
|
|
115
116
|
export {
|
|
116
|
-
|
|
117
|
+
F as TruncateText,
|
|
117
118
|
i as VirtualizedTable
|
|
118
119
|
};
|
|
@@ -1,40 +1,48 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { f } from "../../../../index-CSWGJT-v.js";
|
|
3
|
-
import { Skeleton as
|
|
4
|
-
import { cn as
|
|
5
|
-
import { useTableContext as
|
|
6
|
-
const
|
|
7
|
-
isLoading:
|
|
1
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { f as x } from "../../../../index-CSWGJT-v.js";
|
|
3
|
+
import { Skeleton as y } from "../Skeleton/Skeleton.js";
|
|
4
|
+
import { cn as b } from "../../../../utils/index.js";
|
|
5
|
+
import { useTableContext as N } from "../../contexts/table.hook.js";
|
|
6
|
+
const j = ({
|
|
7
|
+
isLoading: d,
|
|
8
|
+
showPagination: a
|
|
8
9
|
}) => {
|
|
9
|
-
const { table:
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
const { table: o, pageSize: i, tableFetching: f } = N();
|
|
11
|
+
if (d || f)
|
|
12
|
+
return /* @__PURE__ */ t(y, { numberOfRows: i, table: o });
|
|
13
|
+
const e = o.getRowModel().rows ?? [];
|
|
14
|
+
return /* @__PURE__ */ t("tbody", { className: "text-slate-800 text-sm font-normal relative", children: e.map(({ id: s, original: p, getVisibleCells: u }, l) => {
|
|
15
|
+
const { meta: n = {} } = p, m = u();
|
|
16
|
+
return /* @__PURE__ */ t(
|
|
13
17
|
"tr",
|
|
14
18
|
{
|
|
15
|
-
className:
|
|
16
|
-
"border-b border-b-gray-200
|
|
17
|
-
|
|
19
|
+
className: b(
|
|
20
|
+
"border-b border-b-gray-200 last:border-b-transparent bg-transparent",
|
|
21
|
+
n.className
|
|
18
22
|
),
|
|
19
|
-
"data-row-id":
|
|
20
|
-
...
|
|
21
|
-
children:
|
|
23
|
+
"data-row-id": s,
|
|
24
|
+
...n.attributes ?? {},
|
|
25
|
+
children: m.map(({ id: g, column: r, getContext: h }, c) => /* @__PURE__ */ t(
|
|
22
26
|
"td",
|
|
23
27
|
{
|
|
24
|
-
className:
|
|
25
|
-
"px-4 py-1 text-sm",
|
|
26
|
-
|
|
28
|
+
className: b(
|
|
29
|
+
"px-4 py-1 text-sm bg-white",
|
|
30
|
+
r.columnDef.meta?.className,
|
|
31
|
+
{
|
|
32
|
+
"[tr:last-child_&:first-of-type]:rounded-bl-lg": l === e.length - 1 && c === 0 || !a,
|
|
33
|
+
"[tr:last-child_&:last-of-type]:rounded-br-lg": l === e.length - 1 && c === m.length - 1 || !a
|
|
34
|
+
}
|
|
27
35
|
),
|
|
28
|
-
...
|
|
29
|
-
children:
|
|
36
|
+
...r.columnDef.meta?.attributes ?? {},
|
|
37
|
+
children: x(r.columnDef.cell, h())
|
|
30
38
|
},
|
|
31
|
-
|
|
39
|
+
g
|
|
32
40
|
))
|
|
33
41
|
},
|
|
34
|
-
|
|
42
|
+
s
|
|
35
43
|
);
|
|
36
44
|
}) });
|
|
37
45
|
};
|
|
38
46
|
export {
|
|
39
|
-
|
|
47
|
+
j as Body
|
|
40
48
|
};
|
|
@@ -1,32 +1,33 @@
|
|
|
1
|
-
import { jsxs as t, Fragment as
|
|
2
|
-
import { DotPaginate as
|
|
3
|
-
import { DropdownPaginate as
|
|
4
|
-
import { FormPaginate as
|
|
5
|
-
import { cn as
|
|
6
|
-
import { useTableContext as
|
|
7
|
-
import { DEFAULT_PAGE_SIZE as
|
|
8
|
-
const
|
|
1
|
+
import { jsxs as t, Fragment as p, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { DotPaginate as f } from "../DotPaginate/DotPaginate.js";
|
|
3
|
+
import { DropdownPaginate as x } from "../DropdownPaginate/DropdownPaginate.js";
|
|
4
|
+
import { FormPaginate as u } from "../FormPaginate/FormPaginate.js";
|
|
5
|
+
import { cn as g } from "../../../../utils/index.js";
|
|
6
|
+
import { useTableContext as h } from "../../contexts/table.hook.js";
|
|
7
|
+
import { DEFAULT_PAGE_SIZE as b } from "../../constants/pagination.js";
|
|
8
|
+
const D = ({
|
|
9
9
|
showTotalItems: a = !0,
|
|
10
10
|
showDropdownPagination: i = !0,
|
|
11
11
|
showDotPagination: n = !0,
|
|
12
12
|
showFormPagination: s = !0,
|
|
13
13
|
pageSizes: l,
|
|
14
|
-
classNamePagination: o
|
|
14
|
+
classNamePagination: o,
|
|
15
|
+
isLoading: m
|
|
15
16
|
}) => {
|
|
16
17
|
const {
|
|
17
18
|
totalItems: r = -1 / 0,
|
|
18
|
-
tableFetching:
|
|
19
|
-
isFirstLoad:
|
|
20
|
-
} =
|
|
21
|
-
return r <=
|
|
19
|
+
tableFetching: c,
|
|
20
|
+
isFirstLoad: d
|
|
21
|
+
} = h();
|
|
22
|
+
return r <= b || c || m ? null : /* @__PURE__ */ t(p, { children: [
|
|
22
23
|
/* @__PURE__ */ e(
|
|
23
24
|
"div",
|
|
24
25
|
{
|
|
25
|
-
className:
|
|
26
|
+
className: g(
|
|
26
27
|
"bg-slate-50 border border-y-transparent border-x-slate-100 text-slate-500 text-xs not-italic py-2 px-6 rounded-b-lg shadow",
|
|
27
28
|
o,
|
|
28
29
|
{
|
|
29
|
-
"animate-in fade-in-10": !
|
|
30
|
+
"animate-in fade-in-10": !d
|
|
30
31
|
}
|
|
31
32
|
),
|
|
32
33
|
children: /* @__PURE__ */ t("div", { className: "flex items-center justify-between", children: [
|
|
@@ -35,11 +36,11 @@ const j = ({
|
|
|
35
36
|
r,
|
|
36
37
|
" Results"
|
|
37
38
|
] }) : null,
|
|
38
|
-
i && /* @__PURE__ */ e("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ e(
|
|
39
|
+
i && /* @__PURE__ */ e("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ e(x, { pageSizes: l }) })
|
|
39
40
|
] }),
|
|
40
41
|
/* @__PURE__ */ t("div", { className: "flex items-center gap-8", children: [
|
|
41
|
-
n && /* @__PURE__ */ e(
|
|
42
|
-
s && /* @__PURE__ */ e(
|
|
42
|
+
n && /* @__PURE__ */ e(f, {}),
|
|
43
|
+
s && /* @__PURE__ */ e(u, {})
|
|
43
44
|
] })
|
|
44
45
|
] })
|
|
45
46
|
}
|
|
@@ -48,5 +49,5 @@ const j = ({
|
|
|
48
49
|
] });
|
|
49
50
|
};
|
|
50
51
|
export {
|
|
51
|
-
|
|
52
|
+
D as Pagination
|
|
52
53
|
};
|
|
@@ -1,52 +1,67 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { Button as
|
|
3
|
-
import { cn as
|
|
4
|
-
import { useTableContext as
|
|
5
|
-
import { E as
|
|
6
|
-
const
|
|
7
|
-
const { tableFetching:
|
|
8
|
-
return /* @__PURE__ */
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { Button as c } from "../../../Button/Button.js";
|
|
3
|
+
import { cn as i } from "../../../../utils/index.js";
|
|
4
|
+
import { useTableContext as h } from "../../contexts/table.hook.js";
|
|
5
|
+
import { E as g } from "../../../../ellipsis-vertical-BVPtjl5f.js";
|
|
6
|
+
const _ = ({ numberOfRows: n, table: o }) => {
|
|
7
|
+
const { tableFetching: d, tableLoading: m } = h(), e = Array.from({ length: n });
|
|
8
|
+
return /* @__PURE__ */ t("tbody", { className: "text-slate-800 text-sm font-normal relative", children: e.map((p, a) => {
|
|
9
|
+
const s = o.getAllColumns();
|
|
10
|
+
return /* @__PURE__ */ t(
|
|
11
|
+
"tr",
|
|
12
|
+
{
|
|
13
|
+
className: "border-b border-b-gray-200 bg-transparent last:border-b-transparent",
|
|
14
|
+
children: s.map((r, l) => r.id !== "actions" ? /* @__PURE__ */ t(
|
|
14
15
|
"td",
|
|
15
16
|
{
|
|
16
|
-
className:
|
|
17
|
-
|
|
17
|
+
className: i(
|
|
18
|
+
"px-4 py-1 bg-white",
|
|
19
|
+
r.columnDef.meta?.className,
|
|
20
|
+
{
|
|
21
|
+
"[tr:last-child_&:first-of-type]:rounded-bl-lg": a === e.length - 1 && l === 0,
|
|
22
|
+
"[tr:last-child_&:last-of-type]:rounded-br-lg": a === e.length - 1 && l === s.length - 1
|
|
23
|
+
}
|
|
24
|
+
),
|
|
25
|
+
children: /* @__PURE__ */ t("div", { className: "animate-in fade-in-0", children: /* @__PURE__ */ t("div", { className: "bg-gray-200 animate-pulse rounded h-5 w-full" }) })
|
|
18
26
|
},
|
|
19
|
-
`skeleton-${
|
|
20
|
-
) : /* @__PURE__ */
|
|
27
|
+
`skeleton-${r.id}`
|
|
28
|
+
) : /* @__PURE__ */ t(
|
|
21
29
|
"td",
|
|
22
30
|
{
|
|
23
|
-
className:
|
|
24
|
-
|
|
25
|
-
|
|
31
|
+
className: i(
|
|
32
|
+
"px-4 py-1 bg-white",
|
|
33
|
+
r.columnDef.meta?.className,
|
|
34
|
+
{
|
|
35
|
+
"[tr:last-child_&:first-of-type]:rounded-bl-lg": a === e.length - 1 && l === 0,
|
|
36
|
+
"[tr:last-child_&:last-of-type]:rounded-br-lg": a === e.length - 1 && l === s.length - 1
|
|
37
|
+
}
|
|
38
|
+
),
|
|
39
|
+
children: /* @__PURE__ */ t(
|
|
40
|
+
c,
|
|
26
41
|
{
|
|
27
42
|
variant: "text",
|
|
28
43
|
shape: "circle",
|
|
29
44
|
size: "large",
|
|
30
45
|
disabled: !0,
|
|
31
46
|
"aria-hidden": "true",
|
|
32
|
-
children: /* @__PURE__ */
|
|
33
|
-
|
|
47
|
+
children: /* @__PURE__ */ t(
|
|
48
|
+
g,
|
|
34
49
|
{
|
|
35
|
-
className:
|
|
36
|
-
"text-gray-300 animate-pulse":
|
|
50
|
+
className: i("w-5 h-5 text-slate-400", {
|
|
51
|
+
"text-gray-300 animate-pulse": d || m
|
|
37
52
|
})
|
|
38
53
|
}
|
|
39
54
|
)
|
|
40
55
|
}
|
|
41
56
|
)
|
|
42
57
|
},
|
|
43
|
-
`skeleton-${
|
|
44
|
-
)
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
)
|
|
58
|
+
`skeleton-${r.id}`
|
|
59
|
+
))
|
|
60
|
+
},
|
|
61
|
+
`skeleton-row-${a}`
|
|
62
|
+
);
|
|
63
|
+
}) });
|
|
49
64
|
};
|
|
50
65
|
export {
|
|
51
|
-
|
|
66
|
+
_ as Skeleton
|
|
52
67
|
};
|