import { jsx as e } from "react/jsx-runtime";
import { classNames as h } from "./index-classNames.js";
import { ComponentContainer as a } from "./index-ComponentContainer.js";
import { IconNames as u } from "./index-IconNames.js";
import { CtaWithIcon as p } from "./index-CtaWithIcon.js";
import { TableProvider as C } from "./index-Table.js";
import { Text as b, FontWeights as x } from "./index-Text.js";
import { useContext as v, useState as w, useEffect as S } from "react";
import N from "./index-FooterShowMore.module.scss.js";
const H = (i) => {
  const {
    isHidden: n = !1
  } = i, c = v(C), {
    data: t,
    onShowMore: r,
    pagination: o
  } = c;
  t == null || t.columns;
  const [s, m] = w(!1), l = (o == null ? void 0 : o.limit) ?? 1, f = (o == null ? void 0 : o.offset) ?? 0, d = (o == null ? void 0 : o.total) ?? 1;
  return S(() => {
    f + l >= d ? m(!0) : m(!1);
  }, [o]), n ? null : e(a, {
    children: e(p, {
      onClick: (W) => {
        r && r(l);
      },
      disabled: s,
      className: h(N.linkColor),
      icon: u.caretDown,
      position: "right",
      children: e(b, {
        fontWeight: x.medium,
        color: s ? "var(--n300)" : "var(--brand-color)",
        children: "Show more"
      })
    })
  });
};
export {
  H as FooterShowMore
};
