UNPKG

@snowball-tech/fractal

Version:

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

3 lines 1.87 kB
'use client'; import{a as E}from"./chunk-RKZN6FZX.js";import{a as h}from"./chunk-Q4YA32NC.js";import{a as t}from"./chunk-3CV5UMCN.js";import{c as d}from"./chunk-LYTTDLE2.js";import{a as g}from"./chunk-AOLTZ2WJ.js";import{b as o}from"./chunk-CMFNILWJ.js";import{a as w,b as _}from"./chunk-XYM7TA65.js";import{forwardRef as S,useContext as $}from"react";import k from"lodash/fp/isEmpty";import i from"lodash/fp/isFunction";import U from"lodash/fp/isString";import X from"lodash/fp/omit";import{jsx as Y,jsxs as j}from"react/jsx-runtime";var v=S(({active:p=!1,children:m,condensed:C=!1,disabled:I,href:l,icon:s,label:e,onActivate:r,onClick:u,onKeyDown:f,rainbow:R=!0,target:T,...c},D)=>{let y=!!m;!y&&!e&&console.warn("You must provide a `label` or `children` to the `MenuItem` component");let{condensed:N,disabled:L,rainbow:P}=$(h),{condensed:F,disabled:H,rainbow:K}=$(E),b=I||L||H,G=C||N||F,x=R&&K&&P,a=!k(l),B=n=>{i(u)&&u(n),i(r)&&r()},O=n=>{i(f)&&f(n),(n.key==="Enter"||n.key===" ")&&i(r)&&r()},M=U(e)?e:k(e)?d(m):d(e);return j(g,{ref:D,"aria-label":M,className:_(`${o}-${t}__item`,x?"alternatee":"","flex flex-row items-center gap-1 text-nowrap","rounded-sm outline-none transition-background-color duration-300 ease-out",G?"max-h-6 px-2 py-1":"p-2",s?`${o}-${t}--with-icon`:"",b?`${o}-${t}__item--disabled pointer-events-none cursor-not-allowed !bg-transparent text-disabled`:"cursor-pointer text-dark",!b&&!x?"hover:bg-decorative-pink-90":"",a?`${o}-${t}__item__link no-underline`:"",c.className),element:a?"a":"div",role:"menuitem",tabIndex:-1,title:M,onClick:B,onKeyDown:O,...p?{"data-highlighted":p}:{},...a?{href:l,target:T}:{},...X(["className","data-value"],c),children:[s&&Y("div",{className:w(`${o}-${t}__item__icon`,"max-h-3 max-w-3"),children:s}),y?m:e]})});v.displayName="MenuItem";var re=v;export{v as a,re as b}; //# sourceMappingURL=chunk-UWF4A3O5.js.map