@ztwoint/z-ui 0.1.127 → 0.1.128
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/column-reorder/column-reorder.hook.js +11 -9
- package/dist/components/column-reorder/column-reorder.js +23 -19
- package/dist/components/column-reorder/column-reorder.type.d.ts +3 -0
- package/dist/components/column-reorder/components/column-item/column-item.hook.d.ts +13 -2
- package/dist/components/column-reorder/components/column-item/column-item.hook.js +57 -39
- package/dist/components/column-reorder/components/column-item/column-item.js +111 -45
- package/dist/components/column-reorder/components/column-item/column-item.type.d.ts +2 -0
- package/dist/components/primitives/chart-card/builders/chart-builder-factory.js +15 -9
- package/dist/components/primitives/chart-card/config/colors.js +32 -22
- package/dist/components/primitives/index.d.ts +2 -0
- package/dist/components/primitives/table-card/table-card.js +216 -0
- package/dist/components/table/components/cell/avatar-cell.js +6 -5
- package/dist/components/table/table-provider.js +4 -3
- package/dist/components/table-filter/close-filter-confirm/filter-confirmation-dialog.js +20 -0
- package/dist/components/table-filter/close-filter-confirm/filter-confirmation-dialog.utils.js +20 -0
- package/dist/components/table-filter/filters/boolean.js +67 -0
- package/dist/components/table-filter/filters/checkbox.js +70 -0
- package/dist/components/table-filter/filters/number/filter-input-field.js +38 -0
- package/dist/components/table-filter/filters/number/number.hook.js +33 -0
- package/dist/components/table-filter/filters/number/number.js +55 -0
- package/dist/components/table-filter/filters/text.js +50 -0
- package/dist/components/table-filter/index.js +11 -0
- package/dist/components/table-filter/selected-filters-display/selected-filters-display.js +31 -0
- package/dist/components/table-filter/selected-filters-display/selected-filters-display.utils.js +23 -0
- package/dist/components/table-filter/table-filter-button.js +181 -0
- package/dist/components/table-filter/table-filter-column-button.js +113 -0
- package/dist/components/table-filter/table-filter-provider.js +32 -0
- package/dist/components/table-filter/table-filter.context.js +12 -3
- package/dist/components/table-filter/table-filter.hook.js +72 -0
- package/dist/components/table-filter/table-filter.utils.js +12 -0
- package/dist/css/styles/tailwind.css +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +363 -345
- package/dist/types/components/column-reorder/column-reorder.type.d.ts +3 -0
- package/dist/types/components/column-reorder/components/column-item/column-item.hook.d.ts +13 -2
- package/dist/types/components/column-reorder/components/column-item/column-item.type.d.ts +2 -0
- package/dist/types/components/primitives/index.d.ts +2 -0
- package/dist/types/index.d.ts +2 -2
- package/package.json +1 -1
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
import { jsx as t, jsxs as m } from "react/jsx-runtime";
|
|
2
|
+
import { Table as r } from "../../table/table-provider.js";
|
|
3
|
+
import "react";
|
|
4
|
+
import { cn as d } from "../../../lib/utils.js";
|
|
5
|
+
/* empty css */
|
|
6
|
+
import "../../alert/alert.const.js";
|
|
7
|
+
import "../../button/button.js";
|
|
8
|
+
import "../../collapsible-side-nav-bar/side-nav-bar-provider.js";
|
|
9
|
+
import "../../collapsible-side-nav-bar/side-nav-bar.js";
|
|
10
|
+
import "../../collapsible-side-nav-bar/side-nav-bar-header.js";
|
|
11
|
+
import "../../collapsible-side-nav-bar/side-nav-bar-content.js";
|
|
12
|
+
import "../../collapsible-side-nav-bar/side-nav-bar-footer.js";
|
|
13
|
+
import "../../collapsible-side-nav-bar/side-nav-bar-group.js";
|
|
14
|
+
import "../../collapsible-side-nav-bar/side-nav-bar-item.js";
|
|
15
|
+
import "../../collapsible-side-nav-bar/side-nav-bar-separator.js";
|
|
16
|
+
import "../../collapsible-side-nav-bar/context.js";
|
|
17
|
+
import "../../collapsible-side-nav-bar/popover/popover.js";
|
|
18
|
+
import "react-country-flag";
|
|
19
|
+
import "classnames";
|
|
20
|
+
import "@radix-ui/react-checkbox";
|
|
21
|
+
import "@radix-ui/react-dialog";
|
|
22
|
+
import "../../dropdown/z2-dropdown.js";
|
|
23
|
+
import "@radix-ui/react-dropdown-menu";
|
|
24
|
+
import "lucide-react";
|
|
25
|
+
import S from "../../assets/icons/octagon-warning-Copy.js";
|
|
26
|
+
import "../../input/input.js";
|
|
27
|
+
import "../../nav-header/nav-header.js";
|
|
28
|
+
import "../../nav-header/nav-item/nav-item.js";
|
|
29
|
+
import "@radix-ui/react-select";
|
|
30
|
+
import "../../stepper/stepper.js";
|
|
31
|
+
import "../../stepper-item/stepper-item.js";
|
|
32
|
+
import "@radix-ui/react-tabs";
|
|
33
|
+
import "../../tooltip/tooltip.js";
|
|
34
|
+
import { Filter as x } from "../../table-filter/index.js";
|
|
35
|
+
import "../../badge/badge.js";
|
|
36
|
+
import "../../avatar/avatar.js";
|
|
37
|
+
import "../../text-preset/text-preset.js";
|
|
38
|
+
import "react-dom";
|
|
39
|
+
import "../../../node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/util/changing-window/count-events-for-safari.js";
|
|
40
|
+
import "../../../node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/ledger/dispatch-consumer-event.js";
|
|
41
|
+
import "@radix-ui/react-slot";
|
|
42
|
+
import "../../radio/z2-radio.js";
|
|
43
|
+
import "../../segmented-control/item.js";
|
|
44
|
+
import "@radix-ui/react-popover";
|
|
45
|
+
import "../popconfirm/popconfirm.js";
|
|
46
|
+
import "../../dynamic-table/z2-table.js";
|
|
47
|
+
import "../../dynamic-table/z2-table-context.js";
|
|
48
|
+
import "../../chart/chart.js";
|
|
49
|
+
import "../chart-card/config/defaults.js";
|
|
50
|
+
import "../chart-card/config/colors.js";
|
|
51
|
+
import "../../z2map/map.js";
|
|
52
|
+
import "../../z2map/map.constants.js";
|
|
53
|
+
import "../../z2map/components/map-pin.js";
|
|
54
|
+
import "../../z2map/components/map-pin-content.js";
|
|
55
|
+
import "../../z2map/components/map-controls.js";
|
|
56
|
+
import "../../z2map/components/map-zoom-control.js";
|
|
57
|
+
import "../../z2map/components/map-style-control.js";
|
|
58
|
+
import "../../table/table.context.js";
|
|
59
|
+
const Dt = ({
|
|
60
|
+
dataSource: w,
|
|
61
|
+
schema: B,
|
|
62
|
+
loading: b,
|
|
63
|
+
emptyMessage: k,
|
|
64
|
+
className: H,
|
|
65
|
+
rounded: c = !0,
|
|
66
|
+
bordered: n = !0,
|
|
67
|
+
showHeader: g = !0,
|
|
68
|
+
headerClassName: j,
|
|
69
|
+
search: s,
|
|
70
|
+
filter: e,
|
|
71
|
+
headerLeftContent: h,
|
|
72
|
+
headerActions: p,
|
|
73
|
+
body: o = {
|
|
74
|
+
cell: { hasBorder: !0 },
|
|
75
|
+
className: "",
|
|
76
|
+
stickyHeader: !0
|
|
77
|
+
},
|
|
78
|
+
showFooter: P = !0,
|
|
79
|
+
footerClassName: T,
|
|
80
|
+
pagination: l,
|
|
81
|
+
paginationInfo: i,
|
|
82
|
+
paginationQuickJumper: a,
|
|
83
|
+
error: u = !1,
|
|
84
|
+
dataSourceError: _ = !1
|
|
85
|
+
}) => {
|
|
86
|
+
var F;
|
|
87
|
+
if (u)
|
|
88
|
+
return /* @__PURE__ */ t("div", { className: "flex flex-col items-center justify-center h-64 bg-background-error-subtle rounded-lg text-text-warning-secondary", children: /* @__PURE__ */ m("div", { className: "flex gap-2", children: [
|
|
89
|
+
/* @__PURE__ */ t(S, { className: "mt-1.5" }),
|
|
90
|
+
/* @__PURE__ */ m("div", { className: "flex flex-col gap-2", children: [
|
|
91
|
+
/* @__PURE__ */ t("div", { className: "text-text-error-primary text-lg font-medium", children: "Error loading data" }),
|
|
92
|
+
/* @__PURE__ */ t("div", { className: "text-sm", children: "Please try again later" }),
|
|
93
|
+
typeof u == "string" && /* @__PURE__ */ t("div", { className: "text-text-warning-secondary text-sm", children: u })
|
|
94
|
+
] })
|
|
95
|
+
] }) });
|
|
96
|
+
const N = a && a.totalPage && a.totalPage >= 2, C = l && l.totalPage && l.totalPage >= 2 || !!i || N, v = s || e || h || p, R = typeof (e == null ? void 0 : e.showFilterButton) > "u" ? !0 : e == null ? void 0 : e.showFilterButton;
|
|
97
|
+
return /* @__PURE__ */ m("div", { className: d("flex flex-col overflow-hidden relative", H), children: [
|
|
98
|
+
/* @__PURE__ */ m(r, { dataSource: w, schema: B, emptyMessage: k, children: [
|
|
99
|
+
g && v && /* @__PURE__ */ m(
|
|
100
|
+
r.Header,
|
|
101
|
+
{
|
|
102
|
+
className: d(
|
|
103
|
+
"flex-shrink-0",
|
|
104
|
+
n && "border-stroke-solid-medium border-1 border-b-0",
|
|
105
|
+
c && "rounded-t-xl",
|
|
106
|
+
j
|
|
107
|
+
),
|
|
108
|
+
children: [
|
|
109
|
+
/* @__PURE__ */ m(r.HeaderContent, { className: "overflow-x-auto p-[1px]", children: [
|
|
110
|
+
h && h,
|
|
111
|
+
s && /* @__PURE__ */ t(
|
|
112
|
+
r.Search,
|
|
113
|
+
{
|
|
114
|
+
search: {
|
|
115
|
+
value: s.value || "",
|
|
116
|
+
onChange: s.onChange || (() => {
|
|
117
|
+
}),
|
|
118
|
+
placeholder: s.placeholder
|
|
119
|
+
},
|
|
120
|
+
className: s.className
|
|
121
|
+
}
|
|
122
|
+
),
|
|
123
|
+
e && /* @__PURE__ */ m(
|
|
124
|
+
x,
|
|
125
|
+
{
|
|
126
|
+
filterSchema: e.filterSchema,
|
|
127
|
+
filter: {
|
|
128
|
+
value: e.value || [],
|
|
129
|
+
onChange: e.onChange || (() => {
|
|
130
|
+
}),
|
|
131
|
+
onFilterClick: e.onFilterClick,
|
|
132
|
+
loading: e.loading
|
|
133
|
+
},
|
|
134
|
+
children: [
|
|
135
|
+
R && /* @__PURE__ */ t(x.FilterButton, {}),
|
|
136
|
+
(F = e == null ? void 0 : e.quickFilters) == null ? void 0 : F.map((f) => /* @__PURE__ */ t(x.FilterColumnButton, { filterName: f }, f))
|
|
137
|
+
]
|
|
138
|
+
}
|
|
139
|
+
)
|
|
140
|
+
] }),
|
|
141
|
+
p && /* @__PURE__ */ t(r.HeaderContent, { children: p })
|
|
142
|
+
]
|
|
143
|
+
}
|
|
144
|
+
),
|
|
145
|
+
/* @__PURE__ */ t(
|
|
146
|
+
r.Body,
|
|
147
|
+
{
|
|
148
|
+
dataSourceError: _,
|
|
149
|
+
cell: o == null ? void 0 : o.cell,
|
|
150
|
+
sort: o == null ? void 0 : o.sort,
|
|
151
|
+
className: d(
|
|
152
|
+
"flex-1 min-h-0",
|
|
153
|
+
n && "border-stroke-solid-light border-1",
|
|
154
|
+
c && !(g && v) && "rounded-t-xl",
|
|
155
|
+
c && !(P && C) && "rounded-b-xl",
|
|
156
|
+
n && "[&_td:first-child]:border-l-0 [&_td:last-child]:border-r-0",
|
|
157
|
+
n && "[&_th:first-child]:border-l-0 [&_th:last-child]:border-r-0",
|
|
158
|
+
o == null ? void 0 : o.className
|
|
159
|
+
),
|
|
160
|
+
stickyHeader: o == null ? void 0 : o.stickyHeader
|
|
161
|
+
}
|
|
162
|
+
),
|
|
163
|
+
P && C && /* @__PURE__ */ m(
|
|
164
|
+
r.Footer,
|
|
165
|
+
{
|
|
166
|
+
className: d(
|
|
167
|
+
"flex-shrink-0 border-stroke-solid-light border-t-[0.5px] mt-[-2px]",
|
|
168
|
+
n && "border",
|
|
169
|
+
c && "rounded-b-xl",
|
|
170
|
+
T
|
|
171
|
+
),
|
|
172
|
+
children: [
|
|
173
|
+
i ? /* @__PURE__ */ t(r.FooterContent, { children: /* @__PURE__ */ t(
|
|
174
|
+
r.PaginationInfo,
|
|
175
|
+
{
|
|
176
|
+
showTotal: i.showTotal,
|
|
177
|
+
totalItems: i.totalItems,
|
|
178
|
+
currentPage: i.currentPage,
|
|
179
|
+
itemsPerPage: i.itemsPerPage
|
|
180
|
+
}
|
|
181
|
+
) }) : a || l ? /* @__PURE__ */ t(r.FooterContent, { children: null }) : null,
|
|
182
|
+
(a || l) && /* @__PURE__ */ m(r.FooterContent, { children: [
|
|
183
|
+
N && /* @__PURE__ */ t(
|
|
184
|
+
r.PaginationQuickJumper,
|
|
185
|
+
{
|
|
186
|
+
currentPage: a.currentPage,
|
|
187
|
+
totalPage: a.totalPage,
|
|
188
|
+
onChange: a.onChange || (() => {
|
|
189
|
+
}),
|
|
190
|
+
disabled: a.disabled
|
|
191
|
+
}
|
|
192
|
+
),
|
|
193
|
+
l && /* @__PURE__ */ t(
|
|
194
|
+
r.Pagination,
|
|
195
|
+
{
|
|
196
|
+
currentPage: l.currentPage,
|
|
197
|
+
totalPage: l.totalPage,
|
|
198
|
+
onChange: l.onChange || (() => {
|
|
199
|
+
}),
|
|
200
|
+
totalItems: l.totalItems
|
|
201
|
+
}
|
|
202
|
+
)
|
|
203
|
+
] })
|
|
204
|
+
]
|
|
205
|
+
}
|
|
206
|
+
)
|
|
207
|
+
] }),
|
|
208
|
+
b && /* @__PURE__ */ t("div", { className: "absolute top-0 inset-0 w-full h-full bg-white/80 flex items-center justify-center", children: /* @__PURE__ */ m("div", { className: "flex flex-col items-center gap-3", children: [
|
|
209
|
+
/* @__PURE__ */ t("div", { className: "animate-spin rounded-full h-8 w-8 border-b-2 border-text-brand-secondary" }),
|
|
210
|
+
/* @__PURE__ */ t("p", { className: "text-text-neutral-primary font-medium", children: "Loading..." })
|
|
211
|
+
] }) })
|
|
212
|
+
] });
|
|
213
|
+
};
|
|
214
|
+
export {
|
|
215
|
+
Dt as default
|
|
216
|
+
};
|
|
@@ -32,9 +32,7 @@ import "../../table-provider.js";
|
|
|
32
32
|
import { Avatar as l } from "../../../avatar/avatar.js";
|
|
33
33
|
import "../../table.context.js";
|
|
34
34
|
import "../../../tooltip/tooltip.js";
|
|
35
|
-
import "../../../table-filter/
|
|
36
|
-
import "@radix-ui/react-popover";
|
|
37
|
-
import "react-virtuoso";
|
|
35
|
+
import "../../../table-filter/index.js";
|
|
38
36
|
import "../../../badge/badge.js";
|
|
39
37
|
import "../../../text-preset/text-preset.js";
|
|
40
38
|
import "react-dom";
|
|
@@ -43,10 +41,13 @@ import "../../../../node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/ledg
|
|
|
43
41
|
import "@radix-ui/react-slot";
|
|
44
42
|
import "../../../radio/z2-radio.js";
|
|
45
43
|
import "../../../segmented-control/item.js";
|
|
44
|
+
import "@radix-ui/react-popover";
|
|
46
45
|
import "../../../primitives/popconfirm/popconfirm.js";
|
|
47
46
|
import "../../../dynamic-table/z2-table.js";
|
|
48
47
|
import "../../../dynamic-table/z2-table-context.js";
|
|
49
48
|
import "../../../chart/chart.js";
|
|
49
|
+
import "../../../primitives/chart-card/config/defaults.js";
|
|
50
|
+
import "../../../primitives/chart-card/config/colors.js";
|
|
50
51
|
import "../../../z2map/map.js";
|
|
51
52
|
import "../../../z2map/map.constants.js";
|
|
52
53
|
import "../../../z2map/components/map-pin.js";
|
|
@@ -54,7 +55,7 @@ import "../../../z2map/components/map-pin-content.js";
|
|
|
54
55
|
import "../../../z2map/components/map-controls.js";
|
|
55
56
|
import "../../../z2map/components/map-zoom-control.js";
|
|
56
57
|
import "../../../z2map/components/map-style-control.js";
|
|
57
|
-
const
|
|
58
|
+
const ft = ({
|
|
58
59
|
avatar: m,
|
|
59
60
|
value: a,
|
|
60
61
|
rightIcon: o,
|
|
@@ -92,5 +93,5 @@ const xt = ({
|
|
|
92
93
|
}
|
|
93
94
|
);
|
|
94
95
|
export {
|
|
95
|
-
|
|
96
|
+
ft as AvatarCell
|
|
96
97
|
};
|
|
@@ -36,9 +36,7 @@ import "../stepper/stepper.js";
|
|
|
36
36
|
import "../stepper-item/stepper-item.js";
|
|
37
37
|
import "@radix-ui/react-tabs";
|
|
38
38
|
import "../tooltip/tooltip.js";
|
|
39
|
-
import "../table-filter/
|
|
40
|
-
import "@radix-ui/react-popover";
|
|
41
|
-
import "react-virtuoso";
|
|
39
|
+
import "../table-filter/index.js";
|
|
42
40
|
import "../badge/badge.js";
|
|
43
41
|
import "../avatar/avatar.js";
|
|
44
42
|
import "../text-preset/text-preset.js";
|
|
@@ -48,10 +46,13 @@ import "../../node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/ledger/dis
|
|
|
48
46
|
import "@radix-ui/react-slot";
|
|
49
47
|
import "../radio/z2-radio.js";
|
|
50
48
|
import "../segmented-control/item.js";
|
|
49
|
+
import "@radix-ui/react-popover";
|
|
51
50
|
import "../primitives/popconfirm/popconfirm.js";
|
|
52
51
|
import "../dynamic-table/z2-table.js";
|
|
53
52
|
import "../dynamic-table/z2-table-context.js";
|
|
54
53
|
import "../chart/chart.js";
|
|
54
|
+
import "../primitives/chart-card/config/defaults.js";
|
|
55
|
+
import "../primitives/chart-card/config/colors.js";
|
|
55
56
|
import "../z2map/map.js";
|
|
56
57
|
import "../z2map/map.constants.js";
|
|
57
58
|
import "../z2map/components/map-pin.js";
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { jsx as e, jsxs as i } from "react/jsx-runtime";
|
|
2
|
+
import { Button as r } from "../../button/button.js";
|
|
3
|
+
import { Z2Dialog as a, Z2DialogContent as t, Z2DialogHeader as s, Z2DialogTitle as d, Z2DialogDescription as h, Z2DialogFooter as c } from "../../dialog/dialog.js";
|
|
4
|
+
const u = ({
|
|
5
|
+
onClose: l,
|
|
6
|
+
onRevertChanges: n,
|
|
7
|
+
onApplyChanges: o
|
|
8
|
+
}) => /* @__PURE__ */ e(a, { open: !0, onOpenChange: l, children: /* @__PURE__ */ i(t, { className: "max-w-md p-4 rounded-2xl", children: [
|
|
9
|
+
/* @__PURE__ */ i(s, { children: [
|
|
10
|
+
/* @__PURE__ */ e("div", { className: "flex justify-between", children: /* @__PURE__ */ e(d, { children: "Unsaved Filter Changes" }) }),
|
|
11
|
+
/* @__PURE__ */ e(h, { children: "You have unsaved filter changes. Would you like to keep these changes or revert to the previous state?" })
|
|
12
|
+
] }),
|
|
13
|
+
/* @__PURE__ */ i(c, { children: [
|
|
14
|
+
/* @__PURE__ */ e(r, { onClick: n, variant: "stroke", shade: "danger", size: "small", children: "Discard" }),
|
|
15
|
+
/* @__PURE__ */ e(r, { onClick: o, variant: "filled", shade: "brand", size: "small", children: "Apply Changes" })
|
|
16
|
+
] })
|
|
17
|
+
] }) });
|
|
18
|
+
export {
|
|
19
|
+
u as FilterConfirmationDialog
|
|
20
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
const v = (u, t) => {
|
|
2
|
+
if (u.length !== t.length)
|
|
3
|
+
return !1;
|
|
4
|
+
const i = [...u].sort((r, l) => r.field.localeCompare(l.field)), e = [...t].sort((r, l) => r.field.localeCompare(l.field));
|
|
5
|
+
return i.every((r, l) => {
|
|
6
|
+
const a = e[l];
|
|
7
|
+
return r.field !== a.field || r.condition !== a.condition ? !1 : Array.isArray(r.value) && Array.isArray(a.value) ? r.value.length !== a.value.length ? !1 : r.value.every((n, s) => n === a.value[s]) : Array.isArray(r.value) || Array.isArray(a.value) ? !1 : r.value === a.value;
|
|
8
|
+
});
|
|
9
|
+
}, o = (u, t) => {
|
|
10
|
+
const i = u.filter((e) => Array.isArray(e.value) ? e.value.length > 0 : e.value !== "");
|
|
11
|
+
return !v(i, t);
|
|
12
|
+
}, y = (u, t, i) => {
|
|
13
|
+
const e = t.find((n) => n.field === u), r = i.find((n) => n.field === u), l = e && (Array.isArray(e.value) ? e.value.length > 0 : e.value !== ""), a = r && (Array.isArray(r.value) ? r.value.length > 0 : r.value !== "");
|
|
14
|
+
return !l && a || l && !a ? !0 : !l && !a ? !1 : l && a && e && r ? e.condition !== r.condition ? !0 : Array.isArray(e.value) && Array.isArray(r.value) ? e.value.length !== r.value.length ? !0 : !e.value.every((n, s) => n === r.value[s]) : Array.isArray(e.value) || Array.isArray(r.value) ? !0 : e.value !== r.value : !1;
|
|
15
|
+
};
|
|
16
|
+
export {
|
|
17
|
+
v as areFiltersEqual,
|
|
18
|
+
o as hasUnsavedFilterChanges,
|
|
19
|
+
y as hasUnsavedFilterChangesForColumn
|
|
20
|
+
};
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { jsx as r, jsxs as t } from "react/jsx-runtime";
|
|
2
|
+
const c = ({ value: e, onChange: l }) => {
|
|
3
|
+
const i = (s, d) => {
|
|
4
|
+
l(d ? { value: s } : { value: "" });
|
|
5
|
+
};
|
|
6
|
+
return /* @__PURE__ */ r("div", { className: "w-full", children: /* @__PURE__ */ t("div", { className: "p-4 space-y-3", children: [
|
|
7
|
+
/* @__PURE__ */ t("label", { className: "flex items-center p-3 rounded-lg border border-stroke-solid-light hover:border-stroke-solid-medium hover:bg-gray-50 transition-all duration-200 cursor-pointer group", children: [
|
|
8
|
+
/* @__PURE__ */ t("div", { className: "relative", children: [
|
|
9
|
+
/* @__PURE__ */ r(
|
|
10
|
+
"input",
|
|
11
|
+
{
|
|
12
|
+
type: "checkbox",
|
|
13
|
+
checked: (e == null ? void 0 : e.value) === "true",
|
|
14
|
+
onChange: (s) => i("true", s.target.checked),
|
|
15
|
+
className: "w-5 h-5 rounded border-2 border-stroke-solid-medium text-blue-600 focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 transition-colors duration-200"
|
|
16
|
+
}
|
|
17
|
+
),
|
|
18
|
+
(e == null ? void 0 : e.value) === "true" && /* @__PURE__ */ r("div", { className: "absolute inset-0 flex items-center justify-center", children: /* @__PURE__ */ r("svg", { className: "w-3 h-3 text-white", fill: "currentColor", viewBox: "0 0 20 20", children: /* @__PURE__ */ r(
|
|
19
|
+
"path",
|
|
20
|
+
{
|
|
21
|
+
fillRule: "evenodd",
|
|
22
|
+
d: "M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",
|
|
23
|
+
clipRule: "evenodd"
|
|
24
|
+
}
|
|
25
|
+
) }) })
|
|
26
|
+
] }),
|
|
27
|
+
/* @__PURE__ */ t("div", { className: "ml-3 flex-1", children: [
|
|
28
|
+
/* @__PURE__ */ t("div", { className: "flex items-center", children: [
|
|
29
|
+
/* @__PURE__ */ r("span", { className: "text-sm font-medium text-text-neutral-primary", children: "True" }),
|
|
30
|
+
(e == null ? void 0 : e.value) === "true" && /* @__PURE__ */ r("span", { className: "ml-2 inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium bg-green-100 text-green-800", children: "Selected" })
|
|
31
|
+
] }),
|
|
32
|
+
/* @__PURE__ */ r("p", { className: "text-xs text-text-neutral-secondary mt-0.5", children: "Include records with true values" })
|
|
33
|
+
] })
|
|
34
|
+
] }),
|
|
35
|
+
/* @__PURE__ */ t("label", { className: "flex items-center p-3 rounded-lg border border-stroke-solid-light hover:border-stroke-solid-medium hover:bg-gray-50 transition-all duration-200 cursor-pointer group", children: [
|
|
36
|
+
/* @__PURE__ */ t("div", { className: "relative", children: [
|
|
37
|
+
/* @__PURE__ */ r(
|
|
38
|
+
"input",
|
|
39
|
+
{
|
|
40
|
+
type: "checkbox",
|
|
41
|
+
checked: (e == null ? void 0 : e.value) === "false",
|
|
42
|
+
onChange: (s) => i("false", s.target.checked),
|
|
43
|
+
className: "w-5 h-5 rounded border-2 border-stroke-solid-medium text-blue-600 focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 transition-colors duration-200"
|
|
44
|
+
}
|
|
45
|
+
),
|
|
46
|
+
(e == null ? void 0 : e.value) === "false" && /* @__PURE__ */ r("div", { className: "absolute inset-0 flex items-center justify-center", children: /* @__PURE__ */ r("svg", { className: "w-3 h-3 text-white", fill: "currentColor", viewBox: "0 0 20 20", children: /* @__PURE__ */ r(
|
|
47
|
+
"path",
|
|
48
|
+
{
|
|
49
|
+
fillRule: "evenodd",
|
|
50
|
+
d: "M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",
|
|
51
|
+
clipRule: "evenodd"
|
|
52
|
+
}
|
|
53
|
+
) }) })
|
|
54
|
+
] }),
|
|
55
|
+
/* @__PURE__ */ t("div", { className: "ml-3 flex-1", children: [
|
|
56
|
+
/* @__PURE__ */ t("div", { className: "flex items-center", children: [
|
|
57
|
+
/* @__PURE__ */ r("span", { className: "text-sm font-medium text-text-neutral-primary", children: "False" }),
|
|
58
|
+
(e == null ? void 0 : e.value) === "false" && /* @__PURE__ */ r("span", { className: "ml-2 inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium bg-red-100 text-red-800", children: "Selected" })
|
|
59
|
+
] }),
|
|
60
|
+
/* @__PURE__ */ r("p", { className: "text-xs text-text-neutral-secondary mt-0.5", children: "Include records with false values" })
|
|
61
|
+
] })
|
|
62
|
+
] })
|
|
63
|
+
] }) });
|
|
64
|
+
};
|
|
65
|
+
export {
|
|
66
|
+
c as default
|
|
67
|
+
};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { jsx as t, jsxs as s } from "react/jsx-runtime";
|
|
2
|
+
import { useState as d, useEffect as h } from "react";
|
|
3
|
+
import { Virtuoso as k } from "react-virtuoso";
|
|
4
|
+
import { MagnifierIcon as y } from "../../assets/icons/magnifier-icon.js";
|
|
5
|
+
import S from "../../assets/icons/x.js";
|
|
6
|
+
import { Z2Checkbox as w } from "../../checkbox/checkbox.js";
|
|
7
|
+
const E = ({ value: n, onChange: f, filterOptions: r = [] }) => {
|
|
8
|
+
const [c, o] = d([]), [m, u] = d(""), [x, i] = d(r), p = (l) => {
|
|
9
|
+
u(l.target.value);
|
|
10
|
+
const e = r.filter(
|
|
11
|
+
(a) => a.label.toLowerCase().includes(l.target.value.toLowerCase())
|
|
12
|
+
);
|
|
13
|
+
i(e);
|
|
14
|
+
};
|
|
15
|
+
h(() => {
|
|
16
|
+
n && Array.isArray(n.value) ? o(n.value.filter(Boolean) ?? []) : o([]);
|
|
17
|
+
}, [n]), h(() => {
|
|
18
|
+
i(r);
|
|
19
|
+
}, [r]);
|
|
20
|
+
const b = (l, e) => {
|
|
21
|
+
let a;
|
|
22
|
+
e ? a = [...c, l] : a = c.filter((N) => N !== l), o(a), f({ value: a });
|
|
23
|
+
}, C = () => {
|
|
24
|
+
u(""), i(r);
|
|
25
|
+
}, g = (l) => c.includes(l), v = (l, e) => /* @__PURE__ */ s("div", { className: "flex justify-between items-center py-2 px-3", children: [
|
|
26
|
+
/* @__PURE__ */ s("label", { className: "flex items-center space-x-2 cursor-pointer", children: [
|
|
27
|
+
/* @__PURE__ */ t(
|
|
28
|
+
w,
|
|
29
|
+
{
|
|
30
|
+
checked: g(e.value),
|
|
31
|
+
onCheckedChange: (a) => b(e.value, a === !0)
|
|
32
|
+
}
|
|
33
|
+
),
|
|
34
|
+
/* @__PURE__ */ t("span", { className: "text-text-neutral-primary leading-none-medium-sm", children: e.label })
|
|
35
|
+
] }),
|
|
36
|
+
e.total && /* @__PURE__ */ s("span", { className: "text-text-neutral-muted text-sm", children: [
|
|
37
|
+
"[",
|
|
38
|
+
e.total,
|
|
39
|
+
"]"
|
|
40
|
+
] })
|
|
41
|
+
] });
|
|
42
|
+
return r.length === 0 ? /* @__PURE__ */ t("div", { className: "text-text-neutral-muted text-sm p-4", children: "No filter options available for this column" }) : /* @__PURE__ */ s("div", { className: "flex flex-col h-full", children: [
|
|
43
|
+
/* @__PURE__ */ s("div", { className: "relative border-b border-stroke-solid-medium", children: [
|
|
44
|
+
/* @__PURE__ */ t(y, { className: "absolute left-3 top-3.5 text-text-neutral-muted" }),
|
|
45
|
+
/* @__PURE__ */ t(
|
|
46
|
+
"input",
|
|
47
|
+
{
|
|
48
|
+
placeholder: "Search options",
|
|
49
|
+
value: m,
|
|
50
|
+
onChange: p,
|
|
51
|
+
className: "border-none outline-none bg-surface-neutral-default text-text-neutral-primary rounded p-3 pl-8 leading-none-medium-sm w-full"
|
|
52
|
+
}
|
|
53
|
+
),
|
|
54
|
+
m && /* @__PURE__ */ t("span", { className: "absolute right-3 top-3.5", onClick: C, children: /* @__PURE__ */ t(S, {}) })
|
|
55
|
+
] }),
|
|
56
|
+
/* @__PURE__ */ t("div", { className: "flex-1", children: /* @__PURE__ */ t(
|
|
57
|
+
k,
|
|
58
|
+
{
|
|
59
|
+
data: x,
|
|
60
|
+
itemContent: v,
|
|
61
|
+
className: "h-full min-h-60",
|
|
62
|
+
style: { height: "100%" },
|
|
63
|
+
overscan: 5
|
|
64
|
+
}
|
|
65
|
+
) })
|
|
66
|
+
] });
|
|
67
|
+
};
|
|
68
|
+
export {
|
|
69
|
+
E as default
|
|
70
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { jsxs as a, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import i from "../../../assets/icons/x.js";
|
|
3
|
+
const d = ({
|
|
4
|
+
label: l,
|
|
5
|
+
operator: n,
|
|
6
|
+
value: e,
|
|
7
|
+
onChange: o,
|
|
8
|
+
onReset: s,
|
|
9
|
+
disabled: r,
|
|
10
|
+
placeholder: m = "0.00"
|
|
11
|
+
}) => /* @__PURE__ */ a("div", { className: "flex flex-col gap-2", children: [
|
|
12
|
+
/* @__PURE__ */ t("label", { className: "text-sm font-medium text-text-neutral-primary", children: l }),
|
|
13
|
+
/* @__PURE__ */ a("div", { className: "relative", children: [
|
|
14
|
+
/* @__PURE__ */ t("span", { className: "absolute left-3 top-1/2 transform -translate-y-1/2 text-text-neutral-muted", children: n }),
|
|
15
|
+
/* @__PURE__ */ t(
|
|
16
|
+
"input",
|
|
17
|
+
{
|
|
18
|
+
type: "number",
|
|
19
|
+
value: e,
|
|
20
|
+
onChange: (u) => o(u.target.value),
|
|
21
|
+
placeholder: m,
|
|
22
|
+
disabled: r,
|
|
23
|
+
className: `border border-stroke-solid-medium bg-surface-neutral-default text-text-neutral-primary placeholder:text-text-neutral-muted rounded px-2 py-2 pl-10 pr-8 text-sm w-full ${r ? "opacity-50 cursor-not-allowed" : ""}`
|
|
24
|
+
}
|
|
25
|
+
),
|
|
26
|
+
e && /* @__PURE__ */ t(
|
|
27
|
+
"button",
|
|
28
|
+
{
|
|
29
|
+
onClick: s,
|
|
30
|
+
className: "absolute right-2 top-1/2 transform -translate-y-1/2 text-text-neutral-muted hover:text-text-neutral-primary",
|
|
31
|
+
children: /* @__PURE__ */ t(i, {})
|
|
32
|
+
}
|
|
33
|
+
)
|
|
34
|
+
] })
|
|
35
|
+
] });
|
|
36
|
+
export {
|
|
37
|
+
d as FilterInputField
|
|
38
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { useState as e, useEffect as h } from "react";
|
|
2
|
+
const b = ({ value: t, onChange: o }) => {
|
|
3
|
+
const [r, n] = e(""), [d, c] = e(""), [f, s] = e(""), A = r ? "specific" : d ? "atLeast" : f ? "noMoreThan" : null;
|
|
4
|
+
return h(() => {
|
|
5
|
+
(t == null ? void 0 : t.condition) === "=" && (t != null && t.value) ? (n(t == null ? void 0 : t.value), c(""), s("")) : (t == null ? void 0 : t.condition) === ">" && (t != null && t.value) ? (c(t.value), n(""), s("")) : (t == null ? void 0 : t.condition) === "<" && (t != null && t.value) && (s(t.value), n(""), c(""));
|
|
6
|
+
}, [t == null ? void 0 : t.condition, t == null ? void 0 : t.value]), {
|
|
7
|
+
specificAmount: r,
|
|
8
|
+
atLeast: d,
|
|
9
|
+
noMoreThan: f,
|
|
10
|
+
activeField: A,
|
|
11
|
+
handleSpecificAmountChange: (i) => {
|
|
12
|
+
n(i), i ? (c(""), s(""), o({ condition: "=", value: i })) : o({ condition: "", value: "" });
|
|
13
|
+
},
|
|
14
|
+
handleAtLeastChange: (i) => {
|
|
15
|
+
c(i), i ? (n(""), s(""), o({ condition: ">", value: i })) : o({ condition: "", value: "" });
|
|
16
|
+
},
|
|
17
|
+
handleNoMoreThanChange: (i) => {
|
|
18
|
+
s(i), i ? (n(""), c(""), o({ condition: "<", value: i })) : o({ condition: "", value: "" });
|
|
19
|
+
},
|
|
20
|
+
resetSpecificAmount: () => {
|
|
21
|
+
n(""), o({ condition: "", value: "" });
|
|
22
|
+
},
|
|
23
|
+
resetAtLeast: () => {
|
|
24
|
+
c(""), o({ condition: "", value: "" });
|
|
25
|
+
},
|
|
26
|
+
resetNoMoreThan: () => {
|
|
27
|
+
s(""), o({ condition: "", value: "" });
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
export {
|
|
32
|
+
b as useNumberFilter
|
|
33
|
+
};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { jsxs as m, jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import { useNumberFilter as f } from "./number.hook.js";
|
|
3
|
+
import { FilterInputField as t } from "./filter-input-field.js";
|
|
4
|
+
const C = ({ value: o, onChange: l }) => {
|
|
5
|
+
const {
|
|
6
|
+
specificAmount: n,
|
|
7
|
+
atLeast: r,
|
|
8
|
+
noMoreThan: s,
|
|
9
|
+
activeField: e,
|
|
10
|
+
handleSpecificAmountChange: i,
|
|
11
|
+
handleAtLeastChange: c,
|
|
12
|
+
handleNoMoreThanChange: h,
|
|
13
|
+
resetSpecificAmount: p,
|
|
14
|
+
resetAtLeast: u,
|
|
15
|
+
resetNoMoreThan: d
|
|
16
|
+
} = f({ value: o, onChange: l });
|
|
17
|
+
return /* @__PURE__ */ m("div", { className: "flex flex-col gap-4 p-4", children: [
|
|
18
|
+
/* @__PURE__ */ a(
|
|
19
|
+
t,
|
|
20
|
+
{
|
|
21
|
+
label: "Specific",
|
|
22
|
+
operator: "=",
|
|
23
|
+
value: n,
|
|
24
|
+
onChange: i,
|
|
25
|
+
onReset: p,
|
|
26
|
+
disabled: e !== null && e !== "specific"
|
|
27
|
+
}
|
|
28
|
+
),
|
|
29
|
+
/* @__PURE__ */ a(
|
|
30
|
+
t,
|
|
31
|
+
{
|
|
32
|
+
label: "At least...",
|
|
33
|
+
operator: "≥",
|
|
34
|
+
value: r,
|
|
35
|
+
onChange: c,
|
|
36
|
+
onReset: u,
|
|
37
|
+
disabled: e !== null && e !== "atLeast"
|
|
38
|
+
}
|
|
39
|
+
),
|
|
40
|
+
/* @__PURE__ */ a(
|
|
41
|
+
t,
|
|
42
|
+
{
|
|
43
|
+
label: "No more than...",
|
|
44
|
+
operator: "≤",
|
|
45
|
+
value: s,
|
|
46
|
+
onChange: h,
|
|
47
|
+
onReset: d,
|
|
48
|
+
disabled: e !== null && e !== "noMoreThan"
|
|
49
|
+
}
|
|
50
|
+
)
|
|
51
|
+
] });
|
|
52
|
+
};
|
|
53
|
+
export {
|
|
54
|
+
C as default
|
|
55
|
+
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { jsxs as r, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import i from "../../assets/icons/x.js";
|
|
3
|
+
import { MagnifierIcon as o } from "../../assets/icons/magnifier-icon.js";
|
|
4
|
+
import { Input as c } from "../../input/input.js";
|
|
5
|
+
const d = [
|
|
6
|
+
{ label: "Contains", value: "contains" },
|
|
7
|
+
{ label: "Does not equal", value: "notEqual" },
|
|
8
|
+
{ label: "Equals", value: "equals" }
|
|
9
|
+
], x = ({ value: e, onChange: n }) => {
|
|
10
|
+
var a;
|
|
11
|
+
const s = () => {
|
|
12
|
+
n({ value: "" });
|
|
13
|
+
};
|
|
14
|
+
return /* @__PURE__ */ r("div", { className: "flex flex-col gap-3", children: [
|
|
15
|
+
/* @__PURE__ */ t("div", { className: "p-4 relative", children: /* @__PURE__ */ t(
|
|
16
|
+
c,
|
|
17
|
+
{
|
|
18
|
+
leftIcon: /* @__PURE__ */ t(o, {}),
|
|
19
|
+
size: "large",
|
|
20
|
+
placeholder: "Search options",
|
|
21
|
+
value: e == null ? void 0 : e.value,
|
|
22
|
+
rightIcon: e != null && e.value ? /* @__PURE__ */ t(i, { onClick: s }) : null,
|
|
23
|
+
onChange: (l) => n({ value: l.target.value }),
|
|
24
|
+
className: ""
|
|
25
|
+
}
|
|
26
|
+
) }),
|
|
27
|
+
/* @__PURE__ */ t("div", { className: "flex flex-col gap-2 p-3", children: !!(e != null && e.value) && /* @__PURE__ */ r("div", { className: "flex items-center justify-center gap-2 px-3 py-2", children: [
|
|
28
|
+
/* @__PURE__ */ t("span", { className: "text-text-neutral-muted text-xs font-medium uppercase tracking-wide", children: (a = d.find((l) => l.value === (e == null ? void 0 : e.condition))) == null ? void 0 : a.label }),
|
|
29
|
+
/* @__PURE__ */ r("div", { className: "flex items-center gap-1", children: [
|
|
30
|
+
/* @__PURE__ */ r("span", { className: "text-text-neutral-primary text-sm font-medium px-2 py-1 bg-surface-neutral-default rounded border border-stroke-solid-medium", children: [
|
|
31
|
+
"“",
|
|
32
|
+
e.value,
|
|
33
|
+
"”"
|
|
34
|
+
] }),
|
|
35
|
+
/* @__PURE__ */ t(
|
|
36
|
+
"button",
|
|
37
|
+
{
|
|
38
|
+
onClick: s,
|
|
39
|
+
className: "flex items-center justify-center w-5 h-5 rounded-full bg-surface-neutral-hovered hover:bg-surface-neutral-pressed transition-colors",
|
|
40
|
+
title: "Remove filter",
|
|
41
|
+
children: /* @__PURE__ */ t(i, { className: "w-3 h-3 text-text-neutral-muted" })
|
|
42
|
+
}
|
|
43
|
+
)
|
|
44
|
+
] })
|
|
45
|
+
] }) })
|
|
46
|
+
] });
|
|
47
|
+
};
|
|
48
|
+
export {
|
|
49
|
+
x as default
|
|
50
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { TableFilterProvider as o } from "./table-filter-provider.js";
|
|
2
|
+
import { TableFilterButton as r } from "./table-filter-button.js";
|
|
3
|
+
import { TableFilterColumnButton as e } from "./table-filter-column-button.js";
|
|
4
|
+
import { useTableFilterContext as F } from "./table-filter.context.js";
|
|
5
|
+
const t = o;
|
|
6
|
+
t.FilterButton = r;
|
|
7
|
+
t.FilterColumnButton = e;
|
|
8
|
+
export {
|
|
9
|
+
t as Filter,
|
|
10
|
+
F as useTableFilterContext
|
|
11
|
+
};
|