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