UNPKG

@lanaco/lnc-react-ui

Version:

React component library

8 lines (7 loc) 1.22 kB
"use strict";const P=require("react/jsx-runtime"),r=require("react"),e=require("./index-BPVoEhTF.cjs"),j=require("./emotion-styled.browser.esm-Cle7tAM9.cjs"),q=require("./emotion-element-f0de968e.browser.esm-B7k6i6lC.cjs"),w=j.newStyled.div` background: transparent; display: flex; justify-content: ${s=>s.fullWidth?"space-evenly":"none"}; gap: ${s=>s.type=="pill"?"10px":"0"}; box-sizing: border-box; `,p=r.forwardRef((s,d)=>{const{type:o="regular",fullWidth:l=!1,className:m="",style:u={},color:i="primary",size:a="small",children:c,...y}=s,h=q.useTheme(),[f,b]=r.useState(),g={theme:h,color:i,size:a,style:u,className:"lnc-ui-tabs "+m},T=t=>{b(t)},x=r.Children.map(c,(t,n)=>r.cloneElement(t,{type:o,first:n==0,last:n==r.Children.toArray(c).length-1,fullWidth:l,index:n,itemClick:T,activeIndex:f,color:i,size:a}));return P.jsx(w,{ref:d,type:o,fullWidth:l,...g,...y,children:x})});p.propTypes={type:e.PropTypes.oneOf(["regular","pill","underline"]),fullWidth:e.PropTypes.bool,className:e.PropTypes.string,style:e.PropTypes.object,color:e.PropTypes.oneOf(["primary","secondary","success","warning","danger","information","neutral","gray"]),size:e.PropTypes.oneOf(["small","medium","large"])};module.exports=p;