@deepnoid/ui 0.1.173 → 0.1.175
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 +151 -151
- package/dist/{chunk-CPFFP7L6.mjs → chunk-JGG3ZUNG.mjs} +3 -3
- package/dist/{chunk-NSADIVGU.mjs → chunk-JPCZROOU.mjs} +18 -7
- package/dist/{chunk-DU7L4GA7.mjs → chunk-NTNF5T5I.mjs} +11 -9
- package/dist/components/accordion/accordion.d.mts +3 -2
- package/dist/components/accordion/accordion.d.ts +3 -2
- package/dist/components/accordion/accordion.js +3 -3
- package/dist/components/accordion/accordion.mjs +1 -1
- package/dist/components/accordion/accordionItem.js +11 -9
- package/dist/components/accordion/accordionItem.mjs +1 -1
- package/dist/components/accordion/index.js +14 -12
- package/dist/components/accordion/index.mjs +2 -2
- package/dist/components/table/index.js +43 -32
- package/dist/components/table/index.mjs +2 -2
- package/dist/components/table/table-body.js +13 -2
- package/dist/components/table/table-body.mjs +2 -2
- package/dist/components/table/table-head.js +41 -28
- package/dist/components/table/table-head.mjs +2 -2
- package/dist/components/table/table.js +39 -28
- package/dist/components/table/table.mjs +2 -2
- package/dist/index.js +234 -221
- package/dist/index.mjs +15 -15
- package/package.json +1 -1
|
@@ -147,7 +147,7 @@ function toVal(mix) {
|
|
|
147
147
|
}
|
|
148
148
|
|
|
149
149
|
// src/components/table/table.tsx
|
|
150
|
-
var
|
|
150
|
+
var import_react6 = require("react");
|
|
151
151
|
var import_tailwind_variants6 = require("tailwind-variants");
|
|
152
152
|
|
|
153
153
|
// src/utils/props.ts
|
|
@@ -170,6 +170,9 @@ var mapPropsVariants = (props, variantKeys, removeVariantProps = true) => {
|
|
|
170
170
|
}
|
|
171
171
|
};
|
|
172
172
|
|
|
173
|
+
// src/components/table/table-body.tsx
|
|
174
|
+
var import_react2 = require("react");
|
|
175
|
+
|
|
173
176
|
// src/components/checkbox/checkbox.tsx
|
|
174
177
|
var import_react = require("react");
|
|
175
178
|
|
|
@@ -643,6 +646,7 @@ var TableBody = ({
|
|
|
643
646
|
classNames,
|
|
644
647
|
className
|
|
645
648
|
}) => {
|
|
649
|
+
const checkOverflow = (el) => el.scrollWidth > el.clientWidth;
|
|
646
650
|
const renderCheckboxCell = (rowId, rowIndex) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
647
651
|
"td",
|
|
648
652
|
{
|
|
@@ -664,11 +668,20 @@ var TableBody = ({
|
|
|
664
668
|
const value = row[column.field];
|
|
665
669
|
const formattedValue = ((_a = column.valueFormatter) == null ? void 0 : _a.call(column, { value, field: column.field })) || value;
|
|
666
670
|
const content = column.renderCell ? column.renderCell({ id: row.id, field: column.field, value, formattedValue, row }) : formattedValue;
|
|
671
|
+
const tdRef = (0, import_react2.useRef)(null);
|
|
672
|
+
const [showTitle, setShowTitle] = (0, import_react2.useState)(false);
|
|
673
|
+
(0, import_react2.useEffect)(() => {
|
|
674
|
+
if (tdRef.current) {
|
|
675
|
+
setShowTitle(checkOverflow(tdRef.current));
|
|
676
|
+
}
|
|
677
|
+
}, [content]);
|
|
667
678
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
668
679
|
"td",
|
|
669
680
|
{
|
|
670
|
-
|
|
671
|
-
|
|
681
|
+
ref: tdRef,
|
|
682
|
+
className: clsx(slots.td(), classNames == null ? void 0 : classNames.td, column.className, "truncate"),
|
|
683
|
+
style: { ...getCellStyle(column), maxWidth: column.width || "150px" },
|
|
684
|
+
title: showTitle ? String(content) : void 0,
|
|
672
685
|
children: content
|
|
673
686
|
},
|
|
674
687
|
`${row.id}-${column.field}-${colIdx}-${rowIndex}`
|
|
@@ -695,18 +708,18 @@ var TableBody = ({
|
|
|
695
708
|
var table_body_default = TableBody;
|
|
696
709
|
|
|
697
710
|
// src/components/pagination/pagination.tsx
|
|
698
|
-
var
|
|
711
|
+
var import_react5 = require("react");
|
|
699
712
|
|
|
700
713
|
// src/components/pagination/usePagination.ts
|
|
701
|
-
var
|
|
714
|
+
var import_react3 = require("react");
|
|
702
715
|
var usePagination = ({ currentPage, totalPage, groupSize, handleChangePage }) => {
|
|
703
|
-
const startPage = (0,
|
|
704
|
-
const endPage = (0,
|
|
705
|
-
const pageList = (0,
|
|
716
|
+
const startPage = (0, import_react3.useMemo)(() => Math.floor((currentPage - 1) / groupSize) * groupSize + 1, [currentPage, groupSize]);
|
|
717
|
+
const endPage = (0, import_react3.useMemo)(() => Math.min(startPage + groupSize - 1, totalPage), [startPage, groupSize, totalPage]);
|
|
718
|
+
const pageList = (0, import_react3.useMemo)(
|
|
706
719
|
() => Array.from({ length: endPage - startPage + 1 }, (_, i) => startPage + i),
|
|
707
720
|
[startPage, endPage]
|
|
708
721
|
);
|
|
709
|
-
const handleClickMovePage = (0,
|
|
722
|
+
const handleClickMovePage = (0, import_react3.useCallback)(
|
|
710
723
|
(page) => (event) => {
|
|
711
724
|
event.preventDefault();
|
|
712
725
|
handleChangePage == null ? void 0 : handleChangePage(page);
|
|
@@ -723,7 +736,7 @@ var usePagination = ({ currentPage, totalPage, groupSize, handleChangePage }) =>
|
|
|
723
736
|
var usePagination_default = usePagination;
|
|
724
737
|
|
|
725
738
|
// src/components/input/input.tsx
|
|
726
|
-
var
|
|
739
|
+
var import_react4 = require("react");
|
|
727
740
|
|
|
728
741
|
// src/components/icon/template.tsx
|
|
729
742
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
@@ -5548,12 +5561,12 @@ var Icon_default = Icon;
|
|
|
5548
5561
|
|
|
5549
5562
|
// src/components/input/input.tsx
|
|
5550
5563
|
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
5551
|
-
var Input = (0,
|
|
5564
|
+
var Input = (0, import_react4.forwardRef)((originalProps, ref) => {
|
|
5552
5565
|
const [props, variantProps] = mapPropsVariants(originalProps, inputStyle.variantKeys);
|
|
5553
5566
|
const { classNames, label, helperMessage, errorMessage, startContent, endContent, ...inputProps } = props;
|
|
5554
|
-
const inputRef = (0,
|
|
5555
|
-
const slots = (0,
|
|
5556
|
-
const getContentProps = (0,
|
|
5567
|
+
const inputRef = (0, import_react4.useRef)(null);
|
|
5568
|
+
const slots = (0, import_react4.useMemo)(() => inputStyle({ ...variantProps }), [variantProps]);
|
|
5569
|
+
const getContentProps = (0, import_react4.useCallback)(
|
|
5557
5570
|
() => ({
|
|
5558
5571
|
className: clsx(
|
|
5559
5572
|
slots.content({ class: classNames == null ? void 0 : classNames.content }),
|
|
@@ -5564,13 +5577,13 @@ var Input = (0, import_react3.forwardRef)((originalProps, ref) => {
|
|
|
5564
5577
|
[slots, classNames, originalProps.size, inputProps.readOnly]
|
|
5565
5578
|
);
|
|
5566
5579
|
const renderStartContent = () => {
|
|
5567
|
-
if ((0,
|
|
5580
|
+
if ((0, import_react4.isValidElement)(startContent)) {
|
|
5568
5581
|
const existingProps = startContent.props;
|
|
5569
5582
|
const mergedProps = {
|
|
5570
5583
|
...getContentProps(),
|
|
5571
5584
|
className: `${getContentProps().className || ""} ${existingProps.className || ""}`.trim()
|
|
5572
5585
|
};
|
|
5573
|
-
return (0,
|
|
5586
|
+
return (0, import_react4.cloneElement)(startContent, mergedProps);
|
|
5574
5587
|
} else {
|
|
5575
5588
|
const contentProps = getContentProps();
|
|
5576
5589
|
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { ...contentProps, children: startContent });
|
|
@@ -5589,13 +5602,13 @@ var Input = (0, import_react3.forwardRef)((originalProps, ref) => {
|
|
|
5589
5602
|
}
|
|
5590
5603
|
);
|
|
5591
5604
|
const renderContentWithIcon = () => {
|
|
5592
|
-
if ((0,
|
|
5605
|
+
if ((0, import_react4.isValidElement)(endContent)) {
|
|
5593
5606
|
const existingProps = endContent.props;
|
|
5594
5607
|
const mergedProps = {
|
|
5595
5608
|
...getContentProps(),
|
|
5596
5609
|
className: `${getContentProps().className || ""} ${existingProps.className || ""}`.trim()
|
|
5597
5610
|
};
|
|
5598
|
-
return (0,
|
|
5611
|
+
return (0, import_react4.cloneElement)(endContent, mergedProps);
|
|
5599
5612
|
} else if (errorMessage && errorMessage.length > 0) {
|
|
5600
5613
|
const iconProps = { ...getContentProps(), className: getContentProps().className };
|
|
5601
5614
|
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { ...iconProps, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Icon_default, { name: "exclamation-circle", fill: true, size: originalProps.size }) });
|
|
@@ -5932,7 +5945,7 @@ var inputStyle = tv(
|
|
|
5932
5945
|
|
|
5933
5946
|
// src/components/pagination/pagination.tsx
|
|
5934
5947
|
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
5935
|
-
var Pagination = (0,
|
|
5948
|
+
var Pagination = (0, import_react5.forwardRef)((originalProps, ref) => {
|
|
5936
5949
|
const [props, variantProps] = mapPropsVariants(originalProps, paginationStyle.variantKeys);
|
|
5937
5950
|
const {
|
|
5938
5951
|
classNames,
|
|
@@ -5946,12 +5959,12 @@ var Pagination = (0, import_react4.forwardRef)((originalProps, ref) => {
|
|
|
5946
5959
|
variant,
|
|
5947
5960
|
size
|
|
5948
5961
|
} = { ...props, ...variantProps };
|
|
5949
|
-
const [inputPage, setInputPage] = (0,
|
|
5962
|
+
const [inputPage, setInputPage] = (0, import_react5.useState)(currentPage);
|
|
5950
5963
|
const isFirstPageDisabled = currentPage <= 1;
|
|
5951
5964
|
const isPrevPageDisabled = currentPage <= 1;
|
|
5952
5965
|
const isNextPageDisabled = currentPage >= totalPage;
|
|
5953
5966
|
const isLastPageDisabled = currentPage >= totalPage;
|
|
5954
|
-
const slots = (0,
|
|
5967
|
+
const slots = (0, import_react5.useMemo)(() => paginationStyle(variantProps), [variantProps]);
|
|
5955
5968
|
const { pageList, handleClickMovePage } = usePagination_default({
|
|
5956
5969
|
currentPage,
|
|
5957
5970
|
totalPage,
|
|
@@ -6319,7 +6332,7 @@ var scrollAreaStyle = (0, import_tailwind_variants5.tv)({
|
|
|
6319
6332
|
|
|
6320
6333
|
// src/components/table/table.tsx
|
|
6321
6334
|
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
6322
|
-
var Table = (0,
|
|
6335
|
+
var Table = (0, import_react6.forwardRef)((originalProps, ref) => {
|
|
6323
6336
|
const [props, variantProps] = mapPropsVariants(originalProps, tableStyle.variantKeys);
|
|
6324
6337
|
const {
|
|
6325
6338
|
rows,
|
|
@@ -6344,8 +6357,8 @@ var Table = (0, import_react5.forwardRef)((originalProps, ref) => {
|
|
|
6344
6357
|
} = { ...props, ...variantProps };
|
|
6345
6358
|
const { page = 1, perPage = 15 } = pagination || {};
|
|
6346
6359
|
const showPagination = pagination && totalData > 0;
|
|
6347
|
-
const [checkedRowIds, setCheckedRowIds] = (0,
|
|
6348
|
-
const tableMinWidth = (0,
|
|
6360
|
+
const [checkedRowIds, setCheckedRowIds] = (0, import_react6.useState)(new Set(checkedRows == null ? void 0 : checkedRows.map((row) => row.id)));
|
|
6361
|
+
const tableMinWidth = (0, import_react6.useMemo)(() => {
|
|
6349
6362
|
const columnsWidth = columns.reduce((total, column) => {
|
|
6350
6363
|
if (column.width) return total + column.width;
|
|
6351
6364
|
if (column.minWidth) return total + column.minWidth;
|
|
@@ -6354,10 +6367,10 @@ var Table = (0, import_react5.forwardRef)((originalProps, ref) => {
|
|
|
6354
6367
|
const checkboxWidth = rowCheckbox ? 40 : 0;
|
|
6355
6368
|
return columnsWidth + checkboxWidth;
|
|
6356
6369
|
}, [columns, rowCheckbox]);
|
|
6357
|
-
(0,
|
|
6370
|
+
(0, import_react6.useEffect)(() => {
|
|
6358
6371
|
onCheckedRowsChange == null ? void 0 : onCheckedRowsChange(getCheckedRowData(checkedRowIds));
|
|
6359
6372
|
}, [checkedRowIds]);
|
|
6360
|
-
(0,
|
|
6373
|
+
(0, import_react6.useEffect)(() => {
|
|
6361
6374
|
const currentRowIds = new Set(rows.map((row) => row.id));
|
|
6362
6375
|
const ids = Array.from(checkedRowIds);
|
|
6363
6376
|
const hasValidCheckedRows = ids.every((id) => currentRowIds.has(id));
|
|
@@ -6365,7 +6378,7 @@ var Table = (0, import_react5.forwardRef)((originalProps, ref) => {
|
|
|
6365
6378
|
setCheckedRowIds(new Set(checkedRows == null ? void 0 : checkedRows.map((row) => row.id)));
|
|
6366
6379
|
}
|
|
6367
6380
|
}, [rows.map((row) => row.id).join(",")]);
|
|
6368
|
-
(0,
|
|
6381
|
+
(0, import_react6.useImperativeHandle)(
|
|
6369
6382
|
ref,
|
|
6370
6383
|
() => ({
|
|
6371
6384
|
checkedRowIds,
|
|
@@ -6392,7 +6405,7 @@ var Table = (0, import_react5.forwardRef)((originalProps, ref) => {
|
|
|
6392
6405
|
onRowClick == null ? void 0 : onRowClick(row, index, event);
|
|
6393
6406
|
};
|
|
6394
6407
|
const getCheckedRowData = (checked) => rows.filter((row) => checked.has(row.id));
|
|
6395
|
-
const slots = (0,
|
|
6408
|
+
const slots = (0, import_react6.useMemo)(
|
|
6396
6409
|
() => tableStyle({ ...variantProps, rowClickable: typeof onRowClick === "function" }),
|
|
6397
6410
|
[variantProps, onRowClick]
|
|
6398
6411
|
);
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
table_head_default
|
|
4
|
-
} from "../../chunk-
|
|
4
|
+
} from "../../chunk-JPCZROOU.mjs";
|
|
5
5
|
import "../../chunk-7B7LRG5J.mjs";
|
|
6
6
|
import "../../chunk-D4YI5HF2.mjs";
|
|
7
7
|
import "../../chunk-F3HENRVM.mjs";
|
|
8
|
+
import "../../chunk-QZ3LVYJW.mjs";
|
|
8
9
|
import "../../chunk-2GCSFWHD.mjs";
|
|
9
10
|
import "../../chunk-VNRGOOSY.mjs";
|
|
10
|
-
import "../../chunk-QZ3LVYJW.mjs";
|
|
11
11
|
import "../../chunk-DQRAFUDA.mjs";
|
|
12
12
|
import "../../chunk-EWS3FESG.mjs";
|
|
13
13
|
import "../../chunk-OEIEALIP.mjs";
|
|
@@ -106,7 +106,7 @@ __export(table_exports, {
|
|
|
106
106
|
getCellStyle: () => getCellStyle
|
|
107
107
|
});
|
|
108
108
|
module.exports = __toCommonJS(table_exports);
|
|
109
|
-
var
|
|
109
|
+
var import_react6 = require("react");
|
|
110
110
|
var import_tailwind_variants6 = require("tailwind-variants");
|
|
111
111
|
|
|
112
112
|
// src/utils/props.ts
|
|
@@ -673,6 +673,7 @@ var TableHead = ({
|
|
|
673
673
|
var table_head_default = TableHead;
|
|
674
674
|
|
|
675
675
|
// src/components/table/table-body.tsx
|
|
676
|
+
var import_react2 = require("react");
|
|
676
677
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
677
678
|
var TableBody = ({
|
|
678
679
|
slots,
|
|
@@ -689,6 +690,7 @@ var TableBody = ({
|
|
|
689
690
|
classNames,
|
|
690
691
|
className
|
|
691
692
|
}) => {
|
|
693
|
+
const checkOverflow = (el) => el.scrollWidth > el.clientWidth;
|
|
692
694
|
const renderCheckboxCell = (rowId, rowIndex) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
693
695
|
"td",
|
|
694
696
|
{
|
|
@@ -710,11 +712,20 @@ var TableBody = ({
|
|
|
710
712
|
const value = row[column.field];
|
|
711
713
|
const formattedValue = ((_a = column.valueFormatter) == null ? void 0 : _a.call(column, { value, field: column.field })) || value;
|
|
712
714
|
const content = column.renderCell ? column.renderCell({ id: row.id, field: column.field, value, formattedValue, row }) : formattedValue;
|
|
715
|
+
const tdRef = (0, import_react2.useRef)(null);
|
|
716
|
+
const [showTitle, setShowTitle] = (0, import_react2.useState)(false);
|
|
717
|
+
(0, import_react2.useEffect)(() => {
|
|
718
|
+
if (tdRef.current) {
|
|
719
|
+
setShowTitle(checkOverflow(tdRef.current));
|
|
720
|
+
}
|
|
721
|
+
}, [content]);
|
|
713
722
|
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
714
723
|
"td",
|
|
715
724
|
{
|
|
716
|
-
|
|
717
|
-
|
|
725
|
+
ref: tdRef,
|
|
726
|
+
className: clsx(slots.td(), classNames == null ? void 0 : classNames.td, column.className, "truncate"),
|
|
727
|
+
style: { ...getCellStyle(column), maxWidth: column.width || "150px" },
|
|
728
|
+
title: showTitle ? String(content) : void 0,
|
|
718
729
|
children: content
|
|
719
730
|
},
|
|
720
731
|
`${row.id}-${column.field}-${colIdx}-${rowIndex}`
|
|
@@ -741,18 +752,18 @@ var TableBody = ({
|
|
|
741
752
|
var table_body_default = TableBody;
|
|
742
753
|
|
|
743
754
|
// src/components/pagination/pagination.tsx
|
|
744
|
-
var
|
|
755
|
+
var import_react5 = require("react");
|
|
745
756
|
|
|
746
757
|
// src/components/pagination/usePagination.ts
|
|
747
|
-
var
|
|
758
|
+
var import_react3 = require("react");
|
|
748
759
|
var usePagination = ({ currentPage, totalPage, groupSize, handleChangePage }) => {
|
|
749
|
-
const startPage = (0,
|
|
750
|
-
const endPage = (0,
|
|
751
|
-
const pageList = (0,
|
|
760
|
+
const startPage = (0, import_react3.useMemo)(() => Math.floor((currentPage - 1) / groupSize) * groupSize + 1, [currentPage, groupSize]);
|
|
761
|
+
const endPage = (0, import_react3.useMemo)(() => Math.min(startPage + groupSize - 1, totalPage), [startPage, groupSize, totalPage]);
|
|
762
|
+
const pageList = (0, import_react3.useMemo)(
|
|
752
763
|
() => Array.from({ length: endPage - startPage + 1 }, (_, i) => startPage + i),
|
|
753
764
|
[startPage, endPage]
|
|
754
765
|
);
|
|
755
|
-
const handleClickMovePage = (0,
|
|
766
|
+
const handleClickMovePage = (0, import_react3.useCallback)(
|
|
756
767
|
(page) => (event) => {
|
|
757
768
|
event.preventDefault();
|
|
758
769
|
handleChangePage == null ? void 0 : handleChangePage(page);
|
|
@@ -769,7 +780,7 @@ var usePagination = ({ currentPage, totalPage, groupSize, handleChangePage }) =>
|
|
|
769
780
|
var usePagination_default = usePagination;
|
|
770
781
|
|
|
771
782
|
// src/components/input/input.tsx
|
|
772
|
-
var
|
|
783
|
+
var import_react4 = require("react");
|
|
773
784
|
|
|
774
785
|
// src/components/icon/template.tsx
|
|
775
786
|
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
@@ -5594,12 +5605,12 @@ var Icon_default = Icon;
|
|
|
5594
5605
|
|
|
5595
5606
|
// src/components/input/input.tsx
|
|
5596
5607
|
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
5597
|
-
var Input = (0,
|
|
5608
|
+
var Input = (0, import_react4.forwardRef)((originalProps, ref) => {
|
|
5598
5609
|
const [props, variantProps] = mapPropsVariants(originalProps, inputStyle.variantKeys);
|
|
5599
5610
|
const { classNames, label, helperMessage, errorMessage, startContent, endContent, ...inputProps } = props;
|
|
5600
|
-
const inputRef = (0,
|
|
5601
|
-
const slots = (0,
|
|
5602
|
-
const getContentProps = (0,
|
|
5611
|
+
const inputRef = (0, import_react4.useRef)(null);
|
|
5612
|
+
const slots = (0, import_react4.useMemo)(() => inputStyle({ ...variantProps }), [variantProps]);
|
|
5613
|
+
const getContentProps = (0, import_react4.useCallback)(
|
|
5603
5614
|
() => ({
|
|
5604
5615
|
className: clsx(
|
|
5605
5616
|
slots.content({ class: classNames == null ? void 0 : classNames.content }),
|
|
@@ -5610,13 +5621,13 @@ var Input = (0, import_react3.forwardRef)((originalProps, ref) => {
|
|
|
5610
5621
|
[slots, classNames, originalProps.size, inputProps.readOnly]
|
|
5611
5622
|
);
|
|
5612
5623
|
const renderStartContent = () => {
|
|
5613
|
-
if ((0,
|
|
5624
|
+
if ((0, import_react4.isValidElement)(startContent)) {
|
|
5614
5625
|
const existingProps = startContent.props;
|
|
5615
5626
|
const mergedProps = {
|
|
5616
5627
|
...getContentProps(),
|
|
5617
5628
|
className: `${getContentProps().className || ""} ${existingProps.className || ""}`.trim()
|
|
5618
5629
|
};
|
|
5619
|
-
return (0,
|
|
5630
|
+
return (0, import_react4.cloneElement)(startContent, mergedProps);
|
|
5620
5631
|
} else {
|
|
5621
5632
|
const contentProps = getContentProps();
|
|
5622
5633
|
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { ...contentProps, children: startContent });
|
|
@@ -5635,13 +5646,13 @@ var Input = (0, import_react3.forwardRef)((originalProps, ref) => {
|
|
|
5635
5646
|
}
|
|
5636
5647
|
);
|
|
5637
5648
|
const renderContentWithIcon = () => {
|
|
5638
|
-
if ((0,
|
|
5649
|
+
if ((0, import_react4.isValidElement)(endContent)) {
|
|
5639
5650
|
const existingProps = endContent.props;
|
|
5640
5651
|
const mergedProps = {
|
|
5641
5652
|
...getContentProps(),
|
|
5642
5653
|
className: `${getContentProps().className || ""} ${existingProps.className || ""}`.trim()
|
|
5643
5654
|
};
|
|
5644
|
-
return (0,
|
|
5655
|
+
return (0, import_react4.cloneElement)(endContent, mergedProps);
|
|
5645
5656
|
} else if (errorMessage && errorMessage.length > 0) {
|
|
5646
5657
|
const iconProps = { ...getContentProps(), className: getContentProps().className };
|
|
5647
5658
|
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { ...iconProps, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Icon_default, { name: "exclamation-circle", fill: true, size: originalProps.size }) });
|
|
@@ -5978,7 +5989,7 @@ var inputStyle = tv(
|
|
|
5978
5989
|
|
|
5979
5990
|
// src/components/pagination/pagination.tsx
|
|
5980
5991
|
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
5981
|
-
var Pagination = (0,
|
|
5992
|
+
var Pagination = (0, import_react5.forwardRef)((originalProps, ref) => {
|
|
5982
5993
|
const [props, variantProps] = mapPropsVariants(originalProps, paginationStyle.variantKeys);
|
|
5983
5994
|
const {
|
|
5984
5995
|
classNames,
|
|
@@ -5992,12 +6003,12 @@ var Pagination = (0, import_react4.forwardRef)((originalProps, ref) => {
|
|
|
5992
6003
|
variant,
|
|
5993
6004
|
size
|
|
5994
6005
|
} = { ...props, ...variantProps };
|
|
5995
|
-
const [inputPage, setInputPage] = (0,
|
|
6006
|
+
const [inputPage, setInputPage] = (0, import_react5.useState)(currentPage);
|
|
5996
6007
|
const isFirstPageDisabled = currentPage <= 1;
|
|
5997
6008
|
const isPrevPageDisabled = currentPage <= 1;
|
|
5998
6009
|
const isNextPageDisabled = currentPage >= totalPage;
|
|
5999
6010
|
const isLastPageDisabled = currentPage >= totalPage;
|
|
6000
|
-
const slots = (0,
|
|
6011
|
+
const slots = (0, import_react5.useMemo)(() => paginationStyle(variantProps), [variantProps]);
|
|
6001
6012
|
const { pageList, handleClickMovePage } = usePagination_default({
|
|
6002
6013
|
currentPage,
|
|
6003
6014
|
totalPage,
|
|
@@ -6365,7 +6376,7 @@ var scrollAreaStyle = (0, import_tailwind_variants5.tv)({
|
|
|
6365
6376
|
|
|
6366
6377
|
// src/components/table/table.tsx
|
|
6367
6378
|
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
6368
|
-
var Table = (0,
|
|
6379
|
+
var Table = (0, import_react6.forwardRef)((originalProps, ref) => {
|
|
6369
6380
|
const [props, variantProps] = mapPropsVariants(originalProps, tableStyle.variantKeys);
|
|
6370
6381
|
const {
|
|
6371
6382
|
rows,
|
|
@@ -6390,8 +6401,8 @@ var Table = (0, import_react5.forwardRef)((originalProps, ref) => {
|
|
|
6390
6401
|
} = { ...props, ...variantProps };
|
|
6391
6402
|
const { page = 1, perPage = 15 } = pagination || {};
|
|
6392
6403
|
const showPagination = pagination && totalData > 0;
|
|
6393
|
-
const [checkedRowIds, setCheckedRowIds] = (0,
|
|
6394
|
-
const tableMinWidth = (0,
|
|
6404
|
+
const [checkedRowIds, setCheckedRowIds] = (0, import_react6.useState)(new Set(checkedRows == null ? void 0 : checkedRows.map((row) => row.id)));
|
|
6405
|
+
const tableMinWidth = (0, import_react6.useMemo)(() => {
|
|
6395
6406
|
const columnsWidth = columns.reduce((total, column) => {
|
|
6396
6407
|
if (column.width) return total + column.width;
|
|
6397
6408
|
if (column.minWidth) return total + column.minWidth;
|
|
@@ -6400,10 +6411,10 @@ var Table = (0, import_react5.forwardRef)((originalProps, ref) => {
|
|
|
6400
6411
|
const checkboxWidth = rowCheckbox ? 40 : 0;
|
|
6401
6412
|
return columnsWidth + checkboxWidth;
|
|
6402
6413
|
}, [columns, rowCheckbox]);
|
|
6403
|
-
(0,
|
|
6414
|
+
(0, import_react6.useEffect)(() => {
|
|
6404
6415
|
onCheckedRowsChange == null ? void 0 : onCheckedRowsChange(getCheckedRowData(checkedRowIds));
|
|
6405
6416
|
}, [checkedRowIds]);
|
|
6406
|
-
(0,
|
|
6417
|
+
(0, import_react6.useEffect)(() => {
|
|
6407
6418
|
const currentRowIds = new Set(rows.map((row) => row.id));
|
|
6408
6419
|
const ids = Array.from(checkedRowIds);
|
|
6409
6420
|
const hasValidCheckedRows = ids.every((id) => currentRowIds.has(id));
|
|
@@ -6411,7 +6422,7 @@ var Table = (0, import_react5.forwardRef)((originalProps, ref) => {
|
|
|
6411
6422
|
setCheckedRowIds(new Set(checkedRows == null ? void 0 : checkedRows.map((row) => row.id)));
|
|
6412
6423
|
}
|
|
6413
6424
|
}, [rows.map((row) => row.id).join(",")]);
|
|
6414
|
-
(0,
|
|
6425
|
+
(0, import_react6.useImperativeHandle)(
|
|
6415
6426
|
ref,
|
|
6416
6427
|
() => ({
|
|
6417
6428
|
checkedRowIds,
|
|
@@ -6438,7 +6449,7 @@ var Table = (0, import_react5.forwardRef)((originalProps, ref) => {
|
|
|
6438
6449
|
onRowClick == null ? void 0 : onRowClick(row, index, event);
|
|
6439
6450
|
};
|
|
6440
6451
|
const getCheckedRowData = (checked) => rows.filter((row) => checked.has(row.id));
|
|
6441
|
-
const slots = (0,
|
|
6452
|
+
const slots = (0, import_react6.useMemo)(
|
|
6442
6453
|
() => tableStyle({ ...variantProps, rowClickable: typeof onRowClick === "function" }),
|
|
6443
6454
|
[variantProps, onRowClick]
|
|
6444
6455
|
);
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
import {
|
|
3
3
|
getCellStyle,
|
|
4
4
|
table_default
|
|
5
|
-
} from "../../chunk-
|
|
5
|
+
} from "../../chunk-JPCZROOU.mjs";
|
|
6
6
|
import "../../chunk-7B7LRG5J.mjs";
|
|
7
7
|
import "../../chunk-D4YI5HF2.mjs";
|
|
8
8
|
import "../../chunk-F3HENRVM.mjs";
|
|
9
|
+
import "../../chunk-QZ3LVYJW.mjs";
|
|
9
10
|
import "../../chunk-2GCSFWHD.mjs";
|
|
10
11
|
import "../../chunk-VNRGOOSY.mjs";
|
|
11
|
-
import "../../chunk-QZ3LVYJW.mjs";
|
|
12
12
|
import "../../chunk-DQRAFUDA.mjs";
|
|
13
13
|
import "../../chunk-EWS3FESG.mjs";
|
|
14
14
|
import "../../chunk-OEIEALIP.mjs";
|