@ztwoint/z-ui 0.1.78 → 0.1.80
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/assets/icons/chevron-left.js +8 -12
- package/dist/components/column-reorder/column-visibility-select.d.ts +12 -0
- package/dist/components/column-reorder/column-visibility.hook.d.ts +24 -0
- package/dist/components/column-reorder/components/column-item/column-item.type.d.ts +2 -1
- package/dist/components/table/components/pagination/pagination.js +2 -2
- package/dist/components/table-filter/filters/checkbox.js +13 -13
- package/dist/components/table-filter/selected-filters-display/selected-filters-display.js +2 -2
- package/dist/components/table-filter/table-filter-button.js +41 -40
- package/dist/css/styles/tailwind.css +1 -1
- package/dist/types/components/column-reorder/column-visibility-select.d.ts +12 -0
- package/dist/types/components/column-reorder/column-visibility.hook.d.ts +24 -0
- package/dist/types/components/column-reorder/components/column-item/column-item.type.d.ts +2 -1
- package/package.json +1 -1
|
@@ -1,20 +1,16 @@
|
|
|
1
|
-
import { jsxs as n, jsx as
|
|
2
|
-
function
|
|
3
|
-
return /* @__PURE__ */ n("svg", { height: "14", width: "14", viewBox: "0 0 14 14", xmlns: "http://www.w3.org/2000/svg", ...
|
|
4
|
-
/* @__PURE__ */
|
|
5
|
-
/* @__PURE__ */
|
|
1
|
+
import { jsxs as n, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
function i({ fill: e = "currentColor", title: r = "chevron left", ...h }) {
|
|
3
|
+
return /* @__PURE__ */ n("svg", { height: "14", width: "14", viewBox: "0 0 14 14", xmlns: "http://www.w3.org/2000/svg", ...h, children: [
|
|
4
|
+
/* @__PURE__ */ t("title", { children: r }),
|
|
5
|
+
/* @__PURE__ */ t("g", { fill: e, children: /* @__PURE__ */ t(
|
|
6
6
|
"path",
|
|
7
7
|
{
|
|
8
|
-
d: "
|
|
9
|
-
fill:
|
|
10
|
-
stroke: r,
|
|
11
|
-
strokeLinecap: "round",
|
|
12
|
-
strokeLinejoin: "round",
|
|
13
|
-
strokeWidth: "2"
|
|
8
|
+
d: "M9.04222 11.5852C8.73911 11.8883 8.24772 11.8883 7.94461 11.5852L3.90816 7.54877C3.60517 7.24565 3.60511 6.75424 3.90816 6.45115L7.94461 2.4147C8.2477 2.1118 8.73913 2.1118 9.04222 2.4147C9.34523 2.71778 9.34517 3.20921 9.04222 3.51231L5.55457 6.99996L9.04222 10.4876C9.34528 10.7908 9.34533 11.2821 9.04222 11.5852Z",
|
|
9
|
+
fill: e
|
|
14
10
|
}
|
|
15
11
|
) })
|
|
16
12
|
] });
|
|
17
13
|
}
|
|
18
14
|
export {
|
|
19
|
-
|
|
15
|
+
i as default
|
|
20
16
|
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export interface ColumnVisibilitySelectProps {
|
|
3
|
+
value: string;
|
|
4
|
+
onChange: (value: string) => void;
|
|
5
|
+
className?: string;
|
|
6
|
+
options?: {
|
|
7
|
+
value: string;
|
|
8
|
+
label: string;
|
|
9
|
+
}[];
|
|
10
|
+
}
|
|
11
|
+
export declare const ColumnVisibilitySelect: React.FC<ColumnVisibilitySelectProps>;
|
|
12
|
+
export default ColumnVisibilitySelect;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { ColumnType } from './column-reorder.type';
|
|
2
|
+
export type ColumnVisibilityValue = string;
|
|
3
|
+
export interface UseColumnVisibilityOptions {
|
|
4
|
+
/** Initial map of columnId -> visibility value */
|
|
5
|
+
initial?: Record<string, ColumnVisibilityValue>;
|
|
6
|
+
/** Default value to use when a column has no entry */
|
|
7
|
+
defaultValue?: ColumnVisibilityValue;
|
|
8
|
+
}
|
|
9
|
+
export interface UseColumnVisibilityResult {
|
|
10
|
+
/** Map of columnId -> visibility setting */
|
|
11
|
+
settings: Record<string, ColumnVisibilityValue>;
|
|
12
|
+
/** Read a column's visibility with default fallback */
|
|
13
|
+
get: (columnId: string) => ColumnVisibilityValue;
|
|
14
|
+
/** Update a column's visibility */
|
|
15
|
+
set: (columnId: string, value: ColumnVisibilityValue) => void;
|
|
16
|
+
/** Bulk set/reset settings (replaces entire state) */
|
|
17
|
+
setAll: (next: Record<string, ColumnVisibilityValue>) => void;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Manages per-column visibility settings with sensible defaults.
|
|
21
|
+
* Keeps UI concerns separate from state management.
|
|
22
|
+
*/
|
|
23
|
+
export declare function useColumnVisibility(columns: ColumnType[], options?: UseColumnVisibilityOptions): UseColumnVisibilityResult;
|
|
24
|
+
export default useColumnVisibility;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Edge } from '@atlaskit/pragmatic-drag-and-drop-hitbox/closest-edge';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
2
3
|
import { ColumnType } from '../../column-reorder.type';
|
|
3
4
|
export type ColumnItemState = {
|
|
4
5
|
type: 'idle';
|
|
@@ -15,5 +16,5 @@ export interface ColumnItemProps {
|
|
|
15
16
|
column: ColumnType;
|
|
16
17
|
index: number;
|
|
17
18
|
onRemove?: (columnId: string) => void;
|
|
18
|
-
renderAction?: (column: ColumnType, onRemove?: (columnId: string) => void) =>
|
|
19
|
+
renderAction?: (column: ColumnType, onRemove?: (columnId: string) => void) => ReactNode;
|
|
19
20
|
}
|
|
@@ -40,8 +40,8 @@ const p = () => /* @__PURE__ */ e("span", { className: S.ellipsis, children: "..
|
|
|
40
40
|
"aria-label": `${o.page} ${a}`,
|
|
41
41
|
"aria-current": i ? "page" : void 0,
|
|
42
42
|
className: _(
|
|
43
|
-
"text-text-neutral-secondary hover:bg-
|
|
44
|
-
i && "border border-
|
|
43
|
+
"text-text-neutral-secondary hover:bg-btn-secondary-surface-pressed",
|
|
44
|
+
i && "border border-btn-primary-brand-surface-default text-text-neutral-primary bg-btn-secondary-surface-pressed"
|
|
45
45
|
),
|
|
46
46
|
style: {
|
|
47
47
|
borderStyle: i ? "solid" : "none",
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { jsx as t, jsxs as s } from "react/jsx-runtime";
|
|
2
2
|
import { useState as i, useEffect as f } from "react";
|
|
3
|
-
import { Virtuoso as
|
|
4
|
-
import { MagnifierIcon as
|
|
3
|
+
import { Virtuoso as k } from "react-virtuoso";
|
|
4
|
+
import { MagnifierIcon as y } from "../../assets/icons/magnifier-icon.js";
|
|
5
5
|
import S from "../../assets/icons/x.js";
|
|
6
|
-
|
|
6
|
+
import { Z2Checkbox as w } from "../../checkbox/checkbox.js";
|
|
7
|
+
const V = ["includesAny", "includesAll", "excludes"], I = ({ value: r, onChange: d, filterOptions: n = [] }) => {
|
|
7
8
|
const [c, o] = i([]), [u, m] = i(""), [x, h] = i(n), p = (l) => {
|
|
8
9
|
m(l.target.value);
|
|
9
10
|
const e = n.filter(
|
|
@@ -12,23 +13,22 @@ const w = ["includesAny", "includesAll", "excludes"], B = ({ value: r, onChange:
|
|
|
12
13
|
h(e);
|
|
13
14
|
};
|
|
14
15
|
f(() => {
|
|
15
|
-
r.condition || d({ condition:
|
|
16
|
+
r.condition || d({ condition: V[0] });
|
|
16
17
|
}, []), f(() => {
|
|
17
18
|
Array.isArray(r.value) ? o(r.value.filter(Boolean)) : o([]);
|
|
18
19
|
}, [r.value]);
|
|
19
20
|
const b = (l, e) => {
|
|
20
21
|
let a;
|
|
21
|
-
e ? a = [...c, l] : a = c.filter((
|
|
22
|
+
e ? a = [...c, l] : a = c.filter((g) => g !== l), o(a), d({ value: a });
|
|
22
23
|
}, v = () => {
|
|
23
24
|
m(""), h(n);
|
|
24
|
-
},
|
|
25
|
+
}, C = (l) => c.includes(l), N = (l, e) => /* @__PURE__ */ s("div", { className: "flex justify-between items-center py-2 px-3", children: [
|
|
25
26
|
/* @__PURE__ */ s("label", { className: "flex items-center space-x-2 cursor-pointer", children: [
|
|
26
27
|
/* @__PURE__ */ t(
|
|
27
|
-
|
|
28
|
+
w,
|
|
28
29
|
{
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
onChange: (a) => b(e.value, a.target.checked)
|
|
30
|
+
checked: C(e.value),
|
|
31
|
+
onCheckedChange: (a) => b(e.value, a === !0)
|
|
32
32
|
}
|
|
33
33
|
),
|
|
34
34
|
/* @__PURE__ */ t("span", { className: "text-text-neutral-primary leading-none-medium-sm", children: e.label })
|
|
@@ -41,7 +41,7 @@ const w = ["includesAny", "includesAll", "excludes"], B = ({ value: r, onChange:
|
|
|
41
41
|
] });
|
|
42
42
|
return n.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
43
|
/* @__PURE__ */ s("div", { className: "relative border-b border-stroke-solid-medium", children: [
|
|
44
|
-
/* @__PURE__ */ t(
|
|
44
|
+
/* @__PURE__ */ t(y, { className: "absolute left-3 top-3.5 text-text-neutral-muted" }),
|
|
45
45
|
/* @__PURE__ */ t(
|
|
46
46
|
"input",
|
|
47
47
|
{
|
|
@@ -54,7 +54,7 @@ const w = ["includesAny", "includesAll", "excludes"], B = ({ value: r, onChange:
|
|
|
54
54
|
u && /* @__PURE__ */ t("span", { className: "absolute right-3 top-3.5", onClick: v, children: /* @__PURE__ */ t(S, {}) })
|
|
55
55
|
] }),
|
|
56
56
|
/* @__PURE__ */ t("div", { className: "flex-1", children: /* @__PURE__ */ t(
|
|
57
|
-
|
|
57
|
+
k,
|
|
58
58
|
{
|
|
59
59
|
data: x,
|
|
60
60
|
itemContent: N,
|
|
@@ -66,5 +66,5 @@ const w = ["includesAny", "includesAll", "excludes"], B = ({ value: r, onChange:
|
|
|
66
66
|
] });
|
|
67
67
|
};
|
|
68
68
|
export {
|
|
69
|
-
|
|
69
|
+
I as default
|
|
70
70
|
};
|
|
@@ -8,7 +8,7 @@ const u = ({
|
|
|
8
8
|
const l = d(r, s), n = o(l);
|
|
9
9
|
return /* @__PURE__ */ e("div", { className: "flex flex-col gap-2.5 max-w-md", children: [
|
|
10
10
|
n > 0 && /* @__PURE__ */ e("span", { className: "text-text-neutral-primary leading-none-medium-sm", children: [
|
|
11
|
-
n,
|
|
11
|
+
n.toLocaleString(),
|
|
12
12
|
" total"
|
|
13
13
|
] }),
|
|
14
14
|
/* @__PURE__ */ a("div", { className: "flex flex-wrap items-center gap-2.5 max-w-md", children: l.map((t, c) => /* @__PURE__ */ e(m.Fragment, { children: [
|
|
@@ -17,7 +17,7 @@ const u = ({
|
|
|
17
17
|
" ",
|
|
18
18
|
t.count !== void 0 && /* @__PURE__ */ e(i, { children: [
|
|
19
19
|
"[",
|
|
20
|
-
/* @__PURE__ */ a("span", { className: "text-text-neutral-secondary", children: t.count }),
|
|
20
|
+
/* @__PURE__ */ a("span", { className: "text-text-neutral-secondary", children: t.count.toLocaleString() }),
|
|
21
21
|
"]"
|
|
22
22
|
] })
|
|
23
23
|
] }) }),
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { jsxs as l, jsx as t } from "react/jsx-runtime";
|
|
2
2
|
import * as F from "react";
|
|
3
|
-
import * as
|
|
3
|
+
import * as d from "@radix-ui/react-popover";
|
|
4
4
|
import { Button as x } from "../button/button.js";
|
|
5
5
|
import { useTableFilterContext as H } from "./table-filter.context.js";
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import { SelectedFiltersDisplay as
|
|
12
|
-
import { createFilterDisplayItems as
|
|
6
|
+
import L from "./filters/text.js";
|
|
7
|
+
import U from "./filters/boolean.js";
|
|
8
|
+
import V from "./filters/number/number.js";
|
|
9
|
+
import q from "./filters/checkbox.js";
|
|
10
|
+
import E from "../assets/icons/circle-check-filled.js";
|
|
11
|
+
import { SelectedFiltersDisplay as G } from "./selected-filters-display/selected-filters-display.js";
|
|
12
|
+
import { createFilterDisplayItems as J, calculateTotalCount as M } from "./selected-filters-display/selected-filters-display.utils.js";
|
|
13
13
|
import { FilterConfirmationDialog as Q } from "./close-filter-confirm/filter-confirmation-dialog.js";
|
|
14
14
|
import { hasUnsavedFilterChanges as N } from "./close-filter-confirm/filter-confirmation-dialog.utils.js";
|
|
15
15
|
const ne = () => {
|
|
@@ -17,34 +17,34 @@ const ne = () => {
|
|
|
17
17
|
selectedColumn: r,
|
|
18
18
|
setSelectedColumn: k,
|
|
19
19
|
getFilterForColumn: K,
|
|
20
|
-
hasFilterForColumn:
|
|
21
|
-
updateColumnFilter:
|
|
22
|
-
clearAllFilters:
|
|
23
|
-
resetToAppliedFilters:
|
|
24
|
-
applyFilters:
|
|
25
|
-
hasActiveFilters:
|
|
20
|
+
hasFilterForColumn: S,
|
|
21
|
+
updateColumnFilter: j,
|
|
22
|
+
clearAllFilters: A,
|
|
23
|
+
resetToAppliedFilters: D,
|
|
24
|
+
applyFilters: O,
|
|
25
|
+
hasActiveFilters: h,
|
|
26
26
|
tempFilters: i,
|
|
27
27
|
filterSchema: c,
|
|
28
|
-
filter:
|
|
29
|
-
filterComponents:
|
|
30
|
-
} = H(),
|
|
31
|
-
!e && g ? N(i,
|
|
28
|
+
filter: p,
|
|
29
|
+
filterComponents: f = {}
|
|
30
|
+
} = H(), P = (e) => {
|
|
31
|
+
!e && g ? N(i, p.value) ? a(!0) : n(!1) : n(e);
|
|
32
32
|
}, v = () => {
|
|
33
|
-
|
|
33
|
+
O(), a(!1), n(!1);
|
|
34
34
|
}, T = () => {
|
|
35
35
|
a(!1), n(!1);
|
|
36
36
|
}, $ = () => {
|
|
37
|
-
|
|
37
|
+
D(), a(!1), n(!1);
|
|
38
38
|
}, R = () => {
|
|
39
39
|
a(!1);
|
|
40
|
-
}, b = N(i,
|
|
40
|
+
}, b = N(i, p.value), z = J(i, c), m = M(z), B = () => {
|
|
41
41
|
if (!r) return null;
|
|
42
42
|
const e = c.find((o) => o.filterKey === r), y = {
|
|
43
|
-
boolean:
|
|
44
|
-
string:
|
|
45
|
-
number:
|
|
46
|
-
checkbox:
|
|
47
|
-
}, C = (e == null ? void 0 : e.type) && (
|
|
43
|
+
boolean: U,
|
|
44
|
+
string: L,
|
|
45
|
+
number: V,
|
|
46
|
+
checkbox: q
|
|
47
|
+
}, C = (e == null ? void 0 : e.type) && (f == null ? void 0 : f[e.type]) || y[(e == null ? void 0 : e.type) ?? "string"];
|
|
48
48
|
if (!C)
|
|
49
49
|
return console.warn(
|
|
50
50
|
`No filter component found for column "${e == null ? void 0 : e.filterKey}" with type "${e == null ? void 0 : e.type}". Provide a custom filter component or use supported types: "string", "number", "boolean", "checkbox".`
|
|
@@ -57,7 +57,7 @@ const ne = () => {
|
|
|
57
57
|
C,
|
|
58
58
|
{
|
|
59
59
|
value: I,
|
|
60
|
-
onChange: ({ condition: o, value: u }) =>
|
|
60
|
+
onChange: ({ condition: o, value: u }) => j(r, o, u),
|
|
61
61
|
filterOptions: e != null && e.options ? Object.entries(e.options).map(([o, u]) => ({
|
|
62
62
|
label: o,
|
|
63
63
|
value: o,
|
|
@@ -67,21 +67,21 @@ const ne = () => {
|
|
|
67
67
|
r
|
|
68
68
|
) }) });
|
|
69
69
|
};
|
|
70
|
-
return /* @__PURE__ */ l(
|
|
71
|
-
/* @__PURE__ */ t(
|
|
70
|
+
return /* @__PURE__ */ l(d.Root, { open: g, onOpenChange: P, children: [
|
|
71
|
+
/* @__PURE__ */ t(d.Trigger, { asChild: !0, children: /* @__PURE__ */ l(
|
|
72
72
|
x,
|
|
73
73
|
{
|
|
74
|
-
variant:
|
|
75
|
-
shade:
|
|
74
|
+
variant: h ? "filled" : "stroke",
|
|
75
|
+
shade: h ? "brand" : "neutral",
|
|
76
76
|
size: "small",
|
|
77
77
|
children: [
|
|
78
78
|
"Filters ",
|
|
79
|
-
|
|
79
|
+
h && `(${p.value.length})`
|
|
80
80
|
]
|
|
81
81
|
}
|
|
82
82
|
) }),
|
|
83
|
-
/* @__PURE__ */ t(
|
|
84
|
-
|
|
83
|
+
/* @__PURE__ */ t(d.Portal, { children: /* @__PURE__ */ l(
|
|
84
|
+
d.Content,
|
|
85
85
|
{
|
|
86
86
|
className: "w-[512px] bg-surface-neutral-default border border-stroke-solid-light rounded-2xl overflow-hidden shadow-lg",
|
|
87
87
|
sideOffset: 8,
|
|
@@ -97,7 +97,7 @@ const ne = () => {
|
|
|
97
97
|
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.filterKey ? "bg-surface-neutral-focused text-text-brand-primary" : "text-text-neutral-primary"}`,
|
|
98
98
|
children: [
|
|
99
99
|
/* @__PURE__ */ t("span", { className: "truncate", children: e.title }),
|
|
100
|
-
|
|
100
|
+
S(e.filterKey) && /* @__PURE__ */ t(E, { className: "w-4 h-4 text-text-brand-secondary flex-shrink-0 ml-2" })
|
|
101
101
|
]
|
|
102
102
|
},
|
|
103
103
|
e.filterKey
|
|
@@ -105,11 +105,11 @@ const ne = () => {
|
|
|
105
105
|
] }),
|
|
106
106
|
/* @__PURE__ */ t("div", { className: "flex-1 flex flex-col", children: r ? B() : /* @__PURE__ */ t("div", { className: "flex-1 flex items-center justify-center text-text-neutral-muted", children: "Select a column to configure its filter" }) })
|
|
107
107
|
] }),
|
|
108
|
-
(!!
|
|
109
|
-
/* @__PURE__ */ t(
|
|
108
|
+
(!!m || b) && /* @__PURE__ */ l("div", { className: "flex justify-between items-end p-4 border-t border-stroke-solid-medium min-h-[73px]", children: [
|
|
109
|
+
/* @__PURE__ */ t(G, { selectedFilters: i, schema: c }),
|
|
110
110
|
/* @__PURE__ */ l("div", { className: "flex justify-end gap-2", children: [
|
|
111
|
-
!!
|
|
112
|
-
|
|
111
|
+
!!m && /* @__PURE__ */ t(x, { onClick: A, variant: "stroke", shade: "neutral", size: "small", children: "Clear All" }),
|
|
112
|
+
/* @__PURE__ */ t(
|
|
113
113
|
x,
|
|
114
114
|
{
|
|
115
115
|
onClick: v,
|
|
@@ -117,7 +117,8 @@ const ne = () => {
|
|
|
117
117
|
shade: "neutral",
|
|
118
118
|
size: "small",
|
|
119
119
|
className: "min-w-20",
|
|
120
|
-
|
|
120
|
+
disabled: !b,
|
|
121
|
+
children: `Apply ${m ? m.toLocaleString() : ""}`
|
|
121
122
|
}
|
|
122
123
|
)
|
|
123
124
|
] })
|