react-better-html 1.1.114 → 1.1.116
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 +61 -7
- package/dist/index.d.ts +61 -7
- package/dist/index.js +472 -73
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +477 -78
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -6842,10 +6842,11 @@ import {
|
|
|
6842
6842
|
useState as useState8,
|
|
6843
6843
|
useImperativeHandle as useImperativeHandle2,
|
|
6844
6844
|
useRef as useRef5,
|
|
6845
|
-
useEffect as useEffect9
|
|
6845
|
+
useEffect as useEffect9,
|
|
6846
|
+
Fragment as Fragment5
|
|
6846
6847
|
} from "react";
|
|
6847
6848
|
import styled10, { css as css2 } from "styled-components";
|
|
6848
|
-
import { Fragment as
|
|
6849
|
+
import { Fragment as Fragment6, jsx as jsx20, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
6849
6850
|
var defaultImageWidth = 160;
|
|
6850
6851
|
var maximumVisiblePages = 11;
|
|
6851
6852
|
var TableStyledComponent = styled10.table.withConfig({
|
|
@@ -6871,6 +6872,14 @@ var TableStyledComponent = styled10.table.withConfig({
|
|
|
6871
6872
|
cursor: pointer;
|
|
6872
6873
|
}
|
|
6873
6874
|
|
|
6875
|
+
&.isExpandRow {
|
|
6876
|
+
height: 0px;
|
|
6877
|
+
|
|
6878
|
+
td {
|
|
6879
|
+
border-top: none;
|
|
6880
|
+
}
|
|
6881
|
+
}
|
|
6882
|
+
|
|
6874
6883
|
${(props) => props.isStriped ? css2`
|
|
6875
6884
|
&:nth-child(even) {
|
|
6876
6885
|
background-color: ${props.theme.colors.backgroundSecondary};
|
|
@@ -6948,6 +6957,7 @@ var TableComponent = forwardRef15(function Table({
|
|
|
6948
6957
|
const { colorTheme } = useBetterHtmlContextInternal();
|
|
6949
6958
|
const filterModalRef = useRef5(null);
|
|
6950
6959
|
const [checkedItems, setCheckedItems] = useState8([]);
|
|
6960
|
+
const [expandedRows, setExpandedRows] = useState8([]);
|
|
6951
6961
|
const [currentPage, setCurrentPage] = useState8(1);
|
|
6952
6962
|
const [filterData, setFilterData] = useState8({});
|
|
6953
6963
|
const [openedFilterColumnIndex, setOpenedFilterColumnIndex] = useState8();
|
|
@@ -6980,30 +6990,35 @@ var TableComponent = forwardRef15(function Table({
|
|
|
6980
6990
|
filterModalRef.current?.close();
|
|
6981
6991
|
}
|
|
6982
6992
|
});
|
|
6993
|
+
const expandRow = useMemo7(() => columns.find((column) => column.type === "expand"), [columns]);
|
|
6983
6994
|
const renderCellContent = useCallback10(
|
|
6984
|
-
(column, item,
|
|
6995
|
+
(column, item, itemIndex) => {
|
|
6985
6996
|
switch (column.type) {
|
|
6986
6997
|
case "text": {
|
|
6987
6998
|
const value = column.keyName ? item[column.keyName] : void 0;
|
|
6988
|
-
|
|
6999
|
+
const textProps = (typeof column.getTextProps === "function" ? column.getTextProps?.(item, itemIndex) : column.getTextProps) ?? {};
|
|
7000
|
+
return /* @__PURE__ */ jsx20(Text_default, { ...textProps, children: column.format?.(item, itemIndex) ?? String(value ?? "") });
|
|
6989
7001
|
}
|
|
6990
7002
|
case "element": {
|
|
6991
|
-
return column.render?.(item,
|
|
7003
|
+
return column.render?.(item, itemIndex) ?? /* @__PURE__ */ jsx20(Fragment6, {});
|
|
6992
7004
|
}
|
|
6993
7005
|
case "image": {
|
|
6994
|
-
const
|
|
6995
|
-
return /* @__PURE__ */ jsx20(Image_default, {
|
|
7006
|
+
const imageProps = (typeof column.getImageProps === "function" ? column.getImageProps?.(item, itemIndex) : column.getImageProps) ?? {};
|
|
7007
|
+
return /* @__PURE__ */ jsx20(Image_default, { width: "100%", borderRadius: theme2.styles.borderRadius / 2, ...imageProps });
|
|
6996
7008
|
}
|
|
6997
7009
|
case "checkbox": {
|
|
6998
|
-
const { onChange, ...toggleInputProps } = column.
|
|
6999
|
-
const checkedValue = checkedItems[
|
|
7010
|
+
const { onChange, ...toggleInputProps } = (typeof column.getToggleInputProps === "function" ? column.getToggleInputProps?.(item, itemIndex) : column.getToggleInputProps) ?? {};
|
|
7011
|
+
const checkedValue = checkedItems[itemIndex];
|
|
7000
7012
|
return /* @__PURE__ */ jsx20(
|
|
7001
7013
|
ToggleInput_default.checkbox,
|
|
7002
7014
|
{
|
|
7003
7015
|
checked: checkedValue,
|
|
7016
|
+
value: item,
|
|
7004
7017
|
onChange: (checked, value) => {
|
|
7005
7018
|
setCheckedItems(
|
|
7006
|
-
(oldValue) => oldValue.map(
|
|
7019
|
+
(oldValue) => oldValue.map(
|
|
7020
|
+
(isChecked, internalIndex) => internalIndex === itemIndex ? checked : isChecked
|
|
7021
|
+
)
|
|
7007
7022
|
);
|
|
7008
7023
|
onChange?.(checked, value);
|
|
7009
7024
|
},
|
|
@@ -7011,18 +7026,37 @@ var TableComponent = forwardRef15(function Table({
|
|
|
7011
7026
|
}
|
|
7012
7027
|
);
|
|
7013
7028
|
}
|
|
7029
|
+
case "expand": {
|
|
7030
|
+
return /* @__PURE__ */ jsx20(
|
|
7031
|
+
Icon_default,
|
|
7032
|
+
{
|
|
7033
|
+
name: "chevronDown",
|
|
7034
|
+
transform: `rotate(${expandedRows[itemIndex] ? 180 : 0}deg)`,
|
|
7035
|
+
transition: theme2.styles.transition
|
|
7036
|
+
}
|
|
7037
|
+
);
|
|
7038
|
+
}
|
|
7014
7039
|
default: {
|
|
7015
|
-
return /* @__PURE__ */ jsx20(
|
|
7040
|
+
return /* @__PURE__ */ jsx20(Fragment6, {});
|
|
7016
7041
|
}
|
|
7017
7042
|
}
|
|
7018
7043
|
},
|
|
7019
|
-
[theme2, checkedItems]
|
|
7044
|
+
[theme2, checkedItems, expandedRows]
|
|
7020
7045
|
);
|
|
7021
7046
|
const onClickRowElement = useCallback10(
|
|
7022
7047
|
(item, index) => {
|
|
7023
|
-
|
|
7048
|
+
if (expandRow) {
|
|
7049
|
+
setExpandedRows((oldValue) => {
|
|
7050
|
+
if (oldValue[index] === void 0) {
|
|
7051
|
+
const newValue = expandRow.onlyOneExpanded ? [] : [...oldValue];
|
|
7052
|
+
newValue[index] = true;
|
|
7053
|
+
return newValue;
|
|
7054
|
+
}
|
|
7055
|
+
return oldValue.map((isExpanded, internalIndex) => internalIndex === index ? !isExpanded : isExpanded);
|
|
7056
|
+
});
|
|
7057
|
+
} else onClickRow?.(item, index);
|
|
7024
7058
|
},
|
|
7025
|
-
[onClickRow]
|
|
7059
|
+
[onClickRow, expandRow]
|
|
7026
7060
|
);
|
|
7027
7061
|
const onClickAllCheckboxesElement = useCallback10(
|
|
7028
7062
|
(checked) => {
|
|
@@ -7147,6 +7181,14 @@ var TableComponent = forwardRef15(function Table({
|
|
|
7147
7181
|
},
|
|
7148
7182
|
[openedFilterColumn]
|
|
7149
7183
|
);
|
|
7184
|
+
const renderExpandedRow = useCallback10(
|
|
7185
|
+
(...props2) => {
|
|
7186
|
+
const expandColumn = columns.find((column) => column.type === "expand");
|
|
7187
|
+
if (!expandColumn) return;
|
|
7188
|
+
return expandColumn.render?.(...props2);
|
|
7189
|
+
},
|
|
7190
|
+
[columns]
|
|
7191
|
+
);
|
|
7150
7192
|
const dataAfterFilter = useMemo7(
|
|
7151
7193
|
() => data.filter(
|
|
7152
7194
|
(item) => Object.entries(filterData).every(([columnIndex, filter]) => {
|
|
@@ -7252,7 +7294,7 @@ var TableComponent = forwardRef15(function Table({
|
|
|
7252
7294
|
[currentPage, setCurrentPage, pageCountInternal, setCheckedItems]
|
|
7253
7295
|
);
|
|
7254
7296
|
const mobileFooterBreakingPoint = mediumScreen.size700 && pageCountInternal > maximumVisiblePages / 1.4;
|
|
7255
|
-
return /* @__PURE__ */ jsxs16(
|
|
7297
|
+
return /* @__PURE__ */ jsxs16(Fragment6, { children: [
|
|
7256
7298
|
/* @__PURE__ */ jsx20(
|
|
7257
7299
|
Div_default,
|
|
7258
7300
|
{
|
|
@@ -7264,7 +7306,7 @@ var TableComponent = forwardRef15(function Table({
|
|
|
7264
7306
|
TableStyledComponent,
|
|
7265
7307
|
{
|
|
7266
7308
|
isStriped,
|
|
7267
|
-
withHover: onClickRow !== void 0,
|
|
7309
|
+
withHover: onClickRow !== void 0 || expandRow !== void 0,
|
|
7268
7310
|
withStickyHeader,
|
|
7269
7311
|
colorTheme,
|
|
7270
7312
|
theme: theme2,
|
|
@@ -7272,7 +7314,7 @@ var TableComponent = forwardRef15(function Table({
|
|
|
7272
7314
|
/* @__PURE__ */ jsx20("thead", { children: /* @__PURE__ */ jsx20("tr", { className: "isHeader", children: columns.map((column, index) => /* @__PURE__ */ jsx20(
|
|
7273
7315
|
ThStyledComponent,
|
|
7274
7316
|
{
|
|
7275
|
-
width: column.width ?? (column.type === "image" ? defaultImageWidth : column.type === "checkbox" ? 26 : void 0),
|
|
7317
|
+
width: column.width ?? (column.type === "image" ? defaultImageWidth : column.type === "checkbox" ? 26 : column.type === "expand" ? 16 : void 0),
|
|
7276
7318
|
minWidth: column.minWidth,
|
|
7277
7319
|
maxWidth: column.maxWidth,
|
|
7278
7320
|
textAlign: column.align,
|
|
@@ -7306,15 +7348,24 @@ var TableComponent = forwardRef15(function Table({
|
|
|
7306
7348
|
},
|
|
7307
7349
|
column.type + column.label + index
|
|
7308
7350
|
)) }) }),
|
|
7309
|
-
/* @__PURE__ */ jsx20("tbody", { children: isLoading ? /* @__PURE__ */ jsx20("tr", { className: "withoutHover", children: /* @__PURE__ */ jsx20("td", { className: "noData", colSpan: columns.length, children: /* @__PURE__ */ jsx20(Loader_default.box, {}) }) }) : dataAfterPagination.length > 0 ? dataAfterPagination.map((item, rowIndex) => /* @__PURE__ */
|
|
7310
|
-
|
|
7311
|
-
|
|
7312
|
-
|
|
7313
|
-
|
|
7314
|
-
|
|
7315
|
-
|
|
7316
|
-
|
|
7317
|
-
|
|
7351
|
+
/* @__PURE__ */ jsx20("tbody", { children: isLoading ? /* @__PURE__ */ jsx20("tr", { className: "withoutHover", children: /* @__PURE__ */ jsx20("td", { className: "noData", colSpan: columns.length, children: /* @__PURE__ */ jsx20(Loader_default.box, {}) }) }) : dataAfterPagination.length > 0 ? dataAfterPagination.map((item, rowIndex) => /* @__PURE__ */ jsxs16(Fragment5, { children: [
|
|
7352
|
+
/* @__PURE__ */ jsx20(
|
|
7353
|
+
"tr",
|
|
7354
|
+
{
|
|
7355
|
+
className: onClickRow || expandRow ? "isClickable" : void 0,
|
|
7356
|
+
onClick: () => onClickRowElement(item, rowIndex),
|
|
7357
|
+
children: columns.map((column, colIndex) => /* @__PURE__ */ jsx20(
|
|
7358
|
+
TdStyledComponent,
|
|
7359
|
+
{
|
|
7360
|
+
textAlign: column.align,
|
|
7361
|
+
children: renderCellContent(column, item, rowIndex)
|
|
7362
|
+
},
|
|
7363
|
+
column.type + column.label + colIndex
|
|
7364
|
+
))
|
|
7365
|
+
}
|
|
7366
|
+
),
|
|
7367
|
+
expandedRows[rowIndex] && /* @__PURE__ */ jsx20("tr", { className: "withoutHover isExpandRow", children: /* @__PURE__ */ jsx20("td", { colSpan: columns.length, children: renderExpandedRow(item, rowIndex) }) })
|
|
7368
|
+
] }, JSON.stringify(item) + rowIndex)) : /* @__PURE__ */ jsx20("tr", { className: "withoutHover", children: /* @__PURE__ */ jsx20("td", { className: "noData", colSpan: columns.length, children: /* @__PURE__ */ jsx20(Text_default.unknown, { children: noDataItemsMessage }) }) }) }),
|
|
7318
7369
|
pageSize !== void 0 && pageCountInternal > 1 && /* @__PURE__ */ jsx20("tfoot", { children: /* @__PURE__ */ jsx20("tr", { className: "isFooter", children: /* @__PURE__ */ jsx20("td", { colSpan: columns.length, children: /* @__PURE__ */ jsxs16(
|
|
7319
7370
|
Div_default.column,
|
|
7320
7371
|
{
|
|
@@ -7526,20 +7577,367 @@ var TableComponent = forwardRef15(function Table({
|
|
|
7526
7577
|
var Table2 = memo20(TableComponent);
|
|
7527
7578
|
var Table_default = Table2;
|
|
7528
7579
|
|
|
7529
|
-
// src/components/
|
|
7530
|
-
import {
|
|
7580
|
+
// src/components/Tooltip.tsx
|
|
7581
|
+
import { memo as memo21, useCallback as useCallback11, useRef as useRef6, useState as useState9, useEffect as useEffect10, forwardRef as forwardRef16, useImperativeHandle as useImperativeHandle3, useMemo as useMemo8 } from "react";
|
|
7582
|
+
import styled11, { css as css3 } from "styled-components";
|
|
7531
7583
|
import { jsx as jsx21, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
7584
|
+
var tooltipContainerStyle = (props) => ({
|
|
7585
|
+
top: css3`
|
|
7586
|
+
bottom: calc(100% + ${props.gap}px + ${props.arrowSize}px);
|
|
7587
|
+
${props.align === "center" ? "left: 50%;" : props.align === "left" ? "left: 0;" : "right: 0;"}
|
|
7588
|
+
`,
|
|
7589
|
+
bottom: css3`
|
|
7590
|
+
top: calc(100% + ${props.gap}px + ${props.arrowSize}px);
|
|
7591
|
+
${props.align === "center" ? "left: 50%;" : props.align === "left" ? "left: 0;" : "right: 0;"};
|
|
7592
|
+
`,
|
|
7593
|
+
left: css3`
|
|
7594
|
+
${props.align === "center" ? "top: 50%;" : props.align === "top" ? "top: 0;" : "bottom: 0;"};
|
|
7595
|
+
right: calc(100% + ${props.gap}px + ${props.arrowSize}px);
|
|
7596
|
+
`,
|
|
7597
|
+
right: css3`
|
|
7598
|
+
${props.align === "center" ? "top: 50%;" : props.align === "top" ? "top: 0;" : "bottom: 0;"};
|
|
7599
|
+
left: calc(100% + ${props.gap}px + ${props.arrowSize}px);
|
|
7600
|
+
`
|
|
7601
|
+
});
|
|
7602
|
+
var tooltipPositionStyle = (props) => ({
|
|
7603
|
+
top: {
|
|
7604
|
+
opened: css3`
|
|
7605
|
+
transform: translateX(${props.align === "center" ? "-50%" : "0"});
|
|
7606
|
+
`,
|
|
7607
|
+
closed: css3`
|
|
7608
|
+
transform: translateX(${props.align === "center" ? "-50%" : "0"}) translateY(${props.theme.styles.gap}px);
|
|
7609
|
+
`
|
|
7610
|
+
},
|
|
7611
|
+
bottom: {
|
|
7612
|
+
opened: css3`
|
|
7613
|
+
transform: translateX(${props.align === "center" ? "-50%" : "0"});
|
|
7614
|
+
`,
|
|
7615
|
+
closed: css3`
|
|
7616
|
+
transform: translateX(${props.align === "center" ? "-50%" : "0"}) translateY(-${props.theme.styles.gap}px);
|
|
7617
|
+
`
|
|
7618
|
+
},
|
|
7619
|
+
left: {
|
|
7620
|
+
opened: css3`
|
|
7621
|
+
transform: translateY(${props.align === "center" ? "-50%" : "0"});
|
|
7622
|
+
`,
|
|
7623
|
+
closed: css3`
|
|
7624
|
+
transform: translateX(${props.theme.styles.gap}px) translateY(${props.align === "center" ? "-50%" : "0"});
|
|
7625
|
+
`
|
|
7626
|
+
},
|
|
7627
|
+
right: {
|
|
7628
|
+
opened: css3`
|
|
7629
|
+
transform: translateY(${props.align === "center" ? "-50%" : "0"});
|
|
7630
|
+
`,
|
|
7631
|
+
closed: css3`
|
|
7632
|
+
transform: translateX(-${props.theme.styles.gap}px) translateY(${props.align === "center" ? "-50%" : "0"});
|
|
7633
|
+
`
|
|
7634
|
+
}
|
|
7635
|
+
});
|
|
7636
|
+
var TooltipContainer = styled11.div.withConfig({
|
|
7637
|
+
shouldForwardProp: (prop) => !["theme", "position", "align", "withArrow", "arrowSize", "isOpen", "gap"].includes(prop)
|
|
7638
|
+
})`
|
|
7639
|
+
position: absolute;
|
|
7640
|
+
opacity: ${(props) => props.isOpen ? 1 : 0};
|
|
7641
|
+
pointer-events: ${(props) => props.isOpen ? "auto" : "none"};
|
|
7642
|
+
transition: ${(props) => props.theme.styles.transition};
|
|
7643
|
+
z-index: 1000;
|
|
7644
|
+
|
|
7645
|
+
${(props) => tooltipContainerStyle(props)[props.position]}
|
|
7646
|
+
|
|
7647
|
+
${(props) => props.isOpen ? tooltipPositionStyle(props)[props.position].opened : tooltipPositionStyle(props)[props.position].closed}
|
|
7648
|
+
`;
|
|
7649
|
+
var arrowStyle = (props, borderWidth) => ({
|
|
7650
|
+
top: {
|
|
7651
|
+
borderTopColor: props.color,
|
|
7652
|
+
borderBottom: 0,
|
|
7653
|
+
top: borderWidth ? -props.size : void 0,
|
|
7654
|
+
left: borderWidth ? -props.size + borderWidth * 2 : props.align === "center" ? "50%" : props.align === "left" ? props.sideSpace : void 0,
|
|
7655
|
+
right: !borderWidth && props.align === "right" ? props.sideSpace : void 0,
|
|
7656
|
+
bottom: -props.size + 1,
|
|
7657
|
+
transform: !borderWidth && props.align === "center" ? "translateX(-50%)" : void 0
|
|
7658
|
+
},
|
|
7659
|
+
bottom: {
|
|
7660
|
+
borderBottomColor: props.color,
|
|
7661
|
+
borderTop: 0,
|
|
7662
|
+
top: borderWidth ? borderWidth * 2 : -props.size + 1,
|
|
7663
|
+
left: borderWidth ? -props.size + borderWidth * 2 : props.align === "center" ? "50%" : props.align === "left" ? props.sideSpace : void 0,
|
|
7664
|
+
right: !borderWidth && props.align === "right" ? props.sideSpace : void 0,
|
|
7665
|
+
transform: !borderWidth && props.align === "center" ? "translateX(-50%);" : void 0
|
|
7666
|
+
},
|
|
7667
|
+
left: {
|
|
7668
|
+
borderLeftColor: props.color,
|
|
7669
|
+
borderRight: 0,
|
|
7670
|
+
top: borderWidth ? -props.size + borderWidth * 2 : props.align === "center" ? "50%" : props.align === "top" ? props.sideSpace : void 0,
|
|
7671
|
+
bottom: !borderWidth && props.align === "bottom" ? props.sideSpace : void 0,
|
|
7672
|
+
left: borderWidth ? -props.size : void 0,
|
|
7673
|
+
right: -props.size + 1,
|
|
7674
|
+
transform: !borderWidth && props.align === "center" ? "translateY(-50%)" : void 0
|
|
7675
|
+
},
|
|
7676
|
+
right: {
|
|
7677
|
+
borderRightColor: props.color,
|
|
7678
|
+
borderLeft: 0,
|
|
7679
|
+
top: borderWidth ? -props.size + borderWidth * 2 : props.align === "center" ? "50%" : props.align === "top" ? props.sideSpace : void 0,
|
|
7680
|
+
bottom: !borderWidth && props.align === "bottom" ? props.sideSpace : void 0,
|
|
7681
|
+
left: borderWidth ? borderWidth * 2 : -props.size + 1,
|
|
7682
|
+
transform: !borderWidth && props.align === "center" ? "translateY(-50%);" : void 0
|
|
7683
|
+
}
|
|
7684
|
+
});
|
|
7685
|
+
var Arrow = memo21(function Arrow2(props) {
|
|
7686
|
+
const theme2 = useTheme();
|
|
7687
|
+
const { position, size } = props;
|
|
7688
|
+
const outerProps = useMemo8(
|
|
7689
|
+
() => ({
|
|
7690
|
+
...props,
|
|
7691
|
+
color: theme2.colors.border
|
|
7692
|
+
}),
|
|
7693
|
+
[props, theme2]
|
|
7694
|
+
);
|
|
7695
|
+
const borderWidth = 1;
|
|
7696
|
+
return /* @__PURE__ */ jsx21(
|
|
7697
|
+
Div_default,
|
|
7698
|
+
{
|
|
7699
|
+
position: "absolute",
|
|
7700
|
+
width: 0,
|
|
7701
|
+
height: 0,
|
|
7702
|
+
border: `${size}px solid transparent`,
|
|
7703
|
+
...arrowStyle(outerProps)[position],
|
|
7704
|
+
children: /* @__PURE__ */ jsx21(
|
|
7705
|
+
Div_default,
|
|
7706
|
+
{
|
|
7707
|
+
position: "absolute",
|
|
7708
|
+
width: 0,
|
|
7709
|
+
height: 0,
|
|
7710
|
+
border: `${size - borderWidth * 2}px solid transparent`,
|
|
7711
|
+
...arrowStyle(props, borderWidth)[position]
|
|
7712
|
+
}
|
|
7713
|
+
)
|
|
7714
|
+
}
|
|
7715
|
+
);
|
|
7716
|
+
});
|
|
7717
|
+
var TooltipComponent = forwardRef16(function Tooltip({
|
|
7718
|
+
position = "bottom",
|
|
7719
|
+
trigger = "hover",
|
|
7720
|
+
align = "center",
|
|
7721
|
+
content,
|
|
7722
|
+
contentWidth,
|
|
7723
|
+
contentMinWidth,
|
|
7724
|
+
withArrow,
|
|
7725
|
+
isSmall,
|
|
7726
|
+
backgroundColor,
|
|
7727
|
+
asContextMenu,
|
|
7728
|
+
onOpen,
|
|
7729
|
+
onClose,
|
|
7730
|
+
children,
|
|
7731
|
+
...props
|
|
7732
|
+
}, ref) {
|
|
7733
|
+
const theme2 = useTheme();
|
|
7734
|
+
const triggerHolderRef = useRef6(null);
|
|
7735
|
+
const contentRef = useRef6(null);
|
|
7736
|
+
const tooltipContainerRef = useRef6(null);
|
|
7737
|
+
const closeTimerRef = useRef6(void 0);
|
|
7738
|
+
const [isOpen, setIsOpen] = useState9(false);
|
|
7739
|
+
const [isOpenLate, setIsOpenLate] = useState9(false);
|
|
7740
|
+
const arrowSize = withArrow ? theme2.styles.gap : 0;
|
|
7741
|
+
const gap = theme2.styles.gap / 2;
|
|
7742
|
+
const outsideScreenGap = theme2.styles.gap / 2;
|
|
7743
|
+
const totalGap = arrowSize + gap;
|
|
7744
|
+
const openTooltip = useCallback11(() => {
|
|
7745
|
+
if (closeTimerRef.current) clearTimeout(closeTimerRef.current);
|
|
7746
|
+
setIsOpen(true);
|
|
7747
|
+
setIsOpenLate(true);
|
|
7748
|
+
setTimeout(() => {
|
|
7749
|
+
if (!tooltipContainerRef.current) return;
|
|
7750
|
+
if (!contentRef.current) return;
|
|
7751
|
+
const clientRects = tooltipContainerRef.current.getBoundingClientRect();
|
|
7752
|
+
if (clientRects) {
|
|
7753
|
+
const { width, height, x, y } = clientRects;
|
|
7754
|
+
const topOutside = y < 0;
|
|
7755
|
+
const bottomOutside = y + height > window.innerHeight;
|
|
7756
|
+
const leftOutside = x < 0;
|
|
7757
|
+
const rightOutside = x + width > window.innerWidth;
|
|
7758
|
+
if (topOutside) contentRef.current.style.transform = `translateY(${y * -1 + outsideScreenGap}px)`;
|
|
7759
|
+
if (bottomOutside)
|
|
7760
|
+
contentRef.current.style.transform = `translateY(${window.innerHeight - (y + height) - totalGap}px)`;
|
|
7761
|
+
if (leftOutside) contentRef.current.style.transform = `translateX(${x * -1 + outsideScreenGap}px)`;
|
|
7762
|
+
if (rightOutside)
|
|
7763
|
+
contentRef.current.style.transform = `translateX(${window.innerWidth - (x + width) - totalGap}px)`;
|
|
7764
|
+
}
|
|
7765
|
+
}, 1);
|
|
7766
|
+
onOpen?.();
|
|
7767
|
+
}, [onOpen, outsideScreenGap, totalGap]);
|
|
7768
|
+
const closeTooltip = useCallback11(() => {
|
|
7769
|
+
setIsOpen(false);
|
|
7770
|
+
closeTimerRef.current = setTimeout(() => setIsOpenLate(false), 300);
|
|
7771
|
+
onClose?.();
|
|
7772
|
+
}, [onClose]);
|
|
7773
|
+
const onMouseEnter = useCallback11(() => {
|
|
7774
|
+
if (trigger === "hover") openTooltip();
|
|
7775
|
+
}, [trigger, openTooltip]);
|
|
7776
|
+
const onMouseLeave = useCallback11(() => {
|
|
7777
|
+
if (trigger === "hover") closeTooltip();
|
|
7778
|
+
}, [trigger, closeTooltip]);
|
|
7779
|
+
const onClickHolder = useCallback11(
|
|
7780
|
+
(event) => {
|
|
7781
|
+
if (trigger === "click") {
|
|
7782
|
+
if (!isOpen) openTooltip();
|
|
7783
|
+
else if (triggerHolderRef.current?.contains(event.target)) closeTooltip();
|
|
7784
|
+
}
|
|
7785
|
+
},
|
|
7786
|
+
[trigger, openTooltip, isOpen, closeTooltip]
|
|
7787
|
+
);
|
|
7788
|
+
const onClickOutside = useCallback11(
|
|
7789
|
+
(event) => {
|
|
7790
|
+
if (!isOpen) return;
|
|
7791
|
+
if (trigger !== "click") return;
|
|
7792
|
+
if (!contentRef.current?.contains(event.target) && !triggerHolderRef.current?.contains(event.target)) {
|
|
7793
|
+
closeTooltip();
|
|
7794
|
+
}
|
|
7795
|
+
},
|
|
7796
|
+
[trigger, isOpen, closeTooltip]
|
|
7797
|
+
);
|
|
7798
|
+
useEffect10(() => {
|
|
7799
|
+
if (trigger === "click") {
|
|
7800
|
+
document.addEventListener("mousedown", onClickOutside);
|
|
7801
|
+
return () => {
|
|
7802
|
+
document.removeEventListener("mousedown", onClickOutside);
|
|
7803
|
+
};
|
|
7804
|
+
}
|
|
7805
|
+
}, [trigger, onClickOutside]);
|
|
7806
|
+
useImperativeHandle3(
|
|
7807
|
+
ref,
|
|
7808
|
+
() => {
|
|
7809
|
+
return {
|
|
7810
|
+
isOpen,
|
|
7811
|
+
open: openTooltip,
|
|
7812
|
+
close: closeTooltip
|
|
7813
|
+
};
|
|
7814
|
+
},
|
|
7815
|
+
[isOpen, openTooltip, closeTooltip]
|
|
7816
|
+
);
|
|
7817
|
+
return /* @__PURE__ */ jsxs17(Div_default, { position: "relative", onClick: onClickHolder, onMouseEnter, onMouseLeave, children: [
|
|
7818
|
+
/* @__PURE__ */ jsx21(Div_default, { width: "100%", ref: triggerHolderRef, children }),
|
|
7819
|
+
/* @__PURE__ */ jsx21(
|
|
7820
|
+
TooltipContainer,
|
|
7821
|
+
{
|
|
7822
|
+
theme: theme2,
|
|
7823
|
+
position,
|
|
7824
|
+
align,
|
|
7825
|
+
withArrow,
|
|
7826
|
+
arrowSize,
|
|
7827
|
+
gap,
|
|
7828
|
+
isOpen,
|
|
7829
|
+
role: "tooltip",
|
|
7830
|
+
ref: tooltipContainerRef,
|
|
7831
|
+
children: (isOpen || isOpenLate) && /* @__PURE__ */ jsxs17(Div_default, { position: "relative", ref: contentRef, children: [
|
|
7832
|
+
/* @__PURE__ */ jsx21(
|
|
7833
|
+
Div_default.box,
|
|
7834
|
+
{
|
|
7835
|
+
position: "relative",
|
|
7836
|
+
width: contentWidth,
|
|
7837
|
+
minWidth: contentMinWidth,
|
|
7838
|
+
backgroundColor: backgroundColor ?? theme2.colors.backgroundContent,
|
|
7839
|
+
boxShadow: "0px 10px 20px #00000020",
|
|
7840
|
+
paddingBlock: isSmall ? theme2.styles.gap / 2 : theme2.styles.gap,
|
|
7841
|
+
paddingInline: asContextMenu ? 0 : isSmall ? theme2.styles.space / 2 : theme2.styles.space,
|
|
7842
|
+
overflow: asContextMenu ? "hidden" : void 0,
|
|
7843
|
+
...props,
|
|
7844
|
+
children: content
|
|
7845
|
+
}
|
|
7846
|
+
),
|
|
7847
|
+
/* @__PURE__ */ jsx21(
|
|
7848
|
+
Div_default,
|
|
7849
|
+
{
|
|
7850
|
+
position: "absolute",
|
|
7851
|
+
width: position === "left" || position === "right" ? totalGap : "100%",
|
|
7852
|
+
height: position === "top" || position === "bottom" ? totalGap : "100%",
|
|
7853
|
+
top: position === "top" ? "100%" : position === "bottom" ? void 0 : 0,
|
|
7854
|
+
bottom: position === "bottom" ? "100%" : position === "top" ? void 0 : 0,
|
|
7855
|
+
left: position === "left" ? "100%" : position === "right" ? void 0 : 0,
|
|
7856
|
+
right: position === "right" ? "100%" : position === "left" ? void 0 : 0
|
|
7857
|
+
}
|
|
7858
|
+
),
|
|
7859
|
+
withArrow && /* @__PURE__ */ jsx21(
|
|
7860
|
+
Arrow,
|
|
7861
|
+
{
|
|
7862
|
+
position,
|
|
7863
|
+
align,
|
|
7864
|
+
sideSpace: theme2.styles.borderRadius,
|
|
7865
|
+
size: arrowSize,
|
|
7866
|
+
color: backgroundColor ?? theme2.colors.backgroundContent,
|
|
7867
|
+
isOpen
|
|
7868
|
+
}
|
|
7869
|
+
)
|
|
7870
|
+
] })
|
|
7871
|
+
}
|
|
7872
|
+
)
|
|
7873
|
+
] });
|
|
7874
|
+
});
|
|
7875
|
+
TooltipComponent.item = forwardRef16(function Item({ icon, text, description, isActive, onClick, onClickWithValue, value }, ref) {
|
|
7876
|
+
const theme2 = useTheme();
|
|
7877
|
+
return /* @__PURE__ */ jsxs17(
|
|
7878
|
+
Div_default.row,
|
|
7879
|
+
{
|
|
7880
|
+
alignItems: "center",
|
|
7881
|
+
gap: theme2.styles.space,
|
|
7882
|
+
backgroundColor: theme2.colors.backgroundContent,
|
|
7883
|
+
filterHover: "brightness(0.9)",
|
|
7884
|
+
paddingBlock: theme2.styles.gap,
|
|
7885
|
+
paddingInline: theme2.styles.space,
|
|
7886
|
+
cursor: "pointer",
|
|
7887
|
+
value,
|
|
7888
|
+
onClick,
|
|
7889
|
+
onClickWithValue,
|
|
7890
|
+
ref,
|
|
7891
|
+
children: [
|
|
7892
|
+
icon && /* @__PURE__ */ jsx21(Icon_default, { name: icon, color: !isActive ? theme2.colors.textSecondary : void 0 }),
|
|
7893
|
+
/* @__PURE__ */ jsxs17(Div_default.column, { flex: 1, gap: theme2.styles.gap / 2, children: [
|
|
7894
|
+
/* @__PURE__ */ jsx21(Text_default, { fontWeight: isActive ? 700 : void 0, children: text }),
|
|
7895
|
+
description && /* @__PURE__ */ jsx21(Text_default, { fontSize: 14, color: theme2.colors.textSecondary, children: description })
|
|
7896
|
+
] })
|
|
7897
|
+
]
|
|
7898
|
+
}
|
|
7899
|
+
);
|
|
7900
|
+
});
|
|
7901
|
+
TooltipComponent.divider = forwardRef16(function DividerComponent(props, ref) {
|
|
7902
|
+
const theme2 = useTheme();
|
|
7903
|
+
return /* @__PURE__ */ jsx21(Divider_default.horizontal, { marginBlock: theme2.styles.gap, ...props, ref });
|
|
7904
|
+
});
|
|
7905
|
+
TooltipComponent.sectionTitle = forwardRef16(function SectionTitle({ text, ...props }, ref) {
|
|
7906
|
+
const theme2 = useTheme();
|
|
7907
|
+
return /* @__PURE__ */ jsx21(
|
|
7908
|
+
Text_default,
|
|
7909
|
+
{
|
|
7910
|
+
fontSize: 12,
|
|
7911
|
+
fontWeight: 700,
|
|
7912
|
+
textTransform: "uppercase",
|
|
7913
|
+
marginBlock: theme2.styles.gap / 2,
|
|
7914
|
+
marginInline: theme2.styles.space,
|
|
7915
|
+
...props,
|
|
7916
|
+
ref,
|
|
7917
|
+
children: text
|
|
7918
|
+
}
|
|
7919
|
+
);
|
|
7920
|
+
});
|
|
7921
|
+
var Tooltip2 = memo21(TooltipComponent);
|
|
7922
|
+
Tooltip2.item = TooltipComponent.item;
|
|
7923
|
+
Tooltip2.divider = TooltipComponent.divider;
|
|
7924
|
+
Tooltip2.sectionTitle = TooltipComponent.sectionTitle;
|
|
7925
|
+
var Tooltip_default = Tooltip2;
|
|
7926
|
+
|
|
7927
|
+
// src/components/Tabs.tsx
|
|
7928
|
+
import { forwardRef as forwardRef17, memo as memo22, useCallback as useCallback12, useEffect as useEffect11, useImperativeHandle as useImperativeHandle4, useMemo as useMemo9, useRef as useRef7, useState as useState10 } from "react";
|
|
7929
|
+
import { jsx as jsx22, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
7532
7930
|
var tabBottomLineWidth = 2;
|
|
7533
7931
|
var tabDotSize = 6;
|
|
7534
7932
|
var defaultTabName = "tab";
|
|
7535
|
-
var TabsComponent =
|
|
7933
|
+
var TabsComponent = forwardRef17(function Tabs({ tabs, name, accentColor, style = "default", onChange, children, ...props }, ref) {
|
|
7536
7934
|
const reactRouterDomPlugin2 = usePlugin("react-router-dom");
|
|
7537
7935
|
const theme2 = useTheme();
|
|
7538
7936
|
const urlQuery = reactRouterDomPlugin2 ? useUrlQuery() : void 0;
|
|
7539
7937
|
const { colorTheme, componentsState } = useBetterHtmlContextInternal();
|
|
7540
|
-
const firstRenderPassedRef =
|
|
7541
|
-
const tabsRef =
|
|
7542
|
-
const [selectedTab, setSelectedTab] =
|
|
7938
|
+
const firstRenderPassedRef = useRef7(false);
|
|
7939
|
+
const tabsRef = useRef7({});
|
|
7940
|
+
const [selectedTab, setSelectedTab] = useState10(() => {
|
|
7543
7941
|
const selectedTabValue = tabs[0] ?? "";
|
|
7544
7942
|
if (urlQuery) {
|
|
7545
7943
|
const tabQueryValue = urlQuery.getQuery(name ?? defaultTabName);
|
|
@@ -7548,9 +7946,9 @@ var TabsComponent = forwardRef16(function Tabs({ tabs, name, accentColor, style
|
|
|
7548
7946
|
}
|
|
7549
7947
|
return selectedTabValue;
|
|
7550
7948
|
});
|
|
7551
|
-
const [rerenderState, setRerenderState] =
|
|
7949
|
+
const [rerenderState, setRerenderState] = useState10(0);
|
|
7552
7950
|
const tabsGap = style === "box" ? theme2.styles.gap / 2 : 0;
|
|
7553
|
-
const onClickTab =
|
|
7951
|
+
const onClickTab = useCallback12(
|
|
7554
7952
|
(tab) => {
|
|
7555
7953
|
setSelectedTab(tab);
|
|
7556
7954
|
onChange?.(tab);
|
|
@@ -7562,11 +7960,11 @@ var TabsComponent = forwardRef16(function Tabs({ tabs, name, accentColor, style
|
|
|
7562
7960
|
},
|
|
7563
7961
|
[onChange, name, urlQuery]
|
|
7564
7962
|
);
|
|
7565
|
-
const width =
|
|
7963
|
+
const width = useMemo9(
|
|
7566
7964
|
() => tabsRef.current[selectedTab]?.getBoundingClientRect().width ?? 0,
|
|
7567
7965
|
[rerenderState, selectedTab]
|
|
7568
7966
|
);
|
|
7569
|
-
const leftSpacing =
|
|
7967
|
+
const leftSpacing = useMemo9(() => {
|
|
7570
7968
|
const selectedTabIndex = tabs.findIndex((tab) => tab === selectedTab);
|
|
7571
7969
|
let spacing = 0;
|
|
7572
7970
|
Object.values(tabsRef.current).forEach((tab, index) => {
|
|
@@ -7574,7 +7972,7 @@ var TabsComponent = forwardRef16(function Tabs({ tabs, name, accentColor, style
|
|
|
7574
7972
|
});
|
|
7575
7973
|
return spacing;
|
|
7576
7974
|
}, [selectedTab, tabs, tabsGap]);
|
|
7577
|
-
|
|
7975
|
+
useEffect11(() => {
|
|
7578
7976
|
const timeout = setTimeout(() => {
|
|
7579
7977
|
setRerenderState(Math.random());
|
|
7580
7978
|
firstRenderPassedRef.current = true;
|
|
@@ -7583,7 +7981,7 @@ var TabsComponent = forwardRef16(function Tabs({ tabs, name, accentColor, style
|
|
|
7583
7981
|
clearTimeout(timeout);
|
|
7584
7982
|
};
|
|
7585
7983
|
}, []);
|
|
7586
|
-
|
|
7984
|
+
useEffect11(() => {
|
|
7587
7985
|
componentsState.tabs.setTabGroups((oldValue) => {
|
|
7588
7986
|
const thisTabGroup = oldValue.find((item) => item.name === (name ?? defaultTabName));
|
|
7589
7987
|
if (thisTabGroup) {
|
|
@@ -7604,20 +8002,20 @@ var TabsComponent = forwardRef16(function Tabs({ tabs, name, accentColor, style
|
|
|
7604
8002
|
}
|
|
7605
8003
|
});
|
|
7606
8004
|
}, [selectedTab, name]);
|
|
7607
|
-
|
|
8005
|
+
useEffect11(() => {
|
|
7608
8006
|
tabsRef.current[selectedTab]?.scrollIntoView({
|
|
7609
8007
|
behavior: firstRenderPassedRef.current ? "smooth" : void 0,
|
|
7610
8008
|
block: "nearest"
|
|
7611
8009
|
});
|
|
7612
8010
|
}, [selectedTab]);
|
|
7613
|
-
|
|
8011
|
+
useEffect11(() => {
|
|
7614
8012
|
return () => {
|
|
7615
8013
|
componentsState.tabs.setTabGroups(
|
|
7616
8014
|
(oldValue) => oldValue.filter((item) => item.name !== (name ?? defaultTabName))
|
|
7617
8015
|
);
|
|
7618
8016
|
};
|
|
7619
8017
|
}, []);
|
|
7620
|
-
|
|
8018
|
+
useImperativeHandle4(
|
|
7621
8019
|
ref,
|
|
7622
8020
|
() => {
|
|
7623
8021
|
return {
|
|
@@ -7627,11 +8025,11 @@ var TabsComponent = forwardRef16(function Tabs({ tabs, name, accentColor, style
|
|
|
7627
8025
|
},
|
|
7628
8026
|
[selectedTab, onClickTab]
|
|
7629
8027
|
);
|
|
7630
|
-
return /* @__PURE__ */
|
|
7631
|
-
/* @__PURE__ */
|
|
7632
|
-
/* @__PURE__ */
|
|
8028
|
+
return /* @__PURE__ */ jsxs18(Div_default.column, { width: "100%", gap: theme2.styles.space, ...props, children: [
|
|
8029
|
+
/* @__PURE__ */ jsxs18(Div_default, { position: "relative", className: "react-better-html-no-scrollbar", overflowY: "auto", children: [
|
|
8030
|
+
/* @__PURE__ */ jsx22(Div_default.row, { position: "relative", width: "fit-content", gap: tabsGap, userSelect: "none", children: tabs.map((tab) => {
|
|
7633
8031
|
const selected = tab === selectedTab;
|
|
7634
|
-
return /* @__PURE__ */
|
|
8032
|
+
return /* @__PURE__ */ jsxs18(
|
|
7635
8033
|
Div_default,
|
|
7636
8034
|
{
|
|
7637
8035
|
position: "relative",
|
|
@@ -7652,7 +8050,7 @@ var TabsComponent = forwardRef16(function Tabs({ tabs, name, accentColor, style
|
|
|
7652
8050
|
tabsRef.current[tab] = ref2;
|
|
7653
8051
|
},
|
|
7654
8052
|
children: [
|
|
7655
|
-
componentsState.tabs.tabsWithDots.includes(tab) && /* @__PURE__ */
|
|
8053
|
+
componentsState.tabs.tabsWithDots.includes(tab) && /* @__PURE__ */ jsx22(
|
|
7656
8054
|
Div_default,
|
|
7657
8055
|
{
|
|
7658
8056
|
position: "absolute",
|
|
@@ -7665,7 +8063,7 @@ var TabsComponent = forwardRef16(function Tabs({ tabs, name, accentColor, style
|
|
|
7665
8063
|
transition: theme2.styles.transition
|
|
7666
8064
|
}
|
|
7667
8065
|
),
|
|
7668
|
-
/* @__PURE__ */
|
|
8066
|
+
/* @__PURE__ */ jsx22(
|
|
7669
8067
|
Text_default,
|
|
7670
8068
|
{
|
|
7671
8069
|
fontWeight: 700,
|
|
@@ -7680,7 +8078,7 @@ var TabsComponent = forwardRef16(function Tabs({ tabs, name, accentColor, style
|
|
|
7680
8078
|
tab
|
|
7681
8079
|
);
|
|
7682
8080
|
}) }),
|
|
7683
|
-
style !== "box" && /* @__PURE__ */
|
|
8081
|
+
style !== "box" && /* @__PURE__ */ jsx22(
|
|
7684
8082
|
Div_default,
|
|
7685
8083
|
{
|
|
7686
8084
|
position: "absolute",
|
|
@@ -7693,16 +8091,16 @@ var TabsComponent = forwardRef16(function Tabs({ tabs, name, accentColor, style
|
|
|
7693
8091
|
}
|
|
7694
8092
|
)
|
|
7695
8093
|
] }),
|
|
7696
|
-
children && /* @__PURE__ */
|
|
8094
|
+
children && /* @__PURE__ */ jsx22(Div_default, { width: "100%", children })
|
|
7697
8095
|
] });
|
|
7698
8096
|
});
|
|
7699
8097
|
TabsComponent.content = function Content({ tab, tabWithDot, tabsGroupName, isInitialTab, children }) {
|
|
7700
8098
|
const { componentsState } = useBetterHtmlContextInternal();
|
|
7701
|
-
const thisTabGroupData =
|
|
8099
|
+
const thisTabGroupData = useMemo9(
|
|
7702
8100
|
() => componentsState.tabs.tabGroups.find((item) => item.name === (tabsGroupName ?? defaultTabName)),
|
|
7703
8101
|
[componentsState.tabs, tabsGroupName]
|
|
7704
8102
|
);
|
|
7705
|
-
|
|
8103
|
+
useEffect11(() => {
|
|
7706
8104
|
if (tabWithDot) {
|
|
7707
8105
|
componentsState.tabs.setTabsWithDots?.((oldValue) => oldValue.includes(tab) ? oldValue : [...oldValue, tab]);
|
|
7708
8106
|
} else {
|
|
@@ -7711,18 +8109,18 @@ TabsComponent.content = function Content({ tab, tabWithDot, tabsGroupName, isIni
|
|
|
7711
8109
|
);
|
|
7712
8110
|
}
|
|
7713
8111
|
}, [tabWithDot]);
|
|
7714
|
-
return (thisTabGroupData ? thisTabGroupData.selectedTab === tab : isInitialTab) ? /* @__PURE__ */
|
|
8112
|
+
return (thisTabGroupData ? thisTabGroupData.selectedTab === tab : isInitialTab) ? /* @__PURE__ */ jsx22(Div_default, { width: "100%", children }) : void 0;
|
|
7715
8113
|
};
|
|
7716
|
-
var Tabs2 =
|
|
8114
|
+
var Tabs2 = memo22(TabsComponent);
|
|
7717
8115
|
Tabs2.content = TabsComponent.content;
|
|
7718
8116
|
var Tabs_default = Tabs2;
|
|
7719
8117
|
|
|
7720
8118
|
// src/components/Foldable.tsx
|
|
7721
|
-
import { forwardRef as
|
|
7722
|
-
import { jsx as
|
|
8119
|
+
import { forwardRef as forwardRef18, memo as memo23, useCallback as useCallback13, useEffect as useEffect12, useImperativeHandle as useImperativeHandle5, useRef as useRef8, useState as useState11 } from "react";
|
|
8120
|
+
import { jsx as jsx23, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
7723
8121
|
var animationDurationClose = 0.15;
|
|
7724
8122
|
var animationDurationOpen = animationDurationClose * 2;
|
|
7725
|
-
var FoldableComponent =
|
|
8123
|
+
var FoldableComponent = forwardRef18(function Foldable({
|
|
7726
8124
|
isOpen: controlledIsOpen,
|
|
7727
8125
|
defaultOpen = false,
|
|
7728
8126
|
title,
|
|
@@ -7737,27 +8135,27 @@ var FoldableComponent = forwardRef17(function Foldable({
|
|
|
7737
8135
|
...props
|
|
7738
8136
|
}, ref) {
|
|
7739
8137
|
const theme2 = useTheme();
|
|
7740
|
-
const bodyRef =
|
|
8138
|
+
const bodyRef = useRef8(null);
|
|
7741
8139
|
const [internalIsOpen, setInternalIsOpen] = useBooleanState(defaultOpen);
|
|
7742
|
-
const [bodyVirtualHeight, setBodyVirtualHeight] =
|
|
8140
|
+
const [bodyVirtualHeight, setBodyVirtualHeight] = useState11(500);
|
|
7743
8141
|
const isOpen = controlledIsOpen !== void 0 ? controlledIsOpen : internalIsOpen;
|
|
7744
|
-
const open =
|
|
8142
|
+
const open = useCallback13(() => {
|
|
7745
8143
|
if (controlledIsOpen === void 0) setInternalIsOpen.setTrue();
|
|
7746
8144
|
onOpenChange?.(true);
|
|
7747
8145
|
}, [controlledIsOpen, onOpenChange]);
|
|
7748
|
-
const close =
|
|
8146
|
+
const close = useCallback13(() => {
|
|
7749
8147
|
if (controlledIsOpen === void 0) setInternalIsOpen.setFalse();
|
|
7750
8148
|
onOpenChange?.(false);
|
|
7751
8149
|
}, [controlledIsOpen, onOpenChange]);
|
|
7752
|
-
const toggleOpen =
|
|
8150
|
+
const toggleOpen = useCallback13(() => {
|
|
7753
8151
|
if (controlledIsOpen === void 0) setInternalIsOpen.toggle();
|
|
7754
8152
|
onOpenChange?.(!isOpen);
|
|
7755
8153
|
}, [controlledIsOpen, isOpen, onOpenChange]);
|
|
7756
|
-
|
|
8154
|
+
useEffect12(() => {
|
|
7757
8155
|
if (!bodyRef.current) return;
|
|
7758
8156
|
setBodyVirtualHeight(Math.min(500, bodyRef.current.scrollHeight * 2));
|
|
7759
8157
|
}, [isOpen]);
|
|
7760
|
-
|
|
8158
|
+
useImperativeHandle5(
|
|
7761
8159
|
ref,
|
|
7762
8160
|
() => {
|
|
7763
8161
|
return {
|
|
@@ -7769,8 +8167,8 @@ var FoldableComponent = forwardRef17(function Foldable({
|
|
|
7769
8167
|
},
|
|
7770
8168
|
[open, close, toggleOpen, isOpen]
|
|
7771
8169
|
);
|
|
7772
|
-
return /* @__PURE__ */
|
|
7773
|
-
renderHeader ? renderHeader(isOpen, toggleOpen) : /* @__PURE__ */
|
|
8170
|
+
return /* @__PURE__ */ jsxs19(Div_default.column, { width: "100%", ...props, children: [
|
|
8171
|
+
renderHeader ? renderHeader(isOpen, toggleOpen) : /* @__PURE__ */ jsxs19(
|
|
7774
8172
|
Div_default.row,
|
|
7775
8173
|
{
|
|
7776
8174
|
width: "100%",
|
|
@@ -7782,15 +8180,15 @@ var FoldableComponent = forwardRef17(function Foldable({
|
|
|
7782
8180
|
onClick: toggleOpen,
|
|
7783
8181
|
userSelect: "none",
|
|
7784
8182
|
children: [
|
|
7785
|
-
/* @__PURE__ */
|
|
7786
|
-
icon && /* @__PURE__ */
|
|
7787
|
-
image && /* @__PURE__ */
|
|
7788
|
-
/* @__PURE__ */
|
|
7789
|
-
title && /* @__PURE__ */
|
|
7790
|
-
description && /* @__PURE__ */
|
|
8183
|
+
/* @__PURE__ */ jsxs19(Div_default.row, { flex: 1, alignItems: "center", gap: theme2.styles.space, children: [
|
|
8184
|
+
icon && /* @__PURE__ */ jsx23(Icon_default, { name: icon, size: 20, flexShrink: 0 }),
|
|
8185
|
+
image && /* @__PURE__ */ jsx23(Image_default.profileImage, { name: image, size: 24, flexShrink: 0 }),
|
|
8186
|
+
/* @__PURE__ */ jsxs19(Div_default.column, { gap: theme2.styles.gap / 2, children: [
|
|
8187
|
+
title && /* @__PURE__ */ jsx23(Text_default, { as: "h3", fontWeight: 700, lineHeight: "20px", children: title }),
|
|
8188
|
+
description && /* @__PURE__ */ jsx23(Text_default, { color: theme2.colors.textSecondary, children: description })
|
|
7791
8189
|
] })
|
|
7792
8190
|
] }),
|
|
7793
|
-
/* @__PURE__ */
|
|
8191
|
+
/* @__PURE__ */ jsx23(
|
|
7794
8192
|
Icon_default,
|
|
7795
8193
|
{
|
|
7796
8194
|
name: "chevronDown",
|
|
@@ -7801,8 +8199,8 @@ var FoldableComponent = forwardRef17(function Foldable({
|
|
|
7801
8199
|
]
|
|
7802
8200
|
}
|
|
7803
8201
|
),
|
|
7804
|
-
/* @__PURE__ */
|
|
7805
|
-
/* @__PURE__ */
|
|
8202
|
+
/* @__PURE__ */ jsx23(Div_default, { height: isOpen ? 1 : 0, opacity: isOpen ? 1 : 0, transition: theme2.styles.transition, children: /* @__PURE__ */ jsx23(Divider_default.horizontal, {}) }),
|
|
8203
|
+
/* @__PURE__ */ jsx23(
|
|
7806
8204
|
Div_default,
|
|
7807
8205
|
{
|
|
7808
8206
|
maxHeight: isOpen ? bodyVirtualHeight : 0,
|
|
@@ -7811,14 +8209,14 @@ var FoldableComponent = forwardRef17(function Foldable({
|
|
|
7811
8209
|
overflow: !isOpen ? "hidden" : void 0,
|
|
7812
8210
|
pointerEvents: !isOpen ? "none" : void 0,
|
|
7813
8211
|
ref: bodyRef,
|
|
7814
|
-
children: /* @__PURE__ */
|
|
8212
|
+
children: /* @__PURE__ */ jsx23(Div_default, { paddingBlock: theme2.styles.gap, paddingInline: headerPaddingInline, children })
|
|
7815
8213
|
}
|
|
7816
8214
|
)
|
|
7817
8215
|
] });
|
|
7818
8216
|
});
|
|
7819
|
-
FoldableComponent.box =
|
|
8217
|
+
FoldableComponent.box = forwardRef18(function Box3({ ...props }, ref) {
|
|
7820
8218
|
const theme2 = useTheme();
|
|
7821
|
-
return /* @__PURE__ */
|
|
8219
|
+
return /* @__PURE__ */ jsx23(
|
|
7822
8220
|
FoldableComponent,
|
|
7823
8221
|
{
|
|
7824
8222
|
backgroundColor: theme2.colors.backgroundContent,
|
|
@@ -7831,7 +8229,7 @@ FoldableComponent.box = forwardRef17(function Box3({ ...props }, ref) {
|
|
|
7831
8229
|
}
|
|
7832
8230
|
);
|
|
7833
8231
|
});
|
|
7834
|
-
var Foldable2 =
|
|
8232
|
+
var Foldable2 = memo23(FoldableComponent);
|
|
7835
8233
|
Foldable2.box = FoldableComponent.box;
|
|
7836
8234
|
var Foldable_default = Foldable2;
|
|
7837
8235
|
|
|
@@ -7870,6 +8268,7 @@ export {
|
|
|
7870
8268
|
Tabs_default as Tabs,
|
|
7871
8269
|
Text_default as Text,
|
|
7872
8270
|
ToggleInput_default as ToggleInput,
|
|
8271
|
+
Tooltip_default as Tooltip,
|
|
7873
8272
|
colorThemeControls,
|
|
7874
8273
|
countries,
|
|
7875
8274
|
darkenColor,
|