UNPKG

@snowball-tech/fractal

Version:

Fractal's (Snowball's design system) React component library based on RadixUI and PandaCSS

3 lines 2.02 kB
'use client'; import{a,e as h,g as N,i as E}from"./chunk-JQDFDQL3.js";import{c as f}from"./chunk-LYTTDLE2.js";import{a as g}from"./chunk-AOLTZ2WJ.js";import{b as r}from"./chunk-CMFNILWJ.js";import{a as b,b as y}from"./chunk-XYM7TA65.js";import*as w from"@radix-ui/react-tabs";import{forwardRef as $}from"react";import _ from"lodash/fp/isEmpty";import A from"lodash/fp/isString";import O from"lodash/fp/omit";import{jsx as D,jsxs as B}from"react/jsx-runtime";var R=$(({children:o,disabled:v=!1,icon:i,iconOnly:l=!1,label:t,large:L=!1,name:I,orientation:s=h,size:m=E,tabsPosition:n=N,withIndicator:p=!0,...d},F)=>{let c=!!o;!c&&!t&&console.warn("You must provide a `label` or `children` to the `Tab` component");let u=A(t)?t:_(t)?f(o):f(t),P=!!i,T=v,S=L||P&&!l&&!_(t),e="after:left-1/2 after:h-quarter after:w-0 after:-translate-x-1/2 after:transition-[width] ";e+=n==="start"?"after:-bottom-px":"after:-top-px";let x="aria-selected:after:w-3/4";return s==="vertical"&&(e="after:top-1/2 after:w-quarter after:h-0 after:-translate-y-1/2 after:transition-[height] ",e+=n==="start"?"after:-right-px":"after:-left-px",x="aria-selected:after:h-3/4"),D(w.Trigger,{ref:F,"aria-label":u,className:y(`${r}-${a}__tab`,"cursor-pointer border-0 bg-[unset] px-0 py-0 text-left","relative h-full flex-1 self-end text-center text-grey-30",S?`${r}-${a}__tab--large min-h-10`:"min-h-6","after:absolute after:block after:bg-primary after:duration-300 after:content-empty",p?e:"","aria-selected:text-secondary",p?x:"",T?`${r}-${a}__tab--disabled cursor-not-allowed text-grey-70`:"hover:text-secondary",s==="vertical"?"w-full px-3":"h-full",d.className),disabled:T,title:u,value:I,...O(["className","value"],d),children:B(g,{className:b("flex h-full items-center justify-center gap-1 p-1",s==="horizontal"?"flex-col":""),element:"div",variant:m==="large"?"body-1-median":m==="medium"?"body-2-median":"caption-median",children:[i,!l&&(c?o:t)]})})});R.displayName="Tab";var Z=R;export{R as a,Z as b}; //# sourceMappingURL=chunk-E3QGM2SJ.js.map