@ztwoint/z-ui 0.1.65 → 0.1.66

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 (83) hide show
  1. package/dist/components/table/components/cell/avatar-cell.js +3 -2
  2. package/dist/components/table/index.d.ts +1 -1
  3. package/dist/components/table/table-provider.d.ts +0 -2
  4. package/dist/components/table/table-provider.js +20 -23
  5. package/dist/components/table/table.type.d.ts +0 -20
  6. package/dist/components/table-card/table-card.js +50 -49
  7. package/dist/components/table-card/table-card.type.d.ts +3 -1
  8. package/dist/components/{table/components/table-filter → table-filter}/close-filter-confirm/filter-confirmation-dialog.js +2 -2
  9. package/dist/{types/components/table/components → components}/table-filter/close-filter-confirm/filter-confirmation-dialog.utils.d.ts +1 -1
  10. package/dist/components/{table/components/table-filter → table-filter}/filters/checkbox.js +2 -2
  11. package/dist/components/{table/components/table-filter → table-filter}/filters/number/filter-input-field.js +1 -1
  12. package/dist/components/{table/components/table-filter → table-filter}/filters/text.js +3 -3
  13. package/dist/components/table-filter/index.d.ts +9 -0
  14. package/dist/components/table-filter/index.js +11 -0
  15. package/dist/{types/components/table/components → components}/table-filter/selected-filters-display/selected-filters-display.type.d.ts +2 -2
  16. package/dist/components/{table/components/table-filter → table-filter}/selected-filters-display/selected-filters-display.utils.d.ts +2 -2
  17. package/dist/components/table-filter/selected-filters-display/selected-filters-display.utils.js +30 -0
  18. package/dist/components/{table/components/table-filter → table-filter}/table-filter-button.js +71 -67
  19. package/dist/components/table-filter/table-filter-column-button.js +110 -0
  20. package/dist/components/table-filter/table-filter-provider.d.ts +3 -0
  21. package/dist/components/table-filter/table-filter-provider.js +27 -0
  22. package/dist/components/{table/components/table-filter → table-filter}/table-filter.context.d.ts +2 -4
  23. package/dist/components/{table/components/table-filter → table-filter}/table-filter.hook.d.ts +2 -4
  24. package/dist/components/{table/components/table-filter → table-filter}/table-filter.hook.js +23 -24
  25. package/dist/components/table-filter/table-filter.type.d.ts +44 -0
  26. package/dist/routes/table.d.ts +3 -0
  27. package/dist/types/components/table/index.d.ts +1 -1
  28. package/dist/types/components/table/table-provider.d.ts +0 -2
  29. package/dist/types/components/table/table.type.d.ts +0 -20
  30. package/dist/types/components/table-card/table-card.type.d.ts +4 -1
  31. package/dist/{components/table → types}/components/table-filter/close-filter-confirm/filter-confirmation-dialog.utils.d.ts +1 -1
  32. package/dist/types/components/table-filter/index.d.ts +9 -0
  33. package/dist/{components/table → types}/components/table-filter/selected-filters-display/selected-filters-display.type.d.ts +2 -2
  34. package/dist/types/components/{table/components/table-filter → table-filter}/selected-filters-display/selected-filters-display.utils.d.ts +2 -2
  35. package/dist/types/components/table-filter/table-filter-provider.d.ts +3 -0
  36. package/dist/types/components/{table/components/table-filter → table-filter}/table-filter.context.d.ts +3 -3
  37. package/dist/types/components/{table/components/table-filter → table-filter}/table-filter.hook.d.ts +2 -3
  38. package/dist/types/components/table-filter/table-filter.type.d.ts +44 -0
  39. package/dist/types/routes/table.d.ts +3 -0
  40. package/package.json +1 -1
  41. package/dist/components/table/components/table-filter/index.d.ts +0 -4
  42. package/dist/components/table/components/table-filter/selected-filters-display/selected-filters-display.utils.js +0 -26
  43. package/dist/components/table/components/table-filter/table-filter-column-button.js +0 -108
  44. package/dist/components/table/components/table-filter/table-filter-provider.d.ts +0 -14
  45. package/dist/components/table/components/table-filter/table-filter-provider.js +0 -32
  46. package/dist/components/table/components/table-filter/table-filter.type.d.ts +0 -19
  47. package/dist/types/components/table/components/table-filter/index.d.ts +0 -4
  48. package/dist/types/components/table/components/table-filter/table-filter-provider.d.ts +0 -14
  49. package/dist/types/components/table/components/table-filter/table-filter.type.d.ts +0 -19
  50. /package/dist/components/{table/components/table-filter → table-filter}/close-filter-confirm/filter-confirmation-dialog.d.ts +0 -0
  51. /package/dist/components/{table/components/table-filter → table-filter}/close-filter-confirm/filter-confirmation-dialog.utils.js +0 -0
  52. /package/dist/components/{table/components/table-filter → table-filter}/filters/boolean.d.ts +0 -0
  53. /package/dist/components/{table/components/table-filter → table-filter}/filters/boolean.js +0 -0
  54. /package/dist/components/{table/components/table-filter → table-filter}/filters/checkbox.d.ts +0 -0
  55. /package/dist/components/{table/components/table-filter → table-filter}/filters/index.d.ts +0 -0
  56. /package/dist/components/{table/components/table-filter → table-filter}/filters/number/filter-input-field.d.ts +0 -0
  57. /package/dist/components/{table/components/table-filter → table-filter}/filters/number/index.d.ts +0 -0
  58. /package/dist/components/{table/components/table-filter → table-filter}/filters/number/number.d.ts +0 -0
  59. /package/dist/components/{table/components/table-filter → table-filter}/filters/number/number.hook.d.ts +0 -0
  60. /package/dist/components/{table/components/table-filter → table-filter}/filters/number/number.hook.js +0 -0
  61. /package/dist/components/{table/components/table-filter → table-filter}/filters/number/number.js +0 -0
  62. /package/dist/components/{table/components/table-filter → table-filter}/filters/text.d.ts +0 -0
  63. /package/dist/components/{table/components/table-filter → table-filter}/selected-filters-display/index.d.ts +0 -0
  64. /package/dist/components/{table/components/table-filter → table-filter}/selected-filters-display/selected-filters-display.d.ts +0 -0
  65. /package/dist/components/{table/components/table-filter → table-filter}/selected-filters-display/selected-filters-display.js +0 -0
  66. /package/dist/components/{table/components/table-filter → table-filter}/table-filter-button.d.ts +0 -0
  67. /package/dist/components/{table/components/table-filter → table-filter}/table-filter-column-button.d.ts +0 -0
  68. /package/dist/components/{table/components/table-filter → table-filter}/table-filter-column-button.type.d.ts +0 -0
  69. /package/dist/components/{table/components/table-filter → table-filter}/table-filter.context.js +0 -0
  70. /package/dist/types/components/{table/components/table-filter → table-filter}/close-filter-confirm/filter-confirmation-dialog.d.ts +0 -0
  71. /package/dist/types/components/{table/components/table-filter → table-filter}/filters/boolean.d.ts +0 -0
  72. /package/dist/types/components/{table/components/table-filter → table-filter}/filters/checkbox.d.ts +0 -0
  73. /package/dist/types/components/{table/components/table-filter → table-filter}/filters/index.d.ts +0 -0
  74. /package/dist/types/components/{table/components/table-filter → table-filter}/filters/number/filter-input-field.d.ts +0 -0
  75. /package/dist/types/components/{table/components/table-filter → table-filter}/filters/number/index.d.ts +0 -0
  76. /package/dist/types/components/{table/components/table-filter → table-filter}/filters/number/number.d.ts +0 -0
  77. /package/dist/types/components/{table/components/table-filter → table-filter}/filters/number/number.hook.d.ts +0 -0
  78. /package/dist/types/components/{table/components/table-filter → table-filter}/filters/text.d.ts +0 -0
  79. /package/dist/types/components/{table/components/table-filter → table-filter}/selected-filters-display/index.d.ts +0 -0
  80. /package/dist/types/components/{table/components/table-filter → table-filter}/selected-filters-display/selected-filters-display.d.ts +0 -0
  81. /package/dist/types/components/{table/components/table-filter → table-filter}/table-filter-button.d.ts +0 -0
  82. /package/dist/types/components/{table/components/table-filter → table-filter}/table-filter-column-button.d.ts +0 -0
  83. /package/dist/types/components/{table/components/table-filter → table-filter}/table-filter-column-button.type.d.ts +0 -0
@@ -32,12 +32,13 @@ import "../../table-provider.js";
32
32
  import { Avatar as p } from "../../../avatar/avatar.js";
33
33
  import "../../table.context.js";
34
34
  import "../../../tooltip/tooltip.js";
35
+ import "../../../table-filter/index.js";
35
36
  import "../../../badge/badge.js";
36
37
  import "../../../text-preset/text-preset.js";
37
38
  import "react-dom";
38
39
  import "../../../../node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/util/changing-window/count-events-for-safari.js";
39
40
  import "../../../../node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/ledger/dispatch-consumer-event.js";
40
- const _ = ({
41
+ const $ = ({
41
42
  avatar: m,
42
43
  value: a,
43
44
  rightIcon: o,
@@ -75,5 +76,5 @@ const _ = ({
75
76
  }
76
77
  );
77
78
  export {
78
- _ as AvatarCell
79
+ $ as AvatarCell
79
80
  };
@@ -1,6 +1,6 @@
1
1
  export { Table as default, Table, TableProvider } from './table-provider';
2
2
  export { TableBody } from './table';
3
- export type { TableProps, TableSchema, TableSchemaColumn, CellType, CellValue, CellRenderer, CellRendererProps, FilterRule, FilterCondition, FilterOption, TableFilter as TableFilterType, TablePaginationConfig, SortDirection, SortColumn, TableSort, } from './table.type';
3
+ export type { TableProps, TableSchema, TableSchemaColumn, CellType, CellValue, CellRenderer, CellRendererProps, TablePaginationConfig, SortDirection, SortColumn, TableSort, } from './table.type';
4
4
  export { extractCellValue } from './table.utils';
5
5
  export { DEFAULT_EMPTY_MESSAGE, TABLE_CSS_CLASSES } from './table.const';
6
6
  export { TableContext, useTableContext } from './table.context';
@@ -1,6 +1,5 @@
1
1
  import { TableProps } from './table.type';
2
2
  import { TableBody } from './table';
3
- import { TableFilter } from './components/table-filter/table-filter-provider';
4
3
  import { TableSearch } from './components/table-search';
5
4
  import { Pagination } from './components/pagination';
6
5
  import { TableHeaderWrapper, TableHeaderContent, TableFooter, TableFooterContent } from './components';
@@ -12,7 +11,6 @@ export interface TableProviderProps extends TableProps {
12
11
  declare const TableProvider: React.FC<TableProviderProps>;
13
12
  interface TableCompoundComponent extends React.FC<TableProviderProps> {
14
13
  Body: typeof TableBody;
15
- Filter: typeof TableFilter;
16
14
  Search: typeof TableSearch;
17
15
  Pagination: typeof Pagination;
18
16
  PaginationInfo: typeof PaginationInfo;
@@ -2,11 +2,10 @@ import { jsx as p } from "react/jsx-runtime";
2
2
  import * as e from "react";
3
3
  import { TableContext as a } from "./table.context.js";
4
4
  import { TableBody as n } from "./table.js";
5
- import { TableFilter as f } from "./components/table-filter/table-filter-provider.js";
6
- import { TableSearch as l } from "./components/table-search/table-search.js";
7
- import { Pagination as s } from "./components/pagination/pagination.js";
8
- import { PaginationInfo as T } from "./components/pagination/components/pagination-info.js";
9
- import { PaginationQuickJumper as b } from "./components/pagination/components/pagination-quick-jumper.js";
5
+ import { TableSearch as f } from "./components/table-search/table-search.js";
6
+ import { Pagination as l } from "./components/pagination/pagination.js";
7
+ import { PaginationInfo as c } from "./components/pagination/components/pagination-info.js";
8
+ import { PaginationQuickJumper as d } from "./components/pagination/components/pagination-quick-jumper.js";
10
9
  import "clsx";
11
10
  import "tailwind-merge";
12
11
  /* empty css */
@@ -37,22 +36,21 @@ import "../stepper/stepper.js";
37
36
  import "../stepper-item/stepper-item.js";
38
37
  import "@radix-ui/react-tabs";
39
38
  import "../tooltip/tooltip.js";
39
+ import "../table-filter/index.js";
40
40
  import "../badge/badge.js";
41
41
  import "../avatar/avatar.js";
42
42
  import "../text-preset/text-preset.js";
43
43
  import "react-dom";
44
44
  import "../../node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/util/changing-window/count-events-for-safari.js";
45
45
  import "../../node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/ledger/dispatch-consumer-event.js";
46
- import { TableHeaderWrapper as c } from "./components/table-header-wrapper.js";
47
- import { TableHeaderContent as d } from "./components/table-header-content.js";
48
- import { TableFooter as u } from "./components/table-footer.js";
49
- import { TableFooterContent as g } from "./components/table-footer-content.js";
46
+ import { TableHeaderWrapper as T } from "./components/table-header-wrapper.js";
47
+ import { TableHeaderContent as b } from "./components/table-header-content.js";
48
+ import { TableFooter as s } from "./components/table-footer.js";
49
+ import { TableFooterContent as u } from "./components/table-footer-content.js";
50
50
  const t = ({
51
51
  children: i,
52
- pagination: C,
53
- sort: F,
54
- filter: v,
55
- filterComponents: x,
52
+ pagination: P,
53
+ sort: C,
56
54
  ...r
57
55
  }) => {
58
56
  const m = e.useMemo(
@@ -62,18 +60,17 @@ const t = ({
62
60
  [r]
63
61
  );
64
62
  return /* @__PURE__ */ p(a.Provider, { value: m, children: i });
65
- }, P = t, o = P;
63
+ }, g = t, o = g;
66
64
  o.Body = n;
67
- o.Filter = f;
68
- o.Search = l;
69
- o.Pagination = s;
70
- o.PaginationInfo = T;
71
- o.PaginationQuickJumper = b;
65
+ o.Search = f;
66
+ o.Pagination = l;
67
+ o.PaginationInfo = c;
68
+ o.PaginationQuickJumper = d;
72
69
  o.Provider = t;
73
- o.Header = c;
74
- o.HeaderContent = d;
75
- o.Footer = u;
76
- o.FooterContent = g;
70
+ o.Header = T;
71
+ o.HeaderContent = b;
72
+ o.Footer = s;
73
+ o.FooterContent = u;
77
74
  export {
78
75
  o as Table,
79
76
  t as TableProvider,
@@ -1,5 +1,4 @@
1
1
  import { FC } from 'react';
2
- import { FilterComponentType } from './components/table-filter/table-filter.type';
3
2
  import { NumberCellProps } from './components/cell/number-cell';
4
3
  import { BooleanCellProps } from './components/cell/boolean-cell';
5
4
  import { LinkCellProps } from './components/cell/link-cell';
@@ -14,21 +13,6 @@ export type CellRendererProps = {
14
13
  index: number;
15
14
  };
16
15
  export type CellRenderer = FC<CellRendererProps>;
17
- export type FilterCondition = 'contains' | 'notEqual' | 'equal' | '>' | '<' | '=' | '!=';
18
- export type FilterRule = {
19
- field: string;
20
- condition?: string;
21
- value: string | string[];
22
- };
23
- export type FilterOption = {
24
- label: string;
25
- value: string;
26
- total?: number;
27
- };
28
- export type TableFilter = {
29
- value: FilterRule[];
30
- onChange: (filters: FilterRule[]) => void;
31
- };
32
16
  export type TableSearch = {
33
17
  value: string;
34
18
  onChange: (searchValue: string) => void;
@@ -68,10 +52,8 @@ type ColumnBase<T extends CellType> = {
68
52
  title: string;
69
53
  cellType: T;
70
54
  cellRenderer?: CellRenderer;
71
- filterable?: boolean;
72
55
  hideable?: boolean;
73
56
  sortable?: boolean;
74
- filterOptions?: FilterOption[];
75
57
  };
76
58
  export type TableSchemaColumn = (ColumnBase<'number'> & {
77
59
  valueGetter?: (record: Record<string, unknown>) => CellValue | CellPropsByType['number'];
@@ -97,8 +79,6 @@ export type TableProps = {
97
79
  schema: TableSchema;
98
80
  loading?: boolean;
99
81
  emptyMessage?: string;
100
- filter?: TableFilter;
101
- filterComponents?: Record<string, FilterComponentType>;
102
82
  pagination?: TablePaginationConfig;
103
83
  sort?: TableSort;
104
84
  customCells?: Record<string, CellRenderer>;
@@ -1,5 +1,5 @@
1
- import { jsx as t, jsxs as a } from "react/jsx-runtime";
2
- import { Table as e } from "../table/table-provider.js";
1
+ import { jsx as t, jsxs as m } from "react/jsx-runtime";
2
+ import { Table as r } from "../table/table-provider.js";
3
3
  import "react";
4
4
  import { cn as i } from "../../lib/utils.js";
5
5
  /* empty css */
@@ -30,7 +30,8 @@ import "../stepper/stepper.js";
30
30
  import "../stepper-item/stepper-item.js";
31
31
  import "@radix-ui/react-tabs";
32
32
  import "../tooltip/tooltip.js";
33
- import f from "../assets/icons/octagon-warning-Copy.js";
33
+ import { Filter as P } from "../table-filter/index.js";
34
+ import S from "../assets/icons/octagon-warning-Copy.js";
34
35
  import "../badge/badge.js";
35
36
  import "../avatar/avatar.js";
36
37
  import "../text-preset/text-preset.js";
@@ -38,18 +39,18 @@ import "react-dom";
38
39
  import "../../node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/util/changing-window/count-events-for-safari.js";
39
40
  import "../../node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/ledger/dispatch-consumer-event.js";
40
41
  import "../table/table.context.js";
41
- const Ct = ({
42
+ const vt = ({
42
43
  dataSource: w,
43
- schema: P,
44
- loading: H,
45
- emptyMessage: k,
46
- className: T,
44
+ schema: H,
45
+ loading: k,
46
+ emptyMessage: T,
47
+ className: _,
47
48
  rounded: d = !0,
48
49
  bordered: n = !0,
49
- showHeader: g = !0,
50
- headerClassName: _,
51
- search: m,
52
- filter: r,
50
+ showHeader: p = !0,
51
+ headerClassName: f,
52
+ search: a,
53
+ filter: e,
53
54
  headerLeftContent: h,
54
55
  headerActions: u,
55
56
  body: l = {
@@ -57,79 +58,79 @@ const Ct = ({
57
58
  className: "",
58
59
  stickyHeader: !0
59
60
  },
60
- showFooter: p = !0,
61
+ showFooter: g = !0,
61
62
  footerClassName: j,
62
63
  pagination: o,
63
64
  paginationInfo: c,
64
65
  paginationQuickJumper: s,
65
66
  error: x = !1
66
67
  }) => {
67
- var v;
68
+ var F;
68
69
  if (x)
69
- return /* @__PURE__ */ t("div", { className: "flex flex-col items-center justify-center h-64 bg-background-error-subtle rounded-lg text-text-warning-secondary", children: /* @__PURE__ */ a("div", { className: "flex gap-2", children: [
70
- /* @__PURE__ */ t(f, { className: "mt-1.5" }),
71
- /* @__PURE__ */ a("div", { className: "flex flex-col gap-2", children: [
70
+ return /* @__PURE__ */ t("div", { className: "flex flex-col items-center justify-center h-64 bg-background-error-subtle rounded-lg text-text-warning-secondary", children: /* @__PURE__ */ m("div", { className: "flex gap-2", children: [
71
+ /* @__PURE__ */ t(S, { className: "mt-1.5" }),
72
+ /* @__PURE__ */ m("div", { className: "flex flex-col gap-2", children: [
72
73
  /* @__PURE__ */ t("div", { className: "text-text-error-primary text-lg font-medium", children: "Error loading data" }),
73
74
  /* @__PURE__ */ t("div", { className: "text-sm", children: "Please try again later" }),
74
75
  typeof x == "string" && /* @__PURE__ */ t("div", { className: "text-text-warning-secondary text-sm", children: x })
75
76
  ] })
76
77
  ] }) });
77
- const C = s && s.totalPage && s.totalPage >= 2, N = o && o.totalPage && o.totalPage >= 2 || !!c || C, F = m || r || h || u, R = typeof (r == null ? void 0 : r.showFilterButton) > "u" ? !0 : r == null ? void 0 : r.showFilterButton;
78
- return /* @__PURE__ */ t("div", { className: i("flex flex-col overflow-hidden", T), children: /* @__PURE__ */ a(e, { dataSource: w, schema: P, loading: H, emptyMessage: k, children: [
79
- g && F && /* @__PURE__ */ a(
80
- e.Header,
78
+ const C = s && s.totalPage && s.totalPage >= 2, N = o && o.totalPage && o.totalPage >= 2 || !!c || C, v = a || e || h || u, R = typeof (e == null ? void 0 : e.showFilterButton) > "u" ? !0 : e == null ? void 0 : e.showFilterButton;
79
+ return /* @__PURE__ */ t("div", { className: i("flex flex-col overflow-hidden", _), children: /* @__PURE__ */ m(r, { dataSource: w, schema: H, loading: k, emptyMessage: T, children: [
80
+ p && v && /* @__PURE__ */ m(
81
+ r.Header,
81
82
  {
82
83
  className: i(
83
84
  "flex-shrink-0",
84
85
  n && "border-stroke-solid-medium border-1 border-b-0",
85
86
  d && "rounded-t-xl",
86
- _
87
+ f
87
88
  ),
88
89
  children: [
89
- /* @__PURE__ */ a(e.HeaderContent, { children: [
90
+ /* @__PURE__ */ m(r.HeaderContent, { children: [
90
91
  h && h,
91
- m && /* @__PURE__ */ t(
92
- e.Search,
92
+ a && /* @__PURE__ */ t(
93
+ r.Search,
93
94
  {
94
95
  search: {
95
- value: m.value || "",
96
- onChange: m.onChange || (() => {
96
+ value: a.value || "",
97
+ onChange: a.onChange || (() => {
97
98
  }),
98
- placeholder: m.placeholder
99
+ placeholder: a.placeholder
99
100
  },
100
- className: m.className
101
+ className: a.className
101
102
  }
102
103
  ),
103
- r && /* @__PURE__ */ a(
104
- e.Filter,
104
+ e && /* @__PURE__ */ m(
105
+ P,
105
106
  {
106
- schema: P,
107
+ filterSchema: e.filterSchema,
107
108
  filter: {
108
- value: r.value || [],
109
- onChange: r.onChange || (() => {
109
+ value: e.value || [],
110
+ onChange: e.onChange || (() => {
110
111
  })
111
112
  },
112
113
  children: [
113
- R && /* @__PURE__ */ t(e.Filter.FilterButton, {}),
114
- (v = r == null ? void 0 : r.quickFilters) == null ? void 0 : v.map((B) => /* @__PURE__ */ t(e.Filter.FilterColumnButton, { filterName: B }, B))
114
+ R && /* @__PURE__ */ t(P.FilterButton, {}),
115
+ (F = e == null ? void 0 : e.quickFilters) == null ? void 0 : F.map((B) => /* @__PURE__ */ t(P.FilterColumnButton, { filterName: B }, B))
115
116
  ]
116
117
  }
117
118
  )
118
119
  ] }),
119
- u && /* @__PURE__ */ t(e.HeaderContent, { children: u })
120
+ u && /* @__PURE__ */ t(r.HeaderContent, { children: u })
120
121
  ]
121
122
  }
122
123
  ),
123
124
  /* @__PURE__ */ t(
124
- e.Body,
125
+ r.Body,
125
126
  {
126
127
  cell: l == null ? void 0 : l.cell,
127
128
  sort: l == null ? void 0 : l.sort,
128
129
  className: i(
129
130
  "flex-1 min-h-0",
130
131
  n && "border-stroke-solid-light border-1",
131
- d && !(g && F) && "rounded-t-xl",
132
- d && !(p && N) && "rounded-b-xl",
132
+ d && !(p && v) && "rounded-t-xl",
133
+ d && !(g && N) && "rounded-b-xl",
133
134
  n && "[&_td:first-child]:border-l-0 [&_td:last-child]:border-r-0",
134
135
  n && "[&_th:first-child]:border-l-0 [&_th:last-child]:border-r-0",
135
136
  l == null ? void 0 : l.className
@@ -137,8 +138,8 @@ const Ct = ({
137
138
  stickyHeader: l == null ? void 0 : l.stickyHeader
138
139
  }
139
140
  ),
140
- p && N && /* @__PURE__ */ a(
141
- e.Footer,
141
+ g && N && /* @__PURE__ */ m(
142
+ r.Footer,
142
143
  {
143
144
  className: i(
144
145
  "flex-shrink-0 border-stroke-solid-light border-t-[0.5px] mt-[-2px]",
@@ -147,18 +148,18 @@ const Ct = ({
147
148
  j
148
149
  ),
149
150
  children: [
150
- c ? /* @__PURE__ */ t(e.FooterContent, { children: /* @__PURE__ */ t(
151
- e.PaginationInfo,
151
+ c ? /* @__PURE__ */ t(r.FooterContent, { children: /* @__PURE__ */ t(
152
+ r.PaginationInfo,
152
153
  {
153
154
  showTotal: c.showTotal,
154
155
  totalItems: c.totalItems,
155
156
  currentPage: c.currentPage,
156
157
  itemsPerPage: c.itemsPerPage
157
158
  }
158
- ) }) : s || o ? /* @__PURE__ */ t(e.FooterContent, { children: null }) : null,
159
- (s || o) && /* @__PURE__ */ a(e.FooterContent, { children: [
159
+ ) }) : s || o ? /* @__PURE__ */ t(r.FooterContent, { children: null }) : null,
160
+ (s || o) && /* @__PURE__ */ m(r.FooterContent, { children: [
160
161
  C && /* @__PURE__ */ t(
161
- e.PaginationQuickJumper,
162
+ r.PaginationQuickJumper,
162
163
  {
163
164
  currentPage: s.currentPage,
164
165
  totalPage: s.totalPage,
@@ -168,7 +169,7 @@ const Ct = ({
168
169
  }
169
170
  ),
170
171
  o && /* @__PURE__ */ t(
171
- e.Pagination,
172
+ r.Pagination,
172
173
  {
173
174
  currentPage: o.currentPage,
174
175
  totalPage: o.totalPage,
@@ -184,5 +185,5 @@ const Ct = ({
184
185
  ] }) });
185
186
  };
186
187
  export {
187
- Ct as default
188
+ vt as default
188
189
  };
@@ -1,5 +1,6 @@
1
1
  import { default as React } from 'react';
2
- import { TableProps, TableSchema, TableFilter, TableSearch, TableSort } from '../table/table.type';
2
+ import { TableProps, TableSchema, TableSearch, TableSort } from '../table/table.type';
3
+ import { TableFilter, FilterSchema } from '../table-filter/table-filter.type';
3
4
  import { PaginationProps, PaginationInfoProps, PaginationQuickJumperProps } from '../table/components/pagination/pagination.type';
4
5
  export interface TableCardProps {
5
6
  dataSource: Record<string, unknown>[];
@@ -15,6 +16,7 @@ export interface TableCardProps {
15
16
  filter?: Partial<TableFilter> & {
16
17
  quickFilters?: string[];
17
18
  showFilterButton?: boolean;
19
+ filterSchema: FilterSchema;
18
20
  };
19
21
  headerLeftContent?: React.ReactNode;
20
22
  headerActions?: React.ReactNode;
@@ -1,6 +1,6 @@
1
1
  import { jsx as e, jsxs as n } from "react/jsx-runtime";
2
- import { Button as l } from "../../../../button/button.js";
3
- import { Z2Dialog as s, Z2DialogContent as d, Z2DialogHeader as h, Z2DialogTitle as c, Z2DialogDescription as g, Z2DialogFooter as m } from "../../../../dialog/dialog.js";
2
+ import { Button as l } from "../../button/button.js";
3
+ import { Z2Dialog as s, Z2DialogContent as d, Z2DialogHeader as h, Z2DialogTitle as c, Z2DialogDescription as g, Z2DialogFooter as m } from "../../dialog/dialog.js";
4
4
  const v = ({
5
5
  onClose: r,
6
6
  onKeepChanges: i,
@@ -1,4 +1,4 @@
1
- import { FilterRule } from '../../../table.type';
1
+ import { FilterRule } from '../table-filter.type';
2
2
  /**
3
3
  * Compares two filter arrays to determine if they are different
4
4
  */
@@ -1,7 +1,7 @@
1
1
  import { jsx as t, jsxs as s } from "react/jsx-runtime";
2
2
  import { useState as i, useEffect as h } from "react";
3
- import { MagnifierIcon as y } from "../../../../assets/icons/magnifier-icon.js";
4
- import C from "../../../../assets/icons/x.js";
3
+ import { MagnifierIcon as y } from "../../assets/icons/magnifier-icon.js";
4
+ import C from "../../assets/icons/x.js";
5
5
  const k = ["includesAny", "includesAll", "excludes"], j = ({ value: r, onChange: d, filterOptions: c = [] }) => {
6
6
  const [n, o] = i([]), [u, m] = i(""), [x, f] = i(c), p = (e) => {
7
7
  m(e.target.value);
@@ -1,5 +1,5 @@
1
1
  import { jsxs as a, jsx as t } from "react/jsx-runtime";
2
- import i from "../../../../../assets/icons/x.js";
2
+ import i from "../../../assets/icons/x.js";
3
3
  const d = ({
4
4
  label: l,
5
5
  operator: n,
@@ -1,8 +1,8 @@
1
1
  import { jsxs as l, jsx as e } from "react/jsx-runtime";
2
2
  import { useEffect as c } from "react";
3
- import s from "../../../../assets/icons/x.js";
4
- import { MagnifierIcon as u } from "../../../../assets/icons/magnifier-icon.js";
5
- import { Input as d } from "../../../../input/input.js";
3
+ import s from "../../assets/icons/x.js";
4
+ import { MagnifierIcon as u } from "../../assets/icons/magnifier-icon.js";
5
+ import { Input as d } from "../../input/input.js";
6
6
  const o = [
7
7
  { label: "Contains", value: "contains" },
8
8
  { label: "Does not equal", value: "notEqual" },
@@ -0,0 +1,9 @@
1
+ import { TableFilterProviderProps } from './table-filter.type';
2
+ import { TableFilterButton } from './table-filter-button';
3
+ import { TableFilterColumnButton } from './table-filter-column-button';
4
+ export { useTableFilterContext } from './table-filter.context';
5
+ export interface FilterCompoundComponent extends React.FC<TableFilterProviderProps> {
6
+ FilterButton: typeof TableFilterButton;
7
+ FilterColumnButton: typeof TableFilterColumnButton;
8
+ }
9
+ export declare const Filter: FilterCompoundComponent;
@@ -0,0 +1,11 @@
1
+ import { TableFilterProvider as o } from "./table-filter-provider.js";
2
+ import { TableFilterButton as r } from "./table-filter-button.js";
3
+ import { TableFilterColumnButton as e } from "./table-filter-column-button.js";
4
+ import { useTableFilterContext as F } from "./table-filter.context.js";
5
+ const t = o;
6
+ t.FilterButton = r;
7
+ t.FilterColumnButton = e;
8
+ export {
9
+ t as Filter,
10
+ F as useTableFilterContext
11
+ };
@@ -1,7 +1,7 @@
1
- import { FilterRule, TableSchema } from '../../../table.type';
1
+ import { FilterRule, FilterSchema } from '../table-filter.type';
2
2
  export interface SelectedFilterDisplayProps {
3
3
  selectedFilters: FilterRule[];
4
- schema: TableSchema;
4
+ schema: FilterSchema;
5
5
  }
6
6
  export interface FilterDisplayItem {
7
7
  field: string;
@@ -1,6 +1,6 @@
1
- import { FilterRule, TableSchema, FilterOption } from '../../../table.type';
1
+ import { FilterRule, FilterSchema, FilterOption } from '../table-filter.type';
2
2
  import { FilterDisplayItem } from './selected-filters-display.type';
3
3
  export declare const formatFilterValue: (value: string | string[]) => string;
4
4
  export declare const getFilterCount: (filterRule: FilterRule, filterOptions?: FilterOption[]) => number | undefined;
5
- export declare const createFilterDisplayItems: (selectedFilters: FilterRule[], schema: TableSchema) => FilterDisplayItem[];
5
+ export declare const createFilterDisplayItems: (selectedFilters: FilterRule[], schema: FilterSchema) => FilterDisplayItem[];
6
6
  export declare const calculateTotalCount: (filterDisplayItems: FilterDisplayItem[]) => number;
@@ -0,0 +1,30 @@
1
+ const c = (n, o) => {
2
+ if (!o || o.length === 0) return n.value !== "" ? 1 : 0;
3
+ if (Array.isArray(n.value)) {
4
+ const t = o.filter(
5
+ (r) => n.value.includes(r.value)
6
+ ).reduce((r, a) => r + (a.total || 0), 0);
7
+ return t > 0 ? t : void 0;
8
+ } else {
9
+ const e = o.find((t) => t.value === n.value);
10
+ return e == null ? void 0 : e.total;
11
+ }
12
+ }, s = (n, o) => n.filter((e) => Array.isArray(e.value) ? e.value.length > 0 : e.value !== "").map((e) => {
13
+ const t = o.find((u) => u.filterKey === e.field), r = t != null && t.options ? Object.entries(t.options).map(([u, l]) => ({
14
+ label: u,
15
+ value: u,
16
+ total: l
17
+ })) : void 0, a = c(e, r);
18
+ return {
19
+ field: e.field,
20
+ fieldTitle: (t == null ? void 0 : t.title) || e.field,
21
+ value: e.value,
22
+ condition: e.condition,
23
+ count: a
24
+ };
25
+ }), d = (n) => n.reduce((o, e) => o + (e.count || 1), 0);
26
+ export {
27
+ d as calculateTotalCount,
28
+ s as createFilterDisplayItems,
29
+ c as getFilterCount
30
+ };