@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
|
@@ -18,14 +18,15 @@ import {
|
|
|
18
18
|
// src/components/table/table.tsx
|
|
19
19
|
import {
|
|
20
20
|
forwardRef,
|
|
21
|
-
useEffect,
|
|
21
|
+
useEffect as useEffect2,
|
|
22
22
|
useImperativeHandle,
|
|
23
23
|
useMemo,
|
|
24
|
-
useState
|
|
24
|
+
useState as useState2
|
|
25
25
|
} from "react";
|
|
26
26
|
import { tv } from "tailwind-variants";
|
|
27
27
|
|
|
28
28
|
// src/components/table/table-body.tsx
|
|
29
|
+
import { useEffect, useRef, useState } from "react";
|
|
29
30
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
30
31
|
var TableBody = ({
|
|
31
32
|
slots,
|
|
@@ -42,6 +43,7 @@ var TableBody = ({
|
|
|
42
43
|
classNames,
|
|
43
44
|
className
|
|
44
45
|
}) => {
|
|
46
|
+
const checkOverflow = (el) => el.scrollWidth > el.clientWidth;
|
|
45
47
|
const renderCheckboxCell = (rowId, rowIndex) => /* @__PURE__ */ jsx(
|
|
46
48
|
"td",
|
|
47
49
|
{
|
|
@@ -63,11 +65,20 @@ var TableBody = ({
|
|
|
63
65
|
const value = row[column.field];
|
|
64
66
|
const formattedValue = ((_a = column.valueFormatter) == null ? void 0 : _a.call(column, { value, field: column.field })) || value;
|
|
65
67
|
const content = column.renderCell ? column.renderCell({ id: row.id, field: column.field, value, formattedValue, row }) : formattedValue;
|
|
68
|
+
const tdRef = useRef(null);
|
|
69
|
+
const [showTitle, setShowTitle] = useState(false);
|
|
70
|
+
useEffect(() => {
|
|
71
|
+
if (tdRef.current) {
|
|
72
|
+
setShowTitle(checkOverflow(tdRef.current));
|
|
73
|
+
}
|
|
74
|
+
}, [content]);
|
|
66
75
|
return /* @__PURE__ */ jsx(
|
|
67
76
|
"td",
|
|
68
77
|
{
|
|
69
|
-
|
|
70
|
-
|
|
78
|
+
ref: tdRef,
|
|
79
|
+
className: clsx(slots.td(), classNames == null ? void 0 : classNames.td, column.className, "truncate"),
|
|
80
|
+
style: { ...getCellStyle(column), maxWidth: column.width || "150px" },
|
|
81
|
+
title: showTitle ? String(content) : void 0,
|
|
71
82
|
children: content
|
|
72
83
|
},
|
|
73
84
|
`${row.id}-${column.field}-${colIdx}-${rowIndex}`
|
|
@@ -120,7 +131,7 @@ var Table = forwardRef((originalProps, ref) => {
|
|
|
120
131
|
} = { ...props, ...variantProps };
|
|
121
132
|
const { page = 1, perPage = 15 } = pagination || {};
|
|
122
133
|
const showPagination = pagination && totalData > 0;
|
|
123
|
-
const [checkedRowIds, setCheckedRowIds] =
|
|
134
|
+
const [checkedRowIds, setCheckedRowIds] = useState2(new Set(checkedRows == null ? void 0 : checkedRows.map((row) => row.id)));
|
|
124
135
|
const tableMinWidth = useMemo(() => {
|
|
125
136
|
const columnsWidth = columns.reduce((total, column) => {
|
|
126
137
|
if (column.width) return total + column.width;
|
|
@@ -130,10 +141,10 @@ var Table = forwardRef((originalProps, ref) => {
|
|
|
130
141
|
const checkboxWidth = rowCheckbox ? 40 : 0;
|
|
131
142
|
return columnsWidth + checkboxWidth;
|
|
132
143
|
}, [columns, rowCheckbox]);
|
|
133
|
-
|
|
144
|
+
useEffect2(() => {
|
|
134
145
|
onCheckedRowsChange == null ? void 0 : onCheckedRowsChange(getCheckedRowData(checkedRowIds));
|
|
135
146
|
}, [checkedRowIds]);
|
|
136
|
-
|
|
147
|
+
useEffect2(() => {
|
|
137
148
|
const currentRowIds = new Set(rows.map((row) => row.id));
|
|
138
149
|
const ids = Array.from(checkedRowIds);
|
|
139
150
|
const hasValidCheckedRows = ids.every((id) => currentRowIds.has(id));
|
|
@@ -79,8 +79,8 @@ var AccordionItem = forwardRef((originalProps, ref) => {
|
|
|
79
79
|
}
|
|
80
80
|
};
|
|
81
81
|
}, [slots, classNames == null ? void 0 : classNames.content, contentHeight, isOpen, disableAnimation]);
|
|
82
|
-
return /* @__PURE__ */ jsxs("div", { ref, className: slots.base({ class: classNames == null ? void 0 : classNames.base }), children: [
|
|
83
|
-
/* @__PURE__ */ jsxs("div", { "data-isopen": isOpen, className: slots.header({ class: classNames == null ? void 0 : classNames.header }),
|
|
82
|
+
return /* @__PURE__ */ jsxs("div", { ref, className: slots.base({ class: classNames == null ? void 0 : classNames.base }), onClick: handleToggle, children: [
|
|
83
|
+
/* @__PURE__ */ jsxs("div", { "data-isopen": isOpen, className: slots.header({ class: classNames == null ? void 0 : classNames.header }), children: [
|
|
84
84
|
startContent && renderContent(startContent),
|
|
85
85
|
/* @__PURE__ */ jsx("span", { className: slots.headerTitle({ class: classNames == null ? void 0 : classNames.headerTitle }), children: title }),
|
|
86
86
|
endContent && renderContent(endContent)
|
|
@@ -92,16 +92,18 @@ AccordionItem.displayName = "AccordionItem";
|
|
|
92
92
|
var accordionItem_default = AccordionItem;
|
|
93
93
|
var accordionItem = tv({
|
|
94
94
|
slots: {
|
|
95
|
-
base: [
|
|
96
|
-
|
|
95
|
+
base: [
|
|
96
|
+
"group/accordion",
|
|
97
|
+
"w-full",
|
|
97
98
|
"flex",
|
|
98
|
-
"
|
|
99
|
-
"
|
|
100
|
-
"
|
|
99
|
+
"flex-col",
|
|
100
|
+
"gap-[12px]",
|
|
101
|
+
"p-[12px]",
|
|
102
|
+
"bg-body-background",
|
|
101
103
|
"cursor-pointer",
|
|
102
|
-
"select-none"
|
|
103
|
-
"gap-[8px]"
|
|
104
|
+
"select-none"
|
|
104
105
|
],
|
|
106
|
+
header: ["flex", "justify-between", "items-center", "text-foreground", "gap-[8px]"],
|
|
105
107
|
headerTitle: ["w-full", "font-bold", "text-body-foreground"],
|
|
106
108
|
content: [
|
|
107
109
|
"overflow-hidden",
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as tailwind_variants from 'tailwind-variants';
|
|
2
2
|
import { VariantProps } from 'tailwind-variants';
|
|
3
|
-
import
|
|
3
|
+
import * as react from 'react';
|
|
4
|
+
import { ReactNode } from 'react';
|
|
4
5
|
import { SlotsToClasses } from '../../utils/types.mjs';
|
|
5
6
|
|
|
6
7
|
interface Props {
|
|
@@ -10,7 +11,7 @@ interface Props {
|
|
|
10
11
|
selectionIndex?: number;
|
|
11
12
|
}
|
|
12
13
|
type AccordionProps = Props & AccordionVariantProps;
|
|
13
|
-
declare const Accordion:
|
|
14
|
+
declare const Accordion: react.ForwardRefExoticComponent<Props & AccordionVariantProps & react.RefAttributes<HTMLDivElement>>;
|
|
14
15
|
|
|
15
16
|
declare const accordion: tailwind_variants.TVReturnType<{
|
|
16
17
|
variant: {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as tailwind_variants from 'tailwind-variants';
|
|
2
2
|
import { VariantProps } from 'tailwind-variants';
|
|
3
|
-
import
|
|
3
|
+
import * as react from 'react';
|
|
4
|
+
import { ReactNode } from 'react';
|
|
4
5
|
import { SlotsToClasses } from '../../utils/types.js';
|
|
5
6
|
|
|
6
7
|
interface Props {
|
|
@@ -10,7 +11,7 @@ interface Props {
|
|
|
10
11
|
selectionIndex?: number;
|
|
11
12
|
}
|
|
12
13
|
type AccordionProps = Props & AccordionVariantProps;
|
|
13
|
-
declare const Accordion:
|
|
14
|
+
declare const Accordion: react.ForwardRefExoticComponent<Props & AccordionVariantProps & react.RefAttributes<HTMLDivElement>>;
|
|
14
15
|
|
|
15
16
|
declare const accordion: tailwind_variants.TVReturnType<{
|
|
16
17
|
variant: {
|
|
@@ -105,7 +105,7 @@ __export(accordion_exports, {
|
|
|
105
105
|
default: () => accordion_default
|
|
106
106
|
});
|
|
107
107
|
module.exports = __toCommonJS(accordion_exports);
|
|
108
|
-
var import_react =
|
|
108
|
+
var import_react = require("react");
|
|
109
109
|
|
|
110
110
|
// src/utils/tailwind-variants.ts
|
|
111
111
|
var import_tailwind_variants = require("tailwind-variants");
|
|
@@ -390,8 +390,8 @@ var Accordion = (0, import_react.forwardRef)((originalProps, ref) => {
|
|
|
390
390
|
}
|
|
391
391
|
});
|
|
392
392
|
};
|
|
393
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { ref, className: slots.base({ class: classNames == null ? void 0 : classNames.base }), children: import_react.
|
|
394
|
-
return import_react.
|
|
393
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { ref, className: slots.base({ class: classNames == null ? void 0 : classNames.base }), children: import_react.Children.map(children, (child, index) => {
|
|
394
|
+
return (0, import_react.cloneElement)(child, {
|
|
395
395
|
...variantProps,
|
|
396
396
|
...child.props,
|
|
397
397
|
isInGroup: true,
|
|
@@ -437,8 +437,8 @@ var AccordionItem = (0, import_react.forwardRef)((originalProps, ref) => {
|
|
|
437
437
|
}
|
|
438
438
|
};
|
|
439
439
|
}, [slots, classNames == null ? void 0 : classNames.content, contentHeight, isOpen, disableAnimation]);
|
|
440
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { ref, className: slots.base({ class: classNames == null ? void 0 : classNames.base }), children: [
|
|
441
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { "data-isopen": isOpen, className: slots.header({ class: classNames == null ? void 0 : classNames.header }),
|
|
440
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { ref, className: slots.base({ class: classNames == null ? void 0 : classNames.base }), onClick: handleToggle, children: [
|
|
441
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { "data-isopen": isOpen, className: slots.header({ class: classNames == null ? void 0 : classNames.header }), children: [
|
|
442
442
|
startContent && renderContent(startContent),
|
|
443
443
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: slots.headerTitle({ class: classNames == null ? void 0 : classNames.headerTitle }), children: title }),
|
|
444
444
|
endContent && renderContent(endContent)
|
|
@@ -450,16 +450,18 @@ AccordionItem.displayName = "AccordionItem";
|
|
|
450
450
|
var accordionItem_default = AccordionItem;
|
|
451
451
|
var accordionItem = tv({
|
|
452
452
|
slots: {
|
|
453
|
-
base: [
|
|
454
|
-
|
|
453
|
+
base: [
|
|
454
|
+
"group/accordion",
|
|
455
|
+
"w-full",
|
|
455
456
|
"flex",
|
|
456
|
-
"
|
|
457
|
-
"
|
|
458
|
-
"
|
|
457
|
+
"flex-col",
|
|
458
|
+
"gap-[12px]",
|
|
459
|
+
"p-[12px]",
|
|
460
|
+
"bg-body-background",
|
|
459
461
|
"cursor-pointer",
|
|
460
|
-
"select-none"
|
|
461
|
-
"gap-[8px]"
|
|
462
|
+
"select-none"
|
|
462
463
|
],
|
|
464
|
+
header: ["flex", "justify-between", "items-center", "text-foreground", "gap-[8px]"],
|
|
463
465
|
headerTitle: ["w-full", "font-bold", "text-body-foreground"],
|
|
464
466
|
content: [
|
|
465
467
|
"overflow-hidden",
|
|
@@ -108,7 +108,7 @@ __export(accordion_exports, {
|
|
|
108
108
|
module.exports = __toCommonJS(accordion_exports);
|
|
109
109
|
|
|
110
110
|
// src/components/accordion/accordion.tsx
|
|
111
|
-
var import_react =
|
|
111
|
+
var import_react = require("react");
|
|
112
112
|
|
|
113
113
|
// src/utils/tailwind-variants.ts
|
|
114
114
|
var import_tailwind_variants = require("tailwind-variants");
|
|
@@ -393,8 +393,8 @@ var Accordion = (0, import_react.forwardRef)((originalProps, ref) => {
|
|
|
393
393
|
}
|
|
394
394
|
});
|
|
395
395
|
};
|
|
396
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { ref, className: slots.base({ class: classNames == null ? void 0 : classNames.base }), children: import_react.
|
|
397
|
-
return import_react.
|
|
396
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { ref, className: slots.base({ class: classNames == null ? void 0 : classNames.base }), children: import_react.Children.map(children, (child, index) => {
|
|
397
|
+
return (0, import_react.cloneElement)(child, {
|
|
398
398
|
...variantProps,
|
|
399
399
|
...child.props,
|
|
400
400
|
isInGroup: true,
|
|
@@ -506,8 +506,8 @@ var AccordionItem = (0, import_react2.forwardRef)((originalProps, ref) => {
|
|
|
506
506
|
}
|
|
507
507
|
};
|
|
508
508
|
}, [slots, classNames == null ? void 0 : classNames.content, contentHeight, isOpen, disableAnimation]);
|
|
509
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { ref, className: slots.base({ class: classNames == null ? void 0 : classNames.base }), children: [
|
|
510
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { "data-isopen": isOpen, className: slots.header({ class: classNames == null ? void 0 : classNames.header }),
|
|
509
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { ref, className: slots.base({ class: classNames == null ? void 0 : classNames.base }), onClick: handleToggle, children: [
|
|
510
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { "data-isopen": isOpen, className: slots.header({ class: classNames == null ? void 0 : classNames.header }), children: [
|
|
511
511
|
startContent && renderContent(startContent),
|
|
512
512
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: slots.headerTitle({ class: classNames == null ? void 0 : classNames.headerTitle }), children: title }),
|
|
513
513
|
endContent && renderContent(endContent)
|
|
@@ -519,16 +519,18 @@ AccordionItem.displayName = "AccordionItem";
|
|
|
519
519
|
var accordionItem_default = AccordionItem;
|
|
520
520
|
var accordionItem = tv({
|
|
521
521
|
slots: {
|
|
522
|
-
base: [
|
|
523
|
-
|
|
522
|
+
base: [
|
|
523
|
+
"group/accordion",
|
|
524
|
+
"w-full",
|
|
524
525
|
"flex",
|
|
525
|
-
"
|
|
526
|
-
"
|
|
527
|
-
"
|
|
526
|
+
"flex-col",
|
|
527
|
+
"gap-[12px]",
|
|
528
|
+
"p-[12px]",
|
|
529
|
+
"bg-body-background",
|
|
528
530
|
"cursor-pointer",
|
|
529
|
-
"select-none"
|
|
530
|
-
"gap-[8px]"
|
|
531
|
+
"select-none"
|
|
531
532
|
],
|
|
533
|
+
header: ["flex", "justify-between", "items-center", "text-foreground", "gap-[8px]"],
|
|
532
534
|
headerTitle: ["w-full", "font-bold", "text-body-foreground"],
|
|
533
535
|
content: [
|
|
534
536
|
"overflow-hidden",
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
import "../../chunk-NMSDSEBD.mjs";
|
|
3
3
|
import {
|
|
4
4
|
accordion_default
|
|
5
|
-
} from "../../chunk-
|
|
5
|
+
} from "../../chunk-JGG3ZUNG.mjs";
|
|
6
6
|
import {
|
|
7
7
|
accordionItem_default
|
|
8
|
-
} from "../../chunk-
|
|
8
|
+
} from "../../chunk-NTNF5T5I.mjs";
|
|
9
9
|
import "../../chunk-E3G5QXSH.mjs";
|
|
10
10
|
import "../../chunk-U4DJHAM5.mjs";
|
|
11
11
|
import "../../chunk-AC6TWLRT.mjs";
|
|
@@ -108,7 +108,7 @@ __export(table_exports, {
|
|
|
108
108
|
module.exports = __toCommonJS(table_exports);
|
|
109
109
|
|
|
110
110
|
// src/components/table/table.tsx
|
|
111
|
-
var
|
|
111
|
+
var import_react6 = require("react");
|
|
112
112
|
var import_tailwind_variants6 = require("tailwind-variants");
|
|
113
113
|
|
|
114
114
|
// src/utils/props.ts
|
|
@@ -675,6 +675,7 @@ var TableHead = ({
|
|
|
675
675
|
var table_head_default = TableHead;
|
|
676
676
|
|
|
677
677
|
// src/components/table/table-body.tsx
|
|
678
|
+
var import_react2 = require("react");
|
|
678
679
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
679
680
|
var TableBody = ({
|
|
680
681
|
slots,
|
|
@@ -691,6 +692,7 @@ var TableBody = ({
|
|
|
691
692
|
classNames,
|
|
692
693
|
className
|
|
693
694
|
}) => {
|
|
695
|
+
const checkOverflow = (el) => el.scrollWidth > el.clientWidth;
|
|
694
696
|
const renderCheckboxCell = (rowId, rowIndex) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
695
697
|
"td",
|
|
696
698
|
{
|
|
@@ -712,11 +714,20 @@ var TableBody = ({
|
|
|
712
714
|
const value = row[column.field];
|
|
713
715
|
const formattedValue = ((_a = column.valueFormatter) == null ? void 0 : _a.call(column, { value, field: column.field })) || value;
|
|
714
716
|
const content = column.renderCell ? column.renderCell({ id: row.id, field: column.field, value, formattedValue, row }) : formattedValue;
|
|
717
|
+
const tdRef = (0, import_react2.useRef)(null);
|
|
718
|
+
const [showTitle, setShowTitle] = (0, import_react2.useState)(false);
|
|
719
|
+
(0, import_react2.useEffect)(() => {
|
|
720
|
+
if (tdRef.current) {
|
|
721
|
+
setShowTitle(checkOverflow(tdRef.current));
|
|
722
|
+
}
|
|
723
|
+
}, [content]);
|
|
715
724
|
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
716
725
|
"td",
|
|
717
726
|
{
|
|
718
|
-
|
|
719
|
-
|
|
727
|
+
ref: tdRef,
|
|
728
|
+
className: clsx(slots.td(), classNames == null ? void 0 : classNames.td, column.className, "truncate"),
|
|
729
|
+
style: { ...getCellStyle(column), maxWidth: column.width || "150px" },
|
|
730
|
+
title: showTitle ? String(content) : void 0,
|
|
720
731
|
children: content
|
|
721
732
|
},
|
|
722
733
|
`${row.id}-${column.field}-${colIdx}-${rowIndex}`
|
|
@@ -743,18 +754,18 @@ var TableBody = ({
|
|
|
743
754
|
var table_body_default = TableBody;
|
|
744
755
|
|
|
745
756
|
// src/components/pagination/pagination.tsx
|
|
746
|
-
var
|
|
757
|
+
var import_react5 = require("react");
|
|
747
758
|
|
|
748
759
|
// src/components/pagination/usePagination.ts
|
|
749
|
-
var
|
|
760
|
+
var import_react3 = require("react");
|
|
750
761
|
var usePagination = ({ currentPage, totalPage, groupSize, handleChangePage }) => {
|
|
751
|
-
const startPage = (0,
|
|
752
|
-
const endPage = (0,
|
|
753
|
-
const pageList = (0,
|
|
762
|
+
const startPage = (0, import_react3.useMemo)(() => Math.floor((currentPage - 1) / groupSize) * groupSize + 1, [currentPage, groupSize]);
|
|
763
|
+
const endPage = (0, import_react3.useMemo)(() => Math.min(startPage + groupSize - 1, totalPage), [startPage, groupSize, totalPage]);
|
|
764
|
+
const pageList = (0, import_react3.useMemo)(
|
|
754
765
|
() => Array.from({ length: endPage - startPage + 1 }, (_, i) => startPage + i),
|
|
755
766
|
[startPage, endPage]
|
|
756
767
|
);
|
|
757
|
-
const handleClickMovePage = (0,
|
|
768
|
+
const handleClickMovePage = (0, import_react3.useCallback)(
|
|
758
769
|
(page) => (event) => {
|
|
759
770
|
event.preventDefault();
|
|
760
771
|
handleChangePage == null ? void 0 : handleChangePage(page);
|
|
@@ -771,7 +782,7 @@ var usePagination = ({ currentPage, totalPage, groupSize, handleChangePage }) =>
|
|
|
771
782
|
var usePagination_default = usePagination;
|
|
772
783
|
|
|
773
784
|
// src/components/input/input.tsx
|
|
774
|
-
var
|
|
785
|
+
var import_react4 = require("react");
|
|
775
786
|
|
|
776
787
|
// src/components/icon/template.tsx
|
|
777
788
|
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
@@ -5596,12 +5607,12 @@ var Icon_default = Icon;
|
|
|
5596
5607
|
|
|
5597
5608
|
// src/components/input/input.tsx
|
|
5598
5609
|
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
5599
|
-
var Input = (0,
|
|
5610
|
+
var Input = (0, import_react4.forwardRef)((originalProps, ref) => {
|
|
5600
5611
|
const [props, variantProps] = mapPropsVariants(originalProps, inputStyle.variantKeys);
|
|
5601
5612
|
const { classNames, label, helperMessage, errorMessage, startContent, endContent, ...inputProps } = props;
|
|
5602
|
-
const inputRef = (0,
|
|
5603
|
-
const slots = (0,
|
|
5604
|
-
const getContentProps = (0,
|
|
5613
|
+
const inputRef = (0, import_react4.useRef)(null);
|
|
5614
|
+
const slots = (0, import_react4.useMemo)(() => inputStyle({ ...variantProps }), [variantProps]);
|
|
5615
|
+
const getContentProps = (0, import_react4.useCallback)(
|
|
5605
5616
|
() => ({
|
|
5606
5617
|
className: clsx(
|
|
5607
5618
|
slots.content({ class: classNames == null ? void 0 : classNames.content }),
|
|
@@ -5612,13 +5623,13 @@ var Input = (0, import_react3.forwardRef)((originalProps, ref) => {
|
|
|
5612
5623
|
[slots, classNames, originalProps.size, inputProps.readOnly]
|
|
5613
5624
|
);
|
|
5614
5625
|
const renderStartContent = () => {
|
|
5615
|
-
if ((0,
|
|
5626
|
+
if ((0, import_react4.isValidElement)(startContent)) {
|
|
5616
5627
|
const existingProps = startContent.props;
|
|
5617
5628
|
const mergedProps = {
|
|
5618
5629
|
...getContentProps(),
|
|
5619
5630
|
className: `${getContentProps().className || ""} ${existingProps.className || ""}`.trim()
|
|
5620
5631
|
};
|
|
5621
|
-
return (0,
|
|
5632
|
+
return (0, import_react4.cloneElement)(startContent, mergedProps);
|
|
5622
5633
|
} else {
|
|
5623
5634
|
const contentProps = getContentProps();
|
|
5624
5635
|
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { ...contentProps, children: startContent });
|
|
@@ -5637,13 +5648,13 @@ var Input = (0, import_react3.forwardRef)((originalProps, ref) => {
|
|
|
5637
5648
|
}
|
|
5638
5649
|
);
|
|
5639
5650
|
const renderContentWithIcon = () => {
|
|
5640
|
-
if ((0,
|
|
5651
|
+
if ((0, import_react4.isValidElement)(endContent)) {
|
|
5641
5652
|
const existingProps = endContent.props;
|
|
5642
5653
|
const mergedProps = {
|
|
5643
5654
|
...getContentProps(),
|
|
5644
5655
|
className: `${getContentProps().className || ""} ${existingProps.className || ""}`.trim()
|
|
5645
5656
|
};
|
|
5646
|
-
return (0,
|
|
5657
|
+
return (0, import_react4.cloneElement)(endContent, mergedProps);
|
|
5647
5658
|
} else if (errorMessage && errorMessage.length > 0) {
|
|
5648
5659
|
const iconProps = { ...getContentProps(), className: getContentProps().className };
|
|
5649
5660
|
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 }) });
|
|
@@ -5980,7 +5991,7 @@ var inputStyle = tv(
|
|
|
5980
5991
|
|
|
5981
5992
|
// src/components/pagination/pagination.tsx
|
|
5982
5993
|
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
5983
|
-
var Pagination = (0,
|
|
5994
|
+
var Pagination = (0, import_react5.forwardRef)((originalProps, ref) => {
|
|
5984
5995
|
const [props, variantProps] = mapPropsVariants(originalProps, paginationStyle.variantKeys);
|
|
5985
5996
|
const {
|
|
5986
5997
|
classNames,
|
|
@@ -5994,12 +6005,12 @@ var Pagination = (0, import_react4.forwardRef)((originalProps, ref) => {
|
|
|
5994
6005
|
variant,
|
|
5995
6006
|
size
|
|
5996
6007
|
} = { ...props, ...variantProps };
|
|
5997
|
-
const [inputPage, setInputPage] = (0,
|
|
6008
|
+
const [inputPage, setInputPage] = (0, import_react5.useState)(currentPage);
|
|
5998
6009
|
const isFirstPageDisabled = currentPage <= 1;
|
|
5999
6010
|
const isPrevPageDisabled = currentPage <= 1;
|
|
6000
6011
|
const isNextPageDisabled = currentPage >= totalPage;
|
|
6001
6012
|
const isLastPageDisabled = currentPage >= totalPage;
|
|
6002
|
-
const slots = (0,
|
|
6013
|
+
const slots = (0, import_react5.useMemo)(() => paginationStyle(variantProps), [variantProps]);
|
|
6003
6014
|
const { pageList, handleClickMovePage } = usePagination_default({
|
|
6004
6015
|
currentPage,
|
|
6005
6016
|
totalPage,
|
|
@@ -6367,7 +6378,7 @@ var scrollAreaStyle = (0, import_tailwind_variants5.tv)({
|
|
|
6367
6378
|
|
|
6368
6379
|
// src/components/table/table.tsx
|
|
6369
6380
|
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
6370
|
-
var Table = (0,
|
|
6381
|
+
var Table = (0, import_react6.forwardRef)((originalProps, ref) => {
|
|
6371
6382
|
const [props, variantProps] = mapPropsVariants(originalProps, tableStyle.variantKeys);
|
|
6372
6383
|
const {
|
|
6373
6384
|
rows,
|
|
@@ -6392,8 +6403,8 @@ var Table = (0, import_react5.forwardRef)((originalProps, ref) => {
|
|
|
6392
6403
|
} = { ...props, ...variantProps };
|
|
6393
6404
|
const { page = 1, perPage = 15 } = pagination || {};
|
|
6394
6405
|
const showPagination = pagination && totalData > 0;
|
|
6395
|
-
const [checkedRowIds, setCheckedRowIds] = (0,
|
|
6396
|
-
const tableMinWidth = (0,
|
|
6406
|
+
const [checkedRowIds, setCheckedRowIds] = (0, import_react6.useState)(new Set(checkedRows == null ? void 0 : checkedRows.map((row) => row.id)));
|
|
6407
|
+
const tableMinWidth = (0, import_react6.useMemo)(() => {
|
|
6397
6408
|
const columnsWidth = columns.reduce((total, column) => {
|
|
6398
6409
|
if (column.width) return total + column.width;
|
|
6399
6410
|
if (column.minWidth) return total + column.minWidth;
|
|
@@ -6402,10 +6413,10 @@ var Table = (0, import_react5.forwardRef)((originalProps, ref) => {
|
|
|
6402
6413
|
const checkboxWidth = rowCheckbox ? 40 : 0;
|
|
6403
6414
|
return columnsWidth + checkboxWidth;
|
|
6404
6415
|
}, [columns, rowCheckbox]);
|
|
6405
|
-
(0,
|
|
6416
|
+
(0, import_react6.useEffect)(() => {
|
|
6406
6417
|
onCheckedRowsChange == null ? void 0 : onCheckedRowsChange(getCheckedRowData(checkedRowIds));
|
|
6407
6418
|
}, [checkedRowIds]);
|
|
6408
|
-
(0,
|
|
6419
|
+
(0, import_react6.useEffect)(() => {
|
|
6409
6420
|
const currentRowIds = new Set(rows.map((row) => row.id));
|
|
6410
6421
|
const ids = Array.from(checkedRowIds);
|
|
6411
6422
|
const hasValidCheckedRows = ids.every((id) => currentRowIds.has(id));
|
|
@@ -6413,7 +6424,7 @@ var Table = (0, import_react5.forwardRef)((originalProps, ref) => {
|
|
|
6413
6424
|
setCheckedRowIds(new Set(checkedRows == null ? void 0 : checkedRows.map((row) => row.id)));
|
|
6414
6425
|
}
|
|
6415
6426
|
}, [rows.map((row) => row.id).join(",")]);
|
|
6416
|
-
(0,
|
|
6427
|
+
(0, import_react6.useImperativeHandle)(
|
|
6417
6428
|
ref,
|
|
6418
6429
|
() => ({
|
|
6419
6430
|
checkedRowIds,
|
|
@@ -6440,7 +6451,7 @@ var Table = (0, import_react5.forwardRef)((originalProps, ref) => {
|
|
|
6440
6451
|
onRowClick == null ? void 0 : onRowClick(row, index, event);
|
|
6441
6452
|
};
|
|
6442
6453
|
const getCheckedRowData = (checked) => rows.filter((row) => checked.has(row.id));
|
|
6443
|
-
const slots = (0,
|
|
6454
|
+
const slots = (0, import_react6.useMemo)(
|
|
6444
6455
|
() => tableStyle({ ...variantProps, rowClickable: typeof onRowClick === "function" }),
|
|
6445
6456
|
[variantProps, onRowClick]
|
|
6446
6457
|
);
|
|
@@ -6759,7 +6770,7 @@ var getCellStyle = (column) => {
|
|
|
6759
6770
|
};
|
|
6760
6771
|
|
|
6761
6772
|
// src/components/table/definition-table.tsx
|
|
6762
|
-
var
|
|
6773
|
+
var import_react7 = require("react");
|
|
6763
6774
|
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
6764
6775
|
var DEFAULT_CELL_CLASSES = "px-[10px] py-[8px] text-md border-r border-neutral-light h-[50px]";
|
|
6765
6776
|
var FIRST_CELL_WIDTH_CLASS = "w-[120px] font-bold text-md text-body-foreground";
|
|
@@ -6852,10 +6863,10 @@ var DefinitionTableRow = ({
|
|
|
6852
6863
|
colIndex
|
|
6853
6864
|
);
|
|
6854
6865
|
}) });
|
|
6855
|
-
var DefinitionTable = (0,
|
|
6866
|
+
var DefinitionTable = (0, import_react7.forwardRef)(
|
|
6856
6867
|
({ rows = [], footer, highlightColumnKey, classNames }, ref) => {
|
|
6857
|
-
const slots = (0,
|
|
6858
|
-
const highlightColumnIndex = (0,
|
|
6868
|
+
const slots = (0, import_react7.useMemo)(() => DefinitionTableStyle(), []);
|
|
6869
|
+
const highlightColumnIndex = (0, import_react7.useMemo)(
|
|
6859
6870
|
() => getHighlightColumnIndex(rows, highlightColumnKey),
|
|
6860
6871
|
[rows, highlightColumnKey]
|
|
6861
6872
|
);
|
|
@@ -5,13 +5,13 @@ import {
|
|
|
5
5
|
} from "../../chunk-DS5CGU2X.mjs";
|
|
6
6
|
import {
|
|
7
7
|
table_default
|
|
8
|
-
} from "../../chunk-
|
|
8
|
+
} from "../../chunk-JPCZROOU.mjs";
|
|
9
9
|
import "../../chunk-7B7LRG5J.mjs";
|
|
10
10
|
import "../../chunk-D4YI5HF2.mjs";
|
|
11
11
|
import "../../chunk-F3HENRVM.mjs";
|
|
12
|
+
import "../../chunk-QZ3LVYJW.mjs";
|
|
12
13
|
import "../../chunk-2GCSFWHD.mjs";
|
|
13
14
|
import "../../chunk-VNRGOOSY.mjs";
|
|
14
|
-
import "../../chunk-QZ3LVYJW.mjs";
|
|
15
15
|
import "../../chunk-DQRAFUDA.mjs";
|
|
16
16
|
import "../../chunk-EWS3FESG.mjs";
|
|
17
17
|
import "../../chunk-OEIEALIP.mjs";
|
|
@@ -105,6 +105,7 @@ __export(table_body_exports, {
|
|
|
105
105
|
default: () => table_body_default
|
|
106
106
|
});
|
|
107
107
|
module.exports = __toCommonJS(table_body_exports);
|
|
108
|
+
var import_react6 = require("react");
|
|
108
109
|
|
|
109
110
|
// src/utils/clsx.ts
|
|
110
111
|
function clsx(...args) {
|
|
@@ -6705,6 +6706,7 @@ var TableBody = ({
|
|
|
6705
6706
|
classNames,
|
|
6706
6707
|
className
|
|
6707
6708
|
}) => {
|
|
6709
|
+
const checkOverflow = (el) => el.scrollWidth > el.clientWidth;
|
|
6708
6710
|
const renderCheckboxCell = (rowId, rowIndex) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
6709
6711
|
"td",
|
|
6710
6712
|
{
|
|
@@ -6726,11 +6728,20 @@ var TableBody = ({
|
|
|
6726
6728
|
const value = row[column.field];
|
|
6727
6729
|
const formattedValue = ((_a = column.valueFormatter) == null ? void 0 : _a.call(column, { value, field: column.field })) || value;
|
|
6728
6730
|
const content = column.renderCell ? column.renderCell({ id: row.id, field: column.field, value, formattedValue, row }) : formattedValue;
|
|
6731
|
+
const tdRef = (0, import_react6.useRef)(null);
|
|
6732
|
+
const [showTitle, setShowTitle] = (0, import_react6.useState)(false);
|
|
6733
|
+
(0, import_react6.useEffect)(() => {
|
|
6734
|
+
if (tdRef.current) {
|
|
6735
|
+
setShowTitle(checkOverflow(tdRef.current));
|
|
6736
|
+
}
|
|
6737
|
+
}, [content]);
|
|
6729
6738
|
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
6730
6739
|
"td",
|
|
6731
6740
|
{
|
|
6732
|
-
|
|
6733
|
-
|
|
6741
|
+
ref: tdRef,
|
|
6742
|
+
className: clsx(slots.td(), classNames == null ? void 0 : classNames.td, column.className, "truncate"),
|
|
6743
|
+
style: { ...getCellStyle(column), maxWidth: column.width || "150px" },
|
|
6744
|
+
title: showTitle ? String(content) : void 0,
|
|
6734
6745
|
children: content
|
|
6735
6746
|
},
|
|
6736
6747
|
`${row.id}-${column.field}-${colIdx}-${rowIndex}`
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
table_body_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";
|