@ztwoint/z-ui 0.1.47 → 0.1.50
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/alert/alert.const.d.ts +0 -3
- package/dist/components/alert/alert.const.js +16 -31
- package/dist/components/alert/alert.js +32 -44
- package/dist/components/button/button.d.ts +3 -3
- package/dist/components/button/button.js +58 -58
- package/dist/components/collapsible-side-nav-bar/side-nav-bar-header.js +17 -17
- package/dist/components/dialog/dialog.js +1 -1
- package/dist/components/dropdown/helpers/hover-card.js +1 -1
- package/dist/components/dropdown/z2-dropdown.js +2 -2
- package/dist/components/dropdown-menu/z2-dropdown-menu.js +2 -2
- package/dist/components/nav-header/nav-item/nav-item.d.ts +4 -2
- package/dist/components/nav-header/nav-item/nav-item.js +29 -28
- package/dist/components/select/z2-select.js +131 -78
- package/dist/components/table/components/table-filter/close-filter-confirm/filter-confirmation-dialog.d.ts +10 -0
- package/dist/components/table/components/table-filter/close-filter-confirm/filter-confirmation-dialog.js +33 -0
- package/dist/components/table/components/table-filter/close-filter-confirm/filter-confirmation-dialog.utils.d.ts +13 -0
- package/dist/components/table/components/table-filter/close-filter-confirm/filter-confirmation-dialog.utils.js +20 -0
- package/dist/components/table/components/table-filter/table-filter-button.js +81 -60
- package/dist/components/table/components/table-filter/table-filter-column-button.js +85 -56
- package/dist/components/table/components/table-filter/table-filter.context.d.ts +1 -0
- package/dist/components/table/components/table-filter/table-filter.hook.d.ts +1 -0
- package/dist/components/table/components/table-filter/table-filter.hook.js +17 -14
- package/dist/components/table/components/table-footer.js +6 -6
- package/dist/components/table/components/table-header/table-header.js +27 -33
- package/dist/components/table/table.const.d.ts +10 -6
- package/dist/components/table/table.const.js +10 -6
- package/dist/components/table/table.js +39 -28
- package/dist/components/table-card/table-card.js +2 -2
- package/dist/components/tooltip/tooltip.js +24 -22
- package/dist/css/config/colors/backgrounds.css +8 -8
- package/dist/css/config/colors/components/avatar.css +12 -12
- package/dist/css/config/colors/components/badge.css +42 -42
- package/dist/css/config/colors/components/checkbox.css +2 -2
- package/dist/css/config/colors/components/featured-icon.css +18 -18
- package/dist/css/config/colors/components/progress-bar.css +2 -2
- package/dist/css/config/colors/components/radio-button.css +2 -2
- package/dist/css/config/colors/components/scroll-overlay.css +4 -4
- package/dist/css/config/colors/components/tab.css +7 -7
- package/dist/css/config/colors/components/toggle-switch.css +1 -1
- package/dist/css/config/colors/components/toggle.css +6 -6
- package/dist/css/config/colors/icons.css +20 -20
- package/dist/css/config/colors/overlay.css +1 -1
- package/dist/css/config/colors/semantic/alert.css +44 -0
- package/dist/css/config/colors/semantic/background.css +51 -0
- package/dist/css/config/colors/semantic/base.css +395 -0
- package/dist/css/config/colors/semantic/button.css +131 -0
- package/dist/css/config/colors/semantic/drop-shadow.css +30 -0
- package/dist/css/config/colors/semantic/dropdown.css +12 -0
- package/dist/css/config/colors/semantic/index.css +16 -0
- package/dist/css/config/colors/semantic/input.css +56 -0
- package/dist/css/config/colors/semantic/overlay.css +13 -0
- package/dist/css/config/colors/semantic/stroke.css +90 -0
- package/dist/css/config/colors/semantic/surface.css +135 -0
- package/dist/css/config/colors/semantic/text.css +113 -0
- package/dist/css/config/colors/semantic/tooltip.css +12 -0
- package/dist/css/config/colors/shape.css +40 -40
- package/dist/css/config/colors/stroke.css +19 -19
- package/dist/css/config/colors/surfaces.css +47 -47
- package/dist/css/config/colors/text.css +37 -37
- package/dist/css/config/components/index.css +0 -2
- package/dist/css/config/config-deprecated.css +3 -5
- package/dist/css/config/config.css +5 -3
- package/dist/css/config/other-variables.css +9 -0
- package/dist/css/config/shadows.css +15 -0
- package/dist/css/config/typography/2xl.css +7 -14
- package/dist/css/config/typography/3xl.css +7 -14
- package/dist/css/config/typography/4xl.css +7 -14
- package/dist/css/config/typography/base.css +7 -14
- package/dist/css/config/typography/lg.css +7 -14
- package/dist/css/config/typography/sm.css +7 -14
- package/dist/css/config/typography/xl.css +7 -14
- package/dist/css/config/typography/xs.css +7 -14
- package/dist/css/styles/tailwind.css +1 -1
- package/dist/types/components/alert/alert.const.d.ts +0 -3
- package/dist/types/components/button/button.d.ts +3 -3
- package/dist/types/components/nav-header/nav-item/nav-item.d.ts +4 -2
- package/dist/types/components/table/components/table-filter/close-filter-confirm/filter-confirmation-dialog.d.ts +10 -0
- package/dist/types/components/table/components/table-filter/close-filter-confirm/filter-confirmation-dialog.utils.d.ts +13 -0
- package/dist/types/components/table/components/table-filter/table-filter.context.d.ts +1 -0
- package/dist/types/components/table/components/table-filter/table-filter.hook.d.ts +1 -0
- package/dist/types/components/table/table.const.d.ts +10 -6
- package/package.json +1 -1
- package/dist/css/config/colors/components/alert.css +0 -84
- package/dist/css/config/colors/components/button.css +0 -93
- package/dist/css/config/colors/components/select.css +0 -128
- package/dist/css/config/colors/components/text-button.css +0 -67
- package/dist/css/config/colors/defaults.css +0 -393
- package/dist/css/config/colors/semantic-colors.css +0 -353
- package/dist/css/config/components/button.css +0 -160
- package/dist/css/config/components/input.css +0 -56
- /package/dist/css/config/typography/{typography.css → index.css} +0 -0
|
@@ -1,105 +1,161 @@
|
|
|
1
1
|
import { jsx as t, jsxs as o } from "react/jsx-runtime";
|
|
2
|
-
import * as
|
|
3
|
-
import { ChevronDownIcon as
|
|
4
|
-
import { cn as
|
|
2
|
+
import * as a from "@radix-ui/react-select";
|
|
3
|
+
import { ChevronDownIcon as i, ChevronUpIcon as d } from "lucide-react";
|
|
4
|
+
import { cn as l } from "../../lib/utils.js";
|
|
5
5
|
import u from "../assets/icons/circle-check-filled.js";
|
|
6
|
-
function
|
|
7
|
-
return /* @__PURE__ */ t(
|
|
6
|
+
function h({ ...e }) {
|
|
7
|
+
return /* @__PURE__ */ t(a.Root, { "data-slot": "select", ...e });
|
|
8
8
|
}
|
|
9
|
-
function
|
|
9
|
+
function b({
|
|
10
10
|
className: e,
|
|
11
|
-
...
|
|
11
|
+
...s
|
|
12
12
|
}) {
|
|
13
13
|
return /* @__PURE__ */ t(
|
|
14
|
-
|
|
14
|
+
a.Group,
|
|
15
15
|
{
|
|
16
16
|
"data-slot": "select-group",
|
|
17
|
-
className:
|
|
18
|
-
|
|
17
|
+
className: l(
|
|
18
|
+
// layout
|
|
19
|
+
"flex w-full flex-col items-start gap-1 relative rounded-none",
|
|
20
|
+
e
|
|
21
|
+
),
|
|
22
|
+
...s
|
|
19
23
|
}
|
|
20
24
|
);
|
|
21
25
|
}
|
|
22
|
-
function
|
|
26
|
+
function g({
|
|
23
27
|
className: e,
|
|
24
|
-
...
|
|
28
|
+
...s
|
|
25
29
|
}) {
|
|
26
30
|
return /* @__PURE__ */ t(
|
|
27
|
-
|
|
31
|
+
a.Value,
|
|
28
32
|
{
|
|
29
33
|
"data-slot": "select-value",
|
|
30
|
-
className:
|
|
31
|
-
|
|
34
|
+
className: l(
|
|
35
|
+
// layout + text alignment
|
|
36
|
+
"w-full self-center items-start text-left flex gap-1",
|
|
37
|
+
e
|
|
38
|
+
),
|
|
39
|
+
...s
|
|
32
40
|
}
|
|
33
41
|
);
|
|
34
42
|
}
|
|
35
|
-
function
|
|
43
|
+
function w({
|
|
36
44
|
className: e,
|
|
37
|
-
size:
|
|
38
|
-
children:
|
|
39
|
-
...
|
|
45
|
+
size: s = "default",
|
|
46
|
+
children: r,
|
|
47
|
+
...n
|
|
40
48
|
}) {
|
|
41
49
|
return /* @__PURE__ */ o(
|
|
42
|
-
|
|
50
|
+
a.Trigger,
|
|
43
51
|
{
|
|
44
52
|
"data-slot": "select-trigger",
|
|
45
|
-
"data-size":
|
|
46
|
-
className:
|
|
47
|
-
|
|
53
|
+
"data-size": s,
|
|
54
|
+
className: l(
|
|
55
|
+
// base layout
|
|
56
|
+
"h-7.5 flex items-center justify-center w-full self-stretch transition-all cursor-pointer",
|
|
57
|
+
"gap-[6px] p-2 rounded-md",
|
|
58
|
+
// size variants
|
|
59
|
+
"data-[size=sm]:gap-1 data-[size=sm]:p-[6px]",
|
|
60
|
+
"data-[size=sm]:h-6.5",
|
|
61
|
+
//text
|
|
62
|
+
"leading-none-medium-sm text-text-neutral-primary",
|
|
63
|
+
"hover:text-text-neutral-secondary",
|
|
64
|
+
"focus:text-text-neutral-secondary",
|
|
65
|
+
"data-[state=open]:text-text-neutral-secondary",
|
|
66
|
+
"data-[disabled]:text-text-neutral-muted",
|
|
67
|
+
// focus reset
|
|
68
|
+
"focus:outline-none outline-none focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus-ring-default",
|
|
69
|
+
// surface + stroke (default)
|
|
70
|
+
"bg-input-surface-default box-shadow-button-default",
|
|
71
|
+
// hover
|
|
72
|
+
"hover:bg-input-surface-hover",
|
|
73
|
+
"hover:box-shadow-button-default-hover",
|
|
74
|
+
// focus
|
|
75
|
+
"focus:bg-input-surface-pressed",
|
|
76
|
+
"focus:box-shadow-button-default-pressed",
|
|
77
|
+
// open
|
|
78
|
+
"data-[state=open]:bg-input-surface-pressed",
|
|
79
|
+
"data-[state=open]:box-shadow-button-default-pressed",
|
|
80
|
+
// disabled
|
|
81
|
+
"data-[disabled]:bg-input-surface-disabled data-[disabled]:pointer-events-none data-[disabled]:cursor-not-allowed",
|
|
82
|
+
e
|
|
83
|
+
),
|
|
84
|
+
...n,
|
|
48
85
|
children: [
|
|
49
|
-
|
|
50
|
-
/* @__PURE__ */ t(
|
|
86
|
+
r,
|
|
87
|
+
/* @__PURE__ */ t(a.Icon, { asChild: !0, children: /* @__PURE__ */ t(i, { className: "shrink-0 w-[14px] h-[14px] aspect-square text-text-neutral-muted" }) })
|
|
51
88
|
]
|
|
52
89
|
}
|
|
53
90
|
);
|
|
54
91
|
}
|
|
55
|
-
function
|
|
92
|
+
function v({
|
|
56
93
|
className: e,
|
|
57
|
-
children:
|
|
58
|
-
position:
|
|
59
|
-
...
|
|
94
|
+
children: s,
|
|
95
|
+
position: r = "popper",
|
|
96
|
+
...n
|
|
60
97
|
}) {
|
|
61
|
-
return /* @__PURE__ */ t(
|
|
62
|
-
|
|
98
|
+
return /* @__PURE__ */ t(a.Portal, { children: /* @__PURE__ */ t(
|
|
99
|
+
a.Content,
|
|
63
100
|
{
|
|
64
101
|
"data-slot": "select-content",
|
|
65
|
-
className:
|
|
102
|
+
className: l(
|
|
103
|
+
"min-w-[var(--radix-select-trigger-width)] flex flex-col items-start p-1 rounded-xl",
|
|
104
|
+
// background stack (overlay on top + base)
|
|
105
|
+
"bg-dropdown-surface",
|
|
106
|
+
// elevation + hairline stroke
|
|
107
|
+
"box-shadow-medium-10",
|
|
108
|
+
e
|
|
109
|
+
),
|
|
66
110
|
sideOffset: 10,
|
|
67
|
-
position:
|
|
68
|
-
...
|
|
69
|
-
children: /* @__PURE__ */ t(
|
|
111
|
+
position: r,
|
|
112
|
+
...n,
|
|
113
|
+
children: /* @__PURE__ */ t(a.Viewport, { className: "!w-full ", children: s })
|
|
70
114
|
}
|
|
71
115
|
) });
|
|
72
116
|
}
|
|
73
|
-
function
|
|
117
|
+
function N({
|
|
74
118
|
className: e,
|
|
75
|
-
...
|
|
119
|
+
...s
|
|
76
120
|
}) {
|
|
77
121
|
return /* @__PURE__ */ t(
|
|
78
|
-
|
|
122
|
+
a.Label,
|
|
79
123
|
{
|
|
80
124
|
"data-slot": "select-label",
|
|
81
|
-
className:
|
|
82
|
-
|
|
125
|
+
className: l(
|
|
126
|
+
"flex items-center gap-1 self-stretch text-text-neutral-secondary",
|
|
127
|
+
"px-2 pt-2 pb-1",
|
|
128
|
+
"leading-none-medium-sm",
|
|
129
|
+
e
|
|
130
|
+
),
|
|
131
|
+
...s
|
|
83
132
|
}
|
|
84
133
|
);
|
|
85
134
|
}
|
|
86
|
-
function
|
|
135
|
+
function S({ className: e, children: s, leftIcon: r, label: n, ...c }) {
|
|
87
136
|
return /* @__PURE__ */ o(
|
|
88
|
-
|
|
137
|
+
a.Item,
|
|
89
138
|
{
|
|
90
139
|
"data-slot": "select-item",
|
|
91
|
-
className:
|
|
92
|
-
|
|
140
|
+
className: l(
|
|
141
|
+
"border-none w-full relative self-stretch flex items-center justify-between gap-2 cursor-pointer outline-none rounded-md",
|
|
142
|
+
"data-[disabled]:pointer-events-none",
|
|
143
|
+
"p-2",
|
|
144
|
+
// hover/active surface
|
|
145
|
+
"data-[state=active]:surface-neutral-focused hover:surface-neutral-focused",
|
|
146
|
+
e
|
|
147
|
+
),
|
|
148
|
+
...c,
|
|
93
149
|
children: [
|
|
94
|
-
/* @__PURE__ */ t(
|
|
95
|
-
|
|
96
|
-
/* @__PURE__ */ t("div", { className: "flex-1 overflow-hidden text-ellipsis
|
|
150
|
+
/* @__PURE__ */ t(a.ItemText, { asChild: !0, children: /* @__PURE__ */ o("div", { className: "flex items-center justify-center gap-2 flex-1 overflow-hidden text-ellipsis leading-none-medium-sm", children: [
|
|
151
|
+
r && /* @__PURE__ */ t("div", { className: "flex w-3.5 h-3.5 items-center justify-center", children: r }),
|
|
152
|
+
/* @__PURE__ */ t("div", { className: "flex-1 overflow-hidden text-ellipsis leading-none-medium-sm", children: s || n })
|
|
97
153
|
] }) }),
|
|
98
154
|
/* @__PURE__ */ t(
|
|
99
|
-
|
|
155
|
+
a.ItemIndicator,
|
|
100
156
|
{
|
|
101
157
|
"data-slot": "select-item-indicator",
|
|
102
|
-
className: "
|
|
158
|
+
className: "flex w-[14px] h-[14px] items-center justify-center",
|
|
103
159
|
children: /* @__PURE__ */ t(u, { className: "w-4 h-4" })
|
|
104
160
|
}
|
|
105
161
|
)
|
|
@@ -107,59 +163,56 @@ function b({ className: e, children: l, leftIcon: s, label: a, ...i }) {
|
|
|
107
163
|
}
|
|
108
164
|
);
|
|
109
165
|
}
|
|
110
|
-
function
|
|
166
|
+
function y({
|
|
111
167
|
className: e,
|
|
112
|
-
...
|
|
168
|
+
...s
|
|
113
169
|
}) {
|
|
114
170
|
return /* @__PURE__ */ t(
|
|
115
|
-
|
|
171
|
+
a.Separator,
|
|
116
172
|
{
|
|
117
173
|
"data-slot": "select-separator",
|
|
118
|
-
className:
|
|
119
|
-
|
|
120
|
-
e
|
|
121
|
-
),
|
|
122
|
-
...l
|
|
174
|
+
className: l("border-t-[1px] border-solid border-stroke-solid-light my-1 mx-1", e),
|
|
175
|
+
...s
|
|
123
176
|
}
|
|
124
177
|
);
|
|
125
178
|
}
|
|
126
|
-
function
|
|
179
|
+
function Z({
|
|
127
180
|
className: e,
|
|
128
|
-
...
|
|
181
|
+
...s
|
|
129
182
|
}) {
|
|
130
183
|
return /* @__PURE__ */ t(
|
|
131
|
-
|
|
184
|
+
a.ScrollUpButton,
|
|
132
185
|
{
|
|
133
186
|
"data-slot": "select-scroll-up-button",
|
|
134
|
-
className:
|
|
135
|
-
...
|
|
187
|
+
className: l("flex cursor-default items-center justify-center py-1", e),
|
|
188
|
+
...s,
|
|
136
189
|
children: /* @__PURE__ */ t(d, { className: "size-4" })
|
|
137
190
|
}
|
|
138
191
|
);
|
|
139
192
|
}
|
|
140
|
-
function
|
|
193
|
+
function j({
|
|
141
194
|
className: e,
|
|
142
|
-
...
|
|
195
|
+
...s
|
|
143
196
|
}) {
|
|
144
197
|
return /* @__PURE__ */ t(
|
|
145
|
-
|
|
198
|
+
a.ScrollDownButton,
|
|
146
199
|
{
|
|
147
200
|
"data-slot": "select-scroll-down-button",
|
|
148
|
-
className:
|
|
149
|
-
...
|
|
150
|
-
children: /* @__PURE__ */ t(
|
|
201
|
+
className: l("flex cursor-default items-center justify-center py-1", e),
|
|
202
|
+
...s,
|
|
203
|
+
children: /* @__PURE__ */ t(i, { className: "size-4" })
|
|
151
204
|
}
|
|
152
205
|
);
|
|
153
206
|
}
|
|
154
207
|
export {
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
208
|
+
h as Z2Select,
|
|
209
|
+
v as Z2SelectContent,
|
|
210
|
+
b as Z2SelectGroup,
|
|
211
|
+
S as Z2SelectItem,
|
|
212
|
+
N as Z2SelectLabel,
|
|
213
|
+
j as Z2SelectScrollDownButton,
|
|
214
|
+
Z as Z2SelectScrollUpButton,
|
|
215
|
+
y as Z2SelectSeparator,
|
|
216
|
+
w as Z2SelectTrigger,
|
|
217
|
+
g as Z2SelectValue
|
|
165
218
|
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
interface FilterConfirmationDialogProps {
|
|
3
|
+
onClose: () => void;
|
|
4
|
+
onKeepChanges: () => void;
|
|
5
|
+
onRevertChanges: () => void;
|
|
6
|
+
onApplyChanges: () => void;
|
|
7
|
+
hasUnsavedChanges: boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare const FilterConfirmationDialog: React.FC<FilterConfirmationDialogProps>;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { jsx as e, jsxs as n } from "react/jsx-runtime";
|
|
2
|
+
import { Button as l } from "../../../../button/button.js";
|
|
3
|
+
import { Z2Dialog as s, Z2DialogContent as d, Z2DialogHeader as h, Z2DialogTitle as c, Z2DialogDescription as g, Z2DialogFooter as m } from "../../../../dialog/dialog.js";
|
|
4
|
+
const v = ({
|
|
5
|
+
onClose: r,
|
|
6
|
+
onKeepChanges: i,
|
|
7
|
+
onRevertChanges: o,
|
|
8
|
+
onApplyChanges: a,
|
|
9
|
+
hasUnsavedChanges: t
|
|
10
|
+
}) => t ? /* @__PURE__ */ e(s, { open: !0, onOpenChange: r, children: /* @__PURE__ */ n(d, { className: "max-w-md p-4 rounded-2xl", children: [
|
|
11
|
+
/* @__PURE__ */ n(h, { children: [
|
|
12
|
+
/* @__PURE__ */ n("div", { className: "flex justify-between", children: [
|
|
13
|
+
/* @__PURE__ */ e(c, { children: "Unsaved Filter Changes" }),
|
|
14
|
+
/* @__PURE__ */ e(
|
|
15
|
+
l,
|
|
16
|
+
{
|
|
17
|
+
"aria-label": "Close",
|
|
18
|
+
className: "ml-4 p-2 text-xl leading-none font-bold bg-transparent border-none shadow-none hover:bg-gray-100 min-w-0 min-h-0",
|
|
19
|
+
onClick: i,
|
|
20
|
+
children: "×"
|
|
21
|
+
}
|
|
22
|
+
)
|
|
23
|
+
] }),
|
|
24
|
+
/* @__PURE__ */ e(g, { children: "You have unsaved filter changes. Would you like to keep these changes or revert to the previous state?" })
|
|
25
|
+
] }),
|
|
26
|
+
/* @__PURE__ */ n(m, { children: [
|
|
27
|
+
/* @__PURE__ */ e(l, { onClick: o, variant: "stroke", shade: "danger", size: "small", children: "Discard" }),
|
|
28
|
+
/* @__PURE__ */ e(l, { onClick: a, variant: "filled", shade: "brand", size: "small", children: "Apply Changes" })
|
|
29
|
+
] })
|
|
30
|
+
] }) }) : null;
|
|
31
|
+
export {
|
|
32
|
+
v as FilterConfirmationDialog
|
|
33
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { FilterRule } from '../../../table.type';
|
|
2
|
+
/**
|
|
3
|
+
* Compares two filter arrays to determine if they are different
|
|
4
|
+
*/
|
|
5
|
+
export declare const areFiltersEqual: (filters1: FilterRule[], filters2: FilterRule[]) => boolean;
|
|
6
|
+
/**
|
|
7
|
+
* Checks if there are unsaved changes by comparing temporary filters with applied filters
|
|
8
|
+
*/
|
|
9
|
+
export declare const hasUnsavedFilterChanges: (tempFilters: FilterRule[], appliedFilters: FilterRule[]) => boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Checks if there are unsaved changes for a specific column filter
|
|
12
|
+
*/
|
|
13
|
+
export declare const hasUnsavedFilterChangesForColumn: (columnName: string, tempFilters: FilterRule[], appliedFilters: FilterRule[]) => boolean;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
const v = (l, n) => {
|
|
2
|
+
if (l.length !== n.length)
|
|
3
|
+
return !1;
|
|
4
|
+
const u = [...l].sort((e, t) => e.field.localeCompare(t.field)), r = [...n].sort((e, t) => e.field.localeCompare(t.field));
|
|
5
|
+
return u.every((e, t) => {
|
|
6
|
+
const a = r[t];
|
|
7
|
+
return e.field !== a.field || e.condition !== a.condition ? !1 : Array.isArray(e.value) && Array.isArray(a.value) ? e.value.length !== a.value.length ? !1 : e.value.every((i, s) => i === a.value[s]) : Array.isArray(e.value) || Array.isArray(a.value) ? !1 : e.value === a.value;
|
|
8
|
+
});
|
|
9
|
+
}, o = (l, n) => {
|
|
10
|
+
const u = l.filter((r) => Array.isArray(r.value) ? r.value.length > 0 : r.value !== "");
|
|
11
|
+
return !v(u, n);
|
|
12
|
+
}, f = (l, n, u) => {
|
|
13
|
+
const r = n.find((a) => a.field === l), e = u.find((a) => a.field === l);
|
|
14
|
+
return !r || !(Array.isArray(r.value) ? r.value.length > 0 : r.value !== "") ? !1 : !e || r.condition !== e.condition ? !0 : Array.isArray(r.value) && Array.isArray(e.value) ? r.value.length !== e.value.length ? !0 : !r.value.every((a, i) => a === e.value[i]) : Array.isArray(r.value) || Array.isArray(e.value) ? !0 : r.value !== e.value;
|
|
15
|
+
};
|
|
16
|
+
export {
|
|
17
|
+
v as areFiltersEqual,
|
|
18
|
+
o as hasUnsavedFilterChanges,
|
|
19
|
+
f as hasUnsavedFilterChangesForColumn
|
|
20
|
+
};
|
|
@@ -1,113 +1,134 @@
|
|
|
1
1
|
import { jsxs as l, jsx as t } from "react/jsx-runtime";
|
|
2
|
-
import * as
|
|
3
|
-
import { Button as
|
|
4
|
-
import { useTableFilterContext as
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import { SelectedFiltersDisplay as
|
|
11
|
-
import { useClickOutside as
|
|
12
|
-
import { createFilterDisplayItems as
|
|
13
|
-
|
|
14
|
-
|
|
2
|
+
import * as h from "react";
|
|
3
|
+
import { Button as u } from "../../../button/button.js";
|
|
4
|
+
import { useTableFilterContext as P } from "./table-filter.context.js";
|
|
5
|
+
import U from "./filters/text.js";
|
|
6
|
+
import V from "./filters/boolean.js";
|
|
7
|
+
import q from "./filters/number/number.js";
|
|
8
|
+
import E from "./filters/checkbox.js";
|
|
9
|
+
import G from "../../../assets/icons/circle-check-filled.js";
|
|
10
|
+
import { SelectedFiltersDisplay as H } from "./selected-filters-display/selected-filters-display.js";
|
|
11
|
+
import { useClickOutside as J } from "../../../../hooks/useClickOutside.js";
|
|
12
|
+
import { createFilterDisplayItems as L, calculateTotalCount as M } from "./selected-filters-display/selected-filters-display.utils.js";
|
|
13
|
+
import { FilterConfirmationDialog as Q } from "./close-filter-confirm/filter-confirmation-dialog.js";
|
|
14
|
+
import { hasUnsavedFilterChanges as y } from "./close-filter-confirm/filter-confirmation-dialog.utils.js";
|
|
15
|
+
const ie = () => {
|
|
16
|
+
const [i, o] = h.useState(!1), [C, a] = h.useState(!1), x = h.useRef(null), {
|
|
15
17
|
selectedColumn: r,
|
|
16
|
-
setSelectedColumn:
|
|
17
|
-
getFilterForColumn:
|
|
18
|
-
hasFilterForColumn:
|
|
19
|
-
updateColumnFilter:
|
|
20
|
-
clearAllFilters:
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
}
|
|
18
|
+
setSelectedColumn: F,
|
|
19
|
+
getFilterForColumn: k,
|
|
20
|
+
hasFilterForColumn: N,
|
|
21
|
+
updateColumnFilter: w,
|
|
22
|
+
clearAllFilters: T,
|
|
23
|
+
resetToAppliedFilters: A,
|
|
24
|
+
applyFilters: D,
|
|
25
|
+
hasActiveFilters: c,
|
|
26
|
+
filterableFields: j,
|
|
27
|
+
tempFilters: n,
|
|
28
|
+
schema: m,
|
|
29
|
+
filter: d,
|
|
30
|
+
filterComponents: p = {}
|
|
31
|
+
} = P();
|
|
32
|
+
J(x, () => {
|
|
33
|
+
y(n, d.value) && i ? a(!0) : o(!1);
|
|
34
|
+
});
|
|
35
|
+
const v = () => {
|
|
36
|
+
D(), o(!1);
|
|
37
|
+
}, S = () => {
|
|
38
|
+
a(!1), o(!1);
|
|
39
|
+
}, O = () => {
|
|
40
|
+
A(), a(!1), o(!1);
|
|
41
|
+
}, R = () => {
|
|
42
|
+
a(!1);
|
|
43
|
+
}, $ = L(n, m), b = M($), z = () => {
|
|
33
44
|
if (!r) return null;
|
|
34
|
-
const e =
|
|
35
|
-
boolean:
|
|
36
|
-
text:
|
|
37
|
-
number:
|
|
38
|
-
checkbox:
|
|
39
|
-
},
|
|
40
|
-
if (!
|
|
45
|
+
const e = m.find((f) => f.key === r), B = {
|
|
46
|
+
boolean: V,
|
|
47
|
+
text: U,
|
|
48
|
+
number: q,
|
|
49
|
+
checkbox: E
|
|
50
|
+
}, g = (e == null ? void 0 : e.cellType) && (p == null ? void 0 : p[e.cellType]) || B[(e == null ? void 0 : e.cellType) ?? "text"];
|
|
51
|
+
if (!g)
|
|
41
52
|
return console.warn(
|
|
42
53
|
`No filter component found for column "${e == null ? void 0 : e.key}" with cellType "${e == null ? void 0 : e.cellType}". Provide a custom filter component or use supported types: "text", "number", "boolean", "checkbox".`
|
|
43
54
|
), null;
|
|
44
|
-
const s =
|
|
55
|
+
const s = k(r), I = {
|
|
45
56
|
condition: (s == null ? void 0 : s.condition) || "",
|
|
46
57
|
value: (s == null ? void 0 : s.value) || ""
|
|
47
58
|
};
|
|
48
59
|
return /* @__PURE__ */ t("div", { className: "flex-1", children: /* @__PURE__ */ t("div", { className: "mb-4", children: /* @__PURE__ */ t("div", { className: "", children: /* @__PURE__ */ t(
|
|
49
|
-
|
|
60
|
+
g,
|
|
50
61
|
{
|
|
51
|
-
value:
|
|
52
|
-
onChange: ({ condition:
|
|
62
|
+
value: I,
|
|
63
|
+
onChange: ({ condition: f, value: K }) => w(r, f, K),
|
|
53
64
|
filterOptions: e == null ? void 0 : e.filterOptions
|
|
54
65
|
}
|
|
55
66
|
) }) }) });
|
|
56
67
|
};
|
|
57
|
-
return /* @__PURE__ */ l("div", { className: "relative", ref:
|
|
68
|
+
return /* @__PURE__ */ l("div", { className: "relative", ref: x, children: [
|
|
58
69
|
/* @__PURE__ */ l(
|
|
59
|
-
|
|
70
|
+
u,
|
|
60
71
|
{
|
|
61
72
|
onClick: (e) => {
|
|
62
|
-
e.stopPropagation(), o(!
|
|
73
|
+
e.stopPropagation(), o(!i);
|
|
63
74
|
},
|
|
64
|
-
variant:
|
|
65
|
-
shade:
|
|
75
|
+
variant: c ? "filled" : "stroke",
|
|
76
|
+
shade: c ? "brand" : "neutral",
|
|
66
77
|
size: "small",
|
|
67
78
|
children: [
|
|
68
79
|
"Filter ",
|
|
69
|
-
|
|
80
|
+
c && `(${d.value.length})`
|
|
70
81
|
]
|
|
71
82
|
}
|
|
72
83
|
),
|
|
73
|
-
|
|
84
|
+
i && /* @__PURE__ */ l("div", { className: "absolute top-full left-0 mt-2 w-[512px] bg-surface-neutral-default border border-stroke-solid-light rounded-2xl z-10 overflow-hidden shadow-lg", children: [
|
|
74
85
|
/* @__PURE__ */ l("div", { className: "flex min-h-[442px]", children: [
|
|
75
86
|
/* @__PURE__ */ l("div", { className: "w-48 border-r border-stroke-solid-light p-2 flex flex-col gap-1.5", children: [
|
|
76
87
|
/* @__PURE__ */ t("div", { className: "p-2 pb-1", children: /* @__PURE__ */ t("h3", { className: "leading-none-medium-sm text-text-neutral-secondary", children: "Filters" }) }),
|
|
77
|
-
|
|
88
|
+
j.map((e) => /* @__PURE__ */ l(
|
|
78
89
|
"button",
|
|
79
90
|
{
|
|
80
|
-
onClick: () =>
|
|
91
|
+
onClick: () => F(e.key),
|
|
81
92
|
className: `w-full text-left p-2 text-sm flex items-center justify-between hover:bg-surface-neutral-hovered transition-colors rounded-lg ${r === e.key ? "bg-surface-neutral-focused text-text-brand-primary" : "text-text-neutral-primary"}`,
|
|
82
93
|
children: [
|
|
83
94
|
/* @__PURE__ */ t("span", { className: "truncate", children: e.title }),
|
|
84
|
-
|
|
95
|
+
N(e.key) && /* @__PURE__ */ t(G, { className: "w-4 h-4 text-text-brand-secondary flex-shrink-0 ml-2" })
|
|
85
96
|
]
|
|
86
97
|
},
|
|
87
98
|
e.key
|
|
88
99
|
))
|
|
89
100
|
] }),
|
|
90
|
-
/* @__PURE__ */ t("div", { className: "flex-1 flex flex-col", children: r ?
|
|
101
|
+
/* @__PURE__ */ t("div", { className: "flex-1 flex flex-col", children: r ? z() : /* @__PURE__ */ t("div", { className: "flex-1 flex items-center justify-center text-text-neutral-muted", children: "Select a column to configure its filter" }) })
|
|
91
102
|
] }),
|
|
92
|
-
!!
|
|
93
|
-
/* @__PURE__ */ t(
|
|
103
|
+
!!b && /* @__PURE__ */ l("div", { className: "flex justify-between items-end p-4 border-t border-stroke-solid-medium min-h-[71px]", children: [
|
|
104
|
+
/* @__PURE__ */ t(H, { selectedFilters: n, schema: m }),
|
|
94
105
|
/* @__PURE__ */ l("div", { className: "flex justify-end gap-2", children: [
|
|
95
|
-
/* @__PURE__ */ t(
|
|
106
|
+
/* @__PURE__ */ t(u, { onClick: T, variant: "stroke", shade: "neutral", size: "small", children: "Clear All" }),
|
|
96
107
|
/* @__PURE__ */ t(
|
|
97
|
-
|
|
108
|
+
u,
|
|
98
109
|
{
|
|
99
|
-
onClick:
|
|
110
|
+
onClick: v,
|
|
100
111
|
variant: "filled",
|
|
101
112
|
shade: "neutral",
|
|
102
113
|
size: "small",
|
|
103
|
-
children: `Apply ${
|
|
114
|
+
children: `Apply ${b || ""}`
|
|
104
115
|
}
|
|
105
116
|
)
|
|
106
117
|
] })
|
|
107
118
|
] })
|
|
108
|
-
] })
|
|
119
|
+
] }),
|
|
120
|
+
C && /* @__PURE__ */ t(
|
|
121
|
+
Q,
|
|
122
|
+
{
|
|
123
|
+
onClose: R,
|
|
124
|
+
onKeepChanges: S,
|
|
125
|
+
onRevertChanges: O,
|
|
126
|
+
onApplyChanges: v,
|
|
127
|
+
hasUnsavedChanges: y(n, d.value)
|
|
128
|
+
}
|
|
129
|
+
)
|
|
109
130
|
] });
|
|
110
131
|
};
|
|
111
132
|
export {
|
|
112
|
-
|
|
133
|
+
ie as TableFilterButton
|
|
113
134
|
};
|