UNPKG

@snowball-tech/fractal

Version:

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

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