@konstructio/ui 0.1.2-alpha.8 → 0.1.2-alpha.9

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,19 +1,19 @@
1
1
  import { jsx as r, jsxs as m } from "react/jsx-runtime";
2
- import { useMemo as y } from "react";
2
+ import { useMemo as w } from "react";
3
3
  import { cn as s } from "../../utils/index.js";
4
4
  import { TableProvider as B } from "./contexts/table.provider.js";
5
5
  import { Filter as H } from "./components/Filter/Filter.js";
6
- import { Header as K } from "./components/Header/Header.js";
7
- import { Body as M } from "./components/Body/Body.js";
8
- import { Pagination as P } from "./components/Pagination/Pagination.js";
9
- import { TruncateText as k } from "./components/TruncateText/TruncateText.js";
10
- import { Actions as q } from "./components/Actions/Actions.js";
11
- const C = ({
6
+ import { Header as I } from "./components/Header/Header.js";
7
+ import { Body as K } from "./components/Body/Body.js";
8
+ import { Pagination as M } from "./components/Pagination/Pagination.js";
9
+ import { TruncateText as P } from "./components/TruncateText/TruncateText.js";
10
+ import { Actions as k } from "./components/Actions/Actions.js";
11
+ const q = ({
12
12
  id: c,
13
- ariaLabel: d,
14
- columns: n,
13
+ ariaLabel: n,
14
+ columns: d,
15
15
  data: f,
16
- totalItems: p,
16
+ totalItems: p = -1 / 0,
17
17
  className: u,
18
18
  classNameHeaderActiveArrows: b,
19
19
  classNameHeaderArrows: T,
@@ -24,22 +24,22 @@ const C = ({
24
24
  // Pagination
25
25
  showPagination: v,
26
26
  showTotalItems: o,
27
- showDropdownPagination: l,
28
- showDotPagination: a,
29
- showFormPagination: i,
30
- pageSizes: z,
27
+ showDropdownPagination: i,
28
+ showDotPagination: l,
29
+ showFormPagination: a,
30
+ pageSizes: y,
31
31
  // Filter
32
- showFilter: V = !1,
33
- showFilterInput: g,
34
- filterSearchPlaceholder: j = "",
35
- multiSelectFilter: w
32
+ showFilter: z = !1,
33
+ showFilterInput: V,
34
+ filterSearchPlaceholder: g = "",
35
+ multiSelectFilter: j
36
36
  }) => {
37
- const t = y(
37
+ const t = w(
38
38
  () => v || [
39
39
  o,
40
+ i,
40
41
  l,
41
- a,
42
- i
42
+ a
43
43
  ].some(Boolean),
44
44
  []
45
45
  );
@@ -47,17 +47,17 @@ const C = ({
47
47
  B,
48
48
  {
49
49
  id: c,
50
- columns: n,
50
+ columns: d,
51
51
  data: f,
52
52
  fetchData: A,
53
53
  totalItems: p,
54
54
  children: /* @__PURE__ */ m("section", { className: u, children: [
55
- V && /* @__PURE__ */ r(
55
+ z && /* @__PURE__ */ r(
56
56
  H,
57
57
  {
58
- placeholder: j,
59
- multiSelectFilter: w,
60
- showFilterInput: g
58
+ placeholder: g,
59
+ multiSelectFilter: j,
60
+ showFilterInput: V
61
61
  }
62
62
  ),
63
63
  /* @__PURE__ */ r(
@@ -74,40 +74,40 @@ const C = ({
74
74
  "table",
75
75
  {
76
76
  className: s("w-full border-collapse", h),
77
- "aria-label": d,
77
+ "aria-label": n,
78
78
  children: [
79
79
  /* @__PURE__ */ r(
80
- K,
80
+ I,
81
81
  {
82
82
  className: N,
83
83
  classNameArrows: T,
84
84
  classNameActiveArrows: b
85
85
  }
86
86
  ),
87
- /* @__PURE__ */ r(M, {})
87
+ /* @__PURE__ */ r(K, {})
88
88
  ]
89
89
  }
90
90
  )
91
91
  }
92
92
  ),
93
93
  t && /* @__PURE__ */ r(
94
- P,
94
+ M,
95
95
  {
96
96
  showTotalItems: o,
97
- showDropdownPagination: l,
98
- showDotPagination: a,
99
- showFormPagination: i,
100
- pageSizes: z
97
+ showDropdownPagination: i,
98
+ showDotPagination: l,
99
+ showFormPagination: a,
100
+ pageSizes: y
101
101
  }
102
102
  )
103
103
  ] })
104
104
  }
105
105
  );
106
- }, e = C;
106
+ }, e = q;
107
107
  e.displayName = "KonstructVirtualizedTable";
108
- e.TruncateText = k;
109
- e.Actions = q;
108
+ e.TruncateText = P;
109
+ e.Actions = k;
110
110
  export {
111
- k as TruncateText,
111
+ P as TruncateText,
112
112
  e as VirtualizedTable
113
113
  };
@@ -1,49 +1,49 @@
1
1
  import { jsx as z } from "react/jsx-runtime";
2
2
  import { useQuery as E } from "@tanstack/react-query";
3
3
  import { u as _, g as j, a as k } from "../../../index-Dx2grAuN.js";
4
- import { useState as t, useMemo as q, useCallback as s } from "react";
4
+ import { useState as t, useMemo as q, useCallback as n } from "react";
5
5
  import { TableContext as A } from "./table.context.js";
6
6
  import { DEFAULT_PAGE_SIZE as K } from "../constants/pagination.js";
7
7
  const Z = ({
8
- children: u,
9
- id: d,
8
+ children: d,
9
+ id: u,
10
10
  data: S = [],
11
11
  columns: f = [],
12
12
  totalItems: h,
13
13
  fetchData: p
14
14
  }) => {
15
- const [i, g] = t([]), [n, m] = t(0), [r, C] = t(), [o, M] = t(K), [c, b] = t(h), P = q(
16
- () => Math.ceil(c / o),
17
- [c, o]
15
+ const [i, g] = t([]), [r, m] = t(0), [c, M] = t(), [o, C] = t(K), [l, b] = t(h), P = q(
16
+ () => Math.ceil(l / o),
17
+ [l, o]
18
18
  ), [a, w] = t({}), { data: y, isLoading: O, isFetching: T } = E({
19
19
  queryKey: [
20
- d,
21
- n,
22
- o,
20
+ u,
23
21
  r,
22
+ o,
23
+ c,
24
24
  JSON.stringify(a)
25
25
  ],
26
26
  refetchOnMount: !1,
27
27
  refetchOnWindowFocus: !1,
28
28
  initialData: S,
29
29
  queryFn: () => p({
30
- page: Math.max(n + 1, 1),
30
+ page: Math.max(r + 1, 1),
31
31
  pageSize: o,
32
- termOfSearch: r,
32
+ termOfSearch: c,
33
33
  ...Object.keys(a).length > 0 ? a : {}
34
- }).then(({ data: e, totalItemsCount: l }) => (b(l), e))
35
- }), F = s((e) => {
36
- C(e), m(0);
37
- }, []), I = s((e, l) => {
34
+ }).then(({ data: e, totalItemsCount: s }) => (s && b(s), e))
35
+ }), F = n((e) => {
36
+ M(e), m(0);
37
+ }, []), R = n((e, s) => {
38
38
  const L = e.toLowerCase().replace(/\s+/g, "_");
39
39
  w((v) => ({
40
40
  ...v,
41
- [L]: l
41
+ [L]: s
42
42
  }));
43
- }, []), R = s((e) => m(e), []), x = s(
44
- (e) => M(e),
43
+ }, []), x = n((e) => m(e), []), D = n(
44
+ (e) => C(e),
45
45
  []
46
- ), D = _({
46
+ ), I = _({
47
47
  data: y,
48
48
  columns: f,
49
49
  state: {
@@ -58,22 +58,22 @@ const Z = ({
58
58
  {
59
59
  value: {
60
60
  sortedData: i,
61
- table: D,
61
+ table: I,
62
62
  tableFetching: T,
63
63
  tableLoading: O,
64
- totalItems: c,
65
- termOfSearch: r,
66
- page: n,
64
+ totalItems: l,
65
+ termOfSearch: c,
66
+ page: r,
67
67
  multiselectSelected: a,
68
68
  pageSize: o,
69
69
  totalPages: P,
70
- handlePage: R,
71
- onPageSize: x,
70
+ handlePage: x,
71
+ onPageSize: D,
72
72
  onChangeTermOfSearch: F,
73
73
  onSorting: g,
74
- onSelectMultiselect: I
74
+ onSelectMultiselect: R
75
75
  },
76
- children: u
76
+ children: d
77
77
  }
78
78
  );
79
79
  };
package/dist/index.d.ts CHANGED
@@ -579,7 +579,7 @@ declare type Props_4<TData extends RowData_2> = VariantProps<typeof virtualizeTa
579
579
  classNameWrapperTable?: string;
580
580
  fetchData: (params: Record<string, string | number | string[] | number[] | undefined>) => Promise<{
581
581
  data: TData[];
582
- totalItemsCount: number;
582
+ totalItemsCount?: number;
583
583
  }>;
584
584
  } & ({
585
585
  showPagination: true;
@@ -596,7 +596,7 @@ declare type Props_4<TData extends RowData_2> = VariantProps<typeof virtualizeTa
596
596
  showDotPagination?: never;
597
597
  showFormPagination?: never;
598
598
  pageSizes?: never;
599
- totalItems: never;
599
+ totalItems?: never;
600
600
  }) & ({
601
601
  filterSearchPlaceholder?: string;
602
602
  multiSelectFilter?: MultiSelectFilter[];
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.7",
5
+ "version": "0.1.2-alpha.8",
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.8",
5
+ "version": "0.1.2-alpha.9",
6
6
  "type": "module",
7
7
  "license": "MIT",
8
8
  "main": "dist/index.js",