@konstructio/ui 0.1.2-alpha.3 → 0.1.2-alpha.5
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/{Modal-V67Uz78z.js → Modal-D-NOEWMX.js} +3 -3
- package/dist/_commonjsHelpers-DaMA6jEr.js +8 -0
- package/dist/{chevron-down-BLZPftpV.js → chevron-down-MZvQoT2F.js} +2 -2
- package/dist/chevron-right-VYBOBhRt.js +19 -0
- package/dist/components/Alert/Alert.js +2 -2
- package/dist/components/AlertDialog/AlertDialog.js +1 -1
- package/dist/components/AlertDialog/components/AlertDialogTrigger.js +1 -1
- package/dist/components/AlertDialog/components/index.js +1 -1
- package/dist/components/Badge/Badge.js +2 -2
- package/dist/components/Breadcrumb/Breadcrumb.js +1 -1
- package/dist/components/Breadcrumb/components/Item/Item.js +16 -15
- package/dist/components/Checkbox/Checkbox.js +5 -4
- package/dist/components/Command/Command.js +2 -2
- package/dist/components/Command/components/Command.js +1 -1
- package/dist/components/Command/components/CommandEmpty.js +1 -1
- package/dist/components/Command/components/CommandGroup.js +1 -1
- package/dist/components/Command/components/CommandInput.js +2 -2
- package/dist/components/Command/components/CommandItem.js +1 -1
- package/dist/components/Command/components/CommandList.js +1 -1
- package/dist/components/Command/components/CommandSeparator.js +1 -1
- package/dist/components/Command/components/DialogContent.js +2 -2
- package/dist/components/Command/components/DialogOverlay.js +1 -1
- package/dist/components/Datepicker/DatePicker.js +545 -543
- package/dist/components/Dropdown/Dropdown.js +36 -24
- package/dist/components/Dropdown/Dropdown.variants.js +25 -7
- package/dist/components/Dropdown/components/List/List.js +59 -44
- package/dist/components/Dropdown/components/List/List.variants.js +9 -7
- package/dist/components/Dropdown/components/ListItem/ListItem.js +48 -24
- package/dist/components/Dropdown/components/ListItem/ListItem.variants.js +9 -7
- package/dist/components/Dropdown/components/Wrapper.js +141 -106
- package/dist/components/Dropdown/contexts/dropdown.context.js +9 -8
- package/dist/components/Dropdown/contexts/dropdown.provider.js +20 -19
- package/dist/components/Dropdown/hooks/useDropdown.js +26 -27
- package/dist/components/Dropdown/hooks/useNavigationList.js +32 -28
- package/dist/components/DropdownButton/DropdownButton.js +1 -1
- package/dist/components/Filter/components/BadgeDropdown/BadgeMultiSelect.js +1 -1
- package/dist/components/Filter/components/DateFilterDropdown/DateFilterDropdown.js +1 -1
- package/dist/components/Input/Input.js +1 -1
- package/dist/components/Loading/Loading.js +2 -2
- package/dist/components/Modal/Modal.js +2 -2
- package/dist/components/Modal/components/Wrapper/Wrapper.js +3 -3
- package/dist/components/Modal/components/index.js +1 -1
- package/dist/components/NumberInput/NumberInput.js +2 -2
- package/dist/components/PieChart/PieChart.js +217 -215
- package/dist/components/Range/Range.js +1 -1
- package/dist/components/Sidebar/components/Wrapper/Wrapper.js +29 -28
- package/dist/components/Slider/Slider.js +1 -1
- package/dist/components/Switch/Switch.js +6 -5
- package/dist/components/Tabs/Tabs.js +1 -1
- package/dist/components/Tabs/Tabs.variants.js +45 -24
- package/dist/components/Tabs/components/Content.js +1 -1
- package/dist/components/Tabs/components/List.js +1 -1
- package/dist/components/Tabs/components/Trigger.js +9 -8
- package/dist/components/TagSelect/components/Wrapper/Wrapper.js +98 -49
- package/dist/components/TimePicker/components/Wrapper/Wrapper.js +1 -1
- package/dist/components/Toast/Toast.js +8 -7
- package/dist/components/VirtualizedTable/VirtualizedTable.js +99 -0
- package/dist/components/VirtualizedTable/VirtualizedTable.variants.js +5 -0
- package/dist/components/VirtualizedTable/assets/chevron-down.js +25 -0
- package/dist/components/VirtualizedTable/assets/chevron-up.js +25 -0
- package/dist/components/VirtualizedTable/assets/index.js +6 -0
- package/dist/components/VirtualizedTable/components/Actions/Actions.js +46 -0
- package/dist/components/VirtualizedTable/components/Body/Body.js +25 -0
- package/dist/components/VirtualizedTable/components/DotPaginate/DotPaginate.js +165 -0
- package/dist/components/VirtualizedTable/components/DropdownPaginate/DropdownPaginate.js +34 -0
- package/dist/components/VirtualizedTable/components/Filter/Filter.js +73 -0
- package/dist/components/VirtualizedTable/components/FormPaginate/FormPaginate.js +48 -0
- package/dist/components/VirtualizedTable/components/Header/Header.js +82 -0
- package/dist/components/VirtualizedTable/components/Pagination/Pagination.js +45 -0
- package/dist/components/VirtualizedTable/components/TruncateText/TruncateText.js +1870 -0
- package/dist/components/VirtualizedTable/components/index.js +14 -0
- package/dist/components/VirtualizedTable/constants/index.js +5 -0
- package/dist/components/VirtualizedTable/constants/pagination.js +5 -0
- package/dist/components/VirtualizedTable/contexts/index.js +8 -0
- package/dist/components/VirtualizedTable/contexts/table.context.js +31 -0
- package/dist/components/VirtualizedTable/contexts/table.hook.js +11 -0
- package/dist/components/VirtualizedTable/contexts/table.provider.js +778 -0
- package/dist/components/index.js +44 -40
- package/dist/{createLucideIcon-DbC6TvM5.js → createLucideIcon-D2CN7Ma9.js} +4 -4
- package/dist/debounce-BFejQm9P.js +200 -0
- package/dist/{index-D3xzCzcO.js → index-B7t8D14s.js} +2 -2
- package/dist/index-BAEWsOG1.js +27 -0
- package/dist/{index-C9T9HQaa.js → index-BITvcJAz.js} +1 -1
- package/dist/index-BZPx6jYI.js +8 -0
- package/dist/{index-BAraV3ai.js → index-Bnb0ezr3.js} +1 -1
- package/dist/{index-DB2XhXHn.js → index-C84F4YyO.js} +11 -10
- package/dist/index-Cd2vhaop.js +137 -0
- package/dist/{index-iXyXtdgP.js → index-DBbEcSUG.js} +1 -1
- package/dist/index-Dx2grAuN.js +1742 -0
- package/dist/{index-BXuxPoz7.js → index-DzIBBMjs.js} +18 -17
- package/dist/{index-h-Ul0anl.js → index-N2OStZoU.js} +1 -1
- package/dist/{index-Oq5GlCHP.js → index-os7vysFS.js} +1 -1
- package/dist/index-ti1b9kqV.js +14 -0
- package/dist/index.d.ts +94 -5
- package/dist/index.js +41 -37
- package/dist/package.json +26 -22
- package/dist/styles.css +1 -1
- package/dist/{x-BPcqkRZd.js → x-4F_5p77m.js} +1 -1
- package/package.json +26 -22
- package/dist/_commonjsHelpers-C6fGbg64.js +0 -6
- package/dist/chevron-up-RLP4nX7V.js +0 -54
- package/dist/index-CZnD2QxM.js +0 -32
- package/dist/index-CrBonFvu.js +0 -144
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
+
const l = ({
|
|
3
|
+
className: t,
|
|
4
|
+
onClick: e
|
|
5
|
+
}) => /* @__PURE__ */ o(
|
|
6
|
+
"svg",
|
|
7
|
+
{
|
|
8
|
+
width: "7",
|
|
9
|
+
height: "5",
|
|
10
|
+
viewBox: "0 0 7 5",
|
|
11
|
+
fill: "none",
|
|
12
|
+
className: t,
|
|
13
|
+
onClick: e,
|
|
14
|
+
children: /* @__PURE__ */ o(
|
|
15
|
+
"path",
|
|
16
|
+
{
|
|
17
|
+
d: "M0.8225 0L3.5 2.67167L6.1775 0L7 0.8225L3.5 4.3225L0 0.8225L0.8225 0Z",
|
|
18
|
+
fill: "currentColor"
|
|
19
|
+
}
|
|
20
|
+
)
|
|
21
|
+
}
|
|
22
|
+
);
|
|
23
|
+
export {
|
|
24
|
+
l as default
|
|
25
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
+
const l = ({
|
|
3
|
+
className: r,
|
|
4
|
+
onClick: t
|
|
5
|
+
}) => /* @__PURE__ */ o(
|
|
6
|
+
"svg",
|
|
7
|
+
{
|
|
8
|
+
width: "7",
|
|
9
|
+
height: "5",
|
|
10
|
+
viewBox: "0 0 7 5",
|
|
11
|
+
fill: "currentColor",
|
|
12
|
+
className: r,
|
|
13
|
+
onClick: t,
|
|
14
|
+
children: /* @__PURE__ */ o(
|
|
15
|
+
"path",
|
|
16
|
+
{
|
|
17
|
+
d: "M0.8225 4.99999L3.5 2.32832L6.1775 4.99999L7 4.17749L3.5 0.67749L0 4.17749L0.8225 4.99999Z",
|
|
18
|
+
fill: "currentColor"
|
|
19
|
+
}
|
|
20
|
+
)
|
|
21
|
+
}
|
|
22
|
+
);
|
|
23
|
+
export {
|
|
24
|
+
l as default
|
|
25
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { jsxs as l, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { Button as r } from "../../../Button/Button.js";
|
|
3
|
+
import { c } from "../../../../createLucideIcon-D2CN7Ma9.js";
|
|
4
|
+
/**
|
|
5
|
+
* @license lucide-react v0.545.0 - ISC
|
|
6
|
+
*
|
|
7
|
+
* This source code is licensed under the ISC license.
|
|
8
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
9
|
+
*/
|
|
10
|
+
const s = [
|
|
11
|
+
["circle", { cx: "12", cy: "12", r: "1", key: "41hilf" }],
|
|
12
|
+
["circle", { cx: "12", cy: "5", r: "1", key: "gxeob9" }],
|
|
13
|
+
["circle", { cx: "12", cy: "19", r: "1", key: "lyex9k" }]
|
|
14
|
+
], n = c("ellipsis-vertical", s), u = ({
|
|
15
|
+
actions: t,
|
|
16
|
+
...o
|
|
17
|
+
}) => t ? /* @__PURE__ */ l("div", { className: "relative group w-fit", children: [
|
|
18
|
+
/* @__PURE__ */ l(
|
|
19
|
+
r,
|
|
20
|
+
{
|
|
21
|
+
variant: "text",
|
|
22
|
+
shape: "circle",
|
|
23
|
+
size: "large",
|
|
24
|
+
className: "text-slate-400 group-hover:text-slate-800 group-hover:bg-aurora-50",
|
|
25
|
+
role: "presentation",
|
|
26
|
+
children: [
|
|
27
|
+
/* @__PURE__ */ e(n, { "aria-hidden": "true", className: "w-7 h-7" }),
|
|
28
|
+
/* @__PURE__ */ e("span", { className: "sr-only", children: "Show Actions" })
|
|
29
|
+
]
|
|
30
|
+
}
|
|
31
|
+
),
|
|
32
|
+
/* @__PURE__ */ e("div", { className: "absolute top-full right-0 w-[215px] hidden group-hover:block z-10", children: /* @__PURE__ */ e("div", { className: "bg-white mt-0.5 py-2 rounded-lg shadow-lg border border-zinc-100 animate-in fade-in-0", children: t.map(({ label: i, onClick: a }) => /* @__PURE__ */ e(
|
|
33
|
+
r,
|
|
34
|
+
{
|
|
35
|
+
className: "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",
|
|
36
|
+
variant: "text",
|
|
37
|
+
asChild: !0,
|
|
38
|
+
role: "presentation",
|
|
39
|
+
children: /* @__PURE__ */ e(r, { onClick: () => a(o.row.original), children: i })
|
|
40
|
+
},
|
|
41
|
+
i
|
|
42
|
+
)) }) })
|
|
43
|
+
] }) : null;
|
|
44
|
+
export {
|
|
45
|
+
u as Actions
|
|
46
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { f as d } from "../../../../index-Dx2grAuN.js";
|
|
3
|
+
import { useTableContext as m } from "../../contexts/table.hook.js";
|
|
4
|
+
const p = () => {
|
|
5
|
+
const { table: r } = m();
|
|
6
|
+
return /* @__PURE__ */ e("tbody", { className: "text-slate-800 text-sm font-normal relative", children: r.getRowModel().rows.map(({ id: a, getVisibleCells: o }) => /* @__PURE__ */ e(
|
|
7
|
+
"tr",
|
|
8
|
+
{
|
|
9
|
+
className: "border border-x-transparent border-t-gray-200 border-b-transparent table w-full table-fixed",
|
|
10
|
+
children: o().map(({ id: l, column: t, getContext: s }) => /* @__PURE__ */ e(
|
|
11
|
+
"td",
|
|
12
|
+
{
|
|
13
|
+
className: "px-4 py-1 text-sm",
|
|
14
|
+
style: { width: t.getSize() },
|
|
15
|
+
children: d(t.columnDef.cell, s())
|
|
16
|
+
},
|
|
17
|
+
l
|
|
18
|
+
))
|
|
19
|
+
},
|
|
20
|
+
a
|
|
21
|
+
)) });
|
|
22
|
+
};
|
|
23
|
+
export {
|
|
24
|
+
p as Body
|
|
25
|
+
};
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import { jsx as i, jsxs as m } from "react/jsx-runtime";
|
|
2
|
+
import { memo as u } from "react";
|
|
3
|
+
import { cn as p } from "../../../../utils/index.js";
|
|
4
|
+
import { C as g, a as d } from "../../../../chevron-right-VYBOBhRt.js";
|
|
5
|
+
import { useTableContext as f } from "../../contexts/table.hook.js";
|
|
6
|
+
const r = u(
|
|
7
|
+
({
|
|
8
|
+
index: e,
|
|
9
|
+
currentPage: t,
|
|
10
|
+
handlePage: l
|
|
11
|
+
}) => /* @__PURE__ */ i("li", { children: /* @__PURE__ */ i(
|
|
12
|
+
"button",
|
|
13
|
+
{
|
|
14
|
+
type: "button",
|
|
15
|
+
onClick: () => l(e),
|
|
16
|
+
className: p("px-2.5 py-1 rounded-lg text-blue-600 cursor-pointer", {
|
|
17
|
+
"bg-blue-600 text-white": e === t
|
|
18
|
+
}),
|
|
19
|
+
children: e + 1
|
|
20
|
+
}
|
|
21
|
+
) }, e)
|
|
22
|
+
);
|
|
23
|
+
r.displayName = "PageButton";
|
|
24
|
+
const o = u(({ keyValue: e }) => /* @__PURE__ */ i("li", { className: "px-2", children: /* @__PURE__ */ i("span", { className: "text-blue-600 select-none", children: "..." }) }, e));
|
|
25
|
+
o.displayName = "Ellipsis";
|
|
26
|
+
const a = u(
|
|
27
|
+
({
|
|
28
|
+
direction: e,
|
|
29
|
+
onClick: t,
|
|
30
|
+
disabled: l
|
|
31
|
+
}) => /* @__PURE__ */ i("li", { className: "flex items-center justify-center", children: /* @__PURE__ */ i("button", { onClick: t, disabled: l, children: /* @__PURE__ */ i(
|
|
32
|
+
e === "left" ? g : d,
|
|
33
|
+
{
|
|
34
|
+
className: p("h-6 w-6 cursor-pointer", {
|
|
35
|
+
"text-blue-600": !l,
|
|
36
|
+
"text-slate-400 cursor-not-allowed": l
|
|
37
|
+
})
|
|
38
|
+
}
|
|
39
|
+
) }) })
|
|
40
|
+
);
|
|
41
|
+
a.displayName = "NavigationButton";
|
|
42
|
+
const k = () => {
|
|
43
|
+
const { totalPages: e, page: t, handlePage: l } = f();
|
|
44
|
+
return /* @__PURE__ */ m("ul", { className: "flex items-center gap-2", children: [
|
|
45
|
+
/* @__PURE__ */ i(
|
|
46
|
+
a,
|
|
47
|
+
{
|
|
48
|
+
direction: "left",
|
|
49
|
+
onClick: () => l(t - 1),
|
|
50
|
+
disabled: t === 0
|
|
51
|
+
}
|
|
52
|
+
),
|
|
53
|
+
(() => {
|
|
54
|
+
if (e <= 5)
|
|
55
|
+
return Array.from({ length: e }, (s, c) => /* @__PURE__ */ i(
|
|
56
|
+
r,
|
|
57
|
+
{
|
|
58
|
+
index: c,
|
|
59
|
+
currentPage: t,
|
|
60
|
+
handlePage: l
|
|
61
|
+
},
|
|
62
|
+
c
|
|
63
|
+
));
|
|
64
|
+
const n = [];
|
|
65
|
+
if (t < 3) {
|
|
66
|
+
for (let s = 0; s < 3; s++)
|
|
67
|
+
n.push(
|
|
68
|
+
/* @__PURE__ */ i(
|
|
69
|
+
r,
|
|
70
|
+
{
|
|
71
|
+
index: s,
|
|
72
|
+
currentPage: t,
|
|
73
|
+
handlePage: l
|
|
74
|
+
},
|
|
75
|
+
s
|
|
76
|
+
)
|
|
77
|
+
);
|
|
78
|
+
n.push(/* @__PURE__ */ i(o, { keyValue: "ellipsis" }, "ellipsis"));
|
|
79
|
+
for (let s = e - 2; s < e; s++)
|
|
80
|
+
n.push(
|
|
81
|
+
/* @__PURE__ */ i(
|
|
82
|
+
r,
|
|
83
|
+
{
|
|
84
|
+
index: s,
|
|
85
|
+
currentPage: t,
|
|
86
|
+
handlePage: l
|
|
87
|
+
},
|
|
88
|
+
s
|
|
89
|
+
)
|
|
90
|
+
);
|
|
91
|
+
} else if (t >= e - 5) {
|
|
92
|
+
n.push(
|
|
93
|
+
/* @__PURE__ */ i(
|
|
94
|
+
r,
|
|
95
|
+
{
|
|
96
|
+
index: 0,
|
|
97
|
+
currentPage: t,
|
|
98
|
+
handlePage: l
|
|
99
|
+
},
|
|
100
|
+
0
|
|
101
|
+
)
|
|
102
|
+
), e > 6 && n.push(/* @__PURE__ */ i(o, { keyValue: "ellipsis" }, "ellipsis"));
|
|
103
|
+
for (let s = Math.max(1, e - 5); s < e; s++)
|
|
104
|
+
n.push(
|
|
105
|
+
/* @__PURE__ */ i(
|
|
106
|
+
r,
|
|
107
|
+
{
|
|
108
|
+
index: s,
|
|
109
|
+
currentPage: t,
|
|
110
|
+
handlePage: l
|
|
111
|
+
},
|
|
112
|
+
s
|
|
113
|
+
)
|
|
114
|
+
);
|
|
115
|
+
} else {
|
|
116
|
+
n.push(
|
|
117
|
+
/* @__PURE__ */ i(
|
|
118
|
+
r,
|
|
119
|
+
{
|
|
120
|
+
index: 0,
|
|
121
|
+
currentPage: t,
|
|
122
|
+
handlePage: l
|
|
123
|
+
},
|
|
124
|
+
0
|
|
125
|
+
)
|
|
126
|
+
), t > 3 && n.push(/* @__PURE__ */ i(o, { keyValue: "ellipsis1" }, "ellipsis1"));
|
|
127
|
+
for (let s = t - 1; s <= t + 1; s++)
|
|
128
|
+
s > 0 && s < e - 1 && n.push(
|
|
129
|
+
/* @__PURE__ */ i(
|
|
130
|
+
r,
|
|
131
|
+
{
|
|
132
|
+
index: s,
|
|
133
|
+
currentPage: t,
|
|
134
|
+
handlePage: l
|
|
135
|
+
},
|
|
136
|
+
s
|
|
137
|
+
)
|
|
138
|
+
);
|
|
139
|
+
t < e - 4 && n.push(/* @__PURE__ */ i(o, { keyValue: "ellipsis2" }, "ellipsis2")), n.push(
|
|
140
|
+
/* @__PURE__ */ i(
|
|
141
|
+
r,
|
|
142
|
+
{
|
|
143
|
+
index: e - 1,
|
|
144
|
+
currentPage: t,
|
|
145
|
+
handlePage: l
|
|
146
|
+
},
|
|
147
|
+
e - 1
|
|
148
|
+
)
|
|
149
|
+
);
|
|
150
|
+
}
|
|
151
|
+
return n;
|
|
152
|
+
})(),
|
|
153
|
+
/* @__PURE__ */ i(
|
|
154
|
+
a,
|
|
155
|
+
{
|
|
156
|
+
direction: "right",
|
|
157
|
+
onClick: () => l(t + 1),
|
|
158
|
+
disabled: t >= e - 1
|
|
159
|
+
}
|
|
160
|
+
)
|
|
161
|
+
] });
|
|
162
|
+
};
|
|
163
|
+
export {
|
|
164
|
+
k as DotPaginate
|
|
165
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { jsxs as i, jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo as p, useCallback as l } from "react";
|
|
3
|
+
import { Dropdown as c } from "../../../Dropdown/Dropdown.js";
|
|
4
|
+
import { DEFAULT_PAGE_SIZES as g } from "../../constants/pagination.js";
|
|
5
|
+
import { useTableContext as x } from "../../contexts/table.hook.js";
|
|
6
|
+
const b = ({
|
|
7
|
+
pageSizes: n = g
|
|
8
|
+
}) => {
|
|
9
|
+
const { pageSize: s, onPageSize: o, handlePage: t } = x(), r = p(
|
|
10
|
+
() => n.map(String).map((e) => ({ label: e, value: e })),
|
|
11
|
+
[]
|
|
12
|
+
), m = l(
|
|
13
|
+
(e) => {
|
|
14
|
+
o(Number(e)), t(0);
|
|
15
|
+
},
|
|
16
|
+
[t, o]
|
|
17
|
+
);
|
|
18
|
+
return /* @__PURE__ */ i("div", { className: "flex items-center gap-2", children: [
|
|
19
|
+
/* @__PURE__ */ a("span", { children: "Show" }),
|
|
20
|
+
/* @__PURE__ */ a(
|
|
21
|
+
c,
|
|
22
|
+
{
|
|
23
|
+
className: "w-[88px] [&>div>p]:text-xs bg-white",
|
|
24
|
+
listItemClassName: "[&>p]:text-xs",
|
|
25
|
+
options: r,
|
|
26
|
+
value: s.toString(),
|
|
27
|
+
onChange: ({ target: e }) => m(e.value)
|
|
28
|
+
}
|
|
29
|
+
)
|
|
30
|
+
] });
|
|
31
|
+
};
|
|
32
|
+
export {
|
|
33
|
+
b as DropdownPaginate
|
|
34
|
+
};
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { jsxs as m, jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import { d as M } from "../../../../debounce-BFejQm9P.js";
|
|
3
|
+
import { useRef as j, useCallback as u, useMemo as f } from "react";
|
|
4
|
+
import { Filter as n } from "../../../Filter/Filter.js";
|
|
5
|
+
import { Input as v } from "../../../Input/Input.js";
|
|
6
|
+
import { useTableContext as O } from "../../contexts/table.hook.js";
|
|
7
|
+
const B = ({
|
|
8
|
+
placeholder: h,
|
|
9
|
+
multiSelectFilter: d,
|
|
10
|
+
showFilterInput: p = !0
|
|
11
|
+
}) => {
|
|
12
|
+
const r = j(null), {
|
|
13
|
+
termOfSearch: o,
|
|
14
|
+
multiselectSelected: c,
|
|
15
|
+
onChangeTermOfSearch: t,
|
|
16
|
+
onSelectMultiselect: i
|
|
17
|
+
} = O(), g = u(
|
|
18
|
+
(e, l) => i(
|
|
19
|
+
e,
|
|
20
|
+
l.map((s) => s.id)
|
|
21
|
+
),
|
|
22
|
+
[i]
|
|
23
|
+
), x = u(() => {
|
|
24
|
+
t(""), r.current && (r.current.value = "");
|
|
25
|
+
}, [t]), C = f(
|
|
26
|
+
() => M((e) => {
|
|
27
|
+
t(e.target.value);
|
|
28
|
+
}, 500),
|
|
29
|
+
[t]
|
|
30
|
+
), S = f(
|
|
31
|
+
() => !!o || Object.entries(c ?? {}).map(([, e]) => e).flat().length > 0,
|
|
32
|
+
[o, c]
|
|
33
|
+
);
|
|
34
|
+
return /* @__PURE__ */ m("div", { className: "w-full flex items-center justify-end pb-6", children: [
|
|
35
|
+
p && /* @__PURE__ */ a(
|
|
36
|
+
v,
|
|
37
|
+
{
|
|
38
|
+
ref: r,
|
|
39
|
+
placeholder: h,
|
|
40
|
+
isSearch: !0,
|
|
41
|
+
autoComplete: "false",
|
|
42
|
+
className: "w-72",
|
|
43
|
+
inputMode: "search",
|
|
44
|
+
onChange: C
|
|
45
|
+
}
|
|
46
|
+
),
|
|
47
|
+
/* @__PURE__ */ m(n, { children: [
|
|
48
|
+
d?.map(
|
|
49
|
+
({ key: e, label: l, position: s = "right", options: b }) => /* @__PURE__ */ a(
|
|
50
|
+
n.BadgeMultiSelect,
|
|
51
|
+
{
|
|
52
|
+
label: l,
|
|
53
|
+
position: s,
|
|
54
|
+
options: b,
|
|
55
|
+
onApply: (F) => g(e, F)
|
|
56
|
+
},
|
|
57
|
+
l
|
|
58
|
+
)
|
|
59
|
+
),
|
|
60
|
+
/* @__PURE__ */ a(
|
|
61
|
+
n.ResetButton,
|
|
62
|
+
{
|
|
63
|
+
className: "text-slate-700 hover:text-slate-700 disabled:text-slate-700/45 select-none",
|
|
64
|
+
disabled: !S,
|
|
65
|
+
onClick: x
|
|
66
|
+
}
|
|
67
|
+
)
|
|
68
|
+
] })
|
|
69
|
+
] });
|
|
70
|
+
};
|
|
71
|
+
export {
|
|
72
|
+
B as Filter
|
|
73
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { jsxs as i, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as l, useCallback as p } from "react";
|
|
3
|
+
import { Input as c } from "../../../Input/Input.js";
|
|
4
|
+
import { useTableContext as f } from "../../contexts/table.hook.js";
|
|
5
|
+
const h = () => {
|
|
6
|
+
const r = l(null), { totalPages: e, handlePage: o } = f(), m = p(
|
|
7
|
+
(n) => {
|
|
8
|
+
n.preventDefault();
|
|
9
|
+
const s = new FormData(n.currentTarget), a = Number(s.get("jump-to")), u = (a < e ? a : e) || 1;
|
|
10
|
+
o(u - 1), r.current?.reset();
|
|
11
|
+
},
|
|
12
|
+
[o, e]
|
|
13
|
+
);
|
|
14
|
+
return /* @__PURE__ */ i(
|
|
15
|
+
"form",
|
|
16
|
+
{
|
|
17
|
+
"aria-label": "footer-pagination",
|
|
18
|
+
ref: r,
|
|
19
|
+
onSubmit: m,
|
|
20
|
+
className: "flex items-center gap-2",
|
|
21
|
+
children: [
|
|
22
|
+
/* @__PURE__ */ t("span", { className: "min-w-fit", children: "Jump to" }),
|
|
23
|
+
/* @__PURE__ */ t(
|
|
24
|
+
c,
|
|
25
|
+
{
|
|
26
|
+
type: "number",
|
|
27
|
+
className: "w-[72px] text-xs no-spinner",
|
|
28
|
+
name: "jump-to",
|
|
29
|
+
min: 1,
|
|
30
|
+
max: e,
|
|
31
|
+
required: !0
|
|
32
|
+
}
|
|
33
|
+
),
|
|
34
|
+
/* @__PURE__ */ t(
|
|
35
|
+
"button",
|
|
36
|
+
{
|
|
37
|
+
type: "submit",
|
|
38
|
+
className: "text-xs text-blue-600 p-2 cursor-pointer",
|
|
39
|
+
children: "Go"
|
|
40
|
+
}
|
|
41
|
+
)
|
|
42
|
+
]
|
|
43
|
+
}
|
|
44
|
+
);
|
|
45
|
+
};
|
|
46
|
+
export {
|
|
47
|
+
h as FormPaginate
|
|
48
|
+
};
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { jsx as s, jsxs as a } from "react/jsx-runtime";
|
|
2
|
+
import { f as u } from "../../../../index-Dx2grAuN.js";
|
|
3
|
+
import { useCallback as i } from "react";
|
|
4
|
+
import { cn as o } from "../../../../utils/index.js";
|
|
5
|
+
import b from "../../assets/chevron-up.js";
|
|
6
|
+
import g from "../../assets/chevron-down.js";
|
|
7
|
+
import { useTableContext as S } from "../../contexts/table.hook.js";
|
|
8
|
+
const y = ({
|
|
9
|
+
className: p,
|
|
10
|
+
classNameArrows: n,
|
|
11
|
+
classNameActiveArrows: l
|
|
12
|
+
}) => {
|
|
13
|
+
const { table: c, onSorting: r } = S(), d = i(
|
|
14
|
+
(t) => r([{ id: t.id, desc: !1 }]),
|
|
15
|
+
[r]
|
|
16
|
+
), x = i(
|
|
17
|
+
(t) => r([{ id: t.id, desc: !0 }]),
|
|
18
|
+
[r]
|
|
19
|
+
);
|
|
20
|
+
return /* @__PURE__ */ s(
|
|
21
|
+
"thead",
|
|
22
|
+
{
|
|
23
|
+
className: o(
|
|
24
|
+
"font-semibold uppercase text-slate-500 text-xs not-italic bg-slate-100 w-full relative block overflow-hidden [clip-path:inset(-1px_-1px_0px_-1px_round_8px_8px_0px_0px)]",
|
|
25
|
+
p
|
|
26
|
+
),
|
|
27
|
+
children: c.getHeaderGroups().map(({ id: t, headers: f }) => /* @__PURE__ */ s("tr", { className: "table w-full table-fixed", children: f.map(({ id: m, column: e, getContext: h }) => /* @__PURE__ */ s(
|
|
28
|
+
"th",
|
|
29
|
+
{
|
|
30
|
+
scope: "col",
|
|
31
|
+
className: "px-4 py-3 text-left text-xs",
|
|
32
|
+
style: { width: e.columnDef.size },
|
|
33
|
+
children: /* @__PURE__ */ a("span", { className: "flex items-center gap-2 w-full", children: [
|
|
34
|
+
u(e.columnDef.header, h()),
|
|
35
|
+
e.getCanSort() && /* @__PURE__ */ a(
|
|
36
|
+
"div",
|
|
37
|
+
{
|
|
38
|
+
className: o(
|
|
39
|
+
"flex flex-col text-slate-400 justify-center items-center gap-1",
|
|
40
|
+
n
|
|
41
|
+
),
|
|
42
|
+
role: "presentation",
|
|
43
|
+
children: [
|
|
44
|
+
/* @__PURE__ */ s(
|
|
45
|
+
b,
|
|
46
|
+
{
|
|
47
|
+
className: o(
|
|
48
|
+
"w-2 h-2 cursor-pointer",
|
|
49
|
+
{
|
|
50
|
+
"text-blue-600": e.getIsSorted() === "asc"
|
|
51
|
+
},
|
|
52
|
+
l
|
|
53
|
+
),
|
|
54
|
+
onClick: () => d(e)
|
|
55
|
+
}
|
|
56
|
+
),
|
|
57
|
+
/* @__PURE__ */ s(
|
|
58
|
+
g,
|
|
59
|
+
{
|
|
60
|
+
className: o(
|
|
61
|
+
"w-2 h-2 cursor-pointer",
|
|
62
|
+
{
|
|
63
|
+
"text-blue-600": e.getIsSorted() === "desc"
|
|
64
|
+
},
|
|
65
|
+
l
|
|
66
|
+
),
|
|
67
|
+
onClick: () => x(e)
|
|
68
|
+
}
|
|
69
|
+
)
|
|
70
|
+
]
|
|
71
|
+
}
|
|
72
|
+
)
|
|
73
|
+
] })
|
|
74
|
+
},
|
|
75
|
+
m
|
|
76
|
+
)) }, t))
|
|
77
|
+
}
|
|
78
|
+
);
|
|
79
|
+
};
|
|
80
|
+
export {
|
|
81
|
+
y as Header
|
|
82
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { jsxs as t, Fragment as c, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { DotPaginate as d } from "../DotPaginate/DotPaginate.js";
|
|
3
|
+
import { DropdownPaginate as p } from "../DropdownPaginate/DropdownPaginate.js";
|
|
4
|
+
import { FormPaginate as f } from "../FormPaginate/FormPaginate.js";
|
|
5
|
+
import { cn as x } from "../../../../utils/index.js";
|
|
6
|
+
import { useTableContext as u } from "../../contexts/table.hook.js";
|
|
7
|
+
import { DEFAULT_PAGE_SIZE as g } from "../../constants/pagination.js";
|
|
8
|
+
const F = ({
|
|
9
|
+
showTotalItems: a = !0,
|
|
10
|
+
showDropdownPagination: i = !0,
|
|
11
|
+
showDotPagination: n = !0,
|
|
12
|
+
showFormPagination: s = !0,
|
|
13
|
+
pageSizes: l,
|
|
14
|
+
classNamePagination: o
|
|
15
|
+
}) => {
|
|
16
|
+
const { totalItems: r = -1 / 0, tableFetching: m } = u();
|
|
17
|
+
return r <= g || m ? null : /* @__PURE__ */ t(c, { children: [
|
|
18
|
+
/* @__PURE__ */ e(
|
|
19
|
+
"div",
|
|
20
|
+
{
|
|
21
|
+
className: x(
|
|
22
|
+
"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",
|
|
23
|
+
o
|
|
24
|
+
),
|
|
25
|
+
children: /* @__PURE__ */ t("div", { className: "flex items-center justify-between", children: [
|
|
26
|
+
/* @__PURE__ */ t("div", { className: "flex items-center gap-6", children: [
|
|
27
|
+
r && a ? /* @__PURE__ */ t("span", { className: "text-slate-800", children: [
|
|
28
|
+
r,
|
|
29
|
+
" Results"
|
|
30
|
+
] }) : null,
|
|
31
|
+
i && /* @__PURE__ */ e("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ e(p, { pageSizes: l }) })
|
|
32
|
+
] }),
|
|
33
|
+
/* @__PURE__ */ t("div", { className: "flex items-center gap-8", children: [
|
|
34
|
+
n && /* @__PURE__ */ e(d, {}),
|
|
35
|
+
s && /* @__PURE__ */ e(f, {})
|
|
36
|
+
] })
|
|
37
|
+
] })
|
|
38
|
+
}
|
|
39
|
+
),
|
|
40
|
+
/* @__PURE__ */ e("div", { className: "w-full min-h-[150px]" })
|
|
41
|
+
] });
|
|
42
|
+
};
|
|
43
|
+
export {
|
|
44
|
+
F as Pagination
|
|
45
|
+
};
|