@ztwoint/z-ui 0.1.46 → 0.1.49
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/assets/icons/check.d.ts +8 -0
- package/dist/components/assets/icons/check.js +17 -0
- package/dist/components/assets/icons/x-mark.d.ts +8 -0
- package/dist/components/assets/icons/x-mark.js +17 -0
- 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/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/cell/avatar-cell.d.ts +15 -0
- package/dist/components/table/components/cell/avatar-cell.js +74 -0
- package/dist/components/table/components/cell/boolean-cell.d.ts +1 -2
- package/dist/components/table/components/cell/boolean-cell.js +5 -5
- package/dist/components/table/components/cell/description-cell.d.ts +7 -0
- package/dist/components/table/components/cell/description-cell.js +16 -0
- package/dist/components/table/components/cell/index.d.ts +10 -1
- package/dist/components/table/components/cell/label-cell.d.ts +10 -0
- package/dist/components/table/components/cell/label-cell.js +47 -0
- package/dist/components/table/components/cell/link-cell.d.ts +10 -0
- package/dist/components/table/components/cell/link-cell.js +35 -0
- package/dist/components/table/components/cell/number-cell.d.ts +5 -3
- package/dist/components/table/components/cell/number-cell.js +40 -3
- package/dist/components/table/components/index.d.ts +1 -1
- package/dist/components/table/components/table-cell.d.ts +1 -1
- package/dist/components/table/components/table-cell.js +41 -32
- 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/filters/boolean.js +52 -44
- package/dist/components/table/components/table-filter/selected-filters-display/selected-filters-display.utils.js +16 -16
- package/dist/components/table/components/table-filter/table-filter-button.js +88 -57
- package/dist/components/table/components/table-filter/table-filter-column-button.js +81 -51
- 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/stories/basic-header.d.ts +1 -1
- package/dist/components/table/components/table-header/table-header.js +27 -33
- package/dist/components/table/index.d.ts +1 -1
- package/dist/components/table/table-provider.js +37 -8
- package/dist/components/table/table.const.d.ts +15 -9
- package/dist/components/table/table.const.js +15 -9
- package/dist/components/table/table.js +39 -34
- package/dist/components/table/table.type.d.ts +36 -5
- package/dist/components/table/table.utils.d.ts +1 -1
- package/dist/components/table/table.utils.js +5 -3
- package/dist/components/table-card/table-card.js +116 -89
- 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/index.js +62 -64
- package/dist/types/components/alert/alert.const.d.ts +0 -3
- package/dist/types/components/assets/icons/check.d.ts +8 -0
- package/dist/types/components/assets/icons/x-mark.d.ts +8 -0
- 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/cell/avatar-cell.d.ts +15 -0
- package/dist/types/components/table/components/cell/boolean-cell.d.ts +1 -2
- package/dist/types/components/table/components/cell/description-cell.d.ts +7 -0
- package/dist/types/components/table/components/cell/index.d.ts +10 -1
- package/dist/types/components/table/components/cell/label-cell.d.ts +10 -0
- package/dist/types/components/table/components/cell/link-cell.d.ts +10 -0
- package/dist/types/components/table/components/cell/number-cell.d.ts +5 -3
- package/dist/types/components/table/components/index.d.ts +1 -1
- package/dist/types/components/table/components/table-cell.d.ts +1 -1
- 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/components/table-header/stories/basic-header.d.ts +1 -1
- package/dist/types/components/table/index.d.ts +1 -1
- package/dist/types/components/table/table.const.d.ts +15 -9
- package/dist/types/components/table/table.type.d.ts +36 -5
- package/dist/types/components/table/table.utils.d.ts +1 -1
- package/package.json +1 -1
- package/dist/components/table/components/cell/text-cell.d.ts +0 -7
- package/dist/components/table/components/cell/text-cell.js +0 -5
- 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/node_modules/@heroicons/react/24/solid/esm/CheckCircleIcon.js +0 -26
- package/dist/node_modules/@heroicons/react/24/solid/esm/XCircleIcon.js +0 -26
- package/dist/types/components/table/components/cell/text-cell.d.ts +0 -7
- /package/dist/css/config/typography/{typography.css → index.css} +0 -0
|
@@ -1,78 +1,108 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import * as
|
|
3
|
-
import { Button as
|
|
4
|
-
import { useTableFilterContext as
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import { useClickOutside as
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
1
|
+
import { jsxs as i, jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import * as m from "react";
|
|
3
|
+
import { Button as u } from "../../../button/button.js";
|
|
4
|
+
import { useTableFilterContext as K } from "./table-filter.context.js";
|
|
5
|
+
import U from "./filters/text.js";
|
|
6
|
+
import I from "./filters/boolean.js";
|
|
7
|
+
import P from "./filters/number/number.js";
|
|
8
|
+
import V from "./filters/checkbox.js";
|
|
9
|
+
import q from "../../../assets/icons/circle-check-filled.js";
|
|
10
|
+
import { useClickOutside as E } from "../../../../hooks/useClickOutside.js";
|
|
11
|
+
import { getFilterCount as G } from "./selected-filters-display/selected-filters-display.utils.js";
|
|
12
|
+
import { FilterConfirmationDialog as H } from "./close-filter-confirm/filter-confirmation-dialog.js";
|
|
13
|
+
import { hasUnsavedFilterChangesForColumn as b } from "./close-filter-confirm/filter-confirmation-dialog.utils.js";
|
|
14
|
+
const oe = ({ filterName: l }) => {
|
|
15
|
+
const [a, t] = m.useState(!1), [x, s] = m.useState(!1), h = m.useRef(null), {
|
|
16
|
+
getFilterForColumn: k,
|
|
17
|
+
hasAppliedFilterForColumn: y,
|
|
18
|
+
updateColumnFilter: C,
|
|
19
|
+
applyFilters: c,
|
|
20
|
+
resetToAppliedFilters: w,
|
|
21
|
+
schema: T,
|
|
22
|
+
filterComponents: d = {},
|
|
23
|
+
tempFilters: F,
|
|
24
|
+
filter: g
|
|
25
|
+
} = K();
|
|
26
|
+
E(h, () => {
|
|
27
|
+
b(l, F, g.value) && a ? s(!0) : t(!1);
|
|
28
|
+
});
|
|
29
|
+
const A = () => {
|
|
30
|
+
c(), t(!1);
|
|
31
|
+
}, O = () => {
|
|
32
|
+
s(!1), t(!1);
|
|
33
|
+
}, $ = () => {
|
|
34
|
+
w(), s(!1), t(!1);
|
|
35
|
+
}, R = () => {
|
|
36
|
+
s(!1);
|
|
37
|
+
}, e = T.find((r) => r.key === l);
|
|
22
38
|
if (!e)
|
|
23
39
|
return console.warn(`Column "${l}" not found in schema`), null;
|
|
24
40
|
if (e.filterable === !1)
|
|
25
41
|
return console.warn(`Column "${l}" is not filterable`), null;
|
|
26
|
-
const
|
|
27
|
-
boolean:
|
|
28
|
-
text:
|
|
29
|
-
number:
|
|
30
|
-
checkbox:
|
|
31
|
-
},
|
|
32
|
-
if (!
|
|
42
|
+
const z = {
|
|
43
|
+
boolean: I,
|
|
44
|
+
text: U,
|
|
45
|
+
number: P,
|
|
46
|
+
checkbox: V
|
|
47
|
+
}, v = e.cellType && (d == null ? void 0 : d[e.cellType]) || z[e.cellType ?? "text"];
|
|
48
|
+
if (!v)
|
|
33
49
|
return console.warn(
|
|
34
50
|
`No filter component found for column "${e.key}" with cellType "${e.cellType}". Provide a custom filter component or use supported types: "text", "number", "boolean", "checkbox".`
|
|
35
51
|
), null;
|
|
36
|
-
const o =
|
|
52
|
+
const o = k(l), f = y(l), p = o ? G(o, e.filterOptions) : void 0, D = {
|
|
37
53
|
condition: (o == null ? void 0 : o.condition) || "",
|
|
38
54
|
value: (o == null ? void 0 : o.value) || ""
|
|
39
|
-
},
|
|
40
|
-
|
|
41
|
-
},
|
|
42
|
-
|
|
55
|
+
}, j = () => {
|
|
56
|
+
C(l, "", ""), c(), t(!1);
|
|
57
|
+
}, B = () => {
|
|
58
|
+
c(), t(!1);
|
|
43
59
|
};
|
|
44
|
-
return /* @__PURE__ */
|
|
45
|
-
/* @__PURE__ */
|
|
46
|
-
|
|
60
|
+
return /* @__PURE__ */ i("div", { className: "relative", ref: h, children: [
|
|
61
|
+
/* @__PURE__ */ n(
|
|
62
|
+
u,
|
|
47
63
|
{
|
|
48
64
|
onClick: () => {
|
|
49
|
-
|
|
65
|
+
t(!a);
|
|
50
66
|
},
|
|
51
|
-
variant:
|
|
52
|
-
shade:
|
|
67
|
+
variant: f ? "filled" : "stroke",
|
|
68
|
+
shade: f ? "brand" : "neutral",
|
|
53
69
|
size: "small",
|
|
54
|
-
children: /* @__PURE__ */
|
|
70
|
+
children: /* @__PURE__ */ i("span", { className: "flex items-center gap-2", children: [
|
|
55
71
|
e.title,
|
|
56
|
-
|
|
72
|
+
f && /* @__PURE__ */ n(q, { className: "w-4 h-4 text-white flex-shrink-0" })
|
|
57
73
|
] })
|
|
58
74
|
}
|
|
59
75
|
),
|
|
60
|
-
|
|
61
|
-
/* @__PURE__ */
|
|
62
|
-
|
|
76
|
+
a && /* @__PURE__ */ i("div", { className: "absolute top-full left-0 mt-2 w-80 bg-surface-neutral-default border border-stroke-solid-light rounded-2xl z-10 overflow-hidden shadow-lg", children: [
|
|
77
|
+
/* @__PURE__ */ n(
|
|
78
|
+
v,
|
|
63
79
|
{
|
|
64
|
-
value:
|
|
65
|
-
onChange: ({ condition:
|
|
80
|
+
value: D,
|
|
81
|
+
onChange: ({ condition: r, value: S }) => C(l, r, S),
|
|
66
82
|
filterOptions: e.filterOptions
|
|
67
83
|
}
|
|
68
84
|
),
|
|
69
|
-
/* @__PURE__ */
|
|
70
|
-
/* @__PURE__ */
|
|
71
|
-
/* @__PURE__ */
|
|
85
|
+
!!p && /* @__PURE__ */ i("div", { className: "flex justify-between gap-2 p-3 border-t border-stroke-solid-medium", children: [
|
|
86
|
+
/* @__PURE__ */ n(u, { onClick: j, variant: "stroke", shade: "neutral", size: "small", children: "Clear All" }),
|
|
87
|
+
/* @__PURE__ */ n(u, { onClick: B, variant: "filled", shade: "neutral", size: "small", children: `Apply${p !== void 0 ? ` ${p}` : ""}` })
|
|
72
88
|
] })
|
|
73
|
-
] })
|
|
89
|
+
] }),
|
|
90
|
+
x && /* @__PURE__ */ n(
|
|
91
|
+
H,
|
|
92
|
+
{
|
|
93
|
+
onClose: R,
|
|
94
|
+
onKeepChanges: O,
|
|
95
|
+
onRevertChanges: $,
|
|
96
|
+
onApplyChanges: A,
|
|
97
|
+
hasUnsavedChanges: b(
|
|
98
|
+
l,
|
|
99
|
+
F,
|
|
100
|
+
g.value
|
|
101
|
+
)
|
|
102
|
+
}
|
|
103
|
+
)
|
|
74
104
|
] });
|
|
75
105
|
};
|
|
76
106
|
export {
|
|
77
|
-
|
|
107
|
+
oe as TableFilterColumnButton
|
|
78
108
|
};
|
|
@@ -9,6 +9,7 @@ export interface TableFilterContextValue {
|
|
|
9
9
|
hasAppliedFilterForColumn: (columnKey: string) => boolean;
|
|
10
10
|
updateColumnFilter: (columnKey: string, condition?: string, value?: string | string[]) => void;
|
|
11
11
|
clearAllFilters: () => void;
|
|
12
|
+
resetToAppliedFilters: () => void;
|
|
12
13
|
applyFilters: () => void;
|
|
13
14
|
hasActiveFilters: boolean;
|
|
14
15
|
filterableFields: TableSchema;
|
|
@@ -9,6 +9,7 @@ declare const useTableFilter: ({ filter, schema }: TableFilterProps) => {
|
|
|
9
9
|
hasAppliedFilterForColumn: (columnKey: string) => boolean;
|
|
10
10
|
updateColumnFilter: (columnKey: string, condition?: string, value?: string | string[]) => void;
|
|
11
11
|
clearAllFilters: () => void;
|
|
12
|
+
resetToAppliedFilters: () => void;
|
|
12
13
|
applyFilters: () => void;
|
|
13
14
|
hasActiveFilters: boolean;
|
|
14
15
|
tempFilters: FilterRule[];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import u from "react";
|
|
2
|
-
const
|
|
3
|
-
const [i, f] = u.useState(null), [r,
|
|
2
|
+
const T = ({ filter: l, schema: v }) => {
|
|
3
|
+
const [i, f] = u.useState(null), [r, s] = u.useState(l.value), a = v.filter((t) => t.filterable !== !1);
|
|
4
4
|
u.useEffect(() => {
|
|
5
5
|
!i && a.length > 0 && f(a[0].key);
|
|
6
6
|
}, [i, a]);
|
|
@@ -11,32 +11,34 @@ const S = ({ filter: l, schema: v }) => {
|
|
|
11
11
|
const e = m(t);
|
|
12
12
|
return e ? Array.isArray(e.value) ? e.value.length > 0 : e.value !== "" : !1;
|
|
13
13
|
}, g = (t, e, o) => {
|
|
14
|
-
const d = r.findIndex((
|
|
14
|
+
const d = r.findIndex((n) => n.field === t);
|
|
15
15
|
if (d >= 0) {
|
|
16
|
-
const
|
|
17
|
-
(F,
|
|
16
|
+
const n = r.map(
|
|
17
|
+
(F, b) => b === d ? {
|
|
18
18
|
...F,
|
|
19
19
|
...e !== void 0 ? { condition: e } : {},
|
|
20
20
|
...o !== void 0 ? { value: o } : {}
|
|
21
21
|
} : F
|
|
22
22
|
);
|
|
23
|
-
n
|
|
23
|
+
s(n);
|
|
24
24
|
} else {
|
|
25
|
-
const
|
|
25
|
+
const n = {
|
|
26
26
|
field: t,
|
|
27
27
|
...e ? { condition: e } : {},
|
|
28
28
|
value: o || ""
|
|
29
29
|
};
|
|
30
|
-
|
|
30
|
+
s([...r, n]);
|
|
31
31
|
}
|
|
32
32
|
}, h = () => {
|
|
33
|
-
|
|
33
|
+
s([]);
|
|
34
34
|
}, C = () => {
|
|
35
|
+
s(l.value);
|
|
36
|
+
}, y = () => {
|
|
35
37
|
const t = r.filter((e) => Array.isArray(e.value) ? e.value.length > 0 : e.value !== "");
|
|
36
38
|
l.onChange(t);
|
|
37
|
-
},
|
|
39
|
+
}, x = l.value.length > 0;
|
|
38
40
|
return u.useEffect(() => {
|
|
39
|
-
|
|
41
|
+
s(l.value);
|
|
40
42
|
}, [l.value]), {
|
|
41
43
|
selectedColumn: i,
|
|
42
44
|
setSelectedColumn: f,
|
|
@@ -45,12 +47,13 @@ const S = ({ filter: l, schema: v }) => {
|
|
|
45
47
|
hasAppliedFilterForColumn: A,
|
|
46
48
|
updateColumnFilter: g,
|
|
47
49
|
clearAllFilters: h,
|
|
48
|
-
|
|
49
|
-
|
|
50
|
+
resetToAppliedFilters: C,
|
|
51
|
+
applyFilters: y,
|
|
52
|
+
hasActiveFilters: x,
|
|
50
53
|
tempFilters: r,
|
|
51
54
|
filterableFields: a
|
|
52
55
|
};
|
|
53
56
|
};
|
|
54
57
|
export {
|
|
55
|
-
|
|
58
|
+
T as default
|
|
56
59
|
};
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { jsx as r } from "react/jsx-runtime";
|
|
2
2
|
import "react";
|
|
3
|
-
import { cn as
|
|
4
|
-
const
|
|
3
|
+
import { cn as o } from "../../../lib/utils.js";
|
|
4
|
+
const n = ({ children: e, className: t = "" }) => /* @__PURE__ */ r(
|
|
5
5
|
"div",
|
|
6
6
|
{
|
|
7
|
-
className:
|
|
8
|
-
"flex justify-between items-center bg-neutral-
|
|
7
|
+
className: o(
|
|
8
|
+
"flex justify-between items-center bg-background-neutral-default gap-3 p-2 pl-4",
|
|
9
9
|
t
|
|
10
10
|
),
|
|
11
11
|
children: e
|
|
12
12
|
}
|
|
13
13
|
);
|
|
14
14
|
export {
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
n as TableFooter,
|
|
16
|
+
n as default
|
|
17
17
|
};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { StoryObj } from '@storybook/react';
|
|
2
|
-
export declare const basicHeaderUsageCode = "import { Table, TableHeader } from '@/components/table';\n\nconst schema = [\n {\n key: 'id',\n title: 'ID',\n cellType: 'number',\n sortable: true,\n },\n {\n key: 'name',\n title: 'Name',\n cellType: '
|
|
2
|
+
export declare const basicHeaderUsageCode = "import { Table, TableHeader } from '@/components/table';\n\nconst schema = [\n {\n key: 'id',\n title: 'ID',\n cellType: 'number',\n sortable: true,\n },\n {\n key: 'name',\n title: 'Name',\n cellType: 'label',\n sortable: true,\n },\n];\n\nconst data = [\n { id: 1, name: 'John Doe' },\n { id: 2, name: 'Jane Smith' },\n];\n\nfunction MyTable() {\n return (\n <Table dataSource={data} schema={schema}>\n <table className=\"w-full\">\n <TableHeader \n schema={schema}\n cell={{ hasBorder: true }}\n />\n {/* Table body goes here */}\n </table>\n </Table>\n );\n}";
|
|
3
3
|
export declare const BasicHeader: StoryObj;
|
|
@@ -1,38 +1,32 @@
|
|
|
1
|
-
import { jsx as r, jsxs as
|
|
1
|
+
import { jsx as r, jsxs as h } from "react/jsx-runtime";
|
|
2
2
|
import { TABLE_CSS_CLASSES as t } from "../../table.const.js";
|
|
3
3
|
import { TableSortIcon as n } from "./table-sort-icon.js";
|
|
4
|
-
import { getCurrentSortDirection as
|
|
4
|
+
import { getCurrentSortDirection as p, isSortActive as C, handleSortClick as S } from "./table-header.utils.js";
|
|
5
5
|
import "react";
|
|
6
|
-
import { cn as
|
|
7
|
-
const
|
|
8
|
-
schema:
|
|
9
|
-
sort:
|
|
10
|
-
cell:
|
|
11
|
-
stickyHeader:
|
|
12
|
-
}) => /* @__PURE__ */ r(
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
"
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
},
|
|
31
|
-
e.key
|
|
32
|
-
);
|
|
33
|
-
}) })
|
|
34
|
-
}
|
|
35
|
-
);
|
|
6
|
+
import { cn as i } from "../../../../lib/utils.js";
|
|
7
|
+
const A = ({
|
|
8
|
+
schema: o,
|
|
9
|
+
sort: a,
|
|
10
|
+
cell: s,
|
|
11
|
+
stickyHeader: l = !1
|
|
12
|
+
}) => /* @__PURE__ */ r("thead", { className: i(t.header, l && "sticky top-0 z-1"), children: /* @__PURE__ */ r("tr", { children: o.map((e) => {
|
|
13
|
+
const d = p(e.key, a), c = C(e.key, a);
|
|
14
|
+
return /* @__PURE__ */ r(
|
|
15
|
+
"th",
|
|
16
|
+
{
|
|
17
|
+
className: i(
|
|
18
|
+
e.sortable ? t.sortableHeaderCell : t.headerCell.default,
|
|
19
|
+
t.headerCell.hasBorder[s.hasBorder ? "true" : "false"]
|
|
20
|
+
),
|
|
21
|
+
onClick: e.sortable ? () => S(e.key, a) : void 0,
|
|
22
|
+
children: /* @__PURE__ */ h("div", { className: t.headerCellContent, children: [
|
|
23
|
+
/* @__PURE__ */ r("span", { children: e.title }),
|
|
24
|
+
e.sortable && /* @__PURE__ */ r(n, { direction: d, isActive: c })
|
|
25
|
+
] })
|
|
26
|
+
},
|
|
27
|
+
e.key
|
|
28
|
+
);
|
|
29
|
+
}) }) });
|
|
36
30
|
export {
|
|
37
|
-
|
|
31
|
+
A as TableHeader
|
|
38
32
|
};
|
|
@@ -4,5 +4,5 @@ export type { TableProps, TableSchema, TableSchemaColumn, CellType, CellValue, C
|
|
|
4
4
|
export { extractCellValue } from './table.utils';
|
|
5
5
|
export { DEFAULT_EMPTY_MESSAGE, TABLE_CSS_CLASSES } from './table.const';
|
|
6
6
|
export { TableContext, useTableContext } from './table.context';
|
|
7
|
-
export { TableCell, TableHeader, TableRow, TableEmptyState, TableLoadingState, TablePagination,
|
|
7
|
+
export { TableCell, TableHeader, TableRow, TableEmptyState, TableLoadingState, TablePagination, NumberCell, BooleanCell, TableHeaderWrapper, TableHeaderContent, TableFooter, TableFooterContent, } from './components';
|
|
8
8
|
export { PaginationInfo, PaginationQuickJumper } from './components/pagination/components';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import * as
|
|
3
|
-
import { TableContext as
|
|
4
|
-
import { TableBody as
|
|
1
|
+
import { jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import * as p from "react";
|
|
3
|
+
import { TableContext as a } from "./table.context.js";
|
|
4
|
+
import { TableBody as n } from "./table.js";
|
|
5
5
|
import { TableFilter as f } from "./components/table-filter/table-filter-provider.js";
|
|
6
6
|
import { TableSearch as l } from "./components/table-search/table-search.js";
|
|
7
7
|
import { Pagination as s } from "./components/pagination/pagination.js";
|
|
@@ -9,27 +9,56 @@ import { PaginationInfo as T } from "./components/pagination/components/paginati
|
|
|
9
9
|
import { PaginationQuickJumper as b } from "./components/pagination/components/pagination-quick-jumper.js";
|
|
10
10
|
import "clsx";
|
|
11
11
|
import "tailwind-merge";
|
|
12
|
+
/* empty css */
|
|
13
|
+
import "../alert/alert.const.js";
|
|
14
|
+
import "../button/button.js";
|
|
15
|
+
import "../collapsible-side-nav-bar/side-nav-bar-provider.js";
|
|
16
|
+
import "../collapsible-side-nav-bar/side-nav-bar.js";
|
|
17
|
+
import "../collapsible-side-nav-bar/side-nav-bar-header.js";
|
|
18
|
+
import "../collapsible-side-nav-bar/side-nav-bar-content.js";
|
|
19
|
+
import "../collapsible-side-nav-bar/side-nav-bar-footer.js";
|
|
20
|
+
import "../collapsible-side-nav-bar/side-nav-bar-group.js";
|
|
21
|
+
import "../collapsible-side-nav-bar/side-nav-bar-item.js";
|
|
22
|
+
import "../collapsible-side-nav-bar/side-nav-bar-separator.js";
|
|
23
|
+
import "../collapsible-side-nav-bar/context.js";
|
|
24
|
+
import "../collapsible-side-nav-bar/popover/popover.js";
|
|
25
|
+
import "react-country-flag";
|
|
26
|
+
import "classnames";
|
|
27
|
+
import "@radix-ui/react-dialog";
|
|
28
|
+
import "../dropdown/z2-dropdown.js";
|
|
29
|
+
import "@radix-ui/react-dropdown-menu";
|
|
30
|
+
import "lucide-react";
|
|
31
|
+
import "../input/input.js";
|
|
32
|
+
import "../nav-header/nav-header.js";
|
|
33
|
+
import "../nav-header/nav-item/nav-item.js";
|
|
34
|
+
import "@radix-ui/react-select";
|
|
35
|
+
import "../stepper/stepper.js";
|
|
36
|
+
import "../stepper-item/stepper-item.js";
|
|
37
|
+
import "@radix-ui/react-tabs";
|
|
38
|
+
import "../tooltip/tooltip.js";
|
|
39
|
+
import "../badge/badge.js";
|
|
40
|
+
import "../avatar/avatar.js";
|
|
12
41
|
import { TableHeaderWrapper as c } from "./components/table-header-wrapper.js";
|
|
13
42
|
import { TableHeaderContent as d } from "./components/table-header-content.js";
|
|
14
43
|
import { TableFooter as u } from "./components/table-footer.js";
|
|
15
44
|
import { TableFooterContent as g } from "./components/table-footer-content.js";
|
|
16
45
|
const t = ({
|
|
17
|
-
children:
|
|
46
|
+
children: i,
|
|
18
47
|
pagination: C,
|
|
19
48
|
sort: F,
|
|
20
49
|
filter: v,
|
|
21
50
|
filterComponents: x,
|
|
22
51
|
...r
|
|
23
52
|
}) => {
|
|
24
|
-
const
|
|
53
|
+
const m = p.useMemo(
|
|
25
54
|
() => ({
|
|
26
55
|
...r
|
|
27
56
|
}),
|
|
28
57
|
[r]
|
|
29
58
|
);
|
|
30
|
-
return /* @__PURE__ */ a
|
|
59
|
+
return /* @__PURE__ */ e(a.Provider, { value: m, children: i });
|
|
31
60
|
}, P = t, o = P;
|
|
32
|
-
o.Body =
|
|
61
|
+
o.Body = n;
|
|
33
62
|
o.Filter = f;
|
|
34
63
|
o.Search = l;
|
|
35
64
|
o.Pagination = s;
|
|
@@ -1,24 +1,30 @@
|
|
|
1
1
|
export declare const DEFAULT_EMPTY_MESSAGE = "No data available";
|
|
2
2
|
export declare const TABLE_CSS_CLASSES: {
|
|
3
3
|
readonly table: "w-full";
|
|
4
|
-
readonly
|
|
4
|
+
readonly bordered: {
|
|
5
|
+
readonly true: "[&_td:first-child]:border-l-1 [&_th:first-child]:border-l-1 ";
|
|
6
|
+
readonly false: "";
|
|
7
|
+
};
|
|
8
|
+
readonly header: "bg-background-neutral-medium text-text-neutral-secondary table-fixed";
|
|
5
9
|
readonly cell: {
|
|
6
|
-
readonly default: "
|
|
7
|
-
readonly cellHeight: {
|
|
8
|
-
readonly small: "p-3";
|
|
9
|
-
readonly large: "p-4";
|
|
10
|
-
};
|
|
10
|
+
readonly default: "p-0 align-middle relative h-4 ";
|
|
11
11
|
readonly hasBorder: {
|
|
12
|
-
readonly true: "border border-stroke-solid-light";
|
|
12
|
+
readonly true: "border-r border-b border-stroke-solid-light ";
|
|
13
13
|
readonly false: "border-b border-stroke-solid-light";
|
|
14
14
|
};
|
|
15
15
|
};
|
|
16
|
-
readonly headerCell:
|
|
16
|
+
readonly headerCell: {
|
|
17
|
+
readonly default: "px-4 py-3 text-left text-xs font-medium uppercase tracking-wider border-stroke-solid-light";
|
|
18
|
+
readonly hasBorder: {
|
|
19
|
+
readonly true: " [box-shadow:inset_-1px_0_0_0_var(--color-stroke-solid-light),_inset_0_-1px_0_0_var(--color-stroke-solid-light)] border-stroke-solid-light dark:shadow-none dark:border-0";
|
|
20
|
+
readonly false: "border-stroke-solid-light ";
|
|
21
|
+
};
|
|
22
|
+
};
|
|
17
23
|
readonly sortableHeaderCell: "p-3 text-left text-xs font-medium uppercase tracking-wider cursor-pointer transition-colors duration-200";
|
|
18
24
|
readonly headerCellContent: "flex items-center justify-between";
|
|
19
25
|
readonly sortIcon: "ml-2 w-4 h-4 text-gray-400";
|
|
20
26
|
readonly sortIconActive: "ml-2 w-4 h-4 text-gray-600";
|
|
21
|
-
readonly row: "
|
|
27
|
+
readonly row: " transition-colors duration-200 text-text-neutral-primary";
|
|
22
28
|
readonly emptyState: "px-4 py-8 text-center text-gray-500";
|
|
23
29
|
readonly loading: "px-4 py-8 text-center text-gray-500";
|
|
24
30
|
};
|
|
@@ -1,23 +1,29 @@
|
|
|
1
1
|
const e = "No data available", t = {
|
|
2
2
|
table: "w-full",
|
|
3
|
-
|
|
3
|
+
bordered: {
|
|
4
|
+
true: "[&_td:first-child]:border-l-1 [&_th:first-child]:border-l-1 ",
|
|
5
|
+
false: ""
|
|
6
|
+
},
|
|
7
|
+
header: "bg-background-neutral-medium text-text-neutral-secondary table-fixed",
|
|
4
8
|
cell: {
|
|
5
|
-
default: "
|
|
6
|
-
cellHeight: {
|
|
7
|
-
small: "p-3",
|
|
8
|
-
large: "p-4"
|
|
9
|
-
},
|
|
9
|
+
default: "p-0 align-middle relative h-4 ",
|
|
10
10
|
hasBorder: {
|
|
11
|
-
true: "border border-stroke-solid-light",
|
|
11
|
+
true: "border-r border-b border-stroke-solid-light ",
|
|
12
12
|
false: "border-b border-stroke-solid-light"
|
|
13
13
|
}
|
|
14
14
|
},
|
|
15
|
-
headerCell:
|
|
15
|
+
headerCell: {
|
|
16
|
+
default: "px-4 py-3 text-left text-xs font-medium uppercase tracking-wider border-stroke-solid-light",
|
|
17
|
+
hasBorder: {
|
|
18
|
+
true: " [box-shadow:inset_-1px_0_0_0_var(--color-stroke-solid-light),_inset_0_-1px_0_0_var(--color-stroke-solid-light)] border-stroke-solid-light dark:shadow-none dark:border-0",
|
|
19
|
+
false: "border-stroke-solid-light "
|
|
20
|
+
}
|
|
21
|
+
},
|
|
16
22
|
sortableHeaderCell: "p-3 text-left text-xs font-medium uppercase tracking-wider cursor-pointer transition-colors duration-200",
|
|
17
23
|
headerCellContent: "flex items-center justify-between",
|
|
18
24
|
sortIcon: "ml-2 w-4 h-4 text-gray-400",
|
|
19
25
|
sortIconActive: "ml-2 w-4 h-4 text-gray-600",
|
|
20
|
-
row: "
|
|
26
|
+
row: " transition-colors duration-200 text-text-neutral-primary",
|
|
21
27
|
emptyState: "px-4 py-8 text-center text-gray-500",
|
|
22
28
|
loading: "px-4 py-8 text-center text-gray-500"
|
|
23
29
|
};
|
|
@@ -1,41 +1,46 @@
|
|
|
1
|
-
import { jsx as e, jsxs as
|
|
2
|
-
import * as
|
|
3
|
-
import { DEFAULT_EMPTY_MESSAGE as
|
|
4
|
-
import { TableHeader as
|
|
5
|
-
import { TableRow as
|
|
6
|
-
import { TableEmptyState as
|
|
7
|
-
import { TableLoadingState as
|
|
1
|
+
import { jsx as e, jsxs as h } from "react/jsx-runtime";
|
|
2
|
+
import * as T from "react";
|
|
3
|
+
import { DEFAULT_EMPTY_MESSAGE as g, TABLE_CSS_CLASSES as m } from "./table.const.js";
|
|
4
|
+
import { TableHeader as E } from "./components/table-header/table-header.js";
|
|
5
|
+
import { TableRow as y } from "./components/table-row.js";
|
|
6
|
+
import { TableEmptyState as x } from "./components/table-empty-state.js";
|
|
7
|
+
import { TableLoadingState as B } from "./components/table-loading-state.js";
|
|
8
8
|
import { TableContext as C } from "./table.context.js";
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
loading: i = !1,
|
|
20
|
-
emptyMessage: f = T,
|
|
21
|
-
customCells: p
|
|
22
|
-
} = c || n, d = () => i ? /* @__PURE__ */ e(x, { colSpan: t.length }) : !o || o.length === 0 ? /* @__PURE__ */ e(y, { colSpan: t.length, message: f }) : /* @__PURE__ */ e("tbody", { children: o.map((S, a) => /* @__PURE__ */ e(
|
|
23
|
-
E,
|
|
9
|
+
import { cn as s } from "../../lib/utils.js";
|
|
10
|
+
const R = ({ cell: o = { hasBorder: !0 }, sort: n, className: f, stickyHeader: d = !1, ...i }) => {
|
|
11
|
+
const c = T.useContext(C), {
|
|
12
|
+
dataSource: t = [],
|
|
13
|
+
schema: r = [],
|
|
14
|
+
loading: a = !1,
|
|
15
|
+
emptyMessage: p = g,
|
|
16
|
+
customCells: u
|
|
17
|
+
} = c || i, S = () => a ? /* @__PURE__ */ e(B, { colSpan: r.length }) : !t || t.length === 0 ? /* @__PURE__ */ e(x, { colSpan: r.length, message: p }) : /* @__PURE__ */ e("tbody", { children: t.map((b, l) => /* @__PURE__ */ e(
|
|
18
|
+
y,
|
|
24
19
|
{
|
|
25
|
-
record:
|
|
26
|
-
index:
|
|
27
|
-
schema:
|
|
28
|
-
customCells:
|
|
29
|
-
cell:
|
|
20
|
+
record: b,
|
|
21
|
+
index: l,
|
|
22
|
+
schema: r,
|
|
23
|
+
customCells: u,
|
|
24
|
+
cell: o
|
|
30
25
|
},
|
|
31
|
-
|
|
26
|
+
l
|
|
32
27
|
)) });
|
|
33
|
-
return /* @__PURE__ */ e(
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
28
|
+
return /* @__PURE__ */ e(
|
|
29
|
+
"div",
|
|
30
|
+
{
|
|
31
|
+
className: s(
|
|
32
|
+
"overflow-y-auto",
|
|
33
|
+
m.bordered[o.hasBorder && !a && t.length > 0 ? "true" : "false"],
|
|
34
|
+
f
|
|
35
|
+
),
|
|
36
|
+
children: /* @__PURE__ */ h("table", { className: s(m.table, "w-full"), children: [
|
|
37
|
+
/* @__PURE__ */ e(E, { schema: r, sort: n, cell: o, stickyHeader: d }),
|
|
38
|
+
S()
|
|
39
|
+
] })
|
|
40
|
+
}
|
|
41
|
+
);
|
|
37
42
|
};
|
|
38
43
|
export {
|
|
39
|
-
|
|
40
|
-
|
|
44
|
+
R as TableBody,
|
|
45
|
+
R as default
|
|
41
46
|
};
|