@lanaco/lnc-react-ui
Version:
React component library
11 lines (10 loc) • 1.74 kB
JavaScript
"use strict";const n=require("react/jsx-runtime"),c=require("react"),s=require("./floating-ui.react.esm-7Yt4LHw6.cjs"),i=require("./index-BPVoEhTF.cjs"),x=require("./PopoverContext.cjs"),h=require("./emotion-styled.browser.esm-Cle7tAM9.cjs"),a=require("./utils-NZLCh-J5.cjs"),y=require("./motion-B_VPZaJq.cjs"),f=require("./emotion-element-f0de968e.browser.esm-B7k6i6lC.cjs"),P=h.newStyled(y.motion.div)`
font-family: ${e=>{var t,r;return(r=(t=e.theme)==null?void 0:t.typography)==null?void 0:r.fontFamily}};
animation: fadeIn 0.4s;
box-shadow: ${e=>a.getComponentPropValue(e.theme,"Popover",e.color,"enabled","boxShadow")};
border-radius: ${e=>a.getBorderRadiusValueWithUnits(e.theme,e.borderRadius)};
border-top: 1px solid rgba(0, 0, 0, 0.04);
box-sizing: border-box;
padding: 0.25rem;
background-color: ${e=>a.getColorRgbaValue(e.theme,"Popover","default","enabled","bg")};
`,v=()=>{const e=c.useContext(x);if(e==null)throw new Error("Popover components must be wrapped in <Popover />");return e},d=c.forwardRef(function({borderRadius:t="regular",className:r="",zIndex:u,style:m={},...l},p){const o=v(),b=s.useMergeRefs([o.floating,p]),g=f.useTheme();return n.jsx(s.FloatingPortal,{children:o.open&&n.jsx(s.FloatingFocusManager,{context:o.context,modal:o.modal,children:n.jsx("div",{ref:b,style:{position:o.strategy,top:o.y??0,left:o.x??0,width:"max-content",zIndex:u},className:"lnc-ui-floating-manager","aria-labelledby":o.labelId,"aria-describedby":o.descriptionId,...o.getFloatingProps(l),children:n.jsx(P,{theme:g,borderRadius:t,className:"lnc-ui-popover-content "+r,style:m,children:l.children})})})})});d.propTypes={className:i.PropTypes.string,style:i.PropTypes.object,zIndex:i.PropTypes.number};module.exports=d;