UNPKG

@snowball-tech/fractal

Version:

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

2 lines 1.08 kB
import{PREFIX as e}from"../../constants.js";import{cn as t}from"../../styles/helpers.js";import n from"../Typography/Typography.js";import{onlyText as r}from"../../utils.js";import{GROUP_NAME as i}from"./Badge.constants.js";import a from"lodash/fp/isEmpty.js";import o from"lodash/fp/omit.js";import s from"lodash/fp/isNil.js";import{jsx as c}from"react/jsx-runtime";import l from"lodash/fp/isNumber.js";import u from"lodash/fp/isInteger.js";const d=({children:d,count:f,label:p,limit:m=99,...h})=>{let g=l(f)&&u(f)?`${f}`:``;l(m)&&m>0&&!a(g)&&(f??0)>m&&(g=`+${m}`);let _=p||r(d)||g;return c(n,{"aria-label":_,className:t(`${e}-${i}`,`inline-flex shrink-0 items-center justify-center rounded-full bg-primary`,(s(f)||!l(f)||!u(f))&&!d?`${e}-${i}--empty h-2 max-h-2 min-h-2 w-2 min-w-2 max-w-2 p-0`:`h-3 max-h-3 w-fit min-w-3`,d?`${e}-${i}--with-children p-1`:u(f)?`${e}-${i}--with-count px-half py-0`:``,h.className),element:`div`,title:_,variant:`caption-bold`,...o([`className`],h),children:d??g})};d.displayName=`Badge`;export{d as default}; //# sourceMappingURL=Badge.js.map