UNPKG

carbon-react

Version:

A library of reusable React components for easily building user interfaces.

2 lines (1 loc) 5.7 kB
import o,{css as r}from"styled-components";import t from"../../../style/themes/apply-base-theme.js";import{StyledFlatTableCell as e}from"../flat-table-cell/flat-table-cell.style.js";import{StyledFlatTableRowHeader as i}from"../flat-table-row-header/flat-table-row-header.style.js";import l from"../flat-table-checkbox/flat-table-checkbox.style.js";import a from"../flat-table-header/flat-table-header.style.js";import s from"../../icon/icon.style.js";import{toColor as n}from"../../../style/utils/color.js";import d from"../../../style/utils/add-focus-styling.js";import{getNavigator as c}from"../../../__internal__/dom/globals.js";import{isSafari as b}from"../../../__internal__/utils/helpers/browser-type-check/index.js";const p={medium:"2px",large:"4px"},h=o=>`\n ${d(!0)}\n z-index: ${o.zIndex.overlay+5};\n `,f=o=>`\n width: calc(100% + 1px);\n z-index: ${o.zIndex.overlay};\n :before {\n content: "";\n border-top: 2px solid var(--colorsSemanticFocus500);\n border-bottom: 2px solid var(--colorsSemanticFocus500);\n display: block;\n left: -2px;\n top: 0px;\n height: calc(100% - 3px);\n width: 103%;\n position: absolute;\n z-index: ${o.zIndex.overlay};\n }\n }\n `,v=o=>{switch(o){case"light":return"var(--colorsUtilityMajor100)";case"transparent-base":return"var(--colorsUtilityMajor025)";case"transparent-white":return"var(--colorsUtilityYang100)";default:return"var(--colorsUtilityMajor400)"}},y=o=>{switch(o){case"transparent-base":return"var(--colorsUtilityMajor025)";case"transparent-white":return"var(--colorsUtilityYang100)";default:return"var(--colorsUtilityMajor100)"}},m=o.tr.attrs(t).withConfig({displayName:"flat-table-row.style__StyledFlatTableRow",componentId:"sc-4daf4fd4-0"})(["",""],(({bgColor:o,horizontalBorderColor:t,horizontalBorderSize:d,stickyOffset:m,isRowInteractive:u,isFirstColumnInteractive:x,lhsRowHeaderIndex:g,rhsRowHeaderIndex:j,totalChildren:w,firstCellIndex:M,colorTheme:U,expandable:k,selected:z,highlighted:_,isExpanded:$,isInSidebar:I,isSubRow:S,isFirstSubRow:R,size:F,theme:C,isDragging:A,draggable:H,rowHeight:B})=>{const T=c(),Y=o?n(C,o):void 0,D=t?n(C,t):void 0,E=I?"var(--colorsUtilityMajor150)":"var(--colorsUtilityMajor075)",N=I?"var(--colorsUtilityMajor100)":"var(--colorsUtilityMajor050)",O=`${i}, ${e}, ${l}`;return r(["border-collapse:separate;border-radius:0px;border-spacing:0;min-width:100%;table-layout:fixed;width:auto;:focus-visible{outline:none;}","{"," "," ","}"," + td{border-left:none;}"," "," "," ","{border-bottom:1px solid ",";"," ","}"," "," "," "," "," "," "," "," "," "," ",""],O,Y&&`background-color: ${Y};`,"small"!==d&&r(["border-bottom:"," solid var(--colorsUtilityMajor100);"],p[d]),D&&r(["border-bottom-color:",";"],D),i,-1!==g&&r(["",":nth-child(","){border-right:2px solid ",";}"],i,g+1,y(U)),-1!==j&&r(["",":nth-child(","){border-left:2px solid ",";}",":nth-child(","){border-right:none;}"],i,j+1,y(U),a,j),j===w-1&&r(["td:last-of-type{border-right:none;}"]),a,v(U),"small"!==d&&r(["border-bottom:"," solid var(--colorsUtilityMajor100);"],p[d]),!I&&!(null==U?void 0:U.includes("transparent"))&&`\n :first-child {\n border-left: 1px solid ${v(U)};\n }\n `,void 0!==m&&r(["&& th{top:","px;}"],m),u&&r(['cursor:pointer;:focus{position:relative;:after{content:"";box-sizing:border-box;position:absolute;left:0px;right:0px;top:0;bottom:0px;'," pointer-events:none;}:last-child{:after{border-bottom-left-radius:var(--borderRadius100);border-bottom-right-radius:var(--borderRadius100);}}:first-child{:after{top:0px;}}"," ","{"," "," ","}","}:hover{","{background-color:",";}}"],h(C),T&&b(T)&&r(['position:-webkit-sticky;:after{border:none;content:"";height:',"px;","}"],B,h(C)),i,0===g&&C&&r(["&:first-of-type::before{border-left:3px solid var(--colorsSemanticFocus500);}"]),((o,t,e)=>o===t-1&&e&&r(["&:last-of-type{border-right:2px solid var(--colorsSemanticFocus500);}"]))(j,w,C),f(C),![-1,0].includes(g)&&r(["",""],Array.from({length:g}).map(((o,r)=>`\n td:nth-of-type(${r+1}) {\n ${f(C)}\n }\n `))),O,Y||"var(--colorsUtilityMajor025)"),x&&r(["td:nth-child(","),th:nth-child(","){cursor:pointer;:focus{","}:hover{background-color:",";}}"],M+1,M+1,h(C),Y||"var(colorsUtilityMajor025)"),I&&r(["","{background-color:",";};}","{background-color:var(--colorsUtilityMajor040);border-bottom-color:var(--colorsUtilityMajor100);}td:first-of-type,th:first-of-type{border-left:none;}td:last-of-type{border-right:none;}","{border-right:1px solid ",";}",""],O,o||"var(--colorsUtilityMajor040)",a,l,N,u&&r([":hover{",",",":not(th){background-color:",";}}"],e,l,Y||"var(--colorsUtilityMajor075)")),k&&r(["",":first-child > div,",":first-child > div,"," + "," > div{",'[type="chevron_down_thick"]:first-of-type{transition:transform 0.3s;',"}}"],e,i,l,e,s,!$&&r(["transform:rotate(-90deg);"])),S&&r(["","{background-color:",";}",":first-child > div,",":first-child > div,"," + "," > div{padding-left:",";}"],O,Y||"var(--colorsActionMinor025)",e,i,l,e,"compact"===F?"32px":"40px"),A&&r(["border:"," 2px solid;","{background-color:",";}"],I?"var(--colorsUtilityMajor300)":"var(--colorsUtilityMajor200)",O,I?"var(--colorsUtilityMajor200)":"var(--colorsUtilityMajor150)"),H&&r(["",":first-of-type{font-size:20px;color:var(--colorsActionMinor500);}"],s),R&&r(["","{box-shadow:var(--boxShadow075);}"],O),_&&r(["","{background-color:",";}:hover{",",",",",":not(th){background-color:",";}}"],O,Y||N,e,i,l,Y||N),z&&r(["",",","{background-color:",";}:hover{",",",",",":not(th){background-color:",";}}"],e,l,Y||E,e,i,l,Y||E))}));export{m as default};