UNPKG

synapse-react-client

Version:

[![npm version](https://badge.fury.io/js/synapse-react-client.svg)](https://badge.fury.io/js/synapse-react-client) [![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettie

41 lines (40 loc) 1.04 kB
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