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.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 Fragment5, jsx as jsx20, jsxs as jsxs16 } from "react/jsx-runtime";
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, index) => {
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
- return column.format?.(item, index) ?? String(value ?? "");
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, index) ?? /* @__PURE__ */ jsx20(Fragment5, {});
7003
+ return column.render?.(item, itemIndex) ?? /* @__PURE__ */ jsx20(Fragment6, {});
6992
7004
  }
6993
7005
  case "image": {
6994
- const src = column.getImageSrc?.(item, index) ?? (column.keyName ? item[column.keyName] : void 0);
6995
- return /* @__PURE__ */ jsx20(Image_default, { src, width: "100%", borderRadius: theme2.styles.borderRadius / 2, ...column.imageProps });
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.toggleInputProps ?? {};
6999
- const checkedValue = checkedItems[index];
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((isChecked, internalIndex) => internalIndex === index ? checked : isChecked)
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(Fragment5, {});
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
- onClickRow?.(item, index);
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(Fragment5, { children: [
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__ */ jsx20(
7310
- "tr",
7311
- {
7312
- className: onClickRow ? "isClickable" : void 0,
7313
- onClick: () => onClickRowElement(item, rowIndex),
7314
- children: columns.map((column, colIndex) => /* @__PURE__ */ jsx20(TdStyledComponent, { textAlign: column.align, children: renderCellContent(column, item, rowIndex) }, column.type + column.label + colIndex))
7315
- },
7316
- JSON.stringify(item) + rowIndex
7317
- )) : /* @__PURE__ */ jsx20("tr", { className: "withoutHover", children: /* @__PURE__ */ jsx20("td", { className: "noData", colSpan: columns.length, children: /* @__PURE__ */ jsx20(Text_default.unknown, { children: noDataItemsMessage }) }) }) }),
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,368 @@ var TableComponent = forwardRef15(function Table({
7526
7577
  var Table2 = memo20(TableComponent);
7527
7578
  var Table_default = Table2;
7528
7579
 
7529
- // src/components/Tabs.tsx
7530
- import { forwardRef as forwardRef16, memo as memo21, useCallback as useCallback11, useEffect as useEffect10, useImperativeHandle as useImperativeHandle3, useMemo as useMemo8, useRef as useRef6, useState as useState9 } from "react";
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
+ }, ref) {
7732
+ const theme2 = useTheme();
7733
+ const triggerHolderRef = useRef6(null);
7734
+ const contentRef = useRef6(null);
7735
+ const tooltipContainerRef = useRef6(null);
7736
+ const closeTimerRef = useRef6(void 0);
7737
+ const [isOpen, setIsOpen] = useState9(false);
7738
+ const [isOpenLate, setIsOpenLate] = useState9(false);
7739
+ const arrowSize = withArrow ? theme2.styles.gap : 0;
7740
+ const gap = theme2.styles.gap / 2;
7741
+ const outsideScreenGap = theme2.styles.gap / 2;
7742
+ const totalGap = arrowSize + gap;
7743
+ const openTooltip = useCallback11(() => {
7744
+ if (closeTimerRef.current) clearTimeout(closeTimerRef.current);
7745
+ setIsOpen(true);
7746
+ setIsOpenLate(true);
7747
+ setTimeout(() => {
7748
+ if (!tooltipContainerRef.current) return;
7749
+ if (!contentRef.current) return;
7750
+ const clientRects = tooltipContainerRef.current.getBoundingClientRect();
7751
+ if (clientRects) {
7752
+ const { width, height, x, y } = clientRects;
7753
+ const topOutside = y < 0;
7754
+ const bottomOutside = y + height > window.innerHeight;
7755
+ const leftOutside = x < 0;
7756
+ const rightOutside = x + width > window.innerWidth;
7757
+ if (topOutside) contentRef.current.style.transform = `translateY(${y * -1 + outsideScreenGap}px)`;
7758
+ if (bottomOutside)
7759
+ contentRef.current.style.transform = `translateY(${window.innerHeight - (y + height) - totalGap}px)`;
7760
+ if (leftOutside) contentRef.current.style.transform = `translateX(${x * -1 + outsideScreenGap}px)`;
7761
+ if (rightOutside)
7762
+ contentRef.current.style.transform = `translateX(${window.innerWidth - (x + width) - totalGap}px)`;
7763
+ }
7764
+ }, 1);
7765
+ onOpen?.();
7766
+ }, [onOpen, outsideScreenGap, totalGap]);
7767
+ const closeTooltip = useCallback11(() => {
7768
+ setIsOpen(false);
7769
+ closeTimerRef.current = setTimeout(() => setIsOpenLate(false), 300);
7770
+ onClose?.();
7771
+ }, [onClose]);
7772
+ const onMouseEnter = useCallback11(() => {
7773
+ if (trigger === "hover") openTooltip();
7774
+ }, [trigger, openTooltip]);
7775
+ const onMouseLeave = useCallback11(() => {
7776
+ if (trigger === "hover") closeTooltip();
7777
+ }, [trigger, closeTooltip]);
7778
+ const onClickHolder = useCallback11(
7779
+ (event) => {
7780
+ if (trigger === "click") {
7781
+ if (!isOpen) openTooltip();
7782
+ else if (triggerHolderRef.current?.contains(event.target)) closeTooltip();
7783
+ }
7784
+ },
7785
+ [trigger, openTooltip, isOpen, closeTooltip]
7786
+ );
7787
+ const onClickOutside = useCallback11(
7788
+ (event) => {
7789
+ if (!isOpen) return;
7790
+ if (trigger !== "click") return;
7791
+ if (!contentRef.current?.contains(event.target) && !triggerHolderRef.current?.contains(event.target)) {
7792
+ closeTooltip();
7793
+ }
7794
+ },
7795
+ [trigger, isOpen, closeTooltip]
7796
+ );
7797
+ useEffect10(() => {
7798
+ if (trigger === "click") {
7799
+ document.addEventListener("mousedown", onClickOutside);
7800
+ return () => {
7801
+ document.removeEventListener("mousedown", onClickOutside);
7802
+ };
7803
+ }
7804
+ }, [trigger, onClickOutside]);
7805
+ useImperativeHandle3(
7806
+ ref,
7807
+ () => {
7808
+ return {
7809
+ isOpen,
7810
+ open: openTooltip,
7811
+ close: closeTooltip
7812
+ };
7813
+ },
7814
+ [isOpen, openTooltip, closeTooltip]
7815
+ );
7816
+ return /* @__PURE__ */ jsxs17(Div_default, { position: "relative", onClick: onClickHolder, onMouseEnter, onMouseLeave, children: [
7817
+ /* @__PURE__ */ jsx21(Div_default, { width: "100%", ref: triggerHolderRef, children }),
7818
+ /* @__PURE__ */ jsx21(
7819
+ TooltipContainer,
7820
+ {
7821
+ theme: theme2,
7822
+ position,
7823
+ align,
7824
+ withArrow,
7825
+ arrowSize,
7826
+ gap,
7827
+ isOpen,
7828
+ role: "tooltip",
7829
+ ref: tooltipContainerRef,
7830
+ children: (isOpen || isOpenLate) && /* @__PURE__ */ jsxs17(Div_default, { position: "relative", ref: contentRef, children: [
7831
+ /* @__PURE__ */ jsx21(
7832
+ Div_default.box,
7833
+ {
7834
+ position: "relative",
7835
+ width: contentWidth,
7836
+ minWidth: contentMinWidth,
7837
+ backgroundColor: backgroundColor ?? theme2.colors.backgroundContent,
7838
+ boxShadow: "0px 10px 20px #00000020",
7839
+ paddingBlock: isSmall ? theme2.styles.gap / 2 : theme2.styles.gap,
7840
+ paddingInline: asContextMenu ? 0 : isSmall ? theme2.styles.space / 2 : theme2.styles.space,
7841
+ overflow: asContextMenu ? "hidden" : void 0,
7842
+ children: content
7843
+ }
7844
+ ),
7845
+ /* @__PURE__ */ jsx21(
7846
+ Div_default,
7847
+ {
7848
+ position: "absolute",
7849
+ width: position === "left" || position === "right" ? totalGap : "100%",
7850
+ height: position === "top" || position === "bottom" ? totalGap : "100%",
7851
+ top: position === "top" ? "100%" : position === "bottom" ? void 0 : 0,
7852
+ bottom: position === "bottom" ? "100%" : position === "top" ? void 0 : 0,
7853
+ left: position === "left" ? "100%" : position === "right" ? void 0 : 0,
7854
+ right: position === "right" ? "100%" : position === "left" ? void 0 : 0,
7855
+ borderTopLeftRadius: 999,
7856
+ borderTopRightRadius: 999
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, value, id, onClick, onClickWithValue }, 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
+ id,
7888
+ value,
7889
+ onClick,
7890
+ onClickWithValue,
7891
+ ref,
7892
+ children: [
7893
+ icon && /* @__PURE__ */ jsx21(Icon_default, { name: icon, color: !isActive ? theme2.colors.textSecondary : void 0 }),
7894
+ /* @__PURE__ */ jsxs17(Div_default.column, { flex: 1, gap: theme2.styles.gap / 2, children: [
7895
+ /* @__PURE__ */ jsx21(Text_default, { fontWeight: isActive ? 700 : void 0, children: text }),
7896
+ description && /* @__PURE__ */ jsx21(Text_default, { fontSize: 14, color: theme2.colors.textSecondary, children: description })
7897
+ ] })
7898
+ ]
7899
+ }
7900
+ );
7901
+ });
7902
+ TooltipComponent.divider = forwardRef16(function DividerComponent(props, ref) {
7903
+ const theme2 = useTheme();
7904
+ return /* @__PURE__ */ jsx21(Divider_default.horizontal, { marginBlock: theme2.styles.gap, ...props, ref });
7905
+ });
7906
+ TooltipComponent.sectionTitle = forwardRef16(function SectionTitle({ text, ...props }, ref) {
7907
+ const theme2 = useTheme();
7908
+ return /* @__PURE__ */ jsx21(
7909
+ Text_default,
7910
+ {
7911
+ fontSize: 12,
7912
+ fontWeight: 700,
7913
+ textTransform: "uppercase",
7914
+ marginBlock: theme2.styles.gap / 2,
7915
+ marginInline: theme2.styles.space,
7916
+ ...props,
7917
+ ref,
7918
+ children: text
7919
+ }
7920
+ );
7921
+ });
7922
+ var Tooltip2 = memo21(TooltipComponent);
7923
+ Tooltip2.item = TooltipComponent.item;
7924
+ Tooltip2.divider = TooltipComponent.divider;
7925
+ Tooltip2.sectionTitle = TooltipComponent.sectionTitle;
7926
+ var Tooltip_default = Tooltip2;
7927
+
7928
+ // src/components/Tabs.tsx
7929
+ 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";
7930
+ import { jsx as jsx22, jsxs as jsxs18 } from "react/jsx-runtime";
7532
7931
  var tabBottomLineWidth = 2;
7533
7932
  var tabDotSize = 6;
7534
7933
  var defaultTabName = "tab";
7535
- var TabsComponent = forwardRef16(function Tabs({ tabs, name, accentColor, style = "default", onChange, children, ...props }, ref) {
7934
+ var TabsComponent = forwardRef17(function Tabs({ tabs, name, accentColor, style = "default", onChange, children, ...props }, ref) {
7536
7935
  const reactRouterDomPlugin2 = usePlugin("react-router-dom");
7537
7936
  const theme2 = useTheme();
7538
7937
  const urlQuery = reactRouterDomPlugin2 ? useUrlQuery() : void 0;
7539
7938
  const { colorTheme, componentsState } = useBetterHtmlContextInternal();
7540
- const firstRenderPassedRef = useRef6(false);
7541
- const tabsRef = useRef6({});
7542
- const [selectedTab, setSelectedTab] = useState9(() => {
7939
+ const firstRenderPassedRef = useRef7(false);
7940
+ const tabsRef = useRef7({});
7941
+ const [selectedTab, setSelectedTab] = useState10(() => {
7543
7942
  const selectedTabValue = tabs[0] ?? "";
7544
7943
  if (urlQuery) {
7545
7944
  const tabQueryValue = urlQuery.getQuery(name ?? defaultTabName);
@@ -7548,9 +7947,9 @@ var TabsComponent = forwardRef16(function Tabs({ tabs, name, accentColor, style
7548
7947
  }
7549
7948
  return selectedTabValue;
7550
7949
  });
7551
- const [rerenderState, setRerenderState] = useState9(0);
7950
+ const [rerenderState, setRerenderState] = useState10(0);
7552
7951
  const tabsGap = style === "box" ? theme2.styles.gap / 2 : 0;
7553
- const onClickTab = useCallback11(
7952
+ const onClickTab = useCallback12(
7554
7953
  (tab) => {
7555
7954
  setSelectedTab(tab);
7556
7955
  onChange?.(tab);
@@ -7562,11 +7961,11 @@ var TabsComponent = forwardRef16(function Tabs({ tabs, name, accentColor, style
7562
7961
  },
7563
7962
  [onChange, name, urlQuery]
7564
7963
  );
7565
- const width = useMemo8(
7964
+ const width = useMemo9(
7566
7965
  () => tabsRef.current[selectedTab]?.getBoundingClientRect().width ?? 0,
7567
7966
  [rerenderState, selectedTab]
7568
7967
  );
7569
- const leftSpacing = useMemo8(() => {
7968
+ const leftSpacing = useMemo9(() => {
7570
7969
  const selectedTabIndex = tabs.findIndex((tab) => tab === selectedTab);
7571
7970
  let spacing = 0;
7572
7971
  Object.values(tabsRef.current).forEach((tab, index) => {
@@ -7574,7 +7973,7 @@ var TabsComponent = forwardRef16(function Tabs({ tabs, name, accentColor, style
7574
7973
  });
7575
7974
  return spacing;
7576
7975
  }, [selectedTab, tabs, tabsGap]);
7577
- useEffect10(() => {
7976
+ useEffect11(() => {
7578
7977
  const timeout = setTimeout(() => {
7579
7978
  setRerenderState(Math.random());
7580
7979
  firstRenderPassedRef.current = true;
@@ -7583,7 +7982,7 @@ var TabsComponent = forwardRef16(function Tabs({ tabs, name, accentColor, style
7583
7982
  clearTimeout(timeout);
7584
7983
  };
7585
7984
  }, []);
7586
- useEffect10(() => {
7985
+ useEffect11(() => {
7587
7986
  componentsState.tabs.setTabGroups((oldValue) => {
7588
7987
  const thisTabGroup = oldValue.find((item) => item.name === (name ?? defaultTabName));
7589
7988
  if (thisTabGroup) {
@@ -7604,20 +8003,20 @@ var TabsComponent = forwardRef16(function Tabs({ tabs, name, accentColor, style
7604
8003
  }
7605
8004
  });
7606
8005
  }, [selectedTab, name]);
7607
- useEffect10(() => {
8006
+ useEffect11(() => {
7608
8007
  tabsRef.current[selectedTab]?.scrollIntoView({
7609
8008
  behavior: firstRenderPassedRef.current ? "smooth" : void 0,
7610
8009
  block: "nearest"
7611
8010
  });
7612
8011
  }, [selectedTab]);
7613
- useEffect10(() => {
8012
+ useEffect11(() => {
7614
8013
  return () => {
7615
8014
  componentsState.tabs.setTabGroups(
7616
8015
  (oldValue) => oldValue.filter((item) => item.name !== (name ?? defaultTabName))
7617
8016
  );
7618
8017
  };
7619
8018
  }, []);
7620
- useImperativeHandle3(
8019
+ useImperativeHandle4(
7621
8020
  ref,
7622
8021
  () => {
7623
8022
  return {
@@ -7627,11 +8026,11 @@ var TabsComponent = forwardRef16(function Tabs({ tabs, name, accentColor, style
7627
8026
  },
7628
8027
  [selectedTab, onClickTab]
7629
8028
  );
7630
- return /* @__PURE__ */ jsxs17(Div_default.column, { width: "100%", gap: theme2.styles.space, ...props, children: [
7631
- /* @__PURE__ */ jsxs17(Div_default, { position: "relative", className: "react-better-html-no-scrollbar", overflowY: "auto", children: [
7632
- /* @__PURE__ */ jsx21(Div_default.row, { position: "relative", width: "fit-content", gap: tabsGap, userSelect: "none", children: tabs.map((tab) => {
8029
+ return /* @__PURE__ */ jsxs18(Div_default.column, { width: "100%", gap: theme2.styles.space, ...props, children: [
8030
+ /* @__PURE__ */ jsxs18(Div_default, { position: "relative", className: "react-better-html-no-scrollbar", overflowY: "auto", children: [
8031
+ /* @__PURE__ */ jsx22(Div_default.row, { position: "relative", width: "fit-content", gap: tabsGap, userSelect: "none", children: tabs.map((tab) => {
7633
8032
  const selected = tab === selectedTab;
7634
- return /* @__PURE__ */ jsxs17(
8033
+ return /* @__PURE__ */ jsxs18(
7635
8034
  Div_default,
7636
8035
  {
7637
8036
  position: "relative",
@@ -7652,7 +8051,7 @@ var TabsComponent = forwardRef16(function Tabs({ tabs, name, accentColor, style
7652
8051
  tabsRef.current[tab] = ref2;
7653
8052
  },
7654
8053
  children: [
7655
- componentsState.tabs.tabsWithDots.includes(tab) && /* @__PURE__ */ jsx21(
8054
+ componentsState.tabs.tabsWithDots.includes(tab) && /* @__PURE__ */ jsx22(
7656
8055
  Div_default,
7657
8056
  {
7658
8057
  position: "absolute",
@@ -7665,7 +8064,7 @@ var TabsComponent = forwardRef16(function Tabs({ tabs, name, accentColor, style
7665
8064
  transition: theme2.styles.transition
7666
8065
  }
7667
8066
  ),
7668
- /* @__PURE__ */ jsx21(
8067
+ /* @__PURE__ */ jsx22(
7669
8068
  Text_default,
7670
8069
  {
7671
8070
  fontWeight: 700,
@@ -7680,7 +8079,7 @@ var TabsComponent = forwardRef16(function Tabs({ tabs, name, accentColor, style
7680
8079
  tab
7681
8080
  );
7682
8081
  }) }),
7683
- style !== "box" && /* @__PURE__ */ jsx21(
8082
+ style !== "box" && /* @__PURE__ */ jsx22(
7684
8083
  Div_default,
7685
8084
  {
7686
8085
  position: "absolute",
@@ -7693,16 +8092,16 @@ var TabsComponent = forwardRef16(function Tabs({ tabs, name, accentColor, style
7693
8092
  }
7694
8093
  )
7695
8094
  ] }),
7696
- children && /* @__PURE__ */ jsx21(Div_default, { width: "100%", children })
8095
+ children && /* @__PURE__ */ jsx22(Div_default, { width: "100%", children })
7697
8096
  ] });
7698
8097
  });
7699
8098
  TabsComponent.content = function Content({ tab, tabWithDot, tabsGroupName, isInitialTab, children }) {
7700
8099
  const { componentsState } = useBetterHtmlContextInternal();
7701
- const thisTabGroupData = useMemo8(
8100
+ const thisTabGroupData = useMemo9(
7702
8101
  () => componentsState.tabs.tabGroups.find((item) => item.name === (tabsGroupName ?? defaultTabName)),
7703
8102
  [componentsState.tabs, tabsGroupName]
7704
8103
  );
7705
- useEffect10(() => {
8104
+ useEffect11(() => {
7706
8105
  if (tabWithDot) {
7707
8106
  componentsState.tabs.setTabsWithDots?.((oldValue) => oldValue.includes(tab) ? oldValue : [...oldValue, tab]);
7708
8107
  } else {
@@ -7711,18 +8110,18 @@ TabsComponent.content = function Content({ tab, tabWithDot, tabsGroupName, isIni
7711
8110
  );
7712
8111
  }
7713
8112
  }, [tabWithDot]);
7714
- return (thisTabGroupData ? thisTabGroupData.selectedTab === tab : isInitialTab) ? /* @__PURE__ */ jsx21(Div_default, { width: "100%", children }) : void 0;
8113
+ return (thisTabGroupData ? thisTabGroupData.selectedTab === tab : isInitialTab) ? /* @__PURE__ */ jsx22(Div_default, { width: "100%", children }) : void 0;
7715
8114
  };
7716
- var Tabs2 = memo21(TabsComponent);
8115
+ var Tabs2 = memo22(TabsComponent);
7717
8116
  Tabs2.content = TabsComponent.content;
7718
8117
  var Tabs_default = Tabs2;
7719
8118
 
7720
8119
  // src/components/Foldable.tsx
7721
- import { forwardRef as forwardRef17, memo as memo22, useCallback as useCallback12, useEffect as useEffect11, useImperativeHandle as useImperativeHandle4, useRef as useRef7, useState as useState10 } from "react";
7722
- import { jsx as jsx22, jsxs as jsxs18 } from "react/jsx-runtime";
8120
+ import { forwardRef as forwardRef18, memo as memo23, useCallback as useCallback13, useEffect as useEffect12, useImperativeHandle as useImperativeHandle5, useRef as useRef8, useState as useState11 } from "react";
8121
+ import { jsx as jsx23, jsxs as jsxs19 } from "react/jsx-runtime";
7723
8122
  var animationDurationClose = 0.15;
7724
8123
  var animationDurationOpen = animationDurationClose * 2;
7725
- var FoldableComponent = forwardRef17(function Foldable({
8124
+ var FoldableComponent = forwardRef18(function Foldable({
7726
8125
  isOpen: controlledIsOpen,
7727
8126
  defaultOpen = false,
7728
8127
  title,
@@ -7737,27 +8136,27 @@ var FoldableComponent = forwardRef17(function Foldable({
7737
8136
  ...props
7738
8137
  }, ref) {
7739
8138
  const theme2 = useTheme();
7740
- const bodyRef = useRef7(null);
8139
+ const bodyRef = useRef8(null);
7741
8140
  const [internalIsOpen, setInternalIsOpen] = useBooleanState(defaultOpen);
7742
- const [bodyVirtualHeight, setBodyVirtualHeight] = useState10(500);
8141
+ const [bodyVirtualHeight, setBodyVirtualHeight] = useState11(500);
7743
8142
  const isOpen = controlledIsOpen !== void 0 ? controlledIsOpen : internalIsOpen;
7744
- const open = useCallback12(() => {
8143
+ const open = useCallback13(() => {
7745
8144
  if (controlledIsOpen === void 0) setInternalIsOpen.setTrue();
7746
8145
  onOpenChange?.(true);
7747
8146
  }, [controlledIsOpen, onOpenChange]);
7748
- const close = useCallback12(() => {
8147
+ const close = useCallback13(() => {
7749
8148
  if (controlledIsOpen === void 0) setInternalIsOpen.setFalse();
7750
8149
  onOpenChange?.(false);
7751
8150
  }, [controlledIsOpen, onOpenChange]);
7752
- const toggleOpen = useCallback12(() => {
8151
+ const toggleOpen = useCallback13(() => {
7753
8152
  if (controlledIsOpen === void 0) setInternalIsOpen.toggle();
7754
8153
  onOpenChange?.(!isOpen);
7755
8154
  }, [controlledIsOpen, isOpen, onOpenChange]);
7756
- useEffect11(() => {
8155
+ useEffect12(() => {
7757
8156
  if (!bodyRef.current) return;
7758
8157
  setBodyVirtualHeight(Math.min(500, bodyRef.current.scrollHeight * 2));
7759
8158
  }, [isOpen]);
7760
- useImperativeHandle4(
8159
+ useImperativeHandle5(
7761
8160
  ref,
7762
8161
  () => {
7763
8162
  return {
@@ -7769,8 +8168,8 @@ var FoldableComponent = forwardRef17(function Foldable({
7769
8168
  },
7770
8169
  [open, close, toggleOpen, isOpen]
7771
8170
  );
7772
- return /* @__PURE__ */ jsxs18(Div_default.column, { width: "100%", ...props, children: [
7773
- renderHeader ? renderHeader(isOpen, toggleOpen) : /* @__PURE__ */ jsxs18(
8171
+ return /* @__PURE__ */ jsxs19(Div_default.column, { width: "100%", ...props, children: [
8172
+ renderHeader ? renderHeader(isOpen, toggleOpen) : /* @__PURE__ */ jsxs19(
7774
8173
  Div_default.row,
7775
8174
  {
7776
8175
  width: "100%",
@@ -7782,15 +8181,15 @@ var FoldableComponent = forwardRef17(function Foldable({
7782
8181
  onClick: toggleOpen,
7783
8182
  userSelect: "none",
7784
8183
  children: [
7785
- /* @__PURE__ */ jsxs18(Div_default.row, { flex: 1, alignItems: "center", gap: theme2.styles.space, children: [
7786
- icon && /* @__PURE__ */ jsx22(Icon_default, { name: icon, size: 20, flexShrink: 0 }),
7787
- image && /* @__PURE__ */ jsx22(Image_default.profileImage, { name: image, size: 24, flexShrink: 0 }),
7788
- /* @__PURE__ */ jsxs18(Div_default.column, { gap: theme2.styles.gap / 2, children: [
7789
- title && /* @__PURE__ */ jsx22(Text_default, { as: "h3", fontWeight: 700, lineHeight: "20px", children: title }),
7790
- description && /* @__PURE__ */ jsx22(Text_default, { color: theme2.colors.textSecondary, children: description })
8184
+ /* @__PURE__ */ jsxs19(Div_default.row, { flex: 1, alignItems: "center", gap: theme2.styles.space, children: [
8185
+ icon && /* @__PURE__ */ jsx23(Icon_default, { name: icon, size: 20, flexShrink: 0 }),
8186
+ image && /* @__PURE__ */ jsx23(Image_default.profileImage, { name: image, size: 24, flexShrink: 0 }),
8187
+ /* @__PURE__ */ jsxs19(Div_default.column, { gap: theme2.styles.gap / 2, children: [
8188
+ title && /* @__PURE__ */ jsx23(Text_default, { as: "h3", fontWeight: 700, lineHeight: "20px", children: title }),
8189
+ description && /* @__PURE__ */ jsx23(Text_default, { color: theme2.colors.textSecondary, children: description })
7791
8190
  ] })
7792
8191
  ] }),
7793
- /* @__PURE__ */ jsx22(
8192
+ /* @__PURE__ */ jsx23(
7794
8193
  Icon_default,
7795
8194
  {
7796
8195
  name: "chevronDown",
@@ -7801,8 +8200,8 @@ var FoldableComponent = forwardRef17(function Foldable({
7801
8200
  ]
7802
8201
  }
7803
8202
  ),
7804
- /* @__PURE__ */ jsx22(Div_default, { height: isOpen ? 1 : 0, opacity: isOpen ? 1 : 0, transition: theme2.styles.transition, children: /* @__PURE__ */ jsx22(Divider_default.horizontal, {}) }),
7805
- /* @__PURE__ */ jsx22(
8203
+ /* @__PURE__ */ jsx23(Div_default, { height: isOpen ? 1 : 0, opacity: isOpen ? 1 : 0, transition: theme2.styles.transition, children: /* @__PURE__ */ jsx23(Divider_default.horizontal, {}) }),
8204
+ /* @__PURE__ */ jsx23(
7806
8205
  Div_default,
7807
8206
  {
7808
8207
  maxHeight: isOpen ? bodyVirtualHeight : 0,
@@ -7811,14 +8210,14 @@ var FoldableComponent = forwardRef17(function Foldable({
7811
8210
  overflow: !isOpen ? "hidden" : void 0,
7812
8211
  pointerEvents: !isOpen ? "none" : void 0,
7813
8212
  ref: bodyRef,
7814
- children: /* @__PURE__ */ jsx22(Div_default, { paddingBlock: theme2.styles.gap, paddingInline: headerPaddingInline, children })
8213
+ children: /* @__PURE__ */ jsx23(Div_default, { paddingBlock: theme2.styles.gap, paddingInline: headerPaddingInline, children })
7815
8214
  }
7816
8215
  )
7817
8216
  ] });
7818
8217
  });
7819
- FoldableComponent.box = forwardRef17(function Box3({ ...props }, ref) {
8218
+ FoldableComponent.box = forwardRef18(function Box3({ ...props }, ref) {
7820
8219
  const theme2 = useTheme();
7821
- return /* @__PURE__ */ jsx22(
8220
+ return /* @__PURE__ */ jsx23(
7822
8221
  FoldableComponent,
7823
8222
  {
7824
8223
  backgroundColor: theme2.colors.backgroundContent,
@@ -7831,7 +8230,7 @@ FoldableComponent.box = forwardRef17(function Box3({ ...props }, ref) {
7831
8230
  }
7832
8231
  );
7833
8232
  });
7834
- var Foldable2 = memo22(FoldableComponent);
8233
+ var Foldable2 = memo23(FoldableComponent);
7835
8234
  Foldable2.box = FoldableComponent.box;
7836
8235
  var Foldable_default = Foldable2;
7837
8236
 
@@ -7870,6 +8269,7 @@ export {
7870
8269
  Tabs_default as Tabs,
7871
8270
  Text_default as Text,
7872
8271
  ToggleInput_default as ToggleInput,
8272
+ Tooltip_default as Tooltip,
7873
8273
  colorThemeControls,
7874
8274
  countries,
7875
8275
  darkenColor,