@deepnoid/ui 0.1.181 → 0.1.183
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 +145 -145
- package/dist/{chunk-GWHUQUKA.mjs → chunk-6WD32ERF.mjs} +93 -79
- package/dist/{chunk-HOQAQVDA.mjs → chunk-VRHMQMRO.mjs} +110 -31
- package/dist/chunk-WKTRWHDA.mjs +264 -0
- package/dist/components/charts/barChart.js +125 -111
- package/dist/components/charts/barChart.mjs +1 -1
- package/dist/components/charts/index.js +218 -190
- package/dist/components/charts/index.mjs +2 -2
- package/dist/components/charts/simpleBarChart.js +93 -79
- package/dist/components/charts/simpleBarChart.mjs +1 -1
- package/dist/components/table/index.js +144 -65
- package/dist/components/table/index.mjs +1 -1
- package/dist/components/table/table-body.js +140 -61
- package/dist/components/table/table-body.mjs +1 -1
- package/dist/components/table/table-head.js +108 -31
- package/dist/components/table/table-head.mjs +1 -1
- package/dist/components/table/table.js +140 -61
- package/dist/components/table/table.mjs +1 -1
- package/dist/components/toast/index.mjs +2 -2
- package/dist/components/toast/use-toast.mjs +2 -2
- package/dist/index.js +540 -433
- package/dist/index.mjs +19 -19
- package/package.json +1 -1
- package/dist/chunk-JOK735WN.mjs +0 -250
- package/dist/{chunk-ROXKJQSJ.mjs → chunk-4SDPS5R2.mjs} +3 -3
package/dist/index.js
CHANGED
|
@@ -7921,9 +7921,12 @@ var textareaStyle = (0, import_tailwind_variants13.tv)({
|
|
|
7921
7921
|
});
|
|
7922
7922
|
|
|
7923
7923
|
// src/components/table/table.tsx
|
|
7924
|
-
var
|
|
7924
|
+
var import_react19 = require("react");
|
|
7925
7925
|
var import_tailwind_variants17 = require("tailwind-variants");
|
|
7926
7926
|
|
|
7927
|
+
// src/components/table/table-head.tsx
|
|
7928
|
+
var import_react15 = require("react");
|
|
7929
|
+
|
|
7927
7930
|
// src/components/checkbox/checkbox.tsx
|
|
7928
7931
|
var import_react14 = require("react");
|
|
7929
7932
|
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
@@ -8133,20 +8136,51 @@ var checkboxStyle = tv({
|
|
|
8133
8136
|
|
|
8134
8137
|
// src/components/table/table-head.tsx
|
|
8135
8138
|
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
8136
|
-
|
|
8139
|
+
function TableHeaderCell({
|
|
8140
|
+
content,
|
|
8141
|
+
column,
|
|
8142
|
+
isCheckbox = false,
|
|
8137
8143
|
slots,
|
|
8138
|
-
|
|
8139
|
-
|
|
8140
|
-
|
|
8141
|
-
|
|
8142
|
-
|
|
8143
|
-
|
|
8144
|
-
|
|
8145
|
-
}
|
|
8146
|
-
|
|
8144
|
+
classNames
|
|
8145
|
+
}) {
|
|
8146
|
+
const thRef = (0, import_react15.useRef)(null);
|
|
8147
|
+
const [showTitle, setShowTitle] = (0, import_react15.useState)(false);
|
|
8148
|
+
const checkOverflow = (el) => {
|
|
8149
|
+
if (el.scrollWidth > el.clientWidth) {
|
|
8150
|
+
return true;
|
|
8151
|
+
}
|
|
8152
|
+
const children = Array.from(el.children);
|
|
8153
|
+
for (const child of children) {
|
|
8154
|
+
if (child.scrollWidth > child.clientWidth) {
|
|
8155
|
+
return true;
|
|
8156
|
+
}
|
|
8157
|
+
}
|
|
8158
|
+
return false;
|
|
8159
|
+
};
|
|
8160
|
+
const extractTextFromContent = (node) => {
|
|
8161
|
+
if (typeof node === "string" || typeof node === "number") {
|
|
8162
|
+
return String(node);
|
|
8163
|
+
}
|
|
8164
|
+
if ((0, import_react15.isValidElement)(node)) {
|
|
8165
|
+
return String(node.props.children || "");
|
|
8166
|
+
}
|
|
8167
|
+
return "";
|
|
8168
|
+
};
|
|
8169
|
+
(0, import_react15.useEffect)(() => {
|
|
8170
|
+
if (thRef.current && !isCheckbox) {
|
|
8171
|
+
setTimeout(() => {
|
|
8172
|
+
if (thRef.current) {
|
|
8173
|
+
setShowTitle(checkOverflow(thRef.current));
|
|
8174
|
+
}
|
|
8175
|
+
}, 0);
|
|
8176
|
+
}
|
|
8177
|
+
}, [content, isCheckbox]);
|
|
8178
|
+
const titleText = !isCheckbox && showTitle ? extractTextFromContent(content) : void 0;
|
|
8179
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
8147
8180
|
"th",
|
|
8148
8181
|
{
|
|
8149
|
-
|
|
8182
|
+
ref: thRef,
|
|
8183
|
+
className: clsx(slots.th({ class: classNames == null ? void 0 : classNames.th }), column == null ? void 0 : column.className, !isCheckbox && "truncate"),
|
|
8150
8184
|
style: isCheckbox ? {
|
|
8151
8185
|
width: "40px",
|
|
8152
8186
|
minWidth: "40px",
|
|
@@ -8155,31 +8189,55 @@ var TableHead = ({
|
|
|
8155
8189
|
flexGrow: 0,
|
|
8156
8190
|
boxSizing: "border-box"
|
|
8157
8191
|
} : column ? { ...getCellStyle(column), textAlign: "center" } : void 0,
|
|
8192
|
+
title: titleText,
|
|
8158
8193
|
children: content
|
|
8159
|
-
}
|
|
8160
|
-
key
|
|
8194
|
+
}
|
|
8161
8195
|
);
|
|
8196
|
+
}
|
|
8197
|
+
var TableHead = ({
|
|
8198
|
+
slots,
|
|
8199
|
+
columns,
|
|
8200
|
+
color,
|
|
8201
|
+
size,
|
|
8202
|
+
rowCheckbox = false,
|
|
8203
|
+
hasCheckedRows,
|
|
8204
|
+
classNames,
|
|
8205
|
+
onCheckAll
|
|
8206
|
+
}) => {
|
|
8162
8207
|
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("thead", { className: slots.thead({ class: classNames == null ? void 0 : classNames.thead }), children: /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("tr", { className: slots.tr({ class: classNames == null ? void 0 : classNames.tr }), children: [
|
|
8163
|
-
columns.map((column, idx) =>
|
|
8164
|
-
|
|
8165
|
-
|
|
8166
|
-
|
|
8167
|
-
|
|
8168
|
-
|
|
8169
|
-
|
|
8170
|
-
|
|
8171
|
-
|
|
8172
|
-
|
|
8173
|
-
|
|
8174
|
-
|
|
8175
|
-
|
|
8208
|
+
columns.map((column, idx) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
8209
|
+
TableHeaderCell,
|
|
8210
|
+
{
|
|
8211
|
+
content: column.headerName,
|
|
8212
|
+
column,
|
|
8213
|
+
slots,
|
|
8214
|
+
classNames
|
|
8215
|
+
},
|
|
8216
|
+
`${column.field}-${idx}`
|
|
8217
|
+
)),
|
|
8218
|
+
rowCheckbox && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
8219
|
+
TableHeaderCell,
|
|
8220
|
+
{
|
|
8221
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { "data-checkbox": true, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
8222
|
+
checkbox_default,
|
|
8223
|
+
{
|
|
8224
|
+
size,
|
|
8225
|
+
checked: hasCheckedRows,
|
|
8226
|
+
onChange: (e) => onCheckAll(e.target.checked)
|
|
8227
|
+
}
|
|
8228
|
+
) }),
|
|
8229
|
+
isCheckbox: true,
|
|
8230
|
+
slots,
|
|
8231
|
+
classNames
|
|
8232
|
+
},
|
|
8233
|
+
"checkbox"
|
|
8176
8234
|
)
|
|
8177
8235
|
] }) });
|
|
8178
8236
|
};
|
|
8179
8237
|
var table_head_default = TableHead;
|
|
8180
8238
|
|
|
8181
8239
|
// src/components/table/table-body.tsx
|
|
8182
|
-
var
|
|
8240
|
+
var import_react16 = require("react");
|
|
8183
8241
|
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
8184
8242
|
function TableCell({
|
|
8185
8243
|
row,
|
|
@@ -8189,25 +8247,46 @@ function TableCell({
|
|
|
8189
8247
|
slots,
|
|
8190
8248
|
classNames
|
|
8191
8249
|
}) {
|
|
8192
|
-
var _a;
|
|
8250
|
+
var _a, _b;
|
|
8193
8251
|
const value = row[column.field];
|
|
8194
8252
|
const formattedValue = ((_a = column.valueFormatter) == null ? void 0 : _a.call(column, { value, field: column.field })) || value;
|
|
8195
8253
|
const content = column.renderCell ? column.renderCell({ id: row.id, field: column.field, value, formattedValue, row }) : formattedValue;
|
|
8196
|
-
const tdRef = (0,
|
|
8197
|
-
const [showTitle, setShowTitle] = (0,
|
|
8198
|
-
const checkOverflow = (el) =>
|
|
8199
|
-
|
|
8254
|
+
const tdRef = (0, import_react16.useRef)(null);
|
|
8255
|
+
const [showTitle, setShowTitle] = (0, import_react16.useState)(false);
|
|
8256
|
+
const checkOverflow = (el) => {
|
|
8257
|
+
if (el.scrollWidth > el.clientWidth) {
|
|
8258
|
+
return true;
|
|
8259
|
+
}
|
|
8260
|
+
const children = Array.from(el.children);
|
|
8261
|
+
for (const child of children) {
|
|
8262
|
+
if (child.scrollWidth > child.clientWidth) {
|
|
8263
|
+
return true;
|
|
8264
|
+
}
|
|
8265
|
+
}
|
|
8266
|
+
return false;
|
|
8267
|
+
};
|
|
8268
|
+
(0, import_react16.useEffect)(() => {
|
|
8200
8269
|
if (tdRef.current) {
|
|
8201
|
-
|
|
8270
|
+
setTimeout(() => {
|
|
8271
|
+
if (tdRef.current) {
|
|
8272
|
+
setShowTitle(checkOverflow(tdRef.current));
|
|
8273
|
+
}
|
|
8274
|
+
}, 0);
|
|
8202
8275
|
}
|
|
8203
8276
|
}, [content]);
|
|
8204
8277
|
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
8205
8278
|
"td",
|
|
8206
8279
|
{
|
|
8207
8280
|
ref: tdRef,
|
|
8208
|
-
className: clsx(
|
|
8281
|
+
className: clsx(
|
|
8282
|
+
slots.td(),
|
|
8283
|
+
classNames == null ? void 0 : classNames.td,
|
|
8284
|
+
column.className,
|
|
8285
|
+
"truncate",
|
|
8286
|
+
"[&>*]:block [&>*]:w-full [&>*]:truncate"
|
|
8287
|
+
),
|
|
8209
8288
|
style: { ...getCellStyle(column), maxWidth: column.width || "150px" },
|
|
8210
|
-
title: showTitle ? String(content) : void 0,
|
|
8289
|
+
title: showTitle ? String(((_b = value == null ? void 0 : value.props) == null ? void 0 : _b.children) || content || "") : void 0,
|
|
8211
8290
|
children: content
|
|
8212
8291
|
},
|
|
8213
8292
|
`${row.id}-${column.field}-${colIdx}-${rowIndex}`
|
|
@@ -8277,18 +8356,18 @@ var TableBody = ({
|
|
|
8277
8356
|
var table_body_default = TableBody;
|
|
8278
8357
|
|
|
8279
8358
|
// src/components/pagination/pagination.tsx
|
|
8280
|
-
var
|
|
8359
|
+
var import_react18 = require("react");
|
|
8281
8360
|
|
|
8282
8361
|
// src/components/pagination/usePagination.ts
|
|
8283
|
-
var
|
|
8362
|
+
var import_react17 = require("react");
|
|
8284
8363
|
var usePagination = ({ currentPage, totalPage, groupSize, handleChangePage }) => {
|
|
8285
|
-
const startPage = (0,
|
|
8286
|
-
const endPage = (0,
|
|
8287
|
-
const pageList = (0,
|
|
8364
|
+
const startPage = (0, import_react17.useMemo)(() => Math.floor((currentPage - 1) / groupSize) * groupSize + 1, [currentPage, groupSize]);
|
|
8365
|
+
const endPage = (0, import_react17.useMemo)(() => Math.min(startPage + groupSize - 1, totalPage), [startPage, groupSize, totalPage]);
|
|
8366
|
+
const pageList = (0, import_react17.useMemo)(
|
|
8288
8367
|
() => Array.from({ length: endPage - startPage + 1 }, (_, i) => startPage + i),
|
|
8289
8368
|
[startPage, endPage]
|
|
8290
8369
|
);
|
|
8291
|
-
const handleClickMovePage = (0,
|
|
8370
|
+
const handleClickMovePage = (0, import_react17.useCallback)(
|
|
8292
8371
|
(page) => (event) => {
|
|
8293
8372
|
event.preventDefault();
|
|
8294
8373
|
handleChangePage == null ? void 0 : handleChangePage(page);
|
|
@@ -8306,7 +8385,7 @@ var usePagination_default = usePagination;
|
|
|
8306
8385
|
|
|
8307
8386
|
// src/components/pagination/pagination.tsx
|
|
8308
8387
|
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
8309
|
-
var Pagination = (0,
|
|
8388
|
+
var Pagination = (0, import_react18.forwardRef)((originalProps, ref) => {
|
|
8310
8389
|
const [props, variantProps] = mapPropsVariants(originalProps, paginationStyle.variantKeys);
|
|
8311
8390
|
const {
|
|
8312
8391
|
classNames,
|
|
@@ -8320,12 +8399,12 @@ var Pagination = (0, import_react17.forwardRef)((originalProps, ref) => {
|
|
|
8320
8399
|
variant,
|
|
8321
8400
|
size
|
|
8322
8401
|
} = { ...props, ...variantProps };
|
|
8323
|
-
const [inputPage, setInputPage] = (0,
|
|
8402
|
+
const [inputPage, setInputPage] = (0, import_react18.useState)(currentPage);
|
|
8324
8403
|
const isFirstPageDisabled = currentPage <= 1;
|
|
8325
8404
|
const isPrevPageDisabled = currentPage <= 1;
|
|
8326
8405
|
const isNextPageDisabled = currentPage >= totalPage;
|
|
8327
8406
|
const isLastPageDisabled = currentPage >= totalPage;
|
|
8328
|
-
const slots = (0,
|
|
8407
|
+
const slots = (0, import_react18.useMemo)(() => paginationStyle(variantProps), [variantProps]);
|
|
8329
8408
|
const { pageList, handleClickMovePage } = usePagination_default({
|
|
8330
8409
|
currentPage,
|
|
8331
8410
|
totalPage,
|
|
@@ -8693,7 +8772,7 @@ var scrollAreaStyle = (0, import_tailwind_variants16.tv)({
|
|
|
8693
8772
|
|
|
8694
8773
|
// src/components/table/table.tsx
|
|
8695
8774
|
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
8696
|
-
var Table = (0,
|
|
8775
|
+
var Table = (0, import_react19.forwardRef)((originalProps, ref) => {
|
|
8697
8776
|
const [props, variantProps] = mapPropsVariants(originalProps, tableStyle.variantKeys);
|
|
8698
8777
|
const {
|
|
8699
8778
|
rows,
|
|
@@ -8718,8 +8797,8 @@ var Table = (0, import_react18.forwardRef)((originalProps, ref) => {
|
|
|
8718
8797
|
} = { ...props, ...variantProps };
|
|
8719
8798
|
const { page = 1, perPage = 15 } = pagination || {};
|
|
8720
8799
|
const showPagination = pagination && totalData > 0;
|
|
8721
|
-
const [checkedRowIds, setCheckedRowIds] = (0,
|
|
8722
|
-
const tableMinWidth = (0,
|
|
8800
|
+
const [checkedRowIds, setCheckedRowIds] = (0, import_react19.useState)(new Set(checkedRows == null ? void 0 : checkedRows.map((row) => row.id)));
|
|
8801
|
+
const tableMinWidth = (0, import_react19.useMemo)(() => {
|
|
8723
8802
|
const columnsWidth = columns.reduce((total, column) => {
|
|
8724
8803
|
if (column.width) return total + column.width;
|
|
8725
8804
|
if (column.minWidth) return total + column.minWidth;
|
|
@@ -8728,10 +8807,10 @@ var Table = (0, import_react18.forwardRef)((originalProps, ref) => {
|
|
|
8728
8807
|
const checkboxWidth = rowCheckbox ? 40 : 0;
|
|
8729
8808
|
return columnsWidth + checkboxWidth;
|
|
8730
8809
|
}, [columns, rowCheckbox]);
|
|
8731
|
-
(0,
|
|
8810
|
+
(0, import_react19.useEffect)(() => {
|
|
8732
8811
|
onCheckedRowsChange == null ? void 0 : onCheckedRowsChange(getCheckedRowData(checkedRowIds));
|
|
8733
8812
|
}, [checkedRowIds]);
|
|
8734
|
-
(0,
|
|
8813
|
+
(0, import_react19.useEffect)(() => {
|
|
8735
8814
|
const currentRowIds = new Set(rows.map((row) => row.id));
|
|
8736
8815
|
const ids = Array.from(checkedRowIds);
|
|
8737
8816
|
const hasValidCheckedRows = ids.every((id) => currentRowIds.has(id));
|
|
@@ -8739,7 +8818,7 @@ var Table = (0, import_react18.forwardRef)((originalProps, ref) => {
|
|
|
8739
8818
|
setCheckedRowIds(new Set(checkedRows == null ? void 0 : checkedRows.map((row) => row.id)));
|
|
8740
8819
|
}
|
|
8741
8820
|
}, [rows.map((row) => row.id).join(",")]);
|
|
8742
|
-
(0,
|
|
8821
|
+
(0, import_react19.useImperativeHandle)(
|
|
8743
8822
|
ref,
|
|
8744
8823
|
() => ({
|
|
8745
8824
|
checkedRowIds,
|
|
@@ -8766,7 +8845,7 @@ var Table = (0, import_react18.forwardRef)((originalProps, ref) => {
|
|
|
8766
8845
|
onRowClick == null ? void 0 : onRowClick(row, index, event);
|
|
8767
8846
|
};
|
|
8768
8847
|
const getCheckedRowData = (checked) => rows.filter((row) => checked.has(row.id));
|
|
8769
|
-
const slots = (0,
|
|
8848
|
+
const slots = (0, import_react19.useMemo)(
|
|
8770
8849
|
() => tableStyle({ ...variantProps, rowClickable: typeof onRowClick === "function" }),
|
|
8771
8850
|
[variantProps, onRowClick]
|
|
8772
8851
|
);
|
|
@@ -9085,7 +9164,7 @@ var getCellStyle = (column) => {
|
|
|
9085
9164
|
};
|
|
9086
9165
|
|
|
9087
9166
|
// src/components/table/definition-table.tsx
|
|
9088
|
-
var
|
|
9167
|
+
var import_react20 = require("react");
|
|
9089
9168
|
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
9090
9169
|
var DEFAULT_CELL_CLASSES = "px-[10px] py-[8px] text-md border-r border-neutral-light h-[50px]";
|
|
9091
9170
|
var FIRST_CELL_WIDTH_CLASS = "w-[120px] font-bold text-md text-body-foreground";
|
|
@@ -9178,10 +9257,10 @@ var DefinitionTableRow = ({
|
|
|
9178
9257
|
colIndex
|
|
9179
9258
|
);
|
|
9180
9259
|
}) });
|
|
9181
|
-
var DefinitionTable = (0,
|
|
9260
|
+
var DefinitionTable = (0, import_react20.forwardRef)(
|
|
9182
9261
|
({ rows = [], footer, highlightColumnKey, classNames }, ref) => {
|
|
9183
|
-
const slots = (0,
|
|
9184
|
-
const highlightColumnIndex = (0,
|
|
9262
|
+
const slots = (0, import_react20.useMemo)(() => DefinitionTableStyle(), []);
|
|
9263
|
+
const highlightColumnIndex = (0, import_react20.useMemo)(
|
|
9185
9264
|
() => getHighlightColumnIndex(rows, highlightColumnKey),
|
|
9186
9265
|
[rows, highlightColumnKey]
|
|
9187
9266
|
);
|
|
@@ -9214,10 +9293,10 @@ var DefinitionTableStyle = tv({
|
|
|
9214
9293
|
});
|
|
9215
9294
|
|
|
9216
9295
|
// src/components/select/select.tsx
|
|
9217
|
-
var
|
|
9296
|
+
var import_react21 = require("react");
|
|
9218
9297
|
var import_react_dom = require("react-dom");
|
|
9219
9298
|
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
9220
|
-
var Select = (0,
|
|
9299
|
+
var Select = (0, import_react21.forwardRef)((originalProps, ref) => {
|
|
9221
9300
|
var _a, _b;
|
|
9222
9301
|
const [props, variantProps] = mapPropsVariants(originalProps, select.variantKeys);
|
|
9223
9302
|
const {
|
|
@@ -9234,14 +9313,14 @@ var Select = (0, import_react20.forwardRef)((originalProps, ref) => {
|
|
|
9234
9313
|
optionIconPlacement,
|
|
9235
9314
|
...inputProps
|
|
9236
9315
|
} = props;
|
|
9237
|
-
const slots = (0,
|
|
9238
|
-
const [selectedOptions, setSelectedOptions] = (0,
|
|
9239
|
-
const [targetRect, setTargetRect] = (0,
|
|
9240
|
-
const [optionWrapperHeight, setOptionWrapperHeight] = (0,
|
|
9241
|
-
const [isVisible, setIsVisible] = (0,
|
|
9242
|
-
const [isOpen, setIsOpen] = (0,
|
|
9243
|
-
const selectWrapperRef = (0,
|
|
9244
|
-
const optionWrapperRef = (0,
|
|
9316
|
+
const slots = (0, import_react21.useMemo)(() => select({ ...variantProps }), [variantProps]);
|
|
9317
|
+
const [selectedOptions, setSelectedOptions] = (0, import_react21.useState)(defaultSelectedOptions || []);
|
|
9318
|
+
const [targetRect, setTargetRect] = (0, import_react21.useState)(null);
|
|
9319
|
+
const [optionWrapperHeight, setOptionWrapperHeight] = (0, import_react21.useState)(0);
|
|
9320
|
+
const [isVisible, setIsVisible] = (0, import_react21.useState)(false);
|
|
9321
|
+
const [isOpen, setIsOpen] = (0, import_react21.useState)(false);
|
|
9322
|
+
const selectWrapperRef = (0, import_react21.useRef)(null);
|
|
9323
|
+
const optionWrapperRef = (0, import_react21.useRef)(null);
|
|
9245
9324
|
const isControlled = originalProps.value !== void 0;
|
|
9246
9325
|
const openSelect = () => {
|
|
9247
9326
|
if (selectWrapperRef.current) {
|
|
@@ -9281,7 +9360,7 @@ var Select = (0, import_react20.forwardRef)((originalProps, ref) => {
|
|
|
9281
9360
|
setSelectedOptions(nextOptions);
|
|
9282
9361
|
onChange == null ? void 0 : onChange(nextOptions);
|
|
9283
9362
|
};
|
|
9284
|
-
(0,
|
|
9363
|
+
(0, import_react21.useEffect)(() => {
|
|
9285
9364
|
const handleClickOutside = (e) => {
|
|
9286
9365
|
var _a2;
|
|
9287
9366
|
const target = e.target;
|
|
@@ -9292,12 +9371,12 @@ var Select = (0, import_react20.forwardRef)((originalProps, ref) => {
|
|
|
9292
9371
|
window.addEventListener("mousedown", handleClickOutside);
|
|
9293
9372
|
return () => window.removeEventListener("mousedown", handleClickOutside);
|
|
9294
9373
|
}, []);
|
|
9295
|
-
(0,
|
|
9374
|
+
(0, import_react21.useEffect)(() => {
|
|
9296
9375
|
if (optionWrapperRef.current) {
|
|
9297
9376
|
setOptionWrapperHeight(optionWrapperRef.current.getBoundingClientRect().height);
|
|
9298
9377
|
}
|
|
9299
9378
|
}, [targetRect]);
|
|
9300
|
-
(0,
|
|
9379
|
+
(0, import_react21.useEffect)(() => {
|
|
9301
9380
|
if (isControlled) {
|
|
9302
9381
|
const valueArray = Array.isArray(originalProps.value) ? originalProps.value : [originalProps.value];
|
|
9303
9382
|
const matched = options.filter((opt) => valueArray.includes(opt.value));
|
|
@@ -9667,14 +9746,14 @@ var select = tv({
|
|
|
9667
9746
|
});
|
|
9668
9747
|
|
|
9669
9748
|
// src/components/chip/chip.tsx
|
|
9670
|
-
var
|
|
9749
|
+
var import_react22 = require("react");
|
|
9671
9750
|
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
9672
|
-
var Chip = (0,
|
|
9751
|
+
var Chip = (0, import_react22.forwardRef)((originalProps, ref) => {
|
|
9673
9752
|
var _a;
|
|
9674
9753
|
const [rawProps, variantProps] = mapPropsVariants(originalProps, chipStyle.variantKeys);
|
|
9675
9754
|
const props = { ...rawProps, ...variantProps };
|
|
9676
9755
|
const Component = props.onClick ? "button" : "div";
|
|
9677
|
-
const slots = (0,
|
|
9756
|
+
const slots = (0, import_react22.useMemo)(() => chipStyle({ ...variantProps }), [variantProps]);
|
|
9678
9757
|
const renderIcon = (name) => name ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Icon_default, { name, fill: true, size: props.size, className: slots.icon() }) : null;
|
|
9679
9758
|
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
9680
9759
|
Component,
|
|
@@ -9852,12 +9931,12 @@ var chipStyle = tv({
|
|
|
9852
9931
|
});
|
|
9853
9932
|
|
|
9854
9933
|
// src/components/radio/radio.tsx
|
|
9855
|
-
var
|
|
9934
|
+
var import_react23 = require("react");
|
|
9856
9935
|
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
9857
|
-
var Radio = (0,
|
|
9936
|
+
var Radio = (0, import_react23.forwardRef)((originalProps, ref) => {
|
|
9858
9937
|
const [props, variantProps] = mapPropsVariants(originalProps, radioStyle.variantKeys);
|
|
9859
9938
|
const { children, classNames, labelPosition = "end", ...inputProps } = props;
|
|
9860
|
-
const slots = (0,
|
|
9939
|
+
const slots = (0, import_react23.useMemo)(() => radioStyle({ ...variantProps }), [variantProps]);
|
|
9861
9940
|
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
9862
9941
|
"label",
|
|
9863
9942
|
{
|
|
@@ -10022,16 +10101,16 @@ var radioStyle = tv({
|
|
|
10022
10101
|
});
|
|
10023
10102
|
|
|
10024
10103
|
// src/components/switch/switch.tsx
|
|
10025
|
-
var
|
|
10104
|
+
var import_react24 = require("react");
|
|
10026
10105
|
var import_tailwind_variants22 = require("tailwind-variants");
|
|
10027
10106
|
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
10028
|
-
var Switch = (0,
|
|
10107
|
+
var Switch = (0, import_react24.forwardRef)((originalProps, ref) => {
|
|
10029
10108
|
const [rawProps, variantProps] = mapPropsVariants(originalProps, switchStyle.variantKeys);
|
|
10030
10109
|
const { size, color, disabled, disableAnimation, id, checked, onChange, classNames, ...inputProps } = {
|
|
10031
10110
|
...rawProps,
|
|
10032
10111
|
...variantProps
|
|
10033
10112
|
};
|
|
10034
|
-
const slots = (0,
|
|
10113
|
+
const slots = (0, import_react24.useMemo)(() => switchStyle({ ...variantProps }), [variantProps]);
|
|
10035
10114
|
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: slots.base({ class: classNames == null ? void 0 : classNames.base }), children: [
|
|
10036
10115
|
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
10037
10116
|
"input",
|
|
@@ -10156,7 +10235,7 @@ var switchStyle = (0, import_tailwind_variants22.tv)({
|
|
|
10156
10235
|
});
|
|
10157
10236
|
|
|
10158
10237
|
// src/components/tooltip/tooltip.tsx
|
|
10159
|
-
var
|
|
10238
|
+
var import_react26 = require("react");
|
|
10160
10239
|
var import_react_dom2 = require("react-dom");
|
|
10161
10240
|
|
|
10162
10241
|
// src/components/tooltip/tooltip-utils.ts
|
|
@@ -10279,11 +10358,11 @@ var getTailStyles = (placement) => {
|
|
|
10279
10358
|
};
|
|
10280
10359
|
|
|
10281
10360
|
// src/components/tooltip/useTooltip.ts
|
|
10282
|
-
var
|
|
10361
|
+
var import_react25 = require("react");
|
|
10283
10362
|
var useTooltip = ({ placement, offset, targetRect }) => {
|
|
10284
|
-
const [tooltipPosition, setTooltipPosition] = (0,
|
|
10285
|
-
const tooltipRef = (0,
|
|
10286
|
-
(0,
|
|
10363
|
+
const [tooltipPosition, setTooltipPosition] = (0, import_react25.useState)({ x: 0, y: 0 });
|
|
10364
|
+
const tooltipRef = (0, import_react25.useRef)(null);
|
|
10365
|
+
(0, import_react25.useEffect)(() => {
|
|
10287
10366
|
if (targetRect && tooltipRef.current) {
|
|
10288
10367
|
const { width, height } = tooltipRef.current.getBoundingClientRect();
|
|
10289
10368
|
const scrollX = window.scrollX;
|
|
@@ -10314,28 +10393,28 @@ var useTooltip = ({ placement, offset, targetRect }) => {
|
|
|
10314
10393
|
|
|
10315
10394
|
// src/components/tooltip/tooltip.tsx
|
|
10316
10395
|
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
10317
|
-
var Tooltip = (0,
|
|
10396
|
+
var Tooltip = (0, import_react26.forwardRef)((originalProps, ref) => {
|
|
10318
10397
|
const [props, variantProps] = mapPropsVariants(originalProps, tooltipStyle.variantKeys);
|
|
10319
10398
|
const { placement = "top", offset = 5, delay = 100, persistent = false, classNames, noTouchContent } = props;
|
|
10320
|
-
const slots = (0,
|
|
10321
|
-
const [targetRect, setTargetRect] = (0,
|
|
10399
|
+
const slots = (0, import_react26.useMemo)(() => tooltipStyle({ ...variantProps }), [variantProps]);
|
|
10400
|
+
const [targetRect, setTargetRect] = (0, import_react26.useState)(null);
|
|
10322
10401
|
const { tooltipPosition, tooltipRef } = useTooltip({
|
|
10323
10402
|
placement,
|
|
10324
10403
|
offset,
|
|
10325
10404
|
delay,
|
|
10326
10405
|
targetRect
|
|
10327
10406
|
});
|
|
10328
|
-
const childrenRef = (0,
|
|
10329
|
-
const delayTimeoutRef = (0,
|
|
10330
|
-
const getProps = (0,
|
|
10407
|
+
const childrenRef = (0, import_react26.useRef)(null);
|
|
10408
|
+
const delayTimeoutRef = (0, import_react26.useRef)(null);
|
|
10409
|
+
const getProps = (0, import_react26.useCallback)(
|
|
10331
10410
|
(slotKey, classNameKey) => ({
|
|
10332
10411
|
className: slots[slotKey]({ class: classNames == null ? void 0 : classNames[classNameKey] })
|
|
10333
10412
|
}),
|
|
10334
10413
|
[slots, classNames]
|
|
10335
10414
|
);
|
|
10336
|
-
const getBaseProps = (0,
|
|
10337
|
-
const getContentProps = (0,
|
|
10338
|
-
const showTooltip = (0,
|
|
10415
|
+
const getBaseProps = (0, import_react26.useCallback)(() => getProps("base", "base"), [getProps]);
|
|
10416
|
+
const getContentProps = (0, import_react26.useCallback)(() => getProps("content", "content"), [getProps]);
|
|
10417
|
+
const showTooltip = (0, import_react26.useCallback)(() => {
|
|
10339
10418
|
if (childrenRef.current) {
|
|
10340
10419
|
const rect = childrenRef.current.getBoundingClientRect();
|
|
10341
10420
|
setTargetRect({
|
|
@@ -10348,12 +10427,12 @@ var Tooltip = (0, import_react25.forwardRef)((originalProps, ref) => {
|
|
|
10348
10427
|
});
|
|
10349
10428
|
}
|
|
10350
10429
|
}, []);
|
|
10351
|
-
const hideTooltip = (0,
|
|
10430
|
+
const hideTooltip = (0, import_react26.useCallback)(() => {
|
|
10352
10431
|
if (!persistent) {
|
|
10353
10432
|
delayTimeoutRef.current = window.setTimeout(() => setTargetRect(null), delay);
|
|
10354
10433
|
}
|
|
10355
10434
|
}, [persistent, delay]);
|
|
10356
|
-
(0,
|
|
10435
|
+
(0, import_react26.useEffect)(() => {
|
|
10357
10436
|
if (persistent) showTooltip();
|
|
10358
10437
|
}, [persistent, showTooltip]);
|
|
10359
10438
|
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_jsx_runtime27.Fragment, { children: [
|
|
@@ -10438,10 +10517,10 @@ var tooltipStyle = tv({
|
|
|
10438
10517
|
});
|
|
10439
10518
|
|
|
10440
10519
|
// src/components/modal/modal.tsx
|
|
10441
|
-
var
|
|
10520
|
+
var import_react27 = require("react");
|
|
10442
10521
|
var import_react_dom3 = require("react-dom");
|
|
10443
10522
|
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
10444
|
-
var Modal = (0,
|
|
10523
|
+
var Modal = (0, import_react27.forwardRef)((props, ref) => {
|
|
10445
10524
|
const [localProps, variantProps] = mapPropsVariants(props, modal.variantKeys);
|
|
10446
10525
|
const {
|
|
10447
10526
|
classNames,
|
|
@@ -10456,8 +10535,8 @@ var Modal = (0, import_react26.forwardRef)((props, ref) => {
|
|
|
10456
10535
|
onCancel,
|
|
10457
10536
|
extraFooter
|
|
10458
10537
|
} = localProps;
|
|
10459
|
-
const slots = (0,
|
|
10460
|
-
(0,
|
|
10538
|
+
const slots = (0, import_react27.useMemo)(() => modal(variantProps), [variantProps]);
|
|
10539
|
+
(0, import_react27.useEffect)(() => {
|
|
10461
10540
|
document.body.classList.toggle("overflow-hidden", !!isOpen);
|
|
10462
10541
|
if (!isOpen || isKeyboardDismissDisabled) return;
|
|
10463
10542
|
const handleKeyDown = (e) => {
|
|
@@ -10559,18 +10638,18 @@ var modal = tv({
|
|
|
10559
10638
|
});
|
|
10560
10639
|
|
|
10561
10640
|
// src/components/drawer/drawer.tsx
|
|
10562
|
-
var
|
|
10641
|
+
var import_react28 = require("react");
|
|
10563
10642
|
var import_react_dom4 = require("react-dom");
|
|
10564
10643
|
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
10565
|
-
var Drawer = (0,
|
|
10644
|
+
var Drawer = (0, import_react28.forwardRef)((props, ref) => {
|
|
10566
10645
|
const [localProps, variantProps] = mapPropsVariants(props, drawer.variantKeys);
|
|
10567
10646
|
const { classNames, isOpen, content, isKeyboardDismissDisabled = false, onClose, backdrop = true } = localProps;
|
|
10568
10647
|
const position = props.position || "right";
|
|
10569
|
-
const [shouldRender, setShouldRender] = (0,
|
|
10570
|
-
const [isAnimating, setIsAnimating] = (0,
|
|
10571
|
-
const [isContentAnimating, setIsContentAnimating] = (0,
|
|
10572
|
-
const slots = (0,
|
|
10573
|
-
(0,
|
|
10648
|
+
const [shouldRender, setShouldRender] = (0, import_react28.useState)(isOpen);
|
|
10649
|
+
const [isAnimating, setIsAnimating] = (0, import_react28.useState)(isOpen);
|
|
10650
|
+
const [isContentAnimating, setIsContentAnimating] = (0, import_react28.useState)(isOpen);
|
|
10651
|
+
const slots = (0, import_react28.useMemo)(() => drawer(variantProps), [variantProps]);
|
|
10652
|
+
(0, import_react28.useEffect)(() => {
|
|
10574
10653
|
if (isOpen) {
|
|
10575
10654
|
setShouldRender(true);
|
|
10576
10655
|
requestAnimationFrame(() => {
|
|
@@ -10588,7 +10667,7 @@ var Drawer = (0, import_react27.forwardRef)((props, ref) => {
|
|
|
10588
10667
|
return () => clearTimeout(timer);
|
|
10589
10668
|
}
|
|
10590
10669
|
}, [isOpen]);
|
|
10591
|
-
(0,
|
|
10670
|
+
(0, import_react28.useEffect)(() => {
|
|
10592
10671
|
if (shouldRender) {
|
|
10593
10672
|
document.body.classList.add("overflow-hidden");
|
|
10594
10673
|
} else {
|
|
@@ -10719,15 +10798,15 @@ var drawer = tv({
|
|
|
10719
10798
|
var drawer_default = Drawer;
|
|
10720
10799
|
|
|
10721
10800
|
// src/components/list/list.tsx
|
|
10722
|
-
var
|
|
10801
|
+
var import_react29 = require("react");
|
|
10723
10802
|
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
10724
|
-
var List = (0,
|
|
10803
|
+
var List = (0, import_react29.forwardRef)((originalProps, ref) => {
|
|
10725
10804
|
const [props, variantProps] = mapPropsVariants(originalProps, listStyle.variantKeys);
|
|
10726
10805
|
const { children, classNames } = props;
|
|
10727
|
-
const slots = (0,
|
|
10728
|
-
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { ref, className: slots.base({ class: classNames == null ? void 0 : classNames.base }), children:
|
|
10729
|
-
if (!(0,
|
|
10730
|
-
return (0,
|
|
10806
|
+
const slots = (0, import_react29.useMemo)(() => listStyle(variantProps), [variantProps]);
|
|
10807
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { ref, className: slots.base({ class: classNames == null ? void 0 : classNames.base }), children: import_react29.Children.map(children, (child) => {
|
|
10808
|
+
if (!(0, import_react29.isValidElement)(child)) return child;
|
|
10809
|
+
return (0, import_react29.cloneElement)(child, {
|
|
10731
10810
|
...variantProps,
|
|
10732
10811
|
...child.props
|
|
10733
10812
|
});
|
|
@@ -10764,9 +10843,9 @@ var listStyle = tv({
|
|
|
10764
10843
|
});
|
|
10765
10844
|
|
|
10766
10845
|
// src/components/list/listItem.tsx
|
|
10767
|
-
var
|
|
10846
|
+
var import_react30 = require("react");
|
|
10768
10847
|
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
10769
|
-
var ListItem = (0,
|
|
10848
|
+
var ListItem = (0, import_react30.forwardRef)((props, ref) => {
|
|
10770
10849
|
const [rawProps, variantProps] = mapPropsVariants(props, listItemStyle.variantKeys);
|
|
10771
10850
|
const {
|
|
10772
10851
|
title,
|
|
@@ -10778,7 +10857,7 @@ var ListItem = (0, import_react29.forwardRef)((props, ref) => {
|
|
|
10778
10857
|
classNames,
|
|
10779
10858
|
onClick
|
|
10780
10859
|
} = { ...rawProps, ...variantProps };
|
|
10781
|
-
const slots = (0,
|
|
10860
|
+
const slots = (0, import_react30.useMemo)(() => listItemStyle(variantProps), [variantProps]);
|
|
10782
10861
|
const iconSize = ["lg", "xl"].includes(size) ? "lg" : "md";
|
|
10783
10862
|
const avatarSize = iconSize;
|
|
10784
10863
|
return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { ref, className: slots.base({ class: classNames == null ? void 0 : classNames.base }), "data-selected": selected, onClick, children: [
|
|
@@ -10958,9 +11037,9 @@ var listItemStyle = tv({
|
|
|
10958
11037
|
});
|
|
10959
11038
|
|
|
10960
11039
|
// src/components/toast/toast.tsx
|
|
10961
|
-
var
|
|
11040
|
+
var import_react31 = require("react");
|
|
10962
11041
|
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
10963
|
-
var Toast = (0,
|
|
11042
|
+
var Toast = (0, import_react31.forwardRef)((originalProps, ref) => {
|
|
10964
11043
|
const [props, variantProps] = mapPropsVariants(originalProps, toast.variantKeys);
|
|
10965
11044
|
const {
|
|
10966
11045
|
title,
|
|
@@ -10974,9 +11053,9 @@ var Toast = (0, import_react30.forwardRef)((originalProps, ref) => {
|
|
|
10974
11053
|
disableAnimation,
|
|
10975
11054
|
onClose
|
|
10976
11055
|
} = { ...props, ...variantProps };
|
|
10977
|
-
const slots = (0,
|
|
10978
|
-
const toastRef = (0,
|
|
10979
|
-
(0,
|
|
11056
|
+
const slots = (0, import_react31.useMemo)(() => toast({ ...variantProps }), [variantProps]);
|
|
11057
|
+
const toastRef = (0, import_react31.useRef)(null);
|
|
11058
|
+
(0, import_react31.useImperativeHandle)(
|
|
10980
11059
|
ref,
|
|
10981
11060
|
() => ({
|
|
10982
11061
|
getWidth: () => {
|
|
@@ -11109,7 +11188,7 @@ var toast = tv({
|
|
|
11109
11188
|
});
|
|
11110
11189
|
|
|
11111
11190
|
// src/components/toast/use-toast.tsx
|
|
11112
|
-
var
|
|
11191
|
+
var import_react32 = require("react");
|
|
11113
11192
|
|
|
11114
11193
|
// src/components/toast/toast-utils.ts
|
|
11115
11194
|
var getToastPosition = (placement, width, offset) => {
|
|
@@ -11149,9 +11228,9 @@ var getToastPosition = (placement, width, offset) => {
|
|
|
11149
11228
|
|
|
11150
11229
|
// src/components/toast/use-toast.tsx
|
|
11151
11230
|
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
11152
|
-
var ToastContext = (0,
|
|
11231
|
+
var ToastContext = (0, import_react32.createContext)(null);
|
|
11153
11232
|
var useToast = () => {
|
|
11154
|
-
const context = (0,
|
|
11233
|
+
const context = (0, import_react32.useContext)(ToastContext);
|
|
11155
11234
|
if (!context) {
|
|
11156
11235
|
throw new Error("useToast must be used within a ToastProvider");
|
|
11157
11236
|
}
|
|
@@ -11161,10 +11240,10 @@ var ToastProvider = ({
|
|
|
11161
11240
|
globalOptions,
|
|
11162
11241
|
children
|
|
11163
11242
|
}) => {
|
|
11164
|
-
const [toasts, setToasts] = (0,
|
|
11165
|
-
const [containerStyle, setContainerStyle] = (0,
|
|
11166
|
-
const toastRef = (0,
|
|
11167
|
-
const addToast = (0,
|
|
11243
|
+
const [toasts, setToasts] = (0, import_react32.useState)([]);
|
|
11244
|
+
const [containerStyle, setContainerStyle] = (0, import_react32.useState)({});
|
|
11245
|
+
const toastRef = (0, import_react32.useRef)(null);
|
|
11246
|
+
const addToast = (0, import_react32.useCallback)(
|
|
11168
11247
|
(title, options = {}) => {
|
|
11169
11248
|
const id = Date.now() + Math.floor(Math.random() * 1e5);
|
|
11170
11249
|
const newToast = {
|
|
@@ -11181,11 +11260,11 @@ var ToastProvider = ({
|
|
|
11181
11260
|
},
|
|
11182
11261
|
[globalOptions]
|
|
11183
11262
|
);
|
|
11184
|
-
const removeToast = (0,
|
|
11263
|
+
const removeToast = (0, import_react32.useCallback)((id) => {
|
|
11185
11264
|
setToasts((prevToasts) => prevToasts.filter((toast2) => toast2.id !== id));
|
|
11186
11265
|
}, []);
|
|
11187
11266
|
const contextValue = addToast;
|
|
11188
|
-
(0,
|
|
11267
|
+
(0, import_react32.useEffect)(() => {
|
|
11189
11268
|
var _a;
|
|
11190
11269
|
const width = (globalOptions == null ? void 0 : globalOptions.width) ? globalOptions.width : typeof ((_a = toastRef.current) == null ? void 0 : _a.getWidth) === "function" ? toastRef.current.getWidth() : 300;
|
|
11191
11270
|
const offset = 20;
|
|
@@ -11206,12 +11285,12 @@ var ToastProvider = ({
|
|
|
11206
11285
|
};
|
|
11207
11286
|
|
|
11208
11287
|
// src/components/picker/day.tsx
|
|
11209
|
-
var
|
|
11288
|
+
var import_react33 = require("react");
|
|
11210
11289
|
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
11211
|
-
var Day = (0,
|
|
11290
|
+
var Day = (0, import_react33.forwardRef)((originalProps, ref) => {
|
|
11212
11291
|
const [props, variantProps] = mapPropsVariants(originalProps, dayStyle.variantKeys);
|
|
11213
11292
|
const { classNames, children, ...divProps } = props;
|
|
11214
|
-
const slots = (0,
|
|
11293
|
+
const slots = (0, import_react33.useMemo)(() => dayStyle({ ...variantProps }), [variantProps]);
|
|
11215
11294
|
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { ref, className: slots.base({ class: classNames == null ? void 0 : classNames.base }), ...divProps, children });
|
|
11216
11295
|
});
|
|
11217
11296
|
Day.displayName = "Day";
|
|
@@ -11248,7 +11327,7 @@ var dayStyle = tv({
|
|
|
11248
11327
|
});
|
|
11249
11328
|
|
|
11250
11329
|
// src/components/picker/datePicker.tsx
|
|
11251
|
-
var
|
|
11330
|
+
var import_react34 = require("react");
|
|
11252
11331
|
var import_react_dom5 = require("react-dom");
|
|
11253
11332
|
|
|
11254
11333
|
// src/components/picker/utils.ts
|
|
@@ -11265,7 +11344,7 @@ var formatStringToDate = (date) => {
|
|
|
11265
11344
|
|
|
11266
11345
|
// src/components/picker/datePicker.tsx
|
|
11267
11346
|
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
11268
|
-
var DatePicker = (0,
|
|
11347
|
+
var DatePicker = (0, import_react34.forwardRef)((originalProps, ref) => {
|
|
11269
11348
|
const [props, variantProps] = mapPropsVariants(originalProps, datePickerStyle.variantKeys);
|
|
11270
11349
|
const {
|
|
11271
11350
|
classNames,
|
|
@@ -11292,26 +11371,26 @@ var DatePicker = (0, import_react33.forwardRef)((originalProps, ref) => {
|
|
|
11292
11371
|
dualCalendar = false,
|
|
11293
11372
|
...inputProps
|
|
11294
11373
|
} = { ...props, ...variantProps };
|
|
11295
|
-
const [selectedDate, setSelectedDate] = (0,
|
|
11296
|
-
const [selectedRange, setSelectedRange] = (0,
|
|
11374
|
+
const [selectedDate, setSelectedDate] = (0, import_react34.useState)(range ? "" : typeof value === "string" ? value || "" : "");
|
|
11375
|
+
const [selectedRange, setSelectedRange] = (0, import_react34.useState)({
|
|
11297
11376
|
startDate: range && typeof value === "object" ? (value == null ? void 0 : value.startDate) || "" : "",
|
|
11298
11377
|
endDate: range && typeof value === "object" ? (value == null ? void 0 : value.endDate) || "" : ""
|
|
11299
11378
|
});
|
|
11300
|
-
const [tempSelectedDate, setTempSelectedDate] = (0,
|
|
11301
|
-
const [tempSelectedRange, setTempSelectedRange] = (0,
|
|
11302
|
-
const [rangeSelection, setRangeSelection] = (0,
|
|
11303
|
-
const [isPanelOpen, setIsPanelOpen] = (0,
|
|
11304
|
-
const [leftCurrentDate, setLeftCurrentDate] = (0,
|
|
11379
|
+
const [tempSelectedDate, setTempSelectedDate] = (0, import_react34.useState)(selectedDate);
|
|
11380
|
+
const [tempSelectedRange, setTempSelectedRange] = (0, import_react34.useState)(selectedRange);
|
|
11381
|
+
const [rangeSelection, setRangeSelection] = (0, import_react34.useState)("start");
|
|
11382
|
+
const [isPanelOpen, setIsPanelOpen] = (0, import_react34.useState)(false);
|
|
11383
|
+
const [leftCurrentDate, setLeftCurrentDate] = (0, import_react34.useState)(
|
|
11305
11384
|
range && tempSelectedRange.startDate ? new Date(tempSelectedRange.startDate) : tempSelectedDate ? new Date(tempSelectedDate) : /* @__PURE__ */ new Date()
|
|
11306
11385
|
);
|
|
11307
|
-
const [rightCurrentDate, setRightCurrentDate] = (0,
|
|
11386
|
+
const [rightCurrentDate, setRightCurrentDate] = (0, import_react34.useState)(
|
|
11308
11387
|
dualCalendar ? new Date(leftCurrentDate.getFullYear(), leftCurrentDate.getMonth() + 1) : /* @__PURE__ */ new Date()
|
|
11309
11388
|
);
|
|
11310
|
-
const inputWrapperRef = (0,
|
|
11311
|
-
const calendarWrapperRef = (0,
|
|
11312
|
-
const [panelPos, setPanelPos] = (0,
|
|
11313
|
-
const blurTimeoutRef = (0,
|
|
11314
|
-
const isConfirmDisabled = (0,
|
|
11389
|
+
const inputWrapperRef = (0, import_react34.useRef)(null);
|
|
11390
|
+
const calendarWrapperRef = (0, import_react34.useRef)(null);
|
|
11391
|
+
const [panelPos, setPanelPos] = (0, import_react34.useState)({ top: -9999, left: -9999 });
|
|
11392
|
+
const blurTimeoutRef = (0, import_react34.useRef)(null);
|
|
11393
|
+
const isConfirmDisabled = (0, import_react34.useMemo)(() => {
|
|
11315
11394
|
if (range) {
|
|
11316
11395
|
const hasStart = !!tempSelectedRange.startDate;
|
|
11317
11396
|
const hasEnd = !!tempSelectedRange.endDate;
|
|
@@ -11331,7 +11410,7 @@ var DatePicker = (0, import_react33.forwardRef)((originalProps, ref) => {
|
|
|
11331
11410
|
return dateString;
|
|
11332
11411
|
}
|
|
11333
11412
|
};
|
|
11334
|
-
const displayValue = (0,
|
|
11413
|
+
const displayValue = (0, import_react34.useMemo)(() => {
|
|
11335
11414
|
if (range) {
|
|
11336
11415
|
const start = formatDate(selectedRange.startDate);
|
|
11337
11416
|
const end = formatDate(selectedRange.endDate);
|
|
@@ -11341,7 +11420,7 @@ var DatePicker = (0, import_react33.forwardRef)((originalProps, ref) => {
|
|
|
11341
11420
|
}
|
|
11342
11421
|
return formatDate(selectedDate);
|
|
11343
11422
|
}, [selectedDate, selectedRange, format, range]);
|
|
11344
|
-
const calculatePosition = (0,
|
|
11423
|
+
const calculatePosition = (0, import_react34.useCallback)(() => {
|
|
11345
11424
|
if (inputWrapperRef.current) {
|
|
11346
11425
|
const rect = inputWrapperRef.current.getBoundingClientRect();
|
|
11347
11426
|
setPanelPos({ top: rect.bottom + window.scrollY + 6, left: rect.left + window.scrollX });
|
|
@@ -11384,7 +11463,7 @@ var DatePicker = (0, import_react33.forwardRef)((originalProps, ref) => {
|
|
|
11384
11463
|
e.preventDefault();
|
|
11385
11464
|
if (blurTimeoutRef.current) clearTimeout(blurTimeoutRef.current);
|
|
11386
11465
|
};
|
|
11387
|
-
const getCalendarDates = (0,
|
|
11466
|
+
const getCalendarDates = (0, import_react34.useCallback)((currentDate) => {
|
|
11388
11467
|
const year = currentDate.getFullYear();
|
|
11389
11468
|
const month = currentDate.getMonth();
|
|
11390
11469
|
const firstDayOfMonth = new Date(year, month, 1).getDay();
|
|
@@ -11480,7 +11559,7 @@ var DatePicker = (0, import_react33.forwardRef)((originalProps, ref) => {
|
|
|
11480
11559
|
}
|
|
11481
11560
|
setIsPanelOpen(false);
|
|
11482
11561
|
};
|
|
11483
|
-
const getDayProps = (0,
|
|
11562
|
+
const getDayProps = (0, import_react34.useCallback)(
|
|
11484
11563
|
(dateObj, currentDate) => {
|
|
11485
11564
|
const today = /* @__PURE__ */ new Date();
|
|
11486
11565
|
const isToday = today.getDate() === dateObj.date && today.getMonth() === currentDate.getMonth() && today.getFullYear() === currentDate.getFullYear();
|
|
@@ -11507,7 +11586,7 @@ var DatePicker = (0, import_react33.forwardRef)((originalProps, ref) => {
|
|
|
11507
11586
|
const getPlaceholderText = () => {
|
|
11508
11587
|
return placeholder;
|
|
11509
11588
|
};
|
|
11510
|
-
(0,
|
|
11589
|
+
(0, import_react34.useEffect)(() => {
|
|
11511
11590
|
if (range && typeof value === "object") {
|
|
11512
11591
|
setSelectedRange(value || { startDate: "", endDate: "" });
|
|
11513
11592
|
setTempSelectedRange(value || { startDate: "", endDate: "" });
|
|
@@ -11518,12 +11597,12 @@ var DatePicker = (0, import_react33.forwardRef)((originalProps, ref) => {
|
|
|
11518
11597
|
if (value) setLeftCurrentDate(new Date(value));
|
|
11519
11598
|
}
|
|
11520
11599
|
}, [value, range]);
|
|
11521
|
-
(0,
|
|
11600
|
+
(0, import_react34.useEffect)(() => {
|
|
11522
11601
|
if (dualCalendar) {
|
|
11523
11602
|
setRightCurrentDate(new Date(leftCurrentDate.getFullYear(), leftCurrentDate.getMonth() + 1));
|
|
11524
11603
|
}
|
|
11525
11604
|
}, [leftCurrentDate, dualCalendar]);
|
|
11526
|
-
const slots = (0,
|
|
11605
|
+
const slots = (0, import_react34.useMemo)(() => datePickerStyle({ ...variantProps, dualCalendar }), [variantProps, dualCalendar]);
|
|
11527
11606
|
const endContent = /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Icon_default, { name: "calendar", size, className: "cursor-pointer", fill: true, onClick: handleCalendarIconClick });
|
|
11528
11607
|
const renderCalendar = (currentDate, isLeft) => /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "flex flex-col gap-[5px]", children: [
|
|
11529
11608
|
/* @__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: [
|
|
@@ -11540,7 +11619,7 @@ var DatePicker = (0, import_react33.forwardRef)((originalProps, ref) => {
|
|
|
11540
11619
|
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(icon_button_default, { name: "right", variant: "soft", color: "neutral", onClick: handleLeftNextMonth })
|
|
11541
11620
|
] }) }),
|
|
11542
11621
|
/* @__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}`)) }),
|
|
11543
|
-
/* @__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)(
|
|
11622
|
+
/* @__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_react34.Fragment, { children: week.map((dateObj, index) => {
|
|
11544
11623
|
const dayVariant = getDayProps(dateObj, currentDate);
|
|
11545
11624
|
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
11546
11625
|
day_default,
|
|
@@ -11688,10 +11767,10 @@ var datePickerStyle = tv({
|
|
|
11688
11767
|
});
|
|
11689
11768
|
|
|
11690
11769
|
// src/components/picker/timePicker.tsx
|
|
11691
|
-
var
|
|
11770
|
+
var import_react35 = require("react");
|
|
11692
11771
|
var import_react_dom6 = require("react-dom");
|
|
11693
11772
|
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
11694
|
-
var TimePicker = (0,
|
|
11773
|
+
var TimePicker = (0, import_react35.forwardRef)((originalProps, ref) => {
|
|
11695
11774
|
const [props, variantProps] = mapPropsVariants(originalProps, timePickerStyle.variantKeys);
|
|
11696
11775
|
const {
|
|
11697
11776
|
classNames,
|
|
@@ -11704,20 +11783,20 @@ var TimePicker = (0, import_react34.forwardRef)((originalProps, ref) => {
|
|
|
11704
11783
|
placeholder = "",
|
|
11705
11784
|
...inputProps
|
|
11706
11785
|
} = props;
|
|
11707
|
-
const [selectedRange, setSelectedRange] = (0,
|
|
11786
|
+
const [selectedRange, setSelectedRange] = (0, import_react35.useState)(
|
|
11708
11787
|
valueRange || { start: "", end: "" }
|
|
11709
11788
|
);
|
|
11710
|
-
const [isPanelOpen, setIsPanelOpen] = (0,
|
|
11711
|
-
const inputWrapperRef = (0,
|
|
11712
|
-
const panelWrapperRef = (0,
|
|
11713
|
-
const [panelPos, setPanelPos] = (0,
|
|
11714
|
-
const displayValue = (0,
|
|
11789
|
+
const [isPanelOpen, setIsPanelOpen] = (0, import_react35.useState)(false);
|
|
11790
|
+
const inputWrapperRef = (0, import_react35.useRef)(null);
|
|
11791
|
+
const panelWrapperRef = (0, import_react35.useRef)(null);
|
|
11792
|
+
const [panelPos, setPanelPos] = (0, import_react35.useState)({ top: -9999, left: -9999 });
|
|
11793
|
+
const displayValue = (0, import_react35.useMemo)(() => {
|
|
11715
11794
|
if (selectedRange.start && selectedRange.end) {
|
|
11716
11795
|
return `${selectedRange.start} ~ ${selectedRange.end}`;
|
|
11717
11796
|
}
|
|
11718
11797
|
return "";
|
|
11719
11798
|
}, [selectedRange]);
|
|
11720
|
-
const calculatePosition = (0,
|
|
11799
|
+
const calculatePosition = (0, import_react35.useCallback)(() => {
|
|
11721
11800
|
if (inputWrapperRef.current) {
|
|
11722
11801
|
const rect = inputWrapperRef.current.getBoundingClientRect();
|
|
11723
11802
|
setPanelPos({ top: rect.bottom + window.scrollY + 6, left: rect.left + window.scrollX });
|
|
@@ -11739,7 +11818,7 @@ var TimePicker = (0, import_react34.forwardRef)((originalProps, ref) => {
|
|
|
11739
11818
|
setIsPanelOpen(false);
|
|
11740
11819
|
}
|
|
11741
11820
|
};
|
|
11742
|
-
const slots = (0,
|
|
11821
|
+
const slots = (0, import_react35.useMemo)(() => timePickerStyle({ ...variantProps }), [variantProps]);
|
|
11743
11822
|
const renderHourOptions = () => {
|
|
11744
11823
|
return Array.from({ length: 24 }, (_, i) => {
|
|
11745
11824
|
const value = String(i).padStart(2, "0");
|
|
@@ -12032,19 +12111,19 @@ var timePickerStyle = tv({
|
|
|
12032
12111
|
});
|
|
12033
12112
|
|
|
12034
12113
|
// src/components/tree/tree.tsx
|
|
12035
|
-
var
|
|
12114
|
+
var import_react36 = require("react");
|
|
12036
12115
|
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
12037
|
-
var TreeNodeItem = (0,
|
|
12116
|
+
var TreeNodeItem = (0, import_react36.forwardRef)(
|
|
12038
12117
|
({ node, depth, fileIcon, selectedName, classNames, onExpand }, ref) => {
|
|
12039
|
-
const [isOpen, setIsOpen] = (0,
|
|
12040
|
-
const [children, setChildren] = (0,
|
|
12041
|
-
const slots = (0,
|
|
12042
|
-
const hasMore = (0,
|
|
12118
|
+
const [isOpen, setIsOpen] = (0, import_react36.useState)(false);
|
|
12119
|
+
const [children, setChildren] = (0, import_react36.useState)(node.children);
|
|
12120
|
+
const slots = (0, import_react36.useMemo)(() => treeStyle(), []);
|
|
12121
|
+
const hasMore = (0, import_react36.useMemo)(() => {
|
|
12043
12122
|
if (node.isLeaf) return false;
|
|
12044
12123
|
if (Array.isArray(children)) return children.length > 0;
|
|
12045
12124
|
return typeof onExpand === "function";
|
|
12046
12125
|
}, [node.isLeaf, children, onExpand]);
|
|
12047
|
-
const toggleOpen = (0,
|
|
12126
|
+
const toggleOpen = (0, import_react36.useCallback)(async () => {
|
|
12048
12127
|
if (!isOpen && !children && onExpand && !node.isLeaf) {
|
|
12049
12128
|
try {
|
|
12050
12129
|
const result = await onExpand(node);
|
|
@@ -12120,7 +12199,7 @@ var TreeNodeItem = (0, import_react35.forwardRef)(
|
|
|
12120
12199
|
);
|
|
12121
12200
|
TreeNodeItem.displayName = "TreeNodeItem";
|
|
12122
12201
|
var Tree = ({ headerContent, group, groupIcon, fileIcon, selectedName, classNames, onExpand }) => {
|
|
12123
|
-
const slots = (0,
|
|
12202
|
+
const slots = (0, import_react36.useMemo)(() => treeStyle(), []);
|
|
12124
12203
|
const handleClick = (e) => {
|
|
12125
12204
|
var _a;
|
|
12126
12205
|
(_a = group.onClick) == null ? void 0 : _a.call(group, e);
|
|
@@ -12188,19 +12267,19 @@ var treeStyle = tv({
|
|
|
12188
12267
|
});
|
|
12189
12268
|
|
|
12190
12269
|
// src/components/fileUpload/fileUpload.tsx
|
|
12191
|
-
var
|
|
12270
|
+
var import_react39 = require("react");
|
|
12192
12271
|
var import_tailwind_variants34 = require("tailwind-variants");
|
|
12193
12272
|
|
|
12194
12273
|
// src/components/progress/progress.tsx
|
|
12195
|
-
var
|
|
12274
|
+
var import_react38 = require("react");
|
|
12196
12275
|
|
|
12197
12276
|
// src/hooks/useIsMounted.ts
|
|
12198
|
-
var
|
|
12277
|
+
var import_react37 = require("react");
|
|
12199
12278
|
function useIsMounted(props = {}) {
|
|
12200
12279
|
const { rerender = false, delay = 0 } = props;
|
|
12201
|
-
const isMountedRef = (0,
|
|
12202
|
-
const [isMounted, setIsMounted] = (0,
|
|
12203
|
-
(0,
|
|
12280
|
+
const isMountedRef = (0, import_react37.useRef)(false);
|
|
12281
|
+
const [isMounted, setIsMounted] = (0, import_react37.useState)(false);
|
|
12282
|
+
(0, import_react37.useEffect)(() => {
|
|
12204
12283
|
isMountedRef.current = true;
|
|
12205
12284
|
let timer = null;
|
|
12206
12285
|
if (rerender) {
|
|
@@ -12222,7 +12301,7 @@ function useIsMounted(props = {}) {
|
|
|
12222
12301
|
}
|
|
12223
12302
|
};
|
|
12224
12303
|
}, [rerender]);
|
|
12225
|
-
return [(0,
|
|
12304
|
+
return [(0, import_react37.useCallback)(() => isMountedRef.current, []), isMounted];
|
|
12226
12305
|
}
|
|
12227
12306
|
|
|
12228
12307
|
// src/components/progress/progress.tsx
|
|
@@ -12236,11 +12315,11 @@ var Progress = (originalProps) => {
|
|
|
12236
12315
|
delay: 100
|
|
12237
12316
|
});
|
|
12238
12317
|
const selfMounted = variantProps.disableAnimation ? true : isMounted;
|
|
12239
|
-
const percentage = (0,
|
|
12318
|
+
const percentage = (0, import_react38.useMemo)(
|
|
12240
12319
|
() => isIndeterminate || !selfMounted ? void 0 : clampPercentage((value - minValue) / (maxValue - minValue) * 100),
|
|
12241
12320
|
[selfMounted, isIndeterminate, value, minValue, maxValue]
|
|
12242
12321
|
);
|
|
12243
|
-
const slots = (0,
|
|
12322
|
+
const slots = (0, import_react38.useMemo)(() => progressStyle({ ...variantProps }), [variantProps]);
|
|
12244
12323
|
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)(
|
|
12245
12324
|
"div",
|
|
12246
12325
|
{
|
|
@@ -12357,14 +12436,14 @@ function FileUpload({
|
|
|
12357
12436
|
classNames,
|
|
12358
12437
|
defaultFile
|
|
12359
12438
|
}) {
|
|
12360
|
-
const fileInputRef = (0,
|
|
12361
|
-
const uploadIntervalRef = (0,
|
|
12362
|
-
const [currentFile, setCurrentFile] = (0,
|
|
12363
|
-
const [uploadProgress, setUploadProgress] = (0,
|
|
12364
|
-
const [message, setMessage] = (0,
|
|
12365
|
-
const [displayFileName, setDisplayFileName] = (0,
|
|
12366
|
-
const [hasUploadedFile, setHasUploadedFile] = (0,
|
|
12367
|
-
const [isUploading, setIsUploading] = (0,
|
|
12439
|
+
const fileInputRef = (0, import_react39.useRef)(null);
|
|
12440
|
+
const uploadIntervalRef = (0, import_react39.useRef)(null);
|
|
12441
|
+
const [currentFile, setCurrentFile] = (0, import_react39.useState)(null);
|
|
12442
|
+
const [uploadProgress, setUploadProgress] = (0, import_react39.useState)(0);
|
|
12443
|
+
const [message, setMessage] = (0, import_react39.useState)(errorMessage);
|
|
12444
|
+
const [displayFileName, setDisplayFileName] = (0, import_react39.useState)(() => (defaultFile == null ? void 0 : defaultFile.name) || "");
|
|
12445
|
+
const [hasUploadedFile, setHasUploadedFile] = (0, import_react39.useState)(false);
|
|
12446
|
+
const [isUploading, setIsUploading] = (0, import_react39.useState)(false);
|
|
12368
12447
|
const slots = fileUploadStyle();
|
|
12369
12448
|
const handleButtonClick = () => {
|
|
12370
12449
|
var _a;
|
|
@@ -12431,14 +12510,14 @@ function FileUpload({
|
|
|
12431
12510
|
}
|
|
12432
12511
|
if (onCancelUpload) onCancelUpload();
|
|
12433
12512
|
};
|
|
12434
|
-
(0,
|
|
12513
|
+
(0, import_react39.useEffect)(() => {
|
|
12435
12514
|
return () => {
|
|
12436
12515
|
if (uploadIntervalRef.current) {
|
|
12437
12516
|
clearInterval(uploadIntervalRef.current);
|
|
12438
12517
|
}
|
|
12439
12518
|
};
|
|
12440
12519
|
}, []);
|
|
12441
|
-
(0,
|
|
12520
|
+
(0, import_react39.useEffect)(() => {
|
|
12442
12521
|
if (errorMessage !== void 0) {
|
|
12443
12522
|
setMessage(errorMessage);
|
|
12444
12523
|
}
|
|
@@ -12573,12 +12652,12 @@ var skeletonStyle = (0, import_tailwind_variants35.tv)({
|
|
|
12573
12652
|
|
|
12574
12653
|
// src/components/charts/circularProgress.tsx
|
|
12575
12654
|
var import_recharts = require("recharts");
|
|
12576
|
-
var
|
|
12655
|
+
var import_react40 = require("react");
|
|
12577
12656
|
var import_jsx_runtime41 = require("react/jsx-runtime");
|
|
12578
|
-
var CircularProgress = (0,
|
|
12657
|
+
var CircularProgress = (0, import_react40.forwardRef)((originalProps, ref) => {
|
|
12579
12658
|
const [props, variantProps] = mapPropsVariants(originalProps, circularProgressStyle.variantKeys);
|
|
12580
12659
|
const { label, size = 150, percentage, innerContent, classNames } = { ...props, ...variantProps };
|
|
12581
|
-
const slots = (0,
|
|
12660
|
+
const slots = (0, import_react40.useMemo)(() => circularProgressStyle({ ...variantProps }), [variantProps]);
|
|
12582
12661
|
const data = [
|
|
12583
12662
|
{
|
|
12584
12663
|
name: label,
|
|
@@ -12610,7 +12689,7 @@ var CircularProgress = (0, import_react39.forwardRef)((originalProps, ref) => {
|
|
|
12610
12689
|
const colorValue = originalProps.color;
|
|
12611
12690
|
const colorKey = colorValue || "blue";
|
|
12612
12691
|
const currentGradient = gradientColors[colorKey];
|
|
12613
|
-
const wrappedInnerContent = (0,
|
|
12692
|
+
const wrappedInnerContent = (0, import_react40.useMemo)(() => {
|
|
12614
12693
|
return wrapSpanWithClass(innerContent);
|
|
12615
12694
|
}, [innerContent]);
|
|
12616
12695
|
return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { ref, className: slots.base({ class: classNames == null ? void 0 : classNames.base }), children: [
|
|
@@ -12704,16 +12783,16 @@ function wrapSpanWithClass(node) {
|
|
|
12704
12783
|
if (Array.isArray(node)) {
|
|
12705
12784
|
return node.map(wrapSpanWithClass);
|
|
12706
12785
|
}
|
|
12707
|
-
if ((0,
|
|
12786
|
+
if ((0, import_react40.isValidElement)(node)) {
|
|
12708
12787
|
const element = node;
|
|
12709
12788
|
if (element.type === "span") {
|
|
12710
12789
|
const existing = (_a = element.props.className) != null ? _a : "";
|
|
12711
|
-
return (0,
|
|
12790
|
+
return (0, import_react40.cloneElement)(element, {
|
|
12712
12791
|
className: `text-xl font-bold ${existing}`.trim()
|
|
12713
12792
|
});
|
|
12714
12793
|
}
|
|
12715
12794
|
if (element.props.children) {
|
|
12716
|
-
return (0,
|
|
12795
|
+
return (0, import_react40.cloneElement)(element, {
|
|
12717
12796
|
children: wrapSpanWithClass(element.props.children)
|
|
12718
12797
|
});
|
|
12719
12798
|
}
|
|
@@ -12723,11 +12802,11 @@ function wrapSpanWithClass(node) {
|
|
|
12723
12802
|
}
|
|
12724
12803
|
|
|
12725
12804
|
// src/components/charts/areaChart.tsx
|
|
12726
|
-
var
|
|
12805
|
+
var import_react41 = require("react");
|
|
12727
12806
|
var import_recharts2 = require("recharts");
|
|
12728
12807
|
var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
12729
|
-
var AreaChartComponent = (0,
|
|
12730
|
-
const uniqueId = (0,
|
|
12808
|
+
var AreaChartComponent = (0, import_react41.forwardRef)((originalProps, ref) => {
|
|
12809
|
+
const uniqueId = (0, import_react41.useId)();
|
|
12731
12810
|
const [props, variantProps] = mapPropsVariants(originalProps, areaChartStyle.variantKeys);
|
|
12732
12811
|
const {
|
|
12733
12812
|
data,
|
|
@@ -12739,26 +12818,26 @@ var AreaChartComponent = (0, import_react40.forwardRef)((originalProps, ref) =>
|
|
|
12739
12818
|
chartHeight = 240,
|
|
12740
12819
|
classNames
|
|
12741
12820
|
} = { ...props, ...variantProps };
|
|
12742
|
-
const slots = (0,
|
|
12821
|
+
const slots = (0, import_react41.useMemo)(() => areaChartStyle({ ...variantProps }), [variantProps]);
|
|
12743
12822
|
const COLOR_MAP = {
|
|
12744
12823
|
primary: "#3F9CF2",
|
|
12745
12824
|
danger: "#FF4684"
|
|
12746
12825
|
};
|
|
12747
|
-
const colorHex = (0,
|
|
12748
|
-
const totalChartWidth = (0,
|
|
12826
|
+
const colorHex = (0, import_react41.useMemo)(() => COLOR_MAP[color], [color]);
|
|
12827
|
+
const totalChartWidth = (0, import_react41.useMemo)(() => {
|
|
12749
12828
|
if (!data || !itemWidth) return void 0;
|
|
12750
12829
|
const dataLength = startFromZero ? data.length + 1 : data.length;
|
|
12751
12830
|
return dataLength * itemWidth;
|
|
12752
12831
|
}, [data, itemWidth, startFromZero]);
|
|
12753
|
-
const needsScroll = (0,
|
|
12832
|
+
const needsScroll = (0, import_react41.useMemo)(() => {
|
|
12754
12833
|
return totalChartWidth;
|
|
12755
12834
|
}, [totalChartWidth]);
|
|
12756
|
-
const processedData = (0,
|
|
12835
|
+
const processedData = (0, import_react41.useMemo)(() => {
|
|
12757
12836
|
if (!data) return [];
|
|
12758
12837
|
return data;
|
|
12759
12838
|
}, [data, startFromZero]);
|
|
12760
|
-
const [tickPositions, setTickPositions] = (0,
|
|
12761
|
-
const tickRef = (0,
|
|
12839
|
+
const [tickPositions, setTickPositions] = (0, import_react41.useState)([]);
|
|
12840
|
+
const tickRef = (0, import_react41.useRef)([]);
|
|
12762
12841
|
const CustomTick = ({ x, y, payload }) => {
|
|
12763
12842
|
if (x !== void 0) {
|
|
12764
12843
|
tickRef.current.push(x);
|
|
@@ -12780,7 +12859,7 @@ var AreaChartComponent = (0, import_react40.forwardRef)((originalProps, ref) =>
|
|
|
12780
12859
|
}
|
|
12781
12860
|
);
|
|
12782
12861
|
};
|
|
12783
|
-
(0,
|
|
12862
|
+
(0, import_react41.useEffect)(() => {
|
|
12784
12863
|
const raf = requestAnimationFrame(() => {
|
|
12785
12864
|
const unique = [...new Set(tickRef.current)].sort((a, b) => a - b);
|
|
12786
12865
|
const mids = [];
|
|
@@ -12907,10 +12986,10 @@ var areaChartStyle = tv({
|
|
|
12907
12986
|
});
|
|
12908
12987
|
|
|
12909
12988
|
// src/components/charts/barChart.tsx
|
|
12910
|
-
var
|
|
12989
|
+
var import_react42 = require("react");
|
|
12911
12990
|
var import_recharts3 = require("recharts");
|
|
12912
12991
|
var import_jsx_runtime43 = require("react/jsx-runtime");
|
|
12913
|
-
var BarChartComponent = (0,
|
|
12992
|
+
var BarChartComponent = (0, import_react42.forwardRef)((originalProps, ref) => {
|
|
12914
12993
|
const [props, variantProps] = mapPropsVariants(originalProps, barChartStyle.variantKeys);
|
|
12915
12994
|
const {
|
|
12916
12995
|
data = [],
|
|
@@ -12922,20 +13001,20 @@ var BarChartComponent = (0, import_react41.forwardRef)((originalProps, ref) => {
|
|
|
12922
13001
|
barGap = 20,
|
|
12923
13002
|
tooltipFormatter
|
|
12924
13003
|
} = { ...props, ...variantProps };
|
|
12925
|
-
const slots = (0,
|
|
12926
|
-
const chartRef = (0,
|
|
12927
|
-
const tooltipRef = (0,
|
|
12928
|
-
const [tooltipLeft, setTooltipLeft] = (0,
|
|
12929
|
-
const [tickPositions, setTickPositions] = (0,
|
|
12930
|
-
const tickRef = (0,
|
|
12931
|
-
const [tooltipState, setTooltipState] = (0,
|
|
13004
|
+
const slots = (0, import_react42.useMemo)(() => barChartStyle({ ...variantProps }), [variantProps]);
|
|
13005
|
+
const chartRef = (0, import_react42.useRef)(null);
|
|
13006
|
+
const tooltipRef = (0, import_react42.useRef)(null);
|
|
13007
|
+
const [tooltipLeft, setTooltipLeft] = (0, import_react42.useState)(0);
|
|
13008
|
+
const [tickPositions, setTickPositions] = (0, import_react42.useState)([]);
|
|
13009
|
+
const tickRef = (0, import_react42.useRef)([]);
|
|
13010
|
+
const [tooltipState, setTooltipState] = (0, import_react42.useState)(null);
|
|
12932
13011
|
const handleMouseEnter = (e, dataKey) => {
|
|
12933
13012
|
if (!tooltipFormatter || !chartRef.current) return;
|
|
12934
13013
|
const { payload, x, y } = e;
|
|
12935
13014
|
if (!payload || !payload[dataKey]) return;
|
|
12936
13015
|
setTooltipState({
|
|
12937
|
-
x,
|
|
12938
|
-
y,
|
|
13016
|
+
barX: x,
|
|
13017
|
+
barY: y - 10,
|
|
12939
13018
|
value: payload[dataKey],
|
|
12940
13019
|
dataKey,
|
|
12941
13020
|
label: payload.title
|
|
@@ -12988,7 +13067,7 @@ var BarChartComponent = (0, import_react41.forwardRef)((originalProps, ref) => {
|
|
|
12988
13067
|
children: yAxisTickFormatter(payload.value)
|
|
12989
13068
|
}
|
|
12990
13069
|
);
|
|
12991
|
-
(0,
|
|
13070
|
+
(0, import_react42.useEffect)(() => {
|
|
12992
13071
|
const raf = requestAnimationFrame(() => {
|
|
12993
13072
|
const unique = [...new Set(tickRef.current)].sort((a, b) => a - b);
|
|
12994
13073
|
const mids = [];
|
|
@@ -13000,13 +13079,13 @@ var BarChartComponent = (0, import_react41.forwardRef)((originalProps, ref) => {
|
|
|
13000
13079
|
});
|
|
13001
13080
|
return () => cancelAnimationFrame(raf);
|
|
13002
13081
|
}, [data]);
|
|
13003
|
-
(0,
|
|
13082
|
+
(0, import_react42.useLayoutEffect)(() => {
|
|
13004
13083
|
if (!tooltipState || !chartRef.current || !tooltipRef.current) return;
|
|
13005
13084
|
const chartRect = chartRef.current.getBoundingClientRect();
|
|
13006
13085
|
const tooltipRect = tooltipRef.current.getBoundingClientRect();
|
|
13007
13086
|
const chartWidth = chartRect.width;
|
|
13008
13087
|
const tooltipWidth = tooltipRect.width;
|
|
13009
|
-
let left = tooltipState.
|
|
13088
|
+
let left = tooltipState.barX - tooltipWidth / 2;
|
|
13010
13089
|
const padding2 = 8;
|
|
13011
13090
|
if (left < padding2) {
|
|
13012
13091
|
left = padding2;
|
|
@@ -13015,114 +13094,128 @@ var BarChartComponent = (0, import_react41.forwardRef)((originalProps, ref) => {
|
|
|
13015
13094
|
}
|
|
13016
13095
|
setTooltipLeft(left);
|
|
13017
13096
|
}, [tooltipState]);
|
|
13018
|
-
return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
|
|
13019
|
-
|
|
13020
|
-
|
|
13021
|
-
|
|
13022
|
-
{
|
|
13023
|
-
|
|
13024
|
-
|
|
13025
|
-
|
|
13026
|
-
|
|
13027
|
-
|
|
13028
|
-
|
|
13029
|
-
|
|
13030
|
-
|
|
13031
|
-
|
|
13032
|
-
|
|
13033
|
-
|
|
13034
|
-
|
|
13035
|
-
|
|
13036
|
-
|
|
13037
|
-
|
|
13038
|
-
|
|
13039
|
-
|
|
13040
|
-
|
|
13041
|
-
|
|
13042
|
-
|
|
13043
|
-
|
|
13044
|
-
|
|
13045
|
-
|
|
13046
|
-
|
|
13047
|
-
|
|
13048
|
-
|
|
13049
|
-
|
|
13050
|
-
|
|
13051
|
-
|
|
13052
|
-
|
|
13053
|
-
|
|
13054
|
-
|
|
13055
|
-
|
|
13056
|
-
|
|
13057
|
-
|
|
13058
|
-
|
|
13059
|
-
|
|
13060
|
-
|
|
13061
|
-
|
|
13062
|
-
|
|
13063
|
-
|
|
13064
|
-
|
|
13065
|
-
|
|
13066
|
-
|
|
13067
|
-
|
|
13068
|
-
|
|
13069
|
-
|
|
13070
|
-
|
|
13071
|
-
|
|
13072
|
-
|
|
13073
|
-
|
|
13074
|
-
|
|
13075
|
-
|
|
13076
|
-
|
|
13077
|
-
|
|
13078
|
-
|
|
13079
|
-
|
|
13080
|
-
|
|
13081
|
-
|
|
13082
|
-
|
|
13083
|
-
|
|
13084
|
-
|
|
13085
|
-
|
|
13086
|
-
|
|
13087
|
-
|
|
13088
|
-
|
|
13089
|
-
|
|
13090
|
-
|
|
13091
|
-
|
|
13092
|
-
|
|
13093
|
-
|
|
13094
|
-
|
|
13095
|
-
|
|
13096
|
-
|
|
13097
|
-
|
|
13098
|
-
|
|
13099
|
-
|
|
13100
|
-
|
|
13101
|
-
|
|
13102
|
-
|
|
13103
|
-
|
|
13104
|
-
|
|
13105
|
-
|
|
13106
|
-
|
|
13107
|
-
|
|
13108
|
-
|
|
13109
|
-
|
|
13110
|
-
|
|
13111
|
-
|
|
13112
|
-
|
|
13113
|
-
|
|
13114
|
-
|
|
13115
|
-
|
|
13116
|
-
|
|
13117
|
-
|
|
13118
|
-
|
|
13119
|
-
|
|
13120
|
-
|
|
13121
|
-
|
|
13122
|
-
|
|
13123
|
-
|
|
13124
|
-
|
|
13125
|
-
|
|
13097
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
|
|
13098
|
+
"div",
|
|
13099
|
+
{
|
|
13100
|
+
ref: chartRef,
|
|
13101
|
+
className: slots.base({ class: classNames == null ? void 0 : classNames.base }),
|
|
13102
|
+
onMouseLeave: handleMouseLeave,
|
|
13103
|
+
onMouseMove: (e) => {
|
|
13104
|
+
const target = e.target;
|
|
13105
|
+
if (!target.closest('[data-testid="recharts-bar-rectangle"]') && !target.closest(".recharts-bar-rectangle") && target.tagName !== "path") {
|
|
13106
|
+
setTooltipState(null);
|
|
13107
|
+
}
|
|
13108
|
+
},
|
|
13109
|
+
children: [
|
|
13110
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("p", { className: slots.label({ class: classNames == null ? void 0 : classNames.label }), children: label }),
|
|
13111
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_recharts3.ResponsiveContainer, { width: "100%", height: "100%", children: /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
|
|
13112
|
+
import_recharts3.BarChart,
|
|
13113
|
+
{
|
|
13114
|
+
data,
|
|
13115
|
+
margin: { left: -20 },
|
|
13116
|
+
barSize: 20,
|
|
13117
|
+
barGap,
|
|
13118
|
+
className: "[&_.recharts-surface]:outline-none [&_.recharts-surface]:focus:outline-none",
|
|
13119
|
+
children: [
|
|
13120
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("defs", { children: [
|
|
13121
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("linearGradient", { id: "blueGradient", x1: "0", y1: "0", x2: "0", y2: "1", children: [
|
|
13122
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("stop", { offset: "0%", stopColor: "#DEC1FA" }),
|
|
13123
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("stop", { offset: "100%", stopColor: "#3F9CF2" })
|
|
13124
|
+
] }),
|
|
13125
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("linearGradient", { id: "greenGradient", x1: "0", y1: "0", x2: "0", y2: "1", children: [
|
|
13126
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("stop", { offset: "0%", stopColor: "#C2E59C" }),
|
|
13127
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("stop", { offset: "100%", stopColor: "#64B3F4" })
|
|
13128
|
+
] }),
|
|
13129
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("linearGradient", { id: "pinkGradient", x1: "0", y1: "0", x2: "0", y2: "1", children: [
|
|
13130
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("stop", { offset: "0%", stopColor: "#DDD6F3" }),
|
|
13131
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("stop", { offset: "100%", stopColor: "#FAACA8" })
|
|
13132
|
+
] })
|
|
13133
|
+
] }),
|
|
13134
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
13135
|
+
import_recharts3.CartesianGrid,
|
|
13136
|
+
{
|
|
13137
|
+
vertical: true,
|
|
13138
|
+
horizontal: false,
|
|
13139
|
+
strokeDasharray: "4 4",
|
|
13140
|
+
className: "stroke-neutral-light",
|
|
13141
|
+
verticalPoints: tickPositions
|
|
13142
|
+
}
|
|
13143
|
+
),
|
|
13144
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
13145
|
+
import_recharts3.XAxis,
|
|
13146
|
+
{
|
|
13147
|
+
dataKey: "title",
|
|
13148
|
+
axisLine: { stroke: "#DFE2E7", strokeWidth: 1 },
|
|
13149
|
+
tickLine: false,
|
|
13150
|
+
tick: CustomTick,
|
|
13151
|
+
padding: { left: 0, right: 0 }
|
|
13152
|
+
}
|
|
13153
|
+
),
|
|
13154
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
13155
|
+
import_recharts3.YAxis,
|
|
13156
|
+
{
|
|
13157
|
+
axisLine: { stroke: "#DFE2E7", strokeWidth: 1 },
|
|
13158
|
+
tickLine: false,
|
|
13159
|
+
tick: CustomYAxisTick,
|
|
13160
|
+
ticks: yAxisTicks,
|
|
13161
|
+
domain: yAxisDomain
|
|
13162
|
+
}
|
|
13163
|
+
),
|
|
13164
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
13165
|
+
import_recharts3.Bar,
|
|
13166
|
+
{
|
|
13167
|
+
dataKey: "blue",
|
|
13168
|
+
fill: "url(#blueGradient)",
|
|
13169
|
+
shape: CustomBarShape,
|
|
13170
|
+
onMouseEnter: (e) => handleMouseEnter(e, "blue"),
|
|
13171
|
+
onMouseLeave: handleMouseLeave
|
|
13172
|
+
}
|
|
13173
|
+
),
|
|
13174
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
13175
|
+
import_recharts3.Bar,
|
|
13176
|
+
{
|
|
13177
|
+
dataKey: "green",
|
|
13178
|
+
fill: "url(#greenGradient)",
|
|
13179
|
+
shape: CustomBarShape,
|
|
13180
|
+
onMouseEnter: (e) => handleMouseEnter(e, "green"),
|
|
13181
|
+
onMouseLeave: handleMouseLeave
|
|
13182
|
+
}
|
|
13183
|
+
),
|
|
13184
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
13185
|
+
import_recharts3.Bar,
|
|
13186
|
+
{
|
|
13187
|
+
dataKey: "pink",
|
|
13188
|
+
fill: "url(#pinkGradient)",
|
|
13189
|
+
shape: CustomBarShape,
|
|
13190
|
+
onMouseEnter: (e) => handleMouseEnter(e, "pink"),
|
|
13191
|
+
onMouseLeave: handleMouseLeave
|
|
13192
|
+
}
|
|
13193
|
+
)
|
|
13194
|
+
]
|
|
13195
|
+
}
|
|
13196
|
+
) }),
|
|
13197
|
+
tooltipFormatter && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
13198
|
+
"div",
|
|
13199
|
+
{
|
|
13200
|
+
ref: tooltipRef,
|
|
13201
|
+
style: {
|
|
13202
|
+
position: "absolute",
|
|
13203
|
+
left: tooltipLeft + 10,
|
|
13204
|
+
top: (tooltipState == null ? void 0 : tooltipState.barY) || 0,
|
|
13205
|
+
pointerEvents: "none",
|
|
13206
|
+
zIndex: 10,
|
|
13207
|
+
opacity: tooltipState ? 1 : 0,
|
|
13208
|
+
transition: "opacity 0.1s ease-out",
|
|
13209
|
+
visibility: tooltipState ? "visible" : "hidden",
|
|
13210
|
+
width: "fit-content",
|
|
13211
|
+
whiteSpace: "nowrap"
|
|
13212
|
+
},
|
|
13213
|
+
children: tooltipState && tooltipFormatter(tooltipState)
|
|
13214
|
+
}
|
|
13215
|
+
)
|
|
13216
|
+
]
|
|
13217
|
+
}
|
|
13218
|
+
);
|
|
13126
13219
|
});
|
|
13127
13220
|
BarChartComponent.displayName = "barChart";
|
|
13128
13221
|
var barChart_default = BarChartComponent;
|
|
@@ -13146,13 +13239,13 @@ function BarChartTooltip({ className = "", children }) {
|
|
|
13146
13239
|
|
|
13147
13240
|
// src/components/charts/radarChart.tsx
|
|
13148
13241
|
var import_recharts4 = require("recharts");
|
|
13149
|
-
var
|
|
13242
|
+
var import_react43 = require("react");
|
|
13150
13243
|
var import_jsx_runtime44 = require("react/jsx-runtime");
|
|
13151
|
-
var RadarChart = (0,
|
|
13244
|
+
var RadarChart = (0, import_react43.forwardRef)((originalProps, ref) => {
|
|
13152
13245
|
const [props, variantProps] = mapPropsVariants(originalProps, radarChartStyle.variantKeys);
|
|
13153
13246
|
const { data, label, classNames, tooltipFormatter } = { ...props, ...variantProps };
|
|
13154
|
-
const slots = (0,
|
|
13155
|
-
const normalizedData = (0,
|
|
13247
|
+
const slots = (0, import_react43.useMemo)(() => radarChartStyle({ ...variantProps }), [variantProps]);
|
|
13248
|
+
const normalizedData = (0, import_react43.useMemo)(() => {
|
|
13156
13249
|
if (!data || data.length === 0) return [];
|
|
13157
13250
|
return data.map((item) => ({
|
|
13158
13251
|
...item,
|
|
@@ -13161,18 +13254,18 @@ var RadarChart = (0, import_react42.forwardRef)((originalProps, ref) => {
|
|
|
13161
13254
|
originalFullMark: item.fullMark || 100
|
|
13162
13255
|
}));
|
|
13163
13256
|
}, [data]);
|
|
13164
|
-
const containerHeight = (0,
|
|
13257
|
+
const containerHeight = (0, import_react43.useMemo)(() => {
|
|
13165
13258
|
if (!data || data.length === 0) return 250;
|
|
13166
13259
|
return data.length === 3 ? 245 : 306;
|
|
13167
13260
|
}, [data]);
|
|
13168
|
-
const chartMargin = (0,
|
|
13261
|
+
const chartMargin = (0, import_react43.useMemo)(() => {
|
|
13169
13262
|
return { top: 0, right: 0, bottom: 0, left: 0 };
|
|
13170
13263
|
}, [data]);
|
|
13171
|
-
const outerRadius = (0,
|
|
13264
|
+
const outerRadius = (0, import_react43.useMemo)(() => {
|
|
13172
13265
|
if (!data || data.length === 0) return 125;
|
|
13173
13266
|
return data.length === 3 ? 135 : 125;
|
|
13174
13267
|
}, [data]);
|
|
13175
|
-
const chartCenter = (0,
|
|
13268
|
+
const chartCenter = (0, import_react43.useMemo)(() => {
|
|
13176
13269
|
if (!data || data.length === 0) return {};
|
|
13177
13270
|
if (data.length === 3) return { cx: "50%", cy: "65%" };
|
|
13178
13271
|
return {};
|
|
@@ -13249,10 +13342,10 @@ var radarChartStyle = tv({
|
|
|
13249
13342
|
});
|
|
13250
13343
|
|
|
13251
13344
|
// src/components/charts/simpleBarChart.tsx
|
|
13252
|
-
var
|
|
13345
|
+
var import_react44 = require("react");
|
|
13253
13346
|
var import_recharts5 = require("recharts");
|
|
13254
13347
|
var import_jsx_runtime45 = require("react/jsx-runtime");
|
|
13255
|
-
var SimpleBarChartComponent = (0,
|
|
13348
|
+
var SimpleBarChartComponent = (0, import_react44.forwardRef)((originalProps, ref) => {
|
|
13256
13349
|
const [props, variantProps] = mapPropsVariants(originalProps, simpleBarChartStyle.variantKeys);
|
|
13257
13350
|
const {
|
|
13258
13351
|
data = [],
|
|
@@ -13263,13 +13356,13 @@ var SimpleBarChartComponent = (0, import_react43.forwardRef)((originalProps, ref
|
|
|
13263
13356
|
barGap = 20,
|
|
13264
13357
|
tooltipFormatter
|
|
13265
13358
|
} = { ...props, ...variantProps };
|
|
13266
|
-
const slots = (0,
|
|
13267
|
-
const chartRef = (0,
|
|
13268
|
-
const tooltipRef = (0,
|
|
13269
|
-
const [tooltipLeft, setTooltipLeft] = (0,
|
|
13270
|
-
const [tickPositions, setTickPositions] = (0,
|
|
13271
|
-
const [tooltipState, setTooltipState] = (0,
|
|
13272
|
-
(0,
|
|
13359
|
+
const slots = (0, import_react44.useMemo)(() => simpleBarChartStyle({ ...variantProps }), [variantProps]);
|
|
13360
|
+
const chartRef = (0, import_react44.useRef)(null);
|
|
13361
|
+
const tooltipRef = (0, import_react44.useRef)(null);
|
|
13362
|
+
const [tooltipLeft, setTooltipLeft] = (0, import_react44.useState)(0);
|
|
13363
|
+
const [tickPositions, setTickPositions] = (0, import_react44.useState)([]);
|
|
13364
|
+
const [tooltipState, setTooltipState] = (0, import_react44.useState)(null);
|
|
13365
|
+
(0, import_react44.useEffect)(() => {
|
|
13273
13366
|
if (!chartRef.current || !data.length) return;
|
|
13274
13367
|
const updateDimensions = () => {
|
|
13275
13368
|
if (!chartRef.current) return;
|
|
@@ -13305,8 +13398,8 @@ var SimpleBarChartComponent = (0, import_react43.forwardRef)((originalProps, ref
|
|
|
13305
13398
|
const { payload, x, y } = e;
|
|
13306
13399
|
if (!payload) return;
|
|
13307
13400
|
setTooltipState({
|
|
13308
|
-
x,
|
|
13309
|
-
y,
|
|
13401
|
+
barX: x,
|
|
13402
|
+
barY: y - 20,
|
|
13310
13403
|
value: payload.value,
|
|
13311
13404
|
label: payload.title
|
|
13312
13405
|
});
|
|
@@ -13343,13 +13436,13 @@ var SimpleBarChartComponent = (0, import_react43.forwardRef)((originalProps, ref
|
|
|
13343
13436
|
}
|
|
13344
13437
|
);
|
|
13345
13438
|
};
|
|
13346
|
-
(0,
|
|
13439
|
+
(0, import_react44.useLayoutEffect)(() => {
|
|
13347
13440
|
if (!tooltipState || !chartRef.current || !tooltipRef.current) return;
|
|
13348
13441
|
const chartRect = chartRef.current.getBoundingClientRect();
|
|
13349
13442
|
const tooltipRect = tooltipRef.current.getBoundingClientRect();
|
|
13350
13443
|
const chartWidth = chartRect.width;
|
|
13351
13444
|
const tooltipWidth = tooltipRect.width;
|
|
13352
|
-
let left = tooltipState.
|
|
13445
|
+
let left = tooltipState.barX - tooltipWidth / 2;
|
|
13353
13446
|
const padding2 = 8;
|
|
13354
13447
|
if (left < padding2) {
|
|
13355
13448
|
left = padding2;
|
|
@@ -13358,82 +13451,96 @@ var SimpleBarChartComponent = (0, import_react43.forwardRef)((originalProps, ref
|
|
|
13358
13451
|
}
|
|
13359
13452
|
setTooltipLeft(left);
|
|
13360
13453
|
}, [tooltipState]);
|
|
13361
|
-
return /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(
|
|
13362
|
-
|
|
13363
|
-
|
|
13364
|
-
|
|
13365
|
-
{
|
|
13366
|
-
|
|
13367
|
-
|
|
13368
|
-
|
|
13369
|
-
|
|
13370
|
-
|
|
13371
|
-
|
|
13372
|
-
|
|
13373
|
-
|
|
13374
|
-
|
|
13375
|
-
|
|
13376
|
-
|
|
13377
|
-
|
|
13378
|
-
|
|
13379
|
-
|
|
13380
|
-
|
|
13381
|
-
|
|
13382
|
-
|
|
13383
|
-
|
|
13384
|
-
|
|
13385
|
-
|
|
13386
|
-
|
|
13387
|
-
|
|
13388
|
-
|
|
13389
|
-
|
|
13390
|
-
|
|
13391
|
-
|
|
13392
|
-
|
|
13393
|
-
|
|
13394
|
-
|
|
13395
|
-
|
|
13396
|
-
|
|
13397
|
-
|
|
13398
|
-
|
|
13399
|
-
|
|
13400
|
-
|
|
13401
|
-
|
|
13402
|
-
|
|
13403
|
-
|
|
13404
|
-
|
|
13405
|
-
|
|
13406
|
-
|
|
13407
|
-
|
|
13408
|
-
|
|
13409
|
-
|
|
13410
|
-
|
|
13411
|
-
|
|
13412
|
-
|
|
13413
|
-
|
|
13414
|
-
|
|
13415
|
-
|
|
13416
|
-
|
|
13417
|
-
|
|
13418
|
-
|
|
13419
|
-
|
|
13420
|
-
|
|
13421
|
-
|
|
13422
|
-
|
|
13423
|
-
|
|
13424
|
-
|
|
13425
|
-
|
|
13426
|
-
|
|
13427
|
-
|
|
13428
|
-
|
|
13429
|
-
|
|
13430
|
-
|
|
13431
|
-
|
|
13432
|
-
|
|
13433
|
-
|
|
13434
|
-
|
|
13435
|
-
|
|
13436
|
-
|
|
13454
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(
|
|
13455
|
+
"div",
|
|
13456
|
+
{
|
|
13457
|
+
ref: chartRef,
|
|
13458
|
+
className: slots.base({ class: classNames == null ? void 0 : classNames.base }),
|
|
13459
|
+
onMouseLeave: handleMouseLeave,
|
|
13460
|
+
onMouseMove: (e) => {
|
|
13461
|
+
const target = e.target;
|
|
13462
|
+
if (!target.closest('[data-testid="recharts-bar-rectangle"]') && !target.closest(".recharts-bar-rectangle") && target.tagName !== "path") {
|
|
13463
|
+
setTooltipState(null);
|
|
13464
|
+
}
|
|
13465
|
+
},
|
|
13466
|
+
children: [
|
|
13467
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("p", { className: slots.label({ class: classNames == null ? void 0 : classNames.label }), children: label }),
|
|
13468
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_recharts5.ResponsiveContainer, { width: "100%", height: 140, children: /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(
|
|
13469
|
+
import_recharts5.BarChart,
|
|
13470
|
+
{
|
|
13471
|
+
data,
|
|
13472
|
+
margin: { left: 0, right: 0, top: 0, bottom: 0 },
|
|
13473
|
+
barSize: 10,
|
|
13474
|
+
barGap,
|
|
13475
|
+
className: "[&_.recharts-surface]:outline-none [&_.recharts-surface]:focus:outline-none",
|
|
13476
|
+
children: [
|
|
13477
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
13478
|
+
import_recharts5.CartesianGrid,
|
|
13479
|
+
{
|
|
13480
|
+
vertical: true,
|
|
13481
|
+
horizontal: false,
|
|
13482
|
+
strokeDasharray: "4 4",
|
|
13483
|
+
className: "stroke-neutral-light",
|
|
13484
|
+
verticalPoints: tickPositions
|
|
13485
|
+
}
|
|
13486
|
+
),
|
|
13487
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
13488
|
+
import_recharts5.CartesianGrid,
|
|
13489
|
+
{
|
|
13490
|
+
vertical: true,
|
|
13491
|
+
horizontal: false,
|
|
13492
|
+
strokeDasharray: "0",
|
|
13493
|
+
strokeWidth: 2,
|
|
13494
|
+
className: "stroke-neutral-light",
|
|
13495
|
+
verticalPoints: [0]
|
|
13496
|
+
}
|
|
13497
|
+
),
|
|
13498
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
13499
|
+
import_recharts5.XAxis,
|
|
13500
|
+
{
|
|
13501
|
+
dataKey: "title",
|
|
13502
|
+
axisLine: { stroke: "#DFE2E7", strokeWidth: 1 },
|
|
13503
|
+
tickLine: false,
|
|
13504
|
+
tick: CustomTick,
|
|
13505
|
+
padding: { left: 0, right: 0 }
|
|
13506
|
+
}
|
|
13507
|
+
),
|
|
13508
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_recharts5.YAxis, { hide: true, ticks: yAxisTicks, domain: yAxisDomain }),
|
|
13509
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
13510
|
+
import_recharts5.Bar,
|
|
13511
|
+
{
|
|
13512
|
+
dataKey: "value",
|
|
13513
|
+
fill: "#C7E5FA",
|
|
13514
|
+
shape: CustomBarShape,
|
|
13515
|
+
onMouseEnter: handleMouseEnter,
|
|
13516
|
+
onMouseLeave: handleMouseLeave
|
|
13517
|
+
}
|
|
13518
|
+
)
|
|
13519
|
+
]
|
|
13520
|
+
}
|
|
13521
|
+
) }),
|
|
13522
|
+
tooltipFormatter && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
13523
|
+
"div",
|
|
13524
|
+
{
|
|
13525
|
+
ref: tooltipRef,
|
|
13526
|
+
style: {
|
|
13527
|
+
position: "absolute",
|
|
13528
|
+
left: tooltipLeft + 5,
|
|
13529
|
+
top: (tooltipState == null ? void 0 : tooltipState.barY) || 0,
|
|
13530
|
+
pointerEvents: "none",
|
|
13531
|
+
zIndex: 10,
|
|
13532
|
+
opacity: tooltipState ? 1 : 0,
|
|
13533
|
+
transition: "opacity 0.1s ease-out",
|
|
13534
|
+
visibility: tooltipState ? "visible" : "hidden",
|
|
13535
|
+
width: "fit-content",
|
|
13536
|
+
whiteSpace: "nowrap"
|
|
13537
|
+
},
|
|
13538
|
+
children: tooltipState && tooltipFormatter(tooltipState)
|
|
13539
|
+
}
|
|
13540
|
+
)
|
|
13541
|
+
]
|
|
13542
|
+
}
|
|
13543
|
+
);
|
|
13437
13544
|
});
|
|
13438
13545
|
SimpleBarChartComponent.displayName = "simpleBarChart";
|
|
13439
13546
|
var simpleBarChart_default = SimpleBarChartComponent;
|
|
@@ -13447,9 +13554,9 @@ var simpleBarChartStyle = tv({
|
|
|
13447
13554
|
});
|
|
13448
13555
|
|
|
13449
13556
|
// src/components/starRating/starRating.tsx
|
|
13450
|
-
var
|
|
13557
|
+
var import_react45 = require("react");
|
|
13451
13558
|
var import_jsx_runtime46 = require("react/jsx-runtime");
|
|
13452
|
-
var StarRating = (0,
|
|
13559
|
+
var StarRating = (0, import_react45.forwardRef)((originalProps, ref) => {
|
|
13453
13560
|
const [props, variantProps] = mapPropsVariants(originalProps, starRatingStyle.variantKeys);
|
|
13454
13561
|
const {
|
|
13455
13562
|
stars,
|
|
@@ -13462,8 +13569,8 @@ var StarRating = (0, import_react44.forwardRef)((originalProps, ref) => {
|
|
|
13462
13569
|
filledColor = "text-primary-main",
|
|
13463
13570
|
emptyColor = "text-neutral-soft"
|
|
13464
13571
|
} = { ...props, ...variantProps };
|
|
13465
|
-
const slots = (0,
|
|
13466
|
-
const [hoverRating, setHoverRating] = (0,
|
|
13572
|
+
const slots = (0, import_react45.useMemo)(() => starRatingStyle({ ...variantProps }), [variantProps]);
|
|
13573
|
+
const [hoverRating, setHoverRating] = (0, import_react45.useState)(0);
|
|
13467
13574
|
const handleStarClick = (starIndex, isHalf = false) => {
|
|
13468
13575
|
if (readOnly || !onChange) return;
|
|
13469
13576
|
let newRating;
|