UNPKG

@lanaco/lnc-react-ui

Version:

React component library

11 lines (10 loc) 1.61 kB
"use strict";const n=require("react/jsx-runtime"),l=require("react"),i=require("./floating-ui.react.esm-CsrI9PVk.cjs"),g=require("./PopoverContext.cjs"),p=require("./emotion-styled.browser.esm-DwHBgTPn.cjs"),s=require("./utils-BK6B_Y9X.cjs"),x=require("./motion-B_VPZaJq.cjs"),h=require("./emotion-element-f0de968e.browser.esm-B7k6i6lC.cjs"),f=p.styled(x.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=>s.getComponentPropValue(e.theme,"Popover",e.color,"enabled","boxShadow")}; border-radius: ${e=>s.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=>s.getColorRgbaValue(e.theme,"Popover","default","enabled","bg")}; `,y=()=>{const e=l.useContext(g);if(e==null)throw new Error("Popover components must be wrapped in <Popover />");return e},v=l.forwardRef(function({borderRadius:t="regular",className:r="",zIndex:c,style:d={},...a},u){const o=y(),m=i.useMergeRefs([o.floating,u]),b=h.useTheme();return n.jsx(i.FloatingPortal,{children:o.open&&n.jsx(i.FloatingFocusManager,{context:o.context,modal:o.modal,children:n.jsx("div",{ref:m,style:{position:o.strategy,top:o.y??0,left:o.x??0,width:"max-content",zIndex:c},className:"lnc-ui-floating-manager","aria-labelledby":o.labelId,"aria-describedby":o.descriptionId,...o.getFloatingProps(a),children:n.jsx(f,{theme:b,borderRadius:t,className:"lnc-ui-popover-content "+r,style:d,children:a.children})})})})});module.exports=v;