react-better-html 1.1.120 → 1.1.122

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
@@ -6890,7 +6890,10 @@ var TableStyledComponent = styled10.table.withConfig({
6890
6890
  transition: ${props.theme.styles.transition};
6891
6891
 
6892
6892
  &:not(.isHeader):not(.isFooter):not(.withoutHover):hover {
6893
- filter: brightness(${props.colorTheme === "light" ? 0.95 : 0.7});
6893
+ background-color: ${darkenColor(
6894
+ props.theme.colors.backgroundContent,
6895
+ props.colorTheme === "light" ? 0.05 : 0.15
6896
+ )};
6894
6897
  }
6895
6898
  ` : ""}
6896
6899
 
@@ -6991,7 +6994,7 @@ var TableComponent = forwardRef15(function Table({
6991
6994
  filterModalRef.current?.close();
6992
6995
  }
6993
6996
  });
6994
- const expandRow = useMemo7(() => columns.find((column) => column.type === "expand"), [columns]);
6997
+ const expandColumn = useMemo7(() => columns.find((column) => column.type === "expand"), [columns]);
6995
6998
  const renderCellContent = useCallback10(
6996
6999
  (column, item, itemIndex) => {
6997
7000
  switch (column.type) {
@@ -7015,6 +7018,9 @@ var TableComponent = forwardRef15(function Table({
7015
7018
  {
7016
7019
  checked: checkedValue,
7017
7020
  value: item,
7021
+ onClick: (event) => {
7022
+ event.stopPropagation();
7023
+ },
7018
7024
  onChange: (checked, value) => {
7019
7025
  setCheckedItems(
7020
7026
  (oldValue) => oldValue.map(
@@ -7046,10 +7052,10 @@ var TableComponent = forwardRef15(function Table({
7046
7052
  );
7047
7053
  const onClickRowElement = useCallback10(
7048
7054
  (item, index) => {
7049
- if (expandRow) {
7055
+ if (expandColumn) {
7050
7056
  setExpandedRows((oldValue) => {
7051
7057
  if (oldValue[index] === void 0) {
7052
- const newValue = expandRow.onlyOneExpanded ? [] : [...oldValue];
7058
+ const newValue = expandColumn.onlyOneExpanded ? [] : [...oldValue];
7053
7059
  newValue[index] = true;
7054
7060
  return newValue;
7055
7061
  }
@@ -7057,7 +7063,7 @@ var TableComponent = forwardRef15(function Table({
7057
7063
  });
7058
7064
  } else onClickRow?.(item, index);
7059
7065
  },
7060
- [onClickRow, expandRow]
7066
+ [onClickRow, expandColumn]
7061
7067
  );
7062
7068
  const onClickAllCheckboxesElement = useCallback10(
7063
7069
  (checked) => {
@@ -7190,9 +7196,9 @@ var TableComponent = forwardRef15(function Table({
7190
7196
  );
7191
7197
  const renderExpandedRow = useCallback10(
7192
7198
  (...props2) => {
7193
- const expandColumn = columns.find((column) => column.type === "expand");
7194
- if (!expandColumn) return;
7195
- return expandColumn.render?.(...props2);
7199
+ const expandColumn2 = columns.find((column) => column.type === "expand");
7200
+ if (!expandColumn2) return;
7201
+ return expandColumn2.render?.(...props2);
7196
7202
  },
7197
7203
  [columns]
7198
7204
  );
@@ -7313,7 +7319,7 @@ var TableComponent = forwardRef15(function Table({
7313
7319
  TableStyledComponent,
7314
7320
  {
7315
7321
  isStriped,
7316
- withHover: onClickRow !== void 0 || expandRow !== void 0,
7322
+ withHover: onClickRow !== void 0 || expandColumn !== void 0,
7317
7323
  withStickyHeader,
7318
7324
  colorTheme,
7319
7325
  theme: theme2,
@@ -7359,12 +7365,15 @@ var TableComponent = forwardRef15(function Table({
7359
7365
  /* @__PURE__ */ jsx20(
7360
7366
  "tr",
7361
7367
  {
7362
- className: onClickRow || expandRow ? "isClickable" : void 0,
7368
+ className: onClickRow || expandColumn ? "isClickable" : void 0,
7363
7369
  onClick: () => onClickRowElement(item, rowIndex),
7364
7370
  children: columns.map((column, colIndex) => /* @__PURE__ */ jsx20(
7365
7371
  TdStyledComponent,
7366
7372
  {
7367
7373
  textAlign: column.align,
7374
+ onClick: (event) => {
7375
+ if (column.clickStopPropagation) event.stopPropagation();
7376
+ },
7368
7377
  children: renderCellContent(column, item, rowIndex)
7369
7378
  },
7370
7379
  column.type + column.label + colIndex
@@ -7509,17 +7518,15 @@ var TableComponent = forwardRef15(function Table({
7509
7518
  ] }) }),
7510
7519
  openedFilterColumn.presets && /* @__PURE__ */ jsxs16(Div_default.column, { gap: theme2.styles.gap / 2, children: [
7511
7520
  /* @__PURE__ */ jsx20(Label_default, { text: "Presets" }),
7512
- /* @__PURE__ */ jsx20(Div_default.row, { alignItems: "center", gap: theme2.styles.gap, children: openedFilterColumn.presets.map((preset) => {
7513
- return /* @__PURE__ */ jsx20(
7514
- Button_default.secondary,
7515
- {
7516
- text: filterPresetsText[preset],
7517
- value: preset,
7518
- onClickWithValue: onClickFilterPreset
7519
- },
7520
- preset
7521
- );
7522
- }) })
7521
+ /* @__PURE__ */ jsx20(Div_default.row, { alignItems: "center", gap: theme2.styles.gap, children: openedFilterColumn.presets.map((preset) => /* @__PURE__ */ jsx20(
7522
+ Button_default.secondary,
7523
+ {
7524
+ text: filterPresetsText[preset],
7525
+ value: preset,
7526
+ onClickWithValue: onClickFilterPreset
7527
+ },
7528
+ preset
7529
+ )) })
7523
7530
  ] })
7524
7531
  ]
7525
7532
  }
@@ -7824,66 +7831,88 @@ var TooltipComponent = forwardRef16(function Tooltip({
7824
7831
  },
7825
7832
  [isOpen, openTooltip, closeTooltip]
7826
7833
  );
7827
- return /* @__PURE__ */ jsxs17(Div_default, { position: "relative", onClick: onClickHolder, onMouseEnter, onMouseLeave, children: [
7828
- /* @__PURE__ */ jsx21(Div_default, { width: "100%", isTabAccessed, ref: triggerHolderRef, children }),
7829
- /* @__PURE__ */ jsx21(
7830
- TooltipContainer,
7831
- {
7832
- theme: theme2,
7833
- position,
7834
- align,
7835
- withArrow,
7836
- arrowSize,
7837
- gap,
7838
- isOpen,
7839
- role: "tooltip",
7840
- ref: tooltipContainerRef,
7841
- children: (isOpen || isOpenLate) && /* @__PURE__ */ jsxs17(Div_default, { position: "relative", ref: contentRef, children: [
7842
- /* @__PURE__ */ jsx21(
7843
- Div_default.box,
7844
- {
7845
- position: "relative",
7846
- width: contentWidth,
7847
- minWidth: contentMinWidth,
7848
- backgroundColor: backgroundColor ?? theme2.colors.backgroundContent,
7849
- boxShadow: "0px 10px 20px #00000020",
7850
- paddingBlock: isSmall ? theme2.styles.gap / 2 : theme2.styles.gap,
7851
- paddingInline: asContextMenu ? 0 : isSmall ? theme2.styles.space / 2 : theme2.styles.space,
7852
- overflow: asContextMenu ? "hidden" : void 0,
7853
- children: content
7854
- }
7855
- ),
7856
- /* @__PURE__ */ jsx21(
7857
- Div_default,
7858
- {
7859
- position: "absolute",
7860
- width: position === "left" || position === "right" ? totalGap : "100%",
7861
- height: position === "top" || position === "bottom" ? totalGap : "100%",
7862
- top: position === "top" ? "100%" : position === "bottom" ? void 0 : 0,
7863
- bottom: position === "bottom" ? "100%" : position === "top" ? void 0 : 0,
7864
- left: position === "left" ? "100%" : position === "right" ? void 0 : 0,
7865
- right: position === "right" ? "100%" : position === "left" ? void 0 : 0,
7866
- borderTopLeftRadius: 999,
7867
- borderTopRightRadius: 999
7868
- }
7869
- ),
7870
- withArrow && /* @__PURE__ */ jsx21(
7871
- Arrow,
7872
- {
7873
- position,
7874
- align,
7875
- sideSpace: theme2.styles.borderRadius,
7876
- size: arrowSize,
7877
- color: backgroundColor ?? theme2.colors.backgroundContent,
7878
- isOpen
7879
- }
7880
- )
7881
- ] })
7882
- }
7883
- )
7884
- ] });
7834
+ return /* @__PURE__ */ jsxs17(
7835
+ Div_default,
7836
+ {
7837
+ position: "relative",
7838
+ width: "fit-content",
7839
+ onClick: onClickHolder,
7840
+ onMouseEnter,
7841
+ onMouseLeave,
7842
+ children: [
7843
+ /* @__PURE__ */ jsx21(Div_default, { width: "fit-content", isTabAccessed, ref: triggerHolderRef, children }),
7844
+ /* @__PURE__ */ jsx21(
7845
+ TooltipContainer,
7846
+ {
7847
+ theme: theme2,
7848
+ position,
7849
+ align,
7850
+ withArrow,
7851
+ arrowSize,
7852
+ gap,
7853
+ isOpen,
7854
+ role: "tooltip",
7855
+ ref: tooltipContainerRef,
7856
+ children: (isOpen || isOpenLate) && /* @__PURE__ */ jsxs17(Div_default, { position: "relative", ref: contentRef, children: [
7857
+ /* @__PURE__ */ jsx21(
7858
+ Div_default.box,
7859
+ {
7860
+ position: "relative",
7861
+ width: contentWidth,
7862
+ minWidth: contentMinWidth,
7863
+ backgroundColor: backgroundColor ?? theme2.colors.backgroundContent,
7864
+ boxShadow: "0px 10px 20px #00000020",
7865
+ paddingBlock: isSmall ? theme2.styles.gap / 2 : theme2.styles.gap,
7866
+ paddingInline: asContextMenu ? 0 : isSmall ? theme2.styles.space / 2 : theme2.styles.space,
7867
+ overflow: asContextMenu ? "hidden" : void 0,
7868
+ children: content
7869
+ }
7870
+ ),
7871
+ /* @__PURE__ */ jsx21(
7872
+ Div_default,
7873
+ {
7874
+ position: "absolute",
7875
+ width: position === "left" || position === "right" ? totalGap : "100%",
7876
+ height: position === "top" || position === "bottom" ? totalGap : "100%",
7877
+ top: position === "top" ? "100%" : position === "bottom" ? void 0 : 0,
7878
+ bottom: position === "bottom" ? "100%" : position === "top" ? void 0 : 0,
7879
+ left: position === "left" ? "100%" : position === "right" ? void 0 : 0,
7880
+ right: position === "right" ? "100%" : position === "left" ? void 0 : 0,
7881
+ borderTopLeftRadius: 999,
7882
+ borderTopRightRadius: 999
7883
+ }
7884
+ ),
7885
+ withArrow && /* @__PURE__ */ jsx21(
7886
+ Arrow,
7887
+ {
7888
+ position,
7889
+ align,
7890
+ sideSpace: theme2.styles.borderRadius,
7891
+ size: arrowSize,
7892
+ color: backgroundColor ?? theme2.colors.backgroundContent,
7893
+ isOpen
7894
+ }
7895
+ )
7896
+ ] })
7897
+ }
7898
+ )
7899
+ ]
7900
+ }
7901
+ );
7885
7902
  });
7886
- TooltipComponent.item = forwardRef16(function Item({ icon, text, description, isActive, value, id, onClick, onClickWithValue }, ref) {
7903
+ TooltipComponent.item = forwardRef16(function Item({
7904
+ icon,
7905
+ iconColor,
7906
+ text,
7907
+ textColor,
7908
+ description,
7909
+ isActive,
7910
+ value,
7911
+ id,
7912
+ disabled,
7913
+ onClick,
7914
+ onClickWithValue
7915
+ }, ref) {
7887
7916
  const theme2 = useTheme();
7888
7917
  return /* @__PURE__ */ jsxs17(
7889
7918
  Div_default.row,
@@ -7891,20 +7920,21 @@ TooltipComponent.item = forwardRef16(function Item({ icon, text, description, is
7891
7920
  alignItems: "center",
7892
7921
  gap: theme2.styles.space,
7893
7922
  backgroundColor: theme2.colors.backgroundContent,
7894
- filterHover: "brightness(0.9)",
7923
+ filterHover: !disabled ? "brightness(0.9)" : "brightness(0.94)",
7895
7924
  paddingBlock: theme2.styles.gap,
7896
7925
  paddingInline: theme2.styles.space,
7897
- cursor: "pointer",
7926
+ cursor: disabled ? "not-allowed" : "pointer",
7898
7927
  isTabAccessed: true,
7899
7928
  id,
7929
+ opacity: disabled ? 0.4 : void 0,
7900
7930
  value,
7901
- onClick,
7902
- onClickWithValue,
7931
+ onClick: !disabled ? onClick : void 0,
7932
+ onClickWithValue: !disabled ? onClickWithValue : void 0,
7903
7933
  ref,
7904
7934
  children: [
7905
- icon && /* @__PURE__ */ jsx21(Icon_default, { name: icon, color: !isActive ? theme2.colors.textSecondary : void 0 }),
7935
+ icon && /* @__PURE__ */ jsx21(Icon_default, { name: icon, color: iconColor ?? (!isActive ? theme2.colors.textSecondary : void 0) }),
7906
7936
  /* @__PURE__ */ jsxs17(Div_default.column, { flex: 1, gap: theme2.styles.gap / 2, children: [
7907
- /* @__PURE__ */ jsx21(Text_default, { fontWeight: isActive ? 700 : void 0, children: text }),
7937
+ /* @__PURE__ */ jsx21(Text_default, { fontWeight: isActive ? 700 : void 0, color: textColor ?? theme2.colors.textPrimary, children: text }),
7908
7938
  description && /* @__PURE__ */ jsx21(Text_default, { fontSize: 14, color: theme2.colors.textSecondary, children: description })
7909
7939
  ] })
7910
7940
  ]