UNPKG

@snowball-tech/fractal

Version:

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

2 lines 1.55 kB
import{a as e,i as t}from"../constants-CW2-utNH.js";import{n,r}from"../helpers-DBEwVIlX.js";import{Typography as i}from"../Typography/Typography.js";import{r as a}from"../utils-K22C_6qC.js";import{DEFAULT_COLOR as o,sizeToTypographyVariant as s}from"./Tag.constants.js";import c from"lodash/fp/isEmpty.js";import l from"lodash/fp/isString.js";import u from"lodash/fp/omit.js";import{jsx as d,jsxs as f}from"react/jsx-runtime";const p=({children:p,color:m=o,disabled:h=!1,fullWidth:g=!1,icon:_,iconPosition:v=`left`,label:y,size:b=`s`,...x})=>{let S=!!p;!S&&!y&&console.warn("You must provide a `label` or `children` to the `DropdownItem` component");let C={m:`h-[20px] w-[20px] [&>svg]:h-[20px] [&>svg]:w-[20px]`,s:`h-2 w-2 [&>svg]:h-2 [&>svg]:w-2`},w=!!_,T=w&&d(`div`,{className:n(`fractal-tag__icon`,`fractal-tag__icon--${v}`,`flex shrink-0 items-center`,C[b]),children:_}),E=l(y)?y:c(y)?a(p):a(y);return f(i,{"aria-label":E,className:r(`${e}-tag`,`${e}-tag--${m}`,`${e}-tag--${b}`,`inline-flex w-fit items-center justify-center gap-half rounded-full border-1`,{m:`px-2 py-1 leading-[20px] max-h-[38px]`,s:`px-1 py-half max-h-[28px] leading-[18px]`}[b],m===`white`?`border-grey-70`:`border-transparent`,g?`${e}-tag--full-width w-full`:``,h?`${e}-tag--disabled cursor-not-allowed bg-disabled-light text-disabled`:`${t[m]} cursor-default`,x.className),element:`div`,title:E,variant:s[b],...u([`className`],x),children:[w&&v===`left`&&T,S?p:y,w&&v===`right`&&T]})};p.displayName=`Tag`;export{p as Tag,p as default}; //# sourceMappingURL=Tag.js.map