UNPKG

react-widgets-up

Version:

An à la carte set of polished, extensible, and accessible inputs built for React

43 lines (41 loc) 1.66 kB
const _excluded = ["id", "role", "dropUp", "className", "children", "open", "transition"]; function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); } function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; } import cn from 'classnames'; import * as React from 'react'; import SlideDownTransition from './SlideDownTransition'; // import { TransitionProps } from 'react-transition-group/Transition' export const StaticContainer = /*#__PURE__*/React.memo(({ children }) => children, (_, { shouldUpdate }) => !shouldUpdate); const Popup = /*#__PURE__*/React.forwardRef((_ref, ref) => { let { id, role, dropUp, className, children, open = false, transition = SlideDownTransition } = _ref, props = _objectWithoutPropertiesLoose(_ref, _excluded); const Transition = transition; return /*#__PURE__*/React.createElement(Transition, _extends({}, props, { in: open, dropUp: dropUp // timeout={undefined! /**hack*/} , className: cn('rw-popup-container', className) }), /*#__PURE__*/React.createElement("div", { id: id, className: "rw-popup", ref: ref, role: role }, /*#__PURE__*/React.createElement(StaticContainer, { shouldUpdate: open }, children))); }); Popup.displayName = 'Popup'; export default Popup;