@deepnoid/ui 0.1.28 → 0.1.30
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 +181 -161
- package/dist/chunk-6PN3DGOE.mjs +77 -0
- package/dist/chunk-CEZQCD6Z.mjs +79 -0
- package/dist/{chunk-JV7VLO2L.mjs → chunk-GLMM253Q.mjs} +37 -27
- package/dist/{chunk-K7VUN5BS.mjs → chunk-IC25OKBJ.mjs} +1 -1
- package/dist/{chunk-NHVIKP4H.mjs → chunk-K7V4VE7R.mjs} +4 -4
- package/dist/chunk-MZ76AA76.mjs +1 -0
- package/dist/{chunk-4OSN2OE2.mjs → chunk-NFQMXW4Z.mjs} +25 -18
- package/dist/chunk-NKH3OF6I.mjs +132 -0
- package/dist/chunk-P7YYNA6L.mjs +67 -0
- package/dist/{chunk-SO7BGWM7.mjs → chunk-QM4ZSQYX.mjs} +1 -1
- package/dist/chunk-RLXOHILK.mjs +1 -0
- package/dist/{chunk-BEQ3KZGS.mjs → chunk-VCVQMPC7.mjs} +2 -1
- package/dist/components/breadcrumb/breadcrumb.mjs +3 -3
- package/dist/components/breadcrumb/index.mjs +3 -3
- package/dist/components/button/button.mjs +2 -2
- package/dist/components/button/icon-button.mjs +2 -2
- package/dist/components/button/index.mjs +3 -3
- package/dist/components/dateTimePicker/dateTimePicker.mjs +5 -5
- package/dist/components/dateTimePicker/index.mjs +5 -5
- package/dist/components/dateTimePicker/timePicker.mjs +2 -2
- package/dist/components/fileUpload/fileUpload.d.mts +92 -0
- package/dist/components/fileUpload/fileUpload.d.ts +92 -0
- package/dist/components/fileUpload/fileUpload.js +5648 -0
- package/dist/components/fileUpload/fileUpload.mjs +28 -0
- package/dist/components/fileUpload/index.d.mts +5 -0
- package/dist/components/fileUpload/index.d.ts +5 -0
- package/dist/components/fileUpload/index.js +5647 -0
- package/dist/components/fileUpload/index.mjs +25 -0
- package/dist/components/input/index.js +2 -1
- package/dist/components/input/index.mjs +1 -1
- package/dist/components/input/input.js +2 -1
- package/dist/components/input/input.mjs +1 -1
- package/dist/components/list/index.mjs +3 -3
- package/dist/components/modal/index.mjs +4 -4
- package/dist/components/modal/modal.mjs +4 -4
- package/dist/components/pagination/index.js +2 -1
- package/dist/components/pagination/index.mjs +2 -2
- package/dist/components/pagination/pagination.js +2 -1
- package/dist/components/pagination/pagination.mjs +2 -2
- package/dist/components/ripple/index.mjs +3 -3
- package/dist/components/skeleton/index.d.mts +2 -0
- package/dist/components/skeleton/index.d.ts +2 -0
- package/dist/components/skeleton/index.js +141 -0
- package/dist/components/skeleton/index.mjs +10 -0
- package/dist/components/skeleton/skeleton.d.mts +14 -0
- package/dist/components/skeleton/skeleton.d.ts +14 -0
- package/dist/components/skeleton/skeleton.js +135 -0
- package/dist/components/skeleton/skeleton.mjs +9 -0
- package/dist/components/table/index.js +694 -615
- package/dist/components/table/index.mjs +9 -7
- package/dist/components/table/table-body.d.mts +6 -4
- package/dist/components/table/table-body.d.ts +6 -4
- package/dist/components/table/table-body.js +115 -64
- package/dist/components/table/table-body.mjs +3 -1
- package/dist/components/table/table-head.d.mts +3 -1
- package/dist/components/table/table-head.d.ts +3 -1
- package/dist/components/table/table-head.js +107 -21
- package/dist/components/table/table-head.mjs +3 -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 +685 -606
- package/dist/components/table/table.mjs +7 -5
- package/dist/components/tree/index.js +25 -18
- package/dist/components/tree/index.mjs +1 -1
- package/dist/components/tree/tree.d.mts +20 -13
- package/dist/components/tree/tree.d.ts +20 -13
- package/dist/components/tree/tree.js +25 -18
- package/dist/components/tree/tree.mjs +1 -1
- package/dist/index.d.mts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +607 -401
- package/dist/index.mjs +50 -40
- package/package.json +1 -1
- package/dist/chunk-UNH3BCGN.mjs +0 -47
- package/dist/chunk-XRC5OUYQ.mjs +0 -94
- package/dist/{chunk-QIEKOGY7.mjs → chunk-7TAGGLNY.mjs} +3 -3
- package/dist/{chunk-KYJTZPXY.mjs → chunk-BFOK4HVC.mjs} +3 -3
- package/dist/{chunk-JTZUXVOU.mjs → chunk-UB4YBFOT.mjs} +3 -3
package/dist/index.js
CHANGED
|
@@ -111,6 +111,7 @@ __export(index_exports, {
|
|
|
111
111
|
Chip: () => chip_default,
|
|
112
112
|
DateTimePicker: () => dateTimePicker_default,
|
|
113
113
|
DefinitionTable: () => definition_table_default,
|
|
114
|
+
FileUpload: () => fileUpload_default,
|
|
114
115
|
Icon: () => Icon_default,
|
|
115
116
|
IconButton: () => icon_button_default,
|
|
116
117
|
Input: () => input_default,
|
|
@@ -121,6 +122,7 @@ __export(index_exports, {
|
|
|
121
122
|
Radio: () => radio_default,
|
|
122
123
|
ScrollArea: () => scrollArea_default,
|
|
123
124
|
Select: () => select_default,
|
|
125
|
+
Skeleton: () => skeleton_default,
|
|
124
126
|
Switch: () => switch_default,
|
|
125
127
|
Table: () => table_default,
|
|
126
128
|
Tabs: () => tabs_default,
|
|
@@ -5957,9 +5959,10 @@ var Input = (0, import_react9.forwardRef)((originalProps, ref) => {
|
|
|
5957
5959
|
{
|
|
5958
5960
|
...inputProps,
|
|
5959
5961
|
ref: ref || inputRef,
|
|
5962
|
+
readOnly: props.readOnly,
|
|
5960
5963
|
className: clsx(
|
|
5961
5964
|
slots.input({ class: classNames == null ? void 0 : classNames.input }),
|
|
5962
|
-
inputProps.readOnly ? "!text-body-foreground placeholder
|
|
5965
|
+
inputProps.readOnly ? "!text-body-foreground placeholder:!text-body-foreground" : ""
|
|
5963
5966
|
),
|
|
5964
5967
|
size: 0
|
|
5965
5968
|
}
|
|
@@ -6612,8 +6615,8 @@ var textareaStyle = (0, import_tailwind_variants11.tv)({
|
|
|
6612
6615
|
});
|
|
6613
6616
|
|
|
6614
6617
|
// src/components/table/table.tsx
|
|
6615
|
-
var
|
|
6616
|
-
var
|
|
6618
|
+
var import_react15 = require("react");
|
|
6619
|
+
var import_tailwind_variants16 = require("tailwind-variants");
|
|
6617
6620
|
|
|
6618
6621
|
// src/components/checkbox/checkbox.tsx
|
|
6619
6622
|
var import_react12 = require("react");
|
|
@@ -6822,138 +6825,206 @@ var checkboxStyle = tv({
|
|
|
6822
6825
|
}
|
|
6823
6826
|
});
|
|
6824
6827
|
|
|
6825
|
-
// src/components/
|
|
6828
|
+
// src/components/skeleton/skeleton.tsx
|
|
6829
|
+
var import_tailwind_variants13 = require("tailwind-variants");
|
|
6826
6830
|
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
6827
|
-
var
|
|
6831
|
+
var Skeleton = ({ color = "primary", className, speed = "normal", rounded = "md" }) => {
|
|
6832
|
+
const speedMap = {
|
|
6833
|
+
fast: "0.7s",
|
|
6834
|
+
normal: "1.2s",
|
|
6835
|
+
slow: "2s"
|
|
6836
|
+
};
|
|
6837
|
+
const slots = skeletonStyle();
|
|
6838
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
6839
|
+
"div",
|
|
6840
|
+
{
|
|
6841
|
+
className: clsx(slots.base({ color, rounded }), className),
|
|
6842
|
+
style: {
|
|
6843
|
+
"--shimmer-duration": speedMap[speed]
|
|
6844
|
+
},
|
|
6845
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("style", { children: `@keyframes shimmer {
|
|
6846
|
+
100% {
|
|
6847
|
+
transform: translateX(100%);
|
|
6848
|
+
}
|
|
6849
|
+
}
|
|
6850
|
+
.skeleton-shimmer::before {
|
|
6851
|
+
animation: shimmer var(--shimmer-duration) infinite linear;
|
|
6852
|
+
}
|
|
6853
|
+
` })
|
|
6854
|
+
}
|
|
6855
|
+
);
|
|
6856
|
+
};
|
|
6857
|
+
Skeleton.displayName = "Skeleton";
|
|
6858
|
+
var skeleton_default = Skeleton;
|
|
6859
|
+
var skeletonStyle = (0, import_tailwind_variants13.tv)({
|
|
6860
|
+
slots: {
|
|
6861
|
+
base: [
|
|
6862
|
+
"relative",
|
|
6863
|
+
"overflow-hidden",
|
|
6864
|
+
"w-full",
|
|
6865
|
+
"h-[18px]",
|
|
6866
|
+
"skeleton-shimmer",
|
|
6867
|
+
"before:absolute",
|
|
6868
|
+
"before:inset-0",
|
|
6869
|
+
"before:-translate-x-full",
|
|
6870
|
+
"before:bg-gradient-to-r",
|
|
6871
|
+
"before:from-transparent",
|
|
6872
|
+
"before:via-white/40",
|
|
6873
|
+
"before:to-transparent",
|
|
6874
|
+
"before:content-['']"
|
|
6875
|
+
]
|
|
6876
|
+
},
|
|
6877
|
+
variants: {
|
|
6878
|
+
color: {
|
|
6879
|
+
primary: { base: "bg-primary-soft" },
|
|
6880
|
+
secondary: { base: "bg-secondary-soft" },
|
|
6881
|
+
neutral: { base: "bg-neutral-soft" }
|
|
6882
|
+
},
|
|
6883
|
+
rounded: {
|
|
6884
|
+
sm: { base: "rounded-sm" },
|
|
6885
|
+
md: { base: "rounded-md" },
|
|
6886
|
+
lg: { base: "rounded-lg" },
|
|
6887
|
+
xl: { base: "rounded-xl" },
|
|
6888
|
+
full: { base: "rounded-full" }
|
|
6889
|
+
}
|
|
6890
|
+
},
|
|
6891
|
+
defaultVariants: {
|
|
6892
|
+
color: "primary",
|
|
6893
|
+
rounded: "md"
|
|
6894
|
+
}
|
|
6895
|
+
});
|
|
6896
|
+
|
|
6897
|
+
// src/components/table/table-head.tsx
|
|
6898
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
6899
|
+
var TableHead = ({
|
|
6900
|
+
slots,
|
|
6901
|
+
columns,
|
|
6902
|
+
color,
|
|
6903
|
+
size,
|
|
6904
|
+
rowCheckbox = false,
|
|
6905
|
+
isCheckedAll,
|
|
6906
|
+
isLoading = false,
|
|
6907
|
+
classNames,
|
|
6908
|
+
onCheckAll
|
|
6909
|
+
}) => {
|
|
6828
6910
|
const handleClickCheckAll = (e) => {
|
|
6829
6911
|
e.preventDefault();
|
|
6830
6912
|
onCheckAll(!isCheckedAll);
|
|
6831
6913
|
};
|
|
6832
|
-
const
|
|
6914
|
+
const renderTh = (content, key, column) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
6833
6915
|
"th",
|
|
6834
6916
|
{
|
|
6835
6917
|
className: clsx(slots.th({ class: classNames == null ? void 0 : classNames.th }), column),
|
|
6836
6918
|
style: {
|
|
6837
|
-
width: column.width ? `${column.width}px` : void 0,
|
|
6838
|
-
minWidth: column.minWidth ? `${column.minWidth}px` : void 0,
|
|
6839
|
-
maxWidth: column.maxWidth ? `${column.maxWidth}px` : void 0,
|
|
6840
|
-
height: column.height ? `${column.height}px` : void 0
|
|
6919
|
+
width: (column == null ? void 0 : column.width) ? `${column.width}px` : void 0,
|
|
6920
|
+
minWidth: (column == null ? void 0 : column.minWidth) ? `${column.minWidth}px` : void 0,
|
|
6921
|
+
maxWidth: (column == null ? void 0 : column.maxWidth) ? `${column.maxWidth}px` : void 0,
|
|
6922
|
+
height: (column == null ? void 0 : column.height) ? `${column.height}px` : void 0
|
|
6841
6923
|
},
|
|
6842
|
-
children:
|
|
6924
|
+
children: content
|
|
6843
6925
|
},
|
|
6844
|
-
|
|
6845
|
-
)
|
|
6846
|
-
const
|
|
6847
|
-
|
|
6848
|
-
{
|
|
6849
|
-
size,
|
|
6850
|
-
checked: isCheckedAll,
|
|
6851
|
-
onChange: (e) => onCheckAll(e.target.checked)
|
|
6852
|
-
}
|
|
6853
|
-
) }) });
|
|
6854
|
-
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("thead", { className: slots.thead({ class: classNames == null ? void 0 : classNames.thead }), children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("tr", { className: slots.tr({ class: classNames == null ? void 0 : classNames.tr }), children: [
|
|
6855
|
-
renderColumnHeaders(),
|
|
6856
|
-
renderSelectAllCheckbox()
|
|
6926
|
+
key
|
|
6927
|
+
);
|
|
6928
|
+
const renderSkeletonRow = () => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("thead", { className: slots.thead({ class: classNames == null ? void 0 : classNames.thead }), children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("tr", { className: clsx(slots.tr({ class: classNames == null ? void 0 : classNames.tr }), "[&>th]:border-0"), children: [
|
|
6929
|
+
columns.map((_, idx) => renderTh(/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(skeleton_default, { color, rounded: "lg", speed: "fast" }), `skeleton-${idx}`)),
|
|
6930
|
+
rowCheckbox && renderTh(/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(skeleton_default, { color, rounded: "lg", speed: "fast" }), "checkbox-skeleton")
|
|
6857
6931
|
] }) });
|
|
6932
|
+
const renderContentRow = () => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("thead", { className: slots.thead({ class: classNames == null ? void 0 : classNames.thead }), children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("tr", { className: slots.tr({ class: classNames == null ? void 0 : classNames.tr }), children: [
|
|
6933
|
+
columns.map((column, idx) => renderTh(column.headerName, `${column.field}-${idx}`, column)),
|
|
6934
|
+
rowCheckbox && renderTh(
|
|
6935
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "flex items-center justify-center", onClick: handleClickCheckAll, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
6936
|
+
checkbox_default,
|
|
6937
|
+
{
|
|
6938
|
+
size,
|
|
6939
|
+
checked: isCheckedAll,
|
|
6940
|
+
onChange: (e) => onCheckAll(e.target.checked)
|
|
6941
|
+
}
|
|
6942
|
+
) }),
|
|
6943
|
+
"checkbox"
|
|
6944
|
+
)
|
|
6945
|
+
] }) });
|
|
6946
|
+
return isLoading ? renderSkeletonRow() : renderContentRow();
|
|
6858
6947
|
};
|
|
6859
6948
|
var table_head_default = TableHead;
|
|
6860
6949
|
|
|
6861
6950
|
// src/components/table/table-body.tsx
|
|
6862
|
-
var
|
|
6863
|
-
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
6864
|
-
var import_react14 = require("react");
|
|
6951
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
6865
6952
|
var TableBody = ({
|
|
6866
6953
|
slots,
|
|
6867
|
-
columns,
|
|
6868
6954
|
rows,
|
|
6955
|
+
columns,
|
|
6869
6956
|
size,
|
|
6870
|
-
|
|
6957
|
+
color,
|
|
6958
|
+
rowCheckbox = false,
|
|
6871
6959
|
checkedRows,
|
|
6872
6960
|
onCheckRow,
|
|
6873
6961
|
onRowClick,
|
|
6962
|
+
isLoading = false,
|
|
6874
6963
|
emptyContent,
|
|
6875
|
-
|
|
6964
|
+
skeletonRow,
|
|
6876
6965
|
classNames,
|
|
6877
6966
|
className
|
|
6878
6967
|
}) => {
|
|
6879
|
-
const
|
|
6880
|
-
|
|
6881
|
-
|
|
6882
|
-
|
|
6883
|
-
|
|
6884
|
-
|
|
6885
|
-
|
|
6886
|
-
|
|
6887
|
-
|
|
6888
|
-
|
|
6889
|
-
|
|
6890
|
-
|
|
6891
|
-
|
|
6892
|
-
|
|
6893
|
-
|
|
6894
|
-
|
|
6895
|
-
|
|
6896
|
-
|
|
6897
|
-
|
|
6898
|
-
|
|
6899
|
-
|
|
6900
|
-
|
|
6901
|
-
|
|
6902
|
-
|
|
6903
|
-
|
|
6904
|
-
|
|
6905
|
-
|
|
6906
|
-
|
|
6907
|
-
height: column.height ? `${column.height}px` : void 0
|
|
6908
|
-
}
|
|
6909
|
-
};
|
|
6910
|
-
},
|
|
6911
|
-
[classNames == null ? void 0 : classNames.td, generateColumnStyles, slots]
|
|
6912
|
-
);
|
|
6913
|
-
const hasRows = rows.length > 0;
|
|
6914
|
-
const colSpan = (columns.length || 1) + (rowCheckbox ? 1 : 0);
|
|
6915
|
-
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("tbody", { className: clsx(slots.tbody({ class: classNames == null ? void 0 : classNames.tbody }), className), children: [
|
|
6916
|
-
!isLoading && hasRows && rows.map((row, rowIndex) => {
|
|
6917
|
-
const isRowChecked = checkedRows.has(rowIndex);
|
|
6918
|
-
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
6919
|
-
"tr",
|
|
6968
|
+
const getCellStyle = (col) => ({
|
|
6969
|
+
width: col.width ? `${col.width}px` : void 0,
|
|
6970
|
+
minWidth: col.minWidth ? `${col.minWidth}px` : void 0,
|
|
6971
|
+
maxWidth: col.maxWidth ? `${col.maxWidth}px` : void 0,
|
|
6972
|
+
height: col.height ? `${col.height}px` : void 0
|
|
6973
|
+
});
|
|
6974
|
+
const renderTdSkeleton = (key) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("td", { className: slots.td({ class: classNames == null ? void 0 : classNames.td }), children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(skeleton_default, { color, className: "h-full w-full", rounded: "lg", speed: "fast" }) }, key);
|
|
6975
|
+
const renderCheckboxCell = (rowIndex) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("td", { className: clsx(slots.td({ class: classNames == null ? void 0 : classNames.td }), "text-center"), children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
6976
|
+
checkbox_default,
|
|
6977
|
+
{
|
|
6978
|
+
size,
|
|
6979
|
+
checked: checkedRows.has(rowIndex),
|
|
6980
|
+
onChange: (e) => onCheckRow(rowIndex, e.target.checked)
|
|
6981
|
+
}
|
|
6982
|
+
) });
|
|
6983
|
+
const renderSkeletonRow = (rowIndex) => /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("tr", { className: slots.tr({ class: classNames == null ? void 0 : classNames.tr }), children: [
|
|
6984
|
+
columns.map((_, colIdx) => renderTdSkeleton(`skeleton-${rowIndex}-${colIdx}`)),
|
|
6985
|
+
rowCheckbox && renderTdSkeleton(`skeleton-checkbox-${rowIndex}`)
|
|
6986
|
+
] }, `skeleton-${rowIndex}`);
|
|
6987
|
+
const renderEmptyRow = () => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("tr", { className: slots.tr({ class: classNames == null ? void 0 : classNames.tr }), children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("td", { colSpan: columns.length + (rowCheckbox ? 1 : 0), className: slots.empty({ class: classNames == null ? void 0 : classNames.empty }), children: emptyContent }) });
|
|
6988
|
+
const renderDataRow = (row, rowIndex) => /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("tr", { className: slots.tr({ class: classNames == null ? void 0 : classNames.tr }), onClick: () => onRowClick == null ? void 0 : onRowClick(row), children: [
|
|
6989
|
+
columns.map((col, colIdx) => {
|
|
6990
|
+
var _a;
|
|
6991
|
+
const value = row[col.field];
|
|
6992
|
+
const formattedValue = ((_a = col.valueFormatter) == null ? void 0 : _a.call(col, { value, field: col.field })) || value;
|
|
6993
|
+
const content = col.renderCell ? col.renderCell({ id: row.id, field: col.field, value, formattedValue, row }) : formattedValue;
|
|
6994
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
6995
|
+
"td",
|
|
6920
6996
|
{
|
|
6921
|
-
className: slots.
|
|
6922
|
-
|
|
6923
|
-
|
|
6924
|
-
children: [
|
|
6925
|
-
columns.map((column) => /* @__PURE__ */ (0, import_react14.createElement)("td", { ...getCellProps(column, row), key: column.field })),
|
|
6926
|
-
rowCheckbox && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("td", { className: slots.td({ class: classNames == null ? void 0 : classNames.td }), children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
6927
|
-
checkbox_default,
|
|
6928
|
-
{
|
|
6929
|
-
size,
|
|
6930
|
-
checked: isRowChecked,
|
|
6931
|
-
onChange: (e) => onCheckRow(rowIndex, e.target.checked)
|
|
6932
|
-
}
|
|
6933
|
-
) }) })
|
|
6934
|
-
]
|
|
6997
|
+
className: clsx(slots.td({ class: classNames == null ? void 0 : classNames.td }), col.className),
|
|
6998
|
+
style: getCellStyle(col),
|
|
6999
|
+
children: content
|
|
6935
7000
|
},
|
|
6936
|
-
rowIndex
|
|
7001
|
+
`${rowIndex}-${colIdx}`
|
|
6937
7002
|
);
|
|
6938
7003
|
}),
|
|
6939
|
-
|
|
6940
|
-
] });
|
|
7004
|
+
rowCheckbox && renderCheckboxCell(rowIndex)
|
|
7005
|
+
] }, rowIndex);
|
|
7006
|
+
const renderRows = () => {
|
|
7007
|
+
if (isLoading) return skeletonRow ? Array.from({ length: skeletonRow }, (_, idx) => renderSkeletonRow(idx)) : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_jsx_runtime17.Fragment, {});
|
|
7008
|
+
if (!rows.length && emptyContent) return renderEmptyRow();
|
|
7009
|
+
return rows.map((row, index) => renderDataRow(row, index));
|
|
7010
|
+
};
|
|
7011
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("tbody", { className: `${slots.tbody({ class: classNames == null ? void 0 : classNames.tbody })} ${className || ""}`, children: renderRows() });
|
|
6941
7012
|
};
|
|
6942
7013
|
var table_body_default = TableBody;
|
|
6943
7014
|
|
|
6944
7015
|
// src/components/pagination/pagination.tsx
|
|
6945
|
-
var
|
|
7016
|
+
var import_react14 = require("react");
|
|
6946
7017
|
|
|
6947
7018
|
// src/components/pagination/usePagination.ts
|
|
6948
|
-
var
|
|
7019
|
+
var import_react13 = require("react");
|
|
6949
7020
|
var usePagination = ({ currentPage, totalPage, groupSize, handleChangePage }) => {
|
|
6950
|
-
const startPage = (0,
|
|
6951
|
-
const endPage = (0,
|
|
6952
|
-
const pageList = (0,
|
|
7021
|
+
const startPage = (0, import_react13.useMemo)(() => Math.floor((currentPage - 1) / groupSize) * groupSize + 1, [currentPage, groupSize]);
|
|
7022
|
+
const endPage = (0, import_react13.useMemo)(() => Math.min(startPage + groupSize - 1, totalPage), [startPage, groupSize, totalPage]);
|
|
7023
|
+
const pageList = (0, import_react13.useMemo)(
|
|
6953
7024
|
() => Array.from({ length: endPage - startPage + 1 }, (_, i) => startPage + i),
|
|
6954
7025
|
[startPage, endPage]
|
|
6955
7026
|
);
|
|
6956
|
-
const handleClickMovePage = (0,
|
|
7027
|
+
const handleClickMovePage = (0, import_react13.useCallback)(
|
|
6957
7028
|
(page) => (event) => {
|
|
6958
7029
|
event.preventDefault();
|
|
6959
7030
|
handleChangePage == null ? void 0 : handleChangePage(page);
|
|
@@ -6970,8 +7041,8 @@ var usePagination = ({ currentPage, totalPage, groupSize, handleChangePage }) =>
|
|
|
6970
7041
|
var usePagination_default = usePagination;
|
|
6971
7042
|
|
|
6972
7043
|
// src/components/pagination/pagination.tsx
|
|
6973
|
-
var
|
|
6974
|
-
var Pagination = (0,
|
|
7044
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
7045
|
+
var Pagination = (0, import_react14.forwardRef)((originalProps, ref) => {
|
|
6975
7046
|
const [props, variantProps] = mapPropsVariants(originalProps, paginationStyle.variantKeys);
|
|
6976
7047
|
const {
|
|
6977
7048
|
classNames,
|
|
@@ -6985,8 +7056,8 @@ var Pagination = (0, import_react16.forwardRef)((originalProps, ref) => {
|
|
|
6985
7056
|
variant,
|
|
6986
7057
|
size
|
|
6987
7058
|
} = { ...props, ...variantProps };
|
|
6988
|
-
const [inputPage, setInputPage] = (0,
|
|
6989
|
-
const slots = (0,
|
|
7059
|
+
const [inputPage, setInputPage] = (0, import_react14.useState)(currentPage);
|
|
7060
|
+
const slots = (0, import_react14.useMemo)(() => paginationStyle(variantProps), [variantProps]);
|
|
6990
7061
|
const { pageList, handleClickMovePage } = usePagination_default({
|
|
6991
7062
|
currentPage,
|
|
6992
7063
|
totalPage,
|
|
@@ -7001,29 +7072,29 @@ var Pagination = (0, import_react16.forwardRef)((originalProps, ref) => {
|
|
|
7001
7072
|
}
|
|
7002
7073
|
}
|
|
7003
7074
|
};
|
|
7004
|
-
return /* @__PURE__ */ (0,
|
|
7005
|
-
/* @__PURE__ */ (0,
|
|
7006
|
-
showFirstLastButtons && /* @__PURE__ */ (0,
|
|
7075
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: slots.base({ class: classNames == null ? void 0 : classNames.base }), ref, children: [
|
|
7076
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: slots.wrapper({ class: classNames == null ? void 0 : classNames.wrapper }), children: [
|
|
7077
|
+
showFirstLastButtons && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
7007
7078
|
"div",
|
|
7008
7079
|
{
|
|
7009
7080
|
"aria-label": "firstPage",
|
|
7010
7081
|
"data-is-active": currentPage > 1,
|
|
7011
7082
|
className: slots.icon({ class: classNames == null ? void 0 : classNames.icon }),
|
|
7012
7083
|
onClick: currentPage > 1 ? handleClickMovePage(1) : void 0,
|
|
7013
|
-
children: /* @__PURE__ */ (0,
|
|
7084
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Icon_default, { name: "left-double-chevron" })
|
|
7014
7085
|
}
|
|
7015
7086
|
),
|
|
7016
|
-
/* @__PURE__ */ (0,
|
|
7087
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
7017
7088
|
"div",
|
|
7018
7089
|
{
|
|
7019
7090
|
"aria-label": "prevPage",
|
|
7020
7091
|
"data-is-active": currentPage > 1,
|
|
7021
7092
|
className: slots.icon({ class: classNames == null ? void 0 : classNames.icon }),
|
|
7022
7093
|
onClick: currentPage > 1 ? handleClickMovePage(currentPage - 1) : void 0,
|
|
7023
|
-
children: /* @__PURE__ */ (0,
|
|
7094
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Icon_default, { name: "left-chevron" })
|
|
7024
7095
|
}
|
|
7025
7096
|
),
|
|
7026
|
-
showPageNumber && pageList.map((page, index) => /* @__PURE__ */ (0,
|
|
7097
|
+
showPageNumber && pageList.map((page, index) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
7027
7098
|
"div",
|
|
7028
7099
|
{
|
|
7029
7100
|
className: slots.button({ class: classNames == null ? void 0 : classNames.button }),
|
|
@@ -7033,29 +7104,29 @@ var Pagination = (0, import_react16.forwardRef)((originalProps, ref) => {
|
|
|
7033
7104
|
},
|
|
7034
7105
|
index
|
|
7035
7106
|
)),
|
|
7036
|
-
/* @__PURE__ */ (0,
|
|
7107
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
7037
7108
|
"div",
|
|
7038
7109
|
{
|
|
7039
7110
|
"aria-label": "nextPage",
|
|
7040
7111
|
"data-is-active": currentPage < totalPage,
|
|
7041
7112
|
className: slots.icon({ class: classNames == null ? void 0 : classNames.icon }),
|
|
7042
7113
|
onClick: currentPage < totalPage ? handleClickMovePage(currentPage + 1) : void 0,
|
|
7043
|
-
children: /* @__PURE__ */ (0,
|
|
7114
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Icon_default, { name: "right-chevron" })
|
|
7044
7115
|
}
|
|
7045
7116
|
),
|
|
7046
|
-
showFirstLastButtons && /* @__PURE__ */ (0,
|
|
7117
|
+
showFirstLastButtons && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
7047
7118
|
"div",
|
|
7048
7119
|
{
|
|
7049
7120
|
"aria-label": "lastPage",
|
|
7050
7121
|
"data-is-active": currentPage < totalPage,
|
|
7051
7122
|
className: slots.icon({ class: classNames == null ? void 0 : classNames.icon }),
|
|
7052
7123
|
onClick: currentPage < totalPage ? handleClickMovePage(totalPage) : void 0,
|
|
7053
|
-
children: /* @__PURE__ */ (0,
|
|
7124
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Icon_default, { name: "right-double-chevron" })
|
|
7054
7125
|
}
|
|
7055
7126
|
)
|
|
7056
7127
|
] }),
|
|
7057
|
-
showPageLabel && /* @__PURE__ */ (0,
|
|
7058
|
-
/* @__PURE__ */ (0,
|
|
7128
|
+
showPageLabel && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("span", { className: slots.label({ class: classNames == null ? void 0 : classNames.label }), children: [
|
|
7129
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
7059
7130
|
input_default,
|
|
7060
7131
|
{
|
|
7061
7132
|
value: inputPage || 1,
|
|
@@ -7228,14 +7299,14 @@ var paginationStyle = tv(
|
|
|
7228
7299
|
);
|
|
7229
7300
|
|
|
7230
7301
|
// src/components/scroll/scrollArea.tsx
|
|
7231
|
-
var
|
|
7232
|
-
var
|
|
7302
|
+
var import_tailwind_variants15 = require("tailwind-variants");
|
|
7303
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
7233
7304
|
var ScrollArea = ({ children, className, direction, size }) => {
|
|
7234
|
-
return /* @__PURE__ */ (0,
|
|
7305
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: clsx(scrollAreaStyle({ direction, size }), className), children });
|
|
7235
7306
|
};
|
|
7236
7307
|
ScrollArea.displayName = "ScrollArea";
|
|
7237
7308
|
var scrollArea_default = ScrollArea;
|
|
7238
|
-
var scrollAreaStyle = (0,
|
|
7309
|
+
var scrollAreaStyle = (0, import_tailwind_variants15.tv)({
|
|
7239
7310
|
base: [
|
|
7240
7311
|
"h-full",
|
|
7241
7312
|
"x-full",
|
|
@@ -7264,95 +7335,105 @@ var scrollAreaStyle = (0, import_tailwind_variants14.tv)({
|
|
|
7264
7335
|
});
|
|
7265
7336
|
|
|
7266
7337
|
// src/components/table/table.tsx
|
|
7267
|
-
var
|
|
7268
|
-
var Table = (0,
|
|
7338
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
7339
|
+
var Table = (0, import_react15.forwardRef)((originalProps, ref) => {
|
|
7269
7340
|
const [props, variantProps] = mapPropsVariants(originalProps, tableStyle.variantKeys);
|
|
7270
7341
|
const {
|
|
7271
|
-
classNames,
|
|
7272
7342
|
rows,
|
|
7273
7343
|
columns,
|
|
7274
|
-
|
|
7275
|
-
rowCheckbox,
|
|
7344
|
+
rowCheckbox = false,
|
|
7276
7345
|
onRowClick,
|
|
7277
7346
|
totalData,
|
|
7278
7347
|
pagination,
|
|
7279
7348
|
onPageChange,
|
|
7280
7349
|
emptyContent,
|
|
7281
|
-
isLoading,
|
|
7282
|
-
|
|
7283
|
-
color
|
|
7350
|
+
isLoading = false,
|
|
7351
|
+
classNames,
|
|
7352
|
+
color,
|
|
7353
|
+
size,
|
|
7354
|
+
skeletonRow
|
|
7284
7355
|
} = { ...props, ...variantProps };
|
|
7285
|
-
const
|
|
7286
|
-
const divRef = (0, import_react17.useRef)(null);
|
|
7287
|
-
const { page, perPage } = pagination || { page: 1, perPage: 10 };
|
|
7356
|
+
const { page = 1, perPage = 10 } = pagination || {};
|
|
7288
7357
|
const showPagination = pagination && typeof totalData === "number" && !isLoading;
|
|
7289
|
-
(0,
|
|
7290
|
-
|
|
7291
|
-
|
|
7292
|
-
|
|
7293
|
-
|
|
7358
|
+
const [checkedRows, setCheckedRows] = (0, import_react15.useState)(/* @__PURE__ */ new Set());
|
|
7359
|
+
const divRef = (0, import_react15.useRef)(null);
|
|
7360
|
+
(0, import_react15.useImperativeHandle)(
|
|
7361
|
+
ref,
|
|
7362
|
+
() => ({
|
|
7363
|
+
checkedRows,
|
|
7364
|
+
setCheckedRows
|
|
7365
|
+
}),
|
|
7366
|
+
[checkedRows]
|
|
7367
|
+
);
|
|
7368
|
+
(0, import_react15.useEffect)(() => {
|
|
7294
7369
|
setCheckedRows(/* @__PURE__ */ new Set());
|
|
7295
7370
|
}, [rows]);
|
|
7296
|
-
const
|
|
7297
|
-
const
|
|
7298
|
-
setCheckedRows(
|
|
7371
|
+
const handleAllRowCheck = (checked) => {
|
|
7372
|
+
const updated = checked ? new Set(rows.map((_, i) => i)) : /* @__PURE__ */ new Set();
|
|
7373
|
+
setCheckedRows(updated);
|
|
7299
7374
|
};
|
|
7300
|
-
const
|
|
7301
|
-
|
|
7302
|
-
|
|
7303
|
-
|
|
7375
|
+
const handleRowCheck = (index, checked) => {
|
|
7376
|
+
setCheckedRows((prev) => {
|
|
7377
|
+
const updated = new Set(prev);
|
|
7378
|
+
checked ? updated.add(index) : updated.delete(index);
|
|
7379
|
+
return updated;
|
|
7380
|
+
});
|
|
7304
7381
|
};
|
|
7305
|
-
const slots = (0,
|
|
7306
|
-
return /* @__PURE__ */ (0,
|
|
7307
|
-
/* @__PURE__ */ (0,
|
|
7308
|
-
/* @__PURE__ */ (0,
|
|
7382
|
+
const slots = (0, import_react15.useMemo)(() => tableStyle(variantProps), [variantProps]);
|
|
7383
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { ref: divRef, "data-table": "base", className: slots.base({ class: classNames == null ? void 0 : classNames.base }), children: [
|
|
7384
|
+
/* @__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: [
|
|
7385
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
7309
7386
|
table_head_default,
|
|
7310
7387
|
{
|
|
7311
7388
|
columns,
|
|
7312
7389
|
size,
|
|
7390
|
+
color,
|
|
7313
7391
|
rowCheckbox,
|
|
7314
7392
|
isCheckedAll: checkedRows.size === rows.length && rows.length > 0,
|
|
7315
|
-
onCheckAll:
|
|
7393
|
+
onCheckAll: handleAllRowCheck,
|
|
7394
|
+
isLoading,
|
|
7316
7395
|
classNames,
|
|
7317
7396
|
slots
|
|
7318
7397
|
}
|
|
7319
7398
|
),
|
|
7320
|
-
/* @__PURE__ */ (0,
|
|
7399
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
7321
7400
|
table_body_default,
|
|
7322
7401
|
{
|
|
7323
7402
|
slots,
|
|
7324
7403
|
rows,
|
|
7325
7404
|
columns,
|
|
7326
7405
|
size,
|
|
7406
|
+
color,
|
|
7327
7407
|
rowCheckbox,
|
|
7328
7408
|
checkedRows,
|
|
7329
7409
|
onRowClick,
|
|
7330
|
-
onCheckRow:
|
|
7410
|
+
onCheckRow: handleRowCheck,
|
|
7331
7411
|
emptyContent,
|
|
7332
7412
|
isLoading,
|
|
7333
|
-
|
|
7413
|
+
skeletonRow,
|
|
7334
7414
|
className: clsx(
|
|
7335
7415
|
"transition-all duration-150 ease-out",
|
|
7336
|
-
isLoading ? "-translate-y-2 opacity-0" : "translate-y-0 opacity-100"
|
|
7416
|
+
isLoading ? "-translate-y-2 opacity-0" : "translate-y-0 opacity-100",
|
|
7417
|
+
classNames
|
|
7337
7418
|
)
|
|
7338
7419
|
}
|
|
7339
7420
|
)
|
|
7340
7421
|
] }) }),
|
|
7341
|
-
showPagination && /* @__PURE__ */ (0,
|
|
7422
|
+
showPagination && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "flex justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
7342
7423
|
pagination_default,
|
|
7343
7424
|
{
|
|
7344
7425
|
color,
|
|
7345
7426
|
currentPage: page,
|
|
7346
7427
|
totalPage: Math.ceil(totalData / perPage),
|
|
7347
7428
|
groupSize: 10,
|
|
7348
|
-
handleChangePage: (
|
|
7429
|
+
handleChangePage: (newPage) => onPageChange == null ? void 0 : onPageChange({ page: newPage, perPage })
|
|
7349
7430
|
}
|
|
7350
7431
|
) })
|
|
7351
7432
|
] });
|
|
7352
7433
|
});
|
|
7353
7434
|
Table.displayName = "Table";
|
|
7354
7435
|
var table_default = Table;
|
|
7355
|
-
var tableStyle = (0,
|
|
7436
|
+
var tableStyle = (0, import_tailwind_variants16.tv)({
|
|
7356
7437
|
slots: {
|
|
7357
7438
|
base: ["flex", "flex-col", "relative", "select-none", "gap-[20px]"],
|
|
7358
7439
|
table: ["w-full", "h-auto"],
|
|
@@ -7569,21 +7650,21 @@ var tableStyle = (0, import_tailwind_variants15.tv)({
|
|
|
7569
7650
|
});
|
|
7570
7651
|
|
|
7571
7652
|
// src/components/table/definition-table.tsx
|
|
7572
|
-
var
|
|
7573
|
-
var
|
|
7653
|
+
var import_react16 = require("react");
|
|
7654
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
7574
7655
|
var DEFAULT_COLUMN_CLASSES = [
|
|
7575
7656
|
"w-[120px] px-[10px] py-[9.5px] font-bold text-md text-body-foreground border-r border-neutral-light",
|
|
7576
7657
|
"px-[10px] py-[9.5px]"
|
|
7577
7658
|
];
|
|
7578
|
-
var DefinitionTableRow = ({ columns, columnClasses = [] }) => /* @__PURE__ */ (0,
|
|
7659
|
+
var DefinitionTableRow = ({ columns, columnClasses = [] }) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("tr", { className: "border-neutral-light min-h-[50px] border-b", children: columns.map((col, index) => {
|
|
7579
7660
|
var _a;
|
|
7580
|
-
return /* @__PURE__ */ (0,
|
|
7661
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("td", { className: (_a = columnClasses[index]) != null ? _a : DEFAULT_COLUMN_CLASSES[index], children: col }, index);
|
|
7581
7662
|
}) });
|
|
7582
|
-
var DefinitionTable = (0,
|
|
7583
|
-
const slots = (0,
|
|
7584
|
-
return /* @__PURE__ */ (0,
|
|
7585
|
-
/* @__PURE__ */ (0,
|
|
7586
|
-
footer && /* @__PURE__ */ (0,
|
|
7663
|
+
var DefinitionTable = (0, import_react16.forwardRef)(({ rows, footer, classNames }, ref) => {
|
|
7664
|
+
const slots = (0, import_react16.useMemo)(() => DefinitionTableStyle(), []);
|
|
7665
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { ref, className: slots.base({ class: classNames == null ? void 0 : classNames.base }), children: [
|
|
7666
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("table", { className: slots.table({ class: classNames == null ? void 0 : classNames.table }), children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("tbody", { children: rows.map((row, i) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(DefinitionTableRow, { ...row }, i)) }) }),
|
|
7667
|
+
footer && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { children: footer })
|
|
7587
7668
|
] });
|
|
7588
7669
|
});
|
|
7589
7670
|
DefinitionTable.displayName = "DefinitionTable";
|
|
@@ -7596,10 +7677,10 @@ var DefinitionTableStyle = tv({
|
|
|
7596
7677
|
});
|
|
7597
7678
|
|
|
7598
7679
|
// src/components/select/select.tsx
|
|
7599
|
-
var
|
|
7680
|
+
var import_react17 = require("react");
|
|
7600
7681
|
var import_react_dom = require("react-dom");
|
|
7601
|
-
var
|
|
7602
|
-
var Select = (0,
|
|
7682
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
7683
|
+
var Select = (0, import_react17.forwardRef)((originalProps, ref) => {
|
|
7603
7684
|
var _a;
|
|
7604
7685
|
const [props, variantProps] = mapPropsVariants(originalProps, select.variantKeys);
|
|
7605
7686
|
const {
|
|
@@ -7613,14 +7694,14 @@ var Select = (0, import_react19.forwardRef)((originalProps, ref) => {
|
|
|
7613
7694
|
multiple,
|
|
7614
7695
|
...inputProps
|
|
7615
7696
|
} = props;
|
|
7616
|
-
const slots = (0,
|
|
7617
|
-
const [selectedOptions, setSelectedOptions] = (0,
|
|
7618
|
-
const [targetRect, setTargetRect] = (0,
|
|
7619
|
-
const [optionWrapperHeight, setOptionWrapperHeight] = (0,
|
|
7620
|
-
const [isVisible, setIsVisible] = (0,
|
|
7621
|
-
const [isOpen, setIsOpen] = (0,
|
|
7622
|
-
const selectWrapperRef = (0,
|
|
7623
|
-
const optionWrapperRef = (0,
|
|
7697
|
+
const slots = (0, import_react17.useMemo)(() => select({ ...variantProps }), [variantProps]);
|
|
7698
|
+
const [selectedOptions, setSelectedOptions] = (0, import_react17.useState)(defaultSelectedOptions);
|
|
7699
|
+
const [targetRect, setTargetRect] = (0, import_react17.useState)(null);
|
|
7700
|
+
const [optionWrapperHeight, setOptionWrapperHeight] = (0, import_react17.useState)(0);
|
|
7701
|
+
const [isVisible, setIsVisible] = (0, import_react17.useState)(false);
|
|
7702
|
+
const [isOpen, setIsOpen] = (0, import_react17.useState)(false);
|
|
7703
|
+
const selectWrapperRef = (0, import_react17.useRef)(null);
|
|
7704
|
+
const optionWrapperRef = (0, import_react17.useRef)(null);
|
|
7624
7705
|
const handleToggleSelect = () => {
|
|
7625
7706
|
if (isOpen) {
|
|
7626
7707
|
setIsOpen(false);
|
|
@@ -7658,7 +7739,7 @@ var Select = (0, import_react19.forwardRef)((originalProps, ref) => {
|
|
|
7658
7739
|
setSelectedOptions(nextOptions);
|
|
7659
7740
|
onChange == null ? void 0 : onChange(nextOptions);
|
|
7660
7741
|
};
|
|
7661
|
-
(0,
|
|
7742
|
+
(0, import_react17.useEffect)(() => {
|
|
7662
7743
|
const handleClickOutside = (e) => {
|
|
7663
7744
|
var _a2;
|
|
7664
7745
|
if (optionWrapperRef.current && !optionWrapperRef.current.contains(e.target) && !((_a2 = selectWrapperRef.current) == null ? void 0 : _a2.contains(e.target))) {
|
|
@@ -7669,7 +7750,7 @@ var Select = (0, import_react19.forwardRef)((originalProps, ref) => {
|
|
|
7669
7750
|
window.addEventListener("mousedown", handleClickOutside);
|
|
7670
7751
|
return () => window.removeEventListener("mousedown", handleClickOutside);
|
|
7671
7752
|
}, []);
|
|
7672
|
-
(0,
|
|
7753
|
+
(0, import_react17.useEffect)(() => {
|
|
7673
7754
|
if (optionWrapperRef.current) {
|
|
7674
7755
|
setOptionWrapperHeight(optionWrapperRef.current.getBoundingClientRect().height);
|
|
7675
7756
|
}
|
|
@@ -7682,13 +7763,13 @@ var Select = (0, import_react19.forwardRef)((originalProps, ref) => {
|
|
|
7682
7763
|
onClick
|
|
7683
7764
|
}) => {
|
|
7684
7765
|
const slot = select({ ...variantProps, isSelected });
|
|
7685
|
-
return /* @__PURE__ */ (0,
|
|
7766
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { title: option.value, onClick, className: clsx(slot.option({ class: classNames == null ? void 0 : classNames.option })), children: [
|
|
7686
7767
|
option.value,
|
|
7687
|
-
isSelected && /* @__PURE__ */ (0,
|
|
7768
|
+
isSelected && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Icon_default, { name: "check", size: originalProps.size })
|
|
7688
7769
|
] });
|
|
7689
7770
|
};
|
|
7690
|
-
return /* @__PURE__ */ (0,
|
|
7691
|
-
/* @__PURE__ */ (0,
|
|
7771
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_jsx_runtime22.Fragment, { children: [
|
|
7772
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
7692
7773
|
"div",
|
|
7693
7774
|
{
|
|
7694
7775
|
className: clsx(
|
|
@@ -7696,9 +7777,9 @@ var Select = (0, import_react19.forwardRef)((originalProps, ref) => {
|
|
|
7696
7777
|
variantProps.direction === "horizon" ? slots.horizon({ class: classNames == null ? void 0 : classNames.horizon }) : slots.vertical({ class: classNames == null ? void 0 : classNames.vertical })
|
|
7697
7778
|
),
|
|
7698
7779
|
children: [
|
|
7699
|
-
label && /* @__PURE__ */ (0,
|
|
7700
|
-
/* @__PURE__ */ (0,
|
|
7701
|
-
/* @__PURE__ */ (0,
|
|
7780
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("label", { className: slots.label({ class: classNames == null ? void 0 : classNames.label }), children: label }),
|
|
7781
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: slots.wrapper({ class: classNames == null ? void 0 : classNames.wrapper }), children: [
|
|
7782
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
7702
7783
|
"div",
|
|
7703
7784
|
{
|
|
7704
7785
|
"data-expanded": isOpen,
|
|
@@ -7709,7 +7790,7 @@ var Select = (0, import_react19.forwardRef)((originalProps, ref) => {
|
|
|
7709
7790
|
ref: selectWrapperRef,
|
|
7710
7791
|
onClick: handleToggleSelect,
|
|
7711
7792
|
children: [
|
|
7712
|
-
/* @__PURE__ */ (0,
|
|
7793
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
7713
7794
|
"input",
|
|
7714
7795
|
{
|
|
7715
7796
|
...inputProps,
|
|
@@ -7723,7 +7804,7 @@ var Select = (0, import_react19.forwardRef)((originalProps, ref) => {
|
|
|
7723
7804
|
size: 0
|
|
7724
7805
|
}
|
|
7725
7806
|
),
|
|
7726
|
-
/* @__PURE__ */ (0,
|
|
7807
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
7727
7808
|
Icon_default,
|
|
7728
7809
|
{
|
|
7729
7810
|
name: "brace-up",
|
|
@@ -7734,14 +7815,14 @@ var Select = (0, import_react19.forwardRef)((originalProps, ref) => {
|
|
|
7734
7815
|
]
|
|
7735
7816
|
}
|
|
7736
7817
|
),
|
|
7737
|
-
helperMessage && !errorMessage && /* @__PURE__ */ (0,
|
|
7738
|
-
errorMessage && /* @__PURE__ */ (0,
|
|
7818
|
+
helperMessage && !errorMessage && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("p", { className: slots.helperMessage({ class: classNames == null ? void 0 : classNames.helperMessage }), children: helperMessage }),
|
|
7819
|
+
errorMessage && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("p", { className: clsx("error", slots.errorMessage({ class: classNames == null ? void 0 : classNames.errorMessage })), children: errorMessage })
|
|
7739
7820
|
] })
|
|
7740
7821
|
]
|
|
7741
7822
|
}
|
|
7742
7823
|
),
|
|
7743
7824
|
isVisible && (0, import_react_dom.createPortal)(
|
|
7744
|
-
/* @__PURE__ */ (0,
|
|
7825
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
7745
7826
|
"div",
|
|
7746
7827
|
{
|
|
7747
7828
|
ref: optionWrapperRef,
|
|
@@ -7758,7 +7839,7 @@ var Select = (0, import_react19.forwardRef)((originalProps, ref) => {
|
|
|
7758
7839
|
},
|
|
7759
7840
|
children: options.map((option) => {
|
|
7760
7841
|
const isSelected = selectedOptions.some((o) => o.key === option.key);
|
|
7761
|
-
return /* @__PURE__ */ (0,
|
|
7842
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
7762
7843
|
Option,
|
|
7763
7844
|
{
|
|
7764
7845
|
option,
|
|
@@ -7927,16 +8008,16 @@ var select = tv({
|
|
|
7927
8008
|
});
|
|
7928
8009
|
|
|
7929
8010
|
// src/components/chip/chip.tsx
|
|
7930
|
-
var
|
|
7931
|
-
var
|
|
7932
|
-
var Chip = (0,
|
|
8011
|
+
var import_react18 = require("react");
|
|
8012
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
8013
|
+
var Chip = (0, import_react18.forwardRef)((originalProps, ref) => {
|
|
7933
8014
|
var _a;
|
|
7934
8015
|
const [rawProps, variantProps] = mapPropsVariants(originalProps, chipStyle.variantKeys);
|
|
7935
8016
|
const props = { ...rawProps, ...variantProps };
|
|
7936
8017
|
const Component = props.onClick ? "button" : "div";
|
|
7937
|
-
const slots = (0,
|
|
7938
|
-
const renderIcon = (name) => name ? /* @__PURE__ */ (0,
|
|
7939
|
-
return /* @__PURE__ */ (0,
|
|
8018
|
+
const slots = (0, import_react18.useMemo)(() => chipStyle({ ...variantProps }), [variantProps]);
|
|
8019
|
+
const renderIcon = (name) => name ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Icon_default, { name, fill: true, size: props.size, className: slots.icon() }) : null;
|
|
8020
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
7940
8021
|
Component,
|
|
7941
8022
|
{
|
|
7942
8023
|
ref,
|
|
@@ -8112,13 +8193,13 @@ var chipStyle = tv({
|
|
|
8112
8193
|
});
|
|
8113
8194
|
|
|
8114
8195
|
// src/components/radio/radio.tsx
|
|
8115
|
-
var
|
|
8116
|
-
var
|
|
8117
|
-
var Radio = (0,
|
|
8196
|
+
var import_react19 = require("react");
|
|
8197
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
8198
|
+
var Radio = (0, import_react19.forwardRef)((originalProps, ref) => {
|
|
8118
8199
|
const [props, variantProps] = mapPropsVariants(originalProps, radioStyle.variantKeys);
|
|
8119
8200
|
const { children, classNames, labelPosition = "end", ...inputProps } = props;
|
|
8120
|
-
const slots = (0,
|
|
8121
|
-
return /* @__PURE__ */ (0,
|
|
8201
|
+
const slots = (0, import_react19.useMemo)(() => radioStyle({ ...variantProps }), [variantProps]);
|
|
8202
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
8122
8203
|
"label",
|
|
8123
8204
|
{
|
|
8124
8205
|
className: clsx(
|
|
@@ -8126,9 +8207,9 @@ var Radio = (0, import_react21.forwardRef)((originalProps, ref) => {
|
|
|
8126
8207
|
labelPosition === "start" && slots.labelReverse({ class: classNames == null ? void 0 : classNames.labelReverse })
|
|
8127
8208
|
),
|
|
8128
8209
|
children: [
|
|
8129
|
-
/* @__PURE__ */ (0,
|
|
8130
|
-
/* @__PURE__ */ (0,
|
|
8131
|
-
/* @__PURE__ */ (0,
|
|
8210
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "hidden", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("input", { ...inputProps, type: "radio", ref }) }),
|
|
8211
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: slots.outerDot({ class: classNames == null ? void 0 : classNames.outerDot }), children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: slots.innerDot({ class: classNames == null ? void 0 : classNames.innerDot }) }) }),
|
|
8212
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: slots.labelWrapper({ class: classNames == null ? void 0 : classNames.labelWrapper }), children: children && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: slots.label({ class: classNames == null ? void 0 : classNames.label }), children }) })
|
|
8132
8213
|
]
|
|
8133
8214
|
}
|
|
8134
8215
|
);
|
|
@@ -8268,21 +8349,21 @@ var radioStyle = tv({
|
|
|
8268
8349
|
});
|
|
8269
8350
|
|
|
8270
8351
|
// src/components/switch/switch.tsx
|
|
8271
|
-
var
|
|
8272
|
-
var
|
|
8273
|
-
var
|
|
8274
|
-
var Switch = (0,
|
|
8352
|
+
var import_react20 = require("react");
|
|
8353
|
+
var import_tailwind_variants21 = require("tailwind-variants");
|
|
8354
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
8355
|
+
var Switch = (0, import_react20.forwardRef)((originalProps, ref) => {
|
|
8275
8356
|
const [rawProps, variantProps] = mapPropsVariants(originalProps, switchStyle.variantKeys);
|
|
8276
8357
|
const { size, color, isDisabled, disableAnimation, id, classNames, ...inputProps } = { ...rawProps, ...variantProps };
|
|
8277
|
-
const slots = (0,
|
|
8278
|
-
return /* @__PURE__ */ (0,
|
|
8279
|
-
/* @__PURE__ */ (0,
|
|
8280
|
-
/* @__PURE__ */ (0,
|
|
8358
|
+
const slots = (0, import_react20.useMemo)(() => switchStyle({ ...variantProps }), [variantProps]);
|
|
8359
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { className: slots.base({ class: classNames == null ? void 0 : classNames.base }), children: [
|
|
8360
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("input", { ...inputProps, id, ref, type: "checkbox", disabled: isDisabled, className: "hidden" }),
|
|
8361
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: slots.outerWrapper({ class: classNames == null ? void 0 : classNames.outerWrapper }), children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: slots.wrapper({ class: classNames == null ? void 0 : classNames.wrapper }), children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: slots.thumb({ class: classNames == null ? void 0 : classNames.thumb }) }) }) })
|
|
8281
8362
|
] });
|
|
8282
8363
|
});
|
|
8283
8364
|
Switch.displayName = "Switch";
|
|
8284
8365
|
var switch_default = Switch;
|
|
8285
|
-
var switchStyle = (0,
|
|
8366
|
+
var switchStyle = (0, import_tailwind_variants21.tv)({
|
|
8286
8367
|
slots: {
|
|
8287
8368
|
base: ["group/switch", "relative", "max-w-fit", "inline-flex", "items-center", "justify-start", "cursor-pointer"],
|
|
8288
8369
|
outerWrapper: [
|
|
@@ -8387,7 +8468,7 @@ var switchStyle = (0, import_tailwind_variants20.tv)({
|
|
|
8387
8468
|
});
|
|
8388
8469
|
|
|
8389
8470
|
// src/components/tooltip/tooltip.tsx
|
|
8390
|
-
var
|
|
8471
|
+
var import_react22 = require("react");
|
|
8391
8472
|
var import_react_dom2 = require("react-dom");
|
|
8392
8473
|
|
|
8393
8474
|
// src/components/tooltip/tooltip-utils.ts
|
|
@@ -8510,11 +8591,11 @@ var getTailStyles = (placement) => {
|
|
|
8510
8591
|
};
|
|
8511
8592
|
|
|
8512
8593
|
// src/components/tooltip/useTooltip.ts
|
|
8513
|
-
var
|
|
8594
|
+
var import_react21 = require("react");
|
|
8514
8595
|
var useTooltip = ({ placement, offset, targetRect }) => {
|
|
8515
|
-
const [tooltipPosition, setTooltipPosition] = (0,
|
|
8516
|
-
const tooltipRef = (0,
|
|
8517
|
-
(0,
|
|
8596
|
+
const [tooltipPosition, setTooltipPosition] = (0, import_react21.useState)({ x: 0, y: 0 });
|
|
8597
|
+
const tooltipRef = (0, import_react21.useRef)(null);
|
|
8598
|
+
(0, import_react21.useEffect)(() => {
|
|
8518
8599
|
if (targetRect && tooltipRef.current) {
|
|
8519
8600
|
const { width, height } = tooltipRef.current.getBoundingClientRect();
|
|
8520
8601
|
const scrollX = window.scrollX;
|
|
@@ -8544,29 +8625,29 @@ var useTooltip = ({ placement, offset, targetRect }) => {
|
|
|
8544
8625
|
};
|
|
8545
8626
|
|
|
8546
8627
|
// src/components/tooltip/tooltip.tsx
|
|
8547
|
-
var
|
|
8548
|
-
var Tooltip = (0,
|
|
8628
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
8629
|
+
var Tooltip = (0, import_react22.forwardRef)((originalProps, ref) => {
|
|
8549
8630
|
const [props, variantProps] = mapPropsVariants(originalProps, tooltipStyle.variantKeys);
|
|
8550
8631
|
const { placement = "top", offset = 5, delay = 100, persistent = false, classNames } = props;
|
|
8551
|
-
const slots = (0,
|
|
8552
|
-
const [targetRect, setTargetRect] = (0,
|
|
8632
|
+
const slots = (0, import_react22.useMemo)(() => tooltipStyle({ ...variantProps }), [variantProps]);
|
|
8633
|
+
const [targetRect, setTargetRect] = (0, import_react22.useState)(null);
|
|
8553
8634
|
const { tooltipPosition, tooltipRef } = useTooltip({
|
|
8554
8635
|
placement,
|
|
8555
8636
|
offset,
|
|
8556
8637
|
delay,
|
|
8557
8638
|
targetRect
|
|
8558
8639
|
});
|
|
8559
|
-
const childrenRef = (0,
|
|
8560
|
-
const delayTimeoutRef = (0,
|
|
8561
|
-
const getProps = (0,
|
|
8640
|
+
const childrenRef = (0, import_react22.useRef)(null);
|
|
8641
|
+
const delayTimeoutRef = (0, import_react22.useRef)(null);
|
|
8642
|
+
const getProps = (0, import_react22.useCallback)(
|
|
8562
8643
|
(slotKey, classNameKey) => ({
|
|
8563
8644
|
className: slots[slotKey]({ class: classNames == null ? void 0 : classNames[classNameKey] })
|
|
8564
8645
|
}),
|
|
8565
8646
|
[slots, classNames]
|
|
8566
8647
|
);
|
|
8567
|
-
const getBaseProps = (0,
|
|
8568
|
-
const getContentProps = (0,
|
|
8569
|
-
const showTooltip = (0,
|
|
8648
|
+
const getBaseProps = (0, import_react22.useCallback)(() => getProps("base", "base"), [getProps]);
|
|
8649
|
+
const getContentProps = (0, import_react22.useCallback)(() => getProps("content", "content"), [getProps]);
|
|
8650
|
+
const showTooltip = (0, import_react22.useCallback)(() => {
|
|
8570
8651
|
if (childrenRef.current) {
|
|
8571
8652
|
const rect = childrenRef.current.getBoundingClientRect();
|
|
8572
8653
|
setTargetRect({
|
|
@@ -8579,16 +8660,16 @@ var Tooltip = (0, import_react24.forwardRef)((originalProps, ref) => {
|
|
|
8579
8660
|
});
|
|
8580
8661
|
}
|
|
8581
8662
|
}, []);
|
|
8582
|
-
const hideTooltip = (0,
|
|
8663
|
+
const hideTooltip = (0, import_react22.useCallback)(() => {
|
|
8583
8664
|
if (!persistent) {
|
|
8584
8665
|
delayTimeoutRef.current = window.setTimeout(() => setTargetRect(null), delay);
|
|
8585
8666
|
}
|
|
8586
8667
|
}, [persistent, delay]);
|
|
8587
|
-
(0,
|
|
8668
|
+
(0, import_react22.useEffect)(() => {
|
|
8588
8669
|
if (persistent) showTooltip();
|
|
8589
8670
|
}, [persistent, showTooltip]);
|
|
8590
|
-
return /* @__PURE__ */ (0,
|
|
8591
|
-
/* @__PURE__ */ (0,
|
|
8671
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_jsx_runtime26.Fragment, { children: [
|
|
8672
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
8592
8673
|
"div",
|
|
8593
8674
|
{
|
|
8594
8675
|
ref: (node) => {
|
|
@@ -8605,7 +8686,7 @@ var Tooltip = (0, import_react24.forwardRef)((originalProps, ref) => {
|
|
|
8605
8686
|
}
|
|
8606
8687
|
),
|
|
8607
8688
|
targetRect && (0, import_react_dom2.createPortal)(
|
|
8608
|
-
/* @__PURE__ */ (0,
|
|
8689
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
8609
8690
|
"div",
|
|
8610
8691
|
{
|
|
8611
8692
|
ref: tooltipRef,
|
|
@@ -8618,7 +8699,7 @@ var Tooltip = (0, import_react24.forwardRef)((originalProps, ref) => {
|
|
|
8618
8699
|
},
|
|
8619
8700
|
children: [
|
|
8620
8701
|
props.content,
|
|
8621
|
-
variantProps.tail && /* @__PURE__ */ (0,
|
|
8702
|
+
variantProps.tail && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
8622
8703
|
"div",
|
|
8623
8704
|
{
|
|
8624
8705
|
className: `absolute h-2 w-2 rotate-45 bg-inherit ${getTailClassName(placement)}`,
|
|
@@ -8669,10 +8750,10 @@ var tooltipStyle = tv({
|
|
|
8669
8750
|
});
|
|
8670
8751
|
|
|
8671
8752
|
// src/components/modal/modal.tsx
|
|
8672
|
-
var
|
|
8753
|
+
var import_react23 = require("react");
|
|
8673
8754
|
var import_react_dom3 = require("react-dom");
|
|
8674
|
-
var
|
|
8675
|
-
var Modal = (0,
|
|
8755
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
8756
|
+
var Modal = (0, import_react23.forwardRef)((props, ref) => {
|
|
8676
8757
|
const [localProps, variantProps] = mapPropsVariants(props, modal.variantKeys);
|
|
8677
8758
|
const {
|
|
8678
8759
|
classNames,
|
|
@@ -8686,8 +8767,8 @@ var Modal = (0, import_react25.forwardRef)((props, ref) => {
|
|
|
8686
8767
|
onConfirm,
|
|
8687
8768
|
onCancel
|
|
8688
8769
|
} = localProps;
|
|
8689
|
-
const slots = (0,
|
|
8690
|
-
(0,
|
|
8770
|
+
const slots = (0, import_react23.useMemo)(() => modal(variantProps), [variantProps]);
|
|
8771
|
+
(0, import_react23.useEffect)(() => {
|
|
8691
8772
|
document.body.classList.toggle("overflow-hidden", !!isOpen);
|
|
8692
8773
|
if (!isOpen || isKeyboardDismissDisabled) return;
|
|
8693
8774
|
const handleKeyDown = (e) => {
|
|
@@ -8701,10 +8782,10 @@ var Modal = (0, import_react25.forwardRef)((props, ref) => {
|
|
|
8701
8782
|
}, [isOpen, isKeyboardDismissDisabled, onCancel]);
|
|
8702
8783
|
if (!isOpen) return null;
|
|
8703
8784
|
return (0, import_react_dom3.createPortal)(
|
|
8704
|
-
/* @__PURE__ */ (0,
|
|
8705
|
-
/* @__PURE__ */ (0,
|
|
8706
|
-
/* @__PURE__ */ (0,
|
|
8707
|
-
showCloseButton && /* @__PURE__ */ (0,
|
|
8785
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_jsx_runtime27.Fragment, { children: [
|
|
8786
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(backdrop_default, { open: true }),
|
|
8787
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { ref, className: slots.base({ class: classNames == null ? void 0 : classNames.base }), children: /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: slots.modalWrapper({ class: classNames == null ? void 0 : classNames.modalWrapper }), children: [
|
|
8788
|
+
showCloseButton && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
8708
8789
|
Icon_default,
|
|
8709
8790
|
{
|
|
8710
8791
|
size: "xl",
|
|
@@ -8713,12 +8794,12 @@ var Modal = (0, import_react25.forwardRef)((props, ref) => {
|
|
|
8713
8794
|
onClick: onCancel
|
|
8714
8795
|
}
|
|
8715
8796
|
),
|
|
8716
|
-
/* @__PURE__ */ (0,
|
|
8717
|
-
title && /* @__PURE__ */ (0,
|
|
8718
|
-
typeof content === "string" ? /* @__PURE__ */ (0,
|
|
8719
|
-
(cancelButtonText || confirmButtonText) && /* @__PURE__ */ (0,
|
|
8720
|
-
cancelButtonText && /* @__PURE__ */ (0,
|
|
8721
|
-
confirmButtonText && /* @__PURE__ */ (0,
|
|
8797
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: slots.wrapper({ class: classNames == null ? void 0 : classNames.wrapper }), children: [
|
|
8798
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: slots.title({ class: classNames == null ? void 0 : classNames.title }), children: title }),
|
|
8799
|
+
typeof content === "string" ? /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: slots.content({ class: classNames == null ? void 0 : classNames.content }), children: content }) : content,
|
|
8800
|
+
(cancelButtonText || confirmButtonText) && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: slots.footer({ class: classNames == null ? void 0 : classNames.footer }), children: [
|
|
8801
|
+
cancelButtonText && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(button_default, { variant: "soft", color: "neutral", fullWidth: true, onClick: onCancel, children: cancelButtonText }),
|
|
8802
|
+
confirmButtonText && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(button_default, { color: props.color, fullWidth: true, onClick: onConfirm, children: confirmButtonText })
|
|
8722
8803
|
] })
|
|
8723
8804
|
] })
|
|
8724
8805
|
] }) })
|
|
@@ -8784,15 +8865,15 @@ var modal = tv({
|
|
|
8784
8865
|
});
|
|
8785
8866
|
|
|
8786
8867
|
// src/components/list/list.tsx
|
|
8787
|
-
var
|
|
8788
|
-
var
|
|
8789
|
-
var List = (0,
|
|
8868
|
+
var import_react24 = require("react");
|
|
8869
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
8870
|
+
var List = (0, import_react24.forwardRef)((originalProps, ref) => {
|
|
8790
8871
|
const [props, variantProps] = mapPropsVariants(originalProps, listStyle.variantKeys);
|
|
8791
8872
|
const { children, classNames } = props;
|
|
8792
|
-
const slots = (0,
|
|
8793
|
-
return /* @__PURE__ */ (0,
|
|
8794
|
-
if (!(0,
|
|
8795
|
-
return (0,
|
|
8873
|
+
const slots = (0, import_react24.useMemo)(() => listStyle(variantProps), [variantProps]);
|
|
8874
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { ref, className: slots.base({ class: classNames == null ? void 0 : classNames.base }), children: import_react24.Children.map(children, (child) => {
|
|
8875
|
+
if (!(0, import_react24.isValidElement)(child)) return child;
|
|
8876
|
+
return (0, import_react24.cloneElement)(child, {
|
|
8796
8877
|
...variantProps,
|
|
8797
8878
|
...child.props
|
|
8798
8879
|
});
|
|
@@ -8829,9 +8910,9 @@ var listStyle = tv({
|
|
|
8829
8910
|
});
|
|
8830
8911
|
|
|
8831
8912
|
// src/components/list/listItem.tsx
|
|
8832
|
-
var
|
|
8833
|
-
var
|
|
8834
|
-
var ListItem = (0,
|
|
8913
|
+
var import_react25 = require("react");
|
|
8914
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
8915
|
+
var ListItem = (0, import_react25.forwardRef)((props, ref) => {
|
|
8835
8916
|
const [rawProps, variantProps] = mapPropsVariants(props, listItemStyle.variantKeys);
|
|
8836
8917
|
const {
|
|
8837
8918
|
title,
|
|
@@ -8843,19 +8924,19 @@ var ListItem = (0, import_react27.forwardRef)((props, ref) => {
|
|
|
8843
8924
|
classNames,
|
|
8844
8925
|
onClick
|
|
8845
8926
|
} = { ...rawProps, ...variantProps };
|
|
8846
|
-
const slots = (0,
|
|
8927
|
+
const slots = (0, import_react25.useMemo)(() => listItemStyle(variantProps), [variantProps]);
|
|
8847
8928
|
const iconSize = ["lg", "xl"].includes(size) ? "lg" : "md";
|
|
8848
8929
|
const avatarSize = iconSize;
|
|
8849
|
-
return /* @__PURE__ */ (0,
|
|
8850
|
-
/* @__PURE__ */ (0,
|
|
8851
|
-
avatar && /* @__PURE__ */ (0,
|
|
8852
|
-
startIconName && /* @__PURE__ */ (0,
|
|
8853
|
-
/* @__PURE__ */ (0,
|
|
8854
|
-
/* @__PURE__ */ (0,
|
|
8855
|
-
subTitle && /* @__PURE__ */ (0,
|
|
8930
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { ref, className: slots.base({ class: classNames == null ? void 0 : classNames.base }), "data-selected": selected, onClick, children: [
|
|
8931
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: slots.wrapper({ class: classNames == null ? void 0 : classNames.wrapper }), children: [
|
|
8932
|
+
avatar && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(avatar_default, { ...avatar, variant: "round", size: avatarSize }),
|
|
8933
|
+
startIconName && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Icon_default, { name: startIconName, fill: true, size, className: slots.startIcon({ class: classNames == null ? void 0 : classNames.startIcon }) }),
|
|
8934
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: slots.titleWrapper({ class: classNames == null ? void 0 : classNames.titleWrapper }), children: [
|
|
8935
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: slots.title({ class: classNames == null ? void 0 : classNames.title }), children: title }),
|
|
8936
|
+
subTitle && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: slots.subTitle({ class: classNames == null ? void 0 : classNames.subTitle }), children: subTitle })
|
|
8856
8937
|
] })
|
|
8857
8938
|
] }),
|
|
8858
|
-
/* @__PURE__ */ (0,
|
|
8939
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Icon_default, { name: "right-chevron", size: iconSize, className: slots.icon({ class: classNames == null ? void 0 : classNames.icon }) })
|
|
8859
8940
|
] });
|
|
8860
8941
|
});
|
|
8861
8942
|
ListItem.displayName = "ListItem";
|
|
@@ -9023,9 +9104,9 @@ var listItemStyle = tv({
|
|
|
9023
9104
|
});
|
|
9024
9105
|
|
|
9025
9106
|
// src/components/toast/toast.tsx
|
|
9026
|
-
var
|
|
9027
|
-
var
|
|
9028
|
-
var Toast = (0,
|
|
9107
|
+
var import_react26 = require("react");
|
|
9108
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
9109
|
+
var Toast = (0, import_react26.forwardRef)((originalProps, ref) => {
|
|
9029
9110
|
const [props, variantProps] = mapPropsVariants(originalProps, toast.variantKeys);
|
|
9030
9111
|
const {
|
|
9031
9112
|
title,
|
|
@@ -9039,9 +9120,9 @@ var Toast = (0, import_react28.forwardRef)((originalProps, ref) => {
|
|
|
9039
9120
|
disableAnimation,
|
|
9040
9121
|
onClose
|
|
9041
9122
|
} = { ...props, ...variantProps };
|
|
9042
|
-
const slots = (0,
|
|
9043
|
-
const toastRef = (0,
|
|
9044
|
-
(0,
|
|
9123
|
+
const slots = (0, import_react26.useMemo)(() => toast({ ...variantProps }), [variantProps]);
|
|
9124
|
+
const toastRef = (0, import_react26.useRef)(null);
|
|
9125
|
+
(0, import_react26.useImperativeHandle)(
|
|
9045
9126
|
ref,
|
|
9046
9127
|
() => ({
|
|
9047
9128
|
getWidth: () => {
|
|
@@ -9052,7 +9133,7 @@ var Toast = (0, import_react28.forwardRef)((originalProps, ref) => {
|
|
|
9052
9133
|
[]
|
|
9053
9134
|
);
|
|
9054
9135
|
const animationClass = (placement == null ? void 0 : placement.includes("top")) ? "animate-slideInFromTop" : "animate-slideInFromBottom";
|
|
9055
|
-
return /* @__PURE__ */ (0,
|
|
9136
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
|
|
9056
9137
|
"div",
|
|
9057
9138
|
{
|
|
9058
9139
|
ref: toastRef,
|
|
@@ -9064,12 +9145,12 @@ var Toast = (0, import_react28.forwardRef)((originalProps, ref) => {
|
|
|
9064
9145
|
),
|
|
9065
9146
|
style: hasShadow ? { boxShadow: "0px 6px 18px rgba(0, 0, 0, 0.10)" } : {},
|
|
9066
9147
|
children: [
|
|
9067
|
-
/* @__PURE__ */ (0,
|
|
9068
|
-
showIcon && /* @__PURE__ */ (0,
|
|
9069
|
-
/* @__PURE__ */ (0,
|
|
9070
|
-
showCloseButton && /* @__PURE__ */ (0,
|
|
9148
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: slots.wrapper({ class: classNames == null ? void 0 : classNames.wrapper }), children: [
|
|
9149
|
+
showIcon && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Icon_default, { name: originalProps.icon || "info-circle", fill: true, className: "mt-[2px]" }),
|
|
9150
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: slots.title({ class: classNames == null ? void 0 : classNames.title }), children: title }),
|
|
9151
|
+
showCloseButton && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Icon_default, { name: "close", className: "cursor-pointer", onClick: onClose })
|
|
9071
9152
|
] }),
|
|
9072
|
-
content && /* @__PURE__ */ (0,
|
|
9153
|
+
content && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { children: content })
|
|
9073
9154
|
]
|
|
9074
9155
|
}
|
|
9075
9156
|
);
|
|
@@ -9174,7 +9255,7 @@ var toast = tv({
|
|
|
9174
9255
|
});
|
|
9175
9256
|
|
|
9176
9257
|
// src/components/toast/use-toast.tsx
|
|
9177
|
-
var
|
|
9258
|
+
var import_react27 = require("react");
|
|
9178
9259
|
|
|
9179
9260
|
// src/components/toast/toast-utils.ts
|
|
9180
9261
|
var getToastPosition = (placement, width, offset) => {
|
|
@@ -9213,10 +9294,10 @@ var getToastPosition = (placement, width, offset) => {
|
|
|
9213
9294
|
};
|
|
9214
9295
|
|
|
9215
9296
|
// src/components/toast/use-toast.tsx
|
|
9216
|
-
var
|
|
9217
|
-
var ToastContext = (0,
|
|
9297
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
9298
|
+
var ToastContext = (0, import_react27.createContext)(null);
|
|
9218
9299
|
var useToast = () => {
|
|
9219
|
-
const context = (0,
|
|
9300
|
+
const context = (0, import_react27.useContext)(ToastContext);
|
|
9220
9301
|
if (!context) {
|
|
9221
9302
|
throw new Error("useToast must be used within a ToastProvider");
|
|
9222
9303
|
}
|
|
@@ -9226,10 +9307,10 @@ var ToastProvider = ({
|
|
|
9226
9307
|
globalOptions,
|
|
9227
9308
|
children
|
|
9228
9309
|
}) => {
|
|
9229
|
-
const [toasts, setToasts] = (0,
|
|
9230
|
-
const [containerStyle, setContainerStyle] = (0,
|
|
9231
|
-
const toastRef = (0,
|
|
9232
|
-
const addToast = (0,
|
|
9310
|
+
const [toasts, setToasts] = (0, import_react27.useState)([]);
|
|
9311
|
+
const [containerStyle, setContainerStyle] = (0, import_react27.useState)({});
|
|
9312
|
+
const toastRef = (0, import_react27.useRef)(null);
|
|
9313
|
+
const addToast = (0, import_react27.useCallback)(
|
|
9233
9314
|
(title, options = {}) => {
|
|
9234
9315
|
const id = Date.now() + Math.floor(Math.random() * 1e5);
|
|
9235
9316
|
const newToast = {
|
|
@@ -9246,11 +9327,11 @@ var ToastProvider = ({
|
|
|
9246
9327
|
},
|
|
9247
9328
|
[globalOptions]
|
|
9248
9329
|
);
|
|
9249
|
-
const removeToast = (0,
|
|
9330
|
+
const removeToast = (0, import_react27.useCallback)((id) => {
|
|
9250
9331
|
setToasts((prevToasts) => prevToasts.filter((toast2) => toast2.id !== id));
|
|
9251
9332
|
}, []);
|
|
9252
9333
|
const contextValue = addToast;
|
|
9253
|
-
(0,
|
|
9334
|
+
(0, import_react27.useEffect)(() => {
|
|
9254
9335
|
var _a;
|
|
9255
9336
|
const width = (globalOptions == null ? void 0 : globalOptions.width) ? globalOptions.width : typeof ((_a = toastRef.current) == null ? void 0 : _a.getWidth) === "function" ? toastRef.current.getWidth() : 300;
|
|
9256
9337
|
const offset = 20;
|
|
@@ -9264,18 +9345,18 @@ var ToastProvider = ({
|
|
|
9264
9345
|
right: right !== void 0 ? `${right}px` : void 0
|
|
9265
9346
|
});
|
|
9266
9347
|
}, [globalOptions == null ? void 0 : globalOptions.placement, globalOptions == null ? void 0 : globalOptions.width]);
|
|
9267
|
-
return /* @__PURE__ */ (0,
|
|
9348
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(ToastContext.Provider, { value: contextValue, children: [
|
|
9268
9349
|
children,
|
|
9269
|
-
/* @__PURE__ */ (0,
|
|
9350
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { id: "deepnoid-toast-container", className: "flex flex-col gap-[10px]", style: containerStyle, children: toasts.map((toast2) => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(toast_default, { ref: toastRef, onClose: () => removeToast(toast2.id), ...toast2 }, toast2.id)) })
|
|
9270
9351
|
] });
|
|
9271
9352
|
};
|
|
9272
9353
|
|
|
9273
9354
|
// src/components/dateTimePicker/dateTimePicker.tsx
|
|
9274
|
-
var
|
|
9355
|
+
var import_react31 = __toESM(require("react"));
|
|
9275
9356
|
var import_react_dom4 = require("react-dom");
|
|
9276
9357
|
|
|
9277
9358
|
// src/components/dateTimePicker/useDateTimePicker.tsx
|
|
9278
|
-
var
|
|
9359
|
+
var import_react28 = require("react");
|
|
9279
9360
|
|
|
9280
9361
|
// src/components/dateTimePicker/util.ts
|
|
9281
9362
|
var formatDateToString = (date) => {
|
|
@@ -9291,17 +9372,17 @@ var formatStringToDate = (date) => {
|
|
|
9291
9372
|
|
|
9292
9373
|
// src/components/dateTimePicker/useDateTimePicker.tsx
|
|
9293
9374
|
var useDatePicker = ({ initialDate, initialTime }) => {
|
|
9294
|
-
const [selectedDate, setSelectedDate] = (0,
|
|
9375
|
+
const [selectedDate, setSelectedDate] = (0, import_react28.useState)(
|
|
9295
9376
|
initialDate ? formatDateToString(initialDate) : ""
|
|
9296
9377
|
);
|
|
9297
|
-
const [selectedTime, setSelectedTime] = (0,
|
|
9298
|
-
const [targetRect, setTargetRect] = (0,
|
|
9299
|
-
const [popupWidth, setPopupWidth] = (0,
|
|
9300
|
-
const [popupHeight, setPopupHeight] = (0,
|
|
9301
|
-
const [isFocusInput, setIsFocusInput] = (0,
|
|
9302
|
-
const dateInputRef = (0,
|
|
9303
|
-
const datePickerWrapperRef = (0,
|
|
9304
|
-
const datePickerRef = (0,
|
|
9378
|
+
const [selectedTime, setSelectedTime] = (0, import_react28.useState)(initialTime ? initialTime : "");
|
|
9379
|
+
const [targetRect, setTargetRect] = (0, import_react28.useState)(null);
|
|
9380
|
+
const [popupWidth, setPopupWidth] = (0, import_react28.useState)(0);
|
|
9381
|
+
const [popupHeight, setPopupHeight] = (0, import_react28.useState)(0);
|
|
9382
|
+
const [isFocusInput, setIsFocusInput] = (0, import_react28.useState)(false);
|
|
9383
|
+
const dateInputRef = (0, import_react28.useRef)(null);
|
|
9384
|
+
const datePickerWrapperRef = (0, import_react28.useRef)(null);
|
|
9385
|
+
const datePickerRef = (0, import_react28.useRef)(null);
|
|
9305
9386
|
const DATE_PICKER_GAP = 4;
|
|
9306
9387
|
const calculatePositionWithScroll = (targetRect2) => {
|
|
9307
9388
|
if (targetRect2 && popupWidth && popupHeight) {
|
|
@@ -9334,7 +9415,7 @@ var useDatePicker = ({ initialDate, initialTime }) => {
|
|
|
9334
9415
|
const handleBlueInput = () => {
|
|
9335
9416
|
setIsFocusInput(false);
|
|
9336
9417
|
};
|
|
9337
|
-
(0,
|
|
9418
|
+
(0, import_react28.useEffect)(() => {
|
|
9338
9419
|
const onClickOutside = (e) => {
|
|
9339
9420
|
if (datePickerRef.current && !datePickerRef.current.contains(e.target) && datePickerWrapperRef.current && !datePickerWrapperRef.current.contains(e.target)) {
|
|
9340
9421
|
setTargetRect(null);
|
|
@@ -9343,7 +9424,7 @@ var useDatePicker = ({ initialDate, initialTime }) => {
|
|
|
9343
9424
|
window.addEventListener("mousedown", onClickOutside);
|
|
9344
9425
|
return () => window.removeEventListener("mousedown", onClickOutside);
|
|
9345
9426
|
}, []);
|
|
9346
|
-
(0,
|
|
9427
|
+
(0, import_react28.useEffect)(() => {
|
|
9347
9428
|
if (datePickerWrapperRef.current) {
|
|
9348
9429
|
setPopupHeight(datePickerWrapperRef.current.getBoundingClientRect().height);
|
|
9349
9430
|
setPopupWidth(datePickerWrapperRef.current.getBoundingClientRect().width);
|
|
@@ -9368,19 +9449,19 @@ var useDatePicker = ({ initialDate, initialTime }) => {
|
|
|
9368
9449
|
};
|
|
9369
9450
|
|
|
9370
9451
|
// src/components/dateTimePicker/calendar.tsx
|
|
9371
|
-
var
|
|
9372
|
-
var
|
|
9373
|
-
var Calendar = (0,
|
|
9452
|
+
var import_react29 = __toESM(require("react"));
|
|
9453
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
9454
|
+
var Calendar = (0, import_react29.forwardRef)((originalProps, ref) => {
|
|
9374
9455
|
const [props, variantProps] = mapPropsVariants(originalProps, calendarStyle.variantKeys);
|
|
9375
9456
|
const { selectedDate, classNames, highlightWeekend = true, onChangeDate, ...inputProps } = props;
|
|
9376
|
-
const [currentDate, setCurrentDate] = (0,
|
|
9457
|
+
const [currentDate, setCurrentDate] = (0, import_react29.useState)(selectedDate ? new Date(selectedDate) : /* @__PURE__ */ new Date());
|
|
9377
9458
|
const daysOfWeek = ["S", "M", "T", "W", "T", "F", "S"];
|
|
9378
|
-
(0,
|
|
9459
|
+
(0, import_react29.useEffect)(() => {
|
|
9379
9460
|
if (selectedDate) {
|
|
9380
9461
|
setCurrentDate(new Date(selectedDate));
|
|
9381
9462
|
}
|
|
9382
9463
|
}, [selectedDate]);
|
|
9383
|
-
const getCalendarDates = (0,
|
|
9464
|
+
const getCalendarDates = (0, import_react29.useCallback)(() => {
|
|
9384
9465
|
const year = currentDate.getFullYear();
|
|
9385
9466
|
const month = currentDate.getMonth();
|
|
9386
9467
|
const firstDayOfMonth = new Date(year, month, 1).getDay();
|
|
@@ -9426,17 +9507,17 @@ var Calendar = (0, import_react31.forwardRef)((originalProps, ref) => {
|
|
|
9426
9507
|
onChangeDate(formatted);
|
|
9427
9508
|
}
|
|
9428
9509
|
};
|
|
9429
|
-
(0,
|
|
9510
|
+
(0, import_react29.useImperativeHandle)(ref, () => ({
|
|
9430
9511
|
getSelectedDate: () => selectedDate
|
|
9431
9512
|
}));
|
|
9432
|
-
const slots = (0,
|
|
9433
|
-
const getBaseProps = (0,
|
|
9513
|
+
const slots = (0, import_react29.useMemo)(() => calendarStyle({ ...variantProps }), [variantProps]);
|
|
9514
|
+
const getBaseProps = (0, import_react29.useCallback)(
|
|
9434
9515
|
() => ({
|
|
9435
9516
|
className: `${slots.base({ class: classNames == null ? void 0 : classNames.base })}`
|
|
9436
9517
|
}),
|
|
9437
9518
|
[slots, classNames]
|
|
9438
9519
|
);
|
|
9439
|
-
const getDateTitleProps = (0,
|
|
9520
|
+
const getDateTitleProps = (0, import_react29.useCallback)(
|
|
9440
9521
|
(index) => {
|
|
9441
9522
|
return {
|
|
9442
9523
|
className: `${slots.dateTitle({
|
|
@@ -9448,7 +9529,7 @@ var Calendar = (0, import_react31.forwardRef)((originalProps, ref) => {
|
|
|
9448
9529
|
},
|
|
9449
9530
|
[slots, classNames, highlightWeekend]
|
|
9450
9531
|
);
|
|
9451
|
-
const getDateProps = (0,
|
|
9532
|
+
const getDateProps = (0, import_react29.useCallback)(
|
|
9452
9533
|
(dateObj) => {
|
|
9453
9534
|
const today = /* @__PURE__ */ new Date();
|
|
9454
9535
|
const isToday = today.getDate() === dateObj.date && today.getMonth() === currentDate.getMonth() && today.getFullYear() === currentDate.getFullYear();
|
|
@@ -9470,18 +9551,18 @@ var Calendar = (0, import_react31.forwardRef)((originalProps, ref) => {
|
|
|
9470
9551
|
[slots, classNames, selectedDate, currentDate, highlightWeekend]
|
|
9471
9552
|
);
|
|
9472
9553
|
const calendarDates = getCalendarDates();
|
|
9473
|
-
return /* @__PURE__ */ (0,
|
|
9474
|
-
/* @__PURE__ */ (0,
|
|
9475
|
-
/* @__PURE__ */ (0,
|
|
9476
|
-
/* @__PURE__ */ (0,
|
|
9477
|
-
/* @__PURE__ */ (0,
|
|
9554
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_jsx_runtime32.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { ...getBaseProps(), children: [
|
|
9555
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "calendar-header flex justify-between items-center mb-4", children: [
|
|
9556
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Icon_default, { name: "brace-left", size: "md", className: "cursor-pointer", onClick: handlePrevMonth }),
|
|
9557
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "text-h6 font-semibold", children: currentDate.toLocaleString("default", { year: "numeric", month: "2-digit" }) }),
|
|
9558
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Icon_default, { name: "brace-right", size: "md", className: "cursor-pointer", onClick: handleNextMonth })
|
|
9478
9559
|
] }),
|
|
9479
|
-
/* @__PURE__ */ (0,
|
|
9480
|
-
/* @__PURE__ */ (0,
|
|
9560
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "grid grid-cols-7 gap-2 text-center", children: daysOfWeek.map((day, index) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { ...getDateTitleProps(index), children: day }, `${day}-${index}`)) }),
|
|
9561
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "grid grid-cols-7 gap-[5px] text-center mt-2", children: calendarDates.map((week, weekIndex) => {
|
|
9481
9562
|
const hasCurrentMonthDates = week.some((dateObj) => dateObj.currentMonth);
|
|
9482
9563
|
if (!hasCurrentMonthDates) return null;
|
|
9483
|
-
return /* @__PURE__ */ (0,
|
|
9484
|
-
return /* @__PURE__ */ (0,
|
|
9564
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_react29.default.Fragment, { children: week.map((dateObj, index) => {
|
|
9565
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { ...getDateProps(dateObj), children: dateObj.date }, index);
|
|
9485
9566
|
}) }, weekIndex);
|
|
9486
9567
|
}) })
|
|
9487
9568
|
] }) });
|
|
@@ -9552,22 +9633,22 @@ var calendarStyle = tv({
|
|
|
9552
9633
|
});
|
|
9553
9634
|
|
|
9554
9635
|
// src/components/dateTimePicker/timePicker.tsx
|
|
9555
|
-
var
|
|
9556
|
-
var
|
|
9636
|
+
var import_react30 = require("react");
|
|
9637
|
+
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
9557
9638
|
var TimePicker = ({ color = "primary", selectedTime, isFocusInput, onChangeTime }) => {
|
|
9558
9639
|
const TOTAL_HOURS = 12;
|
|
9559
9640
|
const TOTAL_MINUTES = 60;
|
|
9560
9641
|
const ITEM_HEIGHT = 30;
|
|
9561
9642
|
const PERIODS = ["AM", "PM"];
|
|
9562
|
-
const [selectedHour, setSelectedHour] = (0,
|
|
9563
|
-
const [selectedMinute, setSelectedMinute] = (0,
|
|
9564
|
-
const [selectedPeriod, setSelectedPeriod] = (0,
|
|
9565
|
-
const hourRef = (0,
|
|
9566
|
-
const minuteRef = (0,
|
|
9567
|
-
const periodRef = (0,
|
|
9643
|
+
const [selectedHour, setSelectedHour] = (0, import_react30.useState)("01");
|
|
9644
|
+
const [selectedMinute, setSelectedMinute] = (0, import_react30.useState)("00");
|
|
9645
|
+
const [selectedPeriod, setSelectedPeriod] = (0, import_react30.useState)("AM");
|
|
9646
|
+
const hourRef = (0, import_react30.useRef)(null);
|
|
9647
|
+
const minuteRef = (0, import_react30.useRef)(null);
|
|
9648
|
+
const periodRef = (0, import_react30.useRef)(null);
|
|
9568
9649
|
const hoursArray = [...Array(TOTAL_HOURS).keys()].map((i) => (i + 1).toString().padStart(2, "0"));
|
|
9569
9650
|
const minutesArray = [...Array(TOTAL_MINUTES).keys()].map((i) => i.toString().padStart(2, "0"));
|
|
9570
|
-
(0,
|
|
9651
|
+
(0, import_react30.useEffect)(() => {
|
|
9571
9652
|
if (selectedTime) {
|
|
9572
9653
|
const { formattedHour, minute, period } = parseAndFormatTime(selectedTime);
|
|
9573
9654
|
setSelectedHour(formattedHour);
|
|
@@ -9578,7 +9659,7 @@ var TimePicker = ({ color = "primary", selectedTime, isFocusInput, onChangeTime
|
|
|
9578
9659
|
scrollToSelectedTime();
|
|
9579
9660
|
}
|
|
9580
9661
|
}, [selectedTime, isFocusInput]);
|
|
9581
|
-
(0,
|
|
9662
|
+
(0, import_react30.useEffect)(() => {
|
|
9582
9663
|
scrollToSelectedTime();
|
|
9583
9664
|
}, []);
|
|
9584
9665
|
const parseAndFormatTime = (time) => {
|
|
@@ -9615,8 +9696,8 @@ var TimePicker = ({ color = "primary", selectedTime, isFocusInput, onChangeTime
|
|
|
9615
9696
|
onChangeTime(formattedTime);
|
|
9616
9697
|
}
|
|
9617
9698
|
};
|
|
9618
|
-
return /* @__PURE__ */ (0,
|
|
9619
|
-
/* @__PURE__ */ (0,
|
|
9699
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex h-[200px] p-[10px] gap-[5px] border border-neutral-main rounded-md bg-background shadow-lg", children: [
|
|
9700
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(list_default, { ref: periodRef, classNames: { base: "overflow-y-auto scrollbar-hide" }, children: PERIODS.map((period, index) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
9620
9701
|
listItem_default,
|
|
9621
9702
|
{
|
|
9622
9703
|
color,
|
|
@@ -9630,7 +9711,7 @@ var TimePicker = ({ color = "primary", selectedTime, isFocusInput, onChangeTime
|
|
|
9630
9711
|
},
|
|
9631
9712
|
`${period}-${index}`
|
|
9632
9713
|
)) }),
|
|
9633
|
-
/* @__PURE__ */ (0,
|
|
9714
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(list_default, { ref: hourRef, classNames: { base: "overflow-y-auto scrollbar-hide" }, children: hoursArray.map((hour, index) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
9634
9715
|
listItem_default,
|
|
9635
9716
|
{
|
|
9636
9717
|
color,
|
|
@@ -9644,7 +9725,7 @@ var TimePicker = ({ color = "primary", selectedTime, isFocusInput, onChangeTime
|
|
|
9644
9725
|
},
|
|
9645
9726
|
`${hour}-${index}`
|
|
9646
9727
|
)) }),
|
|
9647
|
-
/* @__PURE__ */ (0,
|
|
9728
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(list_default, { ref: minuteRef, classNames: { base: "overflow-y-auto scrollbar-hide" }, children: minutesArray.map((minute, index) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
9648
9729
|
listItem_default,
|
|
9649
9730
|
{
|
|
9650
9731
|
color,
|
|
@@ -9663,8 +9744,8 @@ var TimePicker = ({ color = "primary", selectedTime, isFocusInput, onChangeTime
|
|
|
9663
9744
|
var timePicker_default = TimePicker;
|
|
9664
9745
|
|
|
9665
9746
|
// src/components/dateTimePicker/dateTimePicker.tsx
|
|
9666
|
-
var
|
|
9667
|
-
var DatePicker = (0,
|
|
9747
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
9748
|
+
var DatePicker = (0, import_react31.forwardRef)((originalProps, ref) => {
|
|
9668
9749
|
const [props, variantProps] = mapPropsVariants(originalProps, dateTimePickerStyle.variantKeys);
|
|
9669
9750
|
const {
|
|
9670
9751
|
classNames,
|
|
@@ -9678,7 +9759,7 @@ var DatePicker = (0, import_react33.forwardRef)((originalProps, ref) => {
|
|
|
9678
9759
|
onChangeTime,
|
|
9679
9760
|
...inputProps
|
|
9680
9761
|
} = props;
|
|
9681
|
-
const slots = (0,
|
|
9762
|
+
const slots = (0, import_react31.useMemo)(() => dateTimePickerStyle({ ...variantProps }), [variantProps]);
|
|
9682
9763
|
const {
|
|
9683
9764
|
selectedDate,
|
|
9684
9765
|
selectedTime,
|
|
@@ -9699,32 +9780,32 @@ var DatePicker = (0, import_react33.forwardRef)((originalProps, ref) => {
|
|
|
9699
9780
|
initialTime: typeof value === "string" ? value : void 0
|
|
9700
9781
|
});
|
|
9701
9782
|
const position = targetRect ? calculatePositionWithScroll(targetRect) : null;
|
|
9702
|
-
const getBaseProps = (0,
|
|
9783
|
+
const getBaseProps = (0, import_react31.useCallback)(
|
|
9703
9784
|
() => ({
|
|
9704
9785
|
className: slots.base({ class: classNames == null ? void 0 : classNames.base })
|
|
9705
9786
|
}),
|
|
9706
9787
|
[slots, classNames]
|
|
9707
9788
|
);
|
|
9708
|
-
const getLabelProps = (0,
|
|
9789
|
+
const getLabelProps = (0, import_react31.useCallback)(
|
|
9709
9790
|
() => ({
|
|
9710
9791
|
className: slots.label({ class: classNames == null ? void 0 : classNames.label })
|
|
9711
9792
|
}),
|
|
9712
9793
|
[slots, classNames]
|
|
9713
9794
|
);
|
|
9714
|
-
const getInnerWrapperProps = (0,
|
|
9795
|
+
const getInnerWrapperProps = (0, import_react31.useCallback)(
|
|
9715
9796
|
() => ({
|
|
9716
9797
|
className: slots.innerWrapper({ class: classNames == null ? void 0 : classNames.innerWrapper })
|
|
9717
9798
|
}),
|
|
9718
9799
|
[slots, classNames]
|
|
9719
9800
|
);
|
|
9720
|
-
const getInputWrapperProps = (0,
|
|
9801
|
+
const getInputWrapperProps = (0, import_react31.useCallback)(
|
|
9721
9802
|
() => ({
|
|
9722
9803
|
className: slots.inputWrapper({ class: classNames == null ? void 0 : classNames.inputWrapper }),
|
|
9723
9804
|
ref: datePickerRef
|
|
9724
9805
|
}),
|
|
9725
9806
|
[slots, classNames]
|
|
9726
9807
|
);
|
|
9727
|
-
const getInputProps = (0,
|
|
9808
|
+
const getInputProps = (0, import_react31.useCallback)(
|
|
9728
9809
|
() => ({
|
|
9729
9810
|
...inputProps,
|
|
9730
9811
|
ref: ref || dateInputRef,
|
|
@@ -9755,33 +9836,33 @@ var DatePicker = (0, import_react33.forwardRef)((originalProps, ref) => {
|
|
|
9755
9836
|
}),
|
|
9756
9837
|
[inputProps, ref, dateInputRef, slots, classNames == null ? void 0 : classNames.input, selectedDate, selectedTime, type, value]
|
|
9757
9838
|
);
|
|
9758
|
-
const getContentProps = (0,
|
|
9839
|
+
const getContentProps = (0, import_react31.useCallback)(
|
|
9759
9840
|
() => ({
|
|
9760
9841
|
className: slots.content({ class: classNames == null ? void 0 : classNames.content }),
|
|
9761
9842
|
size: originalProps.size
|
|
9762
9843
|
}),
|
|
9763
9844
|
[slots, classNames, originalProps.size]
|
|
9764
9845
|
);
|
|
9765
|
-
const getErrorMessageProps = (0,
|
|
9846
|
+
const getErrorMessageProps = (0, import_react31.useCallback)(
|
|
9766
9847
|
() => ({
|
|
9767
9848
|
className: slots.errorMessage({ class: classNames == null ? void 0 : classNames.errorMessage })
|
|
9768
9849
|
}),
|
|
9769
9850
|
[slots, classNames]
|
|
9770
9851
|
);
|
|
9771
9852
|
const renderStartContent = () => {
|
|
9772
|
-
if (
|
|
9853
|
+
if (import_react31.default.isValidElement(startContent)) {
|
|
9773
9854
|
const existingProps = startContent.props;
|
|
9774
9855
|
const mergedProps = {
|
|
9775
9856
|
...getContentProps(),
|
|
9776
9857
|
className: `${getContentProps().className || ""} ${existingProps.className || ""}`.trim()
|
|
9777
9858
|
};
|
|
9778
|
-
return
|
|
9859
|
+
return import_react31.default.cloneElement(startContent, mergedProps);
|
|
9779
9860
|
} else {
|
|
9780
9861
|
const contentProps = getContentProps();
|
|
9781
|
-
return /* @__PURE__ */ (0,
|
|
9862
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { ...contentProps, children: startContent });
|
|
9782
9863
|
}
|
|
9783
9864
|
};
|
|
9784
|
-
const renderDateTimePickerIcon = () => /* @__PURE__ */ (0,
|
|
9865
|
+
const renderDateTimePickerIcon = () => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { ...getContentProps(), onClick: handleToggleDatePicker, children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
9785
9866
|
Icon_default,
|
|
9786
9867
|
{
|
|
9787
9868
|
name: type === "time" ? "clock" : "calendar",
|
|
@@ -9791,18 +9872,18 @@ var DatePicker = (0, import_react33.forwardRef)((originalProps, ref) => {
|
|
|
9791
9872
|
}
|
|
9792
9873
|
) });
|
|
9793
9874
|
const renderContentWithIcon = () => {
|
|
9794
|
-
if (
|
|
9875
|
+
if (import_react31.default.isValidElement(endContent)) {
|
|
9795
9876
|
const existingProps = endContent.props;
|
|
9796
9877
|
const mergedProps = {
|
|
9797
9878
|
...getContentProps(),
|
|
9798
9879
|
className: `${getContentProps().className || ""} ${existingProps.className || ""}`.trim()
|
|
9799
9880
|
};
|
|
9800
|
-
return
|
|
9881
|
+
return import_react31.default.cloneElement(endContent, mergedProps);
|
|
9801
9882
|
} else if (errorMessage) {
|
|
9802
9883
|
const iconProps = { ...getContentProps(), className: getContentProps().className };
|
|
9803
|
-
return /* @__PURE__ */ (0,
|
|
9884
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { ...iconProps, children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Icon_default, { name: "exclamation-circle", fill: true, size: originalProps.size }) });
|
|
9804
9885
|
} else {
|
|
9805
|
-
return /* @__PURE__ */ (0,
|
|
9886
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_jsx_runtime34.Fragment, {});
|
|
9806
9887
|
}
|
|
9807
9888
|
};
|
|
9808
9889
|
const renderEndContent = () => {
|
|
@@ -9817,20 +9898,20 @@ var DatePicker = (0, import_react33.forwardRef)((originalProps, ref) => {
|
|
|
9817
9898
|
return renderContentWithIcon();
|
|
9818
9899
|
}
|
|
9819
9900
|
};
|
|
9820
|
-
return /* @__PURE__ */ (0,
|
|
9821
|
-
/* @__PURE__ */ (0,
|
|
9822
|
-
label && /* @__PURE__ */ (0,
|
|
9823
|
-
/* @__PURE__ */ (0,
|
|
9824
|
-
/* @__PURE__ */ (0,
|
|
9901
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
|
|
9902
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { ...getBaseProps(), children: [
|
|
9903
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("label", { ...getLabelProps(), children: label }),
|
|
9904
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { ...getInnerWrapperProps(), children: [
|
|
9905
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { ...getInputWrapperProps(), children: [
|
|
9825
9906
|
startContent && renderStartContent(),
|
|
9826
|
-
/* @__PURE__ */ (0,
|
|
9907
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("input", { ...getInputProps() }),
|
|
9827
9908
|
renderEndContent()
|
|
9828
9909
|
] }),
|
|
9829
|
-
errorMessage && /* @__PURE__ */ (0,
|
|
9910
|
+
errorMessage && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("p", { ...getErrorMessageProps(), children: errorMessage })
|
|
9830
9911
|
] })
|
|
9831
9912
|
] }),
|
|
9832
|
-
targetRect && /* @__PURE__ */ (0,
|
|
9833
|
-
/* @__PURE__ */ (0,
|
|
9913
|
+
targetRect && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_jsx_runtime34.Fragment, { children: (0, import_react_dom4.createPortal)(
|
|
9914
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
|
9834
9915
|
"div",
|
|
9835
9916
|
{
|
|
9836
9917
|
ref: datePickerWrapperRef,
|
|
@@ -9841,7 +9922,7 @@ var DatePicker = (0, import_react33.forwardRef)((originalProps, ref) => {
|
|
|
9841
9922
|
zIndex: 1e3
|
|
9842
9923
|
},
|
|
9843
9924
|
children: [
|
|
9844
|
-
type === "date" && /* @__PURE__ */ (0,
|
|
9925
|
+
type === "date" && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
9845
9926
|
calendar_default,
|
|
9846
9927
|
{
|
|
9847
9928
|
color: originalProps.color,
|
|
@@ -9853,7 +9934,7 @@ var DatePicker = (0, import_react33.forwardRef)((originalProps, ref) => {
|
|
|
9853
9934
|
}
|
|
9854
9935
|
}
|
|
9855
9936
|
),
|
|
9856
|
-
type === "time" && /* @__PURE__ */ (0,
|
|
9937
|
+
type === "time" && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
9857
9938
|
timePicker_default,
|
|
9858
9939
|
{
|
|
9859
9940
|
color: originalProps.color,
|
|
@@ -10003,20 +10084,20 @@ var dateTimePickerStyle = tv({
|
|
|
10003
10084
|
});
|
|
10004
10085
|
|
|
10005
10086
|
// src/components/tree/tree.tsx
|
|
10006
|
-
var
|
|
10007
|
-
var
|
|
10008
|
-
var TreeNodeItem = (0,
|
|
10009
|
-
({ node, depth, fileIcon, isLoading, classNames, onExpand }, ref) => {
|
|
10010
|
-
const [isOpen, setIsOpen] = (0,
|
|
10011
|
-
const [children, setChildren] = (0,
|
|
10012
|
-
const [isLoadingChildren, setIsLoadingChildren] = (0,
|
|
10013
|
-
const slots = (0,
|
|
10014
|
-
const hasMore = (0,
|
|
10087
|
+
var import_react32 = require("react");
|
|
10088
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
10089
|
+
var TreeNodeItem = (0, import_react32.forwardRef)(
|
|
10090
|
+
({ node, depth, fileIcon, selectedId, isLoading, classNames, onExpand }, ref) => {
|
|
10091
|
+
const [isOpen, setIsOpen] = (0, import_react32.useState)(false);
|
|
10092
|
+
const [children, setChildren] = (0, import_react32.useState)(node.children);
|
|
10093
|
+
const [isLoadingChildren, setIsLoadingChildren] = (0, import_react32.useState)(false);
|
|
10094
|
+
const slots = (0, import_react32.useMemo)(() => treeStyle(), []);
|
|
10095
|
+
const hasMore = (0, import_react32.useMemo)(() => {
|
|
10015
10096
|
if (node.isLeaf) return false;
|
|
10016
10097
|
if (Array.isArray(children)) return children.length > 0;
|
|
10017
10098
|
return typeof onExpand === "function";
|
|
10018
10099
|
}, [node.isLeaf, children, onExpand]);
|
|
10019
|
-
const toggleOpen = (0,
|
|
10100
|
+
const toggleOpen = (0, import_react32.useCallback)(async () => {
|
|
10020
10101
|
if (!isOpen && !children && onExpand && !node.isLeaf) {
|
|
10021
10102
|
setIsLoadingChildren(true);
|
|
10022
10103
|
try {
|
|
@@ -10030,10 +10111,10 @@ var TreeNodeItem = (0, import_react34.forwardRef)(
|
|
|
10030
10111
|
}
|
|
10031
10112
|
setIsOpen((prev) => !prev);
|
|
10032
10113
|
}, [isOpen, children, onExpand, node]);
|
|
10033
|
-
const handleClick = () => {
|
|
10114
|
+
const handleClick = (e) => {
|
|
10034
10115
|
var _a;
|
|
10035
10116
|
toggleOpen();
|
|
10036
|
-
(_a = node.onClick) == null ? void 0 : _a.call(node);
|
|
10117
|
+
(_a = node.onClick) == null ? void 0 : _a.call(node, e);
|
|
10037
10118
|
};
|
|
10038
10119
|
const handleRightClick = (e) => {
|
|
10039
10120
|
var _a;
|
|
@@ -10041,7 +10122,7 @@ var TreeNodeItem = (0, import_react34.forwardRef)(
|
|
|
10041
10122
|
(_a = node.onRightClick) == null ? void 0 : _a.call(node, e);
|
|
10042
10123
|
};
|
|
10043
10124
|
const marginClass = depth > 1 ? hasMore ? "ml-[30px]" : "ml-[55px]" : hasMore ? "" : "ml-[25px]";
|
|
10044
|
-
return /* @__PURE__ */ (0,
|
|
10125
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
|
|
10045
10126
|
"div",
|
|
10046
10127
|
{
|
|
10047
10128
|
ref,
|
|
@@ -10051,14 +10132,18 @@ var TreeNodeItem = (0, import_react34.forwardRef)(
|
|
|
10051
10132
|
isLoading ? "-translate-y-2 opacity-0" : "translate-y-0 opacity-100"
|
|
10052
10133
|
),
|
|
10053
10134
|
children: [
|
|
10054
|
-
/* @__PURE__ */ (0,
|
|
10135
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
|
|
10055
10136
|
"div",
|
|
10056
10137
|
{
|
|
10057
|
-
className:
|
|
10138
|
+
className: clsx(
|
|
10139
|
+
slots.node({ class: classNames == null ? void 0 : classNames.node }),
|
|
10140
|
+
slots.clickable({ class: classNames == null ? void 0 : classNames.clickable }),
|
|
10141
|
+
selectedId == node.id ? "bg-neutral-soft" : ""
|
|
10142
|
+
),
|
|
10058
10143
|
onClick: handleClick,
|
|
10059
10144
|
onContextMenu: handleRightClick,
|
|
10060
10145
|
children: [
|
|
10061
|
-
hasMore && /* @__PURE__ */ (0,
|
|
10146
|
+
hasMore && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
10062
10147
|
Icon_default,
|
|
10063
10148
|
{
|
|
10064
10149
|
name: "right-chevron",
|
|
@@ -10069,17 +10154,18 @@ var TreeNodeItem = (0, import_react34.forwardRef)(
|
|
|
10069
10154
|
}
|
|
10070
10155
|
),
|
|
10071
10156
|
fileIcon,
|
|
10072
|
-
node.
|
|
10157
|
+
node.content
|
|
10073
10158
|
]
|
|
10074
10159
|
}
|
|
10075
10160
|
),
|
|
10076
|
-
isOpen && /* @__PURE__ */ (0,
|
|
10077
|
-
isLoadingChildren && /* @__PURE__ */ (0,
|
|
10078
|
-
children == null ? void 0 : children.map((child) => /* @__PURE__ */ (0,
|
|
10161
|
+
isOpen && /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { children: [
|
|
10162
|
+
isLoadingChildren && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "text-neutral py-1 text-sm", children: "loading..." }),
|
|
10163
|
+
children == null ? void 0 : children.map((child) => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
10079
10164
|
TreeNodeItem,
|
|
10080
10165
|
{
|
|
10081
10166
|
node: child,
|
|
10082
10167
|
depth: depth + 1,
|
|
10168
|
+
selectedId,
|
|
10083
10169
|
classNames,
|
|
10084
10170
|
fileIcon,
|
|
10085
10171
|
onExpand
|
|
@@ -10098,44 +10184,47 @@ var Tree = ({
|
|
|
10098
10184
|
group,
|
|
10099
10185
|
groupIcon,
|
|
10100
10186
|
fileIcon,
|
|
10187
|
+
selectedId,
|
|
10101
10188
|
isLoading = false,
|
|
10102
10189
|
classNames,
|
|
10103
10190
|
onExpand
|
|
10104
10191
|
}) => {
|
|
10105
|
-
const slots = (0,
|
|
10106
|
-
const
|
|
10107
|
-
const handleToggle = () => {
|
|
10192
|
+
const slots = (0, import_react32.useMemo)(() => treeStyle(), []);
|
|
10193
|
+
const handleClick = (e) => {
|
|
10108
10194
|
var _a;
|
|
10109
|
-
|
|
10110
|
-
(_a = group.onClick) == null ? void 0 : _a.call(group);
|
|
10195
|
+
(_a = group.onClick) == null ? void 0 : _a.call(group, e);
|
|
10111
10196
|
};
|
|
10112
10197
|
const handleRightClick = (e) => {
|
|
10113
10198
|
var _a;
|
|
10114
10199
|
e.preventDefault();
|
|
10115
10200
|
(_a = group.onRightClick) == null ? void 0 : _a.call(group, e);
|
|
10116
10201
|
};
|
|
10117
|
-
return /* @__PURE__ */ (0,
|
|
10118
|
-
headerContent && /* @__PURE__ */ (0,
|
|
10119
|
-
/* @__PURE__ */ (0,
|
|
10120
|
-
/* @__PURE__ */ (0,
|
|
10202
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: slots.base({ class: classNames == null ? void 0 : classNames.base }), children: [
|
|
10203
|
+
headerContent && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { children: headerContent }),
|
|
10204
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: slots.wrapper({ class: classNames == null ? void 0 : classNames.wrapper }), children: [
|
|
10205
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
|
|
10121
10206
|
"div",
|
|
10122
10207
|
{
|
|
10123
|
-
className:
|
|
10124
|
-
|
|
10208
|
+
className: clsx(
|
|
10209
|
+
slots.node({ class: classNames == null ? void 0 : classNames.node }),
|
|
10210
|
+
group.onClick || group.onRightClick ? slots.clickable({ class: classNames == null ? void 0 : classNames.clickable }) : ""
|
|
10211
|
+
),
|
|
10212
|
+
onClick: handleClick,
|
|
10125
10213
|
onContextMenu: handleRightClick,
|
|
10126
10214
|
children: [
|
|
10127
10215
|
groupIcon,
|
|
10128
|
-
group.
|
|
10216
|
+
group.content
|
|
10129
10217
|
]
|
|
10130
10218
|
}
|
|
10131
10219
|
),
|
|
10132
|
-
|
|
10220
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { children: group.data.map((node) => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
10133
10221
|
TreeNodeItem,
|
|
10134
10222
|
{
|
|
10135
10223
|
node,
|
|
10136
10224
|
depth: 1,
|
|
10137
10225
|
classNames,
|
|
10138
10226
|
fileIcon,
|
|
10227
|
+
selectedId,
|
|
10139
10228
|
isLoading,
|
|
10140
10229
|
onExpand
|
|
10141
10230
|
},
|
|
@@ -10150,18 +10239,133 @@ var treeStyle = tv({
|
|
|
10150
10239
|
slots: {
|
|
10151
10240
|
base: ["border", "border-neutral-light", "rounded-xl", "p-[20px]", "flex", "flex-col", "gap-[20px]", "select-none"],
|
|
10152
10241
|
wrapper: ["flex", "flex-col", "gap-[5px]"],
|
|
10153
|
-
|
|
10242
|
+
node: [
|
|
10154
10243
|
"flex",
|
|
10155
10244
|
"items-center",
|
|
10156
10245
|
"gap-[5px]",
|
|
10157
10246
|
"text-md",
|
|
10158
10247
|
"font-bold",
|
|
10159
10248
|
"text-body-foreground",
|
|
10160
|
-
"hover:bg-neutral-soft",
|
|
10161
|
-
"p-[5px]",
|
|
10162
10249
|
"rounded-[5px]",
|
|
10163
|
-
"
|
|
10164
|
-
]
|
|
10250
|
+
"p-[5px]"
|
|
10251
|
+
],
|
|
10252
|
+
clickable: ["hover:bg-neutral-soft", "cursor-pointer"]
|
|
10253
|
+
}
|
|
10254
|
+
});
|
|
10255
|
+
|
|
10256
|
+
// src/components/fileUpload/fileUpload.tsx
|
|
10257
|
+
var import_react33 = require("react");
|
|
10258
|
+
var import_tailwind_variants30 = require("tailwind-variants");
|
|
10259
|
+
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
10260
|
+
function FileUpload({
|
|
10261
|
+
buttonText,
|
|
10262
|
+
maxSizeMB = 10,
|
|
10263
|
+
placeholder,
|
|
10264
|
+
accept = [],
|
|
10265
|
+
acceptErrorMessage = "The file type is not allowed.",
|
|
10266
|
+
sizeErrorMessage = `File is too large.`,
|
|
10267
|
+
onFileUpload,
|
|
10268
|
+
helperMessage,
|
|
10269
|
+
showProgress,
|
|
10270
|
+
classNames
|
|
10271
|
+
}) {
|
|
10272
|
+
const fileInputRef = (0, import_react33.useRef)(null);
|
|
10273
|
+
const uploadIntervalRef = (0, import_react33.useRef)(null);
|
|
10274
|
+
const [file, setFile] = (0, import_react33.useState)(null);
|
|
10275
|
+
const [uploadProgress, setUploadProgress] = (0, import_react33.useState)(0);
|
|
10276
|
+
const [errorMessage, setErrorMessage] = (0, import_react33.useState)("");
|
|
10277
|
+
const slots = fileUploadStyle();
|
|
10278
|
+
const handleButtonClick = () => {
|
|
10279
|
+
var _a;
|
|
10280
|
+
(_a = fileInputRef.current) == null ? void 0 : _a.click();
|
|
10281
|
+
};
|
|
10282
|
+
const validateFile = (file2) => {
|
|
10283
|
+
if (accept.length && !accept.includes(file2.type)) {
|
|
10284
|
+
return acceptErrorMessage;
|
|
10285
|
+
}
|
|
10286
|
+
const sizeMB = file2.size / 1024 / 1024;
|
|
10287
|
+
if (sizeMB > maxSizeMB) {
|
|
10288
|
+
return `${sizeErrorMessage} (${maxSizeMB}MB)`;
|
|
10289
|
+
}
|
|
10290
|
+
return null;
|
|
10291
|
+
};
|
|
10292
|
+
const startUploadSimulation = (file2) => {
|
|
10293
|
+
let progress = 0;
|
|
10294
|
+
setUploadProgress(0);
|
|
10295
|
+
uploadIntervalRef.current = window.setInterval(() => {
|
|
10296
|
+
progress += 10;
|
|
10297
|
+
setUploadProgress(progress);
|
|
10298
|
+
if (progress >= 100) {
|
|
10299
|
+
clearInterval(uploadIntervalRef.current);
|
|
10300
|
+
onFileUpload == null ? void 0 : onFileUpload(file2);
|
|
10301
|
+
}
|
|
10302
|
+
}, 100);
|
|
10303
|
+
};
|
|
10304
|
+
const handleFileChange = (e) => {
|
|
10305
|
+
var _a;
|
|
10306
|
+
const selectedFile = (_a = e.target.files) == null ? void 0 : _a[0];
|
|
10307
|
+
if (!selectedFile) return;
|
|
10308
|
+
const error = validateFile(selectedFile);
|
|
10309
|
+
if (error) {
|
|
10310
|
+
setErrorMessage(error);
|
|
10311
|
+
setFile(null);
|
|
10312
|
+
return;
|
|
10313
|
+
}
|
|
10314
|
+
setFile(selectedFile);
|
|
10315
|
+
setErrorMessage("");
|
|
10316
|
+
startUploadSimulation(selectedFile);
|
|
10317
|
+
};
|
|
10318
|
+
const handleCancelUpload = () => {
|
|
10319
|
+
if (uploadIntervalRef.current) {
|
|
10320
|
+
clearInterval(uploadIntervalRef.current);
|
|
10321
|
+
}
|
|
10322
|
+
setFile(null);
|
|
10323
|
+
setUploadProgress(0);
|
|
10324
|
+
setErrorMessage("");
|
|
10325
|
+
};
|
|
10326
|
+
(0, import_react33.useEffect)(() => {
|
|
10327
|
+
return () => {
|
|
10328
|
+
if (uploadIntervalRef.current) {
|
|
10329
|
+
clearInterval(uploadIntervalRef.current);
|
|
10330
|
+
}
|
|
10331
|
+
};
|
|
10332
|
+
}, []);
|
|
10333
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: slots.base({ class: classNames == null ? void 0 : classNames.base }), children: [
|
|
10334
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: slots.container({ class: classNames == null ? void 0 : classNames.container }), children: [
|
|
10335
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: slots.inputWrapper(), children: [
|
|
10336
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(input_default, { name: "file", readOnly: true, variant: "outline", full: true, placeholder, defaultValue: file == null ? void 0 : file.name }),
|
|
10337
|
+
file && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
10338
|
+
icon_button_default,
|
|
10339
|
+
{
|
|
10340
|
+
name: "close",
|
|
10341
|
+
variant: "ghost",
|
|
10342
|
+
color: "neutral",
|
|
10343
|
+
onClick: handleCancelUpload,
|
|
10344
|
+
classNames: { base: slots.cancelButton() },
|
|
10345
|
+
"aria-label": "cancel"
|
|
10346
|
+
}
|
|
10347
|
+
)
|
|
10348
|
+
] }),
|
|
10349
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(button_default, { type: "button", variant: "outline", onClick: handleButtonClick, children: buttonText }),
|
|
10350
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("input", { ref: fileInputRef, type: "file", hidden: true, accept: accept.join(","), onChange: handleFileChange })
|
|
10351
|
+
] }),
|
|
10352
|
+
showProgress && file && uploadProgress < 100 && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: slots.progressBarContainer(), children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: slots.progressBar(), style: { width: `${uploadProgress}%` } }) }),
|
|
10353
|
+
!errorMessage && helperMessage && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("p", { className: slots.helperMessage(), children: helperMessage }),
|
|
10354
|
+
errorMessage && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("p", { className: slots.errorMessage(), children: errorMessage })
|
|
10355
|
+
] });
|
|
10356
|
+
}
|
|
10357
|
+
FileUpload.displayName = "FileUpload";
|
|
10358
|
+
var fileUpload_default = FileUpload;
|
|
10359
|
+
var fileUploadStyle = (0, import_tailwind_variants30.tv)({
|
|
10360
|
+
slots: {
|
|
10361
|
+
base: ["flex", "flex-col", "gap-[5px]"],
|
|
10362
|
+
container: ["flex", "items-center", "gap-[10px]"],
|
|
10363
|
+
inputWrapper: ["relative", "flex-1"],
|
|
10364
|
+
cancelButton: ["absolute", "top-1/2", "right-0", "-translate-y-1/2"],
|
|
10365
|
+
progressBarContainer: ["w-full", "h-[5px]", "bg-neutral-light", "rounded-full", "overflow-hidden"],
|
|
10366
|
+
progressBar: ["h-full", "bg-primary-main", "transition-all"],
|
|
10367
|
+
errorMessage: ["text-danger-main", "text-sm"],
|
|
10368
|
+
helperMessage: ["text-neutral-main", "text-sm"]
|
|
10165
10369
|
}
|
|
10166
10370
|
});
|
|
10167
10371
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -10175,6 +10379,7 @@ var treeStyle = tv({
|
|
|
10175
10379
|
Chip,
|
|
10176
10380
|
DateTimePicker,
|
|
10177
10381
|
DefinitionTable,
|
|
10382
|
+
FileUpload,
|
|
10178
10383
|
Icon,
|
|
10179
10384
|
IconButton,
|
|
10180
10385
|
Input,
|
|
@@ -10185,6 +10390,7 @@ var treeStyle = tv({
|
|
|
10185
10390
|
Radio,
|
|
10186
10391
|
ScrollArea,
|
|
10187
10392
|
Select,
|
|
10393
|
+
Skeleton,
|
|
10188
10394
|
Switch,
|
|
10189
10395
|
Table,
|
|
10190
10396
|
Tabs,
|