@konstructio/ui 0.1.2-alpha.24 → 0.1.2-alpha.26

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.
@@ -1,145 +1,137 @@
1
- import { jsxs as z, jsx as r } from "react/jsx-runtime";
2
- import { S as A } from "../../../../index-BtQfgaSF.js";
3
- import { d as H } from "../../../../debounce-BFejQm9P.js";
4
- import { forwardRef as V, useRef as y, useState as Z, useImperativeHandle as B, useCallback as G, useEffect as J } from "react";
5
- import { Loading as K } from "../../../Loading/Loading.js";
6
- import { cn as i } from "../../../../utils/index.js";
7
- import { useNavigationUlList as Q } from "../../hooks/useNavigationList.js";
8
- import { ListItem as L } from "../ListItem/ListItem.js";
9
- import { listVariants as R } from "./List.variants.js";
10
- import { DEFAULT_LIST_SIZE as W } from "../../constants/pagination.js";
11
- import { useDropdownContext as X } from "../../contexts/dropdown.hook.js";
12
- const ie = V(
1
+ import { jsxs as H, jsx as o } from "react/jsx-runtime";
2
+ import { S as V } from "../../../../index-BtQfgaSF.js";
3
+ import { d as Z } from "../../../../debounce-BFejQm9P.js";
4
+ import { forwardRef as B, useRef as w, useState as G, useImperativeHandle as J, useMemo as K, useEffect as M } from "react";
5
+ import { Loading as Q } from "../../../Loading/Loading.js";
6
+ import { cn as a } from "../../../../utils/index.js";
7
+ import { useNavigationUlList as R } from "../../hooks/useNavigationList.js";
8
+ import { ListItem as v } from "../ListItem/ListItem.js";
9
+ import { listVariants as W } from "./List.variants.js";
10
+ import { DEFAULT_LIST_SIZE as X } from "../../constants/pagination.js";
11
+ import { useDropdownContext as Y } from "../../contexts/dropdown.hook.js";
12
+ const ue = B(
13
13
  ({
14
14
  additionalOptions: k,
15
15
  className: C,
16
- inputRef: c,
17
- isLoading: N,
18
- itemClassName: f,
19
- name: F,
20
- searchable: x = !1,
21
- listItemSecondRowClassName: u,
16
+ inputRef: i,
17
+ isLoading: F,
18
+ itemClassName: l,
19
+ name: N,
20
+ searchable: b = !1,
21
+ listItemSecondRowClassName: c,
22
22
  wrapperInputRef: I,
23
- isInfiniteScrollEnabled: m,
24
- onFetchMoreOptions: n
25
- }, j) => {
26
- const a = y(null), p = y(null), [g, w] = Z(!1), {
27
- isOpen: E,
28
- searchTerm: l,
29
- canFilter: O,
30
- canContinueFetching: o,
31
- page: d,
32
- options: h,
23
+ isInfiniteScrollEnabled: u,
24
+ onFetchMoreOptions: f
25
+ }, O) => {
26
+ const s = w(null), m = w(null), [p, L] = G(!1), {
27
+ isOpen: T,
28
+ searchTerm: g,
29
+ canFilter: j,
30
+ canContinueFetching: n,
31
+ page: E,
32
+ options: x,
33
+ isTyping: y,
33
34
  setOptions: P,
34
35
  setPage: S,
35
- setCanContinueFetching: T
36
- } = X();
37
- B(j, () => a.current, [a]);
38
- const b = x && O ? h.filter((e) => {
39
- const t = l.toLowerCase();
36
+ setCanContinueFetching: D
37
+ } = Y();
38
+ J(O, () => s.current, [s]);
39
+ const d = b && j ? x.filter((e) => {
40
+ const t = g.toLowerCase();
40
41
  return (typeof e.label == "string" ? e.label.toLowerCase() : "").includes(t);
41
- }) : h;
42
- Q({
43
- ulRef: a,
42
+ }) : x;
43
+ R({
44
+ ulRef: s,
44
45
  wrapperInputRef: I,
45
- searchable: x,
46
- filteredOptions: b
46
+ searchable: b,
47
+ filteredOptions: d
47
48
  });
48
- const D = b.filter(
49
- (e, t, s) => t === s.findIndex((v) => v.value === e.value)
50
- ), U = b.length === 0, _ = G(
51
- H(async (e) => {
49
+ const U = d.filter(
50
+ (e, t, r) => t === r.findIndex((h) => h.value === e.value)
51
+ ), _ = d.length === 0, q = K(
52
+ () => Z(async (e) => {
52
53
  const [t] = e;
53
- if (t.isIntersecting)
54
+ if (t.isIntersecting && !p && f && n)
54
55
  try {
55
- if (n && !g && o) {
56
- w(!0);
57
- const s = d + 1, { data: v, hasMore: q } = await n({
58
- page: s,
59
- pageSize: W,
60
- termOfSearch: l
61
- });
62
- S(s), T(q), P([...h, ...v]);
63
- }
56
+ L(!0);
57
+ const r = E + 1, { data: h, hasMore: z } = await f({
58
+ page: r,
59
+ pageSize: X,
60
+ termOfSearch: g
61
+ });
62
+ S(r), D(z), P((A) => [...A, ...h]);
64
63
  } catch {
65
64
  console.error("Error fetching more options");
66
65
  } finally {
67
- w(!1);
66
+ L(!1);
68
67
  }
69
68
  }, 100),
70
- [d, n, l, o, g]
69
+ [p, f, g]
71
70
  );
72
- return J(() => {
73
- if (m && o && p.current) {
74
- const e = new IntersectionObserver(_, {
71
+ return M(() => {
72
+ if (u && n && m.current && !y) {
73
+ const e = new IntersectionObserver(q, {
75
74
  threshold: 0.1
76
75
  });
77
- return e.observe(p.current), () => e.disconnect();
76
+ return e.observe(m.current), () => e.disconnect();
78
77
  }
79
- }, [
80
- d,
81
- l,
82
- m,
83
- n,
84
- o,
85
- g
86
- ]), /* @__PURE__ */ z(
78
+ }, [u, n, p, y]), /* @__PURE__ */ H(
87
79
  "ul",
88
80
  {
89
- ref: a,
90
- title: F,
81
+ ref: s,
82
+ title: N,
91
83
  role: "listbox",
92
- className: i(R({ className: C })),
93
- "data-state": E ? "open" : "closed",
84
+ className: a(W({ className: C })),
85
+ "data-state": T ? "open" : "closed",
94
86
  children: [
95
- N ? /* @__PURE__ */ r(
96
- L,
87
+ F ? /* @__PURE__ */ o(
88
+ v,
97
89
  {
98
- className: i("select-none", f),
90
+ className: a("select-none", l),
99
91
  isClickable: !1,
100
- inputRef: c,
92
+ inputRef: i,
101
93
  value: "Loading...",
102
94
  label: "Loading...",
103
- listItemSecondRowClassName: u
95
+ listItemSecondRowClassName: c
104
96
  }
105
- ) : U ? /* @__PURE__ */ r(
106
- L,
97
+ ) : _ ? /* @__PURE__ */ o(
98
+ v,
107
99
  {
108
- className: i("select-none", f),
100
+ className: a("select-none", l),
109
101
  isClickable: !1,
110
- inputRef: c,
102
+ inputRef: i,
111
103
  value: "No options",
112
104
  label: "No options",
113
- listItemSecondRowClassName: u
105
+ listItemSecondRowClassName: c
114
106
  }
115
- ) : D.map((e) => /* @__PURE__ */ r(
116
- L,
107
+ ) : U.map((e) => /* @__PURE__ */ o(
108
+ v,
117
109
  {
118
- className: i("select-none", f),
110
+ className: a("select-none", l),
119
111
  isClickable: !0,
120
- inputRef: c,
121
- listItemSecondRowClassName: u,
112
+ inputRef: i,
113
+ listItemSecondRowClassName: c,
122
114
  ...e
123
115
  },
124
116
  e.value
125
117
  )),
126
- m && o && /* @__PURE__ */ r(
118
+ u && n && /* @__PURE__ */ o(
127
119
  "li",
128
120
  {
129
- ref: p,
121
+ ref: m,
130
122
  role: "option",
131
123
  "data-action": "true",
132
124
  className: "flex items-center justify-center py-3",
133
125
  onClick: (e) => e.stopPropagation(),
134
- children: /* @__PURE__ */ r(K, { className: "w-4 h-4 text-aurora-500 select-none" })
126
+ children: /* @__PURE__ */ o(Q, { className: "w-4 h-4 text-aurora-500 select-none" })
135
127
  }
136
128
  ),
137
- k?.map((e, t) => /* @__PURE__ */ r("li", { role: "option", "data-action": "true", children: /* @__PURE__ */ r(A, { className: "flex p-2 w-full h-full gap-1 items-center text-sm [&>svg]:w-3.5 [&>svg]:h-3.5 [&>svg]:shrink-0 cursor-pointer select-none hover:bg-gray-50 hover:dark:bg-slate-700 focus:outline-0", children: e }) }, t))
129
+ k?.map((e, t) => /* @__PURE__ */ o("li", { role: "option", "data-action": "true", children: /* @__PURE__ */ o(V, { className: "flex p-2 w-full h-full gap-1 items-center text-sm [&>svg]:w-3.5 [&>svg]:h-3.5 [&>svg]:shrink-0 cursor-pointer select-none hover:bg-gray-50 hover:dark:bg-slate-700 focus:outline-0", children: e }) }, t))
138
130
  ]
139
131
  }
140
132
  );
141
133
  }
142
134
  );
143
135
  export {
144
- ie as List
136
+ ue as List
145
137
  };
@@ -1,89 +1,93 @@
1
- import { jsx as l, jsxs as d } from "react/jsx-runtime";
2
- import { useRef as w, useCallback as o } from "react";
3
- import { Typography as C } from "../../../Typography/Typography.js";
4
- import { cn as i } from "../../../../utils/index.js";
5
- import { listItemVariants as L } from "./ListItem.variants.js";
6
- import { useDropdownContext as I } from "../../contexts/dropdown.hook.js";
7
- const K = ({
8
- isClickable: p,
9
- className: h,
10
- inputRef: b,
11
- listItemSecondRowClassName: x,
1
+ import { jsxs as g, jsx as l } from "react/jsx-runtime";
2
+ import { useRef as y, useCallback as m } from "react";
3
+ import { Typography as w } from "../../../Typography/Typography.js";
4
+ import { cn as f } from "../../../../utils/index.js";
5
+ import { listItemVariants as C } from "./ListItem.variants.js";
6
+ import { useDropdownContext as L } from "../../contexts/dropdown.hook.js";
7
+ function I(r, n) {
8
+ const o = n.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), c = new RegExp(`(${o})`, "gi");
9
+ return r.split(c).map((t, a) => t.toLowerCase() === n.toLowerCase() ? /* @__PURE__ */ l(
10
+ "mark",
11
+ {
12
+ className: "bg-transparent font-semibold text-slate-800 dark:text-slate-50",
13
+ children: t
14
+ },
15
+ a
16
+ ) : /* @__PURE__ */ l("span", { children: t }, a));
17
+ }
18
+ const $ = ({
19
+ isClickable: r,
20
+ className: n,
21
+ inputRef: o,
22
+ listItemSecondRowClassName: c,
12
23
  ...t
13
24
  }) => {
14
- const { searchTerm: a, highlightSearchEnabled: c, setValue: m, toggleOpen: f } = I(), g = w(null), n = o(
25
+ const { searchTerm: a, highlightSearchEnabled: d, setValue: h, toggleOpen: u } = L(), p = y(null), i = m(
15
26
  (e) => {
16
- m(e.value, b), f(!1);
27
+ h(e.value, o), u(!1);
17
28
  },
18
- [m, f]
19
- ), u = o(
20
- (e, r) => {
21
- e.key === "Enter" && (e.stopPropagation(), n(r));
29
+ [h, u]
30
+ ), x = m(
31
+ (e, s) => {
32
+ e.key === "Enter" && (e.stopPropagation(), i(s));
22
33
  },
23
- [n]
24
- ), k = o(
25
- (e, r) => {
34
+ [i]
35
+ ), b = m(
36
+ (e, s) => {
26
37
  if (typeof e != "string")
27
38
  return e;
28
- const y = c && a.length > 0 ? e.split(new RegExp(`(${a})`, "gi")).map((s) => s.toLowerCase() === a.toLowerCase() ? /* @__PURE__ */ l(
29
- "mark",
30
- {
31
- className: "bg-transparent font-semibold text-slate-800 dark:text-slate-50",
32
- children: s
33
- },
34
- s
35
- ) : s) : [e];
36
- return /* @__PURE__ */ d(
37
- C,
39
+ const k = d && a.length > 0 ? I(e, a) : [e];
40
+ return /* @__PURE__ */ g(
41
+ w,
38
42
  {
39
43
  variant: "body2",
40
44
  className: "text-zinc-700 dark:text-slate-50 font-medium",
41
45
  children: [
42
- y,
43
- r ? /* @__PURE__ */ l(
46
+ k,
47
+ s ? /* @__PURE__ */ l(
44
48
  "span",
45
49
  {
46
- className: i(
50
+ className: f(
47
51
  "block font-normal text-sm text-slate-800 dark:text-slate-50",
48
- x
52
+ c
49
53
  ),
50
- children: r
54
+ children: s
51
55
  }
52
56
  ) : null
53
57
  ]
54
58
  }
55
59
  );
56
60
  },
57
- [c, a]
61
+ [d, a]
58
62
  );
59
- return /* @__PURE__ */ d(
63
+ return /* @__PURE__ */ g(
60
64
  "li",
61
65
  {
62
- ref: g,
66
+ ref: p,
63
67
  role: "option",
64
68
  "data-action": "false",
65
- className: i(L({ className: h })),
69
+ className: f(C({ className: n })),
66
70
  tabIndex: 0,
67
71
  onClick: (e) => {
68
- p && (n(t), e.stopPropagation());
72
+ r && (i(t), e.stopPropagation());
69
73
  },
70
- onKeyDown: (e) => u(e, t),
74
+ onKeyDown: (e) => x(e, t),
71
75
  children: [
72
76
  t.leftIcon ? /* @__PURE__ */ l(
73
77
  "span",
74
78
  {
75
- className: i("w-4 h-4 flex justify-center", {
79
+ className: f("w-4 h-4 flex justify-center", {
76
80
  "items-center": !t.subLabel,
77
81
  "items-baseline -translate-y-2": !!t.subLabel
78
82
  }),
79
83
  children: t.leftIcon
80
84
  }
81
85
  ) : null,
82
- k(t.label, t.subLabel)
86
+ b(t.label, t.subLabel)
83
87
  ]
84
88
  }
85
89
  );
86
90
  };
87
91
  export {
88
- K as ListItem
92
+ $ as ListItem
89
93
  };
@@ -44,7 +44,6 @@ const fe = [
44
44
  isOpen: f,
45
45
  searchTerm: G,
46
46
  value: o,
47
- // canFilter,
48
47
  options: n,
49
48
  setValue: c,
50
49
  setSearchTerm: J,
@@ -64,7 +63,7 @@ const fe = [
64
63
  }, [x, n, c, o]);
65
64
  const S = (r) => {
66
65
  const p = r.target.value;
67
- K(!0), q?.(p), c(""), J(p || "");
66
+ K(!0), c(""), J(p ?? ""), q?.(p);
68
67
  const b = n.find(
69
68
  (X) => X.value.toLocaleLowerCase() === p.toLocaleLowerCase()
70
69
  );
@@ -8,6 +8,7 @@ const t = e({
8
8
  canContinueFetching: !0,
9
9
  page: 1,
10
10
  options: [],
11
+ isTyping: !1,
11
12
  setOptions() {
12
13
  throw new Error("setOptions function must be overridden");
13
14
  },
@@ -1,53 +1,58 @@
1
- import { jsx as w } from "react/jsx-runtime";
2
- import { useState as e, useRef as A, useCallback as u, useEffect as I } from "react";
3
- import { DropdownContext as O } from "./dropdown.context.js";
4
- import { useToggle as _ } from "../../../hooks/useToggle.js";
5
- const s = 1, N = ({
6
- children: p,
7
- value: m,
8
- name: c,
9
- highlightSearch: f = !1,
10
- options: r,
1
+ import { jsx as G } from "react/jsx-runtime";
2
+ import { useState as e, useRef as f, useCallback as p, useEffect as T } from "react";
3
+ import { DropdownContext as L } from "./dropdown.context.js";
4
+ import { useToggle as N } from "../../../hooks/useToggle.js";
5
+ const c = 1, O = 300, U = ({
6
+ children: d,
7
+ value: C,
8
+ name: i,
9
+ highlightSearch: E = !1,
10
+ options: n,
11
11
  onChange: a,
12
- onBlur: g
12
+ onBlur: u
13
13
  }) => {
14
- const [d, i] = e(r), C = A(f), [T, l] = _(!1), [E, F] = e(""), [v, P] = e(!0), [S, n] = e(!0), [b, o] = e(s), x = u(
15
- (t, h) => {
16
- h?.current && (h.current.value = t), n(!0), o(s), a?.({ target: { value: t, name: c ?? "" } }), g?.();
14
+ const [v, l] = e(n), F = f(E), [P, g] = N(!1), [D, I] = e(""), [S, b] = e(!0), [x, o] = e(!0), [A, s] = e(c), [_, h] = e(!1), t = f(void 0), w = p(
15
+ (r, m) => {
16
+ m?.current && (m.current.value = r), t.current && clearTimeout(t.current), h(!0), o(!0), s(c), a?.({ target: { value: r, name: i ?? "" } }), u?.(), t.current = setTimeout(() => {
17
+ h(!1);
18
+ }, O);
17
19
  },
18
- [a, c, g]
19
- ), D = u(
20
- (t) => {
21
- l(t), n(!0), o(s);
20
+ [a, i, u]
21
+ ), y = p(
22
+ (r) => {
23
+ g(r), o(!0), s(c);
22
24
  },
23
- [l]
25
+ [g]
24
26
  );
25
- return I(() => {
26
- i(r);
27
- }, [r.length]), /* @__PURE__ */ w(
28
- O.Provider,
27
+ return T(() => {
28
+ l(n);
29
+ }, [n.length]), T(() => () => {
30
+ t.current && clearTimeout(t.current);
31
+ }, []), /* @__PURE__ */ G(
32
+ L.Provider,
29
33
  {
30
34
  value: {
31
- highlightSearchEnabled: C.current,
32
- isOpen: T,
33
- searchTerm: E,
34
- value: m,
35
- canFilter: v,
36
- canContinueFetching: S,
37
- page: b,
38
- options: d,
39
- setOptions: i,
40
- setPage: o,
41
- setCanContinueFetching: n,
42
- setCanFilter: P,
43
- setSearchTerm: F,
44
- setValue: x,
45
- toggleOpen: D
35
+ highlightSearchEnabled: F.current,
36
+ isOpen: P,
37
+ searchTerm: D,
38
+ value: C,
39
+ canFilter: S,
40
+ canContinueFetching: x,
41
+ page: A,
42
+ options: v,
43
+ isTyping: _,
44
+ setOptions: l,
45
+ setPage: s,
46
+ setCanContinueFetching: o,
47
+ setCanFilter: b,
48
+ setSearchTerm: I,
49
+ setValue: w,
50
+ toggleOpen: y
46
51
  },
47
- children: p
52
+ children: d
48
53
  }
49
54
  );
50
55
  };
51
56
  export {
52
- N as DropdownProvider
57
+ U as DropdownProvider
53
58
  };
@@ -1,40 +1,72 @@
1
- import { jsxs as o, jsx as e } from "react/jsx-runtime";
2
- import { Button as r } from "../../../Button/Button.js";
3
- import { cn as n } from "../../../../utils/index.js";
4
- import { E as c } from "../../../../ellipsis-vertical-BVPtjl5f.js";
5
- const u = ({
6
- actions: t,
7
- ...i
8
- }) => t ? /* @__PURE__ */ o("div", { className: "relative group", children: [
9
- /* @__PURE__ */ o(
10
- r,
1
+ import { jsxs as i, jsx as e } from "react/jsx-runtime";
2
+ import { Button as t } from "../../../Button/Button.js";
3
+ import { cn as r } from "../../../../utils/index.js";
4
+ import { E as u } from "../../../../ellipsis-vertical-BVPtjl5f.js";
5
+ const w = ({
6
+ actions: a,
7
+ wrapperClassName: l,
8
+ triggerButtonClassName: s,
9
+ iconTriggerButtonClassName: n,
10
+ wrapperActionsClassName: c,
11
+ wrapperContentActionsClassName: d,
12
+ ...h
13
+ }) => a ? /* @__PURE__ */ i("div", { className: r("relative group", l), children: [
14
+ /* @__PURE__ */ i(
15
+ t,
11
16
  {
12
17
  variant: "text",
13
18
  shape: "circle",
14
19
  size: "large",
15
- className: "text-slate-400 group-hover:text-slate-800 group-hover:bg-aurora-50",
20
+ className: r(
21
+ "text-slate-400 group-hover:text-slate-800 group-hover:bg-aurora-50",
22
+ s
23
+ ),
16
24
  role: "presentation",
17
25
  children: [
18
- /* @__PURE__ */ e(c, { "aria-hidden": "true", className: "w-7 h-7" }),
26
+ /* @__PURE__ */ e(
27
+ u,
28
+ {
29
+ "aria-hidden": "true",
30
+ className: r("w-7 h-7", n)
31
+ }
32
+ ),
19
33
  /* @__PURE__ */ e("span", { className: "sr-only", children: "Show Actions" })
20
34
  ]
21
35
  }
22
36
  ),
23
- /* @__PURE__ */ e("div", { className: "absolute top-full right-0 w-[215px] hidden group-hover:block z-10", children: /* @__PURE__ */ e("div", { className: "bg-white mt-0.5 py-2 rounded-lg shadow-lg border border-zinc-100 animate-in fade-in-0", children: t.map(({ label: a, onClick: l, className: s }) => /* @__PURE__ */ e(
24
- r,
37
+ /* @__PURE__ */ e(
38
+ "div",
25
39
  {
26
- className: n(
27
- "w-full text-slate-800 cursor-pointer p-0 h-9 flex gap-2 text-sm font-normal justify-start hover:bg-gray-50 hover:text-slate-800 rounded-none px-6",
28
- s
40
+ className: r(
41
+ "absolute top-full right-0 w-[215px] hidden group-hover:block z-10",
42
+ c
29
43
  ),
30
- variant: "text",
31
- asChild: !0,
32
- role: "presentation",
33
- children: /* @__PURE__ */ e(r, { onClick: () => l(i.row.original), children: a })
34
- },
35
- a
36
- )) }) })
44
+ children: /* @__PURE__ */ e(
45
+ "div",
46
+ {
47
+ className: r(
48
+ "bg-white mt-0.5 py-2 rounded-lg shadow-lg border border-zinc-100 animate-in fade-in-0",
49
+ d
50
+ ),
51
+ children: a.map(({ label: o, className: p, onClick: m }) => /* @__PURE__ */ e(
52
+ t,
53
+ {
54
+ className: r(
55
+ "w-full text-slate-800 cursor-pointer p-0 h-9 flex gap-2 text-sm font-normal justify-start hover:bg-gray-50 hover:text-slate-800 rounded-none px-6",
56
+ p
57
+ ),
58
+ variant: "text",
59
+ asChild: !0,
60
+ role: "presentation",
61
+ children: /* @__PURE__ */ e(t, { onClick: () => m(h.row.original), children: o })
62
+ },
63
+ o
64
+ ))
65
+ }
66
+ )
67
+ }
68
+ )
37
69
  ] }) : null;
38
70
  export {
39
- u as Actions
71
+ w as Actions
40
72
  };
@@ -1,48 +1,51 @@
1
- import { jsx as t } from "react/jsx-runtime";
2
- import { f as x } from "../../../../index-CSWGJT-v.js";
3
- import { Skeleton as y } from "../Skeleton/Skeleton.js";
1
+ import { jsx as e } from "react/jsx-runtime";
2
+ import { f as y } from "../../../../index-CSWGJT-v.js";
3
+ import { Skeleton as x } from "../Skeleton/Skeleton.js";
4
4
  import { cn as b } from "../../../../utils/index.js";
5
- import { useTableContext as N } from "../../contexts/table.hook.js";
6
- const j = ({
5
+ import { useTableContext as D } from "../../contexts/table.hook.js";
6
+ const _ = ({
7
7
  isLoading: d,
8
8
  showPagination: a
9
9
  }) => {
10
- const { table: o, pageSize: i, tableFetching: f } = N();
11
- if (d || f)
12
- return /* @__PURE__ */ t(y, { numberOfRows: i, table: o });
13
- const e = o.getRowModel().rows ?? [];
14
- return /* @__PURE__ */ t("tbody", { className: "text-slate-800 text-sm font-normal relative", children: e.map(({ id: s, original: p, getVisibleCells: u }, l) => {
15
- const { meta: n = {} } = p, m = u();
16
- return /* @__PURE__ */ t(
10
+ const { table: s, pageSize: i, tableFetching: p } = D();
11
+ if (d || p)
12
+ return /* @__PURE__ */ e(x, { numberOfRows: i, table: s });
13
+ const r = s.getRowModel().rows ?? [];
14
+ return /* @__PURE__ */ e("tbody", { className: "text-slate-800 text-sm font-normal relative", children: r.map(({ id: o, original: l, getVisibleCells: u }, m) => {
15
+ const { meta: n = {} } = l, c = u();
16
+ return /* @__PURE__ */ e(
17
17
  "tr",
18
18
  {
19
19
  className: b(
20
20
  "border-b border-b-gray-200 last:border-b-transparent bg-transparent",
21
21
  n.className
22
22
  ),
23
- "data-row-id": s,
23
+ "data-row-id": o,
24
24
  ...n.attributes ?? {},
25
- children: m.map(({ id: g, column: r, getContext: h }, c) => /* @__PURE__ */ t(
26
- "td",
27
- {
28
- className: b(
29
- "px-4 py-1 text-sm bg-white",
30
- r.columnDef.meta?.className,
31
- {
32
- "[tr:last-child_&:first-of-type]:rounded-bl-lg": l === e.length - 1 && c === 0 || !a,
33
- "[tr:last-child_&:last-of-type]:rounded-br-lg": l === e.length - 1 && c === m.length - 1 || !a
34
- }
35
- ),
36
- ...r.columnDef.meta?.attributes ?? {},
37
- children: x(r.columnDef.cell, h())
38
- },
39
- g
40
- ))
25
+ children: c.map(({ id: g, column: t, getContext: h }, f) => {
26
+ const N = typeof t.columnDef.meta?.className == "function" ? t.columnDef.meta?.className(l) : t.columnDef.meta?.className;
27
+ return /* @__PURE__ */ e(
28
+ "td",
29
+ {
30
+ className: b(
31
+ "px-4 py-1 text-sm bg-white",
32
+ N,
33
+ {
34
+ "[tr:last-child_&:first-of-type]:rounded-bl-lg": m === r.length - 1 && f === 0 || !a,
35
+ "[tr:last-child_&:last-of-type]:rounded-br-lg": m === r.length - 1 && f === c.length - 1 || !a
36
+ }
37
+ ),
38
+ ...t.columnDef.meta?.attributes ?? {},
39
+ children: y(t.columnDef.cell, h())
40
+ },
41
+ g
42
+ );
43
+ })
41
44
  },
42
- s
45
+ o
43
46
  );
44
47
  }) });
45
48
  };
46
49
  export {
47
- j as Body
50
+ _ as Body
48
51
  };
package/dist/index.d.ts CHANGED
@@ -645,6 +645,11 @@ declare type Props_4<TData extends RowData_2> = VariantProps<typeof virtualizeTa
645
645
 
646
646
  declare type Props_5<TData extends RowData> = CellContext<TData, unknown> & {
647
647
  actions: Action<TData>[];
648
+ iconTriggerButtonClassName?: string;
649
+ triggerButtonClassName?: string;
650
+ wrapperActionsClassName?: string;
651
+ wrapperClassName?: string;
652
+ wrapperContentActionsClassName?: string;
648
653
  };
649
654
 
650
655
  export declare const Radio: FC<RadioProps>;
@@ -980,7 +985,7 @@ export { }
980
985
 
981
986
  declare module '@tanstack/react-table' {
982
987
  interface ColumnMeta<TData extends RowData, TValue> {
983
- className?: string;
988
+ className?: string | ((row: TData) => string);
984
989
  attributes?: Record<string, string | number | boolean>;
985
990
  headerClassName?: string;
986
991
  }
package/dist/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@konstructio/ui",
3
3
  "description": "A set of reusable and customizable React components built for konstruct.io",
4
4
  "private": false,
5
- "version": "0.1.2-alpha.23",
5
+ "version": "0.1.2-alpha.25",
6
6
  "type": "module",
7
7
  "license": "MIT",
8
8
  "main": "dist/index.js",
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@konstructio/ui",
3
3
  "description": "A set of reusable and customizable React components built for konstruct.io",
4
4
  "private": false,
5
- "version": "0.1.2-alpha.24",
5
+ "version": "0.1.2-alpha.26",
6
6
  "type": "module",
7
7
  "license": "MIT",
8
8
  "main": "dist/index.js",