synapse-react-client
Version:
[](https://badge.fury.io/js/synapse-react-client) [](https://github.com/prettier/prettie
41 lines (40 loc) • 1.04 kB
JavaScript
import { jsxs as r, jsx as c } from "react/jsx-runtime";
import { useState as s, useRef as f } from "react";
import { useResizeObserver as m } from "@react-hookz/web";
import h from "./ExpandCollapseButton.js";
function N(t) {
const [a, o] = s(!1), [d, i] = s(!1), l = f(null);
return m(l, ({ target: n }) => {
if (!a && n) {
const e = n.getElementsByClassName(
"SynapseTableCellContent"
)[0];
e && i(
e.scrollHeight > e.clientHeight + 2 || e.scrollWidth > e.clientWidth + 2
);
}
}), /* @__PURE__ */ r(
"td",
{
...t,
className: `ExpandableTableData ${t.className ? t.className : ""}`,
"aria-expanded": a,
ref: l,
children: [
d && /* @__PURE__ */ c(
h,
{
isExpanded: a,
className: "ExpandableTableData__expandButton",
onClick: () => o(!a)
}
),
t.children
]
}
);
}
export {
N as default
};
//# sourceMappingURL=ExpandableTableDataCell.js.map