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.d.mts CHANGED
@@ -647,6 +647,11 @@ declare const ColorThemeSwitch: typeof ColorThemeSwitchComponent & {
647
647
  };
648
648
 
649
649
  type FilterPreset = "today" | "yesterday" | "tomorrow" | "thisWeek" | "thisMonth" | "thisYear" | "lastWeek" | "lastMonth" | "lastYear" | "nextWeek" | "nextMonth" | "nextYear";
650
+ type ListFilterValue = {
651
+ label?: string;
652
+ value: string;
653
+ count: number;
654
+ };
650
655
  type TableFilterData = {
651
656
  type: "number";
652
657
  min?: number;
@@ -694,7 +699,7 @@ type DateFilter<DataItem> = {
694
699
  type ListFilter<DataItem> = {
695
700
  filter?: "list";
696
701
  withTotalNumber?: boolean;
697
- getValueForList?: (item: DataItem) => string;
702
+ getValueForList?: (item: DataItem) => OmitProps<ListFilterValue, "count">;
698
703
  };
699
704
  type TableColumn<DataItem> = {
700
705
  label?: string;
@@ -769,11 +774,14 @@ type TooltipComponent = {
769
774
  declare const TooltipComponent: TooltipComponent;
770
775
  type TooltipItemProps<Value = unknown> = {
771
776
  icon?: IconName | AnyOtherString;
777
+ iconColor?: string;
772
778
  text?: string;
779
+ textColor?: string;
773
780
  description?: string;
774
781
  isActive?: boolean;
775
782
  value?: Value;
776
783
  id?: string;
784
+ disabled?: boolean;
777
785
  onClick?: () => void;
778
786
  onClickWithValue?: (value: Value) => void;
779
787
  };
package/dist/index.d.ts CHANGED
@@ -647,6 +647,11 @@ declare const ColorThemeSwitch: typeof ColorThemeSwitchComponent & {
647
647
  };
648
648
 
649
649
  type FilterPreset = "today" | "yesterday" | "tomorrow" | "thisWeek" | "thisMonth" | "thisYear" | "lastWeek" | "lastMonth" | "lastYear" | "nextWeek" | "nextMonth" | "nextYear";
650
+ type ListFilterValue = {
651
+ label?: string;
652
+ value: string;
653
+ count: number;
654
+ };
650
655
  type TableFilterData = {
651
656
  type: "number";
652
657
  min?: number;
@@ -694,7 +699,7 @@ type DateFilter<DataItem> = {
694
699
  type ListFilter<DataItem> = {
695
700
  filter?: "list";
696
701
  withTotalNumber?: boolean;
697
- getValueForList?: (item: DataItem) => string;
702
+ getValueForList?: (item: DataItem) => OmitProps<ListFilterValue, "count">;
698
703
  };
699
704
  type TableColumn<DataItem> = {
700
705
  label?: string;
@@ -769,11 +774,14 @@ type TooltipComponent = {
769
774
  declare const TooltipComponent: TooltipComponent;
770
775
  type TooltipItemProps<Value = unknown> = {
771
776
  icon?: IconName | AnyOtherString;
777
+ iconColor?: string;
772
778
  text?: string;
779
+ textColor?: string;
773
780
  description?: string;
774
781
  isActive?: boolean;
775
782
  value?: Value;
776
783
  id?: string;
784
+ disabled?: boolean;
777
785
  onClick?: () => void;
778
786
  onClickWithValue?: (value: Value) => void;
779
787
  };
package/dist/index.js CHANGED
@@ -7291,7 +7291,7 @@ var TableComponent = (0, import_react23.forwardRef)(function Table({
7291
7291
  if (filter.min !== void 0 && minDate && itemValue < minDate) return false;
7292
7292
  if (filter.max !== void 0 && maxDate && itemValue > maxDate) return false;
7293
7293
  } else if (column.filter === "list" && filter.type === "list") {
7294
- const itemValue = column.getValueForList?.(item) ?? (column.type === "text" && column.keyName ? String(item[column.keyName]) : "");
7294
+ const itemValue = column.getValueForList?.(item).value ?? (column.type === "text" && column.keyName ? String(item[column.keyName]) : "");
7295
7295
  if (!filter.list?.includes(itemValue)) return false;
7296
7296
  }
7297
7297
  return true;
@@ -7311,27 +7311,26 @@ var TableComponent = (0, import_react23.forwardRef)(function Table({
7311
7311
  }, [data, checkedItems]);
7312
7312
  const possibleFilterListValues = (0, import_react23.useMemo)(() => {
7313
7313
  if (!openedFilterColumn) return [];
7314
- return data.reduce(
7315
- (previousValue, currentValue) => {
7316
- const value = openedFilterColumn.type === "text" && openedFilterColumn.keyName ? String(currentValue[openedFilterColumn.keyName]) : void 0;
7317
- if (value !== void 0) {
7318
- if (previousValue.some((item) => item.value === value)) {
7319
- previousValue = previousValue.map(
7320
- (item) => item.value === value ? {
7321
- ...item,
7322
- count: item.count + 1
7323
- } : item
7324
- );
7325
- } else
7326
- previousValue.push({
7327
- value,
7328
- count: 1
7329
- });
7330
- }
7331
- return previousValue;
7332
- },
7333
- []
7334
- );
7314
+ return data.reduce((previousValue, currentValue) => {
7315
+ const valueFromList = openedFilterColumn.filter === "list" && openedFilterColumn.getValueForList ? openedFilterColumn.getValueForList(currentValue) : void 0;
7316
+ const value = valueFromList ? valueFromList.value : openedFilterColumn.type === "text" && openedFilterColumn.keyName ? String(currentValue[openedFilterColumn.keyName]) : void 0;
7317
+ if (value !== void 0) {
7318
+ if (previousValue.some((item) => item.value === value)) {
7319
+ previousValue = previousValue.map(
7320
+ (item) => item.value === value ? {
7321
+ ...item,
7322
+ count: item.count + 1
7323
+ } : item
7324
+ );
7325
+ } else
7326
+ previousValue.push({
7327
+ label: valueFromList ? valueFromList.label : value,
7328
+ value,
7329
+ count: 1
7330
+ });
7331
+ }
7332
+ return previousValue;
7333
+ }, []);
7335
7334
  }, [data, openedFilterColumn]);
7336
7335
  const pageCountInternal = pageCount ?? (pageSize !== void 0 ? Math.ceil(dataAfterFilter.length / pageSize) : 1);
7337
7336
  const paginationItems = (0, import_react23.useMemo)(() => {
@@ -7638,7 +7637,7 @@ var TableComponent = (0, import_react23.forwardRef)(function Table({
7638
7637
  value: value.value,
7639
7638
  onClickWithValue: onClickFilterListItem,
7640
7639
  children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Div_default.row, { alignItems: "center", gap: theme2.styles.gap / 2, children: [
7641
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Text_default, { children: value.value }),
7640
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Text_default, { children: value.label ?? value.value }),
7642
7641
  openedFilterColumn.withTotalNumber && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
7643
7642
  Text_default,
7644
7643
  {
@@ -7972,7 +7971,19 @@ var TooltipComponent = (0, import_react24.forwardRef)(function Tooltip({
7972
7971
  }
7973
7972
  );
7974
7973
  });
7975
- TooltipComponent.item = (0, import_react24.forwardRef)(function Item({ icon, text, description, isActive, value, id, onClick, onClickWithValue }, ref) {
7974
+ TooltipComponent.item = (0, import_react24.forwardRef)(function Item({
7975
+ icon,
7976
+ iconColor,
7977
+ text,
7978
+ textColor,
7979
+ description,
7980
+ isActive,
7981
+ value,
7982
+ id,
7983
+ disabled,
7984
+ onClick,
7985
+ onClickWithValue
7986
+ }, ref) {
7976
7987
  const theme2 = useTheme();
7977
7988
  return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
7978
7989
  Div_default.row,
@@ -7980,20 +7991,21 @@ TooltipComponent.item = (0, import_react24.forwardRef)(function Item({ icon, tex
7980
7991
  alignItems: "center",
7981
7992
  gap: theme2.styles.space,
7982
7993
  backgroundColor: theme2.colors.backgroundContent,
7983
- filterHover: "brightness(0.9)",
7994
+ filterHover: !disabled ? "brightness(0.9)" : "brightness(0.94)",
7984
7995
  paddingBlock: theme2.styles.gap,
7985
7996
  paddingInline: theme2.styles.space,
7986
- cursor: "pointer",
7997
+ cursor: disabled ? "not-allowed" : "pointer",
7987
7998
  isTabAccessed: true,
7988
7999
  id,
8000
+ opacity: disabled ? 0.4 : void 0,
7989
8001
  value,
7990
- onClick,
7991
- onClickWithValue,
8002
+ onClick: !disabled ? onClick : void 0,
8003
+ onClickWithValue: !disabled ? onClickWithValue : void 0,
7992
8004
  ref,
7993
8005
  children: [
7994
- icon && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Icon_default, { name: icon, color: !isActive ? theme2.colors.textSecondary : void 0 }),
8006
+ icon && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Icon_default, { name: icon, color: iconColor ?? (!isActive ? theme2.colors.textSecondary : void 0) }),
7995
8007
  /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(Div_default.column, { flex: 1, gap: theme2.styles.gap / 2, children: [
7996
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Text_default, { fontWeight: isActive ? 700 : void 0, children: text }),
8008
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Text_default, { fontWeight: isActive ? 700 : void 0, color: textColor ?? theme2.colors.textPrimary, children: text }),
7997
8009
  description && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Text_default, { fontSize: 14, color: theme2.colors.textSecondary, children: description })
7998
8010
  ] })
7999
8011
  ]