@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,105 @@
1
+ import { jsxs as r, jsx as t } from "react/jsx-runtime";
2
+ import { Button as s } from "../../../button/button.js";
3
+ import N from "./table-filter.hook.js";
4
+ import T from "./filters/text.js";
5
+ import z from "./filters/boolean.js";
6
+ import w from "./filters/number.js";
7
+ const C = ({
8
+ filterComponents: o = {},
9
+ schema: c,
10
+ filter: n
11
+ }) => {
12
+ const {
13
+ addFilterRule: b,
14
+ applyFilters: y,
15
+ filterableFields: k,
16
+ hasActiveFilters: d,
17
+ isOpen: m,
18
+ removeFilterRule: F,
19
+ setIsOpen: p,
20
+ tempFilters: x,
21
+ updateFilterRule: u
22
+ } = N({ schema: c, filter: n || { value: [], onChange: () => {
23
+ } } });
24
+ return n ? /* @__PURE__ */ r("div", { className: "relative mb-4", children: [
25
+ /* @__PURE__ */ r(
26
+ s,
27
+ {
28
+ onClick: () => p(!m),
29
+ variant: d ? "filled" : "stroke",
30
+ shade: d ? "brand" : "neutral",
31
+ size: "small",
32
+ children: [
33
+ "Filter ",
34
+ d && `(${n.value.length})`
35
+ ]
36
+ }
37
+ ),
38
+ m && /* @__PURE__ */ t("div", { className: "absolute top-full left-0 mt-2 min-w-96 bg-surface-neutral-default border border-stroke-solid-medium rounded-md shadow-default z-10 p-4", children: /* @__PURE__ */ r("div", { className: "space-y-4", children: [
39
+ x.map((i, a) => {
40
+ const e = c.find((l) => l.key === i.field), h = {
41
+ boolean: z,
42
+ text: T,
43
+ number: w
44
+ }, v = (o == null ? void 0 : o[(e == null ? void 0 : e.cellType) || ""]) || h[(e == null ? void 0 : e.cellType) || "text"];
45
+ v || console.warn(
46
+ `No filter component found for column "${e == null ? void 0 : e.key}" with cellType "${e == null ? void 0 : e.cellType}". Provide a custom filter component or use supported types: "text", "number", "boolean".`
47
+ );
48
+ const g = v ?? h.text;
49
+ return /* @__PURE__ */ r("div", { className: "flex gap-2 items-center", children: [
50
+ /* @__PURE__ */ t(
51
+ "select",
52
+ {
53
+ value: i.field,
54
+ onChange: (l) => u(a, { field: l.target.value, condition: void 0 }),
55
+ className: "border border-stroke-solid-medium bg-surface-neutral-default text-text-neutral-primary rounded px-2 py-1 text-sm flex-1",
56
+ children: k.map((l) => /* @__PURE__ */ t("option", { value: l.key, children: l.title }, l.key))
57
+ }
58
+ ),
59
+ /* @__PURE__ */ t(
60
+ g,
61
+ {
62
+ onChange: ({ condition: l, value: f }) => {
63
+ u(a, {
64
+ ...l ? { condition: l } : {},
65
+ ...f ? { value: f } : {}
66
+ });
67
+ },
68
+ value: { value: i.value, condition: i.condition }
69
+ },
70
+ a
71
+ ),
72
+ /* @__PURE__ */ t(
73
+ s,
74
+ {
75
+ onClick: () => F(a),
76
+ variant: "ghost",
77
+ shade: "danger",
78
+ size: "small",
79
+ className: "!px-2 !py-1",
80
+ children: "×"
81
+ }
82
+ )
83
+ ] }, a);
84
+ }),
85
+ /* @__PURE__ */ r("div", { className: "flex gap-2", children: [
86
+ /* @__PURE__ */ t(s, { onClick: b, variant: "stroke", shade: "neutral", size: "small", children: "+ Add" }),
87
+ /* @__PURE__ */ t("div", { className: "flex-1" }),
88
+ /* @__PURE__ */ t(
89
+ s,
90
+ {
91
+ onClick: () => p(!1),
92
+ variant: "stroke",
93
+ shade: "neutral",
94
+ size: "small",
95
+ children: "Cancel"
96
+ }
97
+ ),
98
+ /* @__PURE__ */ t(s, { onClick: y, variant: "filled", shade: "brand", size: "small", children: "Apply" })
99
+ ] })
100
+ ] }) })
101
+ ] }) : null;
102
+ };
103
+ export {
104
+ C as TableFilter
105
+ };
@@ -0,0 +1,18 @@
1
+ import { FC } from 'react';
2
+ import { TableFilter, TableSchema } from '../../table.type';
3
+ export interface TableFilterProps {
4
+ schema: TableSchema;
5
+ filter: TableFilter;
6
+ filterComponents?: Record<string, FilterComponentType>;
7
+ }
8
+ export type FilterComponentProps = {
9
+ onChange: (input: {
10
+ condition?: string;
11
+ value?: string;
12
+ }) => void;
13
+ value: {
14
+ condition?: string;
15
+ value: string;
16
+ };
17
+ };
18
+ export type FilterComponentType = FC<FilterComponentProps>;
@@ -0,0 +1,7 @@
1
+ import * as React from 'react';
2
+ export interface TableFooterContentProps {
3
+ children: React.ReactNode;
4
+ className?: string;
5
+ }
6
+ export declare const TableFooterContent: React.FC<TableFooterContentProps>;
7
+ export default TableFooterContent;
@@ -0,0 +1,9 @@
1
+ import { jsx as o } from "react/jsx-runtime";
2
+ const s = ({
3
+ children: e,
4
+ className: t = ""
5
+ }) => /* @__PURE__ */ o("div", { className: `flex items-center ${t}`, children: e });
6
+ export {
7
+ s as TableFooterContent,
8
+ s as default
9
+ };
@@ -0,0 +1,7 @@
1
+ import * as React from 'react';
2
+ export interface TableFooterProps {
3
+ children: React.ReactNode;
4
+ className?: string;
5
+ }
6
+ export declare const TableFooter: React.FC<TableFooterProps>;
7
+ export default TableFooter;
@@ -0,0 +1,6 @@
1
+ import { jsx as r } from "react/jsx-runtime";
2
+ const o = ({ children: e, className: t = "" }) => /* @__PURE__ */ r("div", { className: `flex justify-between items-center ${t}`, children: e });
3
+ export {
4
+ o as TableFooter,
5
+ o as default
6
+ };
@@ -0,0 +1,2 @@
1
+ export { TableHeader } from './table-header';
2
+ export { TableSortIcon } from './table-sort-icon';
@@ -0,0 +1,9 @@
1
+ import { TableSchemaColumn, TableSort, TableProps } from '../../table.type';
2
+ import * as React from 'react';
3
+ interface TableHeaderProps {
4
+ schema: TableSchemaColumn[];
5
+ sort?: TableSort;
6
+ cell: TableProps['cell'];
7
+ }
8
+ export declare const TableHeader: React.FC<TableHeaderProps>;
9
+ export {};
@@ -0,0 +1,27 @@
1
+ import { jsx as r, jsxs as d } from "react/jsx-runtime";
2
+ import { TABLE_CSS_CLASSES as t } from "../../table.const.js";
3
+ import { TableSortIcon as c } from "./table-sort-icon.js";
4
+ import { getCurrentSortDirection as n, isSortActive as h, handleSortClick as p } from "./table-header.utils.js";
5
+ import "react";
6
+ import { cn as C } from "../../../../lib/utils.js";
7
+ const y = ({ schema: a, sort: i, cell: o }) => /* @__PURE__ */ r("thead", { className: t.header, children: /* @__PURE__ */ r("tr", { children: a.map((e) => {
8
+ const s = n(e.key, i), l = h(e.key, i);
9
+ return /* @__PURE__ */ r(
10
+ "th",
11
+ {
12
+ className: C(
13
+ e.sortable ? t.sortableHeaderCell : t.headerCell,
14
+ t.cell.hasBorder[o.hasBorder ? "true" : "false"]
15
+ ),
16
+ onClick: e.sortable ? () => p(e.key, i) : void 0,
17
+ children: /* @__PURE__ */ d("div", { className: t.headerCellContent, children: [
18
+ /* @__PURE__ */ r("span", { children: e.title }),
19
+ e.sortable && /* @__PURE__ */ r(c, { direction: s, isActive: l })
20
+ ] })
21
+ },
22
+ e.key
23
+ );
24
+ }) }) });
25
+ export {
26
+ y as TableHeader
27
+ };
@@ -0,0 +1,5 @@
1
+ import { TableSort, SortDirection } from '../../table.type';
2
+ export declare const getCurrentSortDirection: (field: string, sort?: TableSort) => SortDirection;
3
+ export declare const getNextSortDirection: (currentDirection: SortDirection) => SortDirection;
4
+ export declare const isSortActive: (field: string, sort?: TableSort) => boolean;
5
+ export declare const handleSortClick: (field: string, sort?: TableSort) => void;
@@ -0,0 +1,15 @@
1
+ const i = (n, t) => {
2
+ if (!t) return null;
3
+ const e = t.sortedColumns.find((r) => r.field === n);
4
+ return (e == null ? void 0 : e.direction) || null;
5
+ }, o = (n) => n === null ? "asc" : n === "asc" ? "desc" : null, c = (n, t) => t ? t.sortedColumns.some((e) => e.field === n && e.direction !== null) : !1, u = (n, t) => {
6
+ if (!t) return;
7
+ const e = i(n, t), r = o(e);
8
+ t.onSort(n, r);
9
+ };
10
+ export {
11
+ i as getCurrentSortDirection,
12
+ o as getNextSortDirection,
13
+ u as handleSortClick,
14
+ c as isSortActive
15
+ };
@@ -0,0 +1,8 @@
1
+ import { SortDirection } from '../../table.type';
2
+ import * as React from 'react';
3
+ interface TableSortIconProps {
4
+ direction: SortDirection;
5
+ isActive: boolean;
6
+ }
7
+ export declare const TableSortIcon: React.FC<TableSortIconProps>;
8
+ export {};
@@ -0,0 +1,13 @@
1
+ import { jsx as e, Fragment as a, jsxs as c } from "react/jsx-runtime";
2
+ import { ChevronUpIcon as n } from "../../../assets/icons/chevron-up-icon.js";
3
+ import o from "../../../assets/icons/chevron-down.js";
4
+ const f = ({ direction: r, isActive: s }) => {
5
+ const t = () => s ? "ml-2 w-4 h-4 text-gray-600" : "ml-2 w-4 h-4 text-gray-400";
6
+ return /* @__PURE__ */ e(a, { children: r === "asc" ? /* @__PURE__ */ e(n, { className: t() }) : r === "desc" ? /* @__PURE__ */ e(o, { className: t() }) : /* @__PURE__ */ c("div", { className: "ml-2 w-4 h-4 flex flex-col justify-center items-center", children: [
7
+ /* @__PURE__ */ e(n, { className: "w-3 h-2 text-gray-300" }),
8
+ /* @__PURE__ */ e(o, { className: "w-3 h-2 text-gray-300 -mt-1" })
9
+ ] }) });
10
+ };
11
+ export {
12
+ f as TableSortIcon
13
+ };
@@ -0,0 +1,7 @@
1
+ import * as React from 'react';
2
+ export interface TableHeaderContentProps {
3
+ children: React.ReactNode;
4
+ className?: string;
5
+ }
6
+ export declare const TableHeaderContent: React.FC<TableHeaderContentProps>;
7
+ export default TableHeaderContent;
@@ -0,0 +1,9 @@
1
+ import { jsx as r } from "react/jsx-runtime";
2
+ const s = ({
3
+ children: e,
4
+ className: t = ""
5
+ }) => /* @__PURE__ */ r("div", { className: `flex items-center ${t}`, children: e });
6
+ export {
7
+ s as TableHeaderContent,
8
+ s as default
9
+ };
@@ -0,0 +1,7 @@
1
+ import * as React from 'react';
2
+ export interface TableHeaderWrapperProps {
3
+ children: React.ReactNode;
4
+ className?: string;
5
+ }
6
+ export declare const TableHeaderWrapper: React.FC<TableHeaderWrapperProps>;
7
+ export default TableHeaderWrapper;
@@ -0,0 +1,9 @@
1
+ import { jsx as t } from "react/jsx-runtime";
2
+ const s = ({
3
+ children: e,
4
+ className: r = ""
5
+ }) => /* @__PURE__ */ t("div", { className: `flex justify-between items-center ${r}`, children: e });
6
+ export {
7
+ s as TableHeaderWrapper,
8
+ s as default
9
+ };
@@ -0,0 +1,7 @@
1
+ import * as React from 'react';
2
+ interface TableLoadingStateProps {
3
+ colSpan: number;
4
+ message?: string;
5
+ }
6
+ export declare const TableLoadingState: React.FC<TableLoadingStateProps>;
7
+ export {};
@@ -0,0 +1,9 @@
1
+ import { jsx as r } from "react/jsx-runtime";
2
+ import { TABLE_CSS_CLASSES as d } from "../table.const.js";
3
+ const n = ({
4
+ colSpan: o,
5
+ message: t = "Loading..."
6
+ }) => /* @__PURE__ */ r("tbody", { children: /* @__PURE__ */ r("tr", { children: /* @__PURE__ */ r("td", { colSpan: o, className: d.loading, children: t }) }) });
7
+ export {
8
+ n as TableLoadingState
9
+ };
@@ -0,0 +1,11 @@
1
+ import { CellRenderer, TableProps, TableSchemaColumn } from '../table.type';
2
+ import * as React from 'react';
3
+ interface TableRowProps {
4
+ record: Record<string, unknown>;
5
+ index: number;
6
+ schema: TableSchemaColumn[];
7
+ customCells?: Record<string, CellRenderer>;
8
+ cell: TableProps['cell'];
9
+ }
10
+ export declare const TableRow: React.FC<TableRowProps>;
11
+ export {};
@@ -0,0 +1,23 @@
1
+ import { jsx as l } from "react/jsx-runtime";
2
+ import { extractCellValue as c } from "../table.utils.js";
3
+ import { TABLE_CSS_CLASSES as i } from "../table.const.js";
4
+ import { TableCell as s } from "./table-cell.js";
5
+ const C = ({ record: r, index: t, schema: a, customCells: o, cell: p }) => /* @__PURE__ */ l("tr", { className: i.row, children: a.map((e) => {
6
+ const m = c(r, e);
7
+ return /* @__PURE__ */ l(
8
+ s,
9
+ {
10
+ value: m,
11
+ cellType: e.cellType,
12
+ cellRenderer: e.cellRenderer,
13
+ record: r,
14
+ index: t,
15
+ customCells: o,
16
+ cell: p
17
+ },
18
+ e.key
19
+ );
20
+ }) });
21
+ export {
22
+ C as TableRow
23
+ };
@@ -0,0 +1,9 @@
1
+ export { Table as default, Table, TableProvider } from './table-provider';
2
+ export { TableBody } from './table';
3
+ export type { TableProps, TableSchema, TableSchemaColumn, CellType, CellValue, CellRenderer, CellRendererProps, FilterRule, FilterCondition, TableFilter as TableFilterType, TablePaginationConfig, SortDirection, SortColumn, TableSort, } from './table.type';
4
+ export { getNestedValue, extractCellValue } from './table.utils';
5
+ export { DEFAULT_EMPTY_MESSAGE, TABLE_CSS_CLASSES } from './table.const';
6
+ export { TableContext, useTableContext } from './table.context';
7
+ export { TableCell, TableHeader, TableRow, TableEmptyState, TableLoadingState, TablePagination, TextCell, NumberCell, BooleanCell, TableHeaderWrapper, TableHeaderContent, TableFooter, TableFooterContent, } from './components';
8
+ export { TableFilter } from './components/table-filter';
9
+ export { PaginationInfo, PaginationQuickJumper } from './components/pagination/components';
@@ -0,0 +1,26 @@
1
+ import { TableProps } from './table.type';
2
+ import { TableBody } from './table';
3
+ import { TableFilter } from './components/table-filter';
4
+ import { Pagination } from './components/pagination';
5
+ import { TableHeaderWrapper, TableHeaderContent, TableFooter, TableFooterContent } from './components';
6
+ import { PaginationInfo, PaginationQuickJumper } from './components/pagination/components';
7
+ import * as React from 'react';
8
+ export interface TableProviderProps extends TableProps {
9
+ children: React.ReactNode;
10
+ }
11
+ declare const TableProvider: React.FC<TableProviderProps>;
12
+ interface TableCompoundComponent extends React.FC<TableProviderProps> {
13
+ Body: typeof TableBody;
14
+ Filter: typeof TableFilter;
15
+ Pagination: typeof Pagination;
16
+ PaginationInfo: typeof PaginationInfo;
17
+ PaginationQuickJumper: typeof PaginationQuickJumper;
18
+ Provider: typeof TableProvider;
19
+ Header: typeof TableHeaderWrapper;
20
+ HeaderContent: typeof TableHeaderContent;
21
+ Footer: typeof TableFooter;
22
+ FooterContent: typeof TableFooterContent;
23
+ }
24
+ export declare const Table: TableCompoundComponent;
25
+ export { TableProvider };
26
+ export default Table;
@@ -0,0 +1,45 @@
1
+ import { jsx as n } from "react/jsx-runtime";
2
+ import * as a from "react";
3
+ import { TableContext as m } from "./table.context.js";
4
+ import { TableBody as p } from "./table.js";
5
+ import { TableFilter as f } from "./components/table-filter/table-filter.js";
6
+ import { Pagination as l } from "./components/pagination/pagination.js";
7
+ import "clsx";
8
+ import "tailwind-merge";
9
+ import { TableHeaderWrapper as s } from "./components/table-header-wrapper.js";
10
+ import { TableHeaderContent as d } from "./components/table-header-content.js";
11
+ import { TableFooter as T } from "./components/table-footer.js";
12
+ import { TableFooterContent as b } from "./components/table-footer-content.js";
13
+ import { PaginationInfo as u } from "./components/pagination/components/pagination-info.js";
14
+ import { PaginationQuickJumper as c } from "./components/pagination/components/pagination-quick-jumper.js";
15
+ const r = ({
16
+ children: e,
17
+ pagination: P,
18
+ sort: C,
19
+ filter: F,
20
+ filterComponents: v,
21
+ ...t
22
+ }) => {
23
+ const i = a.useMemo(
24
+ () => ({
25
+ ...t
26
+ }),
27
+ [t]
28
+ );
29
+ return /* @__PURE__ */ n(m.Provider, { value: i, children: e });
30
+ }, g = r, o = g;
31
+ o.Body = p;
32
+ o.Filter = f;
33
+ o.Pagination = l;
34
+ o.PaginationInfo = u;
35
+ o.PaginationQuickJumper = c;
36
+ o.Provider = r;
37
+ o.Header = s;
38
+ o.HeaderContent = d;
39
+ o.Footer = T;
40
+ o.FooterContent = b;
41
+ export {
42
+ o as Table,
43
+ r as TableProvider,
44
+ o as default
45
+ };
@@ -0,0 +1,24 @@
1
+ export declare const DEFAULT_EMPTY_MESSAGE = "No data available";
2
+ export declare const TABLE_CSS_CLASSES: {
3
+ readonly table: "w-full";
4
+ readonly header: "bg-neutral-25 text-text-neutral-secondary";
5
+ readonly cell: {
6
+ readonly default: "px-4 py-3 text-sm";
7
+ readonly cellHeight: {
8
+ readonly small: "p-3";
9
+ readonly large: "p-4";
10
+ };
11
+ readonly hasBorder: {
12
+ readonly true: "border border-stroke-solid-light";
13
+ readonly false: "border-b border-stroke-solid-light";
14
+ };
15
+ };
16
+ readonly headerCell: "px-4 py-3 text-left text-xs font-medium uppercase tracking-wider";
17
+ readonly sortableHeaderCell: "p-3 text-left text-xs font-medium uppercase tracking-wider cursor-pointer transition-colors duration-200";
18
+ readonly headerCellContent: "flex items-center justify-between";
19
+ readonly sortIcon: "ml-2 w-4 h-4 text-gray-400";
20
+ readonly sortIconActive: "ml-2 w-4 h-4 text-gray-600";
21
+ readonly row: "hover:bg-surface-neutral-hover transition-colors duration-200 text-text-neutral-primary";
22
+ readonly emptyState: "px-4 py-8 text-center text-gray-500";
23
+ readonly loading: "px-4 py-8 text-center text-gray-500";
24
+ };
@@ -0,0 +1,27 @@
1
+ const e = "No data available", t = {
2
+ table: "w-full",
3
+ header: "bg-neutral-25 text-text-neutral-secondary",
4
+ cell: {
5
+ default: "px-4 py-3 text-sm",
6
+ cellHeight: {
7
+ small: "p-3",
8
+ large: "p-4"
9
+ },
10
+ hasBorder: {
11
+ true: "border border-stroke-solid-light",
12
+ false: "border-b border-stroke-solid-light"
13
+ }
14
+ },
15
+ headerCell: "px-4 py-3 text-left text-xs font-medium uppercase tracking-wider",
16
+ sortableHeaderCell: "p-3 text-left text-xs font-medium uppercase tracking-wider cursor-pointer transition-colors duration-200",
17
+ headerCellContent: "flex items-center justify-between",
18
+ sortIcon: "ml-2 w-4 h-4 text-gray-400",
19
+ sortIconActive: "ml-2 w-4 h-4 text-gray-600",
20
+ row: "hover:bg-surface-neutral-hover transition-colors duration-200 text-text-neutral-primary",
21
+ emptyState: "px-4 py-8 text-center text-gray-500",
22
+ loading: "px-4 py-8 text-center text-gray-500"
23
+ };
24
+ export {
25
+ e as DEFAULT_EMPTY_MESSAGE,
26
+ t as TABLE_CSS_CLASSES
27
+ };
@@ -0,0 +1,7 @@
1
+ import { TableProps } from './table.type';
2
+ import * as React from 'react';
3
+ export interface TableContextValue extends TableProps {
4
+ updateSort?: (sort: TableProps['sort']) => void;
5
+ }
6
+ export declare const TableContext: React.Context<TableContextValue | null>;
7
+ export declare const useTableContext: () => TableContextValue;
@@ -0,0 +1,11 @@
1
+ import * as e from "react";
2
+ const o = e.createContext(null), n = () => {
3
+ const t = e.useContext(o);
4
+ if (!t)
5
+ throw new Error("useTableContext must be used within a TableProvider");
6
+ return t;
7
+ };
8
+ export {
9
+ o as TableContext,
10
+ n as useTableContext
11
+ };
@@ -0,0 +1,4 @@
1
+ import { TableProps } from './table.type';
2
+ import * as React from 'react';
3
+ export declare const TableBody: React.FC<Partial<TableProps>>;
4
+ export default TableBody;
@@ -0,0 +1,39 @@
1
+ import { jsxs as S, jsx as e } from "react/jsx-runtime";
2
+ import * as d from "react";
3
+ import { DEFAULT_EMPTY_MESSAGE as b, TABLE_CSS_CLASSES as T } from "./table.const.js";
4
+ import { TableHeader as u } from "./components/table-header/table-header.js";
5
+ import { TableRow as g } from "./components/table-row.js";
6
+ import { TableEmptyState as h } from "./components/table-empty-state.js";
7
+ import { TableLoadingState as E } from "./components/table-loading-state.js";
8
+ import { TableContext as x } from "./table.context.js";
9
+ const j = ({
10
+ cell: r = { cellHeight: "small", hasBorder: !0 },
11
+ sort: l,
12
+ ...m
13
+ }) => {
14
+ const s = d.useContext(x), {
15
+ dataSource: o = [],
16
+ schema: t = [],
17
+ loading: n = !1,
18
+ emptyMessage: c = b,
19
+ customCells: i
20
+ } = s || m, p = () => n ? /* @__PURE__ */ e(E, { colSpan: t.length }) : !o || o.length === 0 ? /* @__PURE__ */ e(h, { colSpan: t.length, message: c }) : /* @__PURE__ */ e("tbody", { children: o.map((f, a) => /* @__PURE__ */ e(
21
+ g,
22
+ {
23
+ record: f,
24
+ index: a,
25
+ schema: t,
26
+ customCells: i,
27
+ cell: r
28
+ },
29
+ a
30
+ )) });
31
+ return /* @__PURE__ */ S("table", { className: T.table, children: [
32
+ /* @__PURE__ */ e(u, { schema: t, sort: l, cell: r }),
33
+ p()
34
+ ] });
35
+ };
36
+ export {
37
+ j as TableBody,
38
+ j as default
39
+ };
@@ -0,0 +1,63 @@
1
+ import { FC } from 'react';
2
+ import { FilterComponentType } from './components/table-filter/table-filter.type';
3
+ export type CellType = 'text' | 'number' | 'boolean';
4
+ export type CellValue = string | number | boolean | null | undefined;
5
+ export type CellRendererProps = {
6
+ value: CellValue;
7
+ record: Record<string, unknown>;
8
+ index: number;
9
+ };
10
+ export type CellRenderer = FC<CellRendererProps>;
11
+ export type FilterCondition = 'contains' | 'notEqual' | 'equal' | '>' | '<' | '=' | '!=';
12
+ export type FilterRule = {
13
+ field: string;
14
+ condition?: string;
15
+ value: string;
16
+ };
17
+ export type TableFilter = {
18
+ value: FilterRule[];
19
+ onChange: (filters: FilterRule[]) => void;
20
+ };
21
+ export type TablePaginationConfig = {
22
+ currentPage: number;
23
+ totalPage: number;
24
+ onChange: (page: number) => void;
25
+ itemsPerPage?: number;
26
+ totalItems?: number;
27
+ showQuickJumper?: boolean;
28
+ showTotal?: boolean;
29
+ };
30
+ export type SortDirection = 'asc' | 'desc' | null;
31
+ export type SortColumn = {
32
+ field: string;
33
+ direction: SortDirection;
34
+ };
35
+ export type TableSort = {
36
+ sortedColumns: SortColumn[];
37
+ onSort: (field: string, direction: SortDirection) => void;
38
+ };
39
+ export type TableSchemaColumn = {
40
+ key: string;
41
+ title: string;
42
+ cellType: CellType;
43
+ cellRenderer?: CellRenderer;
44
+ filterable?: boolean;
45
+ hideable?: boolean;
46
+ sortable?: boolean;
47
+ };
48
+ export type TableSchema = TableSchemaColumn[];
49
+ export type TableProps = {
50
+ cell?: {
51
+ hasBorder?: boolean;
52
+ cellHeight?: 'small' | 'large';
53
+ };
54
+ dataSource: Record<string, unknown>[];
55
+ schema: TableSchema;
56
+ loading?: boolean;
57
+ emptyMessage?: string;
58
+ filter?: TableFilter;
59
+ filterComponents?: Record<string, FilterComponentType>;
60
+ pagination?: TablePaginationConfig;
61
+ sort?: TableSort;
62
+ customCells?: Record<string, CellRenderer>;
63
+ };
@@ -0,0 +1,3 @@
1
+ import { CellValue, TableSchemaColumn } from './table.type';
2
+ export declare const getNestedValue: (object: Record<string, unknown>, path: string) => CellValue;
3
+ export declare const extractCellValue: (record: Record<string, unknown>, column: TableSchemaColumn) => CellValue;
@@ -0,0 +1,5 @@
1
+ const s = (t, l) => l.split(".").reduce((e, o) => e && typeof e == "object" && o in e ? e[o] : void 0, t), u = (t, l) => s(t, l.key);
2
+ export {
3
+ u as extractCellValue,
4
+ s as getNestedValue
5
+ };
@@ -103,6 +103,21 @@
103
103
  color: var(--color-neutral-400);
104
104
  }
105
105
 
106
+ .z2-select-label {
107
+ display: flex;
108
+ padding: var(--spacing-2, 8px) var(--spacing-2, 8px) var(--spacing-1, 4px) var(--spacing-2, 8px);
109
+ align-items: center;
110
+ gap: 4px;
111
+ align-self: stretch;
112
+ color: var(--color-neutral-600);
113
+ /* text small/leading-none/medium */
114
+ font-size: var(--base-sizes-small-font-size, 14px);
115
+ font-style: normal;
116
+ font-weight: var(--font-weight-medium, 450);
117
+ line-height: 100%; /* 14px */
118
+ letter-spacing: var(--font-letter-spacing-bittight, -0.2px);
119
+ }
120
+
106
121
  .z2-select-item-text {
107
122
  @apply flex items-center justify-center gap-2 flex-1 overflow-hidden text-ellipsis text-[14px] font-[450] leading-[100%] tracking-[-0.2px];
108
123
  }