@deepnoid/ui 0.1.38 → 0.1.40
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/.turbo/turbo-build.log +130 -130
- package/dist/{chunk-BFNWSILP.mjs → chunk-NLYGDZK3.mjs} +17 -13
- package/dist/{chunk-2M5G4MRK.mjs → chunk-Y37BWBR3.mjs} +9 -2
- package/dist/components/breadcrumb/breadcrumb.mjs +2 -2
- package/dist/components/breadcrumb/index.mjs +2 -2
- package/dist/components/button/index.mjs +6 -6
- package/dist/components/fileUpload/fileUpload.mjs +3 -3
- package/dist/components/fileUpload/index.mjs +3 -3
- package/dist/components/modal/index.mjs +2 -2
- package/dist/components/modal/modal.mjs +2 -2
- package/dist/components/select/index.js +17 -13
- package/dist/components/select/index.mjs +1 -1
- package/dist/components/select/select.d.mts +1 -0
- package/dist/components/select/select.d.ts +1 -0
- package/dist/components/select/select.js +17 -13
- package/dist/components/select/select.mjs +1 -1
- package/dist/components/table/index.js +9 -2
- package/dist/components/table/index.mjs +1 -1
- package/dist/components/table/table.d.mts +1 -0
- package/dist/components/table/table.d.ts +1 -0
- package/dist/components/table/table.js +9 -2
- package/dist/components/table/table.mjs +1 -1
- package/dist/index.js +26 -15
- package/dist/index.mjs +13 -13
- package/package.json +1 -1
- package/dist/{chunk-25QOEKXS.mjs → chunk-TRR232FS.mjs} +3 -3
|
@@ -4,13 +4,13 @@ import {
|
|
|
4
4
|
breadcrumb_default
|
|
5
5
|
} from "../../chunk-G67WUZO3.mjs";
|
|
6
6
|
import "../../chunk-MY5U63QO.mjs";
|
|
7
|
+
import "../../chunk-7TAGGLNY.mjs";
|
|
8
|
+
import "../../chunk-WFMFC7R6.mjs";
|
|
7
9
|
import "../../chunk-LPZOH3RP.mjs";
|
|
8
10
|
import "../../chunk-UB4YBFOT.mjs";
|
|
9
|
-
import "../../chunk-7TAGGLNY.mjs";
|
|
10
11
|
import "../../chunk-6WSACUIB.mjs";
|
|
11
12
|
import "../../chunk-LXHUO6VM.mjs";
|
|
12
13
|
import "../../chunk-6PNKRBUT.mjs";
|
|
13
|
-
import "../../chunk-WFMFC7R6.mjs";
|
|
14
14
|
import "../../chunk-ZYIIXWVY.mjs";
|
|
15
15
|
import "../../chunk-2TKEWFGH.mjs";
|
|
16
16
|
import "../../chunk-2SDYFOZL.mjs";
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import "../../chunk-MY5U63QO.mjs";
|
|
3
|
+
import {
|
|
4
|
+
icon_button_default
|
|
5
|
+
} from "../../chunk-7TAGGLNY.mjs";
|
|
6
|
+
import {
|
|
7
|
+
text_button_default
|
|
8
|
+
} from "../../chunk-WFMFC7R6.mjs";
|
|
3
9
|
import {
|
|
4
10
|
button_group_default
|
|
5
11
|
} from "../../chunk-LPZOH3RP.mjs";
|
|
6
12
|
import {
|
|
7
13
|
button_default
|
|
8
14
|
} from "../../chunk-UB4YBFOT.mjs";
|
|
9
|
-
import {
|
|
10
|
-
icon_button_default
|
|
11
|
-
} from "../../chunk-7TAGGLNY.mjs";
|
|
12
15
|
import "../../chunk-6WSACUIB.mjs";
|
|
13
16
|
import "../../chunk-LXHUO6VM.mjs";
|
|
14
17
|
import "../../chunk-6PNKRBUT.mjs";
|
|
15
|
-
import {
|
|
16
|
-
text_button_default
|
|
17
|
-
} from "../../chunk-WFMFC7R6.mjs";
|
|
18
18
|
import "../../chunk-ZYIIXWVY.mjs";
|
|
19
19
|
import "../../chunk-2TKEWFGH.mjs";
|
|
20
20
|
import "../../chunk-2SDYFOZL.mjs";
|
|
@@ -3,17 +3,17 @@ import {
|
|
|
3
3
|
FileUpload,
|
|
4
4
|
fileUploadStyle,
|
|
5
5
|
fileUpload_default
|
|
6
|
-
} from "../../chunk-
|
|
6
|
+
} from "../../chunk-TRR232FS.mjs";
|
|
7
7
|
import "../../chunk-2GCSFWHD.mjs";
|
|
8
8
|
import "../../chunk-GH6CPGFN.mjs";
|
|
9
9
|
import "../../chunk-MY5U63QO.mjs";
|
|
10
|
+
import "../../chunk-7TAGGLNY.mjs";
|
|
11
|
+
import "../../chunk-WFMFC7R6.mjs";
|
|
10
12
|
import "../../chunk-LPZOH3RP.mjs";
|
|
11
13
|
import "../../chunk-UB4YBFOT.mjs";
|
|
12
|
-
import "../../chunk-7TAGGLNY.mjs";
|
|
13
14
|
import "../../chunk-6WSACUIB.mjs";
|
|
14
15
|
import "../../chunk-LXHUO6VM.mjs";
|
|
15
16
|
import "../../chunk-6PNKRBUT.mjs";
|
|
16
|
-
import "../../chunk-WFMFC7R6.mjs";
|
|
17
17
|
import "../../chunk-ZYIIXWVY.mjs";
|
|
18
18
|
import "../../chunk-2TKEWFGH.mjs";
|
|
19
19
|
import "../../chunk-2SDYFOZL.mjs";
|
|
@@ -2,17 +2,17 @@
|
|
|
2
2
|
import "../../chunk-RLXOHILK.mjs";
|
|
3
3
|
import {
|
|
4
4
|
fileUpload_default
|
|
5
|
-
} from "../../chunk-
|
|
5
|
+
} from "../../chunk-TRR232FS.mjs";
|
|
6
6
|
import "../../chunk-2GCSFWHD.mjs";
|
|
7
7
|
import "../../chunk-GH6CPGFN.mjs";
|
|
8
8
|
import "../../chunk-MY5U63QO.mjs";
|
|
9
|
+
import "../../chunk-7TAGGLNY.mjs";
|
|
10
|
+
import "../../chunk-WFMFC7R6.mjs";
|
|
9
11
|
import "../../chunk-LPZOH3RP.mjs";
|
|
10
12
|
import "../../chunk-UB4YBFOT.mjs";
|
|
11
|
-
import "../../chunk-7TAGGLNY.mjs";
|
|
12
13
|
import "../../chunk-6WSACUIB.mjs";
|
|
13
14
|
import "../../chunk-LXHUO6VM.mjs";
|
|
14
15
|
import "../../chunk-6PNKRBUT.mjs";
|
|
15
|
-
import "../../chunk-WFMFC7R6.mjs";
|
|
16
16
|
import "../../chunk-ZYIIXWVY.mjs";
|
|
17
17
|
import "../../chunk-2TKEWFGH.mjs";
|
|
18
18
|
import "../../chunk-2SDYFOZL.mjs";
|
|
@@ -6,13 +6,13 @@ import {
|
|
|
6
6
|
import "../../chunk-SE5TU755.mjs";
|
|
7
7
|
import "../../chunk-LL6F3WDX.mjs";
|
|
8
8
|
import "../../chunk-MY5U63QO.mjs";
|
|
9
|
+
import "../../chunk-7TAGGLNY.mjs";
|
|
10
|
+
import "../../chunk-WFMFC7R6.mjs";
|
|
9
11
|
import "../../chunk-LPZOH3RP.mjs";
|
|
10
12
|
import "../../chunk-UB4YBFOT.mjs";
|
|
11
|
-
import "../../chunk-7TAGGLNY.mjs";
|
|
12
13
|
import "../../chunk-6WSACUIB.mjs";
|
|
13
14
|
import "../../chunk-LXHUO6VM.mjs";
|
|
14
15
|
import "../../chunk-6PNKRBUT.mjs";
|
|
15
|
-
import "../../chunk-WFMFC7R6.mjs";
|
|
16
16
|
import "../../chunk-ZYIIXWVY.mjs";
|
|
17
17
|
import "../../chunk-2TKEWFGH.mjs";
|
|
18
18
|
import "../../chunk-2SDYFOZL.mjs";
|
|
@@ -5,13 +5,13 @@ import {
|
|
|
5
5
|
import "../../chunk-SE5TU755.mjs";
|
|
6
6
|
import "../../chunk-LL6F3WDX.mjs";
|
|
7
7
|
import "../../chunk-MY5U63QO.mjs";
|
|
8
|
+
import "../../chunk-7TAGGLNY.mjs";
|
|
9
|
+
import "../../chunk-WFMFC7R6.mjs";
|
|
8
10
|
import "../../chunk-LPZOH3RP.mjs";
|
|
9
11
|
import "../../chunk-UB4YBFOT.mjs";
|
|
10
|
-
import "../../chunk-7TAGGLNY.mjs";
|
|
11
12
|
import "../../chunk-6WSACUIB.mjs";
|
|
12
13
|
import "../../chunk-LXHUO6VM.mjs";
|
|
13
14
|
import "../../chunk-6PNKRBUT.mjs";
|
|
14
|
-
import "../../chunk-WFMFC7R6.mjs";
|
|
15
15
|
import "../../chunk-ZYIIXWVY.mjs";
|
|
16
16
|
import "../../chunk-2TKEWFGH.mjs";
|
|
17
17
|
import "../../chunk-2SDYFOZL.mjs";
|
|
@@ -4371,7 +4371,7 @@ function toVal(mix) {
|
|
|
4371
4371
|
// src/components/select/select.tsx
|
|
4372
4372
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
4373
4373
|
var Select = (0, import_react.forwardRef)((originalProps, ref) => {
|
|
4374
|
-
var _a;
|
|
4374
|
+
var _a, _b;
|
|
4375
4375
|
const [props, variantProps] = mapPropsVariants(originalProps, select.variantKeys);
|
|
4376
4376
|
const {
|
|
4377
4377
|
label,
|
|
@@ -4447,6 +4447,7 @@ var Select = (0, import_react.forwardRef)((originalProps, ref) => {
|
|
|
4447
4447
|
}, [targetRect]);
|
|
4448
4448
|
const position = targetRect ? calculatePositionWithScroll(targetRect, optionWrapperHeight) : null;
|
|
4449
4449
|
const displayValue = multiple ? selectedOptions.map((opt) => opt.label).join(", ") : ((_a = selectedOptions[0]) == null ? void 0 : _a.label) || "";
|
|
4450
|
+
const selectedValue = multiple ? selectedOptions.map((opt) => opt.value).join(", ") : ((_b = selectedOptions[0]) == null ? void 0 : _b.value) || "";
|
|
4450
4451
|
const Option = ({
|
|
4451
4452
|
option,
|
|
4452
4453
|
isSelected,
|
|
@@ -4458,9 +4459,19 @@ var Select = (0, import_react.forwardRef)((originalProps, ref) => {
|
|
|
4458
4459
|
isSelected && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Icon_default, { name: "check", size: originalProps.size })
|
|
4459
4460
|
] });
|
|
4460
4461
|
};
|
|
4462
|
+
const isControlled = originalProps.value !== void 0;
|
|
4461
4463
|
(0, import_react.useEffect)(() => {
|
|
4462
|
-
|
|
4463
|
-
|
|
4464
|
+
if (isControlled) {
|
|
4465
|
+
const valueArray = Array.isArray(originalProps.value) ? originalProps.value : [originalProps.value];
|
|
4466
|
+
const matchedOptions = options.filter((opt) => valueArray.includes(opt.value));
|
|
4467
|
+
setSelectedOptions(matchedOptions);
|
|
4468
|
+
}
|
|
4469
|
+
}, [originalProps.value, options]);
|
|
4470
|
+
(0, import_react.useEffect)(() => {
|
|
4471
|
+
if (!isControlled) {
|
|
4472
|
+
setSelectedOptions(defaultSelectedOptions);
|
|
4473
|
+
}
|
|
4474
|
+
}, [defaultSelectedOptions]);
|
|
4464
4475
|
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
|
|
4465
4476
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
4466
4477
|
"div",
|
|
@@ -4492,11 +4503,13 @@ var Select = (0, import_react.forwardRef)((originalProps, ref) => {
|
|
|
4492
4503
|
slots.select({ class: classNames == null ? void 0 : classNames.select }),
|
|
4493
4504
|
inputProps.readOnly ? "!text-body-foreground placeholder:text-body-foreground" : ""
|
|
4494
4505
|
),
|
|
4506
|
+
name: void 0,
|
|
4495
4507
|
value: displayValue,
|
|
4496
4508
|
readOnly: true,
|
|
4497
4509
|
size: 0
|
|
4498
4510
|
}
|
|
4499
4511
|
),
|
|
4512
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("input", { type: "hidden", name: inputProps.name, value: selectedValue }),
|
|
4500
4513
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
4501
4514
|
Icon_default,
|
|
4502
4515
|
{
|
|
@@ -4504,16 +4517,7 @@ var Select = (0, import_react.forwardRef)((originalProps, ref) => {
|
|
|
4504
4517
|
size: originalProps.size,
|
|
4505
4518
|
className: `transition-transform duration-200 ${isOpen ? "rotate-0" : "rotate-180"}`
|
|
4506
4519
|
}
|
|
4507
|
-
)
|
|
4508
|
-
selectedOptions.map((opt, index) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
4509
|
-
"input",
|
|
4510
|
-
{
|
|
4511
|
-
type: "hidden",
|
|
4512
|
-
name: multiple ? `${inputProps.name}[]` : inputProps.name,
|
|
4513
|
-
value: opt.value
|
|
4514
|
-
},
|
|
4515
|
-
index
|
|
4516
|
-
))
|
|
4520
|
+
)
|
|
4517
4521
|
]
|
|
4518
4522
|
}
|
|
4519
4523
|
),
|
|
@@ -10,6 +10,7 @@ interface SelectOption {
|
|
|
10
10
|
}
|
|
11
11
|
interface Props extends Omit<ComponentPropsWithRef<"input">, "onChange" | keyof SelectVariantProps> {
|
|
12
12
|
options: SelectOption[];
|
|
13
|
+
value?: string | number;
|
|
13
14
|
defaultSelectedOptions?: SelectOption[];
|
|
14
15
|
label?: string;
|
|
15
16
|
helperMessage?: string;
|
|
@@ -10,6 +10,7 @@ interface SelectOption {
|
|
|
10
10
|
}
|
|
11
11
|
interface Props extends Omit<ComponentPropsWithRef<"input">, "onChange" | keyof SelectVariantProps> {
|
|
12
12
|
options: SelectOption[];
|
|
13
|
+
value?: string | number;
|
|
13
14
|
defaultSelectedOptions?: SelectOption[];
|
|
14
15
|
label?: string;
|
|
15
16
|
helperMessage?: string;
|
|
@@ -4369,7 +4369,7 @@ function toVal(mix) {
|
|
|
4369
4369
|
// src/components/select/select.tsx
|
|
4370
4370
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
4371
4371
|
var Select = (0, import_react.forwardRef)((originalProps, ref) => {
|
|
4372
|
-
var _a;
|
|
4372
|
+
var _a, _b;
|
|
4373
4373
|
const [props, variantProps] = mapPropsVariants(originalProps, select.variantKeys);
|
|
4374
4374
|
const {
|
|
4375
4375
|
label,
|
|
@@ -4445,6 +4445,7 @@ var Select = (0, import_react.forwardRef)((originalProps, ref) => {
|
|
|
4445
4445
|
}, [targetRect]);
|
|
4446
4446
|
const position = targetRect ? calculatePositionWithScroll(targetRect, optionWrapperHeight) : null;
|
|
4447
4447
|
const displayValue = multiple ? selectedOptions.map((opt) => opt.label).join(", ") : ((_a = selectedOptions[0]) == null ? void 0 : _a.label) || "";
|
|
4448
|
+
const selectedValue = multiple ? selectedOptions.map((opt) => opt.value).join(", ") : ((_b = selectedOptions[0]) == null ? void 0 : _b.value) || "";
|
|
4448
4449
|
const Option = ({
|
|
4449
4450
|
option,
|
|
4450
4451
|
isSelected,
|
|
@@ -4456,9 +4457,19 @@ var Select = (0, import_react.forwardRef)((originalProps, ref) => {
|
|
|
4456
4457
|
isSelected && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Icon_default, { name: "check", size: originalProps.size })
|
|
4457
4458
|
] });
|
|
4458
4459
|
};
|
|
4460
|
+
const isControlled = originalProps.value !== void 0;
|
|
4459
4461
|
(0, import_react.useEffect)(() => {
|
|
4460
|
-
|
|
4461
|
-
|
|
4462
|
+
if (isControlled) {
|
|
4463
|
+
const valueArray = Array.isArray(originalProps.value) ? originalProps.value : [originalProps.value];
|
|
4464
|
+
const matchedOptions = options.filter((opt) => valueArray.includes(opt.value));
|
|
4465
|
+
setSelectedOptions(matchedOptions);
|
|
4466
|
+
}
|
|
4467
|
+
}, [originalProps.value, options]);
|
|
4468
|
+
(0, import_react.useEffect)(() => {
|
|
4469
|
+
if (!isControlled) {
|
|
4470
|
+
setSelectedOptions(defaultSelectedOptions);
|
|
4471
|
+
}
|
|
4472
|
+
}, [defaultSelectedOptions]);
|
|
4462
4473
|
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
|
|
4463
4474
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
4464
4475
|
"div",
|
|
@@ -4490,11 +4501,13 @@ var Select = (0, import_react.forwardRef)((originalProps, ref) => {
|
|
|
4490
4501
|
slots.select({ class: classNames == null ? void 0 : classNames.select }),
|
|
4491
4502
|
inputProps.readOnly ? "!text-body-foreground placeholder:text-body-foreground" : ""
|
|
4492
4503
|
),
|
|
4504
|
+
name: void 0,
|
|
4493
4505
|
value: displayValue,
|
|
4494
4506
|
readOnly: true,
|
|
4495
4507
|
size: 0
|
|
4496
4508
|
}
|
|
4497
4509
|
),
|
|
4510
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("input", { type: "hidden", name: inputProps.name, value: selectedValue }),
|
|
4498
4511
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
4499
4512
|
Icon_default,
|
|
4500
4513
|
{
|
|
@@ -4502,16 +4515,7 @@ var Select = (0, import_react.forwardRef)((originalProps, ref) => {
|
|
|
4502
4515
|
size: originalProps.size,
|
|
4503
4516
|
className: `transition-transform duration-200 ${isOpen ? "rotate-0" : "rotate-180"}`
|
|
4504
4517
|
}
|
|
4505
|
-
)
|
|
4506
|
-
selectedOptions.map((opt, index) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
4507
|
-
"input",
|
|
4508
|
-
{
|
|
4509
|
-
type: "hidden",
|
|
4510
|
-
name: multiple ? `${inputProps.name}[]` : inputProps.name,
|
|
4511
|
-
value: opt.value
|
|
4512
|
-
},
|
|
4513
|
-
index
|
|
4514
|
-
))
|
|
4518
|
+
)
|
|
4515
4519
|
]
|
|
4516
4520
|
}
|
|
4517
4521
|
),
|
|
@@ -5472,7 +5472,8 @@ var Table = (0, import_react5.forwardRef)((originalProps, ref) => {
|
|
|
5472
5472
|
classNames,
|
|
5473
5473
|
color,
|
|
5474
5474
|
size,
|
|
5475
|
-
skeletonRow
|
|
5475
|
+
skeletonRow,
|
|
5476
|
+
onCheckedRowsChange
|
|
5476
5477
|
} = { ...props, ...variantProps };
|
|
5477
5478
|
const { page = 1, perPage = 15 } = pagination || {};
|
|
5478
5479
|
const showPagination = pagination && totalData > 0 && !isLoading;
|
|
@@ -5482,7 +5483,10 @@ var Table = (0, import_react5.forwardRef)((originalProps, ref) => {
|
|
|
5482
5483
|
ref,
|
|
5483
5484
|
() => ({
|
|
5484
5485
|
checkedRows,
|
|
5485
|
-
setCheckedRows
|
|
5486
|
+
setCheckedRows: (rowsSet) => {
|
|
5487
|
+
setCheckedRows(rowsSet);
|
|
5488
|
+
onCheckedRowsChange == null ? void 0 : onCheckedRowsChange(getCheckedRowData(rowsSet));
|
|
5489
|
+
}
|
|
5486
5490
|
}),
|
|
5487
5491
|
[checkedRows]
|
|
5488
5492
|
);
|
|
@@ -5492,14 +5496,17 @@ var Table = (0, import_react5.forwardRef)((originalProps, ref) => {
|
|
|
5492
5496
|
const handleAllRowCheck = (checked) => {
|
|
5493
5497
|
const updated = checked ? new Set(rows.map((_, i) => i)) : /* @__PURE__ */ new Set();
|
|
5494
5498
|
setCheckedRows(updated);
|
|
5499
|
+
onCheckedRowsChange == null ? void 0 : onCheckedRowsChange(getCheckedRowData(updated));
|
|
5495
5500
|
};
|
|
5496
5501
|
const handleRowCheck = (index, checked) => {
|
|
5497
5502
|
setCheckedRows((prev) => {
|
|
5498
5503
|
const updated = new Set(prev);
|
|
5499
5504
|
checked ? updated.add(index) : updated.delete(index);
|
|
5505
|
+
onCheckedRowsChange == null ? void 0 : onCheckedRowsChange(getCheckedRowData(updated));
|
|
5500
5506
|
return updated;
|
|
5501
5507
|
});
|
|
5502
5508
|
};
|
|
5509
|
+
const getCheckedRowData = (checked) => Array.from(checked).map((index) => rows[index]).filter((row) => row !== void 0);
|
|
5503
5510
|
const slots = (0, import_react5.useMemo)(() => tableStyle(variantProps), [variantProps]);
|
|
5504
5511
|
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { ref: divRef, "data-table": "base", className: slots.base({ class: classNames == null ? void 0 : classNames.base }), children: [
|
|
5505
5512
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(scrollArea_default, { direction: "x", size: size === "xl" ? "lg" : size, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("table", { className: slots.table({ class: classNames == null ? void 0 : classNames.table }), children: [
|
|
@@ -21,6 +21,7 @@ interface TableBaseProps extends Omit<ComponentPropsWithRef<"table">, "ref" | "c
|
|
|
21
21
|
emptyContent?: ReactNode;
|
|
22
22
|
isLoading?: boolean;
|
|
23
23
|
skeletonRow?: number;
|
|
24
|
+
onCheckedRowsChange?: (rows: TableRow[]) => void;
|
|
24
25
|
classNames?: SlotsToClasses<TableSlots>;
|
|
25
26
|
}
|
|
26
27
|
interface TableRef {
|
|
@@ -21,6 +21,7 @@ interface TableBaseProps extends Omit<ComponentPropsWithRef<"table">, "ref" | "c
|
|
|
21
21
|
emptyContent?: ReactNode;
|
|
22
22
|
isLoading?: boolean;
|
|
23
23
|
skeletonRow?: number;
|
|
24
|
+
onCheckedRowsChange?: (rows: TableRow[]) => void;
|
|
24
25
|
classNames?: SlotsToClasses<TableSlots>;
|
|
25
26
|
}
|
|
26
27
|
interface TableRef {
|
|
@@ -5469,7 +5469,8 @@ var Table = (0, import_react5.forwardRef)((originalProps, ref) => {
|
|
|
5469
5469
|
classNames,
|
|
5470
5470
|
color,
|
|
5471
5471
|
size,
|
|
5472
|
-
skeletonRow
|
|
5472
|
+
skeletonRow,
|
|
5473
|
+
onCheckedRowsChange
|
|
5473
5474
|
} = { ...props, ...variantProps };
|
|
5474
5475
|
const { page = 1, perPage = 15 } = pagination || {};
|
|
5475
5476
|
const showPagination = pagination && totalData > 0 && !isLoading;
|
|
@@ -5479,7 +5480,10 @@ var Table = (0, import_react5.forwardRef)((originalProps, ref) => {
|
|
|
5479
5480
|
ref,
|
|
5480
5481
|
() => ({
|
|
5481
5482
|
checkedRows,
|
|
5482
|
-
setCheckedRows
|
|
5483
|
+
setCheckedRows: (rowsSet) => {
|
|
5484
|
+
setCheckedRows(rowsSet);
|
|
5485
|
+
onCheckedRowsChange == null ? void 0 : onCheckedRowsChange(getCheckedRowData(rowsSet));
|
|
5486
|
+
}
|
|
5483
5487
|
}),
|
|
5484
5488
|
[checkedRows]
|
|
5485
5489
|
);
|
|
@@ -5489,14 +5493,17 @@ var Table = (0, import_react5.forwardRef)((originalProps, ref) => {
|
|
|
5489
5493
|
const handleAllRowCheck = (checked) => {
|
|
5490
5494
|
const updated = checked ? new Set(rows.map((_, i) => i)) : /* @__PURE__ */ new Set();
|
|
5491
5495
|
setCheckedRows(updated);
|
|
5496
|
+
onCheckedRowsChange == null ? void 0 : onCheckedRowsChange(getCheckedRowData(updated));
|
|
5492
5497
|
};
|
|
5493
5498
|
const handleRowCheck = (index, checked) => {
|
|
5494
5499
|
setCheckedRows((prev) => {
|
|
5495
5500
|
const updated = new Set(prev);
|
|
5496
5501
|
checked ? updated.add(index) : updated.delete(index);
|
|
5502
|
+
onCheckedRowsChange == null ? void 0 : onCheckedRowsChange(getCheckedRowData(updated));
|
|
5497
5503
|
return updated;
|
|
5498
5504
|
});
|
|
5499
5505
|
};
|
|
5506
|
+
const getCheckedRowData = (checked) => Array.from(checked).map((index) => rows[index]).filter((row) => row !== void 0);
|
|
5500
5507
|
const slots = (0, import_react5.useMemo)(() => tableStyle(variantProps), [variantProps]);
|
|
5501
5508
|
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { ref: divRef, "data-table": "base", className: slots.base({ class: classNames == null ? void 0 : classNames.base }), children: [
|
|
5502
5509
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(scrollArea_default, { direction: "x", size: size === "xl" ? "lg" : size, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("table", { className: slots.table({ class: classNames == null ? void 0 : classNames.table }), children: [
|
package/dist/index.js
CHANGED
|
@@ -7453,7 +7453,8 @@ var Table = (0, import_react15.forwardRef)((originalProps, ref) => {
|
|
|
7453
7453
|
classNames,
|
|
7454
7454
|
color,
|
|
7455
7455
|
size,
|
|
7456
|
-
skeletonRow
|
|
7456
|
+
skeletonRow,
|
|
7457
|
+
onCheckedRowsChange
|
|
7457
7458
|
} = { ...props, ...variantProps };
|
|
7458
7459
|
const { page = 1, perPage = 15 } = pagination || {};
|
|
7459
7460
|
const showPagination = pagination && totalData > 0 && !isLoading;
|
|
@@ -7463,7 +7464,10 @@ var Table = (0, import_react15.forwardRef)((originalProps, ref) => {
|
|
|
7463
7464
|
ref,
|
|
7464
7465
|
() => ({
|
|
7465
7466
|
checkedRows,
|
|
7466
|
-
setCheckedRows
|
|
7467
|
+
setCheckedRows: (rowsSet) => {
|
|
7468
|
+
setCheckedRows(rowsSet);
|
|
7469
|
+
onCheckedRowsChange == null ? void 0 : onCheckedRowsChange(getCheckedRowData(rowsSet));
|
|
7470
|
+
}
|
|
7467
7471
|
}),
|
|
7468
7472
|
[checkedRows]
|
|
7469
7473
|
);
|
|
@@ -7473,14 +7477,17 @@ var Table = (0, import_react15.forwardRef)((originalProps, ref) => {
|
|
|
7473
7477
|
const handleAllRowCheck = (checked) => {
|
|
7474
7478
|
const updated = checked ? new Set(rows.map((_, i) => i)) : /* @__PURE__ */ new Set();
|
|
7475
7479
|
setCheckedRows(updated);
|
|
7480
|
+
onCheckedRowsChange == null ? void 0 : onCheckedRowsChange(getCheckedRowData(updated));
|
|
7476
7481
|
};
|
|
7477
7482
|
const handleRowCheck = (index, checked) => {
|
|
7478
7483
|
setCheckedRows((prev) => {
|
|
7479
7484
|
const updated = new Set(prev);
|
|
7480
7485
|
checked ? updated.add(index) : updated.delete(index);
|
|
7486
|
+
onCheckedRowsChange == null ? void 0 : onCheckedRowsChange(getCheckedRowData(updated));
|
|
7481
7487
|
return updated;
|
|
7482
7488
|
});
|
|
7483
7489
|
};
|
|
7490
|
+
const getCheckedRowData = (checked) => Array.from(checked).map((index) => rows[index]).filter((row) => row !== void 0);
|
|
7484
7491
|
const slots = (0, import_react15.useMemo)(() => tableStyle(variantProps), [variantProps]);
|
|
7485
7492
|
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { ref: divRef, "data-table": "base", className: slots.base({ class: classNames == null ? void 0 : classNames.base }), children: [
|
|
7486
7493
|
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(scrollArea_default, { direction: "x", size: size === "xl" ? "lg" : size, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("table", { className: slots.table({ class: classNames == null ? void 0 : classNames.table }), children: [
|
|
@@ -7783,7 +7790,7 @@ var import_react17 = require("react");
|
|
|
7783
7790
|
var import_react_dom = require("react-dom");
|
|
7784
7791
|
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
7785
7792
|
var Select = (0, import_react17.forwardRef)((originalProps, ref) => {
|
|
7786
|
-
var _a;
|
|
7793
|
+
var _a, _b;
|
|
7787
7794
|
const [props, variantProps] = mapPropsVariants(originalProps, select.variantKeys);
|
|
7788
7795
|
const {
|
|
7789
7796
|
label,
|
|
@@ -7859,6 +7866,7 @@ var Select = (0, import_react17.forwardRef)((originalProps, ref) => {
|
|
|
7859
7866
|
}, [targetRect]);
|
|
7860
7867
|
const position = targetRect ? calculatePositionWithScroll(targetRect, optionWrapperHeight) : null;
|
|
7861
7868
|
const displayValue = multiple ? selectedOptions.map((opt) => opt.label).join(", ") : ((_a = selectedOptions[0]) == null ? void 0 : _a.label) || "";
|
|
7869
|
+
const selectedValue = multiple ? selectedOptions.map((opt) => opt.value).join(", ") : ((_b = selectedOptions[0]) == null ? void 0 : _b.value) || "";
|
|
7862
7870
|
const Option = ({
|
|
7863
7871
|
option,
|
|
7864
7872
|
isSelected,
|
|
@@ -7870,9 +7878,19 @@ var Select = (0, import_react17.forwardRef)((originalProps, ref) => {
|
|
|
7870
7878
|
isSelected && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Icon_default, { name: "check", size: originalProps.size })
|
|
7871
7879
|
] });
|
|
7872
7880
|
};
|
|
7881
|
+
const isControlled = originalProps.value !== void 0;
|
|
7882
|
+
(0, import_react17.useEffect)(() => {
|
|
7883
|
+
if (isControlled) {
|
|
7884
|
+
const valueArray = Array.isArray(originalProps.value) ? originalProps.value : [originalProps.value];
|
|
7885
|
+
const matchedOptions = options.filter((opt) => valueArray.includes(opt.value));
|
|
7886
|
+
setSelectedOptions(matchedOptions);
|
|
7887
|
+
}
|
|
7888
|
+
}, [originalProps.value, options]);
|
|
7873
7889
|
(0, import_react17.useEffect)(() => {
|
|
7874
|
-
|
|
7875
|
-
|
|
7890
|
+
if (!isControlled) {
|
|
7891
|
+
setSelectedOptions(defaultSelectedOptions);
|
|
7892
|
+
}
|
|
7893
|
+
}, [defaultSelectedOptions]);
|
|
7876
7894
|
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_jsx_runtime22.Fragment, { children: [
|
|
7877
7895
|
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
7878
7896
|
"div",
|
|
@@ -7904,11 +7922,13 @@ var Select = (0, import_react17.forwardRef)((originalProps, ref) => {
|
|
|
7904
7922
|
slots.select({ class: classNames == null ? void 0 : classNames.select }),
|
|
7905
7923
|
inputProps.readOnly ? "!text-body-foreground placeholder:text-body-foreground" : ""
|
|
7906
7924
|
),
|
|
7925
|
+
name: void 0,
|
|
7907
7926
|
value: displayValue,
|
|
7908
7927
|
readOnly: true,
|
|
7909
7928
|
size: 0
|
|
7910
7929
|
}
|
|
7911
7930
|
),
|
|
7931
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("input", { type: "hidden", name: inputProps.name, value: selectedValue }),
|
|
7912
7932
|
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
7913
7933
|
Icon_default,
|
|
7914
7934
|
{
|
|
@@ -7916,16 +7936,7 @@ var Select = (0, import_react17.forwardRef)((originalProps, ref) => {
|
|
|
7916
7936
|
size: originalProps.size,
|
|
7917
7937
|
className: `transition-transform duration-200 ${isOpen ? "rotate-0" : "rotate-180"}`
|
|
7918
7938
|
}
|
|
7919
|
-
)
|
|
7920
|
-
selectedOptions.map((opt, index) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
7921
|
-
"input",
|
|
7922
|
-
{
|
|
7923
|
-
type: "hidden",
|
|
7924
|
-
name: multiple ? `${inputProps.name}[]` : inputProps.name,
|
|
7925
|
-
value: opt.value
|
|
7926
|
-
},
|
|
7927
|
-
index
|
|
7928
|
-
))
|
|
7939
|
+
)
|
|
7929
7940
|
]
|
|
7930
7941
|
}
|
|
7931
7942
|
),
|
package/dist/index.mjs
CHANGED
|
@@ -33,7 +33,7 @@ import {
|
|
|
33
33
|
import "./chunk-DX3KXNP6.mjs";
|
|
34
34
|
import {
|
|
35
35
|
table_default
|
|
36
|
-
} from "./chunk-
|
|
36
|
+
} from "./chunk-Y37BWBR3.mjs";
|
|
37
37
|
import {
|
|
38
38
|
definition_table_default
|
|
39
39
|
} from "./chunk-6TIIBU7J.mjs";
|
|
@@ -46,7 +46,7 @@ import {
|
|
|
46
46
|
import "./chunk-QCEKPS7U.mjs";
|
|
47
47
|
import {
|
|
48
48
|
select_default
|
|
49
|
-
} from "./chunk-
|
|
49
|
+
} from "./chunk-NLYGDZK3.mjs";
|
|
50
50
|
import "./chunk-MZ76AA76.mjs";
|
|
51
51
|
import {
|
|
52
52
|
skeleton_default
|
|
@@ -83,11 +83,15 @@ import "./chunk-FWJ2ZKH6.mjs";
|
|
|
83
83
|
import "./chunk-P732YGHO.mjs";
|
|
84
84
|
import {
|
|
85
85
|
fileUpload_default
|
|
86
|
-
} from "./chunk-
|
|
86
|
+
} from "./chunk-TRR232FS.mjs";
|
|
87
87
|
import "./chunk-2GCSFWHD.mjs";
|
|
88
88
|
import {
|
|
89
89
|
input_default
|
|
90
90
|
} from "./chunk-GH6CPGFN.mjs";
|
|
91
|
+
import "./chunk-SE5TU755.mjs";
|
|
92
|
+
import {
|
|
93
|
+
backdrop_default
|
|
94
|
+
} from "./chunk-LL6F3WDX.mjs";
|
|
91
95
|
import "./chunk-QZ3LVYJW.mjs";
|
|
92
96
|
import {
|
|
93
97
|
checkbox_default
|
|
@@ -99,30 +103,26 @@ import "./chunk-7DLOYKVC.mjs";
|
|
|
99
103
|
import {
|
|
100
104
|
avatar_default
|
|
101
105
|
} from "./chunk-SP3JVQY3.mjs";
|
|
102
|
-
import "./chunk-SE5TU755.mjs";
|
|
103
|
-
import {
|
|
104
|
-
backdrop_default
|
|
105
|
-
} from "./chunk-LL6F3WDX.mjs";
|
|
106
106
|
import "./chunk-KYIODWXL.mjs";
|
|
107
107
|
import {
|
|
108
108
|
breadcrumb_default
|
|
109
109
|
} from "./chunk-G67WUZO3.mjs";
|
|
110
110
|
import "./chunk-MY5U63QO.mjs";
|
|
111
|
+
import {
|
|
112
|
+
icon_button_default
|
|
113
|
+
} from "./chunk-7TAGGLNY.mjs";
|
|
114
|
+
import {
|
|
115
|
+
text_button_default
|
|
116
|
+
} from "./chunk-WFMFC7R6.mjs";
|
|
111
117
|
import {
|
|
112
118
|
button_group_default
|
|
113
119
|
} from "./chunk-LPZOH3RP.mjs";
|
|
114
120
|
import {
|
|
115
121
|
button_default
|
|
116
122
|
} from "./chunk-UB4YBFOT.mjs";
|
|
117
|
-
import {
|
|
118
|
-
icon_button_default
|
|
119
|
-
} from "./chunk-7TAGGLNY.mjs";
|
|
120
123
|
import "./chunk-6WSACUIB.mjs";
|
|
121
124
|
import "./chunk-LXHUO6VM.mjs";
|
|
122
125
|
import "./chunk-6PNKRBUT.mjs";
|
|
123
|
-
import {
|
|
124
|
-
text_button_default
|
|
125
|
-
} from "./chunk-WFMFC7R6.mjs";
|
|
126
126
|
import "./chunk-ZYIIXWVY.mjs";
|
|
127
127
|
import {
|
|
128
128
|
Icon_default,
|
package/package.json
CHANGED
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
import {
|
|
3
3
|
input_default
|
|
4
4
|
} from "./chunk-GH6CPGFN.mjs";
|
|
5
|
-
import {
|
|
6
|
-
button_default
|
|
7
|
-
} from "./chunk-UB4YBFOT.mjs";
|
|
8
5
|
import {
|
|
9
6
|
icon_button_default
|
|
10
7
|
} from "./chunk-7TAGGLNY.mjs";
|
|
8
|
+
import {
|
|
9
|
+
button_default
|
|
10
|
+
} from "./chunk-UB4YBFOT.mjs";
|
|
11
11
|
|
|
12
12
|
// src/components/fileUpload/fileUpload.tsx
|
|
13
13
|
import { useRef, useState, useEffect } from "react";
|