@empreint/ui 1.2.3 → 1.5.0
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/badge/badge.js +12 -0
- package/dist/components/badge/badge.module.js +4 -0
- package/dist/components/breadcrumb/breadcrumb.module.js +7 -6
- package/dist/components/button/button.module.js +3 -2
- package/dist/components/card/card.module.js +7 -6
- package/dist/components/checkbox/checkbox.module.js +6 -5
- package/dist/components/chip/chip.module.js +5 -4
- package/dist/components/collapsible/collapsible.module.js +8 -7
- package/dist/components/container/container.module.js +3 -2
- package/dist/components/dropdown-menu/dropdown-menu.module.js +6 -5
- package/dist/components/dropzone/dropzone.module.js +8 -7
- package/dist/components/filters/filters.js +29 -0
- package/dist/components/filters/filters.module.js +10 -0
- package/dist/components/flex/flex.module.js +3 -2
- package/dist/components/grid/grid.module.js +3 -2
- package/dist/components/input/input.module.js +7 -6
- package/dist/components/language-selector/language-selector.module.js +3 -2
- package/dist/components/list/list.module.js +5 -4
- package/dist/components/loader/loader.module.js +7 -6
- package/dist/components/modal/modal.module.js +9 -8
- package/dist/components/pagination/pagination.module.js +5 -4
- package/dist/components/popover/popover.module.js +6 -5
- package/dist/components/radio-group/radio-group.module.js +7 -6
- package/dist/components/select/select.module.js +9 -8
- package/dist/components/separator/separator.module.js +3 -2
- package/dist/components/sidebar/sidebar.module.js +8 -7
- package/dist/components/table/table.js +39 -38
- package/dist/components/table/table.module.js +10 -8
- package/dist/components/tabs/tabs.module.js +7 -6
- package/dist/components/text/text.module.js +3 -2
- package/dist/components/title/title.module.js +3 -2
- package/dist/components/wizard/wizard.module.js +8 -7
- package/dist/hooks/use-filters/use-filters.js +23 -0
- package/dist/hooks/use-sort/use-sort.js +25 -0
- package/dist/index.d.ts +77 -26
- package/dist/index.js +42 -38
- package/dist/styles.css +1 -1
- package/package.json +22 -21
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import e from "./badge.module.js";
|
|
2
|
+
import t from "clsx";
|
|
3
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
4
|
+
//#region src/components/badge/badge.tsx
|
|
5
|
+
var r = ({ children: r, variant: i = "soft", className: a, ...o }) => /* @__PURE__ */ n("span", {
|
|
6
|
+
...o,
|
|
7
|
+
className: t(e.badge, a),
|
|
8
|
+
"data-variant": i,
|
|
9
|
+
children: r
|
|
10
|
+
});
|
|
11
|
+
//#endregion
|
|
12
|
+
export { r as Badge };
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
//#region src/components/breadcrumb/breadcrumb.module.css
|
|
2
|
+
var e = "_breadcrumb_y97r7_1", t = "_list_y97r7_6", n = "_item_y97r7_15", r = "_separator_y97r7_34", i = {
|
|
3
|
+
breadcrumb: e,
|
|
4
|
+
list: t,
|
|
5
|
+
item: n,
|
|
6
|
+
separator: r
|
|
6
7
|
};
|
|
7
8
|
//#endregion
|
|
8
|
-
export { e as default };
|
|
9
|
+
export { e as breadcrumb, i as default, n as item, t as list, r as separator };
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
//#region src/components/card/card.module.css
|
|
2
|
+
var e = "_card_1oed4_1", t = "_header_1oed4_11", n = "_footer_1oed4_12", r = "_body_1oed4_16", i = {
|
|
3
|
+
card: e,
|
|
4
|
+
header: t,
|
|
5
|
+
footer: n,
|
|
6
|
+
body: r
|
|
6
7
|
};
|
|
7
8
|
//#endregion
|
|
8
|
-
export { e as default };
|
|
9
|
+
export { r as body, e as card, i as default, n as footer, t as header };
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
//#region src/components/checkbox/checkbox.module.css
|
|
2
|
+
var e = "_checkbox_dkf3o_1", t = "_input_dkf3o_8", n = "_label_dkf3o_39", r = {
|
|
3
|
+
checkbox: e,
|
|
4
|
+
input: t,
|
|
5
|
+
label: n
|
|
5
6
|
};
|
|
6
7
|
//#endregion
|
|
7
|
-
export { e as default };
|
|
8
|
+
export { e as checkbox, r as default, t as input, n as label };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
//#region src/components/chip/chip.module.css
|
|
2
|
+
var e = "_chip_1vcyi_1", t = "_close_1vcyi_28", n = {
|
|
3
|
+
chip: e,
|
|
4
|
+
close: t
|
|
4
5
|
};
|
|
5
6
|
//#endregion
|
|
6
|
-
export { e as default };
|
|
7
|
+
export { e as chip, t as close, n as default };
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
//#region src/components/collapsible/collapsible.module.css
|
|
2
|
+
var e = "_collapsible_3bbjx_1", t = "_icon_3bbjx_6", n = "_trigger_3bbjx_18", r = "_label_3bbjx_34", i = "_content_3bbjx_40", a = {
|
|
3
|
+
collapsible: e,
|
|
4
|
+
icon: t,
|
|
5
|
+
trigger: n,
|
|
6
|
+
label: r,
|
|
7
|
+
content: i
|
|
7
8
|
};
|
|
8
9
|
//#endregion
|
|
9
|
-
export { e as default };
|
|
10
|
+
export { e as collapsible, i as content, a as default, t as icon, r as label, n as trigger };
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
//#region src/components/dropdown-menu/dropdown-menu.module.css
|
|
2
|
+
var e = "_icon_1r2a9_6", t = "_content_1r2a9_14", n = "_item_1r2a9_33", r = {
|
|
2
3
|
"dropdown-menu": "_dropdown-menu_1r2a9_1",
|
|
3
|
-
icon:
|
|
4
|
-
content:
|
|
5
|
-
item:
|
|
4
|
+
icon: e,
|
|
5
|
+
content: t,
|
|
6
|
+
item: n
|
|
6
7
|
};
|
|
7
8
|
//#endregion
|
|
8
|
-
export {
|
|
9
|
+
export { t as content, r as default, e as icon, n as item };
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
//#region src/components/dropzone/dropzone.module.css
|
|
2
|
+
var e = "_dropzone_1u6zv_1", t = "_label_1u6zv_7", n = "_area_1u6zv_11", r = "_file_1u6zv_41", i = "_remove_1u6zv_45", a = {
|
|
3
|
+
dropzone: e,
|
|
4
|
+
label: t,
|
|
5
|
+
area: n,
|
|
6
|
+
file: r,
|
|
7
|
+
remove: i
|
|
7
8
|
};
|
|
8
9
|
//#endregion
|
|
9
|
-
export {
|
|
10
|
+
export { n as area, a as default, e as dropzone, r as file, t as label, i as remove };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import e from "./filters.module.js";
|
|
2
|
+
import t from "clsx";
|
|
3
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
4
|
+
import { Minus as r, Plus as i } from "lucide-react";
|
|
5
|
+
//#region src/components/filters/filters.tsx
|
|
6
|
+
var a = ({ className: r, ...i }) => /* @__PURE__ */ n("div", {
|
|
7
|
+
...i,
|
|
8
|
+
className: t(e.filters, r)
|
|
9
|
+
}), o = ({ className: r, ...i }) => /* @__PURE__ */ n("div", {
|
|
10
|
+
...i,
|
|
11
|
+
className: t(e.header, r)
|
|
12
|
+
}), s = ({ className: r, ...i }) => /* @__PURE__ */ n("fieldset", {
|
|
13
|
+
...i,
|
|
14
|
+
className: t(e.row, r)
|
|
15
|
+
}), c = ({ className: r, children: a, "aria-label": o = "Add filter", ...s }) => /* @__PURE__ */ n("button", {
|
|
16
|
+
type: "button",
|
|
17
|
+
...s,
|
|
18
|
+
"aria-label": o,
|
|
19
|
+
className: t(e.add, r),
|
|
20
|
+
children: a ?? /* @__PURE__ */ n(i, { "aria-hidden": !0 })
|
|
21
|
+
}), l = ({ className: i, children: a, "aria-label": o = "Remove filter", ...s }) => /* @__PURE__ */ n("button", {
|
|
22
|
+
type: "button",
|
|
23
|
+
...s,
|
|
24
|
+
"aria-label": o,
|
|
25
|
+
className: t(e.remove, i),
|
|
26
|
+
children: a ?? /* @__PURE__ */ n(r, { "aria-hidden": !0 })
|
|
27
|
+
});
|
|
28
|
+
//#endregion
|
|
29
|
+
export { c as FilterAdd, o as FilterHeader, l as FilterRemove, s as FilterRow, a as Filters };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
//#region src/components/filters/filters.module.css
|
|
2
|
+
var e = "_filters_1ojmb_1", t = "_header_1ojmb_11", n = "_row_1ojmb_12", r = "_add_1ojmb_34", i = "_remove_1ojmb_35", a = {
|
|
3
|
+
filters: e,
|
|
4
|
+
header: t,
|
|
5
|
+
row: n,
|
|
6
|
+
add: r,
|
|
7
|
+
remove: i
|
|
8
|
+
};
|
|
9
|
+
//#endregion
|
|
10
|
+
export { r as add, a as default, e as filters, t as header, i as remove, n as row };
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
//#region src/components/input/input.module.css
|
|
2
|
+
var e = "_input_1g4d3_1", t = "_label_1g4d3_6", n = "_field_1g4d3_13", r = "_message_1g4d3_71", i = {
|
|
3
|
+
input: e,
|
|
4
|
+
label: t,
|
|
5
|
+
field: n,
|
|
6
|
+
message: r
|
|
6
7
|
};
|
|
7
8
|
//#endregion
|
|
8
|
-
export {
|
|
9
|
+
export { i as default, n as field, e as input, t as label, r as message };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
//#region src/components/list/list.module.css
|
|
2
|
+
var e = "_list_9hntk_1", t = "_item_9hntk_9", n = {
|
|
3
|
+
list: e,
|
|
4
|
+
item: t
|
|
4
5
|
};
|
|
5
6
|
//#endregion
|
|
6
|
-
export {
|
|
7
|
+
export { n as default, t as item, e as list };
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
//#region src/components/loader/loader.module.css
|
|
2
|
+
var e = "_overlay_131sn_1", t = "_loader_131sn_11", n = "_spinner_131sn_19", r = "_loading_131sn_1", i = {
|
|
3
|
+
overlay: e,
|
|
4
|
+
loader: t,
|
|
5
|
+
spinner: n,
|
|
6
|
+
loading: r
|
|
6
7
|
};
|
|
7
8
|
//#endregion
|
|
8
|
-
export {
|
|
9
|
+
export { i as default, t as loader, r as loading, e as overlay, n as spinner };
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
//#region src/components/modal/modal.module.css
|
|
2
|
+
var e = "_content_lkmqc_1", t = "_overlay_lkmqc_17", n = "_trigger_lkmqc_24", r = "_close_lkmqc_25", i = "_header_lkmqc_29", a = "_footer_lkmqc_35", o = {
|
|
3
|
+
content: e,
|
|
4
|
+
overlay: t,
|
|
5
|
+
trigger: n,
|
|
6
|
+
close: r,
|
|
7
|
+
header: i,
|
|
8
|
+
footer: a
|
|
8
9
|
};
|
|
9
10
|
//#endregion
|
|
10
|
-
export { e as default };
|
|
11
|
+
export { r as close, e as content, o as default, a as footer, i as header, t as overlay, n as trigger };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
//#region src/components/pagination/pagination.module.css
|
|
2
|
+
var e = "_pagination_1r9b9_1", t = "_item_1r9b9_6", n = {
|
|
3
|
+
pagination: e,
|
|
4
|
+
item: t
|
|
4
5
|
};
|
|
5
6
|
//#endregion
|
|
6
|
-
export {
|
|
7
|
+
export { n as default, t as item, e as pagination };
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
//#region src/components/popover/popover.module.css
|
|
2
|
+
var e = "_popover_1arnc_1", t = "_trigger_1arnc_6", n = "_content_1arnc_10", r = {
|
|
3
|
+
popover: e,
|
|
4
|
+
trigger: t,
|
|
5
|
+
content: n
|
|
5
6
|
};
|
|
6
7
|
//#endregion
|
|
7
|
-
export {
|
|
8
|
+
export { n as content, r as default, e as popover, t as trigger };
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
//#region src/components/radio-group/radio-group.module.css
|
|
2
|
+
var e = "_group_8w79p_1", t = "_item_8w79p_12", n = "_radio_8w79p_18", r = "_label_8w79p_49", i = {
|
|
3
|
+
group: e,
|
|
4
|
+
item: t,
|
|
5
|
+
radio: n,
|
|
6
|
+
label: r
|
|
6
7
|
};
|
|
7
8
|
//#endregion
|
|
8
|
-
export {
|
|
9
|
+
export { i as default, e as group, t as item, r as label, n as radio };
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
//#region src/components/select/select.module.css
|
|
2
|
+
var e = "_select_vcdsz_1", t = "_icon_vcdsz_7", n = "_trigger_vcdsz_18", r = "_content_vcdsz_32", i = "_item_vcdsz_49", a = "_option_vcdsz_71", o = {
|
|
3
|
+
select: e,
|
|
4
|
+
icon: t,
|
|
5
|
+
trigger: n,
|
|
6
|
+
content: r,
|
|
7
|
+
item: i,
|
|
8
|
+
option: a
|
|
8
9
|
};
|
|
9
10
|
//#endregion
|
|
10
|
-
export {
|
|
11
|
+
export { r as content, o as default, t as icon, i as item, a as option, e as select, n as trigger };
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
//#region src/components/sidebar/sidebar.module.css
|
|
2
|
+
var e = "_sidebar_10i86_1", t = "_header_10i86_9", n = "_group_10i86_15", r = "_link_10i86_24", i = "_item_10i86_30", a = {
|
|
3
|
+
sidebar: e,
|
|
4
|
+
header: t,
|
|
5
|
+
group: n,
|
|
6
|
+
link: r,
|
|
7
|
+
item: i
|
|
7
8
|
};
|
|
8
9
|
//#endregion
|
|
9
|
-
export {
|
|
10
|
+
export { a as default, n as group, t as header, i as item, r as link, e as sidebar };
|
|
@@ -1,45 +1,46 @@
|
|
|
1
1
|
import e from "./table.module.js";
|
|
2
2
|
import t from "clsx";
|
|
3
3
|
import { jsx as n, jsxs as r } from "react/jsx-runtime";
|
|
4
|
+
import { ChevronDown as i } from "lucide-react";
|
|
4
5
|
//#region src/components/table/table.tsx
|
|
5
|
-
var
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
className: e.main,
|
|
23
|
-
children: [/* @__PURE__ */ n("thead", { children: v() }), /* @__PURE__ */ n("tbody", {
|
|
24
|
-
className: e.tbody,
|
|
25
|
-
children: y()
|
|
26
|
-
})]
|
|
27
|
-
}),
|
|
28
|
-
f()
|
|
29
|
-
]
|
|
30
|
-
});
|
|
31
|
-
}, a = ({ children: r, className: i, ...a }) => /* @__PURE__ */ n("th", {
|
|
6
|
+
var a = ({ className: r, layout: i = "auto", ...a }) => /* @__PURE__ */ n("div", {
|
|
7
|
+
className: e.container,
|
|
8
|
+
children: /* @__PURE__ */ n("table", {
|
|
9
|
+
...a,
|
|
10
|
+
"data-layout": i,
|
|
11
|
+
className: t(e.table, r)
|
|
12
|
+
})
|
|
13
|
+
}), o = ({ className: r, ...i }) => /* @__PURE__ */ n("thead", {
|
|
14
|
+
...i,
|
|
15
|
+
className: t(e.header, r)
|
|
16
|
+
}), s = ({ className: r, ...i }) => /* @__PURE__ */ n("tbody", {
|
|
17
|
+
...i,
|
|
18
|
+
className: t(e.body, r)
|
|
19
|
+
}), c = ({ className: r, ...i }) => /* @__PURE__ */ n("tfoot", {
|
|
20
|
+
...i,
|
|
21
|
+
className: t(e.footer, r)
|
|
22
|
+
}), l = ({ className: r, separator: i = !0, ...a }) => /* @__PURE__ */ n("tr", {
|
|
32
23
|
...a,
|
|
33
|
-
className: t(e.
|
|
34
|
-
|
|
35
|
-
}),
|
|
36
|
-
...
|
|
37
|
-
className: t(e.
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
24
|
+
className: t(e.row, r),
|
|
25
|
+
"data-separator": i || void 0
|
|
26
|
+
}), u = ({ className: r, ...i }) => /* @__PURE__ */ n("td", {
|
|
27
|
+
...i,
|
|
28
|
+
className: t(e.cell, r)
|
|
29
|
+
}), d = ({ className: r, scope: i = "col", sort: a, ...o }) => /* @__PURE__ */ n("th", {
|
|
30
|
+
...o,
|
|
31
|
+
scope: i,
|
|
32
|
+
"aria-sort": a ?? "none",
|
|
33
|
+
"data-scope": i,
|
|
34
|
+
className: t(e.cell, e.headerCell, r)
|
|
35
|
+
}), f = ({ className: a, direction: o, icon: s = i, children: c, ...l }) => /* @__PURE__ */ r("button", {
|
|
36
|
+
type: "button",
|
|
37
|
+
...l,
|
|
38
|
+
className: t(e.sort, a),
|
|
39
|
+
children: [c, /* @__PURE__ */ n(s, {
|
|
40
|
+
"aria-hidden": !0,
|
|
41
|
+
className: e.sortIcon,
|
|
42
|
+
"data-direction": o
|
|
43
|
+
})]
|
|
43
44
|
});
|
|
44
45
|
//#endregion
|
|
45
|
-
export {
|
|
46
|
+
export { a as Table, s as TableBody, u as TableCell, c as TableFooter, o as TableHeader, d as TableHeaderCell, l as TableRow, f as TableSortTrigger };
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
//#region src/components/table/table.module.css
|
|
2
|
+
var e = "_container_1n0li_1", t = "_table_1n0li_6", n = "_row_1n0li_19", r = "_cell_1n0li_28", i = "_headerCell_1n0li_35", a = "_sort_1n0li_43", o = "_sortIcon_1n0li_61", s = {
|
|
3
|
+
container: e,
|
|
4
|
+
table: t,
|
|
5
|
+
row: n,
|
|
6
|
+
cell: r,
|
|
7
|
+
headerCell: i,
|
|
8
|
+
sort: a,
|
|
9
|
+
sortIcon: o
|
|
8
10
|
};
|
|
9
11
|
//#endregion
|
|
10
|
-
export { e as default };
|
|
12
|
+
export { r as cell, e as container, s as default, i as headerCell, n as row, a as sort, o as sortIcon, t as table };
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
//#region src/components/tabs/tabs.module.css
|
|
2
|
+
var e = "_tabs_719qy_1", t = "_items_719qy_7", n = "_item_719qy_7", r = "_trigger_719qy_28", i = {
|
|
3
|
+
tabs: e,
|
|
4
|
+
items: t,
|
|
5
|
+
item: n,
|
|
6
|
+
trigger: r
|
|
6
7
|
};
|
|
7
8
|
//#endregion
|
|
8
|
-
export {
|
|
9
|
+
export { i as default, n as item, t as items, e as tabs, r as trigger };
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
//#region src/components/wizard/wizard.module.css
|
|
2
|
+
var e = "_wizard_1ulat_1", t = "_header_1ulat_7", n = "_title_1ulat_12", r = "_indicator_1ulat_16", i = "_footer_1ulat_21", a = {
|
|
3
|
+
wizard: e,
|
|
4
|
+
header: t,
|
|
5
|
+
title: n,
|
|
6
|
+
indicator: r,
|
|
7
|
+
footer: i
|
|
7
8
|
};
|
|
8
9
|
//#endregion
|
|
9
|
-
export {
|
|
10
|
+
export { a as default, i as footer, t as header, r as indicator, n as title, e as wizard };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { useRef as e, useState as t } from "react";
|
|
2
|
+
//#region src/hooks/use-filters/use-filters.ts
|
|
3
|
+
var n = (n = []) => {
|
|
4
|
+
let r = e(0), i = (e = {}) => ({
|
|
5
|
+
id: `filter-${r.current++}`,
|
|
6
|
+
column: "",
|
|
7
|
+
operator: "",
|
|
8
|
+
value: "",
|
|
9
|
+
...e
|
|
10
|
+
}), [a, o] = t(() => n.map((e) => i(e)));
|
|
11
|
+
return {
|
|
12
|
+
filters: a,
|
|
13
|
+
addFilter: (e) => o((t) => [...t, i(e)]),
|
|
14
|
+
updateFilter: (e, t) => o((n) => n.map((n) => n.id === e ? {
|
|
15
|
+
...n,
|
|
16
|
+
...t
|
|
17
|
+
} : n)),
|
|
18
|
+
removeFilter: (e) => o((t) => t.filter((t) => t.id !== e)),
|
|
19
|
+
reset: () => o([])
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
//#endregion
|
|
23
|
+
export { n as useFilters };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { useState as e } from "react";
|
|
2
|
+
//#region src/hooks/use-sort/use-sort.ts
|
|
3
|
+
var t = (e, t) => typeof e == "number" && typeof t == "number" ? e - t : String(e).localeCompare(String(t)), n = (n = null) => {
|
|
4
|
+
let [r, i] = e(n);
|
|
5
|
+
return {
|
|
6
|
+
sort: r,
|
|
7
|
+
toggle: (e) => i((t) => t?.key === e ? t.direction === "ascending" ? {
|
|
8
|
+
key: e,
|
|
9
|
+
direction: "descending"
|
|
10
|
+
} : null : {
|
|
11
|
+
key: e,
|
|
12
|
+
direction: "ascending"
|
|
13
|
+
}),
|
|
14
|
+
sortData: (e) => {
|
|
15
|
+
if (!r) return e;
|
|
16
|
+
let { key: n, direction: i } = r;
|
|
17
|
+
return [...e].sort((e, r) => {
|
|
18
|
+
let a = t(e[n], r[n]);
|
|
19
|
+
return i === "ascending" ? a : -a;
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
//#endregion
|
|
25
|
+
export { n as useSort };
|