react-better-html 1.1.121 → 1.1.123

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
@@ -7219,7 +7219,7 @@ var TableComponent = forwardRef15(function Table({
7219
7219
  if (filter.min !== void 0 && minDate && itemValue < minDate) return false;
7220
7220
  if (filter.max !== void 0 && maxDate && itemValue > maxDate) return false;
7221
7221
  } else if (column.filter === "list" && filter.type === "list") {
7222
- const itemValue = column.getValueForList?.(item) ?? (column.type === "text" && column.keyName ? String(item[column.keyName]) : "");
7222
+ const itemValue = column.getValueForList?.(item).value ?? (column.type === "text" && column.keyName ? String(item[column.keyName]) : "");
7223
7223
  if (!filter.list?.includes(itemValue)) return false;
7224
7224
  }
7225
7225
  return true;
@@ -7239,27 +7239,26 @@ var TableComponent = forwardRef15(function Table({
7239
7239
  }, [data, checkedItems]);
7240
7240
  const possibleFilterListValues = useMemo7(() => {
7241
7241
  if (!openedFilterColumn) return [];
7242
- return data.reduce(
7243
- (previousValue, currentValue) => {
7244
- const value = openedFilterColumn.type === "text" && openedFilterColumn.keyName ? String(currentValue[openedFilterColumn.keyName]) : void 0;
7245
- if (value !== void 0) {
7246
- if (previousValue.some((item) => item.value === value)) {
7247
- previousValue = previousValue.map(
7248
- (item) => item.value === value ? {
7249
- ...item,
7250
- count: item.count + 1
7251
- } : item
7252
- );
7253
- } else
7254
- previousValue.push({
7255
- value,
7256
- count: 1
7257
- });
7258
- }
7259
- return previousValue;
7260
- },
7261
- []
7262
- );
7242
+ return data.reduce((previousValue, currentValue) => {
7243
+ const valueFromList = openedFilterColumn.filter === "list" && openedFilterColumn.getValueForList ? openedFilterColumn.getValueForList(currentValue) : void 0;
7244
+ const value = valueFromList ? valueFromList.value : openedFilterColumn.type === "text" && openedFilterColumn.keyName ? String(currentValue[openedFilterColumn.keyName]) : void 0;
7245
+ if (value !== void 0) {
7246
+ if (previousValue.some((item) => item.value === value)) {
7247
+ previousValue = previousValue.map(
7248
+ (item) => item.value === value ? {
7249
+ ...item,
7250
+ count: item.count + 1
7251
+ } : item
7252
+ );
7253
+ } else
7254
+ previousValue.push({
7255
+ label: valueFromList ? valueFromList.label : value,
7256
+ value,
7257
+ count: 1
7258
+ });
7259
+ }
7260
+ return previousValue;
7261
+ }, []);
7263
7262
  }, [data, openedFilterColumn]);
7264
7263
  const pageCountInternal = pageCount ?? (pageSize !== void 0 ? Math.ceil(dataAfterFilter.length / pageSize) : 1);
7265
7264
  const paginationItems = useMemo7(() => {
@@ -7566,7 +7565,7 @@ var TableComponent = forwardRef15(function Table({
7566
7565
  value: value.value,
7567
7566
  onClickWithValue: onClickFilterListItem,
7568
7567
  children: /* @__PURE__ */ jsxs16(Div_default.row, { alignItems: "center", gap: theme2.styles.gap / 2, children: [
7569
- /* @__PURE__ */ jsx20(Text_default, { children: value.value }),
7568
+ /* @__PURE__ */ jsx20(Text_default, { children: value.label ?? value.value }),
7570
7569
  openedFilterColumn.withTotalNumber && /* @__PURE__ */ jsxs16(
7571
7570
  Text_default,
7572
7571
  {
@@ -7900,7 +7899,19 @@ var TooltipComponent = forwardRef16(function Tooltip({
7900
7899
  }
7901
7900
  );
7902
7901
  });
7903
- TooltipComponent.item = forwardRef16(function Item({ icon, text, description, isActive, value, id, onClick, onClickWithValue }, ref) {
7902
+ TooltipComponent.item = forwardRef16(function Item({
7903
+ icon,
7904
+ iconColor,
7905
+ text,
7906
+ textColor,
7907
+ description,
7908
+ isActive,
7909
+ value,
7910
+ id,
7911
+ disabled,
7912
+ onClick,
7913
+ onClickWithValue
7914
+ }, ref) {
7904
7915
  const theme2 = useTheme();
7905
7916
  return /* @__PURE__ */ jsxs17(
7906
7917
  Div_default.row,
@@ -7908,20 +7919,21 @@ TooltipComponent.item = forwardRef16(function Item({ icon, text, description, is
7908
7919
  alignItems: "center",
7909
7920
  gap: theme2.styles.space,
7910
7921
  backgroundColor: theme2.colors.backgroundContent,
7911
- filterHover: "brightness(0.9)",
7922
+ filterHover: !disabled ? "brightness(0.9)" : "brightness(0.94)",
7912
7923
  paddingBlock: theme2.styles.gap,
7913
7924
  paddingInline: theme2.styles.space,
7914
- cursor: "pointer",
7925
+ cursor: disabled ? "not-allowed" : "pointer",
7915
7926
  isTabAccessed: true,
7916
7927
  id,
7928
+ opacity: disabled ? 0.4 : void 0,
7917
7929
  value,
7918
- onClick,
7919
- onClickWithValue,
7930
+ onClick: !disabled ? onClick : void 0,
7931
+ onClickWithValue: !disabled ? onClickWithValue : void 0,
7920
7932
  ref,
7921
7933
  children: [
7922
- icon && /* @__PURE__ */ jsx21(Icon_default, { name: icon, color: !isActive ? theme2.colors.textSecondary : void 0 }),
7934
+ icon && /* @__PURE__ */ jsx21(Icon_default, { name: icon, color: iconColor ?? (!isActive ? theme2.colors.textSecondary : void 0) }),
7923
7935
  /* @__PURE__ */ jsxs17(Div_default.column, { flex: 1, gap: theme2.styles.gap / 2, children: [
7924
- /* @__PURE__ */ jsx21(Text_default, { fontWeight: isActive ? 700 : void 0, children: text }),
7936
+ /* @__PURE__ */ jsx21(Text_default, { fontWeight: isActive ? 700 : void 0, color: textColor ?? theme2.colors.textPrimary, children: text }),
7925
7937
  description && /* @__PURE__ */ jsx21(Text_default, { fontSize: 14, color: theme2.colors.textSecondary, children: description })
7926
7938
  ] })
7927
7939
  ]