UNPKG

@snowball-tech/fractal

Version:

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

2 lines 1.68 kB
"use client";import{a as e}from"../constants-CW2-utNH.js";import{r as t,t as n}from"../helpers-DBEwVIlX.js";import{Typography as r}from"../Typography/Typography.js";import{ELEVATIONS as i}from"../Paper/Paper.constants.js";import{DEFAULT_ELEVATION as a,DEFAULT_ORIENTATION as o,GROUP_NAME as s}from"./Menu.constants.js";import{MenuContext as c}from"./MenuContext.js";import{forwardRef as l,useImperativeHandle as u,useRef as d}from"react";import f from"lodash/fp/omit.js";import{jsx as p}from"react/jsx-runtime";import m from"lodash/fp/isNumber.js";const h=l(({children:l,condensed:h=!1,disabled:g=!1,elevation:_=a,embedded:v=!1,fullWidth:y=!1,menu:b={},orientation:x=o,rainbow:S=!0,...C},w)=>{let T=d(null),E=d(null);u(w,()=>({get container(){return T?.current??null},get menu(){return E?.current??null}}));let D=!!l,O=i[m(_)?String(_):_];return Object.keys(i).includes(O)||(O=a),p(`div`,{ref:T,className:t(`${e}-${s}`,`${e}-${s}--${O}`,g?`${e}-${s}--disabled`:``,y?`${e}-${s}--full-width`:`sm:w-fit`,`pointer-events-auto relative z-50`,v?``:`rounded-sm border-1 border-normal bg-white p-1`,D?``:`${e}-${s}__menu--empty invisible`,v?``:{0:`rounded-sm shadow-none border-none`,light:`rounded-sm shadow-none border-grey-70`,1:`rounded-sm shadow-none`,2:`rounded-sm shadow-subtle ml-quarter`,3:`rounded-sm shadow-brutal ml-quarter`}[O],C.className),...f([`className`],C),children:p(`div`,{ref:E,"aria-orientation":x,role:`menu`,...b,children:p(c.Provider,{value:{condensed:h,disabled:g,orientation:x,rainbow:S},children:p(r,{className:S?n:``,element:`div`,variant:`body-1`,children:l})})})})});h.displayName=`Menu`;export{h as Menu,h as default}; //# sourceMappingURL=Menu.js.map