@snowball-tech/fractal
Version:
Fractal's (Snowball's design system) React component library based on RadixUI and TailwindCSS
2 lines • 1.25 kB
JavaScript
import{LIGHT_BG_COLORS_CLASSNAMES as e,PREFIX as t}from"../../constants.js";import{cn as n}from"../../styles/helpers.js";import r from"../Typography/Typography.js";import{onlyText as i}from"../../utils.js";import{DEFAULT_COLOR as a,sizeToTypographyVariant as o}from"./Tag.constants.js";import s from"lodash/fp/isEmpty.js";import c from"lodash/fp/isString.js";import l from"lodash/fp/omit.js";import{jsx as u}from"react/jsx-runtime";const d=({children:d,color:f=a,disabled:p=!1,fullWidth:m=!1,label:h,size:g=`s`,..._})=>{let v=!!d;!v&&!h&&console.warn("You must provide a `label` or `children` to the `DropdownItem` component");let y=c(h)?h:s(h)?i(d):i(h);return u(r,{"aria-label":y,className:n(`${t}-tag`,`${t}-tag--${f}`,`${t}-tag--${g}`,`inline-flex w-fit items-center justify-center rounded-full border-1`,{m:`px-2 py-1 leading-[20px] max-h-[38px]`,s:`px-1 py-half max-h-[28px] leading-[18px]`}[g],f===`white`?`border-grey-70`:`border-transparent`,m?`${t}-tag--full-width w-full`:``,p?`${t}-tag--disabled cursor-not-allowed bg-disabled-light text-disabled`:`${e[f]} cursor-default`,_.className),element:`div`,title:y,variant:o[g],...l([`className`],_),children:v?d:h})};d.displayName=`Tag`;export{d as default};
//# sourceMappingURL=Tag.js.map