@ztwoint/z-ui 0.1.84 → 0.1.86

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 (26) hide show
  1. package/dist/components/assets/icons/index.d.ts +1 -0
  2. package/dist/components/assets/icons/vector_3.d.ts +6 -0
  3. package/dist/components/assets/icons/vector_3.js +34 -0
  4. package/dist/components/radio/z2-radio.js +72 -0
  5. package/dist/components/table/components/cell/avatar-cell.js +3 -2
  6. package/dist/components/table/table-provider.js +1 -0
  7. package/dist/components/table-card/table-card.js +38 -36
  8. package/dist/components/table-card/table-card.type.d.ts +2 -1
  9. package/dist/components/table-filter/filters/boolean.js +28 -32
  10. package/dist/components/table-filter/filters/checkbox.js +24 -26
  11. package/dist/components/table-filter/filters/number/number.hook.d.ts +2 -12
  12. package/dist/components/table-filter/filters/number/number.hook.js +18 -18
  13. package/dist/components/table-filter/filters/text.js +25 -28
  14. package/dist/components/table-filter/table-filter-column-button.js +36 -39
  15. package/dist/components/table-filter/table-filter-provider.js +10 -10
  16. package/dist/components/table-filter/table-filter.hook.js +46 -42
  17. package/dist/components/table-filter/table-filter.type.d.ts +3 -2
  18. package/dist/index.d.ts +1 -0
  19. package/dist/index.js +105 -99
  20. package/dist/types/components/assets/icons/index.d.ts +1 -0
  21. package/dist/types/components/assets/icons/vector_3.d.ts +6 -0
  22. package/dist/types/components/table-card/table-card.type.d.ts +2 -1
  23. package/dist/types/components/table-filter/filters/number/number.hook.d.ts +2 -12
  24. package/dist/types/components/table-filter/table-filter.type.d.ts +3 -2
  25. package/dist/types/index.d.ts +1 -0
  26. package/package.json +1 -1
@@ -34,3 +34,4 @@ export { default as XIcon } from './x';
34
34
  export { default as Z2Icon } from './z2-icon';
35
35
  export { default as Z2SlashIcon } from './z2-slash';
36
36
  export { default as Z2DataIcon } from './z2data';
37
+ export { default as Vector3Icon } from './vector_3';
@@ -0,0 +1,6 @@
1
+ import { SVGProps } from 'react';
2
+ type IconProps = SVGProps<SVGSVGElement> & {
3
+ title?: string;
4
+ };
5
+ declare function Vector3({ fill, width, height, title, ...props }: IconProps): import("react/jsx-runtime").JSX.Element;
6
+ export default Vector3;
@@ -0,0 +1,34 @@
1
+ import { jsxs as s, jsx as e } from "react/jsx-runtime";
2
+ function l({
3
+ fill: r = "currentColor",
4
+ width: t = "1em",
5
+ height: o = "1em",
6
+ title: n = "Vector",
7
+ ...i
8
+ }) {
9
+ return /* @__PURE__ */ s(
10
+ "svg",
11
+ {
12
+ height: o,
13
+ width: t,
14
+ viewBox: "0 0 9 9",
15
+ xmlns: "http://www.w3.org/2000/svg",
16
+ ...i,
17
+ children: [
18
+ /* @__PURE__ */ e("title", { children: n }),
19
+ /* @__PURE__ */ e("g", { fill: "none", children: /* @__PURE__ */ e(
20
+ "path",
21
+ {
22
+ d: "M1 1V1C1 4.86599 4.13401 8 8 8V8",
23
+ stroke: r,
24
+ strokeLinecap: "round",
25
+ strokeOpacity: "1"
26
+ }
27
+ ) })
28
+ ]
29
+ }
30
+ );
31
+ }
32
+ export {
33
+ l as default
34
+ };
@@ -0,0 +1,72 @@
1
+ import { jsx as t } from "react/jsx-runtime";
2
+ import * as o from "@radix-ui/react-radio-group";
3
+ import { cn as d } from "../../lib/utils.js";
4
+ function c({ ...e }) {
5
+ return /* @__PURE__ */ t(o.Root, { "data-slot": "radio-group", ...e });
6
+ }
7
+ function n({
8
+ className: e,
9
+ children: r,
10
+ size: a = "default",
11
+ ...s
12
+ }) {
13
+ return /* @__PURE__ */ t(
14
+ o.Item,
15
+ {
16
+ "data-slot": "radio-group-item",
17
+ "data-size": a,
18
+ className: d(
19
+ // Base styles
20
+ "aspect-square rounded-full border-2 border-stroke-solid-high bg-surface-neutral-default",
21
+ "transition-all duration-200 ease-in-out relative",
22
+ "focus:outline-none",
23
+ // Size variants
24
+ "data-[size=sm]:size-3 data-[size=default]:size-4 data-[size=lg]:size-5",
25
+ // State styles
26
+ "hover:border-stroke-solid-hover hover:bg-surface-neutral-hover",
27
+ "data-[state=checked]:border-surface-accent-default data-[state=checked]:bg-surface-accent-default",
28
+ "data-[state=checked]:hover:border-surface-accent-hover data-[state=checked]:hover:bg-surface-accent-hover",
29
+ // Disabled state
30
+ "disabled:cursor-not-allowed disabled:opacity-50",
31
+ "disabled:border-stroke-solid-light disabled:bg-surface-neutral-disabled",
32
+ "disabled:hover:border-stroke-solid-light disabled:hover:bg-surface-neutral-disabled",
33
+ "disabled:data-[state=checked]:border-stroke-solid-light disabled:data-[state=checked]:bg-surface-neutral-disabled",
34
+ e
35
+ ),
36
+ ...s,
37
+ children: r ?? /* @__PURE__ */ t(
38
+ i,
39
+ {
40
+ className: d(
41
+ "rounded-full bg-surface-neutral-default",
42
+ "transition-all duration-200 ease-in-out",
43
+ a === "sm" && "size-1.5",
44
+ a === "default" && "size-2",
45
+ a === "lg" && "size-2.5"
46
+ )
47
+ }
48
+ )
49
+ }
50
+ );
51
+ }
52
+ function i({
53
+ className: e,
54
+ ...r
55
+ }) {
56
+ return /* @__PURE__ */ t(
57
+ o.Indicator,
58
+ {
59
+ "data-slot": "radio-group-indicator",
60
+ className: d(
61
+ "absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 flex items-center justify-center",
62
+ e
63
+ ),
64
+ ...r
65
+ }
66
+ );
67
+ }
68
+ export {
69
+ c as Z2RadioGroup,
70
+ i as Z2RadioGroupIndicator,
71
+ n as Z2RadioGroupItem
72
+ };
@@ -39,7 +39,8 @@ import "react-dom";
39
39
  import "../../../../node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/util/changing-window/count-events-for-safari.js";
40
40
  import "../../../../node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/ledger/dispatch-consumer-event.js";
41
41
  import "@radix-ui/react-slot";
42
- const I = ({
42
+ import "@radix-ui/react-radio-group";
43
+ const T = ({
43
44
  avatar: m,
44
45
  value: a,
45
46
  rightIcon: o,
@@ -77,5 +78,5 @@ const I = ({
77
78
  }
78
79
  );
79
80
  export {
80
- I as AvatarCell
81
+ T as AvatarCell
81
82
  };
@@ -44,6 +44,7 @@ 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
46
  import "@radix-ui/react-slot";
47
+ import "@radix-ui/react-radio-group";
47
48
  import { TableHeaderWrapper as T } from "./components/table-header-wrapper.js";
48
49
  import { TableHeaderContent as b } from "./components/table-header-content.js";
49
50
  import { TableFooter as s } from "./components/table-footer.js";
@@ -1,4 +1,4 @@
1
- import { jsx as e, jsxs as s } from "react/jsx-runtime";
1
+ import { jsx as e, jsxs as a } from "react/jsx-runtime";
2
2
  import { Table as r } from "../table/table-provider.js";
3
3
  import "react";
4
4
  import { cn as d } from "../../lib/utils.js";
@@ -39,15 +39,16 @@ import "react-dom";
39
39
  import "../../node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/util/changing-window/count-events-for-safari.js";
40
40
  import "../../node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/ledger/dispatch-consumer-event.js";
41
41
  import "@radix-ui/react-slot";
42
+ import "@radix-ui/react-radio-group";
42
43
  import "../table/table.context.js";
43
- const Fe = ({
44
+ const we = ({
44
45
  dataSource: w,
45
46
  schema: B,
46
47
  loading: b,
47
48
  emptyMessage: H,
48
49
  className: j,
49
50
  rounded: i = !0,
50
- bordered: n = !0,
51
+ bordered: c = !0,
51
52
  showHeader: g = !0,
52
53
  headerClassName: k,
53
54
  search: m,
@@ -62,35 +63,35 @@ const Fe = ({
62
63
  showFooter: P = !0,
63
64
  footerClassName: T,
64
65
  pagination: o,
65
- paginationInfo: c,
66
- paginationQuickJumper: a,
66
+ paginationInfo: n,
67
+ paginationQuickJumper: s,
67
68
  error: x = !1,
68
69
  dataSourceError: _ = !1
69
70
  }) => {
70
71
  var f;
71
72
  if (x)
72
- return /* @__PURE__ */ e("div", { className: "flex flex-col items-center justify-center h-64 bg-background-error-subtle rounded-lg text-text-warning-secondary", children: /* @__PURE__ */ s("div", { className: "flex gap-2", children: [
73
+ return /* @__PURE__ */ e("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: [
73
74
  /* @__PURE__ */ e(S, { className: "mt-1.5" }),
74
- /* @__PURE__ */ s("div", { className: "flex flex-col gap-2", children: [
75
+ /* @__PURE__ */ a("div", { className: "flex flex-col gap-2", children: [
75
76
  /* @__PURE__ */ e("div", { className: "text-text-error-primary text-lg font-medium", children: "Error loading data" }),
76
77
  /* @__PURE__ */ e("div", { className: "text-sm", children: "Please try again later" }),
77
78
  typeof x == "string" && /* @__PURE__ */ e("div", { className: "text-text-warning-secondary text-sm", children: x })
78
79
  ] })
79
80
  ] }) });
80
- const N = a && a.totalPage && a.totalPage >= 2, v = o && o.totalPage && o.totalPage >= 2 || !!c || N, C = m || t || h || u, R = typeof (t == null ? void 0 : t.showFilterButton) > "u" ? !0 : t == null ? void 0 : t.showFilterButton;
81
- return /* @__PURE__ */ s("div", { className: d("flex flex-col overflow-hidden relative", j), children: [
82
- /* @__PURE__ */ s(r, { dataSource: w, schema: B, emptyMessage: H, children: [
83
- g && C && /* @__PURE__ */ s(
81
+ const C = s && s.totalPage && s.totalPage >= 2, N = o && o.totalPage && o.totalPage >= 2 || !!n || C, v = m || t || h || u, R = typeof (t == null ? void 0 : t.showFilterButton) > "u" ? !0 : t == null ? void 0 : t.showFilterButton;
82
+ return /* @__PURE__ */ a("div", { className: d("flex flex-col overflow-hidden relative", j), children: [
83
+ /* @__PURE__ */ a(r, { dataSource: w, schema: B, emptyMessage: H, children: [
84
+ g && v && /* @__PURE__ */ a(
84
85
  r.Header,
85
86
  {
86
87
  className: d(
87
88
  "flex-shrink-0",
88
- n && "border-stroke-solid-medium border-1 border-b-0",
89
+ c && "border-stroke-solid-medium border-1 border-b-0",
89
90
  i && "rounded-t-xl",
90
91
  k
91
92
  ),
92
93
  children: [
93
- /* @__PURE__ */ s(r.HeaderContent, { children: [
94
+ /* @__PURE__ */ a(r.HeaderContent, { children: [
94
95
  h && h,
95
96
  m && /* @__PURE__ */ e(
96
97
  r.Search,
@@ -104,14 +105,15 @@ const Fe = ({
104
105
  className: m.className
105
106
  }
106
107
  ),
107
- t && /* @__PURE__ */ s(
108
+ t && /* @__PURE__ */ a(
108
109
  p,
109
110
  {
110
111
  filterSchema: t.filterSchema,
111
112
  filter: {
112
113
  value: t.value || [],
113
114
  onChange: t.onChange || (() => {
114
- })
115
+ }),
116
+ onDynamicChange: t.onDynamicChange
115
117
  },
116
118
  children: [
117
119
  R && /* @__PURE__ */ e(p.FilterButton, {}),
@@ -132,44 +134,44 @@ const Fe = ({
132
134
  sort: l == null ? void 0 : l.sort,
133
135
  className: d(
134
136
  "flex-1 min-h-0",
135
- n && "border-stroke-solid-light border-1",
136
- i && !(g && C) && "rounded-t-xl",
137
- i && !(P && v) && "rounded-b-xl",
138
- n && "[&_td:first-child]:border-l-0 [&_td:last-child]:border-r-0",
139
- n && "[&_th:first-child]:border-l-0 [&_th:last-child]:border-r-0",
137
+ c && "border-stroke-solid-light border-1",
138
+ i && !(g && v) && "rounded-t-xl",
139
+ i && !(P && N) && "rounded-b-xl",
140
+ c && "[&_td:first-child]:border-l-0 [&_td:last-child]:border-r-0",
141
+ c && "[&_th:first-child]:border-l-0 [&_th:last-child]:border-r-0",
140
142
  l == null ? void 0 : l.className
141
143
  ),
142
144
  stickyHeader: l == null ? void 0 : l.stickyHeader
143
145
  }
144
146
  ),
145
- P && v && /* @__PURE__ */ s(
147
+ P && N && /* @__PURE__ */ a(
146
148
  r.Footer,
147
149
  {
148
150
  className: d(
149
151
  "flex-shrink-0 border-stroke-solid-light border-t-[0.5px] mt-[-2px]",
150
- n && "border",
152
+ c && "border",
151
153
  i && "rounded-b-xl",
152
154
  T
153
155
  ),
154
156
  children: [
155
- c ? /* @__PURE__ */ e(r.FooterContent, { children: /* @__PURE__ */ e(
157
+ n ? /* @__PURE__ */ e(r.FooterContent, { children: /* @__PURE__ */ e(
156
158
  r.PaginationInfo,
157
159
  {
158
- showTotal: c.showTotal,
159
- totalItems: c.totalItems,
160
- currentPage: c.currentPage,
161
- itemsPerPage: c.itemsPerPage
160
+ showTotal: n.showTotal,
161
+ totalItems: n.totalItems,
162
+ currentPage: n.currentPage,
163
+ itemsPerPage: n.itemsPerPage
162
164
  }
163
- ) }) : a || o ? /* @__PURE__ */ e(r.FooterContent, { children: null }) : null,
164
- (a || o) && /* @__PURE__ */ s(r.FooterContent, { children: [
165
- N && /* @__PURE__ */ e(
165
+ ) }) : s || o ? /* @__PURE__ */ e(r.FooterContent, { children: null }) : null,
166
+ (s || o) && /* @__PURE__ */ a(r.FooterContent, { children: [
167
+ C && /* @__PURE__ */ e(
166
168
  r.PaginationQuickJumper,
167
169
  {
168
- currentPage: a.currentPage,
169
- totalPage: a.totalPage,
170
- onChange: a.onChange || (() => {
170
+ currentPage: s.currentPage,
171
+ totalPage: s.totalPage,
172
+ onChange: s.onChange || (() => {
171
173
  }),
172
- disabled: a.disabled
174
+ disabled: s.disabled
173
175
  }
174
176
  ),
175
177
  o && /* @__PURE__ */ e(
@@ -187,12 +189,12 @@ const Fe = ({
187
189
  }
188
190
  )
189
191
  ] }),
190
- b && /* @__PURE__ */ e("div", { className: "absolute top-0 inset-0 w-full h-full bg-white/80 flex items-center justify-center", children: /* @__PURE__ */ s("div", { className: "flex flex-col items-center gap-3", children: [
192
+ b && /* @__PURE__ */ e("div", { className: "absolute top-0 inset-0 w-full h-full bg-white/80 flex items-center justify-center", children: /* @__PURE__ */ a("div", { className: "flex flex-col items-center gap-3", children: [
191
193
  /* @__PURE__ */ e("div", { className: "animate-spin rounded-full h-8 w-8 border-b-2 border-text-brand-secondary" }),
192
194
  /* @__PURE__ */ e("p", { className: "text-text-neutral-primary font-medium", children: "Loading..." })
193
195
  ] }) })
194
196
  ] });
195
197
  };
196
198
  export {
197
- Fe as default
199
+ we as default
198
200
  };
@@ -1,6 +1,6 @@
1
1
  import { default as React } from 'react';
2
2
  import { TableProps, TableSchema, TableSearch, TableSort } from '../table/table.type';
3
- import { TableFilter, FilterSchema } from '../table-filter/table-filter.type';
3
+ import { TableFilter, FilterRule, FilterSchema } from '../table-filter/table-filter.type';
4
4
  import { PaginationProps, PaginationInfoProps, PaginationQuickJumperProps } from '../table/components/pagination/pagination.type';
5
5
  export interface TableCardProps {
6
6
  dataSource: Record<string, unknown>[];
@@ -17,6 +17,7 @@ export interface TableCardProps {
17
17
  quickFilters?: string[];
18
18
  showFilterButton?: boolean;
19
19
  filterSchema: FilterSchema;
20
+ onDynamicChange?: (filters: FilterRule[]) => void;
20
21
  };
21
22
  headerLeftContent?: React.ReactNode;
22
23
  headerActions?: React.ReactNode;
@@ -1,25 +1,21 @@
1
- import { jsx as e, jsxs as l } from "react/jsx-runtime";
2
- import { useEffect as n } from "react";
3
- const d = ["equals", "notEqual"], u = ({ value: t, onChange: s }) => {
4
- n(() => {
5
- t.condition || s({ condition: d[0] });
6
- }, []);
7
- const i = (r, a) => {
8
- s(a ? { value: r } : { value: "" });
1
+ import { jsx as r, jsxs as t } from "react/jsx-runtime";
2
+ const c = ({ value: e, onChange: l }) => {
3
+ const i = (s, d) => {
4
+ l(d ? { value: s } : { value: "" });
9
5
  };
10
- return /* @__PURE__ */ e("div", { className: "w-full", children: /* @__PURE__ */ l("div", { className: "p-4 space-y-3", children: [
11
- /* @__PURE__ */ l("label", { className: "flex items-center p-3 rounded-lg border border-stroke-solid-light hover:border-stroke-solid-medium hover:bg-gray-50 transition-all duration-200 cursor-pointer group", children: [
12
- /* @__PURE__ */ l("div", { className: "relative", children: [
13
- /* @__PURE__ */ e(
6
+ return /* @__PURE__ */ r("div", { className: "w-full", children: /* @__PURE__ */ t("div", { className: "p-4 space-y-3", children: [
7
+ /* @__PURE__ */ t("label", { className: "flex items-center p-3 rounded-lg border border-stroke-solid-light hover:border-stroke-solid-medium hover:bg-gray-50 transition-all duration-200 cursor-pointer group", children: [
8
+ /* @__PURE__ */ t("div", { className: "relative", children: [
9
+ /* @__PURE__ */ r(
14
10
  "input",
15
11
  {
16
12
  type: "checkbox",
17
- checked: t.value === "true",
18
- onChange: (r) => i("true", r.target.checked),
13
+ checked: (e == null ? void 0 : e.value) === "true",
14
+ onChange: (s) => i("true", s.target.checked),
19
15
  className: "w-5 h-5 rounded border-2 border-stroke-solid-medium text-blue-600 focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 transition-colors duration-200"
20
16
  }
21
17
  ),
22
- t.value === "true" && /* @__PURE__ */ e("div", { className: "absolute inset-0 flex items-center justify-center", children: /* @__PURE__ */ e("svg", { className: "w-3 h-3 text-white", fill: "currentColor", viewBox: "0 0 20 20", children: /* @__PURE__ */ e(
18
+ (e == null ? void 0 : e.value) === "true" && /* @__PURE__ */ r("div", { className: "absolute inset-0 flex items-center justify-center", children: /* @__PURE__ */ r("svg", { className: "w-3 h-3 text-white", fill: "currentColor", viewBox: "0 0 20 20", children: /* @__PURE__ */ r(
23
19
  "path",
24
20
  {
25
21
  fillRule: "evenodd",
@@ -28,26 +24,26 @@ const d = ["equals", "notEqual"], u = ({ value: t, onChange: s }) => {
28
24
  }
29
25
  ) }) })
30
26
  ] }),
31
- /* @__PURE__ */ l("div", { className: "ml-3 flex-1", children: [
32
- /* @__PURE__ */ l("div", { className: "flex items-center", children: [
33
- /* @__PURE__ */ e("span", { className: "text-sm font-medium text-text-neutral-primary", children: "True" }),
34
- t.value === "true" && /* @__PURE__ */ e("span", { className: "ml-2 inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium bg-green-100 text-green-800", children: "Selected" })
27
+ /* @__PURE__ */ t("div", { className: "ml-3 flex-1", children: [
28
+ /* @__PURE__ */ t("div", { className: "flex items-center", children: [
29
+ /* @__PURE__ */ r("span", { className: "text-sm font-medium text-text-neutral-primary", children: "True" }),
30
+ (e == null ? void 0 : e.value) === "true" && /* @__PURE__ */ r("span", { className: "ml-2 inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium bg-green-100 text-green-800", children: "Selected" })
35
31
  ] }),
36
- /* @__PURE__ */ e("p", { className: "text-xs text-text-neutral-secondary mt-0.5", children: "Include records with true values" })
32
+ /* @__PURE__ */ r("p", { className: "text-xs text-text-neutral-secondary mt-0.5", children: "Include records with true values" })
37
33
  ] })
38
34
  ] }),
39
- /* @__PURE__ */ l("label", { className: "flex items-center p-3 rounded-lg border border-stroke-solid-light hover:border-stroke-solid-medium hover:bg-gray-50 transition-all duration-200 cursor-pointer group", children: [
40
- /* @__PURE__ */ l("div", { className: "relative", children: [
41
- /* @__PURE__ */ e(
35
+ /* @__PURE__ */ t("label", { className: "flex items-center p-3 rounded-lg border border-stroke-solid-light hover:border-stroke-solid-medium hover:bg-gray-50 transition-all duration-200 cursor-pointer group", children: [
36
+ /* @__PURE__ */ t("div", { className: "relative", children: [
37
+ /* @__PURE__ */ r(
42
38
  "input",
43
39
  {
44
40
  type: "checkbox",
45
- checked: t.value === "false",
46
- onChange: (r) => i("false", r.target.checked),
41
+ checked: (e == null ? void 0 : e.value) === "false",
42
+ onChange: (s) => i("false", s.target.checked),
47
43
  className: "w-5 h-5 rounded border-2 border-stroke-solid-medium text-blue-600 focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 transition-colors duration-200"
48
44
  }
49
45
  ),
50
- t.value === "false" && /* @__PURE__ */ e("div", { className: "absolute inset-0 flex items-center justify-center", children: /* @__PURE__ */ e("svg", { className: "w-3 h-3 text-white", fill: "currentColor", viewBox: "0 0 20 20", children: /* @__PURE__ */ e(
46
+ (e == null ? void 0 : e.value) === "false" && /* @__PURE__ */ r("div", { className: "absolute inset-0 flex items-center justify-center", children: /* @__PURE__ */ r("svg", { className: "w-3 h-3 text-white", fill: "currentColor", viewBox: "0 0 20 20", children: /* @__PURE__ */ r(
51
47
  "path",
52
48
  {
53
49
  fillRule: "evenodd",
@@ -56,16 +52,16 @@ const d = ["equals", "notEqual"], u = ({ value: t, onChange: s }) => {
56
52
  }
57
53
  ) }) })
58
54
  ] }),
59
- /* @__PURE__ */ l("div", { className: "ml-3 flex-1", children: [
60
- /* @__PURE__ */ l("div", { className: "flex items-center", children: [
61
- /* @__PURE__ */ e("span", { className: "text-sm font-medium text-text-neutral-primary", children: "False" }),
62
- t.value === "false" && /* @__PURE__ */ e("span", { className: "ml-2 inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium bg-red-100 text-red-800", children: "Selected" })
55
+ /* @__PURE__ */ t("div", { className: "ml-3 flex-1", children: [
56
+ /* @__PURE__ */ t("div", { className: "flex items-center", children: [
57
+ /* @__PURE__ */ r("span", { className: "text-sm font-medium text-text-neutral-primary", children: "False" }),
58
+ (e == null ? void 0 : e.value) === "false" && /* @__PURE__ */ r("span", { className: "ml-2 inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium bg-red-100 text-red-800", children: "Selected" })
63
59
  ] }),
64
- /* @__PURE__ */ e("p", { className: "text-xs text-text-neutral-secondary mt-0.5", children: "Include records with false values" })
60
+ /* @__PURE__ */ r("p", { className: "text-xs text-text-neutral-secondary mt-0.5", children: "Include records with false values" })
65
61
  ] })
66
62
  ] })
67
63
  ] }) });
68
64
  };
69
65
  export {
70
- u as default
66
+ c as default
71
67
  };
@@ -1,63 +1,61 @@
1
- import { jsx as t, jsxs as s } from "react/jsx-runtime";
2
- import { useState as i, useEffect as f } from "react";
1
+ import { jsx as t, jsxs as r } from "react/jsx-runtime";
2
+ import { useState as i, useEffect as N } from "react";
3
3
  import { Virtuoso as k } from "react-virtuoso";
4
4
  import { MagnifierIcon as y } from "../../assets/icons/magnifier-icon.js";
5
5
  import S from "../../assets/icons/x.js";
6
6
  import { Z2Checkbox as w } from "../../checkbox/checkbox.js";
7
- const V = ["includesAny", "includesAll", "excludes"], I = ({ value: r, onChange: d, filterOptions: n = [] }) => {
8
- const [c, o] = i([]), [u, m] = i(""), [x, h] = i(n), p = (l) => {
7
+ const E = ({ value: s, onChange: h, filterOptions: n = [] }) => {
8
+ const [o, c] = i([]), [d, m] = i(""), [f, u] = i(n), x = (l) => {
9
9
  m(l.target.value);
10
10
  const e = n.filter(
11
11
  (a) => a.label.toLowerCase().includes(l.target.value.toLowerCase())
12
12
  );
13
- h(e);
13
+ u(e);
14
14
  };
15
- f(() => {
16
- r.condition || d({ condition: V[0] });
17
- }, []), f(() => {
18
- Array.isArray(r.value) ? o(r.value.filter(Boolean)) : o([]);
19
- }, [r.value]);
20
- const b = (l, e) => {
15
+ N(() => {
16
+ s && Array.isArray(s.value) ? c(s.value.filter(Boolean) ?? []) : c([]);
17
+ }, [s]);
18
+ const p = (l, e) => {
21
19
  let a;
22
- e ? a = [...c, l] : a = c.filter((g) => g !== l), o(a), d({ value: a });
23
- }, v = () => {
24
- m(""), h(n);
25
- }, C = (l) => c.includes(l), N = (l, e) => /* @__PURE__ */ s("div", { className: "flex justify-between items-center py-2 px-3", children: [
26
- /* @__PURE__ */ s("label", { className: "flex items-center space-x-2 cursor-pointer", children: [
20
+ e ? a = [...o, l] : a = o.filter((v) => v !== l), c(a), h({ value: a });
21
+ }, b = () => {
22
+ m(""), u(n);
23
+ }, C = (l) => o.includes(l), g = (l, e) => /* @__PURE__ */ r("div", { className: "flex justify-between items-center py-2 px-3", children: [
24
+ /* @__PURE__ */ r("label", { className: "flex items-center space-x-2 cursor-pointer", children: [
27
25
  /* @__PURE__ */ t(
28
26
  w,
29
27
  {
30
28
  checked: C(e.value),
31
- onCheckedChange: (a) => b(e.value, a === !0)
29
+ onCheckedChange: (a) => p(e.value, a === !0)
32
30
  }
33
31
  ),
34
32
  /* @__PURE__ */ t("span", { className: "text-text-neutral-primary leading-none-medium-sm", children: e.label })
35
33
  ] }),
36
- e.total && /* @__PURE__ */ s("span", { className: "text-text-neutral-muted text-sm", children: [
34
+ e.total && /* @__PURE__ */ r("span", { className: "text-text-neutral-muted text-sm", children: [
37
35
  "[",
38
36
  e.total,
39
37
  "]"
40
38
  ] })
41
39
  ] });
42
- return n.length === 0 ? /* @__PURE__ */ t("div", { className: "text-text-neutral-muted text-sm p-4", children: "No filter options available for this column" }) : /* @__PURE__ */ s("div", { className: "flex flex-col h-full", children: [
43
- /* @__PURE__ */ s("div", { className: "relative border-b border-stroke-solid-medium", children: [
40
+ return n.length === 0 ? /* @__PURE__ */ t("div", { className: "text-text-neutral-muted text-sm p-4", children: "No filter options available for this column" }) : /* @__PURE__ */ r("div", { className: "flex flex-col h-full", children: [
41
+ /* @__PURE__ */ r("div", { className: "relative border-b border-stroke-solid-medium", children: [
44
42
  /* @__PURE__ */ t(y, { className: "absolute left-3 top-3.5 text-text-neutral-muted" }),
45
43
  /* @__PURE__ */ t(
46
44
  "input",
47
45
  {
48
46
  placeholder: "Search options",
49
- value: u,
50
- onChange: p,
47
+ value: d,
48
+ onChange: x,
51
49
  className: "border-none outline-none bg-surface-neutral-default text-text-neutral-primary rounded p-3 pl-8 leading-none-medium-sm w-full"
52
50
  }
53
51
  ),
54
- u && /* @__PURE__ */ t("span", { className: "absolute right-3 top-3.5", onClick: v, children: /* @__PURE__ */ t(S, {}) })
52
+ d && /* @__PURE__ */ t("span", { className: "absolute right-3 top-3.5", onClick: b, children: /* @__PURE__ */ t(S, {}) })
55
53
  ] }),
56
54
  /* @__PURE__ */ t("div", { className: "flex-1", children: /* @__PURE__ */ t(
57
55
  k,
58
56
  {
59
- data: x,
60
- itemContent: N,
57
+ data: f,
58
+ itemContent: g,
61
59
  className: "h-full min-h-60",
62
60
  style: { height: "100%" },
63
61
  overscan: 5
@@ -66,5 +64,5 @@ const V = ["includesAny", "includesAll", "excludes"], I = ({ value: r, onChange:
66
64
  ] });
67
65
  };
68
66
  export {
69
- I as default
67
+ E as default
70
68
  };
@@ -1,14 +1,5 @@
1
- interface UseNumberFilterProps {
2
- value: {
3
- condition: string;
4
- value: string;
5
- };
6
- onChange: (update: {
7
- condition?: string;
8
- value?: string;
9
- }) => void;
10
- }
11
- export declare const useNumberFilter: ({ value, onChange }: UseNumberFilterProps) => {
1
+ import { FilterComponentProps } from '../../table-filter.type';
2
+ export declare const useNumberFilter: ({ value, onChange }: FilterComponentProps) => {
12
3
  specificAmount: string;
13
4
  atLeast: string;
14
5
  noMoreThan: string;
@@ -20,4 +11,3 @@ export declare const useNumberFilter: ({ value, onChange }: UseNumberFilterProps
20
11
  resetAtLeast: () => void;
21
12
  resetNoMoreThan: () => void;
22
13
  };
23
- export {};
@@ -1,33 +1,33 @@
1
- import { useState as s, useEffect as l } from "react";
2
- const T = ({ value: t, onChange: i }) => {
3
- const [r, o] = s(""), [d, n] = s(""), [a, c] = s(""), f = r ? "specific" : d ? "atLeast" : a ? "noMoreThan" : null;
4
- return l(() => {
5
- t.condition === "=" && t.value ? (o(t.value), n(""), c("")) : t.condition === ">" && t.value ? (n(t.value), o(""), c("")) : t.condition === "<" && t.value && (c(t.value), o(""), n(""));
6
- }, [t.condition, t.value]), {
1
+ import { useState as e, useEffect as h } from "react";
2
+ const b = ({ value: t, onChange: o }) => {
3
+ const [r, n] = e(""), [d, c] = e(""), [f, s] = e(""), A = r ? "specific" : d ? "atLeast" : f ? "noMoreThan" : null;
4
+ return h(() => {
5
+ (t == null ? void 0 : t.condition) === "=" && (t != null && t.value) ? (n(t == null ? void 0 : t.value), c(""), s("")) : (t == null ? void 0 : t.condition) === ">" && (t != null && t.value) ? (c(t.value), n(""), s("")) : (t == null ? void 0 : t.condition) === "<" && (t != null && t.value) && (s(t.value), n(""), c(""));
6
+ }, [t == null ? void 0 : t.condition, t == null ? void 0 : t.value]), {
7
7
  specificAmount: r,
8
8
  atLeast: d,
9
- noMoreThan: a,
10
- activeField: f,
11
- handleSpecificAmountChange: (e) => {
12
- o(e), e ? (n(""), c(""), i({ condition: "=", value: e })) : i({ condition: "", value: "" });
9
+ noMoreThan: f,
10
+ activeField: A,
11
+ handleSpecificAmountChange: (i) => {
12
+ n(i), i ? (c(""), s(""), o({ condition: "=", value: i })) : o({ condition: "", value: "" });
13
13
  },
14
- handleAtLeastChange: (e) => {
15
- n(e), e ? (o(""), c(""), i({ condition: ">", value: e })) : i({ condition: "", value: "" });
14
+ handleAtLeastChange: (i) => {
15
+ c(i), i ? (n(""), s(""), o({ condition: ">", value: i })) : o({ condition: "", value: "" });
16
16
  },
17
- handleNoMoreThanChange: (e) => {
18
- c(e), e ? (o(""), n(""), i({ condition: "<", value: e })) : i({ condition: "", value: "" });
17
+ handleNoMoreThanChange: (i) => {
18
+ s(i), i ? (n(""), c(""), o({ condition: "<", value: i })) : o({ condition: "", value: "" });
19
19
  },
20
20
  resetSpecificAmount: () => {
21
- o(""), i({ condition: "", value: "" });
21
+ n(""), o({ condition: "", value: "" });
22
22
  },
23
23
  resetAtLeast: () => {
24
- n(""), i({ condition: "", value: "" });
24
+ c(""), o({ condition: "", value: "" });
25
25
  },
26
26
  resetNoMoreThan: () => {
27
- c(""), i({ condition: "", value: "" });
27
+ s(""), o({ condition: "", value: "" });
28
28
  }
29
29
  };
30
30
  };
31
31
  export {
32
- T as useNumberFilter
32
+ b as useNumberFilter
33
33
  };