react-better-html 1.1.134 → 1.1.136

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
@@ -756,6 +756,8 @@ type TooltipProps = {
756
756
  content: React.ReactNode;
757
757
  contentWidth?: React.CSSProperties["width"];
758
758
  contentMinWidth?: React.CSSProperties["minWidth"];
759
+ /** @default "fit-content" */
760
+ childrenWrapperWidth?: React.CSSProperties["width"];
759
761
  withArrow?: boolean;
760
762
  isSmall?: boolean;
761
763
  backgroundColor?: string;
package/dist/index.d.ts CHANGED
@@ -756,6 +756,8 @@ type TooltipProps = {
756
756
  content: React.ReactNode;
757
757
  contentWidth?: React.CSSProperties["width"];
758
758
  contentMinWidth?: React.CSSProperties["minWidth"];
759
+ /** @default "fit-content" */
760
+ childrenWrapperWidth?: React.CSSProperties["width"];
759
761
  withArrow?: boolean;
760
762
  isSmall?: boolean;
761
763
  backgroundColor?: string;
package/dist/index.js CHANGED
@@ -6580,7 +6580,6 @@ InputFieldComponent.dateTime = (0, import_react20.forwardRef)(function DateTime(
6580
6580
  const newTime = `${internalValue?.toString().split("T")?.[1]?.split(":")[0] || "00"}:${minute.toString().padStart(2, "0")}`;
6581
6581
  const today = `${(/* @__PURE__ */ new Date()).getFullYear()}-${((/* @__PURE__ */ new Date()).getMonth() + 1).toString().padStart(2, "0")}-${(/* @__PURE__ */ new Date()).getDate().toString().padStart(2, "0")}`;
6582
6582
  const newValue = `${(internalValue.trim() || today)?.toString().split("T")[0]}T${newTime}`;
6583
- console.log(newValue);
6584
6583
  inputFieldProps.onChangeValue?.(newValue);
6585
6584
  setInternalValue(newValue);
6586
6585
  },
@@ -7485,12 +7484,8 @@ var TableComponent = (0, import_react25.forwardRef)(function Table({
7485
7484
  const mediaQuery = useMediaQuery();
7486
7485
  const { colorTheme } = useBetterHtmlContextInternal();
7487
7486
  const filterModalRef = (0, import_react25.useRef)(null);
7488
- const onChangePageRef = (0, import_react25.useRef)(onChangePage);
7489
- onChangePageRef.current = onChangePage;
7490
- const onChangeFilterRef = (0, import_react25.useRef)(onChangeFilter);
7491
- onChangeFilterRef.current = onChangeFilter;
7492
- const onChangeFilterDataValueRef = (0, import_react25.useRef)(onChangeFilterDataValue);
7493
- onChangeFilterDataValueRef.current = onChangeFilterDataValue;
7487
+ const columnsRef = (0, import_react25.useRef)(columns);
7488
+ columnsRef.current = columns;
7494
7489
  const [checkedItems, setCheckedItems] = (0, import_react25.useState)([]);
7495
7490
  const [expandedRows, setExpandedRows] = (0, import_react25.useState)([]);
7496
7491
  const [currentPage, setCurrentPage] = (0, import_react25.useState)(1);
@@ -7738,7 +7733,7 @@ var TableComponent = (0, import_react25.forwardRef)(function Table({
7738
7733
  () => data.filter(
7739
7734
  (item) => Object.entries(filterData).every(([columnIndex, filter]) => {
7740
7735
  if (!filter) return true;
7741
- const column = columns[parseInt(columnIndex)];
7736
+ const column = columnsRef.current[parseInt(columnIndex)];
7742
7737
  if (!column) return true;
7743
7738
  if (column.filter === "number" && filter.type === "number") {
7744
7739
  const itemValue = column.getValue?.(item) ?? (column.type === "text" && column.keyName ? Number(item[column.keyName]) : 0);
@@ -7757,7 +7752,7 @@ var TableComponent = (0, import_react25.forwardRef)(function Table({
7757
7752
  return true;
7758
7753
  })
7759
7754
  ),
7760
- [data, filterData, columns]
7755
+ [data, filterData]
7761
7756
  );
7762
7757
  const dataAfterPagination = (0, import_react25.useMemo)(() => {
7763
7758
  if (pageSize === void 0) return dataAfterFilter;
@@ -7825,14 +7820,14 @@ var TableComponent = (0, import_react25.forwardRef)(function Table({
7825
7820
  );
7826
7821
  const onClickDeselectAllFilterListItems = (0, import_react25.useCallback)(() => setFilterListSelectedItems([]), []);
7827
7822
  (0, import_react25.useEffect)(() => {
7828
- onChangePageRef.current?.(currentPage);
7829
- }, [currentPage]);
7823
+ onChangePage?.(currentPage);
7824
+ }, [onChangePage, currentPage]);
7830
7825
  (0, import_react25.useEffect)(() => {
7831
- onChangeFilterRef.current?.(filterData);
7832
- }, [filterData]);
7826
+ onChangeFilter?.(filterData);
7827
+ }, [onChangeFilter, filterData]);
7833
7828
  (0, import_react25.useEffect)(() => {
7834
- onChangeFilterDataValueRef.current?.(dataAfterFilter);
7835
- }, [dataAfterFilter]);
7829
+ onChangeFilterDataValue?.(dataAfterFilter);
7830
+ }, [onChangeFilterDataValue, dataAfterFilter]);
7836
7831
  (0, import_react25.useImperativeHandle)(
7837
7832
  ref,
7838
7833
  () => {
@@ -8293,6 +8288,7 @@ var TooltipComponent = (0, import_react26.forwardRef)(function Tooltip({
8293
8288
  content,
8294
8289
  contentWidth,
8295
8290
  contentMinWidth,
8291
+ childrenWrapperWidth = "fit-content",
8296
8292
  withArrow,
8297
8293
  isSmall,
8298
8294
  backgroundColor,
@@ -8390,12 +8386,12 @@ var TooltipComponent = (0, import_react26.forwardRef)(function Tooltip({
8390
8386
  Div_default,
8391
8387
  {
8392
8388
  position: "relative",
8393
- width: "fit-content",
8389
+ width: childrenWrapperWidth,
8394
8390
  onClick: onClickHolder,
8395
8391
  onMouseEnter,
8396
8392
  onMouseLeave,
8397
8393
  children: [
8398
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Div_default, { width: "fit-content", isTabAccessed, ref: triggerHolderRef, children }),
8394
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Div_default, { width: childrenWrapperWidth, isTabAccessed, ref: triggerHolderRef, children }),
8399
8395
  /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
8400
8396
  TooltipContainer,
8401
8397
  {