import _slicedToArray from"@babel/runtime/helpers/slicedToArray";import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["className","anchorRef","openAtom","direction","spareDirection","possibleDirections"];import"./FlatSelectRoot.css";import{useAtom}from"@reatom/npm-react";import React,{forwardRef,useRef}from"react";import{Transition}from"react-transition-group";import{Popover}from"../../Popover";import{useForkRef}from"../../../hooks/useForkRef";import{animateTimeout,cnMixPopoverAnimate}from"../../../mixs/MixPopoverAnimate";import{cn}from"../../../utils/bem";export var cnFlatSelectRoot=cn("FlatSelectRoot");export var FlatSelectRoot=forwardRef(function(a,b){var c=a.className,d=a.anchorRef,e=a.openAtom,f=a.direction,g=void 0===f?"downStartLeft":f,h=a.spareDirection,i=void 0===h?"downStartLeft":h,j=a.possibleDirections,k=void 0===j?["downStartLeft","downStartRight","upStartLeft","upStartRight","leftStartDown","leftStartUp"]:j,l=_objectWithoutProperties(a,_excluded),m=useRef(null),n=useForkRef([m,b]),o=!!d,p=useAtom(e),q=_slicedToArray(p,1),r=q[0];return o?React.createElement(Transition,{in:r,unmountOnExit:!0,timeout:animateTimeout,nodeRef:m},function(a){return React.createElement(Popover,Object.assign({},l,{className:cnFlatSelectRoot({withAnchor:o},[c,cnMixPopoverAnimate({animate:a})]),ref:n,anchorRef:d,equalAnchorWidth:!0,offset:"2xs",direction:g,spareDirection:i,possibleDirections:k}))}):React.createElement("div",Object.assign({},l,{className:cnFlatSelectRoot(null,[c]),ref:b}))});
//# sourceMappingURL=FlatSelectRoot.js.map