@ztwoint/z-ui 0.1.26 → 0.1.28

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 (189) hide show
  1. package/dist/components/assets/icons/chevron-left.d.ts +7 -0
  2. package/dist/components/assets/icons/chevron-left.js +20 -0
  3. package/dist/components/assets/icons/chevron-right.js +30 -0
  4. package/dist/components/assets/icons/circle-check.js +32 -0
  5. package/dist/components/assets/icons/double-chevron-left.d.ts +7 -0
  6. package/dist/components/assets/icons/double-chevron-left.js +24 -0
  7. package/dist/components/assets/icons/double-chevron-right.d.ts +7 -0
  8. package/dist/components/assets/icons/double-chevron-right.js +24 -0
  9. package/dist/components/assets/icons/info-icon.js +16 -0
  10. package/dist/components/assets/icons/magnifier-icon.js +16 -0
  11. package/dist/components/assets/icons/sub-nav-indicator.d.ts +3 -2
  12. package/dist/components/assets/icons/sub-nav-indicator.js +26 -41
  13. package/dist/components/button/button.d.ts +1 -1
  14. package/dist/components/button/button.js +45 -30
  15. package/dist/components/collapsible-side-nav-bar/side-nav-bar-content.js +16 -16
  16. package/dist/components/collapsible-side-nav-bar/side-nav-bar-footer.js +1 -1
  17. package/dist/components/collapsible-side-nav-bar/side-nav-bar-group.js +24 -16
  18. package/dist/components/collapsible-side-nav-bar/side-nav-bar-header.js +60 -54
  19. package/dist/components/collapsible-side-nav-bar/side-nav-bar-item.js +61 -62
  20. package/dist/components/collapsible-side-nav-bar/side-nav-bar-provider.js +23 -23
  21. package/dist/components/collapsible-side-nav-bar/side-nav-bar.d.ts +1 -1
  22. package/dist/components/collapsible-side-nav-bar/side-nav-bar.js +14 -14
  23. package/dist/components/dialog/dialog.js +1 -1
  24. package/dist/components/dropdown/helpers/hover-card.js +34 -0
  25. package/dist/components/dropdown/z2-dropdown.d.ts +1 -1
  26. package/dist/components/dropdown/z2-dropdown.js +245 -0
  27. package/dist/components/dropdown-menu/z2-dropdown-menu.js +255 -0
  28. package/dist/components/nav-header/nav-header.js +7 -7
  29. package/dist/components/table/components/cell/boolean-cell.d.ts +7 -0
  30. package/dist/components/table/components/cell/boolean-cell.js +7 -0
  31. package/dist/components/table/components/cell/index.d.ts +3 -0
  32. package/dist/components/table/components/cell/number-cell.d.ts +7 -0
  33. package/dist/components/table/components/cell/number-cell.js +5 -0
  34. package/dist/components/table/components/cell/text-cell.d.ts +7 -0
  35. package/dist/components/table/components/cell/text-cell.js +5 -0
  36. package/dist/components/table/components/index.d.ts +11 -0
  37. package/dist/components/table/components/pagination/components/index.d.ts +3 -0
  38. package/dist/components/table/components/pagination/components/pagination-info.d.ts +4 -0
  39. package/dist/components/table/components/pagination/components/pagination-info.js +27 -0
  40. package/dist/components/table/components/pagination/components/pagination-quick-jumper.d.ts +4 -0
  41. package/dist/components/table/components/pagination/components/pagination-quick-jumper.hook.d.ts +6 -0
  42. package/dist/components/table/components/pagination/components/pagination-quick-jumper.hook.js +24 -0
  43. package/dist/components/table/components/pagination/components/pagination-quick-jumper.js +35 -0
  44. package/dist/components/table/components/pagination/index.d.ts +6 -0
  45. package/dist/components/table/components/pagination/pagination.const.d.ts +26 -0
  46. package/dist/components/table/components/pagination/pagination.const.js +22 -0
  47. package/dist/components/table/components/pagination/pagination.d.ts +4 -0
  48. package/dist/components/table/components/pagination/pagination.hook.d.ts +5 -0
  49. package/dist/components/table/components/pagination/pagination.hook.js +22 -0
  50. package/dist/components/table/components/pagination/pagination.js +112 -0
  51. package/dist/components/table/components/pagination/pagination.type.d.ts +33 -0
  52. package/dist/components/table/components/pagination/pagination.utils.d.ts +7 -0
  53. package/dist/components/table/components/pagination/pagination.utils.js +35 -0
  54. package/dist/components/table/components/table-cell.d.ts +15 -0
  55. package/dist/components/table/components/table-cell.js +45 -0
  56. package/dist/components/table/components/table-empty-state.d.ts +7 -0
  57. package/dist/components/table/components/table-empty-state.js +6 -0
  58. package/dist/components/table/components/table-filter/filters/boolean.d.ts +3 -0
  59. package/dist/components/table/components/table-filter/filters/boolean.js +31 -0
  60. package/dist/components/table/components/table-filter/filters/index.d.ts +3 -0
  61. package/dist/components/table/components/table-filter/filters/number.d.ts +3 -0
  62. package/dist/components/table/components/table-filter/filters/number.js +28 -0
  63. package/dist/components/table/components/table-filter/filters/text.d.ts +3 -0
  64. package/dist/components/table/components/table-filter/filters/text.js +28 -0
  65. package/dist/components/table/components/table-filter/index.d.ts +1 -0
  66. package/dist/components/table/components/table-filter/table-filter.d.ts +9 -0
  67. package/dist/components/table/components/table-filter/table-filter.hook.d.ts +15 -0
  68. package/dist/components/table/components/table-filter/table-filter.hook.js +34 -0
  69. package/dist/components/table/components/table-filter/table-filter.js +105 -0
  70. package/dist/components/table/components/table-filter/table-filter.type.d.ts +18 -0
  71. package/dist/components/table/components/table-footer-content.d.ts +7 -0
  72. package/dist/components/table/components/table-footer-content.js +9 -0
  73. package/dist/components/table/components/table-footer.d.ts +7 -0
  74. package/dist/components/table/components/table-footer.js +6 -0
  75. package/dist/components/table/components/table-header/index.d.ts +2 -0
  76. package/dist/components/table/components/table-header/table-header.d.ts +9 -0
  77. package/dist/components/table/components/table-header/table-header.js +27 -0
  78. package/dist/components/table/components/table-header/table-header.utils.d.ts +5 -0
  79. package/dist/components/table/components/table-header/table-header.utils.js +15 -0
  80. package/dist/components/table/components/table-header/table-sort-icon.d.ts +8 -0
  81. package/dist/components/table/components/table-header/table-sort-icon.js +13 -0
  82. package/dist/components/table/components/table-header-content.d.ts +7 -0
  83. package/dist/components/table/components/table-header-content.js +9 -0
  84. package/dist/components/table/components/table-header-wrapper.d.ts +7 -0
  85. package/dist/components/table/components/table-header-wrapper.js +9 -0
  86. package/dist/components/table/components/table-loading-state.d.ts +7 -0
  87. package/dist/components/table/components/table-loading-state.js +9 -0
  88. package/dist/components/table/components/table-row.d.ts +11 -0
  89. package/dist/components/table/components/table-row.js +23 -0
  90. package/dist/components/table/index.d.ts +9 -0
  91. package/dist/components/table/table-provider.d.ts +26 -0
  92. package/dist/components/table/table-provider.js +45 -0
  93. package/dist/components/table/table.const.d.ts +24 -0
  94. package/dist/components/table/table.const.js +27 -0
  95. package/dist/components/table/table.context.d.ts +7 -0
  96. package/dist/components/table/table.context.js +11 -0
  97. package/dist/components/table/table.d.ts +4 -0
  98. package/dist/components/table/table.js +39 -0
  99. package/dist/components/table/table.type.d.ts +63 -0
  100. package/dist/components/table/table.utils.d.ts +3 -0
  101. package/dist/components/table/table.utils.js +5 -0
  102. package/dist/css/config/colors/components/select.css +15 -0
  103. package/dist/css/config/colors/defaults.css +378 -137
  104. package/dist/css/config/colors/semantic-colors.css +356 -0
  105. package/dist/css/config/components/button.css +152 -0
  106. package/dist/css/config/components/index.css +1 -0
  107. package/dist/css/config/config-deprecated.css +41 -0
  108. package/dist/css/config/config.css +4 -18
  109. package/dist/css/config/typography/2xl.css +7 -0
  110. package/dist/css/config/typography/3xl.css +7 -0
  111. package/dist/css/config/typography/4xl.css +7 -0
  112. package/dist/css/config/typography/base.css +7 -0
  113. package/dist/css/config/typography/lg.css +7 -0
  114. package/dist/css/config/typography/sm.css +7 -0
  115. package/dist/css/config/typography/xl.css +7 -0
  116. package/dist/css/config/typography/xs.css +7 -0
  117. package/dist/css/styles/tailwind.css +1 -1
  118. package/dist/devComponents/navigation/index.d.ts +1 -0
  119. package/dist/devComponents/navigation/navigation.d.ts +1 -0
  120. package/dist/index.d.ts +41 -7
  121. package/dist/index.js +176 -92
  122. package/dist/lib/index.d.ts +3 -0
  123. package/dist/lib/theme.hook.d.ts +8 -0
  124. package/dist/lib/theme.hook.js +50 -0
  125. package/dist/node_modules/@heroicons/react/24/solid/esm/CheckCircleIcon.js +26 -0
  126. package/dist/node_modules/@heroicons/react/24/solid/esm/XCircleIcon.js +26 -0
  127. package/dist/routes/default.d.ts +2 -0
  128. package/dist/routes/index.d.ts +2 -0
  129. package/dist/routes/table.d.ts +2 -0
  130. package/dist/sample/text-cell.d.ts +3 -0
  131. package/dist/types/components/assets/icons/chevron-left.d.ts +7 -0
  132. package/dist/types/components/assets/icons/double-chevron-left.d.ts +7 -0
  133. package/dist/types/components/assets/icons/double-chevron-right.d.ts +7 -0
  134. package/dist/types/components/assets/icons/sub-nav-indicator.d.ts +3 -2
  135. package/dist/types/components/button/button.d.ts +1 -1
  136. package/dist/types/components/collapsible-side-nav-bar/side-nav-bar.d.ts +1 -1
  137. package/dist/types/components/dropdown/z2-dropdown.d.ts +1 -1
  138. package/dist/types/components/table/components/cell/boolean-cell.d.ts +7 -0
  139. package/dist/types/components/table/components/cell/index.d.ts +3 -0
  140. package/dist/types/components/table/components/cell/number-cell.d.ts +7 -0
  141. package/dist/types/components/table/components/cell/text-cell.d.ts +7 -0
  142. package/dist/types/components/table/components/index.d.ts +11 -0
  143. package/dist/types/components/table/components/pagination/components/index.d.ts +3 -0
  144. package/dist/types/components/table/components/pagination/components/pagination-info.d.ts +4 -0
  145. package/dist/types/components/table/components/pagination/components/pagination-quick-jumper.d.ts +4 -0
  146. package/dist/types/components/table/components/pagination/components/pagination-quick-jumper.hook.d.ts +6 -0
  147. package/dist/types/components/table/components/pagination/index.d.ts +6 -0
  148. package/dist/types/components/table/components/pagination/pagination.const.d.ts +26 -0
  149. package/dist/types/components/table/components/pagination/pagination.d.ts +4 -0
  150. package/dist/types/components/table/components/pagination/pagination.hook.d.ts +5 -0
  151. package/dist/types/components/table/components/pagination/pagination.type.d.ts +33 -0
  152. package/dist/types/components/table/components/pagination/pagination.utils.d.ts +7 -0
  153. package/dist/types/components/table/components/table-cell.d.ts +15 -0
  154. package/dist/types/components/table/components/table-empty-state.d.ts +7 -0
  155. package/dist/types/components/table/components/table-filter/filters/boolean.d.ts +3 -0
  156. package/dist/types/components/table/components/table-filter/filters/index.d.ts +3 -0
  157. package/dist/types/components/table/components/table-filter/filters/number.d.ts +3 -0
  158. package/dist/types/components/table/components/table-filter/filters/text.d.ts +3 -0
  159. package/dist/types/components/table/components/table-filter/index.d.ts +1 -0
  160. package/dist/types/components/table/components/table-filter/table-filter.d.ts +9 -0
  161. package/dist/types/components/table/components/table-filter/table-filter.hook.d.ts +15 -0
  162. package/dist/types/components/table/components/table-filter/table-filter.type.d.ts +18 -0
  163. package/dist/types/components/table/components/table-footer-content.d.ts +7 -0
  164. package/dist/types/components/table/components/table-footer.d.ts +7 -0
  165. package/dist/types/components/table/components/table-header/index.d.ts +2 -0
  166. package/dist/types/components/table/components/table-header/table-header.d.ts +10 -0
  167. package/dist/types/components/table/components/table-header/table-header.utils.d.ts +5 -0
  168. package/dist/types/components/table/components/table-header/table-sort-icon.d.ts +8 -0
  169. package/dist/types/components/table/components/table-header-content.d.ts +7 -0
  170. package/dist/types/components/table/components/table-header-wrapper.d.ts +7 -0
  171. package/dist/types/components/table/components/table-loading-state.d.ts +7 -0
  172. package/dist/types/components/table/components/table-row.d.ts +11 -0
  173. package/dist/types/components/table/index.d.ts +9 -0
  174. package/dist/types/components/table/table-provider.d.ts +26 -0
  175. package/dist/types/components/table/table.const.d.ts +24 -0
  176. package/dist/types/components/table/table.context.d.ts +7 -0
  177. package/dist/types/components/table/table.d.ts +4 -0
  178. package/dist/types/components/table/table.type.d.ts +63 -0
  179. package/dist/types/components/table/table.utils.d.ts +3 -0
  180. package/dist/types/devComponents/navigation/index.d.ts +1 -0
  181. package/dist/types/devComponents/navigation/navigation.d.ts +1 -0
  182. package/dist/types/index.d.ts +41 -7
  183. package/dist/types/lib/index.d.ts +3 -0
  184. package/dist/types/lib/theme.hook.d.ts +8 -0
  185. package/dist/types/routes/default.d.ts +2 -0
  186. package/dist/types/routes/index.d.ts +2 -0
  187. package/dist/types/routes/table.d.ts +2 -0
  188. package/dist/types/sample/text-cell.d.ts +3 -0
  189. package/package.json +3 -1
@@ -0,0 +1,35 @@
1
+ import { jsxs as a, jsx as g } from "react/jsx-runtime";
2
+ import { PAGINATION_CSS_CLASSES as n, PAGINATION_LABELS as t } from "../pagination.const.js";
3
+ import { usePaginationQuickJumper as c } from "./pagination-quick-jumper.hook.js";
4
+ const P = ({
5
+ disabled: o,
6
+ currentPage: e,
7
+ totalPage: r,
8
+ onChange: i
9
+ }) => {
10
+ const { inputValue: u, handleInputChange: l, handleInputSubmit: s, handleKeyPress: p } = c(e, r, i);
11
+ return /* @__PURE__ */ a("div", { className: n.jumper, children: [
12
+ /* @__PURE__ */ a("span", { children: [
13
+ t.goToPage,
14
+ ":"
15
+ ] }),
16
+ /* @__PURE__ */ g(
17
+ "input",
18
+ {
19
+ type: "text",
20
+ className: n.input,
21
+ value: u,
22
+ onChange: (m) => l(m.target.value),
23
+ onKeyPress: p,
24
+ onBlur: s,
25
+ disabled: o,
26
+ placeholder: e.toString(),
27
+ "aria-label": t.goToPage
28
+ }
29
+ )
30
+ ] });
31
+ };
32
+ export {
33
+ P as PaginationQuickJumper,
34
+ P as default
35
+ };
@@ -0,0 +1,6 @@
1
+ export { Pagination, default } from './pagination';
2
+ export type { PaginationProps, PaginationInfoProps, PaginationQuickJumperProps, } from './pagination.type';
3
+ export { usePagination } from './pagination.hook';
4
+ export { usePaginationQuickJumper } from './components/pagination-quick-jumper.hook';
5
+ export { calculateVisiblePages, calculateItemRange, isValidPageNumber } from './pagination.utils';
6
+ export { PAGINATION_DEFAULTS, PAGINATION_CSS_CLASSES, PAGINATION_LABELS } from './pagination.const';
@@ -0,0 +1,26 @@
1
+ export declare const PAGINATION_DEFAULTS: {
2
+ readonly MAX_VISIBLE_PAGES: 6;
3
+ readonly ITEMS_PER_PAGE: 10;
4
+ };
5
+ export declare const PAGINATION_CSS_CLASSES: {
6
+ readonly container: "flex items-center justify-between gap-4 p-4";
7
+ readonly navigation: "flex items-center gap-2";
8
+ readonly button: "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";
9
+ readonly buttonActive: "bg-blue-600 text-white border-blue-600 hover:bg-blue-700";
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
+ readonly ellipsis: "flex items-center justify-center w-8 h-8 text-gray-400";
12
+ readonly info: "text-sm text-text-neutral-secondary";
13
+ readonly jumper: "flex items-center gap-2 text-sm text-text-neutral-primary";
14
+ readonly input: "w-16 px-2 py-1 text-sm border border-gray-300 rounded focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent";
15
+ };
16
+ export declare const PAGINATION_LABELS: {
17
+ readonly previous: "Previous page";
18
+ readonly next: "Next page";
19
+ readonly first: "First page";
20
+ readonly last: "Last page";
21
+ readonly goToPage: "Go to page";
22
+ readonly page: "Page";
23
+ readonly of: "out of";
24
+ readonly showing: "Viewing";
25
+ readonly to: "to";
26
+ };
@@ -0,0 +1,22 @@
1
+ const e = {
2
+ MAX_VISIBLE_PAGES: 6
3
+ }, t = {
4
+ ellipsis: "flex items-center justify-center w-8 h-8 text-gray-400",
5
+ info: "text-sm text-text-neutral-secondary",
6
+ jumper: "flex items-center gap-2 text-sm text-text-neutral-primary",
7
+ input: "w-16 px-2 py-1 text-sm border border-gray-300 rounded focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent"
8
+ }, r = {
9
+ previous: "Previous page",
10
+ next: "Next page",
11
+ first: "First page",
12
+ last: "Last page",
13
+ goToPage: "Go to page",
14
+ page: "Page",
15
+ of: "out of",
16
+ showing: "Viewing"
17
+ };
18
+ export {
19
+ t as PAGINATION_CSS_CLASSES,
20
+ e as PAGINATION_DEFAULTS,
21
+ r as PAGINATION_LABELS
22
+ };
@@ -0,0 +1,4 @@
1
+ import { default as React } from 'react';
2
+ import { PaginationProps } from './pagination.type';
3
+ export declare const Pagination: React.FC<PaginationProps>;
4
+ export default Pagination;
@@ -0,0 +1,5 @@
1
+ import { PaginationHookProps, PaginationHookReturn } from './pagination.type';
2
+ export declare const usePagination: (props: PaginationHookProps) => PaginationHookReturn & {
3
+ goToPage: (page: number) => boolean;
4
+ canGoToPage: (page: number) => boolean;
5
+ };
@@ -0,0 +1,22 @@
1
+ import { useMemo as i, useCallback as o } from "react";
2
+ import { calculateVisiblePages as l, isValidPageNumber as P } from "./pagination.utils.js";
3
+ const u = (a) => {
4
+ const n = i(
5
+ () => l(a),
6
+ [a.currentPage, a.totalPage, a.maxVisiblePages]
7
+ ), e = o(
8
+ (t) => P(t, a.totalPage),
9
+ [a.totalPage]
10
+ ), g = o(
11
+ (t) => e(t),
12
+ [e]
13
+ );
14
+ return {
15
+ ...n,
16
+ goToPage: g,
17
+ canGoToPage: e
18
+ };
19
+ };
20
+ export {
21
+ u as usePagination
22
+ };
@@ -0,0 +1,112 @@
1
+ import { jsxs as I, jsx as s } from "react/jsx-runtime";
2
+ import { usePagination as S } from "./pagination.hook.js";
3
+ import { PAGINATION_LABELS as o, PAGINATION_DEFAULTS as x, PAGINATION_CSS_CLASSES as E } from "./pagination.const.js";
4
+ import { Button as d } from "../../../button/button.js";
5
+ import k from "../../../assets/icons/chevron-left.js";
6
+ import N from "../../../assets/icons/chevron-right.js";
7
+ import L from "../../../assets/icons/double-chevron-left.js";
8
+ import _ from "../../../assets/icons/double-chevron-right.js";
9
+ import "react";
10
+ import { cn as z } from "../../../../lib/utils.js";
11
+ const p = () => /* @__PURE__ */ s("span", { className: E.ellipsis, children: "..." }), V = ({
12
+ currentPage: i,
13
+ totalPage: r,
14
+ onChange: b,
15
+ disabled: t = !1
16
+ }) => {
17
+ const { visiblePages: m, hasEllipsisStart: v, hasEllipsisEnd: A } = S({
18
+ currentPage: i,
19
+ totalPage: r,
20
+ maxVisiblePages: x.MAX_VISIBLE_PAGES
21
+ });
22
+ if (r <= 1)
23
+ return null;
24
+ const f = i === 1, c = i === r, a = (e) => {
25
+ !t && e !== i && e >= 1 && e <= r && b(e);
26
+ }, C = () => {
27
+ const e = [];
28
+ let h = !1, u = !1;
29
+ return m.forEach((l, y) => {
30
+ v && l === m[1] && !h && (e.push(/* @__PURE__ */ s(p, {}, "ellipsis-start")), h = !0);
31
+ const n = l === i;
32
+ e.push(
33
+ /* @__PURE__ */ s(
34
+ d,
35
+ {
36
+ onClick: () => a(l),
37
+ variant: "stroke",
38
+ shade: n ? "brand" : "neutral",
39
+ size: "small",
40
+ "aria-label": `${o.page} ${l}`,
41
+ "aria-current": n ? "page" : void 0,
42
+ className: z(
43
+ "min-w-[29px] text-text-neutral-secondary",
44
+ n && "border border-button-primary-brand-surface-default"
45
+ ),
46
+ style: {
47
+ borderStyle: n ? "solid" : "none",
48
+ boxShadow: n ? "none" : ""
49
+ },
50
+ children: l
51
+ },
52
+ l
53
+ )
54
+ ), A && l === m[m.length - 2] && !u && (e.push(/* @__PURE__ */ s(p, {}, "ellipsis-end")), u = !0);
55
+ }), e;
56
+ };
57
+ return /* @__PURE__ */ I("div", { className: "flex gap-1", children: [
58
+ /* @__PURE__ */ s(
59
+ d,
60
+ {
61
+ "aria-label": o.first,
62
+ onClick: () => a(1),
63
+ disabled: t || f,
64
+ variant: "stroke",
65
+ shade: "neutral",
66
+ size: "small",
67
+ leftIcon: /* @__PURE__ */ s(L, {})
68
+ }
69
+ ),
70
+ /* @__PURE__ */ s(
71
+ d,
72
+ {
73
+ "aria-label": o.previous,
74
+ onClick: () => a(i - 1),
75
+ disabled: t || f,
76
+ variant: "stroke",
77
+ shade: "neutral",
78
+ size: "small",
79
+ leftIcon: /* @__PURE__ */ s(k, {})
80
+ }
81
+ ),
82
+ C(),
83
+ /* @__PURE__ */ s(
84
+ d,
85
+ {
86
+ "aria-label": o.next,
87
+ onClick: () => a(i + 1),
88
+ disabled: t || c,
89
+ variant: "stroke",
90
+ shade: "neutral",
91
+ size: "small",
92
+ leftIcon: /* @__PURE__ */ s(N, {})
93
+ }
94
+ ),
95
+ /* @__PURE__ */ s(
96
+ d,
97
+ {
98
+ "aria-label": o.last,
99
+ onClick: () => a(r),
100
+ disabled: t || c,
101
+ variant: "stroke",
102
+ shade: "neutral",
103
+ size: "small",
104
+ leftIcon: /* @__PURE__ */ s(_, {})
105
+ }
106
+ )
107
+ ] });
108
+ };
109
+ export {
110
+ V as Pagination,
111
+ V as default
112
+ };
@@ -0,0 +1,33 @@
1
+ export interface PaginationProps {
2
+ currentPage: number;
3
+ totalPage: number;
4
+ onChange: (page: number) => void;
5
+ itemsPerPage?: number;
6
+ totalItems?: number;
7
+ showPageSizeSelector?: boolean;
8
+ showQuickJumper?: boolean;
9
+ showTotal?: boolean;
10
+ disabled?: boolean;
11
+ }
12
+ export interface PaginationHookProps {
13
+ currentPage: number;
14
+ totalPage: number;
15
+ maxVisiblePages?: number;
16
+ }
17
+ export interface PaginationHookReturn {
18
+ visiblePages: number[];
19
+ hasEllipsisStart: boolean;
20
+ hasEllipsisEnd: boolean;
21
+ }
22
+ export interface PaginationInfoProps {
23
+ showTotal: boolean;
24
+ totalItems?: number;
25
+ currentPage: number;
26
+ itemsPerPage: number;
27
+ }
28
+ export interface PaginationQuickJumperProps {
29
+ disabled: boolean;
30
+ currentPage: number;
31
+ totalPage: number;
32
+ onChange: (page: number) => void;
33
+ }
@@ -0,0 +1,7 @@
1
+ import { PaginationHookProps, PaginationHookReturn } from './pagination.type';
2
+ export declare const calculateVisiblePages: ({ currentPage, totalPage, maxVisiblePages, }: PaginationHookProps) => PaginationHookReturn;
3
+ export declare const calculateItemRange: (currentPage: number, itemsPerPage: number, totalItems: number) => {
4
+ start: number;
5
+ end: number;
6
+ };
7
+ export declare const isValidPageNumber: (page: number, totalPage: number) => boolean;
@@ -0,0 +1,35 @@
1
+ import { PAGINATION_DEFAULTS as p } from "./pagination.const.js";
2
+ const M = ({
3
+ currentPage: i,
4
+ totalPage: s,
5
+ maxVisiblePages: n = p.MAX_VISIBLE_PAGES
6
+ }) => {
7
+ if (s <= n)
8
+ return {
9
+ visiblePages: Array.from({ length: s }, (f, m) => m + 1),
10
+ hasEllipsisStart: !1,
11
+ hasEllipsisEnd: !1
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);
16
+ const c = [];
17
+ s > 0 && c.push(1);
18
+ const l = r > 2;
19
+ for (let f = r; f <= t; f++)
20
+ f !== 1 && f !== s && c.push(f);
21
+ const E = t < s - 1;
22
+ return s > 1 && c.push(s), {
23
+ visiblePages: c,
24
+ hasEllipsisStart: l,
25
+ hasEllipsisEnd: E
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 };
30
+ }, A = (i, s) => i >= 1 && i <= s && Number.isInteger(i);
31
+ export {
32
+ d as calculateItemRange,
33
+ M as calculateVisiblePages,
34
+ A as isValidPageNumber
35
+ };
@@ -0,0 +1,15 @@
1
+ import { CellValue, CellType, CellRenderer, TableProps } from '../table.type';
2
+ import * as React from 'react';
3
+ interface TableCellProps {
4
+ value: CellValue;
5
+ cellType: CellType;
6
+ cellRenderer?: CellRenderer;
7
+ customCells?: Record<string, CellRenderer>;
8
+ record: Record<string, unknown>;
9
+ index: number;
10
+ align?: 'left' | 'center' | 'right';
11
+ width?: string | number;
12
+ cell: TableProps['cell'];
13
+ }
14
+ export declare const TableCell: React.FC<TableCellProps>;
15
+ export {};
@@ -0,0 +1,45 @@
1
+ import { jsx as l } from "react/jsx-runtime";
2
+ import { TABLE_CSS_CLASSES as r } from "../table.const.js";
3
+ import { TextCell as p } from "./cell/text-cell.js";
4
+ import { NumberCell as h } from "./cell/number-cell.js";
5
+ import { BooleanCell as S } from "./cell/boolean-cell.js";
6
+ import "react";
7
+ import { cn as b } from "../../../lib/utils.js";
8
+ const E = ({
9
+ value: o,
10
+ cellType: m,
11
+ cellRenderer: n,
12
+ record: f,
13
+ index: i,
14
+ customCells: e,
15
+ cell: C
16
+ }) => {
17
+ const c = {
18
+ text: p,
19
+ number: h,
20
+ boolean: S
21
+ }, s = e == null ? void 0 : e[m];
22
+ let t;
23
+ if (n)
24
+ t = n({ value: o, record: f, index: i });
25
+ else if (s)
26
+ t = /* @__PURE__ */ l(s, { value: o, record: f, index: i });
27
+ else {
28
+ const a = c[m] ?? p;
29
+ t = /* @__PURE__ */ l(a, { value: o });
30
+ }
31
+ return /* @__PURE__ */ l(
32
+ "td",
33
+ {
34
+ className: b(
35
+ r.cell.default,
36
+ r.cell.cellHeight[C.cellHeight],
37
+ r.cell.hasBorder[C.hasBorder ? "true" : "false"]
38
+ ),
39
+ children: t
40
+ }
41
+ );
42
+ };
43
+ export {
44
+ E as TableCell
45
+ };
@@ -0,0 +1,7 @@
1
+ import * as React from 'react';
2
+ interface TableEmptyStateProps {
3
+ colSpan: number;
4
+ message: string;
5
+ }
6
+ export declare const TableEmptyState: React.FC<TableEmptyStateProps>;
7
+ export {};
@@ -0,0 +1,6 @@
1
+ import { jsx as t } from "react/jsx-runtime";
2
+ import { TABLE_CSS_CLASSES as m } from "../table.const.js";
3
+ const a = ({ colSpan: r, message: e }) => /* @__PURE__ */ t("tbody", { children: /* @__PURE__ */ t("tr", { children: /* @__PURE__ */ t("td", { colSpan: r, className: m.emptyState, children: e }) }) });
4
+ export {
5
+ a as TableEmptyState
6
+ };
@@ -0,0 +1,3 @@
1
+ import { FilterComponentType } from '../table-filter.type';
2
+ declare const BooleanFilter: FilterComponentType;
3
+ export default BooleanFilter;
@@ -0,0 +1,31 @@
1
+ import { jsxs as a, Fragment as n, jsx as t } from "react/jsx-runtime";
2
+ import { useEffect as u } from "react";
3
+ const o = ["equals", "notEqual"], s = ({ value: r, onChange: l }) => (u(() => {
4
+ r.condition || l({ condition: o[0] });
5
+ }, []), /* @__PURE__ */ a(n, { children: [
6
+ /* @__PURE__ */ t(
7
+ "select",
8
+ {
9
+ value: r.condition,
10
+ onChange: (e) => l({ condition: e.target.value }),
11
+ className: "border border-stroke-solid-medium bg-surface-neutral-default text-text-neutral-primary rounded px-2 py-1 text-sm",
12
+ children: o.map((e) => /* @__PURE__ */ t("option", { value: e, children: e }, e))
13
+ }
14
+ ),
15
+ /* @__PURE__ */ a(
16
+ "select",
17
+ {
18
+ value: r.value,
19
+ onChange: (e) => l({ value: e.target.value }),
20
+ className: "border border-stroke-solid-medium bg-surface-neutral-default text-text-neutral-primary rounded px-2 py-1 text-sm flex-1",
21
+ children: [
22
+ /* @__PURE__ */ t("option", { value: "", children: "Select value" }),
23
+ /* @__PURE__ */ t("option", { value: "true", children: "True" }),
24
+ /* @__PURE__ */ t("option", { value: "false", children: "False" })
25
+ ]
26
+ }
27
+ )
28
+ ] }));
29
+ export {
30
+ s as default
31
+ };
@@ -0,0 +1,3 @@
1
+ export * from './text';
2
+ export * from './boolean';
3
+ export * from './number';
@@ -0,0 +1,3 @@
1
+ import { FilterComponentType } from '../table-filter.type';
2
+ declare const NumberFilter: FilterComponentType;
3
+ export default NumberFilter;
@@ -0,0 +1,28 @@
1
+ import { jsxs as o, Fragment as u, jsx as a } from "react/jsx-runtime";
2
+ import { useEffect as d } from "react";
3
+ const l = [">", "<", "=", "!="], s = ({ value: t, onChange: r }) => (d(() => {
4
+ t.condition || r({ condition: l[0] });
5
+ }, []), /* @__PURE__ */ o(u, { children: [
6
+ /* @__PURE__ */ a(
7
+ "select",
8
+ {
9
+ value: t.condition,
10
+ onChange: (e) => r({ condition: e.target.value }),
11
+ className: "border border-stroke-solid-medium bg-surface-neutral-default text-text-neutral-primary rounded px-2 py-1 text-sm",
12
+ children: l.map((e) => /* @__PURE__ */ a("option", { value: e, children: e }, e))
13
+ }
14
+ ),
15
+ /* @__PURE__ */ a(
16
+ "input",
17
+ {
18
+ type: "number",
19
+ value: t.value,
20
+ onChange: (e) => r({ value: e.target.value }),
21
+ placeholder: "Value",
22
+ className: "border border-stroke-solid-medium bg-surface-neutral-default text-text-neutral-primary placeholder:text-text-neutral-muted rounded px-2 py-1 text-sm flex-1"
23
+ }
24
+ )
25
+ ] }));
26
+ export {
27
+ s as default
28
+ };
@@ -0,0 +1,3 @@
1
+ import { FilterComponentType } from '../table-filter.type';
2
+ declare const TextFilter: FilterComponentType;
3
+ export default TextFilter;
@@ -0,0 +1,28 @@
1
+ import { jsxs as o, Fragment as u, jsx as a } from "react/jsx-runtime";
2
+ import { useEffect as n } from "react";
3
+ const l = ["contains", "notEqual", "equals"], i = ({ value: t, onChange: r }) => (n(() => {
4
+ t.condition || r({ condition: l[0] });
5
+ }, []), /* @__PURE__ */ o(u, { children: [
6
+ /* @__PURE__ */ a(
7
+ "select",
8
+ {
9
+ value: t.condition,
10
+ onChange: (e) => r({ condition: e.target.value }),
11
+ className: "border border-stroke-solid-medium bg-surface-neutral-default text-text-neutral-primary rounded px-2 py-1 text-sm",
12
+ children: l.map((e) => /* @__PURE__ */ a("option", { value: e, children: e }, e))
13
+ }
14
+ ),
15
+ /* @__PURE__ */ a(
16
+ "input",
17
+ {
18
+ type: "text",
19
+ value: t.value,
20
+ onChange: (e) => r({ value: e.target.value }),
21
+ placeholder: "Value",
22
+ className: "border border-stroke-solid-medium bg-surface-neutral-default text-text-neutral-primary placeholder:text-text-neutral-muted rounded px-2 py-1 text-sm flex-1"
23
+ }
24
+ )
25
+ ] }));
26
+ export {
27
+ i as default
28
+ };
@@ -0,0 +1 @@
1
+ export { TableFilter } from './table-filter';
@@ -0,0 +1,9 @@
1
+ import { FilterComponentType } from './table-filter.type';
2
+ import { TableSchema, TableFilter as TableFilterType } from '../../table.type';
3
+ import * as React from 'react';
4
+ export interface TableFilterProps {
5
+ filterComponents?: Record<string, FilterComponentType>;
6
+ schema: TableSchema;
7
+ filter?: TableFilterType;
8
+ }
9
+ export declare const TableFilter: React.FC<TableFilterProps>;
@@ -0,0 +1,15 @@
1
+ import { default as React } from 'react';
2
+ import { TableFilterProps } from './table-filter.type';
3
+ import { FilterRule } from '../../table.type';
4
+ declare const useTableFilter: ({ filter, schema }: TableFilterProps) => {
5
+ isOpen: boolean;
6
+ addFilterRule: () => void;
7
+ updateFilterRule: (index: number, updates: Partial<FilterRule>) => void;
8
+ removeFilterRule: (index: number) => void;
9
+ applyFilters: () => void;
10
+ hasActiveFilters: boolean;
11
+ setIsOpen: React.Dispatch<React.SetStateAction<boolean>>;
12
+ tempFilters: FilterRule[];
13
+ filterableFields: import('../../table.type').TableSchemaColumn[];
14
+ };
15
+ export default useTableFilter;
@@ -0,0 +1,34 @@
1
+ import u from "react";
2
+ const h = ({ filter: t, schema: r }) => {
3
+ const [p, o] = u.useState(!1), [s, a] = u.useState(t.value), c = r.filter((e) => e.filterable !== !1), d = () => {
4
+ var l;
5
+ const e = {
6
+ field: ((l = c[0]) == null ? void 0 : l.key) || "",
7
+ value: ""
8
+ };
9
+ a([...s, e]);
10
+ }, f = (e, l) => {
11
+ const n = s.map((i, R) => R === e ? { ...i, ...l } : i);
12
+ a(n);
13
+ }, F = (e) => {
14
+ a(s.filter((l, n) => n !== e));
15
+ }, v = () => {
16
+ t.onChange(s), o(!1);
17
+ }, m = t.value.length > 0;
18
+ return u.useEffect(() => {
19
+ a(t.value);
20
+ }, [t.value]), {
21
+ isOpen: p,
22
+ addFilterRule: d,
23
+ updateFilterRule: f,
24
+ removeFilterRule: F,
25
+ applyFilters: v,
26
+ hasActiveFilters: m,
27
+ setIsOpen: o,
28
+ tempFilters: s,
29
+ filterableFields: c
30
+ };
31
+ };
32
+ export {
33
+ h as default
34
+ };