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