@farmzone/fz-react-ui 1.0.12 → 1.0.13

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.cjs CHANGED
@@ -82,7 +82,7 @@ var buttonVariants = classVarianceAuthority.cva(
82
82
  carousel: "bg-white border border-gray-300 hover:bg-gray-100 hover:text-black rounded-full",
83
83
  accent: "btn-grad text-white rounded-full",
84
84
  metal: "btn-metal text-white min-w-22",
85
- ghost: "p-1 h-auto rounded-sm bg-transparent hover:bg-sub-lightgray text-sub-darkgray hover:bg-inherit",
85
+ ghost: "p-1 h-auto rounded-sm bg-transparent text-sub-darkgray transition-colors hover:bg-gray-100",
86
86
  link: "bg-transparent border-none text-main-blue underline-offset-4 hover:underline h-auto p-0"
87
87
  },
88
88
  size: {
@@ -4741,15 +4741,26 @@ function Table(props) {
4741
4741
  if (!isDynamicHeight) return;
4742
4742
  const el = scrollRef.current;
4743
4743
  if (!el) return;
4744
+ const pageContainer = el.parentElement?.parentElement;
4745
+ const isContainerConstrained = (container2) => {
4746
+ if (!container2) return false;
4747
+ const style = window.getComputedStyle(container2);
4748
+ return style.overflow === "hidden" || style.overflowY === "hidden";
4749
+ };
4750
+ const getContainerBottom = () => {
4751
+ if (isContainerConstrained(pageContainer)) {
4752
+ return Math.min(pageContainer.getBoundingClientRect().bottom, window.innerHeight);
4753
+ }
4754
+ return window.innerHeight;
4755
+ };
4744
4756
  const update = () => {
4745
4757
  const top = el.getBoundingClientRect().top;
4746
4758
  const footerH = footerRef.current?.getBoundingClientRect().height ?? 0;
4747
- setTableHeight(window.innerHeight - top - footerH - 24);
4759
+ setTableHeight(getContainerBottom() - top - footerH - 24);
4748
4760
  };
4749
4761
  update();
4750
4762
  window.addEventListener("resize", update);
4751
4763
  const observer = new ResizeObserver(update);
4752
- const pageContainer = el.parentElement?.parentElement;
4753
4764
  if (pageContainer) observer.observe(pageContainer);
4754
4765
  const footer = footerRef.current;
4755
4766
  if (footer) observer.observe(footer);
@@ -4762,9 +4773,15 @@ function Table(props) {
4762
4773
  if (!isDynamicHeight) return;
4763
4774
  const el = scrollRef.current;
4764
4775
  if (!el) return;
4776
+ const pageContainer = el.parentElement?.parentElement;
4765
4777
  const top = el.getBoundingClientRect().top;
4766
4778
  const footerH = footerRef.current?.getBoundingClientRect().height ?? 0;
4767
- setTableHeight(window.innerHeight - top - footerH - 24);
4779
+ const isContainerConstrained = !!pageContainer && (() => {
4780
+ const style = window.getComputedStyle(pageContainer);
4781
+ return style.overflow === "hidden" || style.overflowY === "hidden";
4782
+ })();
4783
+ const containerBottom = isContainerConstrained ? Math.min(pageContainer.getBoundingClientRect().bottom, window.innerHeight) : window.innerHeight;
4784
+ setTableHeight(containerBottom - top - footerH - 24);
4768
4785
  }, [showSkeleton, showEmpty]);
4769
4786
  const selectedKeysRef = React6.useRef(selectedKeys);
4770
4787
  selectedKeysRef.current = selectedKeys;