UNPKG

@lanaco/lnc-react-ui

Version:

React component library

8 lines (7 loc) 873 B
"use strict";const g=require("react/jsx-runtime"),t=require("react"),j=require("./emotion-styled.browser.esm-DwHBgTPn.cjs"),q=require("./emotion-element-f0de968e.browser.esm-B7k6i6lC.cjs"),v=j.styled.div` background: transparent; display: flex; justify-content: ${e=>e.fullWidth?"space-evenly":"none"}; gap: ${e=>e.type=="pill"?"10px":"0"}; box-sizing: border-box; `,C=t.forwardRef((e,a)=>{const{type:n="regular",fullWidth:l=!1,className:d="",style:m={},color:o="primary",size:c="small",children:i,...u}=e,h=q.useTheme(),[p,y]=t.useState(),b={theme:h,color:o,size:c,style:m,className:"lnc-ui-tabs "+d},f=s=>{y(s)},x=t.Children.map(i,(s,r)=>t.cloneElement(s,{type:n,first:r==0,last:r==t.Children.toArray(i).length-1,fullWidth:l,index:r,itemClick:f,activeIndex:p,color:o,size:c}));return g.jsx(v,{ref:a,type:n,fullWidth:l,...b,...u,children:x})});module.exports=C;