@ztwoint/z-ui 0.1.69 → 0.1.70

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.
@@ -58,7 +58,7 @@ const w = ["includesAny", "includesAll", "excludes"], B = ({ value: r, onChange:
58
58
  {
59
59
  data: x,
60
60
  itemContent: N,
61
- className: "h-full",
61
+ className: "h-full min-h-60",
62
62
  style: { height: "100%" },
63
63
  overscan: 5
64
64
  }
@@ -1,19 +1,19 @@
1
1
  import { jsxs as l, jsx as t } from "react/jsx-runtime";
2
- import * as y from "react";
2
+ import * as C from "react";
3
3
  import * as m from "@radix-ui/react-popover";
4
4
  import { Button as u } from "../button/button.js";
5
5
  import { useTableFilterContext as I } from "./table-filter.context.js";
6
6
  import U from "./filters/text.js";
7
- import V from "./filters/boolean.js";
8
- import q from "./filters/number/number.js";
9
- import E from "./filters/checkbox.js";
10
- import G from "../assets/icons/circle-check-filled.js";
11
- import { SelectedFiltersDisplay as H } from "./selected-filters-display/selected-filters-display.js";
7
+ import H from "./filters/boolean.js";
8
+ import V from "./filters/number/number.js";
9
+ import q from "./filters/checkbox.js";
10
+ import E from "../assets/icons/circle-check-filled.js";
11
+ import { SelectedFiltersDisplay as G } from "./selected-filters-display/selected-filters-display.js";
12
12
  import { createFilterDisplayItems as J, calculateTotalCount as L } from "./selected-filters-display/selected-filters-display.utils.js";
13
13
  import { FilterConfirmationDialog as M } from "./close-filter-confirm/filter-confirmation-dialog.js";
14
14
  import { hasUnsavedFilterChanges as F } from "./close-filter-confirm/filter-confirmation-dialog.utils.js";
15
15
  const ne = () => {
16
- const [N, a] = y.useState(!1), [x, n] = y.useState(!1), {
16
+ const [N, a] = C.useState(!1), [x, n] = C.useState(!1), {
17
17
  selectedColumn: r,
18
18
  setSelectedColumn: k,
19
19
  getFilterForColumn: w,
@@ -25,10 +25,10 @@ const ne = () => {
25
25
  hasActiveFilters: d,
26
26
  tempFilters: i,
27
27
  filterSchema: c,
28
- filter: p,
29
- filterComponents: h = {}
28
+ filter: h,
29
+ filterComponents: p = {}
30
30
  } = I(), P = (e) => {
31
- !e && x ? F(i, p.value) ? a(!0) : n(!1) : n(e);
31
+ !e && x ? F(i, h.value) ? a(!0) : n(!1) : n(e);
32
32
  }, g = () => {
33
33
  O(), n(!1);
34
34
  }, S = () => {
@@ -37,30 +37,30 @@ const ne = () => {
37
37
  D(), a(!1), n(!1);
38
38
  }, $ = () => {
39
39
  a(!1);
40
- }, z = J(i, c), v = L(z), R = () => {
40
+ }, R = J(i, c), v = L(R), z = () => {
41
41
  if (!r) return null;
42
- const e = c.find((o) => o.filterKey === r), b = {
43
- boolean: V,
42
+ const e = c.find((s) => s.filterKey === r), b = {
43
+ boolean: H,
44
44
  string: U,
45
- number: q,
46
- checkbox: E
47
- }, C = (e == null ? void 0 : e.type) && (h == null ? void 0 : h[e.type]) || b[(e == null ? void 0 : e.type) ?? "string"];
48
- if (!C)
45
+ number: V,
46
+ checkbox: q
47
+ }, y = (e == null ? void 0 : e.type) && (p == null ? void 0 : p[e.type]) || b[(e == null ? void 0 : e.type) ?? "string"];
48
+ if (!y)
49
49
  return console.warn(
50
50
  `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".`
51
51
  ), null;
52
- const s = w(r), B = {
53
- condition: (s == null ? void 0 : s.condition) || "",
54
- value: (s == null ? void 0 : s.value) || ""
52
+ const o = w(r), B = {
53
+ condition: (o == null ? void 0 : o.condition) || "",
54
+ value: (o == null ? void 0 : o.value) || ""
55
55
  };
56
56
  return /* @__PURE__ */ t("div", { className: "flex-1 h-full", children: /* @__PURE__ */ t("div", { className: "mb-4 h-full", children: /* @__PURE__ */ t(
57
- C,
57
+ y,
58
58
  {
59
59
  value: B,
60
- onChange: ({ condition: o, value: f }) => j(r, o, f),
61
- filterOptions: e != null && e.options ? Object.entries(e.options).map(([o, f]) => ({
62
- label: o,
63
- value: o,
60
+ onChange: ({ condition: s, value: f }) => j(r, s, f),
61
+ filterOptions: e != null && e.options ? Object.entries(e.options).map(([s, f]) => ({
62
+ label: s,
63
+ value: s,
64
64
  total: f
65
65
  })) : void 0
66
66
  },
@@ -76,19 +76,19 @@ const ne = () => {
76
76
  size: "small",
77
77
  children: [
78
78
  "Filter ",
79
- d && `(${p.value.length})`
79
+ d && `(${h.value.length})`
80
80
  ]
81
81
  }
82
82
  ) }),
83
83
  /* @__PURE__ */ t(m.Portal, { children: /* @__PURE__ */ l(
84
84
  m.Content,
85
85
  {
86
- className: "z-10 w-[512px] bg-surface-neutral-default border border-stroke-solid-light rounded-2xl overflow-hidden shadow-lg",
86
+ className: "w-[512px] bg-surface-neutral-default border border-stroke-solid-light rounded-2xl overflow-hidden shadow-lg",
87
87
  sideOffset: 8,
88
88
  align: "start",
89
89
  children: [
90
- /* @__PURE__ */ l("div", { className: "flex h-[442px]", children: [
91
- /* @__PURE__ */ l("div", { className: "w-48 border-r border-stroke-solid-light p-2 flex flex-col gap-1.5", children: [
90
+ /* @__PURE__ */ l("div", { className: "flex h-[422px]", style: { maxHeight: "calc(100vh - 8rem)" }, children: [
91
+ /* @__PURE__ */ l("div", { className: "w-48 border-r border-stroke-solid-light p-2 flex flex-col gap-1.5 overflow-y-auto", children: [
92
92
  /* @__PURE__ */ t("div", { className: "p-2 pb-1", children: /* @__PURE__ */ t("h3", { className: "leading-none-medium-sm text-text-neutral-secondary", children: "Filters" }) }),
93
93
  c.map((e) => /* @__PURE__ */ l(
94
94
  "button",
@@ -97,16 +97,16 @@ const ne = () => {
97
97
  className: `w-full text-left p-2 text-sm flex items-center justify-between hover:bg-surface-neutral-hovered transition-colors rounded-lg ${r === e.filterKey ? "bg-surface-neutral-focused text-text-brand-primary" : "text-text-neutral-primary"}`,
98
98
  children: [
99
99
  /* @__PURE__ */ t("span", { className: "truncate", children: e.title }),
100
- K(e.filterKey) && /* @__PURE__ */ t(G, { className: "w-4 h-4 text-text-brand-secondary flex-shrink-0 ml-2" })
100
+ K(e.filterKey) && /* @__PURE__ */ t(E, { className: "w-4 h-4 text-text-brand-secondary flex-shrink-0 ml-2" })
101
101
  ]
102
102
  },
103
103
  e.filterKey
104
104
  ))
105
105
  ] }),
106
- /* @__PURE__ */ t("div", { className: "flex-1 flex flex-col", children: r ? 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
+ /* @__PURE__ */ t("div", { className: "flex-1 flex flex-col", children: r ? z() : /* @__PURE__ */ t("div", { className: "flex-1 flex items-center justify-center text-text-neutral-muted", children: "Select a column to configure its filter" }) })
107
107
  ] }),
108
108
  !!v && /* @__PURE__ */ l("div", { className: "flex justify-between items-end p-4 border-t border-stroke-solid-medium min-h-[71px]", children: [
109
- /* @__PURE__ */ t(H, { selectedFilters: i, schema: c }),
109
+ /* @__PURE__ */ t(G, { selectedFilters: i, schema: c }),
110
110
  /* @__PURE__ */ l("div", { className: "flex justify-end gap-2", children: [
111
111
  /* @__PURE__ */ t(u, { onClick: A, variant: "stroke", shade: "neutral", size: "small", children: "Clear All" }),
112
112
  /* @__PURE__ */ t(
@@ -131,7 +131,7 @@ const ne = () => {
131
131
  onKeepChanges: S,
132
132
  onRevertChanges: T,
133
133
  onApplyChanges: g,
134
- hasUnsavedChanges: F(i, p.value)
134
+ hasUnsavedChanges: F(i, h.value)
135
135
  }
136
136
  )
137
137
  ] });
@@ -28,19 +28,19 @@ const te = ({ filterName: t }) => {
28
28
  d(), s(!1);
29
29
  }, j = () => {
30
30
  r(!1), s(!1);
31
- }, z = () => {
32
- O(), r(!1), s(!1);
33
31
  }, D = () => {
32
+ O(), r(!1), s(!1);
33
+ }, K = () => {
34
34
  r(!1);
35
35
  }, e = P.find((o) => o.filterKey === t);
36
36
  if (!e)
37
37
  return console.warn(`Column "${t}" not found in schema`), null;
38
- const K = {
38
+ const R = {
39
39
  boolean: V,
40
40
  string: I,
41
41
  number: q,
42
42
  checkbox: E
43
- }, F = e.type && (c == null ? void 0 : c[e.type]) || K[e.type ?? "string"];
43
+ }, F = e.type && (c == null ? void 0 : c[e.type]) || R[e.type ?? "string"];
44
44
  if (!F)
45
45
  return console.warn(
46
46
  `No filter component found for column "${e.filterKey}" with type "${e.type}". Provide a custom filter component or use supported types: "string", "number", "boolean", "checkbox".`
@@ -49,10 +49,10 @@ const te = ({ filterName: t }) => {
49
49
  label: o,
50
50
  value: o,
51
51
  total: i
52
- })) : void 0, h = n ? H(n, b) : void 0, R = {
52
+ })) : void 0, h = n ? H(n, b) : void 0, S = {
53
53
  condition: (n == null ? void 0 : n.condition) || "",
54
54
  value: (n == null ? void 0 : n.value) || ""
55
- }, S = () => {
55
+ }, z = () => {
56
56
  C(t, "", ""), d(), s(!1);
57
57
  }, B = () => {
58
58
  d(), s(!1);
@@ -73,20 +73,20 @@ const te = ({ filterName: t }) => {
73
73
  /* @__PURE__ */ l(p.Portal, { children: /* @__PURE__ */ a(
74
74
  p.Content,
75
75
  {
76
- className: "z-10 w-80 bg-surface-neutral-default border border-stroke-solid-light rounded-2xl overflow-hidden shadow-lg",
76
+ className: "w-80 bg-surface-neutral-default border border-stroke-solid-light rounded-2xl overflow-hidden shadow-lg",
77
77
  sideOffset: 8,
78
78
  align: "start",
79
79
  children: [
80
80
  /* @__PURE__ */ l(
81
81
  F,
82
82
  {
83
- value: R,
83
+ value: S,
84
84
  onChange: ({ condition: o, value: i }) => C(t, o, i),
85
85
  filterOptions: b
86
86
  }
87
87
  ),
88
88
  !!h && /* @__PURE__ */ a("div", { className: "flex justify-between gap-2 p-3 border-t border-stroke-solid-medium", children: [
89
- /* @__PURE__ */ l(f, { onClick: S, variant: "stroke", shade: "neutral", size: "small", children: "Clear All" }),
89
+ /* @__PURE__ */ l(f, { onClick: z, variant: "stroke", shade: "neutral", size: "small", children: "Clear All" }),
90
90
  /* @__PURE__ */ l(f, { onClick: B, variant: "filled", shade: "neutral", size: "small", children: `Apply${h !== void 0 ? ` ${h}` : ""}` })
91
91
  ] })
92
92
  ]
@@ -95,9 +95,9 @@ const te = ({ filterName: t }) => {
95
95
  k && /* @__PURE__ */ l(
96
96
  J,
97
97
  {
98
- onClose: D,
98
+ onClose: K,
99
99
  onKeepChanges: j,
100
- onRevertChanges: z,
100
+ onRevertChanges: D,
101
101
  onApplyChanges: $,
102
102
  hasUnsavedChanges: x(
103
103
  t,