@ztwoint/z-ui 0.1.130 → 0.1.131
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/checkbox-filter/checkbox-filter-popover-field.d.ts +8 -0
- package/dist/components/checkbox-filter/checkbox-filter-popover-field.hook.d.ts +11 -0
- package/dist/components/checkbox-filter/checkbox-filter-popover-field.hook.js +23 -0
- package/dist/components/checkbox-filter/checkbox-filter-popover-field.js +44 -0
- package/dist/components/checkbox-filter/checkbox-filter.d.ts +2 -0
- package/dist/components/checkbox-filter/checkbox-filter.hook.d.ts +11 -0
- package/dist/components/checkbox-filter/checkbox-filter.hook.js +31 -0
- package/dist/components/checkbox-filter/checkbox-filter.js +64 -0
- package/dist/components/checkbox-filter/checkbox-filter.type.d.ts +2 -0
- package/dist/components/checkbox-filter/index.d.ts +7 -0
- package/dist/components/checkbox-filter/index.js +7 -0
- package/dist/components/primitives/popover-compact/index.d.ts +2 -0
- package/dist/components/primitives/popover-compact/popover-compact.d.ts +12 -0
- package/dist/components/primitives/popover-compact/popover-compact.js +30 -0
- package/dist/components/primitives/table-card/table-card.js +4 -3
- package/dist/components/table/components/cell/avatar-cell.js +4 -3
- package/dist/components/table/table-provider.js +2 -1
- package/dist/components/table-filter/filters/index.d.ts +0 -1
- package/dist/components/table-filter/table-filter-button.js +12 -12
- package/dist/components/table-filter/table-filter-column-button.js +6 -6
- package/dist/index.d.ts +2 -0
- package/dist/index.js +319 -315
- package/dist/types/components/checkbox-filter/checkbox-filter-popover-field.d.ts +8 -0
- package/dist/types/components/checkbox-filter/checkbox-filter-popover-field.hook.d.ts +11 -0
- package/dist/types/components/checkbox-filter/checkbox-filter.d.ts +2 -0
- package/dist/types/components/checkbox-filter/checkbox-filter.hook.d.ts +11 -0
- package/dist/types/components/checkbox-filter/checkbox-filter.type.d.ts +2 -0
- package/dist/types/components/checkbox-filter/index.d.ts +7 -0
- package/dist/types/components/primitives/popover-compact/index.d.ts +2 -0
- package/dist/types/components/primitives/popover-compact/popover-compact.d.ts +12 -0
- package/dist/types/components/table-filter/filters/index.d.ts +0 -1
- package/dist/types/index.d.ts +2 -0
- package/package.json +1 -1
- package/dist/components/table-filter/filters/checkbox.js +0 -70
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { CheckboxFilterProps } from './checkbox-filter.type';
|
|
2
|
+
interface CheckboxFilterPopoverFieldProps extends Omit<CheckboxFilterProps, 'value' | 'onChange'> {
|
|
3
|
+
placeholder?: string;
|
|
4
|
+
value?: string[];
|
|
5
|
+
onChange: (value: string[]) => void;
|
|
6
|
+
}
|
|
7
|
+
export declare const CheckboxFilterPopoverField: React.FC<CheckboxFilterPopoverFieldProps>;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
interface UseCheckboxFilterPopoverFieldProps {
|
|
2
|
+
placeholder?: string;
|
|
3
|
+
value?: string | string[];
|
|
4
|
+
}
|
|
5
|
+
export declare const useCheckboxFilterPopoverField: ({ value, placeholder, }: UseCheckboxFilterPopoverFieldProps) => {
|
|
6
|
+
isOpen: boolean;
|
|
7
|
+
displayText: string;
|
|
8
|
+
handleOpenChange: (open: boolean) => void;
|
|
9
|
+
handleInputClick: () => void;
|
|
10
|
+
};
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { useState as c } from "react";
|
|
2
|
+
const h = ({
|
|
3
|
+
value: t,
|
|
4
|
+
placeholder: n = "Search options"
|
|
5
|
+
}) => {
|
|
6
|
+
const [r, s] = c(!1), o = (() => {
|
|
7
|
+
const e = t && Array.isArray(t) ? t.length : 0;
|
|
8
|
+
return e === 0 ? n : `${n} (${e} selected)`;
|
|
9
|
+
})();
|
|
10
|
+
return {
|
|
11
|
+
isOpen: r,
|
|
12
|
+
displayText: o,
|
|
13
|
+
handleOpenChange: (e) => {
|
|
14
|
+
s(e);
|
|
15
|
+
},
|
|
16
|
+
handleInputClick: () => {
|
|
17
|
+
s(!0);
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
export {
|
|
22
|
+
h as useCheckboxFilterPopoverField
|
|
23
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { PopoverCompact as s } from "../primitives/popover-compact/popover-compact.js";
|
|
3
|
+
import { CheckboxFilter as m } from "./checkbox-filter.js";
|
|
4
|
+
import { Input as h } from "../input/input.js";
|
|
5
|
+
import { MagnifierIcon as d } from "../assets/icons/magnifier-icon.js";
|
|
6
|
+
import v from "../assets/icons/chevron-down.js";
|
|
7
|
+
import { useCheckboxFilterPopoverField as g } from "./checkbox-filter-popover-field.hook.js";
|
|
8
|
+
const O = ({
|
|
9
|
+
value: n,
|
|
10
|
+
onChange: r,
|
|
11
|
+
filterOptions: i = [],
|
|
12
|
+
placeholder: p = "Search options"
|
|
13
|
+
}) => {
|
|
14
|
+
const { isOpen: t, displayText: l, handleOpenChange: c, handleInputClick: a } = g(
|
|
15
|
+
{
|
|
16
|
+
value: n,
|
|
17
|
+
placeholder: p
|
|
18
|
+
}
|
|
19
|
+
);
|
|
20
|
+
return /* @__PURE__ */ e(s, { trigger: /* @__PURE__ */ e("span", { children: /* @__PURE__ */ e(
|
|
21
|
+
h,
|
|
22
|
+
{
|
|
23
|
+
leftIcon: /* @__PURE__ */ e(d, {}),
|
|
24
|
+
size: "large",
|
|
25
|
+
placeholder: l,
|
|
26
|
+
rightIcon: /* @__PURE__ */ e(v, {}),
|
|
27
|
+
readOnly: !0,
|
|
28
|
+
onClick: a,
|
|
29
|
+
className: "cursor-pointer"
|
|
30
|
+
}
|
|
31
|
+
) }), open: t, onOpenChange: c, children: /* @__PURE__ */ e("div", { className: "h-[400px] flex flex-col", children: /* @__PURE__ */ e(
|
|
32
|
+
m,
|
|
33
|
+
{
|
|
34
|
+
value: { value: n },
|
|
35
|
+
onChange: (o) => {
|
|
36
|
+
Array.isArray(o.value) ? r(o.value) : o.value !== void 0 && o.value !== null ? r([o.value]) : r([]);
|
|
37
|
+
},
|
|
38
|
+
filterOptions: i
|
|
39
|
+
}
|
|
40
|
+
) }) });
|
|
41
|
+
};
|
|
42
|
+
export {
|
|
43
|
+
O as CheckboxFilterPopoverField
|
|
44
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { FilterOption } from '../table-filter/table-filter.type';
|
|
2
|
+
import { CheckboxFilterProps } from './checkbox-filter.type';
|
|
3
|
+
export declare const useCheckboxFilter: ({ value, onChange, filterOptions }: CheckboxFilterProps) => {
|
|
4
|
+
selectedValues: string[];
|
|
5
|
+
searchValue: string;
|
|
6
|
+
filteredOptions: FilterOption[];
|
|
7
|
+
onSearchChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
|
8
|
+
handleCheckboxChange: (optionValue: string, checked: boolean) => void;
|
|
9
|
+
onClearSearch: () => void;
|
|
10
|
+
isSelected: (optionValue: string) => boolean;
|
|
11
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { useState as o, useEffect as u } from "react";
|
|
2
|
+
const k = ({ value: s, onChange: d, filterOptions: a = [] }) => {
|
|
3
|
+
const [c, l] = o([]), [C, h] = o(""), [S, r] = o(a);
|
|
4
|
+
return u(() => {
|
|
5
|
+
s && Array.isArray(s.value) ? l(s.value.filter(Boolean) ?? []) : l([]);
|
|
6
|
+
}, [s]), u(() => {
|
|
7
|
+
r(a);
|
|
8
|
+
}, [a]), {
|
|
9
|
+
selectedValues: c,
|
|
10
|
+
searchValue: C,
|
|
11
|
+
filteredOptions: S,
|
|
12
|
+
onSearchChange: (e) => {
|
|
13
|
+
h(e.target.value);
|
|
14
|
+
const n = a.filter(
|
|
15
|
+
(t) => t.label.toLowerCase().includes(e.target.value.toLowerCase())
|
|
16
|
+
);
|
|
17
|
+
r(n);
|
|
18
|
+
},
|
|
19
|
+
handleCheckboxChange: (e, n) => {
|
|
20
|
+
let t;
|
|
21
|
+
n ? t = [...c, e] : t = c.filter((i) => i !== e), l(t), d({ value: t });
|
|
22
|
+
},
|
|
23
|
+
onClearSearch: () => {
|
|
24
|
+
h(""), r(a);
|
|
25
|
+
},
|
|
26
|
+
isSelected: (e) => c.includes(e)
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
export {
|
|
30
|
+
k as useCheckboxFilter
|
|
31
|
+
};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { jsx as e, jsxs as l } from "react/jsx-runtime";
|
|
2
|
+
import { Virtuoso as x } from "react-virtuoso";
|
|
3
|
+
import { MagnifierIcon as p } from "../assets/icons/magnifier-icon.js";
|
|
4
|
+
import f from "../assets/icons/x.js";
|
|
5
|
+
import { Z2Checkbox as b } from "../checkbox/checkbox.js";
|
|
6
|
+
import { useCheckboxFilter as C } from "./checkbox-filter.hook.js";
|
|
7
|
+
const w = ({
|
|
8
|
+
value: n,
|
|
9
|
+
onChange: s,
|
|
10
|
+
filterOptions: a = []
|
|
11
|
+
}) => {
|
|
12
|
+
const {
|
|
13
|
+
searchValue: r,
|
|
14
|
+
filteredOptions: o,
|
|
15
|
+
onSearchChange: i,
|
|
16
|
+
handleCheckboxChange: c,
|
|
17
|
+
onClearSearch: m,
|
|
18
|
+
isSelected: d
|
|
19
|
+
} = C({ value: n, onChange: s, filterOptions: a }), h = (N, t) => /* @__PURE__ */ l("div", { className: "flex justify-between items-center py-2 px-3", children: [
|
|
20
|
+
/* @__PURE__ */ l("label", { className: "flex items-center space-x-2 cursor-pointer", children: [
|
|
21
|
+
/* @__PURE__ */ e(
|
|
22
|
+
b,
|
|
23
|
+
{
|
|
24
|
+
checked: d(t.value),
|
|
25
|
+
onCheckedChange: (u) => c(t.value, u === !0)
|
|
26
|
+
}
|
|
27
|
+
),
|
|
28
|
+
/* @__PURE__ */ e("span", { className: "text-text-neutral-primary leading-none-medium-sm", children: t.label })
|
|
29
|
+
] }),
|
|
30
|
+
t.total && /* @__PURE__ */ l("span", { className: "text-text-neutral-muted text-sm", children: [
|
|
31
|
+
"[",
|
|
32
|
+
t.total,
|
|
33
|
+
"]"
|
|
34
|
+
] })
|
|
35
|
+
] });
|
|
36
|
+
return a.length === 0 ? /* @__PURE__ */ e("div", { className: "text-text-neutral-muted text-sm p-4", children: "No filter options available for this column" }) : /* @__PURE__ */ l("div", { className: "flex flex-col h-full", children: [
|
|
37
|
+
/* @__PURE__ */ l("div", { className: "relative border-b border-stroke-solid-medium", children: [
|
|
38
|
+
/* @__PURE__ */ e(p, { className: "absolute left-3 top-3.5 text-text-neutral-muted" }),
|
|
39
|
+
/* @__PURE__ */ e(
|
|
40
|
+
"input",
|
|
41
|
+
{
|
|
42
|
+
placeholder: "Search options",
|
|
43
|
+
value: r,
|
|
44
|
+
onChange: i,
|
|
45
|
+
className: "border-none outline-none bg-surface-neutral-default text-text-neutral-primary rounded p-3 pl-8 leading-none-medium-sm w-full"
|
|
46
|
+
}
|
|
47
|
+
),
|
|
48
|
+
r && /* @__PURE__ */ e("span", { className: "absolute right-3 top-3.5", onClick: m, children: /* @__PURE__ */ e(f, {}) })
|
|
49
|
+
] }),
|
|
50
|
+
/* @__PURE__ */ e("div", { className: "flex-1", children: /* @__PURE__ */ e(
|
|
51
|
+
x,
|
|
52
|
+
{
|
|
53
|
+
data: o,
|
|
54
|
+
itemContent: h,
|
|
55
|
+
className: "h-full min-h-60",
|
|
56
|
+
style: { height: "100%" },
|
|
57
|
+
overscan: 5
|
|
58
|
+
}
|
|
59
|
+
) })
|
|
60
|
+
] });
|
|
61
|
+
};
|
|
62
|
+
export {
|
|
63
|
+
w as CheckboxFilter
|
|
64
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { CheckboxFilter } from './checkbox-filter';
|
|
2
|
+
import { CheckboxFilterPopoverField } from './checkbox-filter-popover-field';
|
|
3
|
+
declare const CheckboxFilterComponent: typeof CheckboxFilter & {
|
|
4
|
+
PopoverField: typeof CheckboxFilterPopoverField;
|
|
5
|
+
};
|
|
6
|
+
export { CheckboxFilterComponent as CheckboxFilter };
|
|
7
|
+
export type { CheckboxFilterProps } from './checkbox-filter.type';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export interface PopoverCompactProps {
|
|
3
|
+
trigger: ReactNode;
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
open?: boolean;
|
|
6
|
+
onOpenChange?: (open: boolean) => void;
|
|
7
|
+
contentClassName?: string;
|
|
8
|
+
sideOffset?: number;
|
|
9
|
+
align?: 'start' | 'center' | 'end';
|
|
10
|
+
width?: string;
|
|
11
|
+
}
|
|
12
|
+
export declare function PopoverCompact({ trigger, children, open: controlledOpen, onOpenChange: controlledOnOpenChange, contentClassName, sideOffset, align, width, }: PopoverCompactProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { jsxs as u, jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { useState as g } from "react";
|
|
3
|
+
import * as e from "@radix-ui/react-popover";
|
|
4
|
+
function x({
|
|
5
|
+
trigger: t,
|
|
6
|
+
children: s,
|
|
7
|
+
open: r,
|
|
8
|
+
onOpenChange: i,
|
|
9
|
+
contentClassName: a,
|
|
10
|
+
sideOffset: l = 8,
|
|
11
|
+
align: d = "start",
|
|
12
|
+
width: p = "w-80"
|
|
13
|
+
}) {
|
|
14
|
+
const [c, h] = g(!1), n = r !== void 0, m = n ? r : c, f = n ? i : h;
|
|
15
|
+
return /* @__PURE__ */ u(e.Root, { open: m, onOpenChange: f, children: [
|
|
16
|
+
/* @__PURE__ */ o(e.Trigger, { asChild: !0, children: t }),
|
|
17
|
+
/* @__PURE__ */ o(e.Portal, { children: /* @__PURE__ */ o(
|
|
18
|
+
e.Content,
|
|
19
|
+
{
|
|
20
|
+
className: `${p} bg-surface-neutral-default border border-stroke-solid-light rounded-2xl overflow-hidden shadow-lg z-50 ${a || ""}`,
|
|
21
|
+
sideOffset: l,
|
|
22
|
+
align: d,
|
|
23
|
+
children: s
|
|
24
|
+
}
|
|
25
|
+
) })
|
|
26
|
+
] });
|
|
27
|
+
}
|
|
28
|
+
export {
|
|
29
|
+
x as PopoverCompact
|
|
30
|
+
};
|
|
@@ -18,6 +18,7 @@ import "../../collapsible-side-nav-bar/popover/popover.js";
|
|
|
18
18
|
import "react-country-flag";
|
|
19
19
|
import "classnames";
|
|
20
20
|
import "@radix-ui/react-checkbox";
|
|
21
|
+
import "../../checkbox-filter/index.js";
|
|
21
22
|
import "@radix-ui/react-dialog";
|
|
22
23
|
import "../../dropdown/z2-dropdown.js";
|
|
23
24
|
import "@radix-ui/react-dropdown-menu";
|
|
@@ -27,6 +28,7 @@ import "../../input/input.js";
|
|
|
27
28
|
import "../../nav-header/nav-header.js";
|
|
28
29
|
import "../../nav-header/nav-item/nav-item.js";
|
|
29
30
|
import "@radix-ui/react-select";
|
|
31
|
+
import "@radix-ui/react-popover";
|
|
30
32
|
import "../../stepper/stepper.js";
|
|
31
33
|
import "../../stepper-item/stepper-item.js";
|
|
32
34
|
import "@radix-ui/react-tabs";
|
|
@@ -41,7 +43,6 @@ import "../../../node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/ledger/
|
|
|
41
43
|
import "@radix-ui/react-slot";
|
|
42
44
|
import "../../radio/z2-radio.js";
|
|
43
45
|
import "../../segmented-control/item.js";
|
|
44
|
-
import "@radix-ui/react-popover";
|
|
45
46
|
import "../popconfirm/popconfirm.js";
|
|
46
47
|
import "../../dynamic-table/z2-table.js";
|
|
47
48
|
import "../../dynamic-table/z2-table-context.js";
|
|
@@ -56,7 +57,7 @@ import "../../z2map/components/map-controls.js";
|
|
|
56
57
|
import "../../z2map/components/map-zoom-control.js";
|
|
57
58
|
import "../../z2map/components/map-style-control.js";
|
|
58
59
|
import "../../table/table.context.js";
|
|
59
|
-
const
|
|
60
|
+
const Gt = ({
|
|
60
61
|
dataSource: w,
|
|
61
62
|
schema: B,
|
|
62
63
|
loading: b,
|
|
@@ -212,5 +213,5 @@ const Dt = ({
|
|
|
212
213
|
] });
|
|
213
214
|
};
|
|
214
215
|
export {
|
|
215
|
-
|
|
216
|
+
Gt as default
|
|
216
217
|
};
|
|
@@ -17,6 +17,7 @@ import "../../../collapsible-side-nav-bar/popover/popover.js";
|
|
|
17
17
|
import "react-country-flag";
|
|
18
18
|
import "classnames";
|
|
19
19
|
import "@radix-ui/react-checkbox";
|
|
20
|
+
import "../../../checkbox-filter/index.js";
|
|
20
21
|
import "@radix-ui/react-dialog";
|
|
21
22
|
import "../../../dropdown/z2-dropdown.js";
|
|
22
23
|
import "@radix-ui/react-dropdown-menu";
|
|
@@ -25,6 +26,7 @@ import "../../../input/input.js";
|
|
|
25
26
|
import "../../../nav-header/nav-header.js";
|
|
26
27
|
import "../../../nav-header/nav-item/nav-item.js";
|
|
27
28
|
import "@radix-ui/react-select";
|
|
29
|
+
import "@radix-ui/react-popover";
|
|
28
30
|
import "../../../stepper/stepper.js";
|
|
29
31
|
import "../../../stepper-item/stepper-item.js";
|
|
30
32
|
import "@radix-ui/react-tabs";
|
|
@@ -41,7 +43,6 @@ import "../../../../node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/ledg
|
|
|
41
43
|
import "@radix-ui/react-slot";
|
|
42
44
|
import "../../../radio/z2-radio.js";
|
|
43
45
|
import "../../../segmented-control/item.js";
|
|
44
|
-
import "@radix-ui/react-popover";
|
|
45
46
|
import "../../../primitives/popconfirm/popconfirm.js";
|
|
46
47
|
import "../../../dynamic-table/z2-table.js";
|
|
47
48
|
import "../../../dynamic-table/z2-table-context.js";
|
|
@@ -55,7 +56,7 @@ import "../../../z2map/components/map-pin-content.js";
|
|
|
55
56
|
import "../../../z2map/components/map-controls.js";
|
|
56
57
|
import "../../../z2map/components/map-zoom-control.js";
|
|
57
58
|
import "../../../z2map/components/map-style-control.js";
|
|
58
|
-
const
|
|
59
|
+
const ut = ({
|
|
59
60
|
avatar: m,
|
|
60
61
|
value: a,
|
|
61
62
|
rightIcon: o,
|
|
@@ -93,5 +94,5 @@ const ft = ({
|
|
|
93
94
|
}
|
|
94
95
|
);
|
|
95
96
|
export {
|
|
96
|
-
|
|
97
|
+
ut as AvatarCell
|
|
97
98
|
};
|
|
@@ -24,6 +24,7 @@ import "../collapsible-side-nav-bar/popover/popover.js";
|
|
|
24
24
|
import "react-country-flag";
|
|
25
25
|
import "classnames";
|
|
26
26
|
import "@radix-ui/react-checkbox";
|
|
27
|
+
import "../checkbox-filter/index.js";
|
|
27
28
|
import "@radix-ui/react-dialog";
|
|
28
29
|
import "../dropdown/z2-dropdown.js";
|
|
29
30
|
import "@radix-ui/react-dropdown-menu";
|
|
@@ -32,6 +33,7 @@ import "../input/input.js";
|
|
|
32
33
|
import "../nav-header/nav-header.js";
|
|
33
34
|
import "../nav-header/nav-item/nav-item.js";
|
|
34
35
|
import "@radix-ui/react-select";
|
|
36
|
+
import "@radix-ui/react-popover";
|
|
35
37
|
import "../stepper/stepper.js";
|
|
36
38
|
import "../stepper-item/stepper-item.js";
|
|
37
39
|
import "@radix-ui/react-tabs";
|
|
@@ -46,7 +48,6 @@ import "../../node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/ledger/dis
|
|
|
46
48
|
import "@radix-ui/react-slot";
|
|
47
49
|
import "../radio/z2-radio.js";
|
|
48
50
|
import "../segmented-control/item.js";
|
|
49
|
-
import "@radix-ui/react-popover";
|
|
50
51
|
import "../primitives/popconfirm/popconfirm.js";
|
|
51
52
|
import "../dynamic-table/z2-table.js";
|
|
52
53
|
import "../dynamic-table/z2-table-context.js";
|
|
@@ -6,7 +6,7 @@ import { useTableFilterContext as q } from "./table-filter.context.js";
|
|
|
6
6
|
import E from "./filters/text.js";
|
|
7
7
|
import G from "./filters/boolean.js";
|
|
8
8
|
import J from "./filters/number/number.js";
|
|
9
|
-
import M from "
|
|
9
|
+
import { CheckboxFilter as M } from "../checkbox-filter/index.js";
|
|
10
10
|
import Q from "../assets/icons/circle-check-filled.js";
|
|
11
11
|
import { SelectedFiltersDisplay as W } from "./selected-filters-display/selected-filters-display.js";
|
|
12
12
|
import { FilterConfirmationDialog as X } from "./close-filter-confirm/filter-confirmation-dialog.js";
|
|
@@ -15,7 +15,7 @@ import { NumberBadge as Y } from "../number-badge/number-badge.js";
|
|
|
15
15
|
const de = () => {
|
|
16
16
|
var w, A;
|
|
17
17
|
const [K, c] = b.useState(!1), n = b.useRef(null), [C, d] = b.useState(!1), {
|
|
18
|
-
selectedColumn:
|
|
18
|
+
selectedColumn: o,
|
|
19
19
|
setSelectedColumn: O,
|
|
20
20
|
getFilterForColumn: P,
|
|
21
21
|
hasFilterForColumn: T,
|
|
@@ -36,9 +36,9 @@ const de = () => {
|
|
|
36
36
|
B(), c(!1), d(!1);
|
|
37
37
|
}, I = () => {
|
|
38
38
|
c(!1);
|
|
39
|
-
}, F = S(u, h.value), r = P(
|
|
40
|
-
if (!
|
|
41
|
-
const e = m.find((
|
|
39
|
+
}, F = S(u, h.value), r = P(o || ""), V = () => {
|
|
40
|
+
if (!o) return null;
|
|
41
|
+
const e = m.find((a) => a.filterKey === o), s = {
|
|
42
42
|
boolean: G,
|
|
43
43
|
string: E,
|
|
44
44
|
number: J,
|
|
@@ -56,14 +56,14 @@ const de = () => {
|
|
|
56
56
|
j,
|
|
57
57
|
{
|
|
58
58
|
value: U,
|
|
59
|
-
onChange: ({ condition:
|
|
60
|
-
filterOptions: e != null && e.options ? Object.entries(e.options).map(([
|
|
61
|
-
label:
|
|
62
|
-
value:
|
|
59
|
+
onChange: ({ condition: a, value: v }) => D(o, a, v),
|
|
60
|
+
filterOptions: e != null && e.options ? Object.entries(e.options).map(([a, v]) => ({
|
|
61
|
+
label: a,
|
|
62
|
+
value: a,
|
|
63
63
|
total: v
|
|
64
64
|
})) : void 0
|
|
65
65
|
},
|
|
66
|
-
|
|
66
|
+
o
|
|
67
67
|
) }) });
|
|
68
68
|
}, H = h.loading || !1;
|
|
69
69
|
r && (Array.isArray(r.value) && r.value.length > 0 || (r == null ? void 0 : r.value) !== "") && (n.current = r);
|
|
@@ -105,7 +105,7 @@ const de = () => {
|
|
|
105
105
|
"button",
|
|
106
106
|
{
|
|
107
107
|
onClick: () => O(e.filterKey),
|
|
108
|
-
className: `w-full text-left p-2 text-sm flex items-center justify-between hover:bg-surface-neutral-hover transition-colors rounded-lg ${
|
|
108
|
+
className: `w-full text-left p-2 text-sm flex items-center justify-between hover:bg-surface-neutral-hover transition-colors rounded-lg ${o === e.filterKey ? "bg-surface-neutral-focused text-text-brand-primary" : "text-text-neutral-primary"}`,
|
|
109
109
|
children: [
|
|
110
110
|
/* @__PURE__ */ l("span", { className: "flex items-center gap-1", children: [
|
|
111
111
|
e.helperText && /* @__PURE__ */ l("span", { className: "leading-normal-regular-xs text-neutral-muted", children: [
|
|
@@ -121,7 +121,7 @@ const de = () => {
|
|
|
121
121
|
))
|
|
122
122
|
] }),
|
|
123
123
|
/* @__PURE__ */ l("div", { className: "flex-1 flex flex-col relative", children: [
|
|
124
|
-
|
|
124
|
+
o ? V() : /* @__PURE__ */ t("div", { className: "flex-1 flex items-center justify-center text-text-neutral-muted", children: "Select a column to configure its filter" }),
|
|
125
125
|
H && /* @__PURE__ */ t("div", { className: "flex items-center justify-center p-8 absolute top-0 left-0 right-0 bottom-0 bg-background-neutral-default/80", children: /* @__PURE__ */ l("div", { className: "flex flex-col items-center gap-3", children: [
|
|
126
126
|
/* @__PURE__ */ t("div", { className: "w-8 h-8 border-2 border-stroke-solid-medium border-t-transparent rounded-full animate-spin" }),
|
|
127
127
|
/* @__PURE__ */ t("span", { className: "text-text-body-primary text-sm", children: "Loading options..." })
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { jsxs as l, jsx as e } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
2
|
+
import w, { useMemo as K } from "react";
|
|
3
3
|
import * as d from "@radix-ui/react-popover";
|
|
4
4
|
import { Button as f } from "../button/button.js";
|
|
5
5
|
import { useTableFilterContext as L } from "./table-filter.context.js";
|
|
6
6
|
import _ from "./filters/text.js";
|
|
7
7
|
import M from "./filters/boolean.js";
|
|
8
8
|
import U from "./filters/number/number.js";
|
|
9
|
-
import q from "
|
|
9
|
+
import { CheckboxFilter as q } from "../checkbox-filter/index.js";
|
|
10
10
|
import { getFilterCount as E } from "./selected-filters-display/selected-filters-display.utils.js";
|
|
11
11
|
import { FilterConfirmationDialog as G } from "./close-filter-confirm/filter-confirmation-dialog.js";
|
|
12
12
|
import { hasUnsavedFilterChangesForColumn as A } from "./close-filter-confirm/filter-confirmation-dialog.utils.js";
|
|
13
13
|
import { NumberBadge as H } from "../number-badge/number-badge.js";
|
|
14
14
|
const le = ({ filterName: n }) => {
|
|
15
|
-
const [T, a] =
|
|
15
|
+
const [T, a] = w.useState(!1), [C, s] = w.useState(!1), {
|
|
16
16
|
getFilterForColumn: g,
|
|
17
17
|
hasAppliedFilterForColumn: O,
|
|
18
18
|
updateColumnFilter: b,
|
|
@@ -41,11 +41,11 @@ const le = ({ filterName: n }) => {
|
|
|
41
41
|
string: _,
|
|
42
42
|
number: U,
|
|
43
43
|
checkbox: q
|
|
44
|
-
}, F = o.type && (m == null ? void 0 : m[o.type]) || R[o.type ?? "string"], u = O(n), y = p.loading || !1,
|
|
44
|
+
}, F = o.type && (m == null ? void 0 : m[o.type]) || R[o.type ?? "string"], u = O(n), y = p.loading || !1, k = o.options ? Object.entries(o.options).map(([t, i]) => ({
|
|
45
45
|
label: t,
|
|
46
46
|
value: t,
|
|
47
47
|
total: i
|
|
48
|
-
})) : void 0, h = r ? E(r,
|
|
48
|
+
})) : void 0, h = r ? E(r, k) : void 0, S = r != null && r.value ? Array.isArray(r.value) ? r.value.length : 1 : 0, z = () => {
|
|
49
49
|
const t = b(n, "", "");
|
|
50
50
|
c(t), s(!1);
|
|
51
51
|
}, I = () => {
|
|
@@ -86,7 +86,7 @@ const le = ({ filterName: n }) => {
|
|
|
86
86
|
{
|
|
87
87
|
value: r,
|
|
88
88
|
onChange: ({ condition: t, value: i }) => b(n, t, i),
|
|
89
|
-
filterOptions:
|
|
89
|
+
filterOptions: k
|
|
90
90
|
}
|
|
91
91
|
),
|
|
92
92
|
(x || !!S) && /* @__PURE__ */ l("div", { className: "flex justify-between gap-2 p-3 border-t border-stroke-solid-medium", children: [
|
package/dist/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ export * from './components/button/button';
|
|
|
3
3
|
export * from './components/collapsible-side-nav-bar';
|
|
4
4
|
export * from './components/country-flags/country-flags';
|
|
5
5
|
export * from './components/checkbox/checkbox';
|
|
6
|
+
export * from './components/checkbox-filter';
|
|
6
7
|
export * from './components/dialog/dialog';
|
|
7
8
|
export * from './components/dropdown/z2-dropdown';
|
|
8
9
|
export * from './components/dropdown-menu/z2-dropdown-menu';
|
|
@@ -11,6 +12,7 @@ export * from './components/input/input';
|
|
|
11
12
|
export * from './components/nav-header';
|
|
12
13
|
export * from './components/select/z2-select';
|
|
13
14
|
export * from './components/primitives/select-compact/select-compact';
|
|
15
|
+
export * from './components/primitives/popover-compact';
|
|
14
16
|
export * from './components/stepper';
|
|
15
17
|
export * from './components/stepper-item/stepper-item';
|
|
16
18
|
export * from './components/tab/tab';
|