dgz-ui-shared 1.1.25 → 1.1.27
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/Actions-DYmkv_J9.js +29 -0
- package/dist/Actions-Dh8TPahn.cjs +1 -0
- package/dist/ExportData-DV3HcBlK.cjs +1 -0
- package/dist/ExportData-DvwQ6UCI.js +31 -0
- package/dist/{FilterWrapper-Dk18nVPy.js → FilterWrapper-BU6BOSt1.js} +63 -56
- package/dist/FilterWrapper-OjCn16Bf.cjs +21 -0
- package/dist/{MyInput-B-QCpehg.js → MyInput-ChZBApQv.js} +224 -228
- package/dist/{MyInput-9MnlVZ4h.cjs → MyInput-OECIw9XS.cjs} +1 -1
- package/dist/MySelect-BTvVzbd9.js +55 -0
- package/dist/MySelect-ClBq6zbD.cjs +1 -0
- package/dist/components/actions/index.cjs.js +1 -1
- package/dist/components/actions/index.es.js +1 -1
- package/dist/components/confirm/index.cjs.js +1 -1
- package/dist/components/confirm/index.es.js +1 -1
- package/dist/components/datatable/index.cjs.js +5 -5
- package/dist/components/datatable/index.es.js +249 -219
- package/dist/components/export/index.cjs.js +1 -1
- package/dist/components/export/index.es.js +1 -1
- package/dist/components/filters/index.cjs.js +1 -1
- package/dist/components/filters/index.es.js +23 -22
- package/dist/components/form/index.cjs.js +2 -2
- package/dist/components/form/index.es.js +293 -337
- package/dist/dgz-ui-shared.css +1 -1
- package/dist/hooks/index.cjs.js +1 -1
- package/dist/hooks/index.es.js +1 -1
- package/dist/types/components/actions/Actions.d.ts +5 -2
- package/dist/types/components/actions/Actions.d.ts.map +1 -1
- package/dist/types/components/datatable/DataTable.d.ts +24 -4
- package/dist/types/components/datatable/DataTable.d.ts.map +1 -1
- package/dist/types/components/datatable/MyTable.d.ts +3 -2
- package/dist/types/components/datatable/MyTable.d.ts.map +1 -1
- package/dist/types/components/export/ExportData.d.ts +5 -2
- package/dist/types/components/export/ExportData.d.ts.map +1 -1
- package/dist/types/components/filters/FilterWrapper.d.ts +8 -1
- package/dist/types/components/filters/FilterWrapper.d.ts.map +1 -1
- package/dist/types/components/filters/SearchWithCtrl.d.ts +1 -1
- package/dist/types/components/filters/SearchWithCtrl.d.ts.map +1 -1
- package/dist/types/components/form/MyCheckbox.d.ts +6 -6
- package/dist/types/components/form/MyCheckbox.d.ts.map +1 -1
- package/dist/types/components/form/MyDatePicker.d.ts +11 -11
- package/dist/types/components/form/MyDatePicker.d.ts.map +1 -1
- package/dist/types/components/form/MyDateRangePicker.d.ts +9 -9
- package/dist/types/components/form/MyDateRangePicker.d.ts.map +1 -1
- package/dist/types/components/form/MyHtmlEditor.d.ts +8 -8
- package/dist/types/components/form/MyInput.d.ts +9 -9
- package/dist/types/components/form/MyInput.d.ts.map +1 -1
- package/dist/types/components/form/MyMaskInput.d.ts +9 -9
- package/dist/types/components/form/MyMaskInput.d.ts.map +1 -1
- package/dist/types/components/form/MyRadio.d.ts +7 -7
- package/dist/types/components/form/MyRadio.d.ts.map +1 -1
- package/dist/types/components/form/MySelect.d.ts +10 -10
- package/dist/types/components/form/MySelect.d.ts.map +1 -1
- package/dist/types/components/form/MySwitch.d.ts +6 -6
- package/dist/types/components/form/MySwitch.d.ts.map +1 -1
- package/dist/types/components/form/MyTextarea.d.ts +9 -9
- package/dist/types/components/form/MyTextarea.d.ts.map +1 -1
- package/dist/types/components/form/MyTimePicker.d.ts +8 -8
- package/dist/{unstyled-BMbrfzye.js → unstyled-3gQZkMky.js} +1 -1
- package/dist/{unstyled-BFCMBSGZ.cjs → unstyled-CD5LId4m.cjs} +1 -1
- package/package.json +2 -2
- package/dist/Actions-CKVu3P3q.js +0 -28
- package/dist/Actions-uGf1oq7E.cjs +0 -1
- package/dist/ExportData-1xS2UAoq.js +0 -29
- package/dist/ExportData-ApStkEWC.cjs +0 -1
- package/dist/FilterWrapper-DvNjUQih.cjs +0 -21
- package/dist/MySelect-C5uWRVJh.js +0 -62
- package/dist/MySelect-DNK997Bi.cjs +0 -1
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { j as s } from "./jsx-runtime-DS1N_tNq.js";
|
|
2
|
+
import { T as t, A as o, i as m, u as c } from "./dropdown-menu-TWRSm6RK-D_FJpI4C.js";
|
|
3
|
+
import { u as d } from "./button-CdZDBhmr-BT_j3ig5.js";
|
|
4
|
+
import { W as x, f as j } from "./index-BrQ82Wyu.js";
|
|
5
|
+
const A = ({
|
|
6
|
+
actions: i,
|
|
7
|
+
triggerProps: n,
|
|
8
|
+
contentProps: a,
|
|
9
|
+
title: e
|
|
10
|
+
}) => /* @__PURE__ */ s.jsxs(t, { children: [
|
|
11
|
+
/* @__PURE__ */ s.jsx(o, { asChild: !0, ...n, children: /* @__PURE__ */ s.jsxs(
|
|
12
|
+
d,
|
|
13
|
+
{
|
|
14
|
+
variant: "secondary",
|
|
15
|
+
size: "sm",
|
|
16
|
+
className: "ml-auto rounded-lg px-3",
|
|
17
|
+
children: [
|
|
18
|
+
/* @__PURE__ */ s.jsx(x, {}),
|
|
19
|
+
" ",
|
|
20
|
+
/* @__PURE__ */ s.jsx("span", { className: "hidden lg:!inline", children: e || "Actions" }),
|
|
21
|
+
/* @__PURE__ */ s.jsx(j, {})
|
|
22
|
+
]
|
|
23
|
+
}
|
|
24
|
+
) }),
|
|
25
|
+
/* @__PURE__ */ s.jsx(m, { align: "end", ...a, children: i.map((r, l) => /* @__PURE__ */ s.jsx(c, { onClick: () => r.onClick(), children: r.label }, l)) })
|
|
26
|
+
] });
|
|
27
|
+
export {
|
|
28
|
+
A
|
|
29
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const s=require("./jsx-runtime-h4oGeKUK.cjs"),n=require("./dropdown-menu-TWRSm6RK-DQ03CnVw.cjs"),c=require("./button-CdZDBhmr-3yMPCRDo.cjs"),t=require("./index-CGv7FLNy.cjs"),l=({actions:i,triggerProps:r,contentProps:x,title:o})=>s.jsxRuntimeExports.jsxs(n.Tt,{children:[s.jsxRuntimeExports.jsx(n.At,{asChild:!0,...r,children:s.jsxRuntimeExports.jsxs(c.u,{variant:"secondary",size:"sm",className:"ml-auto rounded-lg px-3",children:[s.jsxRuntimeExports.jsx(t.Wg,{})," ",s.jsxRuntimeExports.jsx("span",{className:"hidden lg:!inline",children:o||"Actions"}),s.jsxRuntimeExports.jsx(t.f1,{})]})}),s.jsxRuntimeExports.jsx(n.it,{align:"end",...x,children:i.map((e,u)=>s.jsxRuntimeExports.jsx(n.ut,{onClick:()=>e.onClick(),children:e.label},u))})]});exports.Actions=l;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const s=require("./jsx-runtime-h4oGeKUK.cjs"),e=require("./dropdown-menu-TWRSm6RK-DQ03CnVw.cjs"),l=require("./button-CdZDBhmr-3yMPCRDo.cjs"),n=require("./index-CGv7FLNy.cjs"),a=require("./Spin-DBoJvG-Y.cjs"),c=({options:r,loading:i=!1,triggerProps:x,contentProps:u,title:o})=>s.jsxRuntimeExports.jsxs(e.Tt,{children:[s.jsxRuntimeExports.jsx(e.At,{asChild:!0,...x,children:s.jsxRuntimeExports.jsxs(l.u,{variant:"secondary",size:"sm",className:"ml-auto rounded-lg px-3",children:[i?s.jsxRuntimeExports.jsx(a.Spin,{}):s.jsxRuntimeExports.jsx(n.ZC,{})," ",s.jsxRuntimeExports.jsx("span",{className:"hidden lg:!inline",children:o||"Export"}),s.jsxRuntimeExports.jsx(n.f1,{})]})}),s.jsxRuntimeExports.jsx(e.it,{align:"end",...u,children:r.map((t,j)=>s.jsxRuntimeExports.jsx(e.ut,{onClick:()=>t.onClick(),children:t.label},j))})]});exports.ExportData=c;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { j as s } from "./jsx-runtime-DS1N_tNq.js";
|
|
2
|
+
import { T as o, A as m, i as x, u as d } from "./dropdown-menu-TWRSm6RK-D_FJpI4C.js";
|
|
3
|
+
import { u as c } from "./button-CdZDBhmr-BT_j3ig5.js";
|
|
4
|
+
import { Z as p, f as j } from "./index-BrQ82Wyu.js";
|
|
5
|
+
import { S as u } from "./Spin-D1geCtns.js";
|
|
6
|
+
const k = ({
|
|
7
|
+
options: a,
|
|
8
|
+
loading: i = !1,
|
|
9
|
+
triggerProps: e,
|
|
10
|
+
contentProps: n,
|
|
11
|
+
title: t
|
|
12
|
+
}) => /* @__PURE__ */ s.jsxs(o, { children: [
|
|
13
|
+
/* @__PURE__ */ s.jsx(m, { asChild: !0, ...e, children: /* @__PURE__ */ s.jsxs(
|
|
14
|
+
c,
|
|
15
|
+
{
|
|
16
|
+
variant: "secondary",
|
|
17
|
+
size: "sm",
|
|
18
|
+
className: "ml-auto rounded-lg px-3",
|
|
19
|
+
children: [
|
|
20
|
+
i ? /* @__PURE__ */ s.jsx(u, {}) : /* @__PURE__ */ s.jsx(p, {}),
|
|
21
|
+
" ",
|
|
22
|
+
/* @__PURE__ */ s.jsx("span", { className: "hidden lg:!inline", children: t || "Export" }),
|
|
23
|
+
/* @__PURE__ */ s.jsx(j, {})
|
|
24
|
+
]
|
|
25
|
+
}
|
|
26
|
+
) }),
|
|
27
|
+
/* @__PURE__ */ s.jsx(x, { align: "end", ...n, children: a.map((r, l) => /* @__PURE__ */ s.jsx(d, { onClick: () => r.onClick(), children: r.label }, l)) })
|
|
28
|
+
] });
|
|
29
|
+
export {
|
|
30
|
+
k as E
|
|
31
|
+
};
|
|
@@ -1,120 +1,127 @@
|
|
|
1
1
|
import { j as e } from "./jsx-runtime-DS1N_tNq.js";
|
|
2
|
-
import { y as
|
|
3
|
-
import { u as
|
|
4
|
-
import { m as
|
|
5
|
-
import { u as
|
|
6
|
-
import { c as
|
|
7
|
-
import { memo as
|
|
8
|
-
import { l as
|
|
9
|
-
import { _ as
|
|
10
|
-
import { M as
|
|
11
|
-
import { M as
|
|
12
|
-
import { u as
|
|
2
|
+
import { y as A, b as I } from "./input-mask-DBLFIvhN-BBxoZxnd.js";
|
|
3
|
+
import { u as c } from "./button-CdZDBhmr-BT_j3ig5.js";
|
|
4
|
+
import { m as L } from "./utils-B6fNqzRf-B1_jG1K7.js";
|
|
5
|
+
import { u as O } from "./useTranslation-dH-uwymc.js";
|
|
6
|
+
import { c as l } from "./createLucideIcon-B950nf2d.js";
|
|
7
|
+
import { memo as R, useState as b, useEffect as k, useCallback as v } from "react";
|
|
8
|
+
import { l as C } from "./lodash-CYNxjS-I.js";
|
|
9
|
+
import { _ as P, w as T, u as V } from "./popover-OZcfKDD9-C2PVWPLS.js";
|
|
10
|
+
import { M as W } from "./MyInput-ChZBApQv.js";
|
|
11
|
+
import { M as B } from "./MySelect-BTvVzbd9.js";
|
|
12
|
+
import { u as G } from "./useFilter-DJunNBm2.js";
|
|
13
13
|
/**
|
|
14
14
|
* @license lucide-react v0.511.0 - ISC
|
|
15
15
|
*
|
|
16
16
|
* This source code is licensed under the ISC license.
|
|
17
17
|
* See the LICENSE file in the root directory of this source tree.
|
|
18
18
|
*/
|
|
19
|
-
const
|
|
19
|
+
const H = [["path", { d: "m6 9 6 6 6-6", key: "qrunsl" }]], J = l("chevron-down", H);
|
|
20
20
|
/**
|
|
21
21
|
* @license lucide-react v0.511.0 - ISC
|
|
22
22
|
*
|
|
23
23
|
* This source code is licensed under the ISC license.
|
|
24
24
|
* See the LICENSE file in the root directory of this source tree.
|
|
25
25
|
*/
|
|
26
|
-
const
|
|
26
|
+
const K = [
|
|
27
27
|
["path", { d: "M10 18h4", key: "1ulq68" }],
|
|
28
28
|
["path", { d: "M11 6H3", key: "1u26ik" }],
|
|
29
29
|
["path", { d: "M15 6h6", key: "1jlkvy" }],
|
|
30
30
|
["path", { d: "M18 9V3", key: "xwwp7m" }],
|
|
31
31
|
["path", { d: "M7 12h8", key: "7a1bxv" }]
|
|
32
|
-
],
|
|
32
|
+
], Q = l("list-filter-plus", K);
|
|
33
33
|
/**
|
|
34
34
|
* @license lucide-react v0.511.0 - ISC
|
|
35
35
|
*
|
|
36
36
|
* This source code is licensed under the ISC license.
|
|
37
37
|
* See the LICENSE file in the root directory of this source tree.
|
|
38
38
|
*/
|
|
39
|
-
const
|
|
39
|
+
const U = [
|
|
40
40
|
["path", { d: "M3 6h18", key: "d0wm0j" }],
|
|
41
41
|
["path", { d: "M7 12h10", key: "b7w52i" }],
|
|
42
42
|
["path", { d: "M10 18h4", key: "1ulq68" }]
|
|
43
|
-
],
|
|
43
|
+
], X = l("list-filter", U);
|
|
44
44
|
/**
|
|
45
45
|
* @license lucide-react v0.511.0 - ISC
|
|
46
46
|
*
|
|
47
47
|
* This source code is licensed under the ISC license.
|
|
48
48
|
* See the LICENSE file in the root directory of this source tree.
|
|
49
49
|
*/
|
|
50
|
-
const
|
|
50
|
+
const Y = [
|
|
51
51
|
["path", { d: "m21 21-4.34-4.34", key: "14j7rj" }],
|
|
52
52
|
["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }]
|
|
53
|
-
],
|
|
54
|
-
name:
|
|
53
|
+
], Z = l("search", Y), pe = ({
|
|
54
|
+
name: i = "search",
|
|
55
55
|
defaultValue: t,
|
|
56
56
|
onSearchChange: o,
|
|
57
57
|
placeholder: a,
|
|
58
58
|
className: r,
|
|
59
59
|
...x
|
|
60
60
|
}) => {
|
|
61
|
-
const { t:
|
|
62
|
-
const p = new FormData(
|
|
63
|
-
o(p.get(
|
|
61
|
+
const { t: m } = O(), d = (n) => {
|
|
62
|
+
const p = new FormData(n.currentTarget);
|
|
63
|
+
o(p.get(i) || void 0), n.preventDefault(), n.stopPropagation();
|
|
64
64
|
};
|
|
65
65
|
return /* @__PURE__ */ e.jsxs(
|
|
66
66
|
"form",
|
|
67
67
|
{
|
|
68
|
-
className:
|
|
69
|
-
onSubmit:
|
|
68
|
+
className: L("relative w-full max-w-64 min-w-40", r),
|
|
69
|
+
onSubmit: d,
|
|
70
70
|
children: [
|
|
71
71
|
/* @__PURE__ */ e.jsx(
|
|
72
|
-
|
|
72
|
+
A,
|
|
73
73
|
{
|
|
74
74
|
...x,
|
|
75
75
|
className: "h-8 rounded-lg",
|
|
76
|
-
name:
|
|
77
|
-
placeholder: a ||
|
|
76
|
+
name: i,
|
|
77
|
+
placeholder: a || m("Search..."),
|
|
78
78
|
defaultValue: t ? `${t}` : ""
|
|
79
79
|
}
|
|
80
80
|
),
|
|
81
81
|
/* @__PURE__ */ e.jsx(
|
|
82
|
-
|
|
82
|
+
c,
|
|
83
83
|
{
|
|
84
84
|
type: "submit",
|
|
85
85
|
variant: "ghost",
|
|
86
86
|
className: "text-foreground absolute top-0 right-0 cursor-pointer rounded-md !bg-transparent",
|
|
87
87
|
size: "sm",
|
|
88
|
-
children: /* @__PURE__ */ e.jsx(
|
|
88
|
+
children: /* @__PURE__ */ e.jsx(Z, {})
|
|
89
89
|
}
|
|
90
90
|
)
|
|
91
91
|
]
|
|
92
92
|
}
|
|
93
93
|
);
|
|
94
|
-
},
|
|
94
|
+
}, he = R(function({
|
|
95
95
|
filters: t,
|
|
96
96
|
params: o,
|
|
97
97
|
onFilter: a,
|
|
98
98
|
onChange: r,
|
|
99
99
|
onCancel: x,
|
|
100
|
-
|
|
100
|
+
triggerProps: m,
|
|
101
|
+
contentProps: d,
|
|
102
|
+
title: n,
|
|
103
|
+
resetText: p,
|
|
104
|
+
applyText: N,
|
|
105
|
+
...M
|
|
101
106
|
}) {
|
|
102
|
-
const
|
|
107
|
+
const [w, g] = b(!1), [S, h] = b(!1), { form: j } = G({ params: o }), { watch: _, getValues: z, handleSubmit: $, control: y, reset: f } = j;
|
|
103
108
|
k(() => {
|
|
104
109
|
let s = !1;
|
|
105
|
-
t.map((
|
|
106
|
-
const u =
|
|
107
|
-
(Array.isArray(u) ? u.length > 0 : u) && (s = !0),
|
|
110
|
+
t.map((q) => {
|
|
111
|
+
const u = C.get(o, `${q.name}`);
|
|
112
|
+
(Array.isArray(u) ? u.length > 0 : u) && (s = !0), g(s);
|
|
108
113
|
});
|
|
109
|
-
}, [t, o])
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
114
|
+
}, [t, o]);
|
|
115
|
+
const D = _();
|
|
116
|
+
k(() => {
|
|
117
|
+
r == null || r(z());
|
|
118
|
+
}, [D]);
|
|
119
|
+
const E = v(
|
|
113
120
|
(s = {}) => {
|
|
114
121
|
a == null || a(s), h(!1);
|
|
115
122
|
},
|
|
116
123
|
[a]
|
|
117
|
-
),
|
|
124
|
+
), F = v(() => {
|
|
118
125
|
f(), a && o && a({
|
|
119
126
|
...o,
|
|
120
127
|
...Object.fromEntries(
|
|
@@ -122,27 +129,27 @@ const J = [
|
|
|
122
129
|
)
|
|
123
130
|
}), h(!1);
|
|
124
131
|
}, [a, f, o, t]);
|
|
125
|
-
return /* @__PURE__ */ e.jsxs(
|
|
126
|
-
/* @__PURE__ */ e.jsx(
|
|
127
|
-
|
|
132
|
+
return /* @__PURE__ */ e.jsxs(P, { open: S, onOpenChange: h, children: [
|
|
133
|
+
/* @__PURE__ */ e.jsx(T, { ...m, children: /* @__PURE__ */ e.jsx(
|
|
134
|
+
c,
|
|
128
135
|
{
|
|
129
136
|
asChild: !0,
|
|
130
137
|
size: "sm",
|
|
131
138
|
variant: "secondary",
|
|
132
139
|
className: "ml-auto px-3",
|
|
133
|
-
...
|
|
140
|
+
...M,
|
|
134
141
|
children: /* @__PURE__ */ e.jsxs("div", { className: "flex items-center", children: [
|
|
135
|
-
|
|
142
|
+
w ? /* @__PURE__ */ e.jsx(Q, { className: "size-5" }) : /* @__PURE__ */ e.jsx(X, { className: "size-5" }),
|
|
136
143
|
" ",
|
|
137
|
-
/* @__PURE__ */ e.jsx("span", { className: "hidden lg:!inline", children: n
|
|
138
|
-
/* @__PURE__ */ e.jsx(
|
|
144
|
+
/* @__PURE__ */ e.jsx("span", { className: "hidden lg:!inline", children: n || "Filter" }),
|
|
145
|
+
/* @__PURE__ */ e.jsx(J, {})
|
|
139
146
|
] })
|
|
140
147
|
}
|
|
141
148
|
) }),
|
|
142
|
-
/* @__PURE__ */ e.jsx(
|
|
149
|
+
/* @__PURE__ */ e.jsx(V, { side: "bottom", align: "end", ...d, children: /* @__PURE__ */ e.jsx(I, { ...j, children: /* @__PURE__ */ e.jsxs("form", { onSubmit: $(E), className: "space-y-2", children: [
|
|
143
150
|
/* @__PURE__ */ e.jsx("div", { className: "h-full shrink p-1", children: t.map(
|
|
144
151
|
(s) => s.options ? /* @__PURE__ */ e.jsx(
|
|
145
|
-
|
|
152
|
+
B,
|
|
146
153
|
{
|
|
147
154
|
control: y,
|
|
148
155
|
name: s.name,
|
|
@@ -153,7 +160,7 @@ const J = [
|
|
|
153
160
|
},
|
|
154
161
|
s.name
|
|
155
162
|
) : /* @__PURE__ */ e.jsx(
|
|
156
|
-
|
|
163
|
+
W,
|
|
157
164
|
{
|
|
158
165
|
control: y,
|
|
159
166
|
placeholder: s.placeholder,
|
|
@@ -165,21 +172,21 @@ const J = [
|
|
|
165
172
|
) }),
|
|
166
173
|
/* @__PURE__ */ e.jsxs("div", { className: "flex shrink-0 justify-end gap-2", children: [
|
|
167
174
|
/* @__PURE__ */ e.jsx(
|
|
168
|
-
|
|
175
|
+
c,
|
|
169
176
|
{
|
|
170
177
|
variant: "destructive",
|
|
171
178
|
type: "reset",
|
|
172
179
|
size: "sm",
|
|
173
|
-
onClick:
|
|
174
|
-
children:
|
|
180
|
+
onClick: F,
|
|
181
|
+
children: p || "Reset"
|
|
175
182
|
}
|
|
176
183
|
),
|
|
177
|
-
/* @__PURE__ */ e.jsx(
|
|
184
|
+
/* @__PURE__ */ e.jsx(c, { type: "submit", size: "sm", children: N || "Apply" })
|
|
178
185
|
] })
|
|
179
186
|
] }) }) })
|
|
180
187
|
] });
|
|
181
188
|
});
|
|
182
189
|
export {
|
|
183
|
-
|
|
184
|
-
|
|
190
|
+
he as F,
|
|
191
|
+
pe as S
|
|
185
192
|
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";const e=require("./jsx-runtime-h4oGeKUK.cjs"),b=require("./input-mask-DBLFIvhN-C_0RAR2l.cjs"),i=require("./button-CdZDBhmr-3yMPCRDo.cjs"),z=require("./utils-B6fNqzRf-BNysSCt9.cjs"),F=require("./useTranslation-CZf20ucv.cjs"),u=require("./createLucideIcon-BnAj0RnC.cjs"),o=require("react"),$=require("./lodash-C5w_OPmE.cjs"),j=require("./popover-OZcfKDD9-KUWOsIOs.cjs"),B=require("./MyInput-OECIw9XS.cjs"),C=require("./MySelect-ClBq6zbD.cjs"),O=require("./useFilter-Cwz8oftI.cjs");/**
|
|
2
|
+
* @license lucide-react v0.511.0 - ISC
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the ISC license.
|
|
5
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/const A=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],T=u.createLucideIcon("chevron-down",A);/**
|
|
7
|
+
* @license lucide-react v0.511.0 - ISC
|
|
8
|
+
*
|
|
9
|
+
* This source code is licensed under the ISC license.
|
|
10
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
11
|
+
*/const W=[["path",{d:"M10 18h4",key:"1ulq68"}],["path",{d:"M11 6H3",key:"1u26ik"}],["path",{d:"M15 6h6",key:"1jlkvy"}],["path",{d:"M18 9V3",key:"xwwp7m"}],["path",{d:"M7 12h8",key:"7a1bxv"}]],P=u.createLucideIcon("list-filter-plus",W);/**
|
|
12
|
+
* @license lucide-react v0.511.0 - ISC
|
|
13
|
+
*
|
|
14
|
+
* This source code is licensed under the ISC license.
|
|
15
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
16
|
+
*/const V=[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M7 12h10",key:"b7w52i"}],["path",{d:"M10 18h4",key:"1ulq68"}]],Z=u.createLucideIcon("list-filter",V);/**
|
|
17
|
+
* @license lucide-react v0.511.0 - ISC
|
|
18
|
+
*
|
|
19
|
+
* This source code is licensed under the ISC license.
|
|
20
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
21
|
+
*/const G=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],H=u.createLucideIcon("search",G),K=({name:l="search",defaultValue:n,onSearchChange:r,placeholder:t,className:c,...y})=>{const{t:x}=F.useTranslation(),p=a=>{const d=new FormData(a.currentTarget);r(d.get(l)||void 0),a.preventDefault(),a.stopPropagation()};return e.jsxRuntimeExports.jsxs("form",{className:z.mo("relative w-full max-w-64 min-w-40",c),onSubmit:p,children:[e.jsxRuntimeExports.jsx(b.yp,{...y,className:"h-8 rounded-lg",name:l,placeholder:t||x("Search..."),defaultValue:n?`${n}`:""}),e.jsxRuntimeExports.jsx(i.u,{type:"submit",variant:"ghost",className:"text-foreground absolute top-0 right-0 cursor-pointer rounded-md !bg-transparent",size:"sm",children:e.jsxRuntimeExports.jsx(H,{})})]})},J=o.memo(function({filters:n,params:r,onFilter:t,onChange:c,onCancel:y,triggerProps:x,contentProps:p,title:a,resetText:d,applyText:v,...N}){const[q,f]=o.useState(!1),[M,m]=o.useState(!1),{form:E}=O.useFilter({params:r}),{watch:w,getValues:S,handleSubmit:g,control:R,reset:k}=E;o.useEffect(()=>{let s=!1;n.map(L=>{const h=$.lodashExports.get(r,`${L.name}`);(Array.isArray(h)?h.length>0:h)&&(s=!0),f(s)})},[n,r]);const I=w();o.useEffect(()=>{c==null||c(S())},[I]);const _=o.useCallback((s={})=>{t==null||t(s),m(!1)},[t]),D=o.useCallback(()=>{k(),t&&r&&t({...r,...Object.fromEntries(n.map(s=>[s.name,void 0]))}),m(!1)},[t,k,r,n]);return e.jsxRuntimeExports.jsxs(j._e,{open:M,onOpenChange:m,children:[e.jsxRuntimeExports.jsx(j.we,{...x,children:e.jsxRuntimeExports.jsx(i.u,{asChild:!0,size:"sm",variant:"secondary",className:"ml-auto px-3",...N,children:e.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[q?e.jsxRuntimeExports.jsx(P,{className:"size-5"}):e.jsxRuntimeExports.jsx(Z,{className:"size-5"})," ",e.jsxRuntimeExports.jsx("span",{className:"hidden lg:!inline",children:a||"Filter"}),e.jsxRuntimeExports.jsx(T,{})]})})}),e.jsxRuntimeExports.jsx(j.ue,{side:"bottom",align:"end",...p,children:e.jsxRuntimeExports.jsx(b.Gx,{...E,children:e.jsxRuntimeExports.jsxs("form",{onSubmit:g(_),className:"space-y-2",children:[e.jsxRuntimeExports.jsx("div",{className:"h-full shrink p-1",children:n.map(s=>s.options?e.jsxRuntimeExports.jsx(C.MySelect,{control:R,name:s.name,placeholder:s.placeholder,isMulti:s.isMulti,options:s.options,label:s.label},s.name):e.jsxRuntimeExports.jsx(B.MyInput,{control:R,placeholder:s.placeholder,name:s.name,label:s.label},s.name))}),e.jsxRuntimeExports.jsxs("div",{className:"flex shrink-0 justify-end gap-2",children:[e.jsxRuntimeExports.jsx(i.u,{variant:"destructive",type:"reset",size:"sm",onClick:D,children:d||"Reset"}),e.jsxRuntimeExports.jsx(i.u,{type:"submit",size:"sm",children:v||"Apply"})]})]})})})]})});exports.FilterWrapper=J;exports.Search=K;
|