@deepnoid/ui 0.0.100 → 0.0.102

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,7 +1,7 @@
1
1
  "use client";
2
2
  import {
3
3
  table_body_default
4
- } from "./chunk-QDDEQY63.mjs";
4
+ } from "./chunk-VWD26TIQ.mjs";
5
5
  import {
6
6
  table_head_default
7
7
  } from "./chunk-PO3ADNA5.mjs";
@@ -20,13 +20,13 @@ var Table = forwardRef((originalProps, ref) => {
20
20
  const [props, variantProps] = mapPropsVariants(originalProps, table.variantKeys);
21
21
  const { classNames, rows, columns, className, emptyContent, loadingContent, onRowAction, ...tableComponentsProps } = props;
22
22
  const [checkedRows, setCheckedRows] = useState(/* @__PURE__ */ new Set());
23
- const [selectedRows, setSelectedRows] = useState(/* @__PURE__ */ new Set());
23
+ useImperativeHandle(ref, () => ({
24
+ checkedRows,
25
+ setCheckedRows
26
+ }));
24
27
  useEffect(() => {
25
28
  setCheckedRows(/* @__PURE__ */ new Set());
26
29
  }, [rows]);
27
- useEffect(() => {
28
- setSelectedRows(/* @__PURE__ */ new Set());
29
- }, [rows]);
30
30
  const slots = useMemo(() => table({ ...variantProps }), [...Object.values(variantProps)]);
31
31
  const getBaseProps = useCallback(
32
32
  (props2) => ({
@@ -62,30 +62,6 @@ var Table = forwardRef((originalProps, ref) => {
62
62
  }
63
63
  setCheckedRows(newCheckedRows);
64
64
  };
65
- const handleSelectRow = (index) => {
66
- const newSelectedRows = new Set(selectedRows);
67
- if (originalProps.isMultiSelect) {
68
- if (newSelectedRows.has(index)) {
69
- newSelectedRows.delete(index);
70
- } else {
71
- newSelectedRows.add(index);
72
- }
73
- } else {
74
- if (newSelectedRows.has(index)) {
75
- newSelectedRows.delete(index);
76
- } else {
77
- newSelectedRows.clear();
78
- newSelectedRows.add(index);
79
- }
80
- }
81
- setSelectedRows(newSelectedRows);
82
- };
83
- useImperativeHandle(ref, () => ({
84
- checkedRows,
85
- selectedRows,
86
- setCheckedRows,
87
- setSelectedRows
88
- }));
89
65
  return /* @__PURE__ */ jsxs("div", { ref, "data-table": "base", ...getBaseProps(), children: [
90
66
  /* @__PURE__ */ jsxs("table", { ...getTableProps(tableComponentsProps), children: [
91
67
  /* @__PURE__ */ jsx(
@@ -116,10 +92,8 @@ var Table = forwardRef((originalProps, ref) => {
116
92
  isExpanded: originalProps.isExpanded,
117
93
  classNames,
118
94
  emptyContent,
119
- selectedRows,
120
95
  checkedRows,
121
96
  onCheckedRow: handleCheckRow,
122
- onSelectedRow: handleSelectRow,
123
97
  onRowAction
124
98
  }
125
99
  )
@@ -24,11 +24,9 @@ var TableBody = ({
24
24
  isSelected,
25
25
  isChecked,
26
26
  isCheckedRow,
27
- selectedRows,
28
27
  checkedRows,
29
28
  emptyContent,
30
29
  onCheckedRow,
31
- onSelectedRow,
32
30
  onRowAction
33
31
  }) => {
34
32
  const COL_SPAN_COUNT = columns.length + (isExpanded ? 1 : 0) + (isChecked ? 1 : 0);
@@ -43,15 +41,15 @@ var TableBody = ({
43
41
  [classNames == null ? void 0 : classNames.tbody, slots]
44
42
  );
45
43
  const getTrProps = useCallback(
46
- (index) => ({
44
+ ({ index, isSelectedRow }) => ({
47
45
  className: clsx(
48
46
  slots.tr({ class: [classNames == null ? void 0 : classNames.tr, (isSelected || isCheckedRow || isExpanded) && "cursor-pointer"] })
49
47
  ),
50
48
  "data-odd": index % 2 !== 0,
51
49
  "data-expanded": expandedRows.has(index),
52
- "data-selected": selectedRows == null ? void 0 : selectedRows.has(index)
50
+ "data-selected": isSelectedRow
53
51
  }),
54
- [classNames == null ? void 0 : classNames.tr, expandedRows, isCheckedRow, isExpanded, isSelected, selectedRows, slots]
52
+ [classNames == null ? void 0 : classNames.tr, expandedRows, isCheckedRow, isExpanded, isSelected, slots]
55
53
  );
56
54
  const getExpandedContentProps = useCallback(
57
55
  () => ({
@@ -102,7 +100,6 @@ var TableBody = ({
102
100
  e.stopPropagation();
103
101
  e.preventDefault();
104
102
  if (isExpanded) onChangeExpandedRow(index);
105
- if (isSelected) onSelectedRow(index);
106
103
  if (isChecked && isCheckedRow) onCheckedRow(index);
107
104
  const row = rows[index];
108
105
  if (row) {
@@ -112,21 +109,28 @@ var TableBody = ({
112
109
  return /* @__PURE__ */ jsx("tbody", { ...getTbodyProps(), children: rows.length > 0 ? rows.map((row, rowIndex) => {
113
110
  const keys = Object.keys(row);
114
111
  return /* @__PURE__ */ jsxs(React.Fragment, { children: [
115
- /* @__PURE__ */ jsxs("tr", { ...getTrProps(rowIndex), onClick: handleRowClick(rowIndex), children: [
116
- isChecked && /* @__PURE__ */ jsx("td", { ...getTdProps({ field: "checkbox" }, row, keys), onClick: () => onCheckedRow(rowIndex), children: /* @__PURE__ */ jsx(checkbox_default, { color, size, checked: checkedRows.has(rowIndex) }) }),
117
- isExpanded && /* @__PURE__ */ jsx("td", { ...getTdProps({ field: "expandIcon" }, row, keys), children: /* @__PURE__ */ jsx(
118
- Icon_default,
119
- {
120
- name: expandedRows.has(rowIndex) ? "brace-down" : "brace-right",
121
- className: `ml-2 transition-transform`,
122
- size
123
- }
124
- ) }),
125
- columns.map((column, colIndex) => /* @__PURE__ */ createElement("td", { ...getTdProps(column, row, keys), key: colIndex }))
126
- ] }),
112
+ /* @__PURE__ */ jsxs(
113
+ "tr",
114
+ {
115
+ ...getTrProps({ index: rowIndex, isSelectedRow: row.isSelectedRow }),
116
+ onClick: handleRowClick(rowIndex),
117
+ children: [
118
+ isChecked && /* @__PURE__ */ jsx("td", { ...getTdProps({ field: "checkbox" }, row, keys), onClick: () => onCheckedRow(rowIndex), children: /* @__PURE__ */ jsx(checkbox_default, { color, size, checked: checkedRows.has(rowIndex) }) }),
119
+ isExpanded && /* @__PURE__ */ jsx("td", { ...getTdProps({ field: "expandIcon" }, row, keys), children: /* @__PURE__ */ jsx(
120
+ Icon_default,
121
+ {
122
+ name: expandedRows.has(rowIndex) ? "brace-down" : "brace-right",
123
+ className: `ml-2 transition-transform`,
124
+ size
125
+ }
126
+ ) }),
127
+ columns.map((column, colIndex) => /* @__PURE__ */ createElement("td", { ...getTdProps(column, row, keys), key: colIndex }))
128
+ ]
129
+ }
130
+ ),
127
131
  isExpanded && expandedRows.has(rowIndex) && /* @__PURE__ */ jsx("tr", { ...getExpandedContentProps(), children: /* @__PURE__ */ jsx("td", { colSpan: COL_SPAN_COUNT, ...getTdProps({ field: "expandedRow" }, row, keys), children: row.renderExpandedRow && row.renderExpandedRow() }) })
128
132
  ] }, rowIndex);
129
- }) : /* @__PURE__ */ jsx("tr", { ...getTrProps(-1), children: /* @__PURE__ */ jsx("td", { colSpan: COL_SPAN_COUNT, children: emptyContent }) }) });
133
+ }) : /* @__PURE__ */ jsx("tr", { ...getTrProps({ index: -1 }), children: /* @__PURE__ */ jsx("td", { colSpan: COL_SPAN_COUNT, children: emptyContent }) }) });
130
134
  };
131
135
  var table_body_default = TableBody;
132
136
 
@@ -3941,11 +3941,9 @@ var TableBody = ({
3941
3941
  isSelected,
3942
3942
  isChecked,
3943
3943
  isCheckedRow,
3944
- selectedRows,
3945
3944
  checkedRows,
3946
3945
  emptyContent,
3947
3946
  onCheckedRow,
3948
- onSelectedRow,
3949
3947
  onRowAction
3950
3948
  }) => {
3951
3949
  const COL_SPAN_COUNT = columns.length + (isExpanded ? 1 : 0) + (isChecked ? 1 : 0);
@@ -3960,15 +3958,15 @@ var TableBody = ({
3960
3958
  [classNames == null ? void 0 : classNames.tbody, slots]
3961
3959
  );
3962
3960
  const getTrProps = (0, import_react4.useCallback)(
3963
- (index) => ({
3961
+ ({ index, isSelectedRow }) => ({
3964
3962
  className: clsx(
3965
3963
  slots.tr({ class: [classNames == null ? void 0 : classNames.tr, (isSelected || isCheckedRow || isExpanded) && "cursor-pointer"] })
3966
3964
  ),
3967
3965
  "data-odd": index % 2 !== 0,
3968
3966
  "data-expanded": expandedRows.has(index),
3969
- "data-selected": selectedRows == null ? void 0 : selectedRows.has(index)
3967
+ "data-selected": isSelectedRow
3970
3968
  }),
3971
- [classNames == null ? void 0 : classNames.tr, expandedRows, isCheckedRow, isExpanded, isSelected, selectedRows, slots]
3969
+ [classNames == null ? void 0 : classNames.tr, expandedRows, isCheckedRow, isExpanded, isSelected, slots]
3972
3970
  );
3973
3971
  const getExpandedContentProps = (0, import_react4.useCallback)(
3974
3972
  () => ({
@@ -4019,7 +4017,6 @@ var TableBody = ({
4019
4017
  e.stopPropagation();
4020
4018
  e.preventDefault();
4021
4019
  if (isExpanded) onChangeExpandedRow(index);
4022
- if (isSelected) onSelectedRow(index);
4023
4020
  if (isChecked && isCheckedRow) onCheckedRow(index);
4024
4021
  const row = rows[index];
4025
4022
  if (row) {
@@ -4029,21 +4026,28 @@ var TableBody = ({
4029
4026
  return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("tbody", { ...getTbodyProps(), children: rows.length > 0 ? rows.map((row, rowIndex) => {
4030
4027
  const keys = Object.keys(row);
4031
4028
  return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_react4.default.Fragment, { children: [
4032
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("tr", { ...getTrProps(rowIndex), onClick: handleRowClick(rowIndex), children: [
4033
- isChecked && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("td", { ...getTdProps({ field: "checkbox" }, row, keys), onClick: () => onCheckedRow(rowIndex), children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(checkbox_default, { color, size, checked: checkedRows.has(rowIndex) }) }),
4034
- isExpanded && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("td", { ...getTdProps({ field: "expandIcon" }, row, keys), children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
4035
- Icon_default,
4036
- {
4037
- name: expandedRows.has(rowIndex) ? "brace-down" : "brace-right",
4038
- className: `ml-2 transition-transform`,
4039
- size
4040
- }
4041
- ) }),
4042
- columns.map((column, colIndex) => /* @__PURE__ */ (0, import_react5.createElement)("td", { ...getTdProps(column, row, keys), key: colIndex }))
4043
- ] }),
4029
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
4030
+ "tr",
4031
+ {
4032
+ ...getTrProps({ index: rowIndex, isSelectedRow: row.isSelectedRow }),
4033
+ onClick: handleRowClick(rowIndex),
4034
+ children: [
4035
+ isChecked && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("td", { ...getTdProps({ field: "checkbox" }, row, keys), onClick: () => onCheckedRow(rowIndex), children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(checkbox_default, { color, size, checked: checkedRows.has(rowIndex) }) }),
4036
+ isExpanded && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("td", { ...getTdProps({ field: "expandIcon" }, row, keys), children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
4037
+ Icon_default,
4038
+ {
4039
+ name: expandedRows.has(rowIndex) ? "brace-down" : "brace-right",
4040
+ className: `ml-2 transition-transform`,
4041
+ size
4042
+ }
4043
+ ) }),
4044
+ columns.map((column, colIndex) => /* @__PURE__ */ (0, import_react5.createElement)("td", { ...getTdProps(column, row, keys), key: colIndex }))
4045
+ ]
4046
+ }
4047
+ ),
4044
4048
  isExpanded && expandedRows.has(rowIndex) && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("tr", { ...getExpandedContentProps(), children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("td", { colSpan: COL_SPAN_COUNT, ...getTdProps({ field: "expandedRow" }, row, keys), children: row.renderExpandedRow && row.renderExpandedRow() }) })
4045
4049
  ] }, rowIndex);
4046
- }) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("tr", { ...getTrProps(-1), children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("td", { colSpan: COL_SPAN_COUNT, children: emptyContent }) }) });
4050
+ }) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("tr", { ...getTrProps({ index: -1 }), children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("td", { colSpan: COL_SPAN_COUNT, children: emptyContent }) }) });
4047
4051
  };
4048
4052
  var table_body_default = TableBody;
4049
4053
 
@@ -4054,13 +4058,13 @@ var Table = (0, import_react6.forwardRef)((originalProps, ref) => {
4054
4058
  const [props, variantProps] = mapPropsVariants(originalProps, table.variantKeys);
4055
4059
  const { classNames, rows, columns, className, emptyContent, loadingContent, onRowAction, ...tableComponentsProps } = props;
4056
4060
  const [checkedRows, setCheckedRows] = (0, import_react6.useState)(/* @__PURE__ */ new Set());
4057
- const [selectedRows, setSelectedRows] = (0, import_react6.useState)(/* @__PURE__ */ new Set());
4061
+ (0, import_react6.useImperativeHandle)(ref, () => ({
4062
+ checkedRows,
4063
+ setCheckedRows
4064
+ }));
4058
4065
  (0, import_react6.useEffect)(() => {
4059
4066
  setCheckedRows(/* @__PURE__ */ new Set());
4060
4067
  }, [rows]);
4061
- (0, import_react6.useEffect)(() => {
4062
- setSelectedRows(/* @__PURE__ */ new Set());
4063
- }, [rows]);
4064
4068
  const slots = (0, import_react6.useMemo)(() => table({ ...variantProps }), [...Object.values(variantProps)]);
4065
4069
  const getBaseProps = (0, import_react6.useCallback)(
4066
4070
  (props2) => ({
@@ -4096,30 +4100,6 @@ var Table = (0, import_react6.forwardRef)((originalProps, ref) => {
4096
4100
  }
4097
4101
  setCheckedRows(newCheckedRows);
4098
4102
  };
4099
- const handleSelectRow = (index) => {
4100
- const newSelectedRows = new Set(selectedRows);
4101
- if (originalProps.isMultiSelect) {
4102
- if (newSelectedRows.has(index)) {
4103
- newSelectedRows.delete(index);
4104
- } else {
4105
- newSelectedRows.add(index);
4106
- }
4107
- } else {
4108
- if (newSelectedRows.has(index)) {
4109
- newSelectedRows.delete(index);
4110
- } else {
4111
- newSelectedRows.clear();
4112
- newSelectedRows.add(index);
4113
- }
4114
- }
4115
- setSelectedRows(newSelectedRows);
4116
- };
4117
- (0, import_react6.useImperativeHandle)(ref, () => ({
4118
- checkedRows,
4119
- selectedRows,
4120
- setCheckedRows,
4121
- setSelectedRows
4122
- }));
4123
4103
  return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { ref, "data-table": "base", ...getBaseProps(), children: [
4124
4104
  /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("table", { ...getTableProps(tableComponentsProps), children: [
4125
4105
  /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
@@ -4150,10 +4130,8 @@ var Table = (0, import_react6.forwardRef)((originalProps, ref) => {
4150
4130
  isExpanded: originalProps.isExpanded,
4151
4131
  classNames,
4152
4132
  emptyContent,
4153
- selectedRows,
4154
4133
  checkedRows,
4155
4134
  onCheckedRow: handleCheckRow,
4156
- onSelectedRow: handleSelectRow,
4157
4135
  onRowAction
4158
4136
  }
4159
4137
  )
@@ -2,8 +2,8 @@
2
2
  import "../../chunk-2UUH2MBF.mjs";
3
3
  import {
4
4
  table_default
5
- } from "../../chunk-YVBOTJAH.mjs";
6
- import "../../chunk-QDDEQY63.mjs";
5
+ } from "../../chunk-A5PEB7CC.mjs";
6
+ import "../../chunk-VWD26TIQ.mjs";
7
7
  import "../../chunk-PO3ADNA5.mjs";
8
8
  import "../../chunk-QZ3LVYJW.mjs";
9
9
  import "../../chunk-ANYPMQH4.mjs";
@@ -20,9 +20,8 @@ type TableBodyProps = {
20
20
  checkedRows: Set<number>;
21
21
  emptyContent?: ReactNode;
22
22
  onCheckedRow: (index: number) => void;
23
- onSelectedRow: (index: number) => void;
24
23
  onRowAction?: (e: React__default.MouseEvent, params: TableRow) => void;
25
24
  };
26
- declare const TableBody: ({ classNames, size, color, slots, rows, columns, isExpanded, isSelected, isChecked, isCheckedRow, selectedRows, checkedRows, emptyContent, onCheckedRow, onSelectedRow, onRowAction, }: TableBodyProps) => react_jsx_runtime.JSX.Element;
25
+ declare const TableBody: ({ classNames, size, color, slots, rows, columns, isExpanded, isSelected, isChecked, isCheckedRow, checkedRows, emptyContent, onCheckedRow, onRowAction, }: TableBodyProps) => react_jsx_runtime.JSX.Element;
27
26
 
28
27
  export { TableBody as default };
@@ -20,9 +20,8 @@ type TableBodyProps = {
20
20
  checkedRows: Set<number>;
21
21
  emptyContent?: ReactNode;
22
22
  onCheckedRow: (index: number) => void;
23
- onSelectedRow: (index: number) => void;
24
23
  onRowAction?: (e: React__default.MouseEvent, params: TableRow) => void;
25
24
  };
26
- declare const TableBody: ({ classNames, size, color, slots, rows, columns, isExpanded, isSelected, isChecked, isCheckedRow, selectedRows, checkedRows, emptyContent, onCheckedRow, onSelectedRow, onRowAction, }: TableBodyProps) => react_jsx_runtime.JSX.Element;
25
+ declare const TableBody: ({ classNames, size, color, slots, rows, columns, isExpanded, isSelected, isChecked, isCheckedRow, checkedRows, emptyContent, onCheckedRow, onRowAction, }: TableBodyProps) => react_jsx_runtime.JSX.Element;
27
26
 
28
27
  export { TableBody as default };
@@ -3889,11 +3889,9 @@ var TableBody = ({
3889
3889
  isSelected,
3890
3890
  isChecked,
3891
3891
  isCheckedRow,
3892
- selectedRows,
3893
3892
  checkedRows,
3894
3893
  emptyContent,
3895
3894
  onCheckedRow,
3896
- onSelectedRow,
3897
3895
  onRowAction
3898
3896
  }) => {
3899
3897
  const COL_SPAN_COUNT = columns.length + (isExpanded ? 1 : 0) + (isChecked ? 1 : 0);
@@ -3908,15 +3906,15 @@ var TableBody = ({
3908
3906
  [classNames == null ? void 0 : classNames.tbody, slots]
3909
3907
  );
3910
3908
  const getTrProps = (0, import_react2.useCallback)(
3911
- (index) => ({
3909
+ ({ index, isSelectedRow }) => ({
3912
3910
  className: clsx(
3913
3911
  slots.tr({ class: [classNames == null ? void 0 : classNames.tr, (isSelected || isCheckedRow || isExpanded) && "cursor-pointer"] })
3914
3912
  ),
3915
3913
  "data-odd": index % 2 !== 0,
3916
3914
  "data-expanded": expandedRows.has(index),
3917
- "data-selected": selectedRows == null ? void 0 : selectedRows.has(index)
3915
+ "data-selected": isSelectedRow
3918
3916
  }),
3919
- [classNames == null ? void 0 : classNames.tr, expandedRows, isCheckedRow, isExpanded, isSelected, selectedRows, slots]
3917
+ [classNames == null ? void 0 : classNames.tr, expandedRows, isCheckedRow, isExpanded, isSelected, slots]
3920
3918
  );
3921
3919
  const getExpandedContentProps = (0, import_react2.useCallback)(
3922
3920
  () => ({
@@ -3967,7 +3965,6 @@ var TableBody = ({
3967
3965
  e.stopPropagation();
3968
3966
  e.preventDefault();
3969
3967
  if (isExpanded) onChangeExpandedRow(index);
3970
- if (isSelected) onSelectedRow(index);
3971
3968
  if (isChecked && isCheckedRow) onCheckedRow(index);
3972
3969
  const row = rows[index];
3973
3970
  if (row) {
@@ -3977,20 +3974,27 @@ var TableBody = ({
3977
3974
  return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("tbody", { ...getTbodyProps(), children: rows.length > 0 ? rows.map((row, rowIndex) => {
3978
3975
  const keys = Object.keys(row);
3979
3976
  return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_react2.default.Fragment, { children: [
3980
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("tr", { ...getTrProps(rowIndex), onClick: handleRowClick(rowIndex), children: [
3981
- isChecked && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("td", { ...getTdProps({ field: "checkbox" }, row, keys), onClick: () => onCheckedRow(rowIndex), children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(checkbox_default, { color, size, checked: checkedRows.has(rowIndex) }) }),
3982
- isExpanded && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("td", { ...getTdProps({ field: "expandIcon" }, row, keys), children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
3983
- Icon_default,
3984
- {
3985
- name: expandedRows.has(rowIndex) ? "brace-down" : "brace-right",
3986
- className: `ml-2 transition-transform`,
3987
- size
3988
- }
3989
- ) }),
3990
- columns.map((column, colIndex) => /* @__PURE__ */ (0, import_react3.createElement)("td", { ...getTdProps(column, row, keys), key: colIndex }))
3991
- ] }),
3977
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
3978
+ "tr",
3979
+ {
3980
+ ...getTrProps({ index: rowIndex, isSelectedRow: row.isSelectedRow }),
3981
+ onClick: handleRowClick(rowIndex),
3982
+ children: [
3983
+ isChecked && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("td", { ...getTdProps({ field: "checkbox" }, row, keys), onClick: () => onCheckedRow(rowIndex), children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(checkbox_default, { color, size, checked: checkedRows.has(rowIndex) }) }),
3984
+ isExpanded && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("td", { ...getTdProps({ field: "expandIcon" }, row, keys), children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
3985
+ Icon_default,
3986
+ {
3987
+ name: expandedRows.has(rowIndex) ? "brace-down" : "brace-right",
3988
+ className: `ml-2 transition-transform`,
3989
+ size
3990
+ }
3991
+ ) }),
3992
+ columns.map((column, colIndex) => /* @__PURE__ */ (0, import_react3.createElement)("td", { ...getTdProps(column, row, keys), key: colIndex }))
3993
+ ]
3994
+ }
3995
+ ),
3992
3996
  isExpanded && expandedRows.has(rowIndex) && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("tr", { ...getExpandedContentProps(), children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("td", { colSpan: COL_SPAN_COUNT, ...getTdProps({ field: "expandedRow" }, row, keys), children: row.renderExpandedRow && row.renderExpandedRow() }) })
3993
3997
  ] }, rowIndex);
3994
- }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("tr", { ...getTrProps(-1), children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("td", { colSpan: COL_SPAN_COUNT, children: emptyContent }) }) });
3998
+ }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("tr", { ...getTrProps({ index: -1 }), children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("td", { colSpan: COL_SPAN_COUNT, children: emptyContent }) }) });
3995
3999
  };
3996
4000
  var table_body_default = TableBody;
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import {
3
3
  table_body_default
4
- } from "../../chunk-QDDEQY63.mjs";
4
+ } from "../../chunk-VWD26TIQ.mjs";
5
5
  import "../../chunk-QZ3LVYJW.mjs";
6
6
  import "../../chunk-ANYPMQH4.mjs";
7
7
  import "../../chunk-27Y6K5NK.mjs";
@@ -15,9 +15,7 @@ interface Props extends Omit<React__default.ComponentPropsWithRef<"table">, "ref
15
15
  }
16
16
  interface TableRef {
17
17
  checkedRows: Set<number>;
18
- selectedRows: Set<number>;
19
18
  setCheckedRows: (rows: Set<number>) => void;
20
- setSelectedRows: (rows: Set<number>) => void;
21
19
  }
22
20
  declare const Table: React__default.ForwardRefExoticComponent<Props & TableVariantProps & React__default.RefAttributes<TableRef>>;
23
21
 
@@ -15,9 +15,7 @@ interface Props extends Omit<React__default.ComponentPropsWithRef<"table">, "ref
15
15
  }
16
16
  interface TableRef {
17
17
  checkedRows: Set<number>;
18
- selectedRows: Set<number>;
19
18
  setCheckedRows: (rows: Set<number>) => void;
20
- setSelectedRows: (rows: Set<number>) => void;
21
19
  }
22
20
  declare const Table: React__default.ForwardRefExoticComponent<Props & TableVariantProps & React__default.RefAttributes<TableRef>>;
23
21
 
@@ -3939,11 +3939,9 @@ var TableBody = ({
3939
3939
  isSelected,
3940
3940
  isChecked,
3941
3941
  isCheckedRow,
3942
- selectedRows,
3943
3942
  checkedRows,
3944
3943
  emptyContent,
3945
3944
  onCheckedRow,
3946
- onSelectedRow,
3947
3945
  onRowAction
3948
3946
  }) => {
3949
3947
  const COL_SPAN_COUNT = columns.length + (isExpanded ? 1 : 0) + (isChecked ? 1 : 0);
@@ -3958,15 +3956,15 @@ var TableBody = ({
3958
3956
  [classNames == null ? void 0 : classNames.tbody, slots]
3959
3957
  );
3960
3958
  const getTrProps = (0, import_react4.useCallback)(
3961
- (index) => ({
3959
+ ({ index, isSelectedRow }) => ({
3962
3960
  className: clsx(
3963
3961
  slots.tr({ class: [classNames == null ? void 0 : classNames.tr, (isSelected || isCheckedRow || isExpanded) && "cursor-pointer"] })
3964
3962
  ),
3965
3963
  "data-odd": index % 2 !== 0,
3966
3964
  "data-expanded": expandedRows.has(index),
3967
- "data-selected": selectedRows == null ? void 0 : selectedRows.has(index)
3965
+ "data-selected": isSelectedRow
3968
3966
  }),
3969
- [classNames == null ? void 0 : classNames.tr, expandedRows, isCheckedRow, isExpanded, isSelected, selectedRows, slots]
3967
+ [classNames == null ? void 0 : classNames.tr, expandedRows, isCheckedRow, isExpanded, isSelected, slots]
3970
3968
  );
3971
3969
  const getExpandedContentProps = (0, import_react4.useCallback)(
3972
3970
  () => ({
@@ -4017,7 +4015,6 @@ var TableBody = ({
4017
4015
  e.stopPropagation();
4018
4016
  e.preventDefault();
4019
4017
  if (isExpanded) onChangeExpandedRow(index);
4020
- if (isSelected) onSelectedRow(index);
4021
4018
  if (isChecked && isCheckedRow) onCheckedRow(index);
4022
4019
  const row = rows[index];
4023
4020
  if (row) {
@@ -4027,21 +4024,28 @@ var TableBody = ({
4027
4024
  return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("tbody", { ...getTbodyProps(), children: rows.length > 0 ? rows.map((row, rowIndex) => {
4028
4025
  const keys = Object.keys(row);
4029
4026
  return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_react4.default.Fragment, { children: [
4030
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("tr", { ...getTrProps(rowIndex), onClick: handleRowClick(rowIndex), children: [
4031
- isChecked && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("td", { ...getTdProps({ field: "checkbox" }, row, keys), onClick: () => onCheckedRow(rowIndex), children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(checkbox_default, { color, size, checked: checkedRows.has(rowIndex) }) }),
4032
- isExpanded && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("td", { ...getTdProps({ field: "expandIcon" }, row, keys), children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
4033
- Icon_default,
4034
- {
4035
- name: expandedRows.has(rowIndex) ? "brace-down" : "brace-right",
4036
- className: `ml-2 transition-transform`,
4037
- size
4038
- }
4039
- ) }),
4040
- columns.map((column, colIndex) => /* @__PURE__ */ (0, import_react5.createElement)("td", { ...getTdProps(column, row, keys), key: colIndex }))
4041
- ] }),
4027
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
4028
+ "tr",
4029
+ {
4030
+ ...getTrProps({ index: rowIndex, isSelectedRow: row.isSelectedRow }),
4031
+ onClick: handleRowClick(rowIndex),
4032
+ children: [
4033
+ isChecked && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("td", { ...getTdProps({ field: "checkbox" }, row, keys), onClick: () => onCheckedRow(rowIndex), children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(checkbox_default, { color, size, checked: checkedRows.has(rowIndex) }) }),
4034
+ isExpanded && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("td", { ...getTdProps({ field: "expandIcon" }, row, keys), children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
4035
+ Icon_default,
4036
+ {
4037
+ name: expandedRows.has(rowIndex) ? "brace-down" : "brace-right",
4038
+ className: `ml-2 transition-transform`,
4039
+ size
4040
+ }
4041
+ ) }),
4042
+ columns.map((column, colIndex) => /* @__PURE__ */ (0, import_react5.createElement)("td", { ...getTdProps(column, row, keys), key: colIndex }))
4043
+ ]
4044
+ }
4045
+ ),
4042
4046
  isExpanded && expandedRows.has(rowIndex) && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("tr", { ...getExpandedContentProps(), children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("td", { colSpan: COL_SPAN_COUNT, ...getTdProps({ field: "expandedRow" }, row, keys), children: row.renderExpandedRow && row.renderExpandedRow() }) })
4043
4047
  ] }, rowIndex);
4044
- }) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("tr", { ...getTrProps(-1), children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("td", { colSpan: COL_SPAN_COUNT, children: emptyContent }) }) });
4048
+ }) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("tr", { ...getTrProps({ index: -1 }), children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("td", { colSpan: COL_SPAN_COUNT, children: emptyContent }) }) });
4045
4049
  };
4046
4050
  var table_body_default = TableBody;
4047
4051
 
@@ -4052,13 +4056,13 @@ var Table = (0, import_react6.forwardRef)((originalProps, ref) => {
4052
4056
  const [props, variantProps] = mapPropsVariants(originalProps, table.variantKeys);
4053
4057
  const { classNames, rows, columns, className, emptyContent, loadingContent, onRowAction, ...tableComponentsProps } = props;
4054
4058
  const [checkedRows, setCheckedRows] = (0, import_react6.useState)(/* @__PURE__ */ new Set());
4055
- const [selectedRows, setSelectedRows] = (0, import_react6.useState)(/* @__PURE__ */ new Set());
4059
+ (0, import_react6.useImperativeHandle)(ref, () => ({
4060
+ checkedRows,
4061
+ setCheckedRows
4062
+ }));
4056
4063
  (0, import_react6.useEffect)(() => {
4057
4064
  setCheckedRows(/* @__PURE__ */ new Set());
4058
4065
  }, [rows]);
4059
- (0, import_react6.useEffect)(() => {
4060
- setSelectedRows(/* @__PURE__ */ new Set());
4061
- }, [rows]);
4062
4066
  const slots = (0, import_react6.useMemo)(() => table({ ...variantProps }), [...Object.values(variantProps)]);
4063
4067
  const getBaseProps = (0, import_react6.useCallback)(
4064
4068
  (props2) => ({
@@ -4094,30 +4098,6 @@ var Table = (0, import_react6.forwardRef)((originalProps, ref) => {
4094
4098
  }
4095
4099
  setCheckedRows(newCheckedRows);
4096
4100
  };
4097
- const handleSelectRow = (index) => {
4098
- const newSelectedRows = new Set(selectedRows);
4099
- if (originalProps.isMultiSelect) {
4100
- if (newSelectedRows.has(index)) {
4101
- newSelectedRows.delete(index);
4102
- } else {
4103
- newSelectedRows.add(index);
4104
- }
4105
- } else {
4106
- if (newSelectedRows.has(index)) {
4107
- newSelectedRows.delete(index);
4108
- } else {
4109
- newSelectedRows.clear();
4110
- newSelectedRows.add(index);
4111
- }
4112
- }
4113
- setSelectedRows(newSelectedRows);
4114
- };
4115
- (0, import_react6.useImperativeHandle)(ref, () => ({
4116
- checkedRows,
4117
- selectedRows,
4118
- setCheckedRows,
4119
- setSelectedRows
4120
- }));
4121
4101
  return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { ref, "data-table": "base", ...getBaseProps(), children: [
4122
4102
  /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("table", { ...getTableProps(tableComponentsProps), children: [
4123
4103
  /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
@@ -4148,10 +4128,8 @@ var Table = (0, import_react6.forwardRef)((originalProps, ref) => {
4148
4128
  isExpanded: originalProps.isExpanded,
4149
4129
  classNames,
4150
4130
  emptyContent,
4151
- selectedRows,
4152
4131
  checkedRows,
4153
4132
  onCheckedRow: handleCheckRow,
4154
- onSelectedRow: handleSelectRow,
4155
4133
  onRowAction
4156
4134
  }
4157
4135
  )
@@ -1,8 +1,8 @@
1
1
  "use client";
2
2
  import {
3
3
  table_default
4
- } from "../../chunk-YVBOTJAH.mjs";
5
- import "../../chunk-QDDEQY63.mjs";
4
+ } from "../../chunk-A5PEB7CC.mjs";
5
+ import "../../chunk-VWD26TIQ.mjs";
6
6
  import "../../chunk-PO3ADNA5.mjs";
7
7
  import "../../chunk-QZ3LVYJW.mjs";
8
8
  import "../../chunk-ANYPMQH4.mjs";
@@ -16776,11 +16776,9 @@ var TableBody = ({
16776
16776
  isSelected,
16777
16777
  isChecked,
16778
16778
  isCheckedRow,
16779
- selectedRows,
16780
16779
  checkedRows,
16781
16780
  emptyContent,
16782
16781
  onCheckedRow,
16783
- onSelectedRow,
16784
16782
  onRowAction
16785
16783
  }) => {
16786
16784
  const COL_SPAN_COUNT = columns2.length + (isExpanded ? 1 : 0) + (isChecked ? 1 : 0);
@@ -16795,15 +16793,15 @@ var TableBody = ({
16795
16793
  [classNames == null ? void 0 : classNames.tbody, slots]
16796
16794
  );
16797
16795
  const getTrProps = (0, import_react4.useCallback)(
16798
- (index) => ({
16796
+ ({ index, isSelectedRow }) => ({
16799
16797
  className: clsx(
16800
16798
  slots.tr({ class: [classNames == null ? void 0 : classNames.tr, (isSelected || isCheckedRow || isExpanded) && "cursor-pointer"] })
16801
16799
  ),
16802
16800
  "data-odd": index % 2 !== 0,
16803
16801
  "data-expanded": expandedRows.has(index),
16804
- "data-selected": selectedRows == null ? void 0 : selectedRows.has(index)
16802
+ "data-selected": isSelectedRow
16805
16803
  }),
16806
- [classNames == null ? void 0 : classNames.tr, expandedRows, isCheckedRow, isExpanded, isSelected, selectedRows, slots]
16804
+ [classNames == null ? void 0 : classNames.tr, expandedRows, isCheckedRow, isExpanded, isSelected, slots]
16807
16805
  );
16808
16806
  const getExpandedContentProps = (0, import_react4.useCallback)(
16809
16807
  () => ({
@@ -16854,7 +16852,6 @@ var TableBody = ({
16854
16852
  e.stopPropagation();
16855
16853
  e.preventDefault();
16856
16854
  if (isExpanded) onChangeExpandedRow(index);
16857
- if (isSelected) onSelectedRow(index);
16858
16855
  if (isChecked && isCheckedRow) onCheckedRow(index);
16859
16856
  const row = rows2[index];
16860
16857
  if (row) {
@@ -16864,21 +16861,28 @@ var TableBody = ({
16864
16861
  return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("tbody", { ...getTbodyProps(), children: rows2.length > 0 ? rows2.map((row, rowIndex) => {
16865
16862
  const keys = Object.keys(row);
16866
16863
  return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_react4.default.Fragment, { children: [
16867
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("tr", { ...getTrProps(rowIndex), onClick: handleRowClick(rowIndex), children: [
16868
- isChecked && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("td", { ...getTdProps({ field: "checkbox" }, row, keys), onClick: () => onCheckedRow(rowIndex), children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(checkbox_default, { color, size, checked: checkedRows.has(rowIndex) }) }),
16869
- isExpanded && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("td", { ...getTdProps({ field: "expandIcon" }, row, keys), children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
16870
- Icon_default,
16871
- {
16872
- name: expandedRows.has(rowIndex) ? "brace-down" : "brace-right",
16873
- className: `ml-2 transition-transform`,
16874
- size
16875
- }
16876
- ) }),
16877
- columns2.map((column, colIndex) => /* @__PURE__ */ (0, import_react5.createElement)("td", { ...getTdProps(column, row, keys), key: colIndex }))
16878
- ] }),
16864
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
16865
+ "tr",
16866
+ {
16867
+ ...getTrProps({ index: rowIndex, isSelectedRow: row.isSelectedRow }),
16868
+ onClick: handleRowClick(rowIndex),
16869
+ children: [
16870
+ isChecked && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("td", { ...getTdProps({ field: "checkbox" }, row, keys), onClick: () => onCheckedRow(rowIndex), children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(checkbox_default, { color, size, checked: checkedRows.has(rowIndex) }) }),
16871
+ isExpanded && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("td", { ...getTdProps({ field: "expandIcon" }, row, keys), children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
16872
+ Icon_default,
16873
+ {
16874
+ name: expandedRows.has(rowIndex) ? "brace-down" : "brace-right",
16875
+ className: `ml-2 transition-transform`,
16876
+ size
16877
+ }
16878
+ ) }),
16879
+ columns2.map((column, colIndex) => /* @__PURE__ */ (0, import_react5.createElement)("td", { ...getTdProps(column, row, keys), key: colIndex }))
16880
+ ]
16881
+ }
16882
+ ),
16879
16883
  isExpanded && expandedRows.has(rowIndex) && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("tr", { ...getExpandedContentProps(), children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("td", { colSpan: COL_SPAN_COUNT, ...getTdProps({ field: "expandedRow" }, row, keys), children: row.renderExpandedRow && row.renderExpandedRow() }) })
16880
16884
  ] }, rowIndex);
16881
- }) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("tr", { ...getTrProps(-1), children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("td", { colSpan: COL_SPAN_COUNT, children: emptyContent }) }) });
16885
+ }) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("tr", { ...getTrProps({ index: -1 }), children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("td", { colSpan: COL_SPAN_COUNT, children: emptyContent }) }) });
16882
16886
  };
16883
16887
  var table_body_default = TableBody;
16884
16888
 
@@ -16889,13 +16893,13 @@ var Table = (0, import_react6.forwardRef)((originalProps, ref) => {
16889
16893
  const [props, variantProps] = mapPropsVariants(originalProps, table.variantKeys);
16890
16894
  const { classNames, rows: rows2, columns: columns2, className, emptyContent, loadingContent, onRowAction, ...tableComponentsProps } = props;
16891
16895
  const [checkedRows, setCheckedRows] = (0, import_react6.useState)(/* @__PURE__ */ new Set());
16892
- const [selectedRows, setSelectedRows] = (0, import_react6.useState)(/* @__PURE__ */ new Set());
16896
+ (0, import_react6.useImperativeHandle)(ref, () => ({
16897
+ checkedRows,
16898
+ setCheckedRows
16899
+ }));
16893
16900
  (0, import_react6.useEffect)(() => {
16894
16901
  setCheckedRows(/* @__PURE__ */ new Set());
16895
16902
  }, [rows2]);
16896
- (0, import_react6.useEffect)(() => {
16897
- setSelectedRows(/* @__PURE__ */ new Set());
16898
- }, [rows2]);
16899
16903
  const slots = (0, import_react6.useMemo)(() => table({ ...variantProps }), [...Object.values(variantProps)]);
16900
16904
  const getBaseProps = (0, import_react6.useCallback)(
16901
16905
  (props2) => ({
@@ -16931,30 +16935,6 @@ var Table = (0, import_react6.forwardRef)((originalProps, ref) => {
16931
16935
  }
16932
16936
  setCheckedRows(newCheckedRows);
16933
16937
  };
16934
- const handleSelectRow = (index) => {
16935
- const newSelectedRows = new Set(selectedRows);
16936
- if (originalProps.isMultiSelect) {
16937
- if (newSelectedRows.has(index)) {
16938
- newSelectedRows.delete(index);
16939
- } else {
16940
- newSelectedRows.add(index);
16941
- }
16942
- } else {
16943
- if (newSelectedRows.has(index)) {
16944
- newSelectedRows.delete(index);
16945
- } else {
16946
- newSelectedRows.clear();
16947
- newSelectedRows.add(index);
16948
- }
16949
- }
16950
- setSelectedRows(newSelectedRows);
16951
- };
16952
- (0, import_react6.useImperativeHandle)(ref, () => ({
16953
- checkedRows,
16954
- selectedRows,
16955
- setCheckedRows,
16956
- setSelectedRows
16957
- }));
16958
16938
  return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { ref, "data-table": "base", ...getBaseProps(), children: [
16959
16939
  /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("table", { ...getTableProps(tableComponentsProps), children: [
16960
16940
  /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
@@ -16985,10 +16965,8 @@ var Table = (0, import_react6.forwardRef)((originalProps, ref) => {
16985
16965
  isExpanded: originalProps.isExpanded,
16986
16966
  classNames,
16987
16967
  emptyContent,
16988
- selectedRows,
16989
16968
  checkedRows,
16990
16969
  onCheckedRow: handleCheckRow,
16991
- onSelectedRow: handleSelectRow,
16992
16970
  onRowAction
16993
16971
  }
16994
16972
  )
@@ -1,8 +1,8 @@
1
1
  "use client";
2
2
  import {
3
3
  table_default
4
- } from "../../chunk-YVBOTJAH.mjs";
5
- import "../../chunk-QDDEQY63.mjs";
4
+ } from "../../chunk-A5PEB7CC.mjs";
5
+ import "../../chunk-VWD26TIQ.mjs";
6
6
  import "../../chunk-PO3ADNA5.mjs";
7
7
  import "../../chunk-QZ3LVYJW.mjs";
8
8
  import "../../chunk-ANYPMQH4.mjs";
package/dist/index.js CHANGED
@@ -5355,11 +5355,9 @@ var TableBody = ({
5355
5355
  isSelected,
5356
5356
  isChecked,
5357
5357
  isCheckedRow,
5358
- selectedRows,
5359
5358
  checkedRows,
5360
5359
  emptyContent,
5361
5360
  onCheckedRow,
5362
- onSelectedRow,
5363
5361
  onRowAction
5364
5362
  }) => {
5365
5363
  const COL_SPAN_COUNT = columns.length + (isExpanded ? 1 : 0) + (isChecked ? 1 : 0);
@@ -5374,15 +5372,15 @@ var TableBody = ({
5374
5372
  [classNames == null ? void 0 : classNames.tbody, slots]
5375
5373
  );
5376
5374
  const getTrProps = (0, import_react9.useCallback)(
5377
- (index) => ({
5375
+ ({ index, isSelectedRow }) => ({
5378
5376
  className: clsx(
5379
5377
  slots.tr({ class: [classNames == null ? void 0 : classNames.tr, (isSelected || isCheckedRow || isExpanded) && "cursor-pointer"] })
5380
5378
  ),
5381
5379
  "data-odd": index % 2 !== 0,
5382
5380
  "data-expanded": expandedRows.has(index),
5383
- "data-selected": selectedRows == null ? void 0 : selectedRows.has(index)
5381
+ "data-selected": isSelectedRow
5384
5382
  }),
5385
- [classNames == null ? void 0 : classNames.tr, expandedRows, isCheckedRow, isExpanded, isSelected, selectedRows, slots]
5383
+ [classNames == null ? void 0 : classNames.tr, expandedRows, isCheckedRow, isExpanded, isSelected, slots]
5386
5384
  );
5387
5385
  const getExpandedContentProps = (0, import_react9.useCallback)(
5388
5386
  () => ({
@@ -5433,7 +5431,6 @@ var TableBody = ({
5433
5431
  e.stopPropagation();
5434
5432
  e.preventDefault();
5435
5433
  if (isExpanded) onChangeExpandedRow(index);
5436
- if (isSelected) onSelectedRow(index);
5437
5434
  if (isChecked && isCheckedRow) onCheckedRow(index);
5438
5435
  const row = rows[index];
5439
5436
  if (row) {
@@ -5443,21 +5440,28 @@ var TableBody = ({
5443
5440
  return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("tbody", { ...getTbodyProps(), children: rows.length > 0 ? rows.map((row, rowIndex) => {
5444
5441
  const keys = Object.keys(row);
5445
5442
  return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_react9.default.Fragment, { children: [
5446
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("tr", { ...getTrProps(rowIndex), onClick: handleRowClick(rowIndex), children: [
5447
- isChecked && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("td", { ...getTdProps({ field: "checkbox" }, row, keys), onClick: () => onCheckedRow(rowIndex), children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(checkbox_default, { color, size, checked: checkedRows.has(rowIndex) }) }),
5448
- isExpanded && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("td", { ...getTdProps({ field: "expandIcon" }, row, keys), children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
5449
- Icon_default,
5450
- {
5451
- name: expandedRows.has(rowIndex) ? "brace-down" : "brace-right",
5452
- className: `ml-2 transition-transform`,
5453
- size
5454
- }
5455
- ) }),
5456
- columns.map((column, colIndex) => /* @__PURE__ */ (0, import_react10.createElement)("td", { ...getTdProps(column, row, keys), key: colIndex }))
5457
- ] }),
5443
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
5444
+ "tr",
5445
+ {
5446
+ ...getTrProps({ index: rowIndex, isSelectedRow: row.isSelectedRow }),
5447
+ onClick: handleRowClick(rowIndex),
5448
+ children: [
5449
+ isChecked && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("td", { ...getTdProps({ field: "checkbox" }, row, keys), onClick: () => onCheckedRow(rowIndex), children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(checkbox_default, { color, size, checked: checkedRows.has(rowIndex) }) }),
5450
+ isExpanded && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("td", { ...getTdProps({ field: "expandIcon" }, row, keys), children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
5451
+ Icon_default,
5452
+ {
5453
+ name: expandedRows.has(rowIndex) ? "brace-down" : "brace-right",
5454
+ className: `ml-2 transition-transform`,
5455
+ size
5456
+ }
5457
+ ) }),
5458
+ columns.map((column, colIndex) => /* @__PURE__ */ (0, import_react10.createElement)("td", { ...getTdProps(column, row, keys), key: colIndex }))
5459
+ ]
5460
+ }
5461
+ ),
5458
5462
  isExpanded && expandedRows.has(rowIndex) && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("tr", { ...getExpandedContentProps(), children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("td", { colSpan: COL_SPAN_COUNT, ...getTdProps({ field: "expandedRow" }, row, keys), children: row.renderExpandedRow && row.renderExpandedRow() }) })
5459
5463
  ] }, rowIndex);
5460
- }) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("tr", { ...getTrProps(-1), children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("td", { colSpan: COL_SPAN_COUNT, children: emptyContent }) }) });
5464
+ }) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("tr", { ...getTrProps({ index: -1 }), children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("td", { colSpan: COL_SPAN_COUNT, children: emptyContent }) }) });
5461
5465
  };
5462
5466
  var table_body_default = TableBody;
5463
5467
 
@@ -5468,13 +5472,13 @@ var Table = (0, import_react11.forwardRef)((originalProps, ref) => {
5468
5472
  const [props, variantProps] = mapPropsVariants(originalProps, table.variantKeys);
5469
5473
  const { classNames, rows, columns, className, emptyContent, loadingContent, onRowAction, ...tableComponentsProps } = props;
5470
5474
  const [checkedRows, setCheckedRows] = (0, import_react11.useState)(/* @__PURE__ */ new Set());
5471
- const [selectedRows, setSelectedRows] = (0, import_react11.useState)(/* @__PURE__ */ new Set());
5475
+ (0, import_react11.useImperativeHandle)(ref, () => ({
5476
+ checkedRows,
5477
+ setCheckedRows
5478
+ }));
5472
5479
  (0, import_react11.useEffect)(() => {
5473
5480
  setCheckedRows(/* @__PURE__ */ new Set());
5474
5481
  }, [rows]);
5475
- (0, import_react11.useEffect)(() => {
5476
- setSelectedRows(/* @__PURE__ */ new Set());
5477
- }, [rows]);
5478
5482
  const slots = (0, import_react11.useMemo)(() => table({ ...variantProps }), [...Object.values(variantProps)]);
5479
5483
  const getBaseProps = (0, import_react11.useCallback)(
5480
5484
  (props2) => ({
@@ -5510,30 +5514,6 @@ var Table = (0, import_react11.forwardRef)((originalProps, ref) => {
5510
5514
  }
5511
5515
  setCheckedRows(newCheckedRows);
5512
5516
  };
5513
- const handleSelectRow = (index) => {
5514
- const newSelectedRows = new Set(selectedRows);
5515
- if (originalProps.isMultiSelect) {
5516
- if (newSelectedRows.has(index)) {
5517
- newSelectedRows.delete(index);
5518
- } else {
5519
- newSelectedRows.add(index);
5520
- }
5521
- } else {
5522
- if (newSelectedRows.has(index)) {
5523
- newSelectedRows.delete(index);
5524
- } else {
5525
- newSelectedRows.clear();
5526
- newSelectedRows.add(index);
5527
- }
5528
- }
5529
- setSelectedRows(newSelectedRows);
5530
- };
5531
- (0, import_react11.useImperativeHandle)(ref, () => ({
5532
- checkedRows,
5533
- selectedRows,
5534
- setCheckedRows,
5535
- setSelectedRows
5536
- }));
5537
5517
  return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { ref, "data-table": "base", ...getBaseProps(), children: [
5538
5518
  /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("table", { ...getTableProps(tableComponentsProps), children: [
5539
5519
  /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
@@ -5564,10 +5544,8 @@ var Table = (0, import_react11.forwardRef)((originalProps, ref) => {
5564
5544
  isExpanded: originalProps.isExpanded,
5565
5545
  classNames,
5566
5546
  emptyContent,
5567
- selectedRows,
5568
5547
  checkedRows,
5569
5548
  onCheckedRow: handleCheckRow,
5570
- onSelectedRow: handleSelectRow,
5571
5549
  onRowAction
5572
5550
  }
5573
5551
  )
package/dist/index.mjs CHANGED
@@ -1,4 +1,18 @@
1
1
  "use client";
2
+ import "./chunk-HIE2YRGA.mjs";
3
+ import {
4
+ tooltip_default
5
+ } from "./chunk-FY5YCQL5.mjs";
6
+ import "./chunk-DSBSLSJW.mjs";
7
+ import "./chunk-ODMRJXLJ.mjs";
8
+ import "./chunk-RRAZM5D3.mjs";
9
+ import {
10
+ textarea_default
11
+ } from "./chunk-OJ2OEI5B.mjs";
12
+ import "./chunk-3MY6LO7N.mjs";
13
+ import {
14
+ tabs_default
15
+ } from "./chunk-KRI5IALM.mjs";
2
16
  import "./chunk-LUWGOKLG.mjs";
3
17
  import {
4
18
  ToastProvider,
@@ -8,30 +22,20 @@ import "./chunk-ZOTHPHXA.mjs";
8
22
  import {
9
23
  toast_default
10
24
  } from "./chunk-PXUBPWKU.mjs";
11
- import "./chunk-LVFI2NOH.mjs";
12
- import {
13
- switch_default
14
- } from "./chunk-S3O52LLG.mjs";
15
- import "./chunk-RRAZM5D3.mjs";
16
- import {
17
- textarea_default
18
- } from "./chunk-OJ2OEI5B.mjs";
19
- import "./chunk-HIE2YRGA.mjs";
20
- import {
21
- tooltip_default
22
- } from "./chunk-FY5YCQL5.mjs";
23
- import "./chunk-DSBSLSJW.mjs";
24
- import "./chunk-ODMRJXLJ.mjs";
25
25
  import "./chunk-2UUH2MBF.mjs";
26
26
  import {
27
27
  table_default
28
- } from "./chunk-YVBOTJAH.mjs";
29
- import "./chunk-QDDEQY63.mjs";
28
+ } from "./chunk-A5PEB7CC.mjs";
29
+ import "./chunk-VWD26TIQ.mjs";
30
30
  import "./chunk-PO3ADNA5.mjs";
31
- import "./chunk-3MY6LO7N.mjs";
31
+ import "./chunk-TPFN22HR.mjs";
32
32
  import {
33
- tabs_default
34
- } from "./chunk-KRI5IALM.mjs";
33
+ radio_default
34
+ } from "./chunk-QWFOYO3D.mjs";
35
+ import "./chunk-LVFI2NOH.mjs";
36
+ import {
37
+ switch_default
38
+ } from "./chunk-S3O52LLG.mjs";
35
39
  import "./chunk-QCEKPS7U.mjs";
36
40
  import {
37
41
  select_default
@@ -46,10 +50,6 @@ import "./chunk-7VOQKIIK.mjs";
46
50
  import {
47
51
  progress_default
48
52
  } from "./chunk-N2JULHST.mjs";
49
- import "./chunk-TPFN22HR.mjs";
50
- import {
51
- radio_default
52
- } from "./chunk-QWFOYO3D.mjs";
53
53
  import "./chunk-DJOG6Z35.mjs";
54
54
  import {
55
55
  modal_default
@@ -63,11 +63,11 @@ import "./chunk-2GCSFWHD.mjs";
63
63
  import {
64
64
  input_default
65
65
  } from "./chunk-ZNEEYSIK.mjs";
66
+ import "./chunk-VUYUQGLF.mjs";
66
67
  import "./chunk-QZ3LVYJW.mjs";
67
- import "./chunk-HAOK24MK.mjs";
68
68
  import {
69
- card_default
70
- } from "./chunk-2ALY3PH5.mjs";
69
+ checkbox_default
70
+ } from "./chunk-ANYPMQH4.mjs";
71
71
  import "./chunk-75HLCORR.mjs";
72
72
  import {
73
73
  dateTimePicker_default
@@ -84,16 +84,16 @@ import {
84
84
  listItem_default
85
85
  } from "./chunk-V77MALL4.mjs";
86
86
  import "./chunk-NMSDSEBD.mjs";
87
- import "./chunk-VUYUQGLF.mjs";
87
+ import "./chunk-HAOK24MK.mjs";
88
+ import {
89
+ card_default
90
+ } from "./chunk-2ALY3PH5.mjs";
88
91
  import {
89
92
  button_group_default
90
93
  } from "./chunk-NGQ3MK2J.mjs";
91
94
  import {
92
95
  button_default
93
96
  } from "./chunk-UR64ZUAU.mjs";
94
- import {
95
- checkbox_default
96
- } from "./chunk-ANYPMQH4.mjs";
97
97
  import "./chunk-27Y6K5NK.mjs";
98
98
  import {
99
99
  accordion_default
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deepnoid/ui",
3
- "version": "0.0.100",
3
+ "version": "0.0.102",
4
4
  "license": "MIT",
5
5
  "sideEffects": false,
6
6
  "main": "dist/index.js",