carbon-react
Version:
A library of reusable React components for easily building user interfaces.
2 lines (1 loc) • 1.85 kB
JavaScript
import{jsx as e}from"react/jsx-runtime";import{useRef as t,useState as r,useEffect as n}from"react";import o from"./flat-table-head.style.js";import"../__internal__/strict-flat-table.context.js";import c from"../__internal__/build-position-map.js";import l from"./__internal__/flat-table-head.context.js";function i(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const a=a=>{var{children:f}=a,u=function(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},c=Object.keys(e);for(n=0;n<c.length;n++)r=c[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(e);for(n=0;n<c.length;n++)r=c[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}(a,["children"]);const p=t(null),[b,s]=r({});return n((()=>{var e;const t=null===(e=p.current)||void 0===e?void 0:e.querySelectorAll("tr");s(t?c(Array.from(t),"offsetHeight"):{})}),[f]),e(o,(O=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter((function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable})))),n.forEach((function(t){i(e,t,r[t])}))}return e}({ref:p,"data-component":"flat-table-head"},u),y=null!=(y={children:e(l.Provider,{value:{stickyOffsets:b},children:f})})?y:{},Object.getOwnPropertyDescriptors?Object.defineProperties(O,Object.getOwnPropertyDescriptors(y)):function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t.push.apply(t,r)}return t}(Object(y)).forEach((function(e){Object.defineProperty(O,e,Object.getOwnPropertyDescriptor(y,e))})),O));var O,y};export{a as FlatTableHead,a as default};