@ztwoint/z-ui 0.1.43 → 0.1.44
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.
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { Button as
|
|
3
|
-
import
|
|
4
|
-
import
|
|
1
|
+
import { jsxs as l, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { Button as i } from "../../../button/button.js";
|
|
3
|
+
import T from "./table-filter.hook.js";
|
|
4
|
+
import C from "./filters/text.js";
|
|
5
5
|
import j from "./filters/boolean.js";
|
|
6
6
|
import z from "./filters/number/number.js";
|
|
7
7
|
import A from "./filters/checkbox.js";
|
|
@@ -19,11 +19,11 @@ const E = ({
|
|
|
19
19
|
updateColumnFilter: f,
|
|
20
20
|
clearAllFilters: v,
|
|
21
21
|
applyFilters: k,
|
|
22
|
-
hasActiveFilters:
|
|
22
|
+
hasActiveFilters: s,
|
|
23
23
|
isOpen: m,
|
|
24
24
|
setIsOpen: u,
|
|
25
25
|
filterableFields: y
|
|
26
|
-
} =
|
|
26
|
+
} = T({ schema: d, filter: o || { value: [], onChange: () => {
|
|
27
27
|
} } });
|
|
28
28
|
if (!o)
|
|
29
29
|
return null;
|
|
@@ -31,7 +31,7 @@ const E = ({
|
|
|
31
31
|
if (!r) return null;
|
|
32
32
|
const e = d.find((c) => c.key === r), F = {
|
|
33
33
|
boolean: j,
|
|
34
|
-
text:
|
|
34
|
+
text: C,
|
|
35
35
|
number: z,
|
|
36
36
|
checkbox: A
|
|
37
37
|
}, h = (n == null ? void 0 : n[(e == null ? void 0 : e.cellType) || ""]) || F[(e == null ? void 0 : e.cellType) || "text"];
|
|
@@ -43,63 +43,64 @@ const E = ({
|
|
|
43
43
|
condition: (a == null ? void 0 : a.condition) || "",
|
|
44
44
|
value: (a == null ? void 0 : a.value) || ""
|
|
45
45
|
};
|
|
46
|
-
return /* @__PURE__ */
|
|
46
|
+
return /* @__PURE__ */ t("div", { className: "flex-1", children: /* @__PURE__ */ t("div", { className: "mb-4", children: /* @__PURE__ */ t("div", { className: "", children: /* @__PURE__ */ t(
|
|
47
47
|
h,
|
|
48
48
|
{
|
|
49
49
|
value: g,
|
|
50
50
|
onChange: ({ condition: c, value: w }) => f(r, c, w),
|
|
51
51
|
filterOptions: e == null ? void 0 : e.filterOptions
|
|
52
|
-
}
|
|
52
|
+
},
|
|
53
|
+
e == null ? void 0 : e.key
|
|
53
54
|
) }) }) });
|
|
54
55
|
};
|
|
55
|
-
return /* @__PURE__ */
|
|
56
|
-
/* @__PURE__ */
|
|
57
|
-
|
|
56
|
+
return /* @__PURE__ */ l("div", { className: "relative", children: [
|
|
57
|
+
/* @__PURE__ */ l(
|
|
58
|
+
i,
|
|
58
59
|
{
|
|
59
60
|
onClick: () => u(!m),
|
|
60
|
-
variant:
|
|
61
|
-
shade:
|
|
61
|
+
variant: s ? "filled" : "stroke",
|
|
62
|
+
shade: s ? "brand" : "neutral",
|
|
62
63
|
size: "small",
|
|
63
64
|
children: [
|
|
64
65
|
"Filter ",
|
|
65
|
-
|
|
66
|
+
s && `(${o.value.length})`
|
|
66
67
|
]
|
|
67
68
|
}
|
|
68
69
|
),
|
|
69
|
-
m && /* @__PURE__ */
|
|
70
|
-
/* @__PURE__ */
|
|
71
|
-
/* @__PURE__ */
|
|
72
|
-
/* @__PURE__ */
|
|
73
|
-
/* @__PURE__ */
|
|
70
|
+
m && /* @__PURE__ */ l("div", { className: "absolute top-full left-0 mt-2 min-w-[600px] bg-surface-neutral-default border border-stroke-solid-medium rounded-md shadow-default z-10", children: [
|
|
71
|
+
/* @__PURE__ */ l("div", { className: "flex min-h-[300px]", children: [
|
|
72
|
+
/* @__PURE__ */ l("div", { className: "w-48 border-r border-stroke-solid-medium", children: [
|
|
73
|
+
/* @__PURE__ */ t("div", { className: "p-3 border-b border-stroke-solid-medium", children: /* @__PURE__ */ t("h3", { className: "text-sm font-medium text-text-neutral-primary", children: "Columns" }) }),
|
|
74
|
+
/* @__PURE__ */ t("div", { className: "py-2", children: y.map((e) => /* @__PURE__ */ l(
|
|
74
75
|
"button",
|
|
75
76
|
{
|
|
76
77
|
onClick: () => p(e.key),
|
|
77
78
|
className: `w-full text-left px-3 py-2 text-sm flex items-center justify-between hover:bg-surface-neutral-hovered transition-colors ${r === e.key ? "bg-surface-brand-subtle text-text-brand-primary" : "text-text-neutral-primary"}`,
|
|
78
79
|
children: [
|
|
79
|
-
/* @__PURE__ */
|
|
80
|
-
b(e.key) && /* @__PURE__ */
|
|
80
|
+
/* @__PURE__ */ t("span", { className: "truncate", children: e.title }),
|
|
81
|
+
b(e.key) && /* @__PURE__ */ t(O, { className: "w-4 h-4 text-icon-brand-primary flex-shrink-0 ml-2" })
|
|
81
82
|
]
|
|
82
83
|
},
|
|
83
84
|
e.key
|
|
84
85
|
)) })
|
|
85
86
|
] }),
|
|
86
|
-
/* @__PURE__ */
|
|
87
|
+
/* @__PURE__ */ t("div", { className: "flex-1 flex flex-col", children: r ? N() : /* @__PURE__ */ t("div", { className: "flex-1 flex items-center justify-center text-text-neutral-muted", children: "Select a column to configure its filter" }) })
|
|
87
88
|
] }),
|
|
88
|
-
/* @__PURE__ */
|
|
89
|
-
/* @__PURE__ */
|
|
90
|
-
|
|
89
|
+
/* @__PURE__ */ l("div", { className: "flex justify-between items-center p-4 border-t border-stroke-solid-medium", children: [
|
|
90
|
+
/* @__PURE__ */ t(
|
|
91
|
+
i,
|
|
91
92
|
{
|
|
92
93
|
onClick: v,
|
|
93
94
|
variant: "ghost",
|
|
94
95
|
shade: "neutral",
|
|
95
96
|
size: "small",
|
|
96
|
-
disabled: !
|
|
97
|
+
disabled: !s,
|
|
97
98
|
children: "Clear All"
|
|
98
99
|
}
|
|
99
100
|
),
|
|
100
|
-
/* @__PURE__ */
|
|
101
|
-
/* @__PURE__ */
|
|
102
|
-
|
|
101
|
+
/* @__PURE__ */ l("div", { className: "flex gap-2", children: [
|
|
102
|
+
/* @__PURE__ */ t(
|
|
103
|
+
i,
|
|
103
104
|
{
|
|
104
105
|
onClick: () => u(!1),
|
|
105
106
|
variant: "stroke",
|
|
@@ -108,7 +109,7 @@ const E = ({
|
|
|
108
109
|
children: "Cancel"
|
|
109
110
|
}
|
|
110
111
|
),
|
|
111
|
-
/* @__PURE__ */
|
|
112
|
+
/* @__PURE__ */ t(i, { onClick: k, variant: "filled", shade: "neutral", size: "small", children: "Apply" })
|
|
112
113
|
] })
|
|
113
114
|
] })
|
|
114
115
|
] })
|