UNPKG

@snowball-tech/fractal

Version:

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

3 lines 2.39 kB
'use client'; import{b as R}from"./chunk-DKS2EEQE.js";import{a as m,c as $,e as C}from"./chunk-JCJLJHAM.js";import{b as f}from"./chunk-CMFNILWJ.js";import{a as A,b as y}from"./chunk-XYM7TA65.js";import*as T from"@radix-ui/react-tabs";import{forwardRef as h}from"react";import k from"lodash/fp/isFunction";import H from"lodash/fp/omit";import{Children as b,cloneElement as x,Fragment as L,isValidElement as g}from"react";import N from"lodash/fp/isArray";import c from"lodash/fp/isEmpty";import V from"lodash/fp/isNil";import _ from"lodash/fp/isObject";function d(o,t,n,s){let e=Array.isArray(n)?n:[n],i=V(s)||c(s)?[]:Array.isArray(s)?s:[s],r=!1;return b.forEach(o,a=>{r||g(a)&&(r=(t==="*"||a.type===t)&&e.every(l=>Object.hasOwn(a.props,l)&&!!a.props[l]),!r&&a.props.children?r=d(a.props.children,t,n,s):r&&!c(i)&&(r=i.every(l=>!Object.hasOwn(a.props,l))))}),r}function w(o,t,n){let s=o;return b.count(o)===0?o:(b.count(o)===1&&g(o)&&o.type===L&&(s=o.props.children),b.map(s,e=>{if(!g(e))return e;if(!c(n)){let i=e.type;if(_(i)&&i.displayName!==n)return x(e,t(e.props))}return!c(e.props.children)&&N(e.props.children)?x(e,t(e.props),w(e.props.children,t,n)):x(e,t(e.props))}))}import{jsx as I,jsxs as S}from"react/jsx-runtime";var v=h(({children:o,defaultTab:t,disabled:n=!1,label:s,large:e=!1,onTabChange:i,orientation:r=$,tab:a,tabs:l,tabsPosition:u=C,...E},F)=>{let p=e||d(l,R,"large")||d(l,R,["icon","label"],["iconOnly"]);return S(T.Root,{ref:F,activationMode:"manual",className:y(`${f}-${m}`,`${f}-${m}--${r}`,"flex",r==="vertical"?"":"flex-col",n?`${f}-${m}--disabled`:"",E.className),...t===void 0?{}:{defaultValue:t},...a===void 0?{}:{value:a},orientation:r,...k(i)?{onValueChange:i}:{},...H(["className","defaultValue","value","onValueChange"],E),children:[u==="end"&&o,I(T.List,{"aria-label":s,className:A(`${f}-${m}__tabs`,p?`${f}-${m}__tabs--large`:"","flex w-fit items-center justify-between border-normal bg-white [z-index:1]",r==="vertical"?"h-full w-6 min-w-6 flex-col":"max-h-10 w-full",!p&&r==="horizontal"?"min-h-6":"",p&&r==="horizontal"?"min-h-10":"",u==="start"?r==="horizontal"?"border-b-1":"border-r-1":r==="horizontal"?"border-t-1":"border-l-1"),loop:!0,children:w(l,O=>({disabled:n||O.disabled,large:p||O.large,orientation:r,tabsPosition:u}),"Tab")}),u==="start"&&o]})});v.displayName="Tabs";var er=v;export{v as a,er as b}; //# sourceMappingURL=chunk-JSYGW7VV.js.map