@deepnoid/ui 0.1.173 → 0.1.175
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +151 -151
- package/dist/{chunk-CPFFP7L6.mjs → chunk-JGG3ZUNG.mjs} +3 -3
- package/dist/{chunk-NSADIVGU.mjs → chunk-JPCZROOU.mjs} +18 -7
- package/dist/{chunk-DU7L4GA7.mjs → chunk-NTNF5T5I.mjs} +11 -9
- package/dist/components/accordion/accordion.d.mts +3 -2
- package/dist/components/accordion/accordion.d.ts +3 -2
- package/dist/components/accordion/accordion.js +3 -3
- package/dist/components/accordion/accordion.mjs +1 -1
- package/dist/components/accordion/accordionItem.js +11 -9
- package/dist/components/accordion/accordionItem.mjs +1 -1
- package/dist/components/accordion/index.js +14 -12
- package/dist/components/accordion/index.mjs +2 -2
- package/dist/components/table/index.js +43 -32
- package/dist/components/table/index.mjs +2 -2
- package/dist/components/table/table-body.js +13 -2
- package/dist/components/table/table-body.mjs +2 -2
- package/dist/components/table/table-head.js +41 -28
- package/dist/components/table/table-head.mjs +2 -2
- package/dist/components/table/table.js +39 -28
- package/dist/components/table/table.mjs +2 -2
- package/dist/index.js +234 -221
- package/dist/index.mjs +15 -15
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -153,7 +153,7 @@ __export(index_exports, {
|
|
|
153
153
|
module.exports = __toCommonJS(index_exports);
|
|
154
154
|
|
|
155
155
|
// src/components/accordion/accordion.tsx
|
|
156
|
-
var import_react =
|
|
156
|
+
var import_react = require("react");
|
|
157
157
|
|
|
158
158
|
// src/utils/tailwind-variants.ts
|
|
159
159
|
var import_tailwind_variants = require("tailwind-variants");
|
|
@@ -781,8 +781,8 @@ var Accordion = (0, import_react.forwardRef)((originalProps, ref) => {
|
|
|
781
781
|
}
|
|
782
782
|
});
|
|
783
783
|
};
|
|
784
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { ref, className: slots.base({ class: classNames == null ? void 0 : classNames.base }), children: import_react.
|
|
785
|
-
return import_react.
|
|
784
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { ref, className: slots.base({ class: classNames == null ? void 0 : classNames.base }), children: import_react.Children.map(children, (child, index) => {
|
|
785
|
+
return (0, import_react.cloneElement)(child, {
|
|
786
786
|
...variantProps,
|
|
787
787
|
...child.props,
|
|
788
788
|
isInGroup: true,
|
|
@@ -894,8 +894,8 @@ var AccordionItem = (0, import_react2.forwardRef)((originalProps, ref) => {
|
|
|
894
894
|
}
|
|
895
895
|
};
|
|
896
896
|
}, [slots, classNames == null ? void 0 : classNames.content, contentHeight, isOpen, disableAnimation]);
|
|
897
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { ref, className: slots.base({ class: classNames == null ? void 0 : classNames.base }), children: [
|
|
898
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { "data-isopen": isOpen, className: slots.header({ class: classNames == null ? void 0 : classNames.header }),
|
|
897
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { ref, className: slots.base({ class: classNames == null ? void 0 : classNames.base }), onClick: handleToggle, children: [
|
|
898
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { "data-isopen": isOpen, className: slots.header({ class: classNames == null ? void 0 : classNames.header }), children: [
|
|
899
899
|
startContent && renderContent(startContent),
|
|
900
900
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: slots.headerTitle({ class: classNames == null ? void 0 : classNames.headerTitle }), children: title }),
|
|
901
901
|
endContent && renderContent(endContent)
|
|
@@ -907,16 +907,18 @@ AccordionItem.displayName = "AccordionItem";
|
|
|
907
907
|
var accordionItem_default = AccordionItem;
|
|
908
908
|
var accordionItem = tv({
|
|
909
909
|
slots: {
|
|
910
|
-
base: [
|
|
911
|
-
|
|
910
|
+
base: [
|
|
911
|
+
"group/accordion",
|
|
912
|
+
"w-full",
|
|
912
913
|
"flex",
|
|
913
|
-
"
|
|
914
|
-
"
|
|
915
|
-
"
|
|
914
|
+
"flex-col",
|
|
915
|
+
"gap-[12px]",
|
|
916
|
+
"p-[12px]",
|
|
917
|
+
"bg-body-background",
|
|
916
918
|
"cursor-pointer",
|
|
917
|
-
"select-none"
|
|
918
|
-
"gap-[8px]"
|
|
919
|
+
"select-none"
|
|
919
920
|
],
|
|
921
|
+
header: ["flex", "justify-between", "items-center", "text-foreground", "gap-[8px]"],
|
|
920
922
|
headerTitle: ["w-full", "font-bold", "text-body-foreground"],
|
|
921
923
|
content: [
|
|
922
924
|
"overflow-hidden",
|
|
@@ -7971,7 +7973,7 @@ var textareaStyle = (0, import_tailwind_variants13.tv)({
|
|
|
7971
7973
|
});
|
|
7972
7974
|
|
|
7973
7975
|
// src/components/table/table.tsx
|
|
7974
|
-
var
|
|
7976
|
+
var import_react18 = require("react");
|
|
7975
7977
|
var import_tailwind_variants17 = require("tailwind-variants");
|
|
7976
7978
|
|
|
7977
7979
|
// src/components/checkbox/checkbox.tsx
|
|
@@ -8229,6 +8231,7 @@ var TableHead = ({
|
|
|
8229
8231
|
var table_head_default = TableHead;
|
|
8230
8232
|
|
|
8231
8233
|
// src/components/table/table-body.tsx
|
|
8234
|
+
var import_react15 = require("react");
|
|
8232
8235
|
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
8233
8236
|
var TableBody = ({
|
|
8234
8237
|
slots,
|
|
@@ -8245,6 +8248,7 @@ var TableBody = ({
|
|
|
8245
8248
|
classNames,
|
|
8246
8249
|
className
|
|
8247
8250
|
}) => {
|
|
8251
|
+
const checkOverflow = (el) => el.scrollWidth > el.clientWidth;
|
|
8248
8252
|
const renderCheckboxCell = (rowId, rowIndex) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
8249
8253
|
"td",
|
|
8250
8254
|
{
|
|
@@ -8266,11 +8270,20 @@ var TableBody = ({
|
|
|
8266
8270
|
const value = row[column.field];
|
|
8267
8271
|
const formattedValue = ((_a = column.valueFormatter) == null ? void 0 : _a.call(column, { value, field: column.field })) || value;
|
|
8268
8272
|
const content = column.renderCell ? column.renderCell({ id: row.id, field: column.field, value, formattedValue, row }) : formattedValue;
|
|
8273
|
+
const tdRef = (0, import_react15.useRef)(null);
|
|
8274
|
+
const [showTitle, setShowTitle] = (0, import_react15.useState)(false);
|
|
8275
|
+
(0, import_react15.useEffect)(() => {
|
|
8276
|
+
if (tdRef.current) {
|
|
8277
|
+
setShowTitle(checkOverflow(tdRef.current));
|
|
8278
|
+
}
|
|
8279
|
+
}, [content]);
|
|
8269
8280
|
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
8270
8281
|
"td",
|
|
8271
8282
|
{
|
|
8272
|
-
|
|
8273
|
-
|
|
8283
|
+
ref: tdRef,
|
|
8284
|
+
className: clsx(slots.td(), classNames == null ? void 0 : classNames.td, column.className, "truncate"),
|
|
8285
|
+
style: { ...getCellStyle(column), maxWidth: column.width || "150px" },
|
|
8286
|
+
title: showTitle ? String(content) : void 0,
|
|
8274
8287
|
children: content
|
|
8275
8288
|
},
|
|
8276
8289
|
`${row.id}-${column.field}-${colIdx}-${rowIndex}`
|
|
@@ -8297,18 +8310,18 @@ var TableBody = ({
|
|
|
8297
8310
|
var table_body_default = TableBody;
|
|
8298
8311
|
|
|
8299
8312
|
// src/components/pagination/pagination.tsx
|
|
8300
|
-
var
|
|
8313
|
+
var import_react17 = require("react");
|
|
8301
8314
|
|
|
8302
8315
|
// src/components/pagination/usePagination.ts
|
|
8303
|
-
var
|
|
8316
|
+
var import_react16 = require("react");
|
|
8304
8317
|
var usePagination = ({ currentPage, totalPage, groupSize, handleChangePage }) => {
|
|
8305
|
-
const startPage = (0,
|
|
8306
|
-
const endPage = (0,
|
|
8307
|
-
const pageList = (0,
|
|
8318
|
+
const startPage = (0, import_react16.useMemo)(() => Math.floor((currentPage - 1) / groupSize) * groupSize + 1, [currentPage, groupSize]);
|
|
8319
|
+
const endPage = (0, import_react16.useMemo)(() => Math.min(startPage + groupSize - 1, totalPage), [startPage, groupSize, totalPage]);
|
|
8320
|
+
const pageList = (0, import_react16.useMemo)(
|
|
8308
8321
|
() => Array.from({ length: endPage - startPage + 1 }, (_, i) => startPage + i),
|
|
8309
8322
|
[startPage, endPage]
|
|
8310
8323
|
);
|
|
8311
|
-
const handleClickMovePage = (0,
|
|
8324
|
+
const handleClickMovePage = (0, import_react16.useCallback)(
|
|
8312
8325
|
(page) => (event) => {
|
|
8313
8326
|
event.preventDefault();
|
|
8314
8327
|
handleChangePage == null ? void 0 : handleChangePage(page);
|
|
@@ -8326,7 +8339,7 @@ var usePagination_default = usePagination;
|
|
|
8326
8339
|
|
|
8327
8340
|
// src/components/pagination/pagination.tsx
|
|
8328
8341
|
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
8329
|
-
var Pagination = (0,
|
|
8342
|
+
var Pagination = (0, import_react17.forwardRef)((originalProps, ref) => {
|
|
8330
8343
|
const [props, variantProps] = mapPropsVariants(originalProps, paginationStyle.variantKeys);
|
|
8331
8344
|
const {
|
|
8332
8345
|
classNames,
|
|
@@ -8340,12 +8353,12 @@ var Pagination = (0, import_react16.forwardRef)((originalProps, ref) => {
|
|
|
8340
8353
|
variant,
|
|
8341
8354
|
size
|
|
8342
8355
|
} = { ...props, ...variantProps };
|
|
8343
|
-
const [inputPage, setInputPage] = (0,
|
|
8356
|
+
const [inputPage, setInputPage] = (0, import_react17.useState)(currentPage);
|
|
8344
8357
|
const isFirstPageDisabled = currentPage <= 1;
|
|
8345
8358
|
const isPrevPageDisabled = currentPage <= 1;
|
|
8346
8359
|
const isNextPageDisabled = currentPage >= totalPage;
|
|
8347
8360
|
const isLastPageDisabled = currentPage >= totalPage;
|
|
8348
|
-
const slots = (0,
|
|
8361
|
+
const slots = (0, import_react17.useMemo)(() => paginationStyle(variantProps), [variantProps]);
|
|
8349
8362
|
const { pageList, handleClickMovePage } = usePagination_default({
|
|
8350
8363
|
currentPage,
|
|
8351
8364
|
totalPage,
|
|
@@ -8713,7 +8726,7 @@ var scrollAreaStyle = (0, import_tailwind_variants16.tv)({
|
|
|
8713
8726
|
|
|
8714
8727
|
// src/components/table/table.tsx
|
|
8715
8728
|
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
8716
|
-
var Table = (0,
|
|
8729
|
+
var Table = (0, import_react18.forwardRef)((originalProps, ref) => {
|
|
8717
8730
|
const [props, variantProps] = mapPropsVariants(originalProps, tableStyle.variantKeys);
|
|
8718
8731
|
const {
|
|
8719
8732
|
rows,
|
|
@@ -8738,8 +8751,8 @@ var Table = (0, import_react17.forwardRef)((originalProps, ref) => {
|
|
|
8738
8751
|
} = { ...props, ...variantProps };
|
|
8739
8752
|
const { page = 1, perPage = 15 } = pagination || {};
|
|
8740
8753
|
const showPagination = pagination && totalData > 0;
|
|
8741
|
-
const [checkedRowIds, setCheckedRowIds] = (0,
|
|
8742
|
-
const tableMinWidth = (0,
|
|
8754
|
+
const [checkedRowIds, setCheckedRowIds] = (0, import_react18.useState)(new Set(checkedRows == null ? void 0 : checkedRows.map((row) => row.id)));
|
|
8755
|
+
const tableMinWidth = (0, import_react18.useMemo)(() => {
|
|
8743
8756
|
const columnsWidth = columns.reduce((total, column) => {
|
|
8744
8757
|
if (column.width) return total + column.width;
|
|
8745
8758
|
if (column.minWidth) return total + column.minWidth;
|
|
@@ -8748,10 +8761,10 @@ var Table = (0, import_react17.forwardRef)((originalProps, ref) => {
|
|
|
8748
8761
|
const checkboxWidth = rowCheckbox ? 40 : 0;
|
|
8749
8762
|
return columnsWidth + checkboxWidth;
|
|
8750
8763
|
}, [columns, rowCheckbox]);
|
|
8751
|
-
(0,
|
|
8764
|
+
(0, import_react18.useEffect)(() => {
|
|
8752
8765
|
onCheckedRowsChange == null ? void 0 : onCheckedRowsChange(getCheckedRowData(checkedRowIds));
|
|
8753
8766
|
}, [checkedRowIds]);
|
|
8754
|
-
(0,
|
|
8767
|
+
(0, import_react18.useEffect)(() => {
|
|
8755
8768
|
const currentRowIds = new Set(rows.map((row) => row.id));
|
|
8756
8769
|
const ids = Array.from(checkedRowIds);
|
|
8757
8770
|
const hasValidCheckedRows = ids.every((id) => currentRowIds.has(id));
|
|
@@ -8759,7 +8772,7 @@ var Table = (0, import_react17.forwardRef)((originalProps, ref) => {
|
|
|
8759
8772
|
setCheckedRowIds(new Set(checkedRows == null ? void 0 : checkedRows.map((row) => row.id)));
|
|
8760
8773
|
}
|
|
8761
8774
|
}, [rows.map((row) => row.id).join(",")]);
|
|
8762
|
-
(0,
|
|
8775
|
+
(0, import_react18.useImperativeHandle)(
|
|
8763
8776
|
ref,
|
|
8764
8777
|
() => ({
|
|
8765
8778
|
checkedRowIds,
|
|
@@ -8786,7 +8799,7 @@ var Table = (0, import_react17.forwardRef)((originalProps, ref) => {
|
|
|
8786
8799
|
onRowClick == null ? void 0 : onRowClick(row, index, event);
|
|
8787
8800
|
};
|
|
8788
8801
|
const getCheckedRowData = (checked) => rows.filter((row) => checked.has(row.id));
|
|
8789
|
-
const slots = (0,
|
|
8802
|
+
const slots = (0, import_react18.useMemo)(
|
|
8790
8803
|
() => tableStyle({ ...variantProps, rowClickable: typeof onRowClick === "function" }),
|
|
8791
8804
|
[variantProps, onRowClick]
|
|
8792
8805
|
);
|
|
@@ -9105,7 +9118,7 @@ var getCellStyle = (column) => {
|
|
|
9105
9118
|
};
|
|
9106
9119
|
|
|
9107
9120
|
// src/components/table/definition-table.tsx
|
|
9108
|
-
var
|
|
9121
|
+
var import_react19 = require("react");
|
|
9109
9122
|
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
9110
9123
|
var DEFAULT_CELL_CLASSES = "px-[10px] py-[8px] text-md border-r border-neutral-light h-[50px]";
|
|
9111
9124
|
var FIRST_CELL_WIDTH_CLASS = "w-[120px] font-bold text-md text-body-foreground";
|
|
@@ -9198,10 +9211,10 @@ var DefinitionTableRow = ({
|
|
|
9198
9211
|
colIndex
|
|
9199
9212
|
);
|
|
9200
9213
|
}) });
|
|
9201
|
-
var DefinitionTable = (0,
|
|
9214
|
+
var DefinitionTable = (0, import_react19.forwardRef)(
|
|
9202
9215
|
({ rows = [], footer, highlightColumnKey, classNames }, ref) => {
|
|
9203
|
-
const slots = (0,
|
|
9204
|
-
const highlightColumnIndex = (0,
|
|
9216
|
+
const slots = (0, import_react19.useMemo)(() => DefinitionTableStyle(), []);
|
|
9217
|
+
const highlightColumnIndex = (0, import_react19.useMemo)(
|
|
9205
9218
|
() => getHighlightColumnIndex(rows, highlightColumnKey),
|
|
9206
9219
|
[rows, highlightColumnKey]
|
|
9207
9220
|
);
|
|
@@ -9234,10 +9247,10 @@ var DefinitionTableStyle = tv({
|
|
|
9234
9247
|
});
|
|
9235
9248
|
|
|
9236
9249
|
// src/components/select/select.tsx
|
|
9237
|
-
var
|
|
9250
|
+
var import_react20 = require("react");
|
|
9238
9251
|
var import_react_dom = require("react-dom");
|
|
9239
9252
|
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
9240
|
-
var Select = (0,
|
|
9253
|
+
var Select = (0, import_react20.forwardRef)((originalProps, ref) => {
|
|
9241
9254
|
var _a, _b;
|
|
9242
9255
|
const [props, variantProps] = mapPropsVariants(originalProps, select.variantKeys);
|
|
9243
9256
|
const {
|
|
@@ -9254,14 +9267,14 @@ var Select = (0, import_react19.forwardRef)((originalProps, ref) => {
|
|
|
9254
9267
|
optionIconPlacement,
|
|
9255
9268
|
...inputProps
|
|
9256
9269
|
} = props;
|
|
9257
|
-
const slots = (0,
|
|
9258
|
-
const [selectedOptions, setSelectedOptions] = (0,
|
|
9259
|
-
const [targetRect, setTargetRect] = (0,
|
|
9260
|
-
const [optionWrapperHeight, setOptionWrapperHeight] = (0,
|
|
9261
|
-
const [isVisible, setIsVisible] = (0,
|
|
9262
|
-
const [isOpen, setIsOpen] = (0,
|
|
9263
|
-
const selectWrapperRef = (0,
|
|
9264
|
-
const optionWrapperRef = (0,
|
|
9270
|
+
const slots = (0, import_react20.useMemo)(() => select({ ...variantProps }), [variantProps]);
|
|
9271
|
+
const [selectedOptions, setSelectedOptions] = (0, import_react20.useState)(defaultSelectedOptions || []);
|
|
9272
|
+
const [targetRect, setTargetRect] = (0, import_react20.useState)(null);
|
|
9273
|
+
const [optionWrapperHeight, setOptionWrapperHeight] = (0, import_react20.useState)(0);
|
|
9274
|
+
const [isVisible, setIsVisible] = (0, import_react20.useState)(false);
|
|
9275
|
+
const [isOpen, setIsOpen] = (0, import_react20.useState)(false);
|
|
9276
|
+
const selectWrapperRef = (0, import_react20.useRef)(null);
|
|
9277
|
+
const optionWrapperRef = (0, import_react20.useRef)(null);
|
|
9265
9278
|
const isControlled = originalProps.value !== void 0;
|
|
9266
9279
|
const openSelect = () => {
|
|
9267
9280
|
if (selectWrapperRef.current) {
|
|
@@ -9301,7 +9314,7 @@ var Select = (0, import_react19.forwardRef)((originalProps, ref) => {
|
|
|
9301
9314
|
setSelectedOptions(nextOptions);
|
|
9302
9315
|
onChange == null ? void 0 : onChange(nextOptions);
|
|
9303
9316
|
};
|
|
9304
|
-
(0,
|
|
9317
|
+
(0, import_react20.useEffect)(() => {
|
|
9305
9318
|
const handleClickOutside = (e) => {
|
|
9306
9319
|
var _a2;
|
|
9307
9320
|
const target = e.target;
|
|
@@ -9312,12 +9325,12 @@ var Select = (0, import_react19.forwardRef)((originalProps, ref) => {
|
|
|
9312
9325
|
window.addEventListener("mousedown", handleClickOutside);
|
|
9313
9326
|
return () => window.removeEventListener("mousedown", handleClickOutside);
|
|
9314
9327
|
}, []);
|
|
9315
|
-
(0,
|
|
9328
|
+
(0, import_react20.useEffect)(() => {
|
|
9316
9329
|
if (optionWrapperRef.current) {
|
|
9317
9330
|
setOptionWrapperHeight(optionWrapperRef.current.getBoundingClientRect().height);
|
|
9318
9331
|
}
|
|
9319
9332
|
}, [targetRect]);
|
|
9320
|
-
(0,
|
|
9333
|
+
(0, import_react20.useEffect)(() => {
|
|
9321
9334
|
if (isControlled) {
|
|
9322
9335
|
const valueArray = Array.isArray(originalProps.value) ? originalProps.value : [originalProps.value];
|
|
9323
9336
|
const matched = options.filter((opt) => valueArray.includes(opt.value));
|
|
@@ -9687,14 +9700,14 @@ var select = tv({
|
|
|
9687
9700
|
});
|
|
9688
9701
|
|
|
9689
9702
|
// src/components/chip/chip.tsx
|
|
9690
|
-
var
|
|
9703
|
+
var import_react21 = require("react");
|
|
9691
9704
|
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
9692
|
-
var Chip = (0,
|
|
9705
|
+
var Chip = (0, import_react21.forwardRef)((originalProps, ref) => {
|
|
9693
9706
|
var _a;
|
|
9694
9707
|
const [rawProps, variantProps] = mapPropsVariants(originalProps, chipStyle.variantKeys);
|
|
9695
9708
|
const props = { ...rawProps, ...variantProps };
|
|
9696
9709
|
const Component = props.onClick ? "button" : "div";
|
|
9697
|
-
const slots = (0,
|
|
9710
|
+
const slots = (0, import_react21.useMemo)(() => chipStyle({ ...variantProps }), [variantProps]);
|
|
9698
9711
|
const renderIcon = (name) => name ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Icon_default, { name, fill: true, size: props.size, className: slots.icon() }) : null;
|
|
9699
9712
|
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
9700
9713
|
Component,
|
|
@@ -9872,12 +9885,12 @@ var chipStyle = tv({
|
|
|
9872
9885
|
});
|
|
9873
9886
|
|
|
9874
9887
|
// src/components/radio/radio.tsx
|
|
9875
|
-
var
|
|
9888
|
+
var import_react22 = require("react");
|
|
9876
9889
|
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
9877
|
-
var Radio = (0,
|
|
9890
|
+
var Radio = (0, import_react22.forwardRef)((originalProps, ref) => {
|
|
9878
9891
|
const [props, variantProps] = mapPropsVariants(originalProps, radioStyle.variantKeys);
|
|
9879
9892
|
const { children, classNames, labelPosition = "end", ...inputProps } = props;
|
|
9880
|
-
const slots = (0,
|
|
9893
|
+
const slots = (0, import_react22.useMemo)(() => radioStyle({ ...variantProps }), [variantProps]);
|
|
9881
9894
|
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
9882
9895
|
"label",
|
|
9883
9896
|
{
|
|
@@ -10042,16 +10055,16 @@ var radioStyle = tv({
|
|
|
10042
10055
|
});
|
|
10043
10056
|
|
|
10044
10057
|
// src/components/switch/switch.tsx
|
|
10045
|
-
var
|
|
10058
|
+
var import_react23 = require("react");
|
|
10046
10059
|
var import_tailwind_variants22 = require("tailwind-variants");
|
|
10047
10060
|
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
10048
|
-
var Switch = (0,
|
|
10061
|
+
var Switch = (0, import_react23.forwardRef)((originalProps, ref) => {
|
|
10049
10062
|
const [rawProps, variantProps] = mapPropsVariants(originalProps, switchStyle.variantKeys);
|
|
10050
10063
|
const { size, color, disabled, disableAnimation, id, checked, onChange, classNames, ...inputProps } = {
|
|
10051
10064
|
...rawProps,
|
|
10052
10065
|
...variantProps
|
|
10053
10066
|
};
|
|
10054
|
-
const slots = (0,
|
|
10067
|
+
const slots = (0, import_react23.useMemo)(() => switchStyle({ ...variantProps }), [variantProps]);
|
|
10055
10068
|
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: slots.base({ class: classNames == null ? void 0 : classNames.base }), children: [
|
|
10056
10069
|
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
10057
10070
|
"input",
|
|
@@ -10176,7 +10189,7 @@ var switchStyle = (0, import_tailwind_variants22.tv)({
|
|
|
10176
10189
|
});
|
|
10177
10190
|
|
|
10178
10191
|
// src/components/tooltip/tooltip.tsx
|
|
10179
|
-
var
|
|
10192
|
+
var import_react25 = require("react");
|
|
10180
10193
|
var import_react_dom2 = require("react-dom");
|
|
10181
10194
|
|
|
10182
10195
|
// src/components/tooltip/tooltip-utils.ts
|
|
@@ -10299,11 +10312,11 @@ var getTailStyles = (placement) => {
|
|
|
10299
10312
|
};
|
|
10300
10313
|
|
|
10301
10314
|
// src/components/tooltip/useTooltip.ts
|
|
10302
|
-
var
|
|
10315
|
+
var import_react24 = require("react");
|
|
10303
10316
|
var useTooltip = ({ placement, offset, targetRect }) => {
|
|
10304
|
-
const [tooltipPosition, setTooltipPosition] = (0,
|
|
10305
|
-
const tooltipRef = (0,
|
|
10306
|
-
(0,
|
|
10317
|
+
const [tooltipPosition, setTooltipPosition] = (0, import_react24.useState)({ x: 0, y: 0 });
|
|
10318
|
+
const tooltipRef = (0, import_react24.useRef)(null);
|
|
10319
|
+
(0, import_react24.useEffect)(() => {
|
|
10307
10320
|
if (targetRect && tooltipRef.current) {
|
|
10308
10321
|
const { width, height } = tooltipRef.current.getBoundingClientRect();
|
|
10309
10322
|
const scrollX = window.scrollX;
|
|
@@ -10334,28 +10347,28 @@ var useTooltip = ({ placement, offset, targetRect }) => {
|
|
|
10334
10347
|
|
|
10335
10348
|
// src/components/tooltip/tooltip.tsx
|
|
10336
10349
|
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
10337
|
-
var Tooltip = (0,
|
|
10350
|
+
var Tooltip = (0, import_react25.forwardRef)((originalProps, ref) => {
|
|
10338
10351
|
const [props, variantProps] = mapPropsVariants(originalProps, tooltipStyle.variantKeys);
|
|
10339
10352
|
const { placement = "top", offset = 5, delay = 100, persistent = false, classNames, noTouchContent } = props;
|
|
10340
|
-
const slots = (0,
|
|
10341
|
-
const [targetRect, setTargetRect] = (0,
|
|
10353
|
+
const slots = (0, import_react25.useMemo)(() => tooltipStyle({ ...variantProps }), [variantProps]);
|
|
10354
|
+
const [targetRect, setTargetRect] = (0, import_react25.useState)(null);
|
|
10342
10355
|
const { tooltipPosition, tooltipRef } = useTooltip({
|
|
10343
10356
|
placement,
|
|
10344
10357
|
offset,
|
|
10345
10358
|
delay,
|
|
10346
10359
|
targetRect
|
|
10347
10360
|
});
|
|
10348
|
-
const childrenRef = (0,
|
|
10349
|
-
const delayTimeoutRef = (0,
|
|
10350
|
-
const getProps = (0,
|
|
10361
|
+
const childrenRef = (0, import_react25.useRef)(null);
|
|
10362
|
+
const delayTimeoutRef = (0, import_react25.useRef)(null);
|
|
10363
|
+
const getProps = (0, import_react25.useCallback)(
|
|
10351
10364
|
(slotKey, classNameKey) => ({
|
|
10352
10365
|
className: slots[slotKey]({ class: classNames == null ? void 0 : classNames[classNameKey] })
|
|
10353
10366
|
}),
|
|
10354
10367
|
[slots, classNames]
|
|
10355
10368
|
);
|
|
10356
|
-
const getBaseProps = (0,
|
|
10357
|
-
const getContentProps = (0,
|
|
10358
|
-
const showTooltip = (0,
|
|
10369
|
+
const getBaseProps = (0, import_react25.useCallback)(() => getProps("base", "base"), [getProps]);
|
|
10370
|
+
const getContentProps = (0, import_react25.useCallback)(() => getProps("content", "content"), [getProps]);
|
|
10371
|
+
const showTooltip = (0, import_react25.useCallback)(() => {
|
|
10359
10372
|
if (childrenRef.current) {
|
|
10360
10373
|
const rect = childrenRef.current.getBoundingClientRect();
|
|
10361
10374
|
setTargetRect({
|
|
@@ -10368,12 +10381,12 @@ var Tooltip = (0, import_react24.forwardRef)((originalProps, ref) => {
|
|
|
10368
10381
|
});
|
|
10369
10382
|
}
|
|
10370
10383
|
}, []);
|
|
10371
|
-
const hideTooltip = (0,
|
|
10384
|
+
const hideTooltip = (0, import_react25.useCallback)(() => {
|
|
10372
10385
|
if (!persistent) {
|
|
10373
10386
|
delayTimeoutRef.current = window.setTimeout(() => setTargetRect(null), delay);
|
|
10374
10387
|
}
|
|
10375
10388
|
}, [persistent, delay]);
|
|
10376
|
-
(0,
|
|
10389
|
+
(0, import_react25.useEffect)(() => {
|
|
10377
10390
|
if (persistent) showTooltip();
|
|
10378
10391
|
}, [persistent, showTooltip]);
|
|
10379
10392
|
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_jsx_runtime27.Fragment, { children: [
|
|
@@ -10458,10 +10471,10 @@ var tooltipStyle = tv({
|
|
|
10458
10471
|
});
|
|
10459
10472
|
|
|
10460
10473
|
// src/components/modal/modal.tsx
|
|
10461
|
-
var
|
|
10474
|
+
var import_react26 = require("react");
|
|
10462
10475
|
var import_react_dom3 = require("react-dom");
|
|
10463
10476
|
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
10464
|
-
var Modal = (0,
|
|
10477
|
+
var Modal = (0, import_react26.forwardRef)((props, ref) => {
|
|
10465
10478
|
const [localProps, variantProps] = mapPropsVariants(props, modal.variantKeys);
|
|
10466
10479
|
const {
|
|
10467
10480
|
classNames,
|
|
@@ -10476,8 +10489,8 @@ var Modal = (0, import_react25.forwardRef)((props, ref) => {
|
|
|
10476
10489
|
onCancel,
|
|
10477
10490
|
extraFooter
|
|
10478
10491
|
} = localProps;
|
|
10479
|
-
const slots = (0,
|
|
10480
|
-
(0,
|
|
10492
|
+
const slots = (0, import_react26.useMemo)(() => modal(variantProps), [variantProps]);
|
|
10493
|
+
(0, import_react26.useEffect)(() => {
|
|
10481
10494
|
document.body.classList.toggle("overflow-hidden", !!isOpen);
|
|
10482
10495
|
if (!isOpen || isKeyboardDismissDisabled) return;
|
|
10483
10496
|
const handleKeyDown = (e) => {
|
|
@@ -10579,18 +10592,18 @@ var modal = tv({
|
|
|
10579
10592
|
});
|
|
10580
10593
|
|
|
10581
10594
|
// src/components/drawer/drawer.tsx
|
|
10582
|
-
var
|
|
10595
|
+
var import_react27 = require("react");
|
|
10583
10596
|
var import_react_dom4 = require("react-dom");
|
|
10584
10597
|
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
10585
|
-
var Drawer = (0,
|
|
10598
|
+
var Drawer = (0, import_react27.forwardRef)((props, ref) => {
|
|
10586
10599
|
const [localProps, variantProps] = mapPropsVariants(props, drawer.variantKeys);
|
|
10587
10600
|
const { classNames, isOpen, content, isKeyboardDismissDisabled = false, onClose, backdrop = true } = localProps;
|
|
10588
10601
|
const position = props.position || "right";
|
|
10589
|
-
const [shouldRender, setShouldRender] = (0,
|
|
10590
|
-
const [isAnimating, setIsAnimating] = (0,
|
|
10591
|
-
const [isContentAnimating, setIsContentAnimating] = (0,
|
|
10592
|
-
const slots = (0,
|
|
10593
|
-
(0,
|
|
10602
|
+
const [shouldRender, setShouldRender] = (0, import_react27.useState)(isOpen);
|
|
10603
|
+
const [isAnimating, setIsAnimating] = (0, import_react27.useState)(isOpen);
|
|
10604
|
+
const [isContentAnimating, setIsContentAnimating] = (0, import_react27.useState)(isOpen);
|
|
10605
|
+
const slots = (0, import_react27.useMemo)(() => drawer(variantProps), [variantProps]);
|
|
10606
|
+
(0, import_react27.useEffect)(() => {
|
|
10594
10607
|
if (isOpen) {
|
|
10595
10608
|
setShouldRender(true);
|
|
10596
10609
|
requestAnimationFrame(() => {
|
|
@@ -10608,7 +10621,7 @@ var Drawer = (0, import_react26.forwardRef)((props, ref) => {
|
|
|
10608
10621
|
return () => clearTimeout(timer);
|
|
10609
10622
|
}
|
|
10610
10623
|
}, [isOpen]);
|
|
10611
|
-
(0,
|
|
10624
|
+
(0, import_react27.useEffect)(() => {
|
|
10612
10625
|
if (shouldRender) {
|
|
10613
10626
|
document.body.classList.add("overflow-hidden");
|
|
10614
10627
|
} else {
|
|
@@ -10739,15 +10752,15 @@ var drawer = tv({
|
|
|
10739
10752
|
var drawer_default = Drawer;
|
|
10740
10753
|
|
|
10741
10754
|
// src/components/list/list.tsx
|
|
10742
|
-
var
|
|
10755
|
+
var import_react28 = require("react");
|
|
10743
10756
|
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
10744
|
-
var List = (0,
|
|
10757
|
+
var List = (0, import_react28.forwardRef)((originalProps, ref) => {
|
|
10745
10758
|
const [props, variantProps] = mapPropsVariants(originalProps, listStyle.variantKeys);
|
|
10746
10759
|
const { children, classNames } = props;
|
|
10747
|
-
const slots = (0,
|
|
10748
|
-
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { ref, className: slots.base({ class: classNames == null ? void 0 : classNames.base }), children:
|
|
10749
|
-
if (!(0,
|
|
10750
|
-
return (0,
|
|
10760
|
+
const slots = (0, import_react28.useMemo)(() => listStyle(variantProps), [variantProps]);
|
|
10761
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { ref, className: slots.base({ class: classNames == null ? void 0 : classNames.base }), children: import_react28.Children.map(children, (child) => {
|
|
10762
|
+
if (!(0, import_react28.isValidElement)(child)) return child;
|
|
10763
|
+
return (0, import_react28.cloneElement)(child, {
|
|
10751
10764
|
...variantProps,
|
|
10752
10765
|
...child.props
|
|
10753
10766
|
});
|
|
@@ -10784,9 +10797,9 @@ var listStyle = tv({
|
|
|
10784
10797
|
});
|
|
10785
10798
|
|
|
10786
10799
|
// src/components/list/listItem.tsx
|
|
10787
|
-
var
|
|
10800
|
+
var import_react29 = require("react");
|
|
10788
10801
|
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
10789
|
-
var ListItem = (0,
|
|
10802
|
+
var ListItem = (0, import_react29.forwardRef)((props, ref) => {
|
|
10790
10803
|
const [rawProps, variantProps] = mapPropsVariants(props, listItemStyle.variantKeys);
|
|
10791
10804
|
const {
|
|
10792
10805
|
title,
|
|
@@ -10798,7 +10811,7 @@ var ListItem = (0, import_react28.forwardRef)((props, ref) => {
|
|
|
10798
10811
|
classNames,
|
|
10799
10812
|
onClick
|
|
10800
10813
|
} = { ...rawProps, ...variantProps };
|
|
10801
|
-
const slots = (0,
|
|
10814
|
+
const slots = (0, import_react29.useMemo)(() => listItemStyle(variantProps), [variantProps]);
|
|
10802
10815
|
const iconSize = ["lg", "xl"].includes(size) ? "lg" : "md";
|
|
10803
10816
|
const avatarSize = iconSize;
|
|
10804
10817
|
return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { ref, className: slots.base({ class: classNames == null ? void 0 : classNames.base }), "data-selected": selected, onClick, children: [
|
|
@@ -10978,9 +10991,9 @@ var listItemStyle = tv({
|
|
|
10978
10991
|
});
|
|
10979
10992
|
|
|
10980
10993
|
// src/components/toast/toast.tsx
|
|
10981
|
-
var
|
|
10994
|
+
var import_react30 = require("react");
|
|
10982
10995
|
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
10983
|
-
var Toast = (0,
|
|
10996
|
+
var Toast = (0, import_react30.forwardRef)((originalProps, ref) => {
|
|
10984
10997
|
const [props, variantProps] = mapPropsVariants(originalProps, toast.variantKeys);
|
|
10985
10998
|
const {
|
|
10986
10999
|
title,
|
|
@@ -10994,9 +11007,9 @@ var Toast = (0, import_react29.forwardRef)((originalProps, ref) => {
|
|
|
10994
11007
|
disableAnimation,
|
|
10995
11008
|
onClose
|
|
10996
11009
|
} = { ...props, ...variantProps };
|
|
10997
|
-
const slots = (0,
|
|
10998
|
-
const toastRef = (0,
|
|
10999
|
-
(0,
|
|
11010
|
+
const slots = (0, import_react30.useMemo)(() => toast({ ...variantProps }), [variantProps]);
|
|
11011
|
+
const toastRef = (0, import_react30.useRef)(null);
|
|
11012
|
+
(0, import_react30.useImperativeHandle)(
|
|
11000
11013
|
ref,
|
|
11001
11014
|
() => ({
|
|
11002
11015
|
getWidth: () => {
|
|
@@ -11129,7 +11142,7 @@ var toast = tv({
|
|
|
11129
11142
|
});
|
|
11130
11143
|
|
|
11131
11144
|
// src/components/toast/use-toast.tsx
|
|
11132
|
-
var
|
|
11145
|
+
var import_react31 = require("react");
|
|
11133
11146
|
|
|
11134
11147
|
// src/components/toast/toast-utils.ts
|
|
11135
11148
|
var getToastPosition = (placement, width, offset) => {
|
|
@@ -11169,9 +11182,9 @@ var getToastPosition = (placement, width, offset) => {
|
|
|
11169
11182
|
|
|
11170
11183
|
// src/components/toast/use-toast.tsx
|
|
11171
11184
|
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
11172
|
-
var ToastContext = (0,
|
|
11185
|
+
var ToastContext = (0, import_react31.createContext)(null);
|
|
11173
11186
|
var useToast = () => {
|
|
11174
|
-
const context = (0,
|
|
11187
|
+
const context = (0, import_react31.useContext)(ToastContext);
|
|
11175
11188
|
if (!context) {
|
|
11176
11189
|
throw new Error("useToast must be used within a ToastProvider");
|
|
11177
11190
|
}
|
|
@@ -11181,10 +11194,10 @@ var ToastProvider = ({
|
|
|
11181
11194
|
globalOptions,
|
|
11182
11195
|
children
|
|
11183
11196
|
}) => {
|
|
11184
|
-
const [toasts, setToasts] = (0,
|
|
11185
|
-
const [containerStyle, setContainerStyle] = (0,
|
|
11186
|
-
const toastRef = (0,
|
|
11187
|
-
const addToast = (0,
|
|
11197
|
+
const [toasts, setToasts] = (0, import_react31.useState)([]);
|
|
11198
|
+
const [containerStyle, setContainerStyle] = (0, import_react31.useState)({});
|
|
11199
|
+
const toastRef = (0, import_react31.useRef)(null);
|
|
11200
|
+
const addToast = (0, import_react31.useCallback)(
|
|
11188
11201
|
(title, options = {}) => {
|
|
11189
11202
|
const id = Date.now() + Math.floor(Math.random() * 1e5);
|
|
11190
11203
|
const newToast = {
|
|
@@ -11201,11 +11214,11 @@ var ToastProvider = ({
|
|
|
11201
11214
|
},
|
|
11202
11215
|
[globalOptions]
|
|
11203
11216
|
);
|
|
11204
|
-
const removeToast = (0,
|
|
11217
|
+
const removeToast = (0, import_react31.useCallback)((id) => {
|
|
11205
11218
|
setToasts((prevToasts) => prevToasts.filter((toast2) => toast2.id !== id));
|
|
11206
11219
|
}, []);
|
|
11207
11220
|
const contextValue = addToast;
|
|
11208
|
-
(0,
|
|
11221
|
+
(0, import_react31.useEffect)(() => {
|
|
11209
11222
|
var _a;
|
|
11210
11223
|
const width = (globalOptions == null ? void 0 : globalOptions.width) ? globalOptions.width : typeof ((_a = toastRef.current) == null ? void 0 : _a.getWidth) === "function" ? toastRef.current.getWidth() : 300;
|
|
11211
11224
|
const offset = 20;
|
|
@@ -11226,12 +11239,12 @@ var ToastProvider = ({
|
|
|
11226
11239
|
};
|
|
11227
11240
|
|
|
11228
11241
|
// src/components/picker/day.tsx
|
|
11229
|
-
var
|
|
11242
|
+
var import_react32 = require("react");
|
|
11230
11243
|
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
11231
|
-
var Day = (0,
|
|
11244
|
+
var Day = (0, import_react32.forwardRef)((originalProps, ref) => {
|
|
11232
11245
|
const [props, variantProps] = mapPropsVariants(originalProps, dayStyle.variantKeys);
|
|
11233
11246
|
const { classNames, children, ...divProps } = props;
|
|
11234
|
-
const slots = (0,
|
|
11247
|
+
const slots = (0, import_react32.useMemo)(() => dayStyle({ ...variantProps }), [variantProps]);
|
|
11235
11248
|
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { ref, className: slots.base({ class: classNames == null ? void 0 : classNames.base }), ...divProps, children });
|
|
11236
11249
|
});
|
|
11237
11250
|
Day.displayName = "Day";
|
|
@@ -11268,7 +11281,7 @@ var dayStyle = tv({
|
|
|
11268
11281
|
});
|
|
11269
11282
|
|
|
11270
11283
|
// src/components/picker/datePicker.tsx
|
|
11271
|
-
var
|
|
11284
|
+
var import_react33 = require("react");
|
|
11272
11285
|
var import_react_dom5 = require("react-dom");
|
|
11273
11286
|
|
|
11274
11287
|
// src/components/picker/utils.ts
|
|
@@ -11285,7 +11298,7 @@ var formatStringToDate = (date) => {
|
|
|
11285
11298
|
|
|
11286
11299
|
// src/components/picker/datePicker.tsx
|
|
11287
11300
|
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
11288
|
-
var DatePicker = (0,
|
|
11301
|
+
var DatePicker = (0, import_react33.forwardRef)((originalProps, ref) => {
|
|
11289
11302
|
const [props, variantProps] = mapPropsVariants(originalProps, datePickerStyle.variantKeys);
|
|
11290
11303
|
const {
|
|
11291
11304
|
classNames,
|
|
@@ -11312,26 +11325,26 @@ var DatePicker = (0, import_react32.forwardRef)((originalProps, ref) => {
|
|
|
11312
11325
|
dualCalendar = false,
|
|
11313
11326
|
...inputProps
|
|
11314
11327
|
} = { ...props, ...variantProps };
|
|
11315
|
-
const [selectedDate, setSelectedDate] = (0,
|
|
11316
|
-
const [selectedRange, setSelectedRange] = (0,
|
|
11328
|
+
const [selectedDate, setSelectedDate] = (0, import_react33.useState)(range ? "" : typeof value === "string" ? value || "" : "");
|
|
11329
|
+
const [selectedRange, setSelectedRange] = (0, import_react33.useState)({
|
|
11317
11330
|
startDate: range && typeof value === "object" ? (value == null ? void 0 : value.startDate) || "" : "",
|
|
11318
11331
|
endDate: range && typeof value === "object" ? (value == null ? void 0 : value.endDate) || "" : ""
|
|
11319
11332
|
});
|
|
11320
|
-
const [tempSelectedDate, setTempSelectedDate] = (0,
|
|
11321
|
-
const [tempSelectedRange, setTempSelectedRange] = (0,
|
|
11322
|
-
const [rangeSelection, setRangeSelection] = (0,
|
|
11323
|
-
const [isPanelOpen, setIsPanelOpen] = (0,
|
|
11324
|
-
const [leftCurrentDate, setLeftCurrentDate] = (0,
|
|
11333
|
+
const [tempSelectedDate, setTempSelectedDate] = (0, import_react33.useState)(selectedDate);
|
|
11334
|
+
const [tempSelectedRange, setTempSelectedRange] = (0, import_react33.useState)(selectedRange);
|
|
11335
|
+
const [rangeSelection, setRangeSelection] = (0, import_react33.useState)("start");
|
|
11336
|
+
const [isPanelOpen, setIsPanelOpen] = (0, import_react33.useState)(false);
|
|
11337
|
+
const [leftCurrentDate, setLeftCurrentDate] = (0, import_react33.useState)(
|
|
11325
11338
|
range && tempSelectedRange.startDate ? new Date(tempSelectedRange.startDate) : tempSelectedDate ? new Date(tempSelectedDate) : /* @__PURE__ */ new Date()
|
|
11326
11339
|
);
|
|
11327
|
-
const [rightCurrentDate, setRightCurrentDate] = (0,
|
|
11340
|
+
const [rightCurrentDate, setRightCurrentDate] = (0, import_react33.useState)(
|
|
11328
11341
|
dualCalendar ? new Date(leftCurrentDate.getFullYear(), leftCurrentDate.getMonth() + 1) : /* @__PURE__ */ new Date()
|
|
11329
11342
|
);
|
|
11330
|
-
const inputWrapperRef = (0,
|
|
11331
|
-
const calendarWrapperRef = (0,
|
|
11332
|
-
const [panelPos, setPanelPos] = (0,
|
|
11333
|
-
const blurTimeoutRef = (0,
|
|
11334
|
-
const isConfirmDisabled = (0,
|
|
11343
|
+
const inputWrapperRef = (0, import_react33.useRef)(null);
|
|
11344
|
+
const calendarWrapperRef = (0, import_react33.useRef)(null);
|
|
11345
|
+
const [panelPos, setPanelPos] = (0, import_react33.useState)({ top: -9999, left: -9999 });
|
|
11346
|
+
const blurTimeoutRef = (0, import_react33.useRef)(null);
|
|
11347
|
+
const isConfirmDisabled = (0, import_react33.useMemo)(() => {
|
|
11335
11348
|
if (range) {
|
|
11336
11349
|
const hasStart = !!tempSelectedRange.startDate;
|
|
11337
11350
|
const hasEnd = !!tempSelectedRange.endDate;
|
|
@@ -11351,7 +11364,7 @@ var DatePicker = (0, import_react32.forwardRef)((originalProps, ref) => {
|
|
|
11351
11364
|
return dateString;
|
|
11352
11365
|
}
|
|
11353
11366
|
};
|
|
11354
|
-
const displayValue = (0,
|
|
11367
|
+
const displayValue = (0, import_react33.useMemo)(() => {
|
|
11355
11368
|
if (range) {
|
|
11356
11369
|
const start = formatDate(selectedRange.startDate);
|
|
11357
11370
|
const end = formatDate(selectedRange.endDate);
|
|
@@ -11361,7 +11374,7 @@ var DatePicker = (0, import_react32.forwardRef)((originalProps, ref) => {
|
|
|
11361
11374
|
}
|
|
11362
11375
|
return formatDate(selectedDate);
|
|
11363
11376
|
}, [selectedDate, selectedRange, format, range]);
|
|
11364
|
-
const calculatePosition = (0,
|
|
11377
|
+
const calculatePosition = (0, import_react33.useCallback)(() => {
|
|
11365
11378
|
if (inputWrapperRef.current) {
|
|
11366
11379
|
const rect = inputWrapperRef.current.getBoundingClientRect();
|
|
11367
11380
|
setPanelPos({ top: rect.bottom + window.scrollY + 6, left: rect.left + window.scrollX });
|
|
@@ -11404,7 +11417,7 @@ var DatePicker = (0, import_react32.forwardRef)((originalProps, ref) => {
|
|
|
11404
11417
|
e.preventDefault();
|
|
11405
11418
|
if (blurTimeoutRef.current) clearTimeout(blurTimeoutRef.current);
|
|
11406
11419
|
};
|
|
11407
|
-
const getCalendarDates = (0,
|
|
11420
|
+
const getCalendarDates = (0, import_react33.useCallback)((currentDate) => {
|
|
11408
11421
|
const year = currentDate.getFullYear();
|
|
11409
11422
|
const month = currentDate.getMonth();
|
|
11410
11423
|
const firstDayOfMonth = new Date(year, month, 1).getDay();
|
|
@@ -11500,7 +11513,7 @@ var DatePicker = (0, import_react32.forwardRef)((originalProps, ref) => {
|
|
|
11500
11513
|
}
|
|
11501
11514
|
setIsPanelOpen(false);
|
|
11502
11515
|
};
|
|
11503
|
-
const getDayProps = (0,
|
|
11516
|
+
const getDayProps = (0, import_react33.useCallback)(
|
|
11504
11517
|
(dateObj, currentDate) => {
|
|
11505
11518
|
const today = /* @__PURE__ */ new Date();
|
|
11506
11519
|
const isToday = today.getDate() === dateObj.date && today.getMonth() === currentDate.getMonth() && today.getFullYear() === currentDate.getFullYear();
|
|
@@ -11527,7 +11540,7 @@ var DatePicker = (0, import_react32.forwardRef)((originalProps, ref) => {
|
|
|
11527
11540
|
const getPlaceholderText = () => {
|
|
11528
11541
|
return placeholder;
|
|
11529
11542
|
};
|
|
11530
|
-
(0,
|
|
11543
|
+
(0, import_react33.useEffect)(() => {
|
|
11531
11544
|
if (range && typeof value === "object") {
|
|
11532
11545
|
setSelectedRange(value || { startDate: "", endDate: "" });
|
|
11533
11546
|
setTempSelectedRange(value || { startDate: "", endDate: "" });
|
|
@@ -11538,12 +11551,12 @@ var DatePicker = (0, import_react32.forwardRef)((originalProps, ref) => {
|
|
|
11538
11551
|
if (value) setLeftCurrentDate(new Date(value));
|
|
11539
11552
|
}
|
|
11540
11553
|
}, [value, range]);
|
|
11541
|
-
(0,
|
|
11554
|
+
(0, import_react33.useEffect)(() => {
|
|
11542
11555
|
if (dualCalendar) {
|
|
11543
11556
|
setRightCurrentDate(new Date(leftCurrentDate.getFullYear(), leftCurrentDate.getMonth() + 1));
|
|
11544
11557
|
}
|
|
11545
11558
|
}, [leftCurrentDate, dualCalendar]);
|
|
11546
|
-
const slots = (0,
|
|
11559
|
+
const slots = (0, import_react33.useMemo)(() => datePickerStyle({ ...variantProps, dualCalendar }), [variantProps, dualCalendar]);
|
|
11547
11560
|
const endContent = /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Icon_default, { name: "calendar", size, className: "cursor-pointer", fill: true, onClick: handleCalendarIconClick });
|
|
11548
11561
|
const renderCalendar = (currentDate, isLeft) => /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "flex flex-col gap-[5px]", children: [
|
|
11549
11562
|
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: slots.calendarHead({ class: classNames == null ? void 0 : classNames.calendarHead }), children: dualCalendar ? isLeft ? /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_jsx_runtime35.Fragment, { children: [
|
|
@@ -11560,7 +11573,7 @@ var DatePicker = (0, import_react32.forwardRef)((originalProps, ref) => {
|
|
|
11560
11573
|
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(icon_button_default, { name: "right", variant: "soft", color: "neutral", onClick: handleLeftNextMonth })
|
|
11561
11574
|
] }) }),
|
|
11562
11575
|
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "grid grid-cols-7", children: daysOfWeek.map((day, index) => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(day_default, { variant: "text", children: day }, `${day}-${index}`)) }),
|
|
11563
|
-
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "grid grid-cols-7 gap-y-[5px] text-center", children: getCalendarDates(currentDate).map((week, weekIndex) => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
11576
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "grid grid-cols-7 gap-y-[5px] text-center", children: getCalendarDates(currentDate).map((week, weekIndex) => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_react33.Fragment, { children: week.map((dateObj, index) => {
|
|
11564
11577
|
const dayVariant = getDayProps(dateObj, currentDate);
|
|
11565
11578
|
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
11566
11579
|
day_default,
|
|
@@ -11708,10 +11721,10 @@ var datePickerStyle = tv({
|
|
|
11708
11721
|
});
|
|
11709
11722
|
|
|
11710
11723
|
// src/components/picker/timePicker.tsx
|
|
11711
|
-
var
|
|
11724
|
+
var import_react34 = require("react");
|
|
11712
11725
|
var import_react_dom6 = require("react-dom");
|
|
11713
11726
|
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
11714
|
-
var TimePicker = (0,
|
|
11727
|
+
var TimePicker = (0, import_react34.forwardRef)((originalProps, ref) => {
|
|
11715
11728
|
const [props, variantProps] = mapPropsVariants(originalProps, timePickerStyle.variantKeys);
|
|
11716
11729
|
const {
|
|
11717
11730
|
classNames,
|
|
@@ -11724,20 +11737,20 @@ var TimePicker = (0, import_react33.forwardRef)((originalProps, ref) => {
|
|
|
11724
11737
|
placeholder = "",
|
|
11725
11738
|
...inputProps
|
|
11726
11739
|
} = props;
|
|
11727
|
-
const [selectedRange, setSelectedRange] = (0,
|
|
11740
|
+
const [selectedRange, setSelectedRange] = (0, import_react34.useState)(
|
|
11728
11741
|
valueRange || { start: "", end: "" }
|
|
11729
11742
|
);
|
|
11730
|
-
const [isPanelOpen, setIsPanelOpen] = (0,
|
|
11731
|
-
const inputWrapperRef = (0,
|
|
11732
|
-
const panelWrapperRef = (0,
|
|
11733
|
-
const [panelPos, setPanelPos] = (0,
|
|
11734
|
-
const displayValue = (0,
|
|
11743
|
+
const [isPanelOpen, setIsPanelOpen] = (0, import_react34.useState)(false);
|
|
11744
|
+
const inputWrapperRef = (0, import_react34.useRef)(null);
|
|
11745
|
+
const panelWrapperRef = (0, import_react34.useRef)(null);
|
|
11746
|
+
const [panelPos, setPanelPos] = (0, import_react34.useState)({ top: -9999, left: -9999 });
|
|
11747
|
+
const displayValue = (0, import_react34.useMemo)(() => {
|
|
11735
11748
|
if (selectedRange.start && selectedRange.end) {
|
|
11736
11749
|
return `${selectedRange.start} ~ ${selectedRange.end}`;
|
|
11737
11750
|
}
|
|
11738
11751
|
return "";
|
|
11739
11752
|
}, [selectedRange]);
|
|
11740
|
-
const calculatePosition = (0,
|
|
11753
|
+
const calculatePosition = (0, import_react34.useCallback)(() => {
|
|
11741
11754
|
if (inputWrapperRef.current) {
|
|
11742
11755
|
const rect = inputWrapperRef.current.getBoundingClientRect();
|
|
11743
11756
|
setPanelPos({ top: rect.bottom + window.scrollY + 6, left: rect.left + window.scrollX });
|
|
@@ -11759,7 +11772,7 @@ var TimePicker = (0, import_react33.forwardRef)((originalProps, ref) => {
|
|
|
11759
11772
|
setIsPanelOpen(false);
|
|
11760
11773
|
}
|
|
11761
11774
|
};
|
|
11762
|
-
const slots = (0,
|
|
11775
|
+
const slots = (0, import_react34.useMemo)(() => timePickerStyle({ ...variantProps }), [variantProps]);
|
|
11763
11776
|
const renderHourOptions = () => {
|
|
11764
11777
|
return Array.from({ length: 24 }, (_, i) => {
|
|
11765
11778
|
const value = String(i).padStart(2, "0");
|
|
@@ -12052,19 +12065,19 @@ var timePickerStyle = tv({
|
|
|
12052
12065
|
});
|
|
12053
12066
|
|
|
12054
12067
|
// src/components/tree/tree.tsx
|
|
12055
|
-
var
|
|
12068
|
+
var import_react35 = require("react");
|
|
12056
12069
|
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
12057
|
-
var TreeNodeItem = (0,
|
|
12070
|
+
var TreeNodeItem = (0, import_react35.forwardRef)(
|
|
12058
12071
|
({ node, depth, fileIcon, selectedName, classNames, onExpand }, ref) => {
|
|
12059
|
-
const [isOpen, setIsOpen] = (0,
|
|
12060
|
-
const [children, setChildren] = (0,
|
|
12061
|
-
const slots = (0,
|
|
12062
|
-
const hasMore = (0,
|
|
12072
|
+
const [isOpen, setIsOpen] = (0, import_react35.useState)(false);
|
|
12073
|
+
const [children, setChildren] = (0, import_react35.useState)(node.children);
|
|
12074
|
+
const slots = (0, import_react35.useMemo)(() => treeStyle(), []);
|
|
12075
|
+
const hasMore = (0, import_react35.useMemo)(() => {
|
|
12063
12076
|
if (node.isLeaf) return false;
|
|
12064
12077
|
if (Array.isArray(children)) return children.length > 0;
|
|
12065
12078
|
return typeof onExpand === "function";
|
|
12066
12079
|
}, [node.isLeaf, children, onExpand]);
|
|
12067
|
-
const toggleOpen = (0,
|
|
12080
|
+
const toggleOpen = (0, import_react35.useCallback)(async () => {
|
|
12068
12081
|
if (!isOpen && !children && onExpand && !node.isLeaf) {
|
|
12069
12082
|
try {
|
|
12070
12083
|
const result = await onExpand(node);
|
|
@@ -12140,7 +12153,7 @@ var TreeNodeItem = (0, import_react34.forwardRef)(
|
|
|
12140
12153
|
);
|
|
12141
12154
|
TreeNodeItem.displayName = "TreeNodeItem";
|
|
12142
12155
|
var Tree = ({ headerContent, group, groupIcon, fileIcon, selectedName, classNames, onExpand }) => {
|
|
12143
|
-
const slots = (0,
|
|
12156
|
+
const slots = (0, import_react35.useMemo)(() => treeStyle(), []);
|
|
12144
12157
|
const handleClick = (e) => {
|
|
12145
12158
|
var _a;
|
|
12146
12159
|
(_a = group.onClick) == null ? void 0 : _a.call(group, e);
|
|
@@ -12208,19 +12221,19 @@ var treeStyle = tv({
|
|
|
12208
12221
|
});
|
|
12209
12222
|
|
|
12210
12223
|
// src/components/fileUpload/fileUpload.tsx
|
|
12211
|
-
var
|
|
12224
|
+
var import_react38 = require("react");
|
|
12212
12225
|
var import_tailwind_variants34 = require("tailwind-variants");
|
|
12213
12226
|
|
|
12214
12227
|
// src/components/progress/progress.tsx
|
|
12215
|
-
var
|
|
12228
|
+
var import_react37 = require("react");
|
|
12216
12229
|
|
|
12217
12230
|
// src/hooks/useIsMounted.ts
|
|
12218
|
-
var
|
|
12231
|
+
var import_react36 = require("react");
|
|
12219
12232
|
function useIsMounted(props = {}) {
|
|
12220
12233
|
const { rerender = false, delay = 0 } = props;
|
|
12221
|
-
const isMountedRef = (0,
|
|
12222
|
-
const [isMounted, setIsMounted] = (0,
|
|
12223
|
-
(0,
|
|
12234
|
+
const isMountedRef = (0, import_react36.useRef)(false);
|
|
12235
|
+
const [isMounted, setIsMounted] = (0, import_react36.useState)(false);
|
|
12236
|
+
(0, import_react36.useEffect)(() => {
|
|
12224
12237
|
isMountedRef.current = true;
|
|
12225
12238
|
let timer = null;
|
|
12226
12239
|
if (rerender) {
|
|
@@ -12242,7 +12255,7 @@ function useIsMounted(props = {}) {
|
|
|
12242
12255
|
}
|
|
12243
12256
|
};
|
|
12244
12257
|
}, [rerender]);
|
|
12245
|
-
return [(0,
|
|
12258
|
+
return [(0, import_react36.useCallback)(() => isMountedRef.current, []), isMounted];
|
|
12246
12259
|
}
|
|
12247
12260
|
|
|
12248
12261
|
// src/components/progress/progress.tsx
|
|
@@ -12256,11 +12269,11 @@ var Progress = (originalProps) => {
|
|
|
12256
12269
|
delay: 100
|
|
12257
12270
|
});
|
|
12258
12271
|
const selfMounted = variantProps.disableAnimation ? true : isMounted;
|
|
12259
|
-
const percentage = (0,
|
|
12272
|
+
const percentage = (0, import_react37.useMemo)(
|
|
12260
12273
|
() => isIndeterminate || !selfMounted ? void 0 : clampPercentage((value - minValue) / (maxValue - minValue) * 100),
|
|
12261
12274
|
[selfMounted, isIndeterminate, value, minValue, maxValue]
|
|
12262
12275
|
);
|
|
12263
|
-
const slots = (0,
|
|
12276
|
+
const slots = (0, import_react37.useMemo)(() => progressStyle({ ...variantProps }), [variantProps]);
|
|
12264
12277
|
return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: slots.base({ class: classNames == null ? void 0 : classNames.base }), children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: slots.track({ class: classNames == null ? void 0 : classNames.track }), children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
12265
12278
|
"div",
|
|
12266
12279
|
{
|
|
@@ -12377,13 +12390,13 @@ function FileUpload({
|
|
|
12377
12390
|
classNames,
|
|
12378
12391
|
defaultFile
|
|
12379
12392
|
}) {
|
|
12380
|
-
const fileInputRef = (0,
|
|
12381
|
-
const uploadIntervalRef = (0,
|
|
12382
|
-
const [currentFile, setCurrentFile] = (0,
|
|
12383
|
-
const [uploadProgress, setUploadProgress] = (0,
|
|
12384
|
-
const [message, setMessage] = (0,
|
|
12385
|
-
const [displayFileName, setDisplayFileName] = (0,
|
|
12386
|
-
const [hasUploadedFile, setHasUploadedFile] = (0,
|
|
12393
|
+
const fileInputRef = (0, import_react38.useRef)(null);
|
|
12394
|
+
const uploadIntervalRef = (0, import_react38.useRef)(null);
|
|
12395
|
+
const [currentFile, setCurrentFile] = (0, import_react38.useState)(null);
|
|
12396
|
+
const [uploadProgress, setUploadProgress] = (0, import_react38.useState)(0);
|
|
12397
|
+
const [message, setMessage] = (0, import_react38.useState)(errorMessage);
|
|
12398
|
+
const [displayFileName, setDisplayFileName] = (0, import_react38.useState)(() => (defaultFile == null ? void 0 : defaultFile.name) || "");
|
|
12399
|
+
const [hasUploadedFile, setHasUploadedFile] = (0, import_react38.useState)(false);
|
|
12387
12400
|
const slots = fileUploadStyle();
|
|
12388
12401
|
const handleButtonClick = () => {
|
|
12389
12402
|
var _a;
|
|
@@ -12440,14 +12453,14 @@ function FileUpload({
|
|
|
12440
12453
|
setHasUploadedFile(false);
|
|
12441
12454
|
if (onCancelUpload) onCancelUpload();
|
|
12442
12455
|
};
|
|
12443
|
-
(0,
|
|
12456
|
+
(0, import_react38.useEffect)(() => {
|
|
12444
12457
|
return () => {
|
|
12445
12458
|
if (uploadIntervalRef.current) {
|
|
12446
12459
|
clearInterval(uploadIntervalRef.current);
|
|
12447
12460
|
}
|
|
12448
12461
|
};
|
|
12449
12462
|
}, []);
|
|
12450
|
-
(0,
|
|
12463
|
+
(0, import_react38.useEffect)(() => {
|
|
12451
12464
|
if (errorMessage !== void 0) {
|
|
12452
12465
|
setMessage(errorMessage);
|
|
12453
12466
|
}
|
|
@@ -12581,12 +12594,12 @@ var skeletonStyle = (0, import_tailwind_variants35.tv)({
|
|
|
12581
12594
|
|
|
12582
12595
|
// src/components/charts/circularProgress.tsx
|
|
12583
12596
|
var import_recharts = require("recharts");
|
|
12584
|
-
var
|
|
12597
|
+
var import_react39 = require("react");
|
|
12585
12598
|
var import_jsx_runtime41 = require("react/jsx-runtime");
|
|
12586
|
-
var CircularProgress = (0,
|
|
12599
|
+
var CircularProgress = (0, import_react39.forwardRef)((originalProps, ref) => {
|
|
12587
12600
|
const [props, variantProps] = mapPropsVariants(originalProps, circularProgressStyle.variantKeys);
|
|
12588
12601
|
const { label, size = 150, percentage, innerContent, classNames } = { ...props, ...variantProps };
|
|
12589
|
-
const slots = (0,
|
|
12602
|
+
const slots = (0, import_react39.useMemo)(() => circularProgressStyle({ ...variantProps }), [variantProps]);
|
|
12590
12603
|
const data = [
|
|
12591
12604
|
{
|
|
12592
12605
|
name: label,
|
|
@@ -12618,7 +12631,7 @@ var CircularProgress = (0, import_react38.forwardRef)((originalProps, ref) => {
|
|
|
12618
12631
|
const colorValue = originalProps.color;
|
|
12619
12632
|
const colorKey = colorValue || "blue";
|
|
12620
12633
|
const currentGradient = gradientColors[colorKey];
|
|
12621
|
-
const wrappedInnerContent = (0,
|
|
12634
|
+
const wrappedInnerContent = (0, import_react39.useMemo)(() => {
|
|
12622
12635
|
return wrapSpanWithClass(innerContent);
|
|
12623
12636
|
}, [innerContent]);
|
|
12624
12637
|
return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { ref, className: slots.base({ class: classNames == null ? void 0 : classNames.base }), children: [
|
|
@@ -12712,16 +12725,16 @@ function wrapSpanWithClass(node) {
|
|
|
12712
12725
|
if (Array.isArray(node)) {
|
|
12713
12726
|
return node.map(wrapSpanWithClass);
|
|
12714
12727
|
}
|
|
12715
|
-
if ((0,
|
|
12728
|
+
if ((0, import_react39.isValidElement)(node)) {
|
|
12716
12729
|
const element = node;
|
|
12717
12730
|
if (element.type === "span") {
|
|
12718
12731
|
const existing = (_a = element.props.className) != null ? _a : "";
|
|
12719
|
-
return (0,
|
|
12732
|
+
return (0, import_react39.cloneElement)(element, {
|
|
12720
12733
|
className: `text-xl font-bold ${existing}`.trim()
|
|
12721
12734
|
});
|
|
12722
12735
|
}
|
|
12723
12736
|
if (element.props.children) {
|
|
12724
|
-
return (0,
|
|
12737
|
+
return (0, import_react39.cloneElement)(element, {
|
|
12725
12738
|
children: wrapSpanWithClass(element.props.children)
|
|
12726
12739
|
});
|
|
12727
12740
|
}
|
|
@@ -12731,11 +12744,11 @@ function wrapSpanWithClass(node) {
|
|
|
12731
12744
|
}
|
|
12732
12745
|
|
|
12733
12746
|
// src/components/charts/areaChart.tsx
|
|
12734
|
-
var
|
|
12747
|
+
var import_react40 = require("react");
|
|
12735
12748
|
var import_recharts2 = require("recharts");
|
|
12736
12749
|
var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
12737
|
-
var AreaChartComponent = (0,
|
|
12738
|
-
const uniqueId = (0,
|
|
12750
|
+
var AreaChartComponent = (0, import_react40.forwardRef)((originalProps, ref) => {
|
|
12751
|
+
const uniqueId = (0, import_react40.useId)();
|
|
12739
12752
|
const [props, variantProps] = mapPropsVariants(originalProps, areaChartStyle.variantKeys);
|
|
12740
12753
|
const {
|
|
12741
12754
|
data,
|
|
@@ -12747,26 +12760,26 @@ var AreaChartComponent = (0, import_react39.forwardRef)((originalProps, ref) =>
|
|
|
12747
12760
|
chartHeight = 240,
|
|
12748
12761
|
classNames
|
|
12749
12762
|
} = { ...props, ...variantProps };
|
|
12750
|
-
const slots = (0,
|
|
12763
|
+
const slots = (0, import_react40.useMemo)(() => areaChartStyle({ ...variantProps }), [variantProps]);
|
|
12751
12764
|
const COLOR_MAP = {
|
|
12752
12765
|
primary: "#3F9CF2",
|
|
12753
12766
|
danger: "#FF4684"
|
|
12754
12767
|
};
|
|
12755
|
-
const colorHex = (0,
|
|
12756
|
-
const totalChartWidth = (0,
|
|
12768
|
+
const colorHex = (0, import_react40.useMemo)(() => COLOR_MAP[color], [color]);
|
|
12769
|
+
const totalChartWidth = (0, import_react40.useMemo)(() => {
|
|
12757
12770
|
if (!data || !itemWidth) return void 0;
|
|
12758
12771
|
const dataLength = startFromZero ? data.length + 1 : data.length;
|
|
12759
12772
|
return dataLength * itemWidth;
|
|
12760
12773
|
}, [data, itemWidth, startFromZero]);
|
|
12761
|
-
const needsScroll = (0,
|
|
12774
|
+
const needsScroll = (0, import_react40.useMemo)(() => {
|
|
12762
12775
|
return totalChartWidth;
|
|
12763
12776
|
}, [totalChartWidth]);
|
|
12764
|
-
const processedData = (0,
|
|
12777
|
+
const processedData = (0, import_react40.useMemo)(() => {
|
|
12765
12778
|
if (!data) return [];
|
|
12766
12779
|
return data;
|
|
12767
12780
|
}, [data, startFromZero]);
|
|
12768
|
-
const [tickPositions, setTickPositions] = (0,
|
|
12769
|
-
const tickRef = (0,
|
|
12781
|
+
const [tickPositions, setTickPositions] = (0, import_react40.useState)([]);
|
|
12782
|
+
const tickRef = (0, import_react40.useRef)([]);
|
|
12770
12783
|
const CustomTick = ({ x, y, payload }) => {
|
|
12771
12784
|
if (x !== void 0) {
|
|
12772
12785
|
tickRef.current.push(x);
|
|
@@ -12788,7 +12801,7 @@ var AreaChartComponent = (0, import_react39.forwardRef)((originalProps, ref) =>
|
|
|
12788
12801
|
}
|
|
12789
12802
|
);
|
|
12790
12803
|
};
|
|
12791
|
-
(0,
|
|
12804
|
+
(0, import_react40.useEffect)(() => {
|
|
12792
12805
|
const raf = requestAnimationFrame(() => {
|
|
12793
12806
|
const unique = [...new Set(tickRef.current)].sort((a, b) => a - b);
|
|
12794
12807
|
const mids = [];
|
|
@@ -12915,10 +12928,10 @@ var areaChartStyle = tv({
|
|
|
12915
12928
|
});
|
|
12916
12929
|
|
|
12917
12930
|
// src/components/charts/barChart.tsx
|
|
12918
|
-
var
|
|
12931
|
+
var import_react41 = require("react");
|
|
12919
12932
|
var import_recharts3 = require("recharts");
|
|
12920
12933
|
var import_jsx_runtime43 = require("react/jsx-runtime");
|
|
12921
|
-
var BarChartComponent = (0,
|
|
12934
|
+
var BarChartComponent = (0, import_react41.forwardRef)((originalProps, ref) => {
|
|
12922
12935
|
const [props, variantProps] = mapPropsVariants(originalProps, barChartStyle.variantKeys);
|
|
12923
12936
|
const {
|
|
12924
12937
|
data = [],
|
|
@@ -12930,13 +12943,13 @@ var BarChartComponent = (0, import_react40.forwardRef)((originalProps, ref) => {
|
|
|
12930
12943
|
barGap = 20,
|
|
12931
12944
|
tooltipFormatter
|
|
12932
12945
|
} = { ...props, ...variantProps };
|
|
12933
|
-
const slots = (0,
|
|
12934
|
-
const chartRef = (0,
|
|
12935
|
-
const tooltipRef = (0,
|
|
12936
|
-
const [tooltipLeft, setTooltipLeft] = (0,
|
|
12937
|
-
const [tickPositions, setTickPositions] = (0,
|
|
12938
|
-
const tickRef = (0,
|
|
12939
|
-
const [tooltipState, setTooltipState] = (0,
|
|
12946
|
+
const slots = (0, import_react41.useMemo)(() => barChartStyle({ ...variantProps }), [variantProps]);
|
|
12947
|
+
const chartRef = (0, import_react41.useRef)(null);
|
|
12948
|
+
const tooltipRef = (0, import_react41.useRef)(null);
|
|
12949
|
+
const [tooltipLeft, setTooltipLeft] = (0, import_react41.useState)(0);
|
|
12950
|
+
const [tickPositions, setTickPositions] = (0, import_react41.useState)([]);
|
|
12951
|
+
const tickRef = (0, import_react41.useRef)([]);
|
|
12952
|
+
const [tooltipState, setTooltipState] = (0, import_react41.useState)(null);
|
|
12940
12953
|
const handleMouseEnter = (e, dataKey) => {
|
|
12941
12954
|
if (!tooltipFormatter || !chartRef.current) return;
|
|
12942
12955
|
const { payload, x, y } = e;
|
|
@@ -12996,7 +13009,7 @@ var BarChartComponent = (0, import_react40.forwardRef)((originalProps, ref) => {
|
|
|
12996
13009
|
children: yAxisTickFormatter(payload.value)
|
|
12997
13010
|
}
|
|
12998
13011
|
);
|
|
12999
|
-
(0,
|
|
13012
|
+
(0, import_react41.useEffect)(() => {
|
|
13000
13013
|
const raf = requestAnimationFrame(() => {
|
|
13001
13014
|
const unique = [...new Set(tickRef.current)].sort((a, b) => a - b);
|
|
13002
13015
|
const mids = [];
|
|
@@ -13008,7 +13021,7 @@ var BarChartComponent = (0, import_react40.forwardRef)((originalProps, ref) => {
|
|
|
13008
13021
|
});
|
|
13009
13022
|
return () => cancelAnimationFrame(raf);
|
|
13010
13023
|
}, [data]);
|
|
13011
|
-
(0,
|
|
13024
|
+
(0, import_react41.useLayoutEffect)(() => {
|
|
13012
13025
|
if (!tooltipState || !chartRef.current || !tooltipRef.current) return;
|
|
13013
13026
|
const chartRect = chartRef.current.getBoundingClientRect();
|
|
13014
13027
|
const tooltipRect = tooltipRef.current.getBoundingClientRect();
|
|
@@ -13154,13 +13167,13 @@ function BarChartTooltip({ className = "", children }) {
|
|
|
13154
13167
|
|
|
13155
13168
|
// src/components/charts/radarChart.tsx
|
|
13156
13169
|
var import_recharts4 = require("recharts");
|
|
13157
|
-
var
|
|
13170
|
+
var import_react42 = require("react");
|
|
13158
13171
|
var import_jsx_runtime44 = require("react/jsx-runtime");
|
|
13159
|
-
var RadarChart = (0,
|
|
13172
|
+
var RadarChart = (0, import_react42.forwardRef)((originalProps, ref) => {
|
|
13160
13173
|
const [props, variantProps] = mapPropsVariants(originalProps, radarChartStyle.variantKeys);
|
|
13161
13174
|
const { data, label, classNames, tooltipFormatter } = { ...props, ...variantProps };
|
|
13162
|
-
const slots = (0,
|
|
13163
|
-
const normalizedData = (0,
|
|
13175
|
+
const slots = (0, import_react42.useMemo)(() => radarChartStyle({ ...variantProps }), [variantProps]);
|
|
13176
|
+
const normalizedData = (0, import_react42.useMemo)(() => {
|
|
13164
13177
|
if (!data || data.length === 0) return [];
|
|
13165
13178
|
return data.map((item) => ({
|
|
13166
13179
|
...item,
|
|
@@ -13169,18 +13182,18 @@ var RadarChart = (0, import_react41.forwardRef)((originalProps, ref) => {
|
|
|
13169
13182
|
originalFullMark: item.fullMark || 100
|
|
13170
13183
|
}));
|
|
13171
13184
|
}, [data]);
|
|
13172
|
-
const containerHeight = (0,
|
|
13185
|
+
const containerHeight = (0, import_react42.useMemo)(() => {
|
|
13173
13186
|
if (!data || data.length === 0) return 250;
|
|
13174
13187
|
return data.length === 3 ? 245 : 306;
|
|
13175
13188
|
}, [data]);
|
|
13176
|
-
const chartMargin = (0,
|
|
13189
|
+
const chartMargin = (0, import_react42.useMemo)(() => {
|
|
13177
13190
|
return { top: 0, right: 0, bottom: 0, left: 0 };
|
|
13178
13191
|
}, [data]);
|
|
13179
|
-
const outerRadius = (0,
|
|
13192
|
+
const outerRadius = (0, import_react42.useMemo)(() => {
|
|
13180
13193
|
if (!data || data.length === 0) return 125;
|
|
13181
13194
|
return data.length === 3 ? 135 : 125;
|
|
13182
13195
|
}, [data]);
|
|
13183
|
-
const chartCenter = (0,
|
|
13196
|
+
const chartCenter = (0, import_react42.useMemo)(() => {
|
|
13184
13197
|
if (!data || data.length === 0) return {};
|
|
13185
13198
|
if (data.length === 3) return { cx: "50%", cy: "65%" };
|
|
13186
13199
|
return {};
|
|
@@ -13257,10 +13270,10 @@ var radarChartStyle = tv({
|
|
|
13257
13270
|
});
|
|
13258
13271
|
|
|
13259
13272
|
// src/components/charts/simpleBarChart.tsx
|
|
13260
|
-
var
|
|
13273
|
+
var import_react43 = require("react");
|
|
13261
13274
|
var import_recharts5 = require("recharts");
|
|
13262
13275
|
var import_jsx_runtime45 = require("react/jsx-runtime");
|
|
13263
|
-
var SimpleBarChartComponent = (0,
|
|
13276
|
+
var SimpleBarChartComponent = (0, import_react43.forwardRef)((originalProps, ref) => {
|
|
13264
13277
|
const [props, variantProps] = mapPropsVariants(originalProps, simpleBarChartStyle.variantKeys);
|
|
13265
13278
|
const {
|
|
13266
13279
|
data = [],
|
|
@@ -13271,13 +13284,13 @@ var SimpleBarChartComponent = (0, import_react42.forwardRef)((originalProps, ref
|
|
|
13271
13284
|
barGap = 20,
|
|
13272
13285
|
tooltipFormatter
|
|
13273
13286
|
} = { ...props, ...variantProps };
|
|
13274
|
-
const slots = (0,
|
|
13275
|
-
const chartRef = (0,
|
|
13276
|
-
const tooltipRef = (0,
|
|
13277
|
-
const [tooltipLeft, setTooltipLeft] = (0,
|
|
13278
|
-
const [tickPositions, setTickPositions] = (0,
|
|
13279
|
-
const [tooltipState, setTooltipState] = (0,
|
|
13280
|
-
(0,
|
|
13287
|
+
const slots = (0, import_react43.useMemo)(() => simpleBarChartStyle({ ...variantProps }), [variantProps]);
|
|
13288
|
+
const chartRef = (0, import_react43.useRef)(null);
|
|
13289
|
+
const tooltipRef = (0, import_react43.useRef)(null);
|
|
13290
|
+
const [tooltipLeft, setTooltipLeft] = (0, import_react43.useState)(0);
|
|
13291
|
+
const [tickPositions, setTickPositions] = (0, import_react43.useState)([]);
|
|
13292
|
+
const [tooltipState, setTooltipState] = (0, import_react43.useState)(null);
|
|
13293
|
+
(0, import_react43.useEffect)(() => {
|
|
13281
13294
|
if (!chartRef.current || !data.length) return;
|
|
13282
13295
|
const updateDimensions = () => {
|
|
13283
13296
|
if (!chartRef.current) return;
|
|
@@ -13351,7 +13364,7 @@ var SimpleBarChartComponent = (0, import_react42.forwardRef)((originalProps, ref
|
|
|
13351
13364
|
}
|
|
13352
13365
|
);
|
|
13353
13366
|
};
|
|
13354
|
-
(0,
|
|
13367
|
+
(0, import_react43.useLayoutEffect)(() => {
|
|
13355
13368
|
if (!tooltipState || !chartRef.current || !tooltipRef.current) return;
|
|
13356
13369
|
const chartRect = chartRef.current.getBoundingClientRect();
|
|
13357
13370
|
const tooltipRect = tooltipRef.current.getBoundingClientRect();
|
|
@@ -13455,9 +13468,9 @@ var simpleBarChartStyle = tv({
|
|
|
13455
13468
|
});
|
|
13456
13469
|
|
|
13457
13470
|
// src/components/starRating/starRating.tsx
|
|
13458
|
-
var
|
|
13471
|
+
var import_react44 = require("react");
|
|
13459
13472
|
var import_jsx_runtime46 = require("react/jsx-runtime");
|
|
13460
|
-
var StarRating = (0,
|
|
13473
|
+
var StarRating = (0, import_react44.forwardRef)((originalProps, ref) => {
|
|
13461
13474
|
const [props, variantProps] = mapPropsVariants(originalProps, starRatingStyle.variantKeys);
|
|
13462
13475
|
const {
|
|
13463
13476
|
stars,
|
|
@@ -13470,8 +13483,8 @@ var StarRating = (0, import_react43.forwardRef)((originalProps, ref) => {
|
|
|
13470
13483
|
filledColor = "text-primary-main",
|
|
13471
13484
|
emptyColor = "text-neutral-soft"
|
|
13472
13485
|
} = { ...props, ...variantProps };
|
|
13473
|
-
const slots = (0,
|
|
13474
|
-
const [hoverRating, setHoverRating] = (0,
|
|
13486
|
+
const slots = (0, import_react44.useMemo)(() => starRatingStyle({ ...variantProps }), [variantProps]);
|
|
13487
|
+
const [hoverRating, setHoverRating] = (0, import_react44.useState)(0);
|
|
13475
13488
|
const handleStarClick = (starIndex, isHalf = false) => {
|
|
13476
13489
|
if (readOnly || !onChange) return;
|
|
13477
13490
|
let newRating;
|