react-better-html 1.1.115 → 1.1.117
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/dist/index.d.mts +62 -7
- package/dist/index.d.ts +62 -7
- package/dist/index.js +473 -73
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +478 -78
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -52,6 +52,7 @@ __export(index_exports, {
|
|
|
52
52
|
Tabs: () => Tabs_default,
|
|
53
53
|
Text: () => Text_default,
|
|
54
54
|
ToggleInput: () => ToggleInput_default,
|
|
55
|
+
Tooltip: () => Tooltip_default,
|
|
55
56
|
colorThemeControls: () => colorThemeControls,
|
|
56
57
|
countries: () => countries,
|
|
57
58
|
darkenColor: () => darkenColor,
|
|
@@ -6943,6 +6944,14 @@ var TableStyledComponent = import_styled_components11.default.table.withConfig({
|
|
|
6943
6944
|
cursor: pointer;
|
|
6944
6945
|
}
|
|
6945
6946
|
|
|
6947
|
+
&.isExpandRow {
|
|
6948
|
+
height: 0px;
|
|
6949
|
+
|
|
6950
|
+
td {
|
|
6951
|
+
border-top: none;
|
|
6952
|
+
}
|
|
6953
|
+
}
|
|
6954
|
+
|
|
6946
6955
|
${(props) => props.isStriped ? import_styled_components11.css`
|
|
6947
6956
|
&:nth-child(even) {
|
|
6948
6957
|
background-color: ${props.theme.colors.backgroundSecondary};
|
|
@@ -7020,6 +7029,7 @@ var TableComponent = (0, import_react23.forwardRef)(function Table({
|
|
|
7020
7029
|
const { colorTheme } = useBetterHtmlContextInternal();
|
|
7021
7030
|
const filterModalRef = (0, import_react23.useRef)(null);
|
|
7022
7031
|
const [checkedItems, setCheckedItems] = (0, import_react23.useState)([]);
|
|
7032
|
+
const [expandedRows, setExpandedRows] = (0, import_react23.useState)([]);
|
|
7023
7033
|
const [currentPage, setCurrentPage] = (0, import_react23.useState)(1);
|
|
7024
7034
|
const [filterData, setFilterData] = (0, import_react23.useState)({});
|
|
7025
7035
|
const [openedFilterColumnIndex, setOpenedFilterColumnIndex] = (0, import_react23.useState)();
|
|
@@ -7052,30 +7062,35 @@ var TableComponent = (0, import_react23.forwardRef)(function Table({
|
|
|
7052
7062
|
filterModalRef.current?.close();
|
|
7053
7063
|
}
|
|
7054
7064
|
});
|
|
7065
|
+
const expandRow = (0, import_react23.useMemo)(() => columns.find((column) => column.type === "expand"), [columns]);
|
|
7055
7066
|
const renderCellContent = (0, import_react23.useCallback)(
|
|
7056
|
-
(column, item,
|
|
7067
|
+
(column, item, itemIndex) => {
|
|
7057
7068
|
switch (column.type) {
|
|
7058
7069
|
case "text": {
|
|
7059
7070
|
const value = column.keyName ? item[column.keyName] : void 0;
|
|
7060
|
-
|
|
7071
|
+
const textProps = (typeof column.getTextProps === "function" ? column.getTextProps?.(item, itemIndex) : column.getTextProps) ?? {};
|
|
7072
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Text_default, { ...textProps, children: column.format?.(item, itemIndex) ?? String(value ?? "") });
|
|
7061
7073
|
}
|
|
7062
7074
|
case "element": {
|
|
7063
|
-
return column.render?.(item,
|
|
7075
|
+
return column.render?.(item, itemIndex) ?? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_jsx_runtime21.Fragment, {});
|
|
7064
7076
|
}
|
|
7065
7077
|
case "image": {
|
|
7066
|
-
const
|
|
7067
|
-
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Image_default, {
|
|
7078
|
+
const imageProps = (typeof column.getImageProps === "function" ? column.getImageProps?.(item, itemIndex) : column.getImageProps) ?? {};
|
|
7079
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Image_default, { width: "100%", borderRadius: theme2.styles.borderRadius / 2, ...imageProps });
|
|
7068
7080
|
}
|
|
7069
7081
|
case "checkbox": {
|
|
7070
|
-
const { onChange, ...toggleInputProps } = column.
|
|
7071
|
-
const checkedValue = checkedItems[
|
|
7082
|
+
const { onChange, ...toggleInputProps } = (typeof column.getToggleInputProps === "function" ? column.getToggleInputProps?.(item, itemIndex) : column.getToggleInputProps) ?? {};
|
|
7083
|
+
const checkedValue = checkedItems[itemIndex];
|
|
7072
7084
|
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
7073
7085
|
ToggleInput_default.checkbox,
|
|
7074
7086
|
{
|
|
7075
7087
|
checked: checkedValue,
|
|
7088
|
+
value: item,
|
|
7076
7089
|
onChange: (checked, value) => {
|
|
7077
7090
|
setCheckedItems(
|
|
7078
|
-
(oldValue) => oldValue.map(
|
|
7091
|
+
(oldValue) => oldValue.map(
|
|
7092
|
+
(isChecked, internalIndex) => internalIndex === itemIndex ? checked : isChecked
|
|
7093
|
+
)
|
|
7079
7094
|
);
|
|
7080
7095
|
onChange?.(checked, value);
|
|
7081
7096
|
},
|
|
@@ -7083,18 +7098,37 @@ var TableComponent = (0, import_react23.forwardRef)(function Table({
|
|
|
7083
7098
|
}
|
|
7084
7099
|
);
|
|
7085
7100
|
}
|
|
7101
|
+
case "expand": {
|
|
7102
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
7103
|
+
Icon_default,
|
|
7104
|
+
{
|
|
7105
|
+
name: "chevronDown",
|
|
7106
|
+
transform: `rotate(${expandedRows[itemIndex] ? 180 : 0}deg)`,
|
|
7107
|
+
transition: theme2.styles.transition
|
|
7108
|
+
}
|
|
7109
|
+
);
|
|
7110
|
+
}
|
|
7086
7111
|
default: {
|
|
7087
7112
|
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_jsx_runtime21.Fragment, {});
|
|
7088
7113
|
}
|
|
7089
7114
|
}
|
|
7090
7115
|
},
|
|
7091
|
-
[theme2, checkedItems]
|
|
7116
|
+
[theme2, checkedItems, expandedRows]
|
|
7092
7117
|
);
|
|
7093
7118
|
const onClickRowElement = (0, import_react23.useCallback)(
|
|
7094
7119
|
(item, index) => {
|
|
7095
|
-
|
|
7120
|
+
if (expandRow) {
|
|
7121
|
+
setExpandedRows((oldValue) => {
|
|
7122
|
+
if (oldValue[index] === void 0) {
|
|
7123
|
+
const newValue = expandRow.onlyOneExpanded ? [] : [...oldValue];
|
|
7124
|
+
newValue[index] = true;
|
|
7125
|
+
return newValue;
|
|
7126
|
+
}
|
|
7127
|
+
return oldValue.map((isExpanded, internalIndex) => internalIndex === index ? !isExpanded : isExpanded);
|
|
7128
|
+
});
|
|
7129
|
+
} else onClickRow?.(item, index);
|
|
7096
7130
|
},
|
|
7097
|
-
[onClickRow]
|
|
7131
|
+
[onClickRow, expandRow]
|
|
7098
7132
|
);
|
|
7099
7133
|
const onClickAllCheckboxesElement = (0, import_react23.useCallback)(
|
|
7100
7134
|
(checked) => {
|
|
@@ -7219,6 +7253,14 @@ var TableComponent = (0, import_react23.forwardRef)(function Table({
|
|
|
7219
7253
|
},
|
|
7220
7254
|
[openedFilterColumn]
|
|
7221
7255
|
);
|
|
7256
|
+
const renderExpandedRow = (0, import_react23.useCallback)(
|
|
7257
|
+
(...props2) => {
|
|
7258
|
+
const expandColumn = columns.find((column) => column.type === "expand");
|
|
7259
|
+
if (!expandColumn) return;
|
|
7260
|
+
return expandColumn.render?.(...props2);
|
|
7261
|
+
},
|
|
7262
|
+
[columns]
|
|
7263
|
+
);
|
|
7222
7264
|
const dataAfterFilter = (0, import_react23.useMemo)(
|
|
7223
7265
|
() => data.filter(
|
|
7224
7266
|
(item) => Object.entries(filterData).every(([columnIndex, filter]) => {
|
|
@@ -7336,7 +7378,7 @@ var TableComponent = (0, import_react23.forwardRef)(function Table({
|
|
|
7336
7378
|
TableStyledComponent,
|
|
7337
7379
|
{
|
|
7338
7380
|
isStriped,
|
|
7339
|
-
withHover: onClickRow !== void 0,
|
|
7381
|
+
withHover: onClickRow !== void 0 || expandRow !== void 0,
|
|
7340
7382
|
withStickyHeader,
|
|
7341
7383
|
colorTheme,
|
|
7342
7384
|
theme: theme2,
|
|
@@ -7344,7 +7386,7 @@ var TableComponent = (0, import_react23.forwardRef)(function Table({
|
|
|
7344
7386
|
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("tr", { className: "isHeader", children: columns.map((column, index) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
7345
7387
|
ThStyledComponent,
|
|
7346
7388
|
{
|
|
7347
|
-
width: column.width ?? (column.type === "image" ? defaultImageWidth : column.type === "checkbox" ? 26 : void 0),
|
|
7389
|
+
width: column.width ?? (column.type === "image" ? defaultImageWidth : column.type === "checkbox" ? 26 : column.type === "expand" ? 16 : void 0),
|
|
7348
7390
|
minWidth: column.minWidth,
|
|
7349
7391
|
maxWidth: column.maxWidth,
|
|
7350
7392
|
textAlign: column.align,
|
|
@@ -7378,15 +7420,24 @@ var TableComponent = (0, import_react23.forwardRef)(function Table({
|
|
|
7378
7420
|
},
|
|
7379
7421
|
column.type + column.label + index
|
|
7380
7422
|
)) }) }),
|
|
7381
|
-
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("tbody", { children: isLoading ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("tr", { className: "withoutHover", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("td", { className: "noData", colSpan: columns.length, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Loader_default.box, {}) }) }) : dataAfterPagination.length > 0 ? dataAfterPagination.map((item, rowIndex) => /* @__PURE__ */ (0, import_jsx_runtime21.
|
|
7382
|
-
|
|
7383
|
-
|
|
7384
|
-
|
|
7385
|
-
|
|
7386
|
-
|
|
7387
|
-
|
|
7388
|
-
|
|
7389
|
-
|
|
7423
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("tbody", { children: isLoading ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("tr", { className: "withoutHover", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("td", { className: "noData", colSpan: columns.length, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Loader_default.box, {}) }) }) : dataAfterPagination.length > 0 ? dataAfterPagination.map((item, rowIndex) => /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_react23.Fragment, { children: [
|
|
7424
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
7425
|
+
"tr",
|
|
7426
|
+
{
|
|
7427
|
+
className: onClickRow || expandRow ? "isClickable" : void 0,
|
|
7428
|
+
onClick: () => onClickRowElement(item, rowIndex),
|
|
7429
|
+
children: columns.map((column, colIndex) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
7430
|
+
TdStyledComponent,
|
|
7431
|
+
{
|
|
7432
|
+
textAlign: column.align,
|
|
7433
|
+
children: renderCellContent(column, item, rowIndex)
|
|
7434
|
+
},
|
|
7435
|
+
column.type + column.label + colIndex
|
|
7436
|
+
))
|
|
7437
|
+
}
|
|
7438
|
+
),
|
|
7439
|
+
expandedRows[rowIndex] && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("tr", { className: "withoutHover isExpandRow", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("td", { colSpan: columns.length, children: renderExpandedRow(item, rowIndex) }) })
|
|
7440
|
+
] }, JSON.stringify(item) + rowIndex)) : /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("tr", { className: "withoutHover", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("td", { className: "noData", colSpan: columns.length, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Text_default.unknown, { children: noDataItemsMessage }) }) }) }),
|
|
7390
7441
|
pageSize !== void 0 && pageCountInternal > 1 && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("tfoot", { children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("tr", { className: "isFooter", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("td", { colSpan: columns.length, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
7391
7442
|
Div_default.column,
|
|
7392
7443
|
{
|
|
@@ -7598,20 +7649,368 @@ var TableComponent = (0, import_react23.forwardRef)(function Table({
|
|
|
7598
7649
|
var Table2 = (0, import_react23.memo)(TableComponent);
|
|
7599
7650
|
var Table_default = Table2;
|
|
7600
7651
|
|
|
7601
|
-
// src/components/
|
|
7652
|
+
// src/components/Tooltip.tsx
|
|
7602
7653
|
var import_react24 = require("react");
|
|
7654
|
+
var import_styled_components12 = __toESM(require("styled-components"));
|
|
7603
7655
|
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
7656
|
+
var tooltipContainerStyle = (props) => ({
|
|
7657
|
+
top: import_styled_components12.css`
|
|
7658
|
+
bottom: calc(100% + ${props.gap}px + ${props.arrowSize}px);
|
|
7659
|
+
${props.align === "center" ? "left: 50%;" : props.align === "left" ? "left: 0;" : "right: 0;"}
|
|
7660
|
+
`,
|
|
7661
|
+
bottom: import_styled_components12.css`
|
|
7662
|
+
top: calc(100% + ${props.gap}px + ${props.arrowSize}px);
|
|
7663
|
+
${props.align === "center" ? "left: 50%;" : props.align === "left" ? "left: 0;" : "right: 0;"};
|
|
7664
|
+
`,
|
|
7665
|
+
left: import_styled_components12.css`
|
|
7666
|
+
${props.align === "center" ? "top: 50%;" : props.align === "top" ? "top: 0;" : "bottom: 0;"};
|
|
7667
|
+
right: calc(100% + ${props.gap}px + ${props.arrowSize}px);
|
|
7668
|
+
`,
|
|
7669
|
+
right: import_styled_components12.css`
|
|
7670
|
+
${props.align === "center" ? "top: 50%;" : props.align === "top" ? "top: 0;" : "bottom: 0;"};
|
|
7671
|
+
left: calc(100% + ${props.gap}px + ${props.arrowSize}px);
|
|
7672
|
+
`
|
|
7673
|
+
});
|
|
7674
|
+
var tooltipPositionStyle = (props) => ({
|
|
7675
|
+
top: {
|
|
7676
|
+
opened: import_styled_components12.css`
|
|
7677
|
+
transform: translateX(${props.align === "center" ? "-50%" : "0"});
|
|
7678
|
+
`,
|
|
7679
|
+
closed: import_styled_components12.css`
|
|
7680
|
+
transform: translateX(${props.align === "center" ? "-50%" : "0"}) translateY(${props.theme.styles.gap}px);
|
|
7681
|
+
`
|
|
7682
|
+
},
|
|
7683
|
+
bottom: {
|
|
7684
|
+
opened: import_styled_components12.css`
|
|
7685
|
+
transform: translateX(${props.align === "center" ? "-50%" : "0"});
|
|
7686
|
+
`,
|
|
7687
|
+
closed: import_styled_components12.css`
|
|
7688
|
+
transform: translateX(${props.align === "center" ? "-50%" : "0"}) translateY(-${props.theme.styles.gap}px);
|
|
7689
|
+
`
|
|
7690
|
+
},
|
|
7691
|
+
left: {
|
|
7692
|
+
opened: import_styled_components12.css`
|
|
7693
|
+
transform: translateY(${props.align === "center" ? "-50%" : "0"});
|
|
7694
|
+
`,
|
|
7695
|
+
closed: import_styled_components12.css`
|
|
7696
|
+
transform: translateX(${props.theme.styles.gap}px) translateY(${props.align === "center" ? "-50%" : "0"});
|
|
7697
|
+
`
|
|
7698
|
+
},
|
|
7699
|
+
right: {
|
|
7700
|
+
opened: import_styled_components12.css`
|
|
7701
|
+
transform: translateY(${props.align === "center" ? "-50%" : "0"});
|
|
7702
|
+
`,
|
|
7703
|
+
closed: import_styled_components12.css`
|
|
7704
|
+
transform: translateX(-${props.theme.styles.gap}px) translateY(${props.align === "center" ? "-50%" : "0"});
|
|
7705
|
+
`
|
|
7706
|
+
}
|
|
7707
|
+
});
|
|
7708
|
+
var TooltipContainer = import_styled_components12.default.div.withConfig({
|
|
7709
|
+
shouldForwardProp: (prop) => !["theme", "position", "align", "withArrow", "arrowSize", "isOpen", "gap"].includes(prop)
|
|
7710
|
+
})`
|
|
7711
|
+
position: absolute;
|
|
7712
|
+
opacity: ${(props) => props.isOpen ? 1 : 0};
|
|
7713
|
+
pointer-events: ${(props) => props.isOpen ? "auto" : "none"};
|
|
7714
|
+
transition: ${(props) => props.theme.styles.transition};
|
|
7715
|
+
z-index: 1000;
|
|
7716
|
+
|
|
7717
|
+
${(props) => tooltipContainerStyle(props)[props.position]}
|
|
7718
|
+
|
|
7719
|
+
${(props) => props.isOpen ? tooltipPositionStyle(props)[props.position].opened : tooltipPositionStyle(props)[props.position].closed}
|
|
7720
|
+
`;
|
|
7721
|
+
var arrowStyle = (props, borderWidth) => ({
|
|
7722
|
+
top: {
|
|
7723
|
+
borderTopColor: props.color,
|
|
7724
|
+
borderBottom: 0,
|
|
7725
|
+
top: borderWidth ? -props.size : void 0,
|
|
7726
|
+
left: borderWidth ? -props.size + borderWidth * 2 : props.align === "center" ? "50%" : props.align === "left" ? props.sideSpace : void 0,
|
|
7727
|
+
right: !borderWidth && props.align === "right" ? props.sideSpace : void 0,
|
|
7728
|
+
bottom: -props.size + 1,
|
|
7729
|
+
transform: !borderWidth && props.align === "center" ? "translateX(-50%)" : void 0
|
|
7730
|
+
},
|
|
7731
|
+
bottom: {
|
|
7732
|
+
borderBottomColor: props.color,
|
|
7733
|
+
borderTop: 0,
|
|
7734
|
+
top: borderWidth ? borderWidth * 2 : -props.size + 1,
|
|
7735
|
+
left: borderWidth ? -props.size + borderWidth * 2 : props.align === "center" ? "50%" : props.align === "left" ? props.sideSpace : void 0,
|
|
7736
|
+
right: !borderWidth && props.align === "right" ? props.sideSpace : void 0,
|
|
7737
|
+
transform: !borderWidth && props.align === "center" ? "translateX(-50%);" : void 0
|
|
7738
|
+
},
|
|
7739
|
+
left: {
|
|
7740
|
+
borderLeftColor: props.color,
|
|
7741
|
+
borderRight: 0,
|
|
7742
|
+
top: borderWidth ? -props.size + borderWidth * 2 : props.align === "center" ? "50%" : props.align === "top" ? props.sideSpace : void 0,
|
|
7743
|
+
bottom: !borderWidth && props.align === "bottom" ? props.sideSpace : void 0,
|
|
7744
|
+
left: borderWidth ? -props.size : void 0,
|
|
7745
|
+
right: -props.size + 1,
|
|
7746
|
+
transform: !borderWidth && props.align === "center" ? "translateY(-50%)" : void 0
|
|
7747
|
+
},
|
|
7748
|
+
right: {
|
|
7749
|
+
borderRightColor: props.color,
|
|
7750
|
+
borderLeft: 0,
|
|
7751
|
+
top: borderWidth ? -props.size + borderWidth * 2 : props.align === "center" ? "50%" : props.align === "top" ? props.sideSpace : void 0,
|
|
7752
|
+
bottom: !borderWidth && props.align === "bottom" ? props.sideSpace : void 0,
|
|
7753
|
+
left: borderWidth ? borderWidth * 2 : -props.size + 1,
|
|
7754
|
+
transform: !borderWidth && props.align === "center" ? "translateY(-50%);" : void 0
|
|
7755
|
+
}
|
|
7756
|
+
});
|
|
7757
|
+
var Arrow = (0, import_react24.memo)(function Arrow2(props) {
|
|
7758
|
+
const theme2 = useTheme();
|
|
7759
|
+
const { position, size } = props;
|
|
7760
|
+
const outerProps = (0, import_react24.useMemo)(
|
|
7761
|
+
() => ({
|
|
7762
|
+
...props,
|
|
7763
|
+
color: theme2.colors.border
|
|
7764
|
+
}),
|
|
7765
|
+
[props, theme2]
|
|
7766
|
+
);
|
|
7767
|
+
const borderWidth = 1;
|
|
7768
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
7769
|
+
Div_default,
|
|
7770
|
+
{
|
|
7771
|
+
position: "absolute",
|
|
7772
|
+
width: 0,
|
|
7773
|
+
height: 0,
|
|
7774
|
+
border: `${size}px solid transparent`,
|
|
7775
|
+
...arrowStyle(outerProps)[position],
|
|
7776
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
7777
|
+
Div_default,
|
|
7778
|
+
{
|
|
7779
|
+
position: "absolute",
|
|
7780
|
+
width: 0,
|
|
7781
|
+
height: 0,
|
|
7782
|
+
border: `${size - borderWidth * 2}px solid transparent`,
|
|
7783
|
+
...arrowStyle(props, borderWidth)[position]
|
|
7784
|
+
}
|
|
7785
|
+
)
|
|
7786
|
+
}
|
|
7787
|
+
);
|
|
7788
|
+
});
|
|
7789
|
+
var TooltipComponent = (0, import_react24.forwardRef)(function Tooltip({
|
|
7790
|
+
position = "bottom",
|
|
7791
|
+
trigger = "hover",
|
|
7792
|
+
align = "center",
|
|
7793
|
+
content,
|
|
7794
|
+
contentWidth,
|
|
7795
|
+
contentMinWidth,
|
|
7796
|
+
withArrow,
|
|
7797
|
+
isSmall,
|
|
7798
|
+
backgroundColor,
|
|
7799
|
+
asContextMenu,
|
|
7800
|
+
onOpen,
|
|
7801
|
+
onClose,
|
|
7802
|
+
children
|
|
7803
|
+
}, ref) {
|
|
7804
|
+
const theme2 = useTheme();
|
|
7805
|
+
const triggerHolderRef = (0, import_react24.useRef)(null);
|
|
7806
|
+
const contentRef = (0, import_react24.useRef)(null);
|
|
7807
|
+
const tooltipContainerRef = (0, import_react24.useRef)(null);
|
|
7808
|
+
const closeTimerRef = (0, import_react24.useRef)(void 0);
|
|
7809
|
+
const [isOpen, setIsOpen] = (0, import_react24.useState)(false);
|
|
7810
|
+
const [isOpenLate, setIsOpenLate] = (0, import_react24.useState)(false);
|
|
7811
|
+
const arrowSize = withArrow ? theme2.styles.gap : 0;
|
|
7812
|
+
const gap = theme2.styles.gap / 2;
|
|
7813
|
+
const outsideScreenGap = theme2.styles.gap / 2;
|
|
7814
|
+
const totalGap = arrowSize + gap;
|
|
7815
|
+
const openTooltip = (0, import_react24.useCallback)(() => {
|
|
7816
|
+
if (closeTimerRef.current) clearTimeout(closeTimerRef.current);
|
|
7817
|
+
setIsOpen(true);
|
|
7818
|
+
setIsOpenLate(true);
|
|
7819
|
+
setTimeout(() => {
|
|
7820
|
+
if (!tooltipContainerRef.current) return;
|
|
7821
|
+
if (!contentRef.current) return;
|
|
7822
|
+
const clientRects = tooltipContainerRef.current.getBoundingClientRect();
|
|
7823
|
+
if (clientRects) {
|
|
7824
|
+
const { width, height, x, y } = clientRects;
|
|
7825
|
+
const topOutside = y < 0;
|
|
7826
|
+
const bottomOutside = y + height > window.innerHeight;
|
|
7827
|
+
const leftOutside = x < 0;
|
|
7828
|
+
const rightOutside = x + width > window.innerWidth;
|
|
7829
|
+
if (topOutside) contentRef.current.style.transform = `translateY(${y * -1 + outsideScreenGap}px)`;
|
|
7830
|
+
if (bottomOutside)
|
|
7831
|
+
contentRef.current.style.transform = `translateY(${window.innerHeight - (y + height) - totalGap}px)`;
|
|
7832
|
+
if (leftOutside) contentRef.current.style.transform = `translateX(${x * -1 + outsideScreenGap}px)`;
|
|
7833
|
+
if (rightOutside)
|
|
7834
|
+
contentRef.current.style.transform = `translateX(${window.innerWidth - (x + width) - totalGap}px)`;
|
|
7835
|
+
}
|
|
7836
|
+
}, 1);
|
|
7837
|
+
onOpen?.();
|
|
7838
|
+
}, [onOpen, outsideScreenGap, totalGap]);
|
|
7839
|
+
const closeTooltip = (0, import_react24.useCallback)(() => {
|
|
7840
|
+
setIsOpen(false);
|
|
7841
|
+
closeTimerRef.current = setTimeout(() => setIsOpenLate(false), 300);
|
|
7842
|
+
onClose?.();
|
|
7843
|
+
}, [onClose]);
|
|
7844
|
+
const onMouseEnter = (0, import_react24.useCallback)(() => {
|
|
7845
|
+
if (trigger === "hover") openTooltip();
|
|
7846
|
+
}, [trigger, openTooltip]);
|
|
7847
|
+
const onMouseLeave = (0, import_react24.useCallback)(() => {
|
|
7848
|
+
if (trigger === "hover") closeTooltip();
|
|
7849
|
+
}, [trigger, closeTooltip]);
|
|
7850
|
+
const onClickHolder = (0, import_react24.useCallback)(
|
|
7851
|
+
(event) => {
|
|
7852
|
+
if (trigger === "click") {
|
|
7853
|
+
if (!isOpen) openTooltip();
|
|
7854
|
+
else if (triggerHolderRef.current?.contains(event.target)) closeTooltip();
|
|
7855
|
+
}
|
|
7856
|
+
},
|
|
7857
|
+
[trigger, openTooltip, isOpen, closeTooltip]
|
|
7858
|
+
);
|
|
7859
|
+
const onClickOutside = (0, import_react24.useCallback)(
|
|
7860
|
+
(event) => {
|
|
7861
|
+
if (!isOpen) return;
|
|
7862
|
+
if (trigger !== "click") return;
|
|
7863
|
+
if (!contentRef.current?.contains(event.target) && !triggerHolderRef.current?.contains(event.target)) {
|
|
7864
|
+
closeTooltip();
|
|
7865
|
+
}
|
|
7866
|
+
},
|
|
7867
|
+
[trigger, isOpen, closeTooltip]
|
|
7868
|
+
);
|
|
7869
|
+
(0, import_react24.useEffect)(() => {
|
|
7870
|
+
if (trigger === "click") {
|
|
7871
|
+
document.addEventListener("mousedown", onClickOutside);
|
|
7872
|
+
return () => {
|
|
7873
|
+
document.removeEventListener("mousedown", onClickOutside);
|
|
7874
|
+
};
|
|
7875
|
+
}
|
|
7876
|
+
}, [trigger, onClickOutside]);
|
|
7877
|
+
(0, import_react24.useImperativeHandle)(
|
|
7878
|
+
ref,
|
|
7879
|
+
() => {
|
|
7880
|
+
return {
|
|
7881
|
+
isOpen,
|
|
7882
|
+
open: openTooltip,
|
|
7883
|
+
close: closeTooltip
|
|
7884
|
+
};
|
|
7885
|
+
},
|
|
7886
|
+
[isOpen, openTooltip, closeTooltip]
|
|
7887
|
+
);
|
|
7888
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(Div_default, { position: "relative", onClick: onClickHolder, onMouseEnter, onMouseLeave, children: [
|
|
7889
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Div_default, { width: "100%", ref: triggerHolderRef, children }),
|
|
7890
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
7891
|
+
TooltipContainer,
|
|
7892
|
+
{
|
|
7893
|
+
theme: theme2,
|
|
7894
|
+
position,
|
|
7895
|
+
align,
|
|
7896
|
+
withArrow,
|
|
7897
|
+
arrowSize,
|
|
7898
|
+
gap,
|
|
7899
|
+
isOpen,
|
|
7900
|
+
role: "tooltip",
|
|
7901
|
+
ref: tooltipContainerRef,
|
|
7902
|
+
children: (isOpen || isOpenLate) && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(Div_default, { position: "relative", ref: contentRef, children: [
|
|
7903
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
7904
|
+
Div_default.box,
|
|
7905
|
+
{
|
|
7906
|
+
position: "relative",
|
|
7907
|
+
width: contentWidth,
|
|
7908
|
+
minWidth: contentMinWidth,
|
|
7909
|
+
backgroundColor: backgroundColor ?? theme2.colors.backgroundContent,
|
|
7910
|
+
boxShadow: "0px 10px 20px #00000020",
|
|
7911
|
+
paddingBlock: isSmall ? theme2.styles.gap / 2 : theme2.styles.gap,
|
|
7912
|
+
paddingInline: asContextMenu ? 0 : isSmall ? theme2.styles.space / 2 : theme2.styles.space,
|
|
7913
|
+
overflow: asContextMenu ? "hidden" : void 0,
|
|
7914
|
+
children: content
|
|
7915
|
+
}
|
|
7916
|
+
),
|
|
7917
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
7918
|
+
Div_default,
|
|
7919
|
+
{
|
|
7920
|
+
position: "absolute",
|
|
7921
|
+
width: position === "left" || position === "right" ? totalGap : "100%",
|
|
7922
|
+
height: position === "top" || position === "bottom" ? totalGap : "100%",
|
|
7923
|
+
top: position === "top" ? "100%" : position === "bottom" ? void 0 : 0,
|
|
7924
|
+
bottom: position === "bottom" ? "100%" : position === "top" ? void 0 : 0,
|
|
7925
|
+
left: position === "left" ? "100%" : position === "right" ? void 0 : 0,
|
|
7926
|
+
right: position === "right" ? "100%" : position === "left" ? void 0 : 0,
|
|
7927
|
+
borderTopLeftRadius: 999,
|
|
7928
|
+
borderTopRightRadius: 999
|
|
7929
|
+
}
|
|
7930
|
+
),
|
|
7931
|
+
withArrow && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
7932
|
+
Arrow,
|
|
7933
|
+
{
|
|
7934
|
+
position,
|
|
7935
|
+
align,
|
|
7936
|
+
sideSpace: theme2.styles.borderRadius,
|
|
7937
|
+
size: arrowSize,
|
|
7938
|
+
color: backgroundColor ?? theme2.colors.backgroundContent,
|
|
7939
|
+
isOpen
|
|
7940
|
+
}
|
|
7941
|
+
)
|
|
7942
|
+
] })
|
|
7943
|
+
}
|
|
7944
|
+
)
|
|
7945
|
+
] });
|
|
7946
|
+
});
|
|
7947
|
+
TooltipComponent.item = (0, import_react24.forwardRef)(function Item({ icon, text, description, isActive, value, id, onClick, onClickWithValue }, ref) {
|
|
7948
|
+
const theme2 = useTheme();
|
|
7949
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
7950
|
+
Div_default.row,
|
|
7951
|
+
{
|
|
7952
|
+
alignItems: "center",
|
|
7953
|
+
gap: theme2.styles.space,
|
|
7954
|
+
backgroundColor: theme2.colors.backgroundContent,
|
|
7955
|
+
filterHover: "brightness(0.9)",
|
|
7956
|
+
paddingBlock: theme2.styles.gap,
|
|
7957
|
+
paddingInline: theme2.styles.space,
|
|
7958
|
+
cursor: "pointer",
|
|
7959
|
+
id,
|
|
7960
|
+
value,
|
|
7961
|
+
onClick,
|
|
7962
|
+
onClickWithValue,
|
|
7963
|
+
ref,
|
|
7964
|
+
children: [
|
|
7965
|
+
icon && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Icon_default, { name: icon, color: !isActive ? theme2.colors.textSecondary : void 0 }),
|
|
7966
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(Div_default.column, { flex: 1, gap: theme2.styles.gap / 2, children: [
|
|
7967
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Text_default, { fontWeight: isActive ? 700 : void 0, children: text }),
|
|
7968
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Text_default, { fontSize: 14, color: theme2.colors.textSecondary, children: description })
|
|
7969
|
+
] })
|
|
7970
|
+
]
|
|
7971
|
+
}
|
|
7972
|
+
);
|
|
7973
|
+
});
|
|
7974
|
+
TooltipComponent.divider = (0, import_react24.forwardRef)(function DividerComponent(props, ref) {
|
|
7975
|
+
const theme2 = useTheme();
|
|
7976
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Divider_default.horizontal, { marginBlock: theme2.styles.gap, ...props, ref });
|
|
7977
|
+
});
|
|
7978
|
+
TooltipComponent.sectionTitle = (0, import_react24.forwardRef)(function SectionTitle({ text, ...props }, ref) {
|
|
7979
|
+
const theme2 = useTheme();
|
|
7980
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
7981
|
+
Text_default,
|
|
7982
|
+
{
|
|
7983
|
+
fontSize: 12,
|
|
7984
|
+
fontWeight: 700,
|
|
7985
|
+
textTransform: "uppercase",
|
|
7986
|
+
marginBlock: theme2.styles.gap / 2,
|
|
7987
|
+
marginInline: theme2.styles.space,
|
|
7988
|
+
...props,
|
|
7989
|
+
ref,
|
|
7990
|
+
children: text
|
|
7991
|
+
}
|
|
7992
|
+
);
|
|
7993
|
+
});
|
|
7994
|
+
var Tooltip2 = (0, import_react24.memo)(TooltipComponent);
|
|
7995
|
+
Tooltip2.item = TooltipComponent.item;
|
|
7996
|
+
Tooltip2.divider = TooltipComponent.divider;
|
|
7997
|
+
Tooltip2.sectionTitle = TooltipComponent.sectionTitle;
|
|
7998
|
+
var Tooltip_default = Tooltip2;
|
|
7999
|
+
|
|
8000
|
+
// src/components/Tabs.tsx
|
|
8001
|
+
var import_react25 = require("react");
|
|
8002
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
7604
8003
|
var tabBottomLineWidth = 2;
|
|
7605
8004
|
var tabDotSize = 6;
|
|
7606
8005
|
var defaultTabName = "tab";
|
|
7607
|
-
var TabsComponent = (0,
|
|
8006
|
+
var TabsComponent = (0, import_react25.forwardRef)(function Tabs({ tabs, name, accentColor, style = "default", onChange, children, ...props }, ref) {
|
|
7608
8007
|
const reactRouterDomPlugin2 = usePlugin("react-router-dom");
|
|
7609
8008
|
const theme2 = useTheme();
|
|
7610
8009
|
const urlQuery = reactRouterDomPlugin2 ? useUrlQuery() : void 0;
|
|
7611
8010
|
const { colorTheme, componentsState } = useBetterHtmlContextInternal();
|
|
7612
|
-
const firstRenderPassedRef = (0,
|
|
7613
|
-
const tabsRef = (0,
|
|
7614
|
-
const [selectedTab, setSelectedTab] = (0,
|
|
8011
|
+
const firstRenderPassedRef = (0, import_react25.useRef)(false);
|
|
8012
|
+
const tabsRef = (0, import_react25.useRef)({});
|
|
8013
|
+
const [selectedTab, setSelectedTab] = (0, import_react25.useState)(() => {
|
|
7615
8014
|
const selectedTabValue = tabs[0] ?? "";
|
|
7616
8015
|
if (urlQuery) {
|
|
7617
8016
|
const tabQueryValue = urlQuery.getQuery(name ?? defaultTabName);
|
|
@@ -7620,9 +8019,9 @@ var TabsComponent = (0, import_react24.forwardRef)(function Tabs({ tabs, name, a
|
|
|
7620
8019
|
}
|
|
7621
8020
|
return selectedTabValue;
|
|
7622
8021
|
});
|
|
7623
|
-
const [rerenderState, setRerenderState] = (0,
|
|
8022
|
+
const [rerenderState, setRerenderState] = (0, import_react25.useState)(0);
|
|
7624
8023
|
const tabsGap = style === "box" ? theme2.styles.gap / 2 : 0;
|
|
7625
|
-
const onClickTab = (0,
|
|
8024
|
+
const onClickTab = (0, import_react25.useCallback)(
|
|
7626
8025
|
(tab) => {
|
|
7627
8026
|
setSelectedTab(tab);
|
|
7628
8027
|
onChange?.(tab);
|
|
@@ -7634,11 +8033,11 @@ var TabsComponent = (0, import_react24.forwardRef)(function Tabs({ tabs, name, a
|
|
|
7634
8033
|
},
|
|
7635
8034
|
[onChange, name, urlQuery]
|
|
7636
8035
|
);
|
|
7637
|
-
const width = (0,
|
|
8036
|
+
const width = (0, import_react25.useMemo)(
|
|
7638
8037
|
() => tabsRef.current[selectedTab]?.getBoundingClientRect().width ?? 0,
|
|
7639
8038
|
[rerenderState, selectedTab]
|
|
7640
8039
|
);
|
|
7641
|
-
const leftSpacing = (0,
|
|
8040
|
+
const leftSpacing = (0, import_react25.useMemo)(() => {
|
|
7642
8041
|
const selectedTabIndex = tabs.findIndex((tab) => tab === selectedTab);
|
|
7643
8042
|
let spacing = 0;
|
|
7644
8043
|
Object.values(tabsRef.current).forEach((tab, index) => {
|
|
@@ -7646,7 +8045,7 @@ var TabsComponent = (0, import_react24.forwardRef)(function Tabs({ tabs, name, a
|
|
|
7646
8045
|
});
|
|
7647
8046
|
return spacing;
|
|
7648
8047
|
}, [selectedTab, tabs, tabsGap]);
|
|
7649
|
-
(0,
|
|
8048
|
+
(0, import_react25.useEffect)(() => {
|
|
7650
8049
|
const timeout = setTimeout(() => {
|
|
7651
8050
|
setRerenderState(Math.random());
|
|
7652
8051
|
firstRenderPassedRef.current = true;
|
|
@@ -7655,7 +8054,7 @@ var TabsComponent = (0, import_react24.forwardRef)(function Tabs({ tabs, name, a
|
|
|
7655
8054
|
clearTimeout(timeout);
|
|
7656
8055
|
};
|
|
7657
8056
|
}, []);
|
|
7658
|
-
(0,
|
|
8057
|
+
(0, import_react25.useEffect)(() => {
|
|
7659
8058
|
componentsState.tabs.setTabGroups((oldValue) => {
|
|
7660
8059
|
const thisTabGroup = oldValue.find((item) => item.name === (name ?? defaultTabName));
|
|
7661
8060
|
if (thisTabGroup) {
|
|
@@ -7676,20 +8075,20 @@ var TabsComponent = (0, import_react24.forwardRef)(function Tabs({ tabs, name, a
|
|
|
7676
8075
|
}
|
|
7677
8076
|
});
|
|
7678
8077
|
}, [selectedTab, name]);
|
|
7679
|
-
(0,
|
|
8078
|
+
(0, import_react25.useEffect)(() => {
|
|
7680
8079
|
tabsRef.current[selectedTab]?.scrollIntoView({
|
|
7681
8080
|
behavior: firstRenderPassedRef.current ? "smooth" : void 0,
|
|
7682
8081
|
block: "nearest"
|
|
7683
8082
|
});
|
|
7684
8083
|
}, [selectedTab]);
|
|
7685
|
-
(0,
|
|
8084
|
+
(0, import_react25.useEffect)(() => {
|
|
7686
8085
|
return () => {
|
|
7687
8086
|
componentsState.tabs.setTabGroups(
|
|
7688
8087
|
(oldValue) => oldValue.filter((item) => item.name !== (name ?? defaultTabName))
|
|
7689
8088
|
);
|
|
7690
8089
|
};
|
|
7691
8090
|
}, []);
|
|
7692
|
-
(0,
|
|
8091
|
+
(0, import_react25.useImperativeHandle)(
|
|
7693
8092
|
ref,
|
|
7694
8093
|
() => {
|
|
7695
8094
|
return {
|
|
@@ -7699,11 +8098,11 @@ var TabsComponent = (0, import_react24.forwardRef)(function Tabs({ tabs, name, a
|
|
|
7699
8098
|
},
|
|
7700
8099
|
[selectedTab, onClickTab]
|
|
7701
8100
|
);
|
|
7702
|
-
return /* @__PURE__ */ (0,
|
|
7703
|
-
/* @__PURE__ */ (0,
|
|
7704
|
-
/* @__PURE__ */ (0,
|
|
8101
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(Div_default.column, { width: "100%", gap: theme2.styles.space, ...props, children: [
|
|
8102
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(Div_default, { position: "relative", className: "react-better-html-no-scrollbar", overflowY: "auto", children: [
|
|
8103
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Div_default.row, { position: "relative", width: "fit-content", gap: tabsGap, userSelect: "none", children: tabs.map((tab) => {
|
|
7705
8104
|
const selected = tab === selectedTab;
|
|
7706
|
-
return /* @__PURE__ */ (0,
|
|
8105
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
7707
8106
|
Div_default,
|
|
7708
8107
|
{
|
|
7709
8108
|
position: "relative",
|
|
@@ -7724,7 +8123,7 @@ var TabsComponent = (0, import_react24.forwardRef)(function Tabs({ tabs, name, a
|
|
|
7724
8123
|
tabsRef.current[tab] = ref2;
|
|
7725
8124
|
},
|
|
7726
8125
|
children: [
|
|
7727
|
-
componentsState.tabs.tabsWithDots.includes(tab) && /* @__PURE__ */ (0,
|
|
8126
|
+
componentsState.tabs.tabsWithDots.includes(tab) && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
7728
8127
|
Div_default,
|
|
7729
8128
|
{
|
|
7730
8129
|
position: "absolute",
|
|
@@ -7737,7 +8136,7 @@ var TabsComponent = (0, import_react24.forwardRef)(function Tabs({ tabs, name, a
|
|
|
7737
8136
|
transition: theme2.styles.transition
|
|
7738
8137
|
}
|
|
7739
8138
|
),
|
|
7740
|
-
/* @__PURE__ */ (0,
|
|
8139
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
7741
8140
|
Text_default,
|
|
7742
8141
|
{
|
|
7743
8142
|
fontWeight: 700,
|
|
@@ -7752,7 +8151,7 @@ var TabsComponent = (0, import_react24.forwardRef)(function Tabs({ tabs, name, a
|
|
|
7752
8151
|
tab
|
|
7753
8152
|
);
|
|
7754
8153
|
}) }),
|
|
7755
|
-
style !== "box" && /* @__PURE__ */ (0,
|
|
8154
|
+
style !== "box" && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
7756
8155
|
Div_default,
|
|
7757
8156
|
{
|
|
7758
8157
|
position: "absolute",
|
|
@@ -7765,16 +8164,16 @@ var TabsComponent = (0, import_react24.forwardRef)(function Tabs({ tabs, name, a
|
|
|
7765
8164
|
}
|
|
7766
8165
|
)
|
|
7767
8166
|
] }),
|
|
7768
|
-
children && /* @__PURE__ */ (0,
|
|
8167
|
+
children && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Div_default, { width: "100%", children })
|
|
7769
8168
|
] });
|
|
7770
8169
|
});
|
|
7771
8170
|
TabsComponent.content = function Content({ tab, tabWithDot, tabsGroupName, isInitialTab, children }) {
|
|
7772
8171
|
const { componentsState } = useBetterHtmlContextInternal();
|
|
7773
|
-
const thisTabGroupData = (0,
|
|
8172
|
+
const thisTabGroupData = (0, import_react25.useMemo)(
|
|
7774
8173
|
() => componentsState.tabs.tabGroups.find((item) => item.name === (tabsGroupName ?? defaultTabName)),
|
|
7775
8174
|
[componentsState.tabs, tabsGroupName]
|
|
7776
8175
|
);
|
|
7777
|
-
(0,
|
|
8176
|
+
(0, import_react25.useEffect)(() => {
|
|
7778
8177
|
if (tabWithDot) {
|
|
7779
8178
|
componentsState.tabs.setTabsWithDots?.((oldValue) => oldValue.includes(tab) ? oldValue : [...oldValue, tab]);
|
|
7780
8179
|
} else {
|
|
@@ -7783,18 +8182,18 @@ TabsComponent.content = function Content({ tab, tabWithDot, tabsGroupName, isIni
|
|
|
7783
8182
|
);
|
|
7784
8183
|
}
|
|
7785
8184
|
}, [tabWithDot]);
|
|
7786
|
-
return (thisTabGroupData ? thisTabGroupData.selectedTab === tab : isInitialTab) ? /* @__PURE__ */ (0,
|
|
8185
|
+
return (thisTabGroupData ? thisTabGroupData.selectedTab === tab : isInitialTab) ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Div_default, { width: "100%", children }) : void 0;
|
|
7787
8186
|
};
|
|
7788
|
-
var Tabs2 = (0,
|
|
8187
|
+
var Tabs2 = (0, import_react25.memo)(TabsComponent);
|
|
7789
8188
|
Tabs2.content = TabsComponent.content;
|
|
7790
8189
|
var Tabs_default = Tabs2;
|
|
7791
8190
|
|
|
7792
8191
|
// src/components/Foldable.tsx
|
|
7793
|
-
var
|
|
7794
|
-
var
|
|
8192
|
+
var import_react26 = require("react");
|
|
8193
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
7795
8194
|
var animationDurationClose = 0.15;
|
|
7796
8195
|
var animationDurationOpen = animationDurationClose * 2;
|
|
7797
|
-
var FoldableComponent = (0,
|
|
8196
|
+
var FoldableComponent = (0, import_react26.forwardRef)(function Foldable({
|
|
7798
8197
|
isOpen: controlledIsOpen,
|
|
7799
8198
|
defaultOpen = false,
|
|
7800
8199
|
title,
|
|
@@ -7809,27 +8208,27 @@ var FoldableComponent = (0, import_react25.forwardRef)(function Foldable({
|
|
|
7809
8208
|
...props
|
|
7810
8209
|
}, ref) {
|
|
7811
8210
|
const theme2 = useTheme();
|
|
7812
|
-
const bodyRef = (0,
|
|
8211
|
+
const bodyRef = (0, import_react26.useRef)(null);
|
|
7813
8212
|
const [internalIsOpen, setInternalIsOpen] = useBooleanState(defaultOpen);
|
|
7814
|
-
const [bodyVirtualHeight, setBodyVirtualHeight] = (0,
|
|
8213
|
+
const [bodyVirtualHeight, setBodyVirtualHeight] = (0, import_react26.useState)(500);
|
|
7815
8214
|
const isOpen = controlledIsOpen !== void 0 ? controlledIsOpen : internalIsOpen;
|
|
7816
|
-
const open = (0,
|
|
8215
|
+
const open = (0, import_react26.useCallback)(() => {
|
|
7817
8216
|
if (controlledIsOpen === void 0) setInternalIsOpen.setTrue();
|
|
7818
8217
|
onOpenChange?.(true);
|
|
7819
8218
|
}, [controlledIsOpen, onOpenChange]);
|
|
7820
|
-
const close = (0,
|
|
8219
|
+
const close = (0, import_react26.useCallback)(() => {
|
|
7821
8220
|
if (controlledIsOpen === void 0) setInternalIsOpen.setFalse();
|
|
7822
8221
|
onOpenChange?.(false);
|
|
7823
8222
|
}, [controlledIsOpen, onOpenChange]);
|
|
7824
|
-
const toggleOpen = (0,
|
|
8223
|
+
const toggleOpen = (0, import_react26.useCallback)(() => {
|
|
7825
8224
|
if (controlledIsOpen === void 0) setInternalIsOpen.toggle();
|
|
7826
8225
|
onOpenChange?.(!isOpen);
|
|
7827
8226
|
}, [controlledIsOpen, isOpen, onOpenChange]);
|
|
7828
|
-
(0,
|
|
8227
|
+
(0, import_react26.useEffect)(() => {
|
|
7829
8228
|
if (!bodyRef.current) return;
|
|
7830
8229
|
setBodyVirtualHeight(Math.min(500, bodyRef.current.scrollHeight * 2));
|
|
7831
8230
|
}, [isOpen]);
|
|
7832
|
-
(0,
|
|
8231
|
+
(0, import_react26.useImperativeHandle)(
|
|
7833
8232
|
ref,
|
|
7834
8233
|
() => {
|
|
7835
8234
|
return {
|
|
@@ -7841,8 +8240,8 @@ var FoldableComponent = (0, import_react25.forwardRef)(function Foldable({
|
|
|
7841
8240
|
},
|
|
7842
8241
|
[open, close, toggleOpen, isOpen]
|
|
7843
8242
|
);
|
|
7844
|
-
return /* @__PURE__ */ (0,
|
|
7845
|
-
renderHeader ? renderHeader(isOpen, toggleOpen) : /* @__PURE__ */ (0,
|
|
8243
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(Div_default.column, { width: "100%", ...props, children: [
|
|
8244
|
+
renderHeader ? renderHeader(isOpen, toggleOpen) : /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
7846
8245
|
Div_default.row,
|
|
7847
8246
|
{
|
|
7848
8247
|
width: "100%",
|
|
@@ -7854,15 +8253,15 @@ var FoldableComponent = (0, import_react25.forwardRef)(function Foldable({
|
|
|
7854
8253
|
onClick: toggleOpen,
|
|
7855
8254
|
userSelect: "none",
|
|
7856
8255
|
children: [
|
|
7857
|
-
/* @__PURE__ */ (0,
|
|
7858
|
-
icon && /* @__PURE__ */ (0,
|
|
7859
|
-
image && /* @__PURE__ */ (0,
|
|
7860
|
-
/* @__PURE__ */ (0,
|
|
7861
|
-
title && /* @__PURE__ */ (0,
|
|
7862
|
-
description && /* @__PURE__ */ (0,
|
|
8256
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(Div_default.row, { flex: 1, alignItems: "center", gap: theme2.styles.space, children: [
|
|
8257
|
+
icon && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Icon_default, { name: icon, size: 20, flexShrink: 0 }),
|
|
8258
|
+
image && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Image_default.profileImage, { name: image, size: 24, flexShrink: 0 }),
|
|
8259
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(Div_default.column, { gap: theme2.styles.gap / 2, children: [
|
|
8260
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Text_default, { as: "h3", fontWeight: 700, lineHeight: "20px", children: title }),
|
|
8261
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Text_default, { color: theme2.colors.textSecondary, children: description })
|
|
7863
8262
|
] })
|
|
7864
8263
|
] }),
|
|
7865
|
-
/* @__PURE__ */ (0,
|
|
8264
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
7866
8265
|
Icon_default,
|
|
7867
8266
|
{
|
|
7868
8267
|
name: "chevronDown",
|
|
@@ -7873,8 +8272,8 @@ var FoldableComponent = (0, import_react25.forwardRef)(function Foldable({
|
|
|
7873
8272
|
]
|
|
7874
8273
|
}
|
|
7875
8274
|
),
|
|
7876
|
-
/* @__PURE__ */ (0,
|
|
7877
|
-
/* @__PURE__ */ (0,
|
|
8275
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Div_default, { height: isOpen ? 1 : 0, opacity: isOpen ? 1 : 0, transition: theme2.styles.transition, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Divider_default.horizontal, {}) }),
|
|
8276
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
7878
8277
|
Div_default,
|
|
7879
8278
|
{
|
|
7880
8279
|
maxHeight: isOpen ? bodyVirtualHeight : 0,
|
|
@@ -7883,14 +8282,14 @@ var FoldableComponent = (0, import_react25.forwardRef)(function Foldable({
|
|
|
7883
8282
|
overflow: !isOpen ? "hidden" : void 0,
|
|
7884
8283
|
pointerEvents: !isOpen ? "none" : void 0,
|
|
7885
8284
|
ref: bodyRef,
|
|
7886
|
-
children: /* @__PURE__ */ (0,
|
|
8285
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Div_default, { paddingBlock: theme2.styles.gap, paddingInline: headerPaddingInline, children })
|
|
7887
8286
|
}
|
|
7888
8287
|
)
|
|
7889
8288
|
] });
|
|
7890
8289
|
});
|
|
7891
|
-
FoldableComponent.box = (0,
|
|
8290
|
+
FoldableComponent.box = (0, import_react26.forwardRef)(function Box3({ ...props }, ref) {
|
|
7892
8291
|
const theme2 = useTheme();
|
|
7893
|
-
return /* @__PURE__ */ (0,
|
|
8292
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
7894
8293
|
FoldableComponent,
|
|
7895
8294
|
{
|
|
7896
8295
|
backgroundColor: theme2.colors.backgroundContent,
|
|
@@ -7903,7 +8302,7 @@ FoldableComponent.box = (0, import_react25.forwardRef)(function Box3({ ...props
|
|
|
7903
8302
|
}
|
|
7904
8303
|
);
|
|
7905
8304
|
});
|
|
7906
|
-
var Foldable2 = (0,
|
|
8305
|
+
var Foldable2 = (0, import_react26.memo)(FoldableComponent);
|
|
7907
8306
|
Foldable2.box = FoldableComponent.box;
|
|
7908
8307
|
var Foldable_default = Foldable2;
|
|
7909
8308
|
|
|
@@ -7943,6 +8342,7 @@ var reactRouterDomPlugin = {
|
|
|
7943
8342
|
Tabs,
|
|
7944
8343
|
Text,
|
|
7945
8344
|
ToggleInput,
|
|
8345
|
+
Tooltip,
|
|
7946
8346
|
colorThemeControls,
|
|
7947
8347
|
countries,
|
|
7948
8348
|
darkenColor,
|