@deepnoid/ui 0.1.136 → 0.1.138

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.
@@ -30,7 +30,7 @@ var Pagination = forwardRef((originalProps, ref) => {
30
30
  totalPage,
31
31
  showPageNumber = true,
32
32
  showPageLabel,
33
- showFirstLastButtons,
33
+ showFirstLastButtons = true,
34
34
  handleChangePage,
35
35
  variant,
36
36
  size
@@ -1,10 +1,7 @@
1
1
  "use client";
2
- import {
3
- skeleton_default
4
- } from "./chunk-6PN3DGOE.mjs";
5
2
  import {
6
3
  pagination_default
7
- } from "./chunk-4URRLVNR.mjs";
4
+ } from "./chunk-4JOD47VZ.mjs";
8
5
  import {
9
6
  scrollArea_default
10
7
  } from "./chunk-M37VBNB3.mjs";
@@ -29,7 +26,7 @@ import {
29
26
  import { tv } from "tailwind-variants";
30
27
 
31
28
  // src/components/table/table-body.tsx
32
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
29
+ import { jsx, jsxs } from "react/jsx-runtime";
33
30
  var TableBody = ({
34
31
  slots,
35
32
  rows,
@@ -42,13 +39,9 @@ var TableBody = ({
42
39
  onRowClick,
43
40
  isLoading = false,
44
41
  emptyContent,
45
- skeletonRow,
46
42
  classNames,
47
43
  className
48
44
  }) => {
49
- const renderTdSkeleton = (key, column) => {
50
- return /* @__PURE__ */ jsx("td", { className: slots.td({ class: classNames == null ? void 0 : classNames.td }), style: column ? getCellStyle(column) : {}, children: /* @__PURE__ */ jsx(skeleton_default, { color, className: "h-full w-full", rounded: "lg", speed: "fast" }) }, key);
51
- };
52
45
  const renderCheckboxCell = (rowId, rowIndex) => /* @__PURE__ */ jsx(
53
46
  "td",
54
47
  {
@@ -58,10 +51,6 @@ var TableBody = ({
58
51
  },
59
52
  `checkbox-${rowId}-${rowIndex}`
60
53
  );
61
- const renderSkeletonRow = (rowIndex) => /* @__PURE__ */ jsxs("tr", { className: slots.tr({ class: classNames == null ? void 0 : classNames.tr }), children: [
62
- columns.map((column, colIdx) => renderTdSkeleton(`skeleton-${rowIndex}-${colIdx}`, column)),
63
- rowCheckbox && renderTdSkeleton(`skeleton-checkbox-${rowIndex}`)
64
- ] }, `skeleton-${rowIndex}`);
65
54
  const renderEmptyRow = () => /* @__PURE__ */ jsx("tr", { className: slots.tr({ class: classNames == null ? void 0 : classNames.tr }), children: /* @__PURE__ */ jsx("td", { colSpan: columns.length + (rowCheckbox ? 1 : 0), className: slots.empty({ class: classNames == null ? void 0 : classNames.empty }), children: emptyContent }) });
66
55
  const renderDataRow = (row, rowIndex) => /* @__PURE__ */ jsxs(
67
56
  "tr",
@@ -89,12 +78,18 @@ var TableBody = ({
89
78
  },
90
79
  `${row.id}-${rowIndex}`
91
80
  );
92
- const renderRows = () => {
93
- if (isLoading) return skeletonRow ? Array.from({ length: skeletonRow }, (_, idx) => renderSkeletonRow(idx)) : /* @__PURE__ */ jsx(Fragment, {});
94
- if (!rows.length && emptyContent) return renderEmptyRow();
95
- return rows.map((row, index) => renderDataRow(row, index));
96
- };
97
- return /* @__PURE__ */ jsx("tbody", { className: clsx(slots.tbody({ class: classNames == null ? void 0 : classNames.tbody }), className), children: renderRows() });
81
+ return /* @__PURE__ */ jsx(
82
+ "tbody",
83
+ {
84
+ className: clsx(
85
+ slots.tbody({ class: classNames == null ? void 0 : classNames.tbody }),
86
+ className,
87
+ "transition-all duration-200 ease-in-out",
88
+ isLoading && slots.tbodyLoading({ class: classNames == null ? void 0 : classNames.tbodyLoading })
89
+ ),
90
+ children: !rows.length && emptyContent ? renderEmptyRow() : rows.map((row, index) => renderDataRow(row, index))
91
+ }
92
+ );
98
93
  };
99
94
  var table_body_default = TableBody;
100
95
 
@@ -115,13 +110,12 @@ var Table = forwardRef((originalProps, ref) => {
115
110
  variant,
116
111
  color,
117
112
  size,
118
- skeletonRow,
119
113
  checkedRows,
120
114
  onCheckedRowsChange,
121
115
  onRowClick
122
116
  } = { ...props, ...variantProps };
123
117
  const { page = 1, perPage = 15 } = pagination || {};
124
- const showPagination = pagination && totalData > 0 && !isLoading;
118
+ const showPagination = pagination && totalData > 0;
125
119
  const [checkedRowIds, setCheckedRowIds] = useState(new Set(checkedRows == null ? void 0 : checkedRows.map((row) => row.id)));
126
120
  const tableMinWidth = useMemo(() => {
127
121
  const columnsWidth = columns.reduce((total, column) => {
@@ -194,7 +188,6 @@ var Table = forwardRef((originalProps, ref) => {
194
188
  rowCheckbox,
195
189
  hasCheckedRows: rows.length > 0 && rows.every((row) => checkedRowIds.has(row.id)),
196
190
  onCheckAll: handleAllRowCheck,
197
- isLoading,
198
191
  classNames,
199
192
  slots
200
193
  }
@@ -213,14 +206,10 @@ var Table = forwardRef((originalProps, ref) => {
213
206
  onRowClick: handleRowClick,
214
207
  isLoading,
215
208
  emptyContent,
216
- skeletonRow,
217
- className: clsx(
218
- "transition-all duration-150 ease-out",
219
- isLoading ? "-translate-y-2 opacity-0" : "translate-y-0 opacity-100",
220
- classNames
221
- )
209
+ classNames
222
210
  }
223
- )
211
+ ),
212
+ isLoading && /* @__PURE__ */ jsx2("div", { className: slots.overlay({ class: classNames == null ? void 0 : classNames.overlay }) })
224
213
  ]
225
214
  }
226
215
  ) }),
@@ -278,7 +267,9 @@ var tableStyle = tv({
278
267
  "[&>*]:z-1",
279
268
  "[&>*]:relative",
280
269
  "align-middle"
281
- ]
270
+ ],
271
+ tbodyLoading: [],
272
+ overlay: []
282
273
  },
283
274
  variants: {
284
275
  variant: {
@@ -486,7 +477,6 @@ var TableHead = ({
486
477
  size,
487
478
  rowCheckbox = false,
488
479
  hasCheckedRows,
489
- isLoading = false,
490
480
  classNames,
491
481
  onCheckAll
492
482
  }) => {
@@ -506,13 +496,7 @@ var TableHead = ({
506
496
  },
507
497
  key
508
498
  );
509
- const renderSkeletonRow = () => /* @__PURE__ */ jsx3("thead", { className: slots.thead({ class: classNames == null ? void 0 : classNames.thead }), children: /* @__PURE__ */ jsxs3("tr", { className: clsx(slots.tr({ class: classNames == null ? void 0 : classNames.tr }), "[&>th]:border-0"), children: [
510
- columns.map(
511
- (column, idx) => renderTh(/* @__PURE__ */ jsx3(skeleton_default, { color, rounded: "lg", speed: "fast" }), `skeleton-${idx}`, column)
512
- ),
513
- rowCheckbox && renderTh(/* @__PURE__ */ jsx3(skeleton_default, { color, rounded: "lg", speed: "fast" }), "checkbox-skeleton", void 0, true)
514
- ] }) });
515
- const renderContentRow = () => /* @__PURE__ */ jsx3("thead", { className: slots.thead({ class: classNames == null ? void 0 : classNames.thead }), children: /* @__PURE__ */ jsxs3("tr", { className: slots.tr({ class: classNames == null ? void 0 : classNames.tr }), children: [
499
+ return /* @__PURE__ */ jsx3("thead", { className: slots.thead({ class: classNames == null ? void 0 : classNames.thead }), children: /* @__PURE__ */ jsxs3("tr", { className: slots.tr({ class: classNames == null ? void 0 : classNames.tr }), children: [
516
500
  columns.map((column, idx) => renderTh(column.headerName, `${column.field}-${idx}`, column)),
517
501
  rowCheckbox && renderTh(
518
502
  /* @__PURE__ */ jsx3("div", { "data-checkbox": true, children: /* @__PURE__ */ jsx3(
@@ -528,7 +512,6 @@ var TableHead = ({
528
512
  true
529
513
  )
530
514
  ] }) });
531
- return isLoading ? renderSkeletonRow() : renderContentRow();
532
515
  };
533
516
  var table_head_default = TableHead;
534
517
 
@@ -5535,7 +5535,7 @@ var Pagination = (0, import_react3.forwardRef)((originalProps, ref) => {
5535
5535
  totalPage,
5536
5536
  showPageNumber = true,
5537
5537
  showPageLabel,
5538
- showFirstLastButtons,
5538
+ showFirstLastButtons = true,
5539
5539
  handleChangePage,
5540
5540
  variant,
5541
5541
  size
@@ -2,7 +2,7 @@
2
2
  import "../../chunk-7B7LRG5J.mjs";
3
3
  import {
4
4
  pagination_default
5
- } from "../../chunk-4URRLVNR.mjs";
5
+ } from "../../chunk-4JOD47VZ.mjs";
6
6
  import "../../chunk-F3HENRVM.mjs";
7
7
  import "../../chunk-2GCSFWHD.mjs";
8
8
  import "../../chunk-GL4E6YGW.mjs";
@@ -5533,7 +5533,7 @@ var Pagination = (0, import_react3.forwardRef)((originalProps, ref) => {
5533
5533
  totalPage,
5534
5534
  showPageNumber = true,
5535
5535
  showPageLabel,
5536
- showFirstLastButtons,
5536
+ showFirstLastButtons = true,
5537
5537
  handleChangePage,
5538
5538
  variant,
5539
5539
  size
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import {
3
3
  pagination_default
4
- } from "../../chunk-4URRLVNR.mjs";
4
+ } from "../../chunk-4JOD47VZ.mjs";
5
5
  import "../../chunk-F3HENRVM.mjs";
6
6
  import "../../chunk-2GCSFWHD.mjs";
7
7
  import "../../chunk-GL4E6YGW.mjs";
@@ -1,4 +1,4 @@
1
- export { default as Table, TableColumn, TableRef, TableRow } from './table.mjs';
1
+ export { default as Table, TableColumn, TableProps, TableRef, TableRow } from './table.mjs';
2
2
  export { default as DefinitionTable, DefinitionTableRow, DefinitionTableRowCell } from './definition-table.mjs';
3
3
  import 'tailwind-variants';
4
4
  import 'react';
@@ -1,4 +1,4 @@
1
- export { default as Table, TableColumn, TableRef, TableRow } from './table.js';
1
+ export { default as Table, TableColumn, TableProps, TableRef, TableRow } from './table.js';
2
2
  export { default as DefinitionTable, DefinitionTableRow, DefinitionTableRowCell } from './definition-table.js';
3
3
  import 'tailwind-variants';
4
4
  import 'react';