@ztwoint/z-ui 0.1.39 → 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.
Files changed (34) hide show
  1. package/dist/components/assets/icons/chevron-right.d.ts +1 -2
  2. package/dist/components/assets/icons/chevron-right.js +13 -27
  3. package/dist/components/badge/badge.js +121 -0
  4. package/dist/components/button/button.js +9 -9
  5. package/dist/components/file-upload-area/file-upload-area.js +2 -2
  6. package/dist/components/table/components/pagination/components/pagination-info.js +12 -12
  7. package/dist/components/table/components/pagination/pagination.const.d.ts +1 -1
  8. package/dist/components/table/components/pagination/pagination.const.js +1 -1
  9. package/dist/components/table/components/pagination/pagination.js +43 -43
  10. package/dist/components/table/components/pagination/pagination.utils.js +17 -15
  11. package/dist/components/table/components/table-footer.js +8 -3
  12. package/dist/components/table/components/table-header/stories/basic-header.d.ts +3 -0
  13. package/dist/components/table/components/table-header/stories/custom-header-content.d.ts +3 -0
  14. package/dist/components/table/components/table-header/stories/header-for-sorting.d.ts +3 -0
  15. package/dist/components/table/components/table-header/table-header.storiesOld.d.ts +6 -0
  16. package/dist/components/table/components/table-header-wrapper.js +6 -10
  17. package/dist/components/table/components/table-search/table-search.js +4 -4
  18. package/dist/components/table-card/table-card.js +118 -92
  19. package/dist/components/table-card/table-card.type.d.ts +7 -1
  20. package/dist/css/config/components/button.css +8 -0
  21. package/dist/css/config/components/file-upload-area.css +11 -0
  22. package/dist/css/config/components/index.css +1 -0
  23. package/dist/css/styles/tailwind.css +1 -1
  24. package/dist/index.d.ts +1 -0
  25. package/dist/index.js +48 -45
  26. package/dist/types/components/assets/icons/chevron-right.d.ts +1 -2
  27. package/dist/types/components/table/components/pagination/pagination.const.d.ts +1 -1
  28. package/dist/types/components/table/components/table-header/stories/basic-header.d.ts +3 -0
  29. package/dist/types/components/table/components/table-header/stories/custom-header-content.d.ts +3 -0
  30. package/dist/types/components/table/components/table-header/stories/header-for-sorting.d.ts +3 -0
  31. package/dist/types/components/table/components/table-header/table-header.storiesOld.d.ts +6 -0
  32. package/dist/types/components/table-card/table-card.type.d.ts +7 -1
  33. package/dist/types/index.d.ts +1 -0
  34. 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, secondaryfill: _secondaryfill, strokewidth: _strokewidth, width, height, ...props }: IconProps): import("react/jsx-runtime").JSX.Element;
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 t } from "react/jsx-runtime";
2
- function h({
3
- fill: o = "#5D5D5D",
4
- secondaryfill: n,
5
- strokewidth: s = 1,
6
- width: r = "14",
7
- height: e = "14",
8
- ...i
9
- }) {
10
- return /* @__PURE__ */ t(
11
- "svg",
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
- h as default
15
+ i as default
30
16
  };
@@ -0,0 +1,121 @@
1
+ import { jsx as i } from "react/jsx-runtime";
2
+ import { Slot as n } from "@radix-ui/react-slot";
3
+ import { cva as c } from "class-variance-authority";
4
+ import "react";
5
+ import { cn as u } from "../../lib/utils.js";
6
+ const l = c(
7
+ "inline-flex rounded-lg items-center justify-center border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden",
8
+ {
9
+ variants: {
10
+ variant: {
11
+ default: "border-transparent",
12
+ destructive: "border-transparent",
13
+ outline: ""
14
+ },
15
+ size: {
16
+ default: "px-[8px] py-[3px] text-sm",
17
+ xs: "px-[4px] py-[1px] text-[10px]",
18
+ sm: "px-[6px] py-[2px] text-xs",
19
+ lg: "px-[10px] py-[4px] text-base"
20
+ },
21
+ color: {
22
+ default: "",
23
+ primary: "surface-neutral-default text-default-brand [a&]:hover:surface-neutral-hover",
24
+ destructive: "surface-danger-default text-inverted-primary [a&]:hover:surface-danger-hover",
25
+ success: "surface-success-default text-inverted-primary [a&]:hover:surface-success-hover",
26
+ warning: "surface-warning-default text-inverted-primary [a&]:hover:surface-warning-hover"
27
+ }
28
+ },
29
+ compoundVariants: [
30
+ // Default variant with different colors
31
+ {
32
+ variant: "default",
33
+ color: "default",
34
+ class: "surface-neutral-hover [a&]:hover:surface-neutral-hover"
35
+ },
36
+ {
37
+ variant: "default",
38
+ color: "primary",
39
+ class: "surface-primary-light text-default-brand [a&]:hover:surface-neutral-hover"
40
+ },
41
+ {
42
+ variant: "default",
43
+ color: "destructive",
44
+ class: "surface-danger-light text-danger-secondary [a&]:hover:surface-danger-hover"
45
+ },
46
+ {
47
+ variant: "default",
48
+ color: "success",
49
+ class: "surface-success-light text-success-secondary [a&]:hover:surface-success-hover"
50
+ },
51
+ {
52
+ variant: "default",
53
+ color: "warning",
54
+ class: "surface-warning-light text-warning-secondary [a&]:hover:surface-warning-hover"
55
+ },
56
+ // Destructive variant with different colors
57
+ {
58
+ variant: "destructive",
59
+ color: "default",
60
+ class: "surface-neutral-primary text-inverted-primary [a&]:hover:surface-neutral-hover"
61
+ },
62
+ {
63
+ variant: "destructive",
64
+ color: "primary",
65
+ class: "surface-primary-default text-inverted-primary [a&]:hover:surface-primary-hover"
66
+ },
67
+ // Outline variant with different colors
68
+ {
69
+ variant: "outline",
70
+ color: "default",
71
+ class: "surface-neutral-default text-neutral-primary border-stroke-solid-high [a&]:hover:surface-neutral-hover"
72
+ },
73
+ {
74
+ variant: "outline",
75
+ color: "primary",
76
+ class: "surface-primary-light text-default-brand border-stroke-inverted-active [a&]:hover:surface-neutral-hover"
77
+ },
78
+ {
79
+ variant: "outline",
80
+ color: "destructive",
81
+ class: "surface-danger-light text-danger-secondary border border-red-200 [a&]:hover:surface-danger-light-hover"
82
+ },
83
+ {
84
+ variant: "outline",
85
+ color: "success",
86
+ class: "surface-success-light text-success-secondary border border-green-200 [a&]:hover:surface-success-light-hover"
87
+ },
88
+ {
89
+ variant: "outline",
90
+ color: "warning",
91
+ class: "surface-warning-light text-warning-secondary border border-amber-200 [a&]:hover:surface-warning-light-hover"
92
+ }
93
+ ],
94
+ defaultVariants: {
95
+ variant: "default",
96
+ size: "default",
97
+ color: "default"
98
+ }
99
+ }
100
+ );
101
+ function x({
102
+ className: r,
103
+ variant: e,
104
+ size: a,
105
+ color: t,
106
+ asChild: s = !1,
107
+ ...o
108
+ }) {
109
+ return /* @__PURE__ */ i(
110
+ s ? n : "span",
111
+ {
112
+ "data-slot": "badge",
113
+ className: u(l({ variant: e, size: a, color: t }), r),
114
+ ...o
115
+ }
116
+ );
117
+ }
118
+ export {
119
+ x as Badge,
120
+ l as badgeVariants
121
+ };
@@ -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 O } from "@radix-ui/react-slot";
4
- import { cva as z } from "class-variance-authority";
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 k = z(
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 ? O : "button", r = m || u, n = !r && !!(t || a), l = n ? t || a : null, g = d(
102
- k({ shade: b, size: c, variant: x, iconOnly: n }),
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
- k as buttonVariants
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-2xl border-[.5px] border-dashed stroke-solid-high bg-neutral-light",
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 t } from "react/jsx-runtime";
2
- import { calculateItemRange as s } from "../pagination.utils.js";
3
- import { PAGINATION_LABELS as r, PAGINATION_CSS_CLASSES as c } from "../pagination.const.js";
4
- const l = ({
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: a
8
+ itemsPerPage: f
9
9
  }) => {
10
- if (!o || !n) return null;
11
- const { start: e, end: f } = s(i, a, n);
12
- return /* @__PURE__ */ t("div", { className: c.info, children: [
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
- e,
15
+ a,
16
16
  "-",
17
- f,
17
+ e,
18
18
  " ",
19
19
  r.of,
20
20
  " ",
@@ -22,6 +22,6 @@ const l = ({
22
22
  ] });
23
23
  };
24
24
  export {
25
- l as PaginationInfo,
26
- l as default
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 v, jsx as e } from "react/jsx-runtime";
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 m } from "../../../button/button.js";
5
- import E from "../../../assets/icons/chevron-left.js";
6
- import k from "../../../assets/icons/chevron-right.js";
7
- import y from "../../../assets/icons/double-chevron-left.js";
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: l,
14
- onChange: x,
15
- disabled: r = !1
13
+ totalPage: r,
14
+ onChange: b,
15
+ disabled: l = !1
16
16
  }) => {
17
- const { visiblePages: d, hasEllipsisStart: b, hasEllipsisEnd: N } = A({
17
+ const { visiblePages: m, hasEllipsisStart: x, hasEllipsisEnd: N } = A({
18
18
  currentPage: t,
19
- totalPage: l,
19
+ totalPage: r,
20
20
  maxVisiblePages: C.MAX_VISIBLE_PAGES
21
21
  });
22
- if (l <= 1)
22
+ if (r <= 1)
23
23
  return null;
24
- const c = t === 1, f = t === l, i = (s) => {
25
- !r && s !== t && s >= 1 && s <= l && x(s);
26
- }, I = () => {
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 d.forEach((a, z) => {
30
- b && a === d[1] && !u && (s.push(/* @__PURE__ */ e(p, {}, "ellipsis-start")), u = !0);
31
- const n = a === t;
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
- m,
34
+ d,
35
35
  {
36
- onClick: () => i(a),
36
+ onClick: () => n(a),
37
37
  variant: "stroke",
38
- shade: n ? "brand" : "neutral",
38
+ shade: i ? "brand" : "neutral",
39
39
  size: "small",
40
40
  "aria-label": `${o.page} ${a}`,
41
- "aria-current": n ? "page" : void 0,
41
+ "aria-current": i ? "page" : void 0,
42
42
  className: _(
43
- "text-text-neutral-secondary",
44
- n && "border border-button-primary-brand-surface-default text-text-neutral-primary"
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: n ? "solid" : "none",
48
- boxShadow: n ? "none" : ""
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 === d[d.length - 2] && !h && (s.push(/* @__PURE__ */ e(p, {}, "ellipsis-end")), h = !0);
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__ */ v("div", { className: "flex gap-1.5 items-center", children: [
57
+ return /* @__PURE__ */ I("div", { className: "flex gap-1.5 items-center", children: [
58
58
  /* @__PURE__ */ e(
59
- m,
59
+ d,
60
60
  {
61
61
  "aria-label": o.first,
62
- onClick: () => i(1),
63
- disabled: r || c,
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(y, {})
68
+ leftIcon: /* @__PURE__ */ e(k, {})
69
69
  }
70
70
  ),
71
71
  /* @__PURE__ */ e(
72
- m,
72
+ d,
73
73
  {
74
74
  "aria-label": o.previous,
75
- onClick: () => i(t - 1),
76
- disabled: r || c,
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(E, {})
81
+ leftIcon: /* @__PURE__ */ e(y, {})
82
82
  }
83
83
  ),
84
- I(),
84
+ v(),
85
85
  /* @__PURE__ */ e(
86
- m,
86
+ d,
87
87
  {
88
88
  "aria-label": o.next,
89
- onClick: () => i(t + 1),
90
- disabled: r || f,
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(k, {})
95
+ leftIcon: /* @__PURE__ */ e(E, {})
96
96
  }
97
97
  ),
98
98
  /* @__PURE__ */ e(
99
- m,
99
+ d,
100
100
  {
101
101
  "aria-label": o.last,
102
- onClick: () => i(l),
103
- disabled: r || f,
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 p } from "./pagination.const.js";
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 = p.MAX_VISIBLE_PAGES
5
+ maxVisiblePages: n = d.MAX_VISIBLE_PAGES
6
6
  }) => {
7
7
  if (s <= n)
8
8
  return {
9
- visiblePages: Array.from({ length: s }, (f, m) => m + 1),
9
+ visiblePages: Array.from({ length: s }, (f, u) => u + 1),
10
10
  hasEllipsisStart: !1,
11
11
  hasEllipsisEnd: !1
12
12
  };
13
- const h = Math.floor((n - 3) / 2);
14
- let r = Math.max(2, i - h), t = Math.min(s - 1, i + h);
15
- i <= h + 2 && (t = Math.min(s - 1, n - 2), r = 2), i >= s - h - 1 && (r = Math.max(2, s - n + 3), t = s - 1);
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 l = r > 2;
19
- for (let f = r; f <= t; 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 E = t < s - 1;
21
+ const l = t < s - 1;
22
22
  return s > 1 && c.push(s), {
23
23
  visiblePages: c,
24
- hasEllipsisStart: l,
25
- hasEllipsisEnd: E
24
+ hasEllipsisStart: E,
25
+ hasEllipsisEnd: l
26
26
  };
27
- }, d = (i, s, n) => {
28
- const h = (i - 1) * s + 1, r = Math.min(i * s, n);
29
- return { start: h, end: r };
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
- d as calculateItemRange,
34
+ m as calculateItemRange,
33
35
  M as calculateVisiblePages,
34
36
  A as isValidPageNumber
35
37
  };
@@ -1,8 +1,13 @@
1
- import { jsx as t } from "react/jsx-runtime";
2
- const l = ({ children: e, className: r = "" }) => /* @__PURE__ */ t(
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: `flex justify-between items-center bg-neutral-surface-default border-stroke-solid-light border border-t-[0.5px] gap-3 p-2 pl-4 rounded-b-xl ${r} `,
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
- const o = ({
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
- o as TableHeaderWrapper,
14
- o as default
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 c } from "../../../input/input.js";
3
- import { MagnifierIcon as l } from "../../../assets/icons/magnifier-icon.js";
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
- c,
7
+ p,
8
8
  {
9
9
  size: "small",
10
- leftIcon: /* @__PURE__ */ e(l, { className: "w-4 h-4" }),
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),