import{slicedToArray as e,defineProperty as t}from"../../../../_virtual/_rollupPluginBabelHelpers.js";import o,{forwardRef as r,useState as n}from"react";import a from"classnames";import i from"./TableHeaderCell.module.scss.js";import{Icon as s}from"@vibe/icon/mockedClassNames";import l from"../../IconButton/IconButton.js";import{Info as c}from"@vibe/icons";import m from"../../Text/Text.js";import{Flex as d}from"@vibe/layout/mockedClassNames";import{getSortIcon as p,getNextSortState as u,getAriaSort as f}from"../Table/tableHelpers.js";import b from"../../Tooltip/Tooltip.js";import{getTestId as v}from"../../../tests/testIds.js";import{ComponentDefaultTestId as C}from"../../../tests/constants.js";import{getStyle as E}from"../../../helpers/typesciptCssModulesHelper.js";var y=r((function(r,y){var j=r.id,N=r.className,T=r["data-testid"],H=r.title,k=r.onSortClicked,x=r.infoContent,L=r.icon,g=r.sortState,B=void 0===g?"none":g,h=r.sortButtonAriaLabel,A=void 0===h?"Sort":h,w=r.sticky,I=n(!1),S=e(I,2),_=S[0],M=S[1],P=f(B),z="none"!==P||_;return o.createElement("div",{ref:y,id:j,className:a(i.tableHeaderCell,t(t({},i.sortActive,k&&"none"!==P),i.sticky,w),N),"data-testid":T||v(C.TABLE_HEADER_CELL,j),role:"columnheader",onMouseOver:function(){return M(!0)},onMouseLeave:function(){return M(!1)},onFocus:function(){return M(!0)},onBlur:function(){return M(!1)},"aria-sort":k?P:void 0,tabIndex:k?0:void 0},o.createElement(d,{direction:"row",align:"center",className:i.tableHeaderCellContent,gap:"xs"},L&&o.createElement(s,{icon:L,className:i.icon}),"string"==typeof H?o.createElement(m,{type:"text2",weight:"medium",color:"secondary"},H):H,x&&o.createElement(b,{content:x,referenceWrapperClassName:i.infoTooltip},o.createElement(s,{icon:c,iconLabel:x}))),k&&o.createElement(d,{direction:"row",align:"center",className:i.tableHeaderCellSort},o.createElement(l,{icon:p(B),kind:"tertiary",size:"xs",ariaLabel:A,"aria-hidden":!z,className:a(i.sort,E(i,B),t({},i.show,z)),onClick:function(){return k(u(B))}})))}));export{y as default};
//# sourceMappingURL=TableHeaderCell.js.map
