@ztwoint/z-ui 0.1.40 → 0.1.41
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-right.d.ts +1 -2
- package/dist/components/assets/icons/chevron-right.js +13 -27
- package/dist/components/button/button.js +9 -9
- package/dist/components/file-upload-area/file-upload-area.js +2 -2
- package/dist/components/table/components/pagination/components/pagination-info.js +12 -12
- package/dist/components/table/components/pagination/pagination.const.d.ts +1 -1
- package/dist/components/table/components/pagination/pagination.const.js +1 -1
- package/dist/components/table/components/pagination/pagination.js +43 -43
- package/dist/components/table/components/pagination/pagination.utils.js +17 -15
- package/dist/components/table/components/table-footer.js +8 -3
- package/dist/components/table/components/table-header/stories/basic-header.d.ts +3 -0
- package/dist/components/table/components/table-header/stories/custom-header-content.d.ts +3 -0
- package/dist/components/table/components/table-header/stories/header-for-sorting.d.ts +3 -0
- package/dist/components/table/components/table-header/table-header.storiesOld.d.ts +6 -0
- package/dist/components/table/components/table-header-wrapper.js +6 -10
- package/dist/components/table/components/table-search/table-search.js +4 -4
- package/dist/components/table-card/table-card.js +118 -92
- package/dist/components/table-card/table-card.type.d.ts +7 -1
- package/dist/css/config/components/button.css +8 -0
- package/dist/css/config/components/file-upload-area.css +11 -0
- package/dist/css/config/components/index.css +1 -0
- package/dist/css/styles/tailwind.css +1 -1
- package/dist/types/components/assets/icons/chevron-right.d.ts +1 -2
- package/dist/types/components/table/components/pagination/pagination.const.d.ts +1 -1
- package/dist/types/components/table/components/table-header/stories/basic-header.d.ts +3 -0
- package/dist/types/components/table/components/table-header/stories/custom-header-content.d.ts +3 -0
- package/dist/types/components/table/components/table-header/stories/header-for-sorting.d.ts +3 -0
- package/dist/types/components/table/components/table-header/table-header.storiesOld.d.ts +6 -0
- package/dist/types/components/table-card/table-card.type.d.ts +7 -1
- package/package.json +1 -1
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { SVGProps } from 'react';
|
|
2
2
|
type IconProps = SVGProps<SVGSVGElement> & {
|
|
3
3
|
secondaryfill?: string;
|
|
4
|
-
strokewidth?: number;
|
|
5
4
|
title?: string;
|
|
6
5
|
};
|
|
7
|
-
declare function ChevronRightIcon({ fill,
|
|
6
|
+
declare function ChevronRightIcon({ fill, title, ...props }: IconProps): import("react/jsx-runtime").JSX.Element;
|
|
8
7
|
export default ChevronRightIcon;
|
|
@@ -1,30 +1,16 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
function
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
height: e,
|
|
14
|
-
width: r,
|
|
15
|
-
viewBox: "0 0 14 14",
|
|
16
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
17
|
-
...i,
|
|
18
|
-
children: /* @__PURE__ */ t(
|
|
19
|
-
"path",
|
|
20
|
-
{
|
|
21
|
-
d: "M4.95778 2.41478C5.26089 2.11174 5.75228 2.11174 6.05539 2.41478L10.0919 6.45123C10.3948 6.75435 10.3949 7.24576 10.0919 7.54885L6.05539 11.5853C5.7523 11.8882 5.26087 11.8882 4.95778 11.5853C4.65477 11.2822 4.65483 10.7908 4.95778 10.4877L8.44543 7.00004L4.95778 3.51239C4.65472 3.20925 4.65467 2.71788 4.95778 2.41478Z",
|
|
22
|
-
fill: o
|
|
23
|
-
}
|
|
24
|
-
)
|
|
25
|
-
}
|
|
26
|
-
);
|
|
1
|
+
import { jsxs as n, jsx as r } from "react/jsx-runtime";
|
|
2
|
+
function i({ fill: t = "currentColor", title: e = "chevron right", ...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__ */ r("title", { children: e }),
|
|
5
|
+
/* @__PURE__ */ r("g", { fill: t, children: /* @__PURE__ */ r(
|
|
6
|
+
"path",
|
|
7
|
+
{
|
|
8
|
+
d: "M4.95778 2.41478C5.26089 2.11174 5.75228 2.11174 6.05539 2.41478L10.0919 6.45123C10.3948 6.75435 10.3949 7.24576 10.0919 7.54885L6.05539 11.5853C5.7523 11.8882 5.26087 11.8882 4.95778 11.5853C4.65477 11.2822 4.65483 10.7908 4.95778 10.4877L8.44543 7.00004L4.95778 3.51239C4.65472 3.20925 4.65467 2.71788 4.95778 2.41478Z",
|
|
9
|
+
fill: t
|
|
10
|
+
}
|
|
11
|
+
) })
|
|
12
|
+
] });
|
|
27
13
|
}
|
|
28
14
|
export {
|
|
29
|
-
|
|
15
|
+
i as default
|
|
30
16
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx as e, jsxs as v, Fragment as h } from "react/jsx-runtime";
|
|
2
2
|
import w from "react";
|
|
3
|
-
import { Slot as
|
|
4
|
-
import { cva as
|
|
3
|
+
import { Slot as k } from "@radix-ui/react-slot";
|
|
4
|
+
import { cva as O } from "class-variance-authority";
|
|
5
5
|
import { cn as d } from "../../lib/utils.js";
|
|
6
|
-
const
|
|
6
|
+
const z = O(
|
|
7
7
|
"box-border h-7.5 leading-none-medium-sm flex items-center justify-center whitespace-nowrap rounded-lg select-none hover:cursor-pointer active:outline-none border-solid",
|
|
8
8
|
{
|
|
9
9
|
variants: {
|
|
@@ -50,17 +50,17 @@ const k = z(
|
|
|
50
50
|
{
|
|
51
51
|
variant: "stroke",
|
|
52
52
|
shade: "neutral",
|
|
53
|
-
class: "border-none shadow-default dark:shadow-none bg-button-secondary-surface-default text-text-neutral-primary hover:bg-button-secondary-surface-hover hover:text-text-neutral-primary active:bg-button-secondary-surface-pressed active:text-text-neutral-primary disabled:bg-button-secondary-surface-disabled disabled:text-text-neutral-muted"
|
|
53
|
+
class: "border-none shadow-button-default disabled:shadow-none dark:shadow-none bg-button-secondary-surface-default text-text-neutral-primary hover:bg-button-secondary-surface-hover hover:text-text-neutral-primary active:bg-button-secondary-surface-pressed active:text-text-neutral-primary disabled:bg-button-secondary-surface-disabled disabled:text-text-neutral-muted"
|
|
54
54
|
},
|
|
55
55
|
{
|
|
56
56
|
variant: "stroke",
|
|
57
57
|
shade: "danger",
|
|
58
|
-
class: "border-none shadow-default bg-button-secondary-surface-default text-text-danger-secondary hover:bg-button-secondary-surface-hover hover:text-text-secondary active:bg-button-secondary-surface-pressed active:text-text-primary disabled:bg-button-secondary-surface-disabled disabled:text-text-neutral-muted"
|
|
58
|
+
class: "border-none shadow-button-default disabled:shadow-none dark:shadow-none bg-button-secondary-surface-default text-text-danger-secondary hover:bg-button-secondary-surface-hover hover:text-text-secondary active:bg-button-secondary-surface-pressed active:text-text-primary disabled:bg-button-secondary-surface-disabled disabled:text-text-neutral-muted"
|
|
59
59
|
},
|
|
60
60
|
{
|
|
61
61
|
variant: "stroke",
|
|
62
62
|
shade: "brand",
|
|
63
|
-
class: "border-none shadow-default bg-button-secondary-surface-default text-text-brand-secondary hover:bg-button-secondary-surface-hover hover:text-text-secondary active:bg-button-secondary-surface-pressed active:text-text-primary disabled:bg-button-secondary-surface-disabled disabled:text-text-neutral-muted"
|
|
63
|
+
class: "border-none shadow-button-default disabled:shadow-none dark:shadow-none bg-button-secondary-surface-default text-text-brand-secondary hover:bg-button-secondary-surface-hover hover:text-text-secondary active:bg-button-secondary-surface-pressed active:text-text-primary disabled:bg-button-secondary-surface-disabled disabled:text-text-neutral-muted"
|
|
64
64
|
},
|
|
65
65
|
{
|
|
66
66
|
variant: "ghost",
|
|
@@ -98,8 +98,8 @@ const k = z(
|
|
|
98
98
|
children: u,
|
|
99
99
|
...p
|
|
100
100
|
}, y) => {
|
|
101
|
-
const f = o ?
|
|
102
|
-
|
|
101
|
+
const f = o ? k : "button", r = m || u, n = !r && !!(t || a), l = n ? t || a : null, g = d(
|
|
102
|
+
z({ shade: b, size: c, variant: x, iconOnly: n }),
|
|
103
103
|
i
|
|
104
104
|
), s = "w-3.5 h-3.5 min-w-max";
|
|
105
105
|
return /* @__PURE__ */ e(f, { className: g, ref: y, ...p, children: o ? u : n ? l ? /* @__PURE__ */ e("span", { className: s, children: l }) : null : /* @__PURE__ */ v(h, { children: [
|
|
@@ -112,5 +112,5 @@ const k = z(
|
|
|
112
112
|
N.displayName = "Button";
|
|
113
113
|
export {
|
|
114
114
|
N as Button,
|
|
115
|
-
|
|
115
|
+
z as buttonVariants
|
|
116
116
|
};
|
|
@@ -27,8 +27,8 @@ const I = ({
|
|
|
27
27
|
"div",
|
|
28
28
|
{
|
|
29
29
|
className: y(
|
|
30
|
-
"flex flex-col items-center justify-center gap-8 p-12 max-w-112 w-full rounded-
|
|
31
|
-
e && "opacity-60 bg-gray-100 cursor-not-allowed",
|
|
30
|
+
"flex flex-col items-center justify-center gap-8 p-12 max-w-112 w-full rounded-3xl file-upload-12-dash-border bg-neutral-light",
|
|
31
|
+
e && "opacity-60 bg-gray-100 cursor-not-allowed disabled",
|
|
32
32
|
s
|
|
33
33
|
),
|
|
34
34
|
onDragOver: p,
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { calculateItemRange as
|
|
3
|
-
import { PAGINATION_LABELS as r, PAGINATION_CSS_CLASSES as
|
|
4
|
-
const
|
|
1
|
+
import { jsxs as c } from "react/jsx-runtime";
|
|
2
|
+
import { calculateItemRange as l } from "../pagination.utils.js";
|
|
3
|
+
import { PAGINATION_LABELS as r, PAGINATION_CSS_CLASSES as s } from "../pagination.const.js";
|
|
4
|
+
const d = ({
|
|
5
5
|
showTotal: o,
|
|
6
6
|
totalItems: n,
|
|
7
7
|
currentPage: i,
|
|
8
|
-
itemsPerPage:
|
|
8
|
+
itemsPerPage: f
|
|
9
9
|
}) => {
|
|
10
|
-
if (!o ||
|
|
11
|
-
const { start:
|
|
12
|
-
return /* @__PURE__ */
|
|
10
|
+
if (!o || n === void 0 || n === null) return null;
|
|
11
|
+
const { start: a, end: e } = l(i, f, n);
|
|
12
|
+
return /* @__PURE__ */ c("div", { className: s.info, children: [
|
|
13
13
|
r.showing,
|
|
14
14
|
" ",
|
|
15
|
-
|
|
15
|
+
a,
|
|
16
16
|
"-",
|
|
17
|
-
|
|
17
|
+
e,
|
|
18
18
|
" ",
|
|
19
19
|
r.of,
|
|
20
20
|
" ",
|
|
@@ -22,6 +22,6 @@ const l = ({
|
|
|
22
22
|
] });
|
|
23
23
|
};
|
|
24
24
|
export {
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
d as PaginationInfo,
|
|
26
|
+
d as default
|
|
27
27
|
};
|
|
@@ -9,7 +9,7 @@ export declare const PAGINATION_CSS_CLASSES: {
|
|
|
9
9
|
readonly buttonActive: "bg-blue-600 text-white border-blue-600 hover:bg-blue-700";
|
|
10
10
|
readonly buttonIcon: "flex items-center justify-center w-8 h-8 text-sm rounded border border-gray-300 bg-white hover:bg-gray-50 disabled:bg-gray-100 disabled:text-gray-400 disabled:cursor-not-allowed transition-colors";
|
|
11
11
|
readonly ellipsis: "flex items-center justify-center w-8 h-8 text-gray-400";
|
|
12
|
-
readonly info: "leading-none-sm text-text-neutral-secondary";
|
|
12
|
+
readonly info: "leading-none-medium-sm text-text-neutral-secondary";
|
|
13
13
|
readonly jumper: "flex items-center gap-2 text-sm text-text-neutral-primary";
|
|
14
14
|
readonly input: "w-16 px-2 py-1 text-sm h-6 border border-gray-300 rounded focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent";
|
|
15
15
|
};
|
|
@@ -2,7 +2,7 @@ const e = {
|
|
|
2
2
|
MAX_VISIBLE_PAGES: 6
|
|
3
3
|
}, t = {
|
|
4
4
|
ellipsis: "flex items-center justify-center w-8 h-8 text-gray-400",
|
|
5
|
-
info: "leading-none-sm text-text-neutral-secondary",
|
|
5
|
+
info: "leading-none-medium-sm text-text-neutral-secondary",
|
|
6
6
|
jumper: "flex items-center gap-2 text-sm text-text-neutral-primary",
|
|
7
7
|
input: "w-16 px-2 py-1 text-sm h-6 border border-gray-300 rounded focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent"
|
|
8
8
|
}, o = {
|
|
@@ -1,106 +1,106 @@
|
|
|
1
|
-
import { jsxs as
|
|
1
|
+
import { jsxs as I, jsx as e } from "react/jsx-runtime";
|
|
2
2
|
import { usePagination as A } from "./pagination.hook.js";
|
|
3
3
|
import { PAGINATION_LABELS as o, PAGINATION_DEFAULTS as C, PAGINATION_CSS_CLASSES as S } from "./pagination.const.js";
|
|
4
|
-
import { Button as
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
4
|
+
import { Button as d } from "../../../button/button.js";
|
|
5
|
+
import y from "../../../assets/icons/chevron-left.js";
|
|
6
|
+
import E from "../../../assets/icons/chevron-right.js";
|
|
7
|
+
import k from "../../../assets/icons/double-chevron-left.js";
|
|
8
8
|
import L from "../../../assets/icons/double-chevron-right.js";
|
|
9
9
|
import "react";
|
|
10
10
|
import { cn as _ } from "../../../../lib/utils.js";
|
|
11
11
|
const p = () => /* @__PURE__ */ e("span", { className: S.ellipsis, children: "..." }), $ = ({
|
|
12
12
|
currentPage: t,
|
|
13
|
-
totalPage:
|
|
14
|
-
onChange:
|
|
15
|
-
disabled:
|
|
13
|
+
totalPage: r,
|
|
14
|
+
onChange: b,
|
|
15
|
+
disabled: l = !1
|
|
16
16
|
}) => {
|
|
17
|
-
const { visiblePages:
|
|
17
|
+
const { visiblePages: m, hasEllipsisStart: x, hasEllipsisEnd: N } = A({
|
|
18
18
|
currentPage: t,
|
|
19
|
-
totalPage:
|
|
19
|
+
totalPage: r,
|
|
20
20
|
maxVisiblePages: C.MAX_VISIBLE_PAGES
|
|
21
21
|
});
|
|
22
|
-
if (
|
|
22
|
+
if (r <= 1)
|
|
23
23
|
return null;
|
|
24
|
-
const c = t === 1, f = t ===
|
|
25
|
-
!
|
|
26
|
-
},
|
|
24
|
+
const c = t === 1, f = t === r, n = (s) => {
|
|
25
|
+
!l && s !== t && s >= 1 && s <= r && b(s);
|
|
26
|
+
}, v = () => {
|
|
27
27
|
const s = [];
|
|
28
28
|
let u = !1, h = !1;
|
|
29
|
-
return
|
|
30
|
-
|
|
31
|
-
const
|
|
29
|
+
return m.forEach((a, z) => {
|
|
30
|
+
x && a === m[1] && !u && (s.push(/* @__PURE__ */ e(p, {}, "ellipsis-start")), u = !0);
|
|
31
|
+
const i = a === t;
|
|
32
32
|
s.push(
|
|
33
33
|
/* @__PURE__ */ e(
|
|
34
|
-
|
|
34
|
+
d,
|
|
35
35
|
{
|
|
36
|
-
onClick: () =>
|
|
36
|
+
onClick: () => n(a),
|
|
37
37
|
variant: "stroke",
|
|
38
|
-
shade:
|
|
38
|
+
shade: i ? "brand" : "neutral",
|
|
39
39
|
size: "small",
|
|
40
40
|
"aria-label": `${o.page} ${a}`,
|
|
41
|
-
"aria-current":
|
|
41
|
+
"aria-current": i ? "page" : void 0,
|
|
42
42
|
className: _(
|
|
43
|
-
"text-text-neutral-secondary",
|
|
44
|
-
|
|
43
|
+
"text-text-neutral-secondary hover:bg-button-secondary-surface-pressed",
|
|
44
|
+
i && "border border-button-primary-brand-surface-default text-text-neutral-primary bg-button-secondary-surface-pressed "
|
|
45
45
|
),
|
|
46
46
|
style: {
|
|
47
|
-
borderStyle:
|
|
48
|
-
boxShadow:
|
|
47
|
+
borderStyle: i ? "solid" : "none",
|
|
48
|
+
boxShadow: i ? "none" : ""
|
|
49
49
|
},
|
|
50
50
|
leftIcon: /* @__PURE__ */ e("span", { className: "leading-none-medium-sm", children: a })
|
|
51
51
|
},
|
|
52
52
|
a
|
|
53
53
|
)
|
|
54
|
-
), N && a ===
|
|
54
|
+
), N && a === m[m.length - 2] && !h && (s.push(/* @__PURE__ */ e(p, {}, "ellipsis-end")), h = !0);
|
|
55
55
|
}), s;
|
|
56
56
|
};
|
|
57
|
-
return /* @__PURE__ */
|
|
57
|
+
return /* @__PURE__ */ I("div", { className: "flex gap-1.5 items-center", children: [
|
|
58
58
|
/* @__PURE__ */ e(
|
|
59
|
-
|
|
59
|
+
d,
|
|
60
60
|
{
|
|
61
61
|
"aria-label": o.first,
|
|
62
|
-
onClick: () =>
|
|
63
|
-
disabled:
|
|
62
|
+
onClick: () => n(1),
|
|
63
|
+
disabled: l || c,
|
|
64
64
|
variant: "stroke",
|
|
65
65
|
shade: "neutral",
|
|
66
66
|
size: "small",
|
|
67
67
|
className: "text-text-neutral-secondary",
|
|
68
|
-
leftIcon: /* @__PURE__ */ e(
|
|
68
|
+
leftIcon: /* @__PURE__ */ e(k, {})
|
|
69
69
|
}
|
|
70
70
|
),
|
|
71
71
|
/* @__PURE__ */ e(
|
|
72
|
-
|
|
72
|
+
d,
|
|
73
73
|
{
|
|
74
74
|
"aria-label": o.previous,
|
|
75
|
-
onClick: () =>
|
|
76
|
-
disabled:
|
|
75
|
+
onClick: () => n(t - 1),
|
|
76
|
+
disabled: l || c,
|
|
77
77
|
variant: "stroke",
|
|
78
78
|
shade: "neutral",
|
|
79
79
|
size: "small",
|
|
80
80
|
className: "text-text-neutral-secondary",
|
|
81
|
-
leftIcon: /* @__PURE__ */ e(
|
|
81
|
+
leftIcon: /* @__PURE__ */ e(y, {})
|
|
82
82
|
}
|
|
83
83
|
),
|
|
84
|
-
|
|
84
|
+
v(),
|
|
85
85
|
/* @__PURE__ */ e(
|
|
86
|
-
|
|
86
|
+
d,
|
|
87
87
|
{
|
|
88
88
|
"aria-label": o.next,
|
|
89
|
-
onClick: () =>
|
|
90
|
-
disabled:
|
|
89
|
+
onClick: () => n(t + 1),
|
|
90
|
+
disabled: l || f,
|
|
91
91
|
variant: "stroke",
|
|
92
92
|
shade: "neutral",
|
|
93
93
|
size: "small",
|
|
94
94
|
className: "text-text-neutral-secondary",
|
|
95
|
-
leftIcon: /* @__PURE__ */ e(
|
|
95
|
+
leftIcon: /* @__PURE__ */ e(E, {})
|
|
96
96
|
}
|
|
97
97
|
),
|
|
98
98
|
/* @__PURE__ */ e(
|
|
99
|
-
|
|
99
|
+
d,
|
|
100
100
|
{
|
|
101
101
|
"aria-label": o.last,
|
|
102
|
-
onClick: () =>
|
|
103
|
-
disabled:
|
|
102
|
+
onClick: () => n(r),
|
|
103
|
+
disabled: l || f,
|
|
104
104
|
variant: "stroke",
|
|
105
105
|
shade: "neutral",
|
|
106
106
|
size: "small",
|
|
@@ -1,35 +1,37 @@
|
|
|
1
|
-
import { PAGINATION_DEFAULTS as
|
|
1
|
+
import { PAGINATION_DEFAULTS as d } from "./pagination.const.js";
|
|
2
2
|
const M = ({
|
|
3
3
|
currentPage: i,
|
|
4
4
|
totalPage: s,
|
|
5
|
-
maxVisiblePages: n =
|
|
5
|
+
maxVisiblePages: n = d.MAX_VISIBLE_PAGES
|
|
6
6
|
}) => {
|
|
7
7
|
if (s <= n)
|
|
8
8
|
return {
|
|
9
|
-
visiblePages: Array.from({ length: s }, (f,
|
|
9
|
+
visiblePages: Array.from({ length: s }, (f, u) => u + 1),
|
|
10
10
|
hasEllipsisStart: !1,
|
|
11
11
|
hasEllipsisEnd: !1
|
|
12
12
|
};
|
|
13
|
-
const
|
|
14
|
-
let
|
|
15
|
-
i <=
|
|
13
|
+
const r = Math.floor((n - 3) / 2);
|
|
14
|
+
let h = Math.max(2, i - r), t = Math.min(s - 1, i + r);
|
|
15
|
+
i <= r + 2 && (t = Math.min(s - 1, n - 2), h = 2), i >= s - r - 1 && (h = Math.max(2, s - n + 3), t = s - 1);
|
|
16
16
|
const c = [];
|
|
17
17
|
s > 0 && c.push(1);
|
|
18
|
-
const
|
|
19
|
-
for (let f =
|
|
18
|
+
const E = h > 2;
|
|
19
|
+
for (let f = h; f <= t; f++)
|
|
20
20
|
f !== 1 && f !== s && c.push(f);
|
|
21
|
-
const
|
|
21
|
+
const l = t < s - 1;
|
|
22
22
|
return s > 1 && c.push(s), {
|
|
23
23
|
visiblePages: c,
|
|
24
|
-
hasEllipsisStart:
|
|
25
|
-
hasEllipsisEnd:
|
|
24
|
+
hasEllipsisStart: E,
|
|
25
|
+
hasEllipsisEnd: l
|
|
26
26
|
};
|
|
27
|
-
},
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
}, m = (i, s, n) => {
|
|
28
|
+
if (n === 0)
|
|
29
|
+
return { start: 0, end: 0 };
|
|
30
|
+
const r = (i - 1) * s + 1, h = Math.min(i * s, n);
|
|
31
|
+
return { start: r, end: h };
|
|
30
32
|
}, A = (i, s) => i >= 1 && i <= s && Number.isInteger(i);
|
|
31
33
|
export {
|
|
32
|
-
|
|
34
|
+
m as calculateItemRange,
|
|
33
35
|
M as calculateVisiblePages,
|
|
34
36
|
A as isValidPageNumber
|
|
35
37
|
};
|
|
@@ -1,8 +1,13 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
|
|
1
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import "react";
|
|
3
|
+
import { cn as a } from "../../../lib/utils.js";
|
|
4
|
+
const l = ({ children: e, className: t = "" }) => /* @__PURE__ */ r(
|
|
3
5
|
"div",
|
|
4
6
|
{
|
|
5
|
-
className:
|
|
7
|
+
className: a(
|
|
8
|
+
"flex justify-between items-center bg-neutral-surface-default gap-3 p-2 pl-4",
|
|
9
|
+
t
|
|
10
|
+
),
|
|
6
11
|
children: e
|
|
7
12
|
}
|
|
8
13
|
);
|
|
@@ -0,0 +1,3 @@
|
|
|
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: 'text',\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={{ cellHeight: 'small', hasBorder: true }}\n />\n {/* Table body goes here */}\n </table>\n </Table>\n );\n}";
|
|
3
|
+
export declare const BasicHeader: StoryObj;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { StoryObj } from '@storybook/react';
|
|
2
|
+
export declare const customHeaderUsageCode = "import { TableHeaderWrapper, TableHeaderContent } from '@/components/table';\n\nfunction CustomHeader() {\n return (\n <TableHeaderWrapper>\n <tr>\n <TableHeaderContent className=\"font-bold text-blue-600\">\n Custom Header 1\n </TableHeaderContent>\n <TableHeaderContent className=\"font-bold text-green-600\">\n Custom Header 2\n </TableHeaderContent>\n </tr>\n </TableHeaderWrapper>\n );\n}";
|
|
3
|
+
export declare const CustomHeaderContent: StoryObj;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { StoryObj } from '@storybook/react';
|
|
2
|
+
export declare const sortingUsageCode = "import { useState } from 'react';\nimport { Table, TableHeader } from '@/components/table';\nimport { SortColumn } from '@/components/table/table.type';\n\nfunction SortableTable() {\n const [sortedColumns, setSortedColumns] = useState<SortColumn[]>([]);\n\n const handleSort = (field: string, direction: 'asc' | 'desc' | null) => {\n setSortedColumns(prev => {\n if (direction === null) {\n return prev.filter(col => col.field !== field);\n }\n const exists = prev.find(col => col.field === field);\n if (exists) {\n return prev.map(col => \n col.field === field ? { ...col, direction } : col\n );\n }\n return [...prev, { field, direction }];\n });\n };\n\n return (\n <Table dataSource={data} schema={schema}>\n <table className=\"w-full\">\n <TableHeader \n schema={schema}\n sort={{\n sortedColumns,\n onSort: handleSort,\n }}\n cell={{ cellHeight: 'small', hasBorder: true }}\n />\n {/* Table body goes here */}\n </table>\n </Table>\n );\n}";
|
|
3
|
+
export declare const HeaderWithSorting: StoryObj;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Meta } from '@storybook/react';
|
|
2
|
+
import { TableHeaderWrapper } from '../index';
|
|
3
|
+
declare const meta: Meta<typeof TableHeaderWrapper>;
|
|
4
|
+
export default meta;
|
|
5
|
+
export { BasicHeader } from './stories/basic-header';
|
|
6
|
+
export { HeaderWithSorting } from './stories/header-for-sorting';
|
|
@@ -1,15 +1,11 @@
|
|
|
1
1
|
import { jsx as t } from "react/jsx-runtime";
|
|
2
|
-
|
|
2
|
+
import "react";
|
|
3
|
+
import { cn as a } from "../../../lib/utils.js";
|
|
4
|
+
const s = ({
|
|
3
5
|
children: e,
|
|
4
6
|
className: r = ""
|
|
5
|
-
}) => /* @__PURE__ */ t(
|
|
6
|
-
"div",
|
|
7
|
-
{
|
|
8
|
-
className: `p-3 gap-3 flex justify-between items-center border-stroke-solid-medium border-1 border-b-0 rounded-t-xl ${r}`,
|
|
9
|
-
children: e
|
|
10
|
-
}
|
|
11
|
-
);
|
|
7
|
+
}) => /* @__PURE__ */ t("div", { className: a("p-3 gap-3 flex justify-between items-center", r), children: e });
|
|
12
8
|
export {
|
|
13
|
-
|
|
14
|
-
|
|
9
|
+
s as TableHeaderWrapper,
|
|
10
|
+
s as default
|
|
15
11
|
};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { jsx as e } from "react/jsx-runtime";
|
|
2
|
-
import { Input as
|
|
3
|
-
import { MagnifierIcon as
|
|
2
|
+
import { Input as p } from "../../../input/input.js";
|
|
3
|
+
import { MagnifierIcon as c } from "../../../assets/icons/magnifier-icon.js";
|
|
4
4
|
const h = ({ search: r, className: o = "" }) => {
|
|
5
5
|
const { value: t, onChange: a, placeholder: n = "Search by Item Number or Description" } = r;
|
|
6
6
|
return /* @__PURE__ */ e(
|
|
7
|
-
|
|
7
|
+
p,
|
|
8
8
|
{
|
|
9
9
|
size: "small",
|
|
10
|
-
leftIcon: /* @__PURE__ */ e(
|
|
10
|
+
leftIcon: /* @__PURE__ */ e(c, { className: "w-[14px] h-[14px]" }),
|
|
11
11
|
placeholder: n,
|
|
12
12
|
value: t,
|
|
13
13
|
onChange: (m) => a(m.target.value),
|