@ztwoint/z-ui 0.1.66 → 0.1.68

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.
@@ -0,0 +1,6 @@
1
+ import { SVGProps } from 'react';
2
+ type IconProps = SVGProps<SVGSVGElement> & {
3
+ title?: string;
4
+ };
5
+ declare function Sitemap({ fill, width, height, ...props }: IconProps): import("react/jsx-runtime").JSX.Element;
6
+ export default Sitemap;
@@ -0,0 +1,6 @@
1
+ import { SVGProps } from 'react';
2
+ type IconProps = SVGProps<SVGSVGElement> & {
3
+ title?: string;
4
+ };
5
+ declare function Z2Data({ fill, width, height, ...props }: IconProps): import("react/jsx-runtime").JSX.Element;
6
+ export default Z2Data;
@@ -1,29 +1,47 @@
1
1
  import { jsx as t, jsxs as s } from "react/jsx-runtime";
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";
5
- const k = ["includesAny", "includesAll", "excludes"], j = ({ value: r, onChange: d, filterOptions: c = [] }) => {
6
- const [n, o] = i([]), [u, m] = i(""), [x, f] = i(c), p = (e) => {
7
- m(e.target.value);
8
- const a = c.filter(
9
- (l) => l.label.toLowerCase().includes(e.target.value.toLowerCase())
2
+ import { useState as i, useEffect as f } from "react";
3
+ import { Virtuoso as y } from "react-virtuoso";
4
+ import { MagnifierIcon as k } from "../../assets/icons/magnifier-icon.js";
5
+ import S from "../../assets/icons/x.js";
6
+ const w = ["includesAny", "includesAll", "excludes"], B = ({ value: r, onChange: d, filterOptions: n = [] }) => {
7
+ const [c, o] = i([]), [u, m] = i(""), [x, h] = i(n), p = (l) => {
8
+ m(l.target.value);
9
+ const e = n.filter(
10
+ (a) => a.label.toLowerCase().includes(l.target.value.toLowerCase())
10
11
  );
11
- f(a);
12
+ h(e);
12
13
  };
13
- h(() => {
14
- r.condition || d({ condition: k[0] });
15
- }, []), h(() => {
14
+ f(() => {
15
+ r.condition || d({ condition: w[0] });
16
+ }, []), f(() => {
16
17
  Array.isArray(r.value) ? o(r.value.filter(Boolean)) : o([]);
17
18
  }, [r.value]);
18
- const v = (e, a) => {
19
- let l;
20
- a ? l = [...n, e] : l = n.filter((g) => g !== e), o(l), d({ value: l });
21
- }, b = () => {
22
- m(""), f(c);
23
- }, N = (e) => n.includes(e);
24
- return c.length === 0 ? /* @__PURE__ */ t("div", { className: "text-text-neutral-muted text-sm", children: "No filter options available for this column" }) : /* @__PURE__ */ s("div", { className: "flex flex-col", children: [
19
+ const b = (l, e) => {
20
+ let a;
21
+ e ? a = [...c, l] : a = c.filter((C) => C !== l), o(a), d({ value: a });
22
+ }, v = () => {
23
+ m(""), h(n);
24
+ }, g = (l) => c.includes(l), N = (l, e) => /* @__PURE__ */ s("div", { className: "flex justify-between items-center py-2 px-3", children: [
25
+ /* @__PURE__ */ s("label", { className: "flex items-center space-x-2 cursor-pointer", children: [
26
+ /* @__PURE__ */ t(
27
+ "input",
28
+ {
29
+ type: "checkbox",
30
+ checked: g(e.value),
31
+ onChange: (a) => b(e.value, a.target.checked)
32
+ }
33
+ ),
34
+ /* @__PURE__ */ t("span", { className: "text-text-neutral-primary leading-none-medium-sm", children: e.label })
35
+ ] }),
36
+ e.total && /* @__PURE__ */ s("span", { className: "text-text-neutral-muted text-sm", children: [
37
+ "[",
38
+ e.total,
39
+ "]"
40
+ ] })
41
+ ] });
42
+ return n.length === 0 ? /* @__PURE__ */ t("div", { className: "text-text-neutral-muted text-sm", children: "No filter options available for this column" }) : /* @__PURE__ */ s("div", { className: "flex flex-col h-full", children: [
25
43
  /* @__PURE__ */ s("div", { className: "relative border-b border-stroke-solid-medium", children: [
26
- /* @__PURE__ */ t(y, { className: "absolute left-3 top-3.5 text-text-neutral-muted" }),
44
+ /* @__PURE__ */ t(k, { className: "absolute left-3 top-3.5 text-text-neutral-muted" }),
27
45
  /* @__PURE__ */ t(
28
46
  "input",
29
47
  {
@@ -33,28 +51,20 @@ const k = ["includesAny", "includesAll", "excludes"], j = ({ value: r, onChange:
33
51
  className: "border-none outline-none bg-surface-neutral-default text-text-neutral-primary rounded p-3 pl-8 leading-none-medium-sm w-full"
34
52
  }
35
53
  ),
36
- u && /* @__PURE__ */ t("span", { className: "absolute right-3 top-3.5", onClick: b, children: /* @__PURE__ */ t(C, {}) })
54
+ u && /* @__PURE__ */ t("span", { className: "absolute right-3 top-3.5", onClick: v, children: /* @__PURE__ */ t(S, {}) })
37
55
  ] }),
38
- /* @__PURE__ */ t("div", { className: "flex flex-col p-3", children: /* @__PURE__ */ t("div", { className: "space-y-5 h-full overflow-y-auto", children: x.map((e) => /* @__PURE__ */ s("div", { className: "flex justify-between items-center", children: [
39
- /* @__PURE__ */ s("label", { className: "flex items-center space-x-2 cursor-pointer", children: [
40
- /* @__PURE__ */ t(
41
- "input",
42
- {
43
- type: "checkbox",
44
- checked: N(e.value),
45
- onChange: (a) => v(e.value, a.target.checked)
46
- }
47
- ),
48
- /* @__PURE__ */ t("span", { className: "text-text-neutral-primary leading-none-medium-sm", children: e.label })
49
- ] }),
50
- e.total && /* @__PURE__ */ s("span", { className: "text-text-neutral-muted text-sm", children: [
51
- "[",
52
- e.total,
53
- "]"
54
- ] })
55
- ] }, e.value)) }) })
56
+ /* @__PURE__ */ t("div", { className: "flex-1", children: /* @__PURE__ */ t(
57
+ y,
58
+ {
59
+ data: x,
60
+ itemContent: N,
61
+ className: "h-full",
62
+ style: { height: "100%" },
63
+ overscan: 5
64
+ }
65
+ ) })
56
66
  ] });
57
67
  };
58
68
  export {
59
- j as default
69
+ B as default
60
70
  };
@@ -25,13 +25,13 @@ const ne = () => {
25
25
  hasActiveFilters: d,
26
26
  tempFilters: i,
27
27
  filterSchema: c,
28
- filter: p,
29
- filterComponents: f = {}
28
+ filter: f,
29
+ filterComponents: p = {}
30
30
  } = I();
31
31
  H(g, () => {
32
- C(i, p.value) && m ? n(!0) : a(!1);
32
+ C(i, f.value) && m ? n(!0) : a(!1);
33
33
  });
34
- const v = () => {
34
+ const b = () => {
35
35
  D(), a(!1);
36
36
  }, S = () => {
37
37
  n(!1), a(!1);
@@ -39,14 +39,14 @@ const ne = () => {
39
39
  A(), n(!1), a(!1);
40
40
  }, R = () => {
41
41
  n(!1);
42
- }, T = J(i, c), b = L(T), $ = () => {
42
+ }, T = J(i, c), v = L(T), $ = () => {
43
43
  if (!r) return null;
44
44
  const e = c.find((o) => o.filterKey === r), z = {
45
45
  boolean: U,
46
46
  string: P,
47
47
  number: V,
48
48
  checkbox: q
49
- }, y = (e == null ? void 0 : e.type) && (f == null ? void 0 : f[e.type]) || z[(e == null ? void 0 : e.type) ?? "string"];
49
+ }, y = (e == null ? void 0 : e.type) && (p == null ? void 0 : p[e.type]) || z[(e == null ? void 0 : e.type) ?? "string"];
50
50
  if (!y)
51
51
  return console.warn(
52
52
  `No filter component found for column "${e == null ? void 0 : e.filterKey}" with type "${e == null ? void 0 : e.type}". Provide a custom filter component or use supported types: "string", "number", "boolean", "checkbox".`
@@ -55,7 +55,7 @@ const ne = () => {
55
55
  condition: (s == null ? void 0 : s.condition) || "",
56
56
  value: (s == null ? void 0 : s.value) || ""
57
57
  };
58
- return /* @__PURE__ */ t("div", { className: "flex-1", children: /* @__PURE__ */ t("div", { className: "mb-4", children: /* @__PURE__ */ t("div", { className: "", children: /* @__PURE__ */ t(
58
+ return /* @__PURE__ */ t("div", { className: "flex-1 h-full", children: /* @__PURE__ */ t("div", { className: "mb-4 h-full", children: /* @__PURE__ */ t(
59
59
  y,
60
60
  {
61
61
  value: B,
@@ -67,7 +67,7 @@ const ne = () => {
67
67
  })) : void 0
68
68
  },
69
69
  r
70
- ) }) }) });
70
+ ) }) });
71
71
  };
72
72
  return /* @__PURE__ */ l("div", { className: "relative", ref: g, children: [
73
73
  /* @__PURE__ */ l(
@@ -81,12 +81,12 @@ const ne = () => {
81
81
  size: "small",
82
82
  children: [
83
83
  "Filter ",
84
- d && `(${p.value.length})`
84
+ d && `(${f.value.length})`
85
85
  ]
86
86
  }
87
87
  ),
88
88
  m && /* @__PURE__ */ l("div", { className: "absolute top-full left-0 mt-2 w-[512px] bg-surface-neutral-default border border-stroke-solid-light rounded-2xl z-10 overflow-hidden shadow-lg", children: [
89
- /* @__PURE__ */ l("div", { className: "flex min-h-[442px]", children: [
89
+ /* @__PURE__ */ l("div", { className: "flex h-[442px]", children: [
90
90
  /* @__PURE__ */ l("div", { className: "w-48 border-r border-stroke-solid-light p-2 flex flex-col gap-1.5", children: [
91
91
  /* @__PURE__ */ t("div", { className: "p-2 pb-1", children: /* @__PURE__ */ t("h3", { className: "leading-none-medium-sm text-text-neutral-secondary", children: "Filters" }) }),
92
92
  c.map((e) => /* @__PURE__ */ l(
@@ -104,18 +104,18 @@ const ne = () => {
104
104
  ] }),
105
105
  /* @__PURE__ */ t("div", { className: "flex-1 flex flex-col", children: r ? $() : /* @__PURE__ */ t("div", { className: "flex-1 flex items-center justify-center text-text-neutral-muted", children: "Select a column to configure its filter" }) })
106
106
  ] }),
107
- !!b && /* @__PURE__ */ l("div", { className: "flex justify-between items-end p-4 border-t border-stroke-solid-medium min-h-[71px]", children: [
107
+ !!v && /* @__PURE__ */ l("div", { className: "flex justify-between items-end p-4 border-t border-stroke-solid-medium min-h-[71px]", children: [
108
108
  /* @__PURE__ */ t(G, { selectedFilters: i, schema: c }),
109
109
  /* @__PURE__ */ l("div", { className: "flex justify-end gap-2", children: [
110
110
  /* @__PURE__ */ t(x, { onClick: j, variant: "stroke", shade: "neutral", size: "small", children: "Clear All" }),
111
111
  /* @__PURE__ */ t(
112
112
  x,
113
113
  {
114
- onClick: v,
114
+ onClick: b,
115
115
  variant: "filled",
116
116
  shade: "neutral",
117
117
  size: "small",
118
- children: `Apply ${b || ""}`
118
+ children: `Apply ${v || ""}`
119
119
  }
120
120
  )
121
121
  ] })
@@ -127,8 +127,8 @@ const ne = () => {
127
127
  onClose: R,
128
128
  onKeepChanges: S,
129
129
  onRevertChanges: O,
130
- onApplyChanges: v,
131
- hasUnsavedChanges: C(i, p.value)
130
+ onApplyChanges: b,
131
+ hasUnsavedChanges: C(i, f.value)
132
132
  }
133
133
  )
134
134
  ] });