@deepnoid/ui 0.0.95 → 0.0.97
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.
- package/dist/{chunk-JWFWFBQM.mjs → chunk-PNFR2J4Q.mjs} +62 -27
- package/dist/{chunk-VG4644BG.mjs → chunk-PO3ADNA5.mjs} +6 -6
- package/dist/{chunk-PR277HT5.mjs → chunk-QDDEQY63.mjs} +15 -8
- package/dist/components/accordion/accordion.test.mjs +3 -3
- package/dist/components/button/button-group.test.mjs +3 -3
- package/dist/components/button/button.test.mjs +3 -3
- package/dist/components/checkbox/checkbox.test.mjs +3 -3
- package/dist/components/input/input.test.mjs +1 -1
- package/dist/components/modal/modal.test.mjs +1 -1
- package/dist/components/select/select.test.mjs +3 -3
- package/dist/components/table/index.js +80 -38
- package/dist/components/table/index.mjs +3 -3
- package/dist/components/table/table-body.d.mts +7 -4
- package/dist/components/table/table-body.d.ts +7 -4
- package/dist/components/table/table-body.js +15 -8
- package/dist/components/table/table-body.mjs +1 -1
- package/dist/components/table/table-head.d.mts +4 -4
- package/dist/components/table/table-head.d.ts +4 -4
- package/dist/components/table/table-head.js +6 -6
- package/dist/components/table/table-head.mjs +1 -1
- package/dist/components/table/table.d.mts +51 -7
- package/dist/components/table/table.d.ts +51 -7
- package/dist/components/table/table.js +80 -38
- package/dist/components/table/table.mjs +3 -3
- package/dist/components/table/table.test.js +80 -38
- package/dist/components/table/table.test.mjs +3 -3
- package/dist/components/tabs/tabs.test.mjs +3 -3
- package/dist/components/textarea/textarea.test.mjs +1 -1
- package/dist/components/tooltip/tooltip.test.mjs +3 -3
- package/dist/index.js +80 -38
- package/dist/index.mjs +32 -32
- package/package.json +1 -1
|
@@ -13155,10 +13155,10 @@ var TableHead = ({
|
|
|
13155
13155
|
size,
|
|
13156
13156
|
color,
|
|
13157
13157
|
isExpanded,
|
|
13158
|
-
|
|
13159
|
-
|
|
13158
|
+
isChecked,
|
|
13159
|
+
isCheckedAll,
|
|
13160
13160
|
classNames,
|
|
13161
|
-
|
|
13161
|
+
onCheckAll
|
|
13162
13162
|
}) => {
|
|
13163
13163
|
const getTheadProps = (0, import_react2.useCallback)(
|
|
13164
13164
|
() => ({
|
|
@@ -13178,12 +13178,12 @@ var TableHead = ({
|
|
|
13178
13178
|
}),
|
|
13179
13179
|
[classNames == null ? void 0 : classNames.th, slots]
|
|
13180
13180
|
);
|
|
13181
|
-
const
|
|
13181
|
+
const handleClickCheckAll = (e) => {
|
|
13182
13182
|
e.preventDefault();
|
|
13183
|
-
|
|
13183
|
+
onCheckAll(!isCheckedAll);
|
|
13184
13184
|
};
|
|
13185
13185
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("thead", { ...getTheadProps(), children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("tr", { ...getTrProps(), children: [
|
|
13186
|
-
|
|
13186
|
+
isChecked && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("th", { className: "w-[40px]", onClick: handleClickCheckAll, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(checkbox_default, { size, color, checked: isCheckedAll, classNames: { wrapper: "bg-background" } }) }),
|
|
13187
13187
|
isExpanded && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("th", { className: "w-[40px]" }),
|
|
13188
13188
|
columns2.map((column, index) => /* @__PURE__ */ (0, import_react3.createElement)("th", { ...getThProps(column), key: column.field + index + "th" }, column.headerName))
|
|
13189
13189
|
] }) });
|
|
@@ -16774,13 +16774,16 @@ var TableBody = ({
|
|
|
16774
16774
|
columns: columns2,
|
|
16775
16775
|
isExpanded,
|
|
16776
16776
|
isSelected,
|
|
16777
|
-
|
|
16777
|
+
isChecked,
|
|
16778
|
+
isCheckedRow,
|
|
16778
16779
|
selectedRows,
|
|
16780
|
+
checkedRows,
|
|
16779
16781
|
emptyContent,
|
|
16780
|
-
|
|
16782
|
+
onCheckedRow,
|
|
16783
|
+
onSelectedRow,
|
|
16781
16784
|
onRowAction
|
|
16782
16785
|
}) => {
|
|
16783
|
-
const COL_SPAN_COUNT = columns2.length + (isExpanded ? 1 : 0) + (
|
|
16786
|
+
const COL_SPAN_COUNT = columns2.length + (isExpanded ? 1 : 0) + (isChecked ? 1 : 0);
|
|
16784
16787
|
const [expandedRows, setExpandedRows] = (0, import_react4.useState)(/* @__PURE__ */ new Set());
|
|
16785
16788
|
(0, import_react4.useEffect)(() => {
|
|
16786
16789
|
setExpandedRows(/* @__PURE__ */ new Set());
|
|
@@ -16793,11 +16796,14 @@ var TableBody = ({
|
|
|
16793
16796
|
);
|
|
16794
16797
|
const getTrProps = (0, import_react4.useCallback)(
|
|
16795
16798
|
(index) => ({
|
|
16796
|
-
className: clsx(
|
|
16799
|
+
className: clsx(
|
|
16800
|
+
slots.tr({ class: [classNames == null ? void 0 : classNames.tr, (isSelected || isCheckedRow || isExpanded) && "cursor-pointer"] })
|
|
16801
|
+
),
|
|
16797
16802
|
"data-odd": index % 2 !== 0,
|
|
16798
|
-
"data-expanded": expandedRows.has(index)
|
|
16803
|
+
"data-expanded": expandedRows.has(index),
|
|
16804
|
+
"data-selected": selectedRows == null ? void 0 : selectedRows.has(index)
|
|
16799
16805
|
}),
|
|
16800
|
-
[classNames == null ? void 0 : classNames.tr, expandedRows, slots]
|
|
16806
|
+
[classNames == null ? void 0 : classNames.tr, expandedRows, isCheckedRow, isExpanded, isSelected, selectedRows, slots]
|
|
16801
16807
|
);
|
|
16802
16808
|
const getExpandedContentProps = (0, import_react4.useCallback)(
|
|
16803
16809
|
() => ({
|
|
@@ -16848,7 +16854,8 @@ var TableBody = ({
|
|
|
16848
16854
|
e.stopPropagation();
|
|
16849
16855
|
e.preventDefault();
|
|
16850
16856
|
if (isExpanded) onChangeExpandedRow(index);
|
|
16851
|
-
if (isSelected
|
|
16857
|
+
if (isSelected) onSelectedRow(index);
|
|
16858
|
+
if (isChecked && isCheckedRow) onCheckedRow(index);
|
|
16852
16859
|
const row = rows2[index];
|
|
16853
16860
|
if (row) {
|
|
16854
16861
|
(_a2 = row.onRowAction) == null ? void 0 : _a2.call(row, e, row);
|
|
@@ -16858,7 +16865,7 @@ var TableBody = ({
|
|
|
16858
16865
|
const keys = Object.keys(row);
|
|
16859
16866
|
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_react4.default.Fragment, { children: [
|
|
16860
16867
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("tr", { ...getTrProps(rowIndex), onClick: handleRowClick(rowIndex), children: [
|
|
16861
|
-
|
|
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) }) }),
|
|
16862
16869
|
isExpanded && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("td", { ...getTdProps({ field: "expandIcon" }, row, keys), children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
16863
16870
|
Icon_default,
|
|
16864
16871
|
{
|
|
@@ -16881,7 +16888,14 @@ var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
|
16881
16888
|
var Table = (0, import_react6.forwardRef)((originalProps, ref) => {
|
|
16882
16889
|
const [props, variantProps] = mapPropsVariants(originalProps, table.variantKeys);
|
|
16883
16890
|
const { classNames, rows: rows2, columns: columns2, isLoading, className, emptyContent, onRowAction, ...tableComponentsProps } = props;
|
|
16891
|
+
const [checkedRows, setCheckedRows] = (0, import_react6.useState)(/* @__PURE__ */ new Set());
|
|
16884
16892
|
const [selectedRows, setSelectedRows] = (0, import_react6.useState)(/* @__PURE__ */ new Set());
|
|
16893
|
+
(0, import_react6.useEffect)(() => {
|
|
16894
|
+
setCheckedRows(/* @__PURE__ */ new Set());
|
|
16895
|
+
}, [rows2]);
|
|
16896
|
+
(0, import_react6.useEffect)(() => {
|
|
16897
|
+
setSelectedRows(/* @__PURE__ */ new Set());
|
|
16898
|
+
}, [rows2]);
|
|
16885
16899
|
const slots = (0, import_react6.useMemo)(() => table({ ...variantProps }), [...Object.values(variantProps)]);
|
|
16886
16900
|
const getBaseProps = (0, import_react6.useCallback)(
|
|
16887
16901
|
(props2) => ({
|
|
@@ -16897,21 +16911,41 @@ var Table = (0, import_react6.forwardRef)((originalProps, ref) => {
|
|
|
16897
16911
|
}),
|
|
16898
16912
|
[classNames == null ? void 0 : classNames.table, slots]
|
|
16899
16913
|
);
|
|
16900
|
-
const
|
|
16901
|
-
const
|
|
16902
|
-
|
|
16914
|
+
const handleCheckAll = (isChecked) => {
|
|
16915
|
+
const newCheckedRows = isChecked ? new Set(rows2.map((_, index) => index)) : /* @__PURE__ */ new Set();
|
|
16916
|
+
setCheckedRows(newCheckedRows);
|
|
16917
|
+
};
|
|
16918
|
+
const handleCheckRow = (index) => {
|
|
16919
|
+
const newCheckedRows = new Set(checkedRows);
|
|
16920
|
+
if (newCheckedRows.has(index)) {
|
|
16921
|
+
newCheckedRows.delete(index);
|
|
16922
|
+
} else {
|
|
16923
|
+
newCheckedRows.add(index);
|
|
16924
|
+
}
|
|
16925
|
+
setCheckedRows(newCheckedRows);
|
|
16903
16926
|
};
|
|
16904
16927
|
const handleSelectRow = (index) => {
|
|
16905
16928
|
const newSelectedRows = new Set(selectedRows);
|
|
16906
|
-
if (
|
|
16907
|
-
newSelectedRows.
|
|
16929
|
+
if (originalProps.isMultiSelect) {
|
|
16930
|
+
if (newSelectedRows.has(index)) {
|
|
16931
|
+
newSelectedRows.delete(index);
|
|
16932
|
+
} else {
|
|
16933
|
+
newSelectedRows.add(index);
|
|
16934
|
+
}
|
|
16908
16935
|
} else {
|
|
16909
|
-
newSelectedRows.
|
|
16936
|
+
if (newSelectedRows.has(index)) {
|
|
16937
|
+
newSelectedRows.delete(index);
|
|
16938
|
+
} else {
|
|
16939
|
+
newSelectedRows.clear();
|
|
16940
|
+
newSelectedRows.add(index);
|
|
16941
|
+
}
|
|
16910
16942
|
}
|
|
16911
16943
|
setSelectedRows(newSelectedRows);
|
|
16912
16944
|
};
|
|
16913
16945
|
(0, import_react6.useImperativeHandle)(ref, () => ({
|
|
16946
|
+
checkedRows,
|
|
16914
16947
|
selectedRows,
|
|
16948
|
+
setCheckedRows,
|
|
16915
16949
|
setSelectedRows
|
|
16916
16950
|
}));
|
|
16917
16951
|
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { ref, "data-table": "base", ...getBaseProps(), children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("table", { ...getTableProps(tableComponentsProps), children: [
|
|
@@ -16923,10 +16957,10 @@ var Table = (0, import_react6.forwardRef)((originalProps, ref) => {
|
|
|
16923
16957
|
columns: columns2,
|
|
16924
16958
|
size: originalProps.size,
|
|
16925
16959
|
color: originalProps.color === "neutral" ? "primary" : originalProps.color,
|
|
16926
|
-
|
|
16960
|
+
isChecked: originalProps.isChecked,
|
|
16927
16961
|
isExpanded: originalProps.isExpanded,
|
|
16928
|
-
|
|
16929
|
-
|
|
16962
|
+
onCheckAll: handleCheckAll,
|
|
16963
|
+
isCheckedAll: checkedRows.size === rows2.length
|
|
16930
16964
|
}
|
|
16931
16965
|
),
|
|
16932
16966
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
@@ -16938,13 +16972,16 @@ var Table = (0, import_react6.forwardRef)((originalProps, ref) => {
|
|
|
16938
16972
|
size: originalProps.size,
|
|
16939
16973
|
color: originalProps.color === "neutral" ? "primary" : originalProps.color,
|
|
16940
16974
|
isSelected: originalProps.isSelected,
|
|
16941
|
-
|
|
16975
|
+
isChecked: originalProps.isChecked,
|
|
16976
|
+
isCheckedRow: originalProps.isCheckedRow,
|
|
16942
16977
|
isExpanded: originalProps.isExpanded,
|
|
16943
16978
|
isLoading,
|
|
16944
16979
|
classNames,
|
|
16945
16980
|
emptyContent,
|
|
16946
16981
|
selectedRows,
|
|
16947
|
-
|
|
16982
|
+
checkedRows,
|
|
16983
|
+
onCheckedRow: handleCheckRow,
|
|
16984
|
+
onSelectedRow: handleSelectRow,
|
|
16948
16985
|
onRowAction
|
|
16949
16986
|
}
|
|
16950
16987
|
)
|
|
@@ -16955,13 +16992,13 @@ var table_default = Table;
|
|
|
16955
16992
|
var table = (0, import_tailwind_variants3.tv)({
|
|
16956
16993
|
slots: {
|
|
16957
16994
|
base: "flex flex-col relative gap-4",
|
|
16958
|
-
table: "
|
|
16995
|
+
table: "w-full h-auto",
|
|
16959
16996
|
thead: "[&>tr]:first:rounded-lg",
|
|
16960
|
-
tbody: "",
|
|
16961
|
-
tr: ["group", "outline-none"],
|
|
16997
|
+
tbody: "w-full",
|
|
16998
|
+
tr: ["group", "outline-none", "w-full"],
|
|
16962
16999
|
th: [
|
|
16963
17000
|
"text-foreground",
|
|
16964
|
-
"text-center",
|
|
17001
|
+
"!text-center",
|
|
16965
17002
|
"align-middle",
|
|
16966
17003
|
"whitespace-nowrap",
|
|
16967
17004
|
"font-normal",
|
|
@@ -16980,7 +17017,6 @@ var table = (0, import_tailwind_variants3.tv)({
|
|
|
16980
17017
|
"[&>*]:z-1",
|
|
16981
17018
|
"[&>*]:relative",
|
|
16982
17019
|
"transition duration-200",
|
|
16983
|
-
"data-[selected=true]:before:opacity-100",
|
|
16984
17020
|
"group-data-[disabled=true]:text-default-300"
|
|
16985
17021
|
],
|
|
16986
17022
|
tfoot: "",
|
|
@@ -17046,7 +17082,13 @@ var table = (0, import_tailwind_variants3.tv)({
|
|
|
17046
17082
|
isSelected: {
|
|
17047
17083
|
true: {}
|
|
17048
17084
|
},
|
|
17049
|
-
|
|
17085
|
+
isMultiSelect: {
|
|
17086
|
+
true: {}
|
|
17087
|
+
},
|
|
17088
|
+
isChecked: {
|
|
17089
|
+
true: {}
|
|
17090
|
+
},
|
|
17091
|
+
isCheckedRow: {
|
|
17050
17092
|
true: {
|
|
17051
17093
|
tr: "cursor-pointer"
|
|
17052
17094
|
}
|
|
@@ -17078,7 +17120,7 @@ var table = (0, import_tailwind_variants3.tv)({
|
|
|
17078
17120
|
color: "primary",
|
|
17079
17121
|
variant: "solid",
|
|
17080
17122
|
size: "md",
|
|
17081
|
-
|
|
17123
|
+
isChecked: false,
|
|
17082
17124
|
isExpanded: false,
|
|
17083
17125
|
isCompact: false,
|
|
17084
17126
|
hideHeader: false,
|
|
@@ -17091,7 +17133,7 @@ var table = (0, import_tailwind_variants3.tv)({
|
|
|
17091
17133
|
color: "primary",
|
|
17092
17134
|
class: {
|
|
17093
17135
|
thead: "[&>tr]:bg-primary-light",
|
|
17094
|
-
tr: "data-[expanded=true]:bg-primary-soft"
|
|
17136
|
+
tr: ["data-[expanded=true]:bg-primary-soft", "data-[selected=true]:bg-primary-soft"]
|
|
17095
17137
|
}
|
|
17096
17138
|
},
|
|
17097
17139
|
{
|
|
@@ -17099,7 +17141,7 @@ var table = (0, import_tailwind_variants3.tv)({
|
|
|
17099
17141
|
color: "secondary",
|
|
17100
17142
|
class: {
|
|
17101
17143
|
thead: "[&>tr]:bg-secondary-light",
|
|
17102
|
-
tr: "data-[expanded=true]:bg-secondary-soft"
|
|
17144
|
+
tr: ["data-[expanded=true]:bg-secondary-soft", "data-[selected=true]:bg-secondary-soft"]
|
|
17103
17145
|
}
|
|
17104
17146
|
},
|
|
17105
17147
|
{
|
|
@@ -17107,7 +17149,7 @@ var table = (0, import_tailwind_variants3.tv)({
|
|
|
17107
17149
|
color: "neutral",
|
|
17108
17150
|
class: {
|
|
17109
17151
|
thead: "[&>tr]:bg-trans-light",
|
|
17110
|
-
tr: "data-[expanded=true]:bg-neutral-soft"
|
|
17152
|
+
tr: ["data-[expanded=true]:bg-neutral-soft", "data-[selected=true]:bg-neutral-soft"]
|
|
17111
17153
|
}
|
|
17112
17154
|
},
|
|
17113
17155
|
{
|
|
@@ -17115,7 +17157,7 @@ var table = (0, import_tailwind_variants3.tv)({
|
|
|
17115
17157
|
color: "primary",
|
|
17116
17158
|
class: {
|
|
17117
17159
|
thead: "border-primary-light",
|
|
17118
|
-
tr: "data-[expanded=true]:bg-primary-soft"
|
|
17160
|
+
tr: ["data-[expanded=true]:bg-primary-soft", "data-[selected=true]:bg-primary-soft"]
|
|
17119
17161
|
}
|
|
17120
17162
|
},
|
|
17121
17163
|
{
|
|
@@ -17123,7 +17165,7 @@ var table = (0, import_tailwind_variants3.tv)({
|
|
|
17123
17165
|
color: "secondary",
|
|
17124
17166
|
class: {
|
|
17125
17167
|
thead: "border-secondary-light",
|
|
17126
|
-
tr: "data-[expanded=true]:bg-secondary-soft"
|
|
17168
|
+
tr: ["data-[expanded=true]:bg-secondary-soft", "data-[selected=true]:bg-secondary-soft"]
|
|
17127
17169
|
}
|
|
17128
17170
|
},
|
|
17129
17171
|
{
|
|
@@ -17131,7 +17173,7 @@ var table = (0, import_tailwind_variants3.tv)({
|
|
|
17131
17173
|
color: "neutral",
|
|
17132
17174
|
class: {
|
|
17133
17175
|
thead: "border-trans-light",
|
|
17134
|
-
tr: "data-[expanded=true]:bg-neutral-soft"
|
|
17176
|
+
tr: ["data-[expanded=true]:bg-neutral-soft", "data-[selected=true]:bg-neutral-soft"]
|
|
17135
17177
|
}
|
|
17136
17178
|
},
|
|
17137
17179
|
{
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
table_default
|
|
4
|
-
} from "../../chunk-
|
|
5
|
-
import "../../chunk-
|
|
6
|
-
import "../../chunk-
|
|
4
|
+
} from "../../chunk-PNFR2J4Q.mjs";
|
|
5
|
+
import "../../chunk-QDDEQY63.mjs";
|
|
6
|
+
import "../../chunk-PO3ADNA5.mjs";
|
|
7
7
|
import "../../chunk-QZ3LVYJW.mjs";
|
|
8
8
|
import "../../chunk-ANYPMQH4.mjs";
|
|
9
9
|
import "../../chunk-27Y6K5NK.mjs";
|
|
@@ -6,12 +6,12 @@ import "../../chunk-DSBSLSJW.mjs";
|
|
|
6
6
|
import "../../chunk-ODMRJXLJ.mjs";
|
|
7
7
|
import "../../chunk-VUYUQGLF.mjs";
|
|
8
8
|
import "../../chunk-NGQ3MK2J.mjs";
|
|
9
|
-
import {
|
|
10
|
-
render
|
|
11
|
-
} from "../../chunk-FNPWLOGV.mjs";
|
|
12
9
|
import {
|
|
13
10
|
button_default
|
|
14
11
|
} from "../../chunk-UR64ZUAU.mjs";
|
|
12
|
+
import {
|
|
13
|
+
render
|
|
14
|
+
} from "../../chunk-FNPWLOGV.mjs";
|
|
15
15
|
import "../../chunk-ZYIIXWVY.mjs";
|
|
16
16
|
import "../../chunk-LCI6RPWE.mjs";
|
|
17
17
|
import "../../chunk-IOCRFIQF.mjs";
|
package/dist/index.js
CHANGED
|
@@ -5305,10 +5305,10 @@ var TableHead = ({
|
|
|
5305
5305
|
size,
|
|
5306
5306
|
color,
|
|
5307
5307
|
isExpanded,
|
|
5308
|
-
|
|
5309
|
-
|
|
5308
|
+
isChecked,
|
|
5309
|
+
isCheckedAll,
|
|
5310
5310
|
classNames,
|
|
5311
|
-
|
|
5311
|
+
onCheckAll
|
|
5312
5312
|
}) => {
|
|
5313
5313
|
const getTheadProps = (0, import_react7.useCallback)(
|
|
5314
5314
|
() => ({
|
|
@@ -5328,12 +5328,12 @@ var TableHead = ({
|
|
|
5328
5328
|
}),
|
|
5329
5329
|
[classNames == null ? void 0 : classNames.th, slots]
|
|
5330
5330
|
);
|
|
5331
|
-
const
|
|
5331
|
+
const handleClickCheckAll = (e) => {
|
|
5332
5332
|
e.preventDefault();
|
|
5333
|
-
|
|
5333
|
+
onCheckAll(!isCheckedAll);
|
|
5334
5334
|
};
|
|
5335
5335
|
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("thead", { ...getTheadProps(), children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("tr", { ...getTrProps(), children: [
|
|
5336
|
-
|
|
5336
|
+
isChecked && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("th", { className: "w-[40px]", onClick: handleClickCheckAll, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(checkbox_default, { size, color, checked: isCheckedAll, classNames: { wrapper: "bg-background" } }) }),
|
|
5337
5337
|
isExpanded && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("th", { className: "w-[40px]" }),
|
|
5338
5338
|
columns.map((column, index) => /* @__PURE__ */ (0, import_react8.createElement)("th", { ...getThProps(column), key: column.field + index + "th" }, column.headerName))
|
|
5339
5339
|
] }) });
|
|
@@ -5353,13 +5353,16 @@ var TableBody = ({
|
|
|
5353
5353
|
columns,
|
|
5354
5354
|
isExpanded,
|
|
5355
5355
|
isSelected,
|
|
5356
|
-
|
|
5356
|
+
isChecked,
|
|
5357
|
+
isCheckedRow,
|
|
5357
5358
|
selectedRows,
|
|
5359
|
+
checkedRows,
|
|
5358
5360
|
emptyContent,
|
|
5359
|
-
|
|
5361
|
+
onCheckedRow,
|
|
5362
|
+
onSelectedRow,
|
|
5360
5363
|
onRowAction
|
|
5361
5364
|
}) => {
|
|
5362
|
-
const COL_SPAN_COUNT = columns.length + (isExpanded ? 1 : 0) + (
|
|
5365
|
+
const COL_SPAN_COUNT = columns.length + (isExpanded ? 1 : 0) + (isChecked ? 1 : 0);
|
|
5363
5366
|
const [expandedRows, setExpandedRows] = (0, import_react9.useState)(/* @__PURE__ */ new Set());
|
|
5364
5367
|
(0, import_react9.useEffect)(() => {
|
|
5365
5368
|
setExpandedRows(/* @__PURE__ */ new Set());
|
|
@@ -5372,11 +5375,14 @@ var TableBody = ({
|
|
|
5372
5375
|
);
|
|
5373
5376
|
const getTrProps = (0, import_react9.useCallback)(
|
|
5374
5377
|
(index) => ({
|
|
5375
|
-
className: clsx(
|
|
5378
|
+
className: clsx(
|
|
5379
|
+
slots.tr({ class: [classNames == null ? void 0 : classNames.tr, (isSelected || isCheckedRow || isExpanded) && "cursor-pointer"] })
|
|
5380
|
+
),
|
|
5376
5381
|
"data-odd": index % 2 !== 0,
|
|
5377
|
-
"data-expanded": expandedRows.has(index)
|
|
5382
|
+
"data-expanded": expandedRows.has(index),
|
|
5383
|
+
"data-selected": selectedRows == null ? void 0 : selectedRows.has(index)
|
|
5378
5384
|
}),
|
|
5379
|
-
[classNames == null ? void 0 : classNames.tr, expandedRows, slots]
|
|
5385
|
+
[classNames == null ? void 0 : classNames.tr, expandedRows, isCheckedRow, isExpanded, isSelected, selectedRows, slots]
|
|
5380
5386
|
);
|
|
5381
5387
|
const getExpandedContentProps = (0, import_react9.useCallback)(
|
|
5382
5388
|
() => ({
|
|
@@ -5427,7 +5433,8 @@ var TableBody = ({
|
|
|
5427
5433
|
e.stopPropagation();
|
|
5428
5434
|
e.preventDefault();
|
|
5429
5435
|
if (isExpanded) onChangeExpandedRow(index);
|
|
5430
|
-
if (isSelected
|
|
5436
|
+
if (isSelected) onSelectedRow(index);
|
|
5437
|
+
if (isChecked && isCheckedRow) onCheckedRow(index);
|
|
5431
5438
|
const row = rows[index];
|
|
5432
5439
|
if (row) {
|
|
5433
5440
|
(_a = row.onRowAction) == null ? void 0 : _a.call(row, e, row);
|
|
@@ -5437,7 +5444,7 @@ var TableBody = ({
|
|
|
5437
5444
|
const keys = Object.keys(row);
|
|
5438
5445
|
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_react9.default.Fragment, { children: [
|
|
5439
5446
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("tr", { ...getTrProps(rowIndex), onClick: handleRowClick(rowIndex), children: [
|
|
5440
|
-
|
|
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) }) }),
|
|
5441
5448
|
isExpanded && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("td", { ...getTdProps({ field: "expandIcon" }, row, keys), children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
5442
5449
|
Icon_default,
|
|
5443
5450
|
{
|
|
@@ -5460,7 +5467,14 @@ var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
|
5460
5467
|
var Table = (0, import_react11.forwardRef)((originalProps, ref) => {
|
|
5461
5468
|
const [props, variantProps] = mapPropsVariants(originalProps, table.variantKeys);
|
|
5462
5469
|
const { classNames, rows, columns, isLoading, className, emptyContent, onRowAction, ...tableComponentsProps } = props;
|
|
5470
|
+
const [checkedRows, setCheckedRows] = (0, import_react11.useState)(/* @__PURE__ */ new Set());
|
|
5463
5471
|
const [selectedRows, setSelectedRows] = (0, import_react11.useState)(/* @__PURE__ */ new Set());
|
|
5472
|
+
(0, import_react11.useEffect)(() => {
|
|
5473
|
+
setCheckedRows(/* @__PURE__ */ new Set());
|
|
5474
|
+
}, [rows]);
|
|
5475
|
+
(0, import_react11.useEffect)(() => {
|
|
5476
|
+
setSelectedRows(/* @__PURE__ */ new Set());
|
|
5477
|
+
}, [rows]);
|
|
5464
5478
|
const slots = (0, import_react11.useMemo)(() => table({ ...variantProps }), [...Object.values(variantProps)]);
|
|
5465
5479
|
const getBaseProps = (0, import_react11.useCallback)(
|
|
5466
5480
|
(props2) => ({
|
|
@@ -5476,21 +5490,41 @@ var Table = (0, import_react11.forwardRef)((originalProps, ref) => {
|
|
|
5476
5490
|
}),
|
|
5477
5491
|
[classNames == null ? void 0 : classNames.table, slots]
|
|
5478
5492
|
);
|
|
5479
|
-
const
|
|
5480
|
-
const
|
|
5481
|
-
|
|
5493
|
+
const handleCheckAll = (isChecked) => {
|
|
5494
|
+
const newCheckedRows = isChecked ? new Set(rows.map((_, index) => index)) : /* @__PURE__ */ new Set();
|
|
5495
|
+
setCheckedRows(newCheckedRows);
|
|
5496
|
+
};
|
|
5497
|
+
const handleCheckRow = (index) => {
|
|
5498
|
+
const newCheckedRows = new Set(checkedRows);
|
|
5499
|
+
if (newCheckedRows.has(index)) {
|
|
5500
|
+
newCheckedRows.delete(index);
|
|
5501
|
+
} else {
|
|
5502
|
+
newCheckedRows.add(index);
|
|
5503
|
+
}
|
|
5504
|
+
setCheckedRows(newCheckedRows);
|
|
5482
5505
|
};
|
|
5483
5506
|
const handleSelectRow = (index) => {
|
|
5484
5507
|
const newSelectedRows = new Set(selectedRows);
|
|
5485
|
-
if (
|
|
5486
|
-
newSelectedRows.
|
|
5508
|
+
if (originalProps.isMultiSelect) {
|
|
5509
|
+
if (newSelectedRows.has(index)) {
|
|
5510
|
+
newSelectedRows.delete(index);
|
|
5511
|
+
} else {
|
|
5512
|
+
newSelectedRows.add(index);
|
|
5513
|
+
}
|
|
5487
5514
|
} else {
|
|
5488
|
-
newSelectedRows.
|
|
5515
|
+
if (newSelectedRows.has(index)) {
|
|
5516
|
+
newSelectedRows.delete(index);
|
|
5517
|
+
} else {
|
|
5518
|
+
newSelectedRows.clear();
|
|
5519
|
+
newSelectedRows.add(index);
|
|
5520
|
+
}
|
|
5489
5521
|
}
|
|
5490
5522
|
setSelectedRows(newSelectedRows);
|
|
5491
5523
|
};
|
|
5492
5524
|
(0, import_react11.useImperativeHandle)(ref, () => ({
|
|
5525
|
+
checkedRows,
|
|
5493
5526
|
selectedRows,
|
|
5527
|
+
setCheckedRows,
|
|
5494
5528
|
setSelectedRows
|
|
5495
5529
|
}));
|
|
5496
5530
|
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { ref, "data-table": "base", ...getBaseProps(), children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("table", { ...getTableProps(tableComponentsProps), children: [
|
|
@@ -5502,10 +5536,10 @@ var Table = (0, import_react11.forwardRef)((originalProps, ref) => {
|
|
|
5502
5536
|
columns,
|
|
5503
5537
|
size: originalProps.size,
|
|
5504
5538
|
color: originalProps.color === "neutral" ? "primary" : originalProps.color,
|
|
5505
|
-
|
|
5539
|
+
isChecked: originalProps.isChecked,
|
|
5506
5540
|
isExpanded: originalProps.isExpanded,
|
|
5507
|
-
|
|
5508
|
-
|
|
5541
|
+
onCheckAll: handleCheckAll,
|
|
5542
|
+
isCheckedAll: checkedRows.size === rows.length
|
|
5509
5543
|
}
|
|
5510
5544
|
),
|
|
5511
5545
|
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
@@ -5517,13 +5551,16 @@ var Table = (0, import_react11.forwardRef)((originalProps, ref) => {
|
|
|
5517
5551
|
size: originalProps.size,
|
|
5518
5552
|
color: originalProps.color === "neutral" ? "primary" : originalProps.color,
|
|
5519
5553
|
isSelected: originalProps.isSelected,
|
|
5520
|
-
|
|
5554
|
+
isChecked: originalProps.isChecked,
|
|
5555
|
+
isCheckedRow: originalProps.isCheckedRow,
|
|
5521
5556
|
isExpanded: originalProps.isExpanded,
|
|
5522
5557
|
isLoading,
|
|
5523
5558
|
classNames,
|
|
5524
5559
|
emptyContent,
|
|
5525
5560
|
selectedRows,
|
|
5526
|
-
|
|
5561
|
+
checkedRows,
|
|
5562
|
+
onCheckedRow: handleCheckRow,
|
|
5563
|
+
onSelectedRow: handleSelectRow,
|
|
5527
5564
|
onRowAction
|
|
5528
5565
|
}
|
|
5529
5566
|
)
|
|
@@ -5534,13 +5571,13 @@ var table_default = Table;
|
|
|
5534
5571
|
var table = (0, import_tailwind_variants8.tv)({
|
|
5535
5572
|
slots: {
|
|
5536
5573
|
base: "flex flex-col relative gap-4",
|
|
5537
|
-
table: "
|
|
5574
|
+
table: "w-full h-auto",
|
|
5538
5575
|
thead: "[&>tr]:first:rounded-lg",
|
|
5539
|
-
tbody: "",
|
|
5540
|
-
tr: ["group", "outline-none"],
|
|
5576
|
+
tbody: "w-full",
|
|
5577
|
+
tr: ["group", "outline-none", "w-full"],
|
|
5541
5578
|
th: [
|
|
5542
5579
|
"text-foreground",
|
|
5543
|
-
"text-center",
|
|
5580
|
+
"!text-center",
|
|
5544
5581
|
"align-middle",
|
|
5545
5582
|
"whitespace-nowrap",
|
|
5546
5583
|
"font-normal",
|
|
@@ -5559,7 +5596,6 @@ var table = (0, import_tailwind_variants8.tv)({
|
|
|
5559
5596
|
"[&>*]:z-1",
|
|
5560
5597
|
"[&>*]:relative",
|
|
5561
5598
|
"transition duration-200",
|
|
5562
|
-
"data-[selected=true]:before:opacity-100",
|
|
5563
5599
|
"group-data-[disabled=true]:text-default-300"
|
|
5564
5600
|
],
|
|
5565
5601
|
tfoot: "",
|
|
@@ -5625,7 +5661,13 @@ var table = (0, import_tailwind_variants8.tv)({
|
|
|
5625
5661
|
isSelected: {
|
|
5626
5662
|
true: {}
|
|
5627
5663
|
},
|
|
5628
|
-
|
|
5664
|
+
isMultiSelect: {
|
|
5665
|
+
true: {}
|
|
5666
|
+
},
|
|
5667
|
+
isChecked: {
|
|
5668
|
+
true: {}
|
|
5669
|
+
},
|
|
5670
|
+
isCheckedRow: {
|
|
5629
5671
|
true: {
|
|
5630
5672
|
tr: "cursor-pointer"
|
|
5631
5673
|
}
|
|
@@ -5657,7 +5699,7 @@ var table = (0, import_tailwind_variants8.tv)({
|
|
|
5657
5699
|
color: "primary",
|
|
5658
5700
|
variant: "solid",
|
|
5659
5701
|
size: "md",
|
|
5660
|
-
|
|
5702
|
+
isChecked: false,
|
|
5661
5703
|
isExpanded: false,
|
|
5662
5704
|
isCompact: false,
|
|
5663
5705
|
hideHeader: false,
|
|
@@ -5670,7 +5712,7 @@ var table = (0, import_tailwind_variants8.tv)({
|
|
|
5670
5712
|
color: "primary",
|
|
5671
5713
|
class: {
|
|
5672
5714
|
thead: "[&>tr]:bg-primary-light",
|
|
5673
|
-
tr: "data-[expanded=true]:bg-primary-soft"
|
|
5715
|
+
tr: ["data-[expanded=true]:bg-primary-soft", "data-[selected=true]:bg-primary-soft"]
|
|
5674
5716
|
}
|
|
5675
5717
|
},
|
|
5676
5718
|
{
|
|
@@ -5678,7 +5720,7 @@ var table = (0, import_tailwind_variants8.tv)({
|
|
|
5678
5720
|
color: "secondary",
|
|
5679
5721
|
class: {
|
|
5680
5722
|
thead: "[&>tr]:bg-secondary-light",
|
|
5681
|
-
tr: "data-[expanded=true]:bg-secondary-soft"
|
|
5723
|
+
tr: ["data-[expanded=true]:bg-secondary-soft", "data-[selected=true]:bg-secondary-soft"]
|
|
5682
5724
|
}
|
|
5683
5725
|
},
|
|
5684
5726
|
{
|
|
@@ -5686,7 +5728,7 @@ var table = (0, import_tailwind_variants8.tv)({
|
|
|
5686
5728
|
color: "neutral",
|
|
5687
5729
|
class: {
|
|
5688
5730
|
thead: "[&>tr]:bg-trans-light",
|
|
5689
|
-
tr: "data-[expanded=true]:bg-neutral-soft"
|
|
5731
|
+
tr: ["data-[expanded=true]:bg-neutral-soft", "data-[selected=true]:bg-neutral-soft"]
|
|
5690
5732
|
}
|
|
5691
5733
|
},
|
|
5692
5734
|
{
|
|
@@ -5694,7 +5736,7 @@ var table = (0, import_tailwind_variants8.tv)({
|
|
|
5694
5736
|
color: "primary",
|
|
5695
5737
|
class: {
|
|
5696
5738
|
thead: "border-primary-light",
|
|
5697
|
-
tr: "data-[expanded=true]:bg-primary-soft"
|
|
5739
|
+
tr: ["data-[expanded=true]:bg-primary-soft", "data-[selected=true]:bg-primary-soft"]
|
|
5698
5740
|
}
|
|
5699
5741
|
},
|
|
5700
5742
|
{
|
|
@@ -5702,7 +5744,7 @@ var table = (0, import_tailwind_variants8.tv)({
|
|
|
5702
5744
|
color: "secondary",
|
|
5703
5745
|
class: {
|
|
5704
5746
|
thead: "border-secondary-light",
|
|
5705
|
-
tr: "data-[expanded=true]:bg-secondary-soft"
|
|
5747
|
+
tr: ["data-[expanded=true]:bg-secondary-soft", "data-[selected=true]:bg-secondary-soft"]
|
|
5706
5748
|
}
|
|
5707
5749
|
},
|
|
5708
5750
|
{
|
|
@@ -5710,7 +5752,7 @@ var table = (0, import_tailwind_variants8.tv)({
|
|
|
5710
5752
|
color: "neutral",
|
|
5711
5753
|
class: {
|
|
5712
5754
|
thead: "border-trans-light",
|
|
5713
|
-
tr: "data-[expanded=true]:bg-neutral-soft"
|
|
5755
|
+
tr: ["data-[expanded=true]:bg-neutral-soft", "data-[selected=true]:bg-neutral-soft"]
|
|
5714
5756
|
}
|
|
5715
5757
|
},
|
|
5716
5758
|
{
|