lecom-ui 5.2.29 → 5.2.31

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,4 +1,4 @@
1
- import * as React from 'react';
1
+ import React__default, { useState, useMemo, useCallback } from 'react';
2
2
  import { cn } from '../../lib/utils.js';
3
3
  import { useReactTable, getSortedRowModel, getCoreRowModel } from '@tanstack/react-table';
4
4
  import { Pagination } from '../Pagination/Pagination.js';
@@ -19,8 +19,8 @@ function DataTable({
19
19
  skeleton,
20
20
  onIsSelected
21
21
  }) {
22
- const [sorting, setSorting] = React.useState([]);
23
- const [hasShadow, setHasShadow] = React.useState(false);
22
+ const [sorting, setSorting] = useState([]);
23
+ const [hasShadow, setHasShadow] = useState(false);
24
24
  const table = useReactTable({
25
25
  data,
26
26
  columns: buildColumns({ columns, size }),
@@ -29,18 +29,18 @@ function DataTable({
29
29
  getSortedRowModel: getSortedRowModel(),
30
30
  state: { sorting }
31
31
  });
32
- const styleDataTableContainer = React.useMemo(
32
+ const styleDataTableContainer = useMemo(
33
33
  () => ({
34
34
  width: vwDiff ? `calc(100vw - ${vwDiff}px)` : "100%",
35
35
  height: vhDiff ? `calc(100vh - ${vhDiff}px)` : "100%"
36
36
  }),
37
37
  [vwDiff, vhDiff]
38
38
  );
39
- const handleScroll = React.useCallback((e) => {
39
+ const handleScroll = useCallback((e) => {
40
40
  const target = e.currentTarget;
41
41
  setHasShadow(target.scrollLeft > 0);
42
42
  }, []);
43
- const renderTable = () => /* @__PURE__ */ React.createElement(
43
+ const renderTable = () => /* @__PURE__ */ React__default.createElement(
44
44
  Table,
45
45
  {
46
46
  table,
@@ -51,7 +51,7 @@ function DataTable({
51
51
  hasShadow
52
52
  }
53
53
  );
54
- return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
54
+ return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement(
55
55
  "div",
56
56
  {
57
57
  className: cn(
@@ -60,8 +60,8 @@ function DataTable({
60
60
  ),
61
61
  style: !noScroll ? { width: styleDataTableContainer.width } : void 0
62
62
  },
63
- noScroll ? renderTable() : /* @__PURE__ */ React.createElement(ScrollArea, { type: "always", className: "p-2", onScroll: handleScroll }, /* @__PURE__ */ React.createElement("div", { style: { maxHeight: styleDataTableContainer.height } }, renderTable()), /* @__PURE__ */ React.createElement(ScrollBar, { orientation: "horizontal" }))
64
- ), pagination && /* @__PURE__ */ React.createElement(Pagination, { ...pagination }));
63
+ noScroll ? renderTable() : /* @__PURE__ */ React__default.createElement(ScrollArea, { type: "always", className: "p-2", onScroll: handleScroll }, /* @__PURE__ */ React__default.createElement("div", { style: { maxHeight: styleDataTableContainer.height } }, renderTable()), /* @__PURE__ */ React__default.createElement(ScrollBar, { orientation: "horizontal" }))
64
+ ), pagination && /* @__PURE__ */ React__default.createElement(Pagination, { ...pagination }));
65
65
  }
66
66
  DataTable.displayName = "DataTable";
67
67
 
@@ -1,3 +1,4 @@
1
+ import * as React from 'react';
1
2
  import { clsx } from 'clsx';
2
3
  import { ArrowUpDown } from 'lucide-react';
3
4
  import { Checkbox } from '../Checkbox/Checkbox.js';
@@ -1,4 +1,4 @@
1
- import * as React from 'react';
1
+ import React__default, { useRef } from 'react';
2
2
  import { cn } from '../../lib/utils.js';
3
3
  import { flexRender } from '@tanstack/react-table';
4
4
  import { useVirtualizer } from '@tanstack/react-virtual';
@@ -13,12 +13,12 @@ function Table({
13
13
  onIsSelected,
14
14
  hasShadow
15
15
  }) {
16
- const parentRef = React.useRef(null);
16
+ const parentRef = useRef(null);
17
17
  const rows = table.getRowModel().rows;
18
18
  const rowVirtualizer = useVirtualizer({
19
19
  count: rows.length,
20
20
  getScrollElement: () => parentRef.current,
21
- estimateSize: () => 48
21
+ estimateSize: () => 40
22
22
  });
23
23
  const virtualRows = rowVirtualizer.getVirtualItems();
24
24
  const totalSize = rowVirtualizer.getTotalSize();
@@ -34,7 +34,7 @@ function Table({
34
34
  const getFixedClass = (meta) => meta.fixed ? "sticky left-0 z-10 bg-white" : "";
35
35
  if (isLoading) {
36
36
  if (skeleton) return skeleton;
37
- return /* @__PURE__ */ React.createElement("div", { className: "flex flex-col gap-4" }, Array.from({ length: 10 }).map((_, i) => /* @__PURE__ */ React.createElement(
37
+ return /* @__PURE__ */ React__default.createElement("div", { className: "flex flex-col gap-4" }, Array.from({ length: 10 }).map((_, i) => /* @__PURE__ */ React__default.createElement(
38
38
  Skeleton,
39
39
  {
40
40
  key: i,
@@ -42,7 +42,7 @@ function Table({
42
42
  }
43
43
  )));
44
44
  }
45
- return /* @__PURE__ */ React.createElement("div", { ref: parentRef, className: "relative overflow-auto max-h-full" }, /* @__PURE__ */ React.createElement("table", { id: "data-table", className: "w-full" }, /* @__PURE__ */ React.createElement("thead", { className: "sticky top-0 z-20 bg-white" }, table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ React.createElement("tr", { key: headerGroup.id }, headerGroup.headers.map((header) => /* @__PURE__ */ React.createElement(
45
+ return /* @__PURE__ */ React__default.createElement("div", { ref: parentRef, className: "relative overflow-auto max-h-full" }, /* @__PURE__ */ React__default.createElement("table", { id: "data-table", className: "w-full" }, /* @__PURE__ */ React__default.createElement("thead", { className: "sticky top-0 z-20 bg-white" }, table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ React__default.createElement("tr", { key: headerGroup.id }, headerGroup.headers.map((header) => /* @__PURE__ */ React__default.createElement(
46
46
  "th",
47
47
  {
48
48
  key: header.id,
@@ -62,9 +62,9 @@ function Table({
62
62
  header.column.columnDef.header,
63
63
  header.getContext()
64
64
  )
65
- ))))), /* @__PURE__ */ React.createElement("tbody", { style: { height: `${totalSize}px`, position: "relative" } }, virtualRows.length > 0 ? virtualRows.map((virtualRow) => {
65
+ ))))), /* @__PURE__ */ React__default.createElement("tbody", { style: { height: `${totalSize}px`, position: "relative" } }, virtualRows.length > 0 ? virtualRows.map((virtualRow) => {
66
66
  const row = rows[virtualRow.index];
67
- return /* @__PURE__ */ React.createElement(
67
+ return /* @__PURE__ */ React__default.createElement(
68
68
  "tr",
69
69
  {
70
70
  key: row.id,
@@ -74,7 +74,7 @@ function Table({
74
74
  transform: `translateY(${virtualRow.start}px)`
75
75
  }
76
76
  },
77
- row.getVisibleCells().map((cell) => /* @__PURE__ */ React.createElement(
77
+ row.getVisibleCells().map((cell) => /* @__PURE__ */ React__default.createElement(
78
78
  "td",
79
79
  {
80
80
  key: cell.id,
@@ -93,13 +93,13 @@ function Table({
93
93
  )
94
94
  ))
95
95
  );
96
- }) : /* @__PURE__ */ React.createElement("tr", null, /* @__PURE__ */ React.createElement(
96
+ }) : /* @__PURE__ */ React__default.createElement("tr", null, /* @__PURE__ */ React__default.createElement(
97
97
  "td",
98
98
  {
99
99
  colSpan: table.getAllColumns().length,
100
100
  className: "text-center py-4"
101
101
  },
102
- noResults ?? /* @__PURE__ */ React.createElement("div", null, "-")
102
+ noResults ?? /* @__PURE__ */ React__default.createElement("div", null, "-")
103
103
  )))));
104
104
  }
105
105
 
package/dist/index.d.ts CHANGED
@@ -524,7 +524,7 @@ interface TableProps<TData, TValue> {
524
524
  onIsSelected?: (row: Row$1<TData>) => boolean;
525
525
  }
526
526
 
527
- declare function DataTable<TData, TValue>({ isLoading, columns, data, pagination, vwDiff, vhDiff, className, noScroll, size, skeleton, onIsSelected, }: DataTableProps<TData, TValue>): React$1.JSX.Element;
527
+ declare function DataTable<TData, TValue>({ isLoading, columns, data, pagination, vwDiff, vhDiff, className, noScroll, size, skeleton, onIsSelected, }: DataTableProps<TData, TValue>): React__default.JSX.Element;
528
528
  declare namespace DataTable {
529
529
  var displayName: string;
530
530
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lecom-ui",
3
- "version": "5.2.29",
3
+ "version": "5.2.31",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "module": "dist/index.js",