UNPKG

fomantic-ui-react

Version:

Fomantic-UI React -- A React Component Library.

83 lines (72 loc) 3.36 kB
/** * fomantic-ui-react v0.0.1-alpha.10 * (c) 2022 FireLoong <fireloong@foxmail.com> * @license MIT */ import { _ as _defineProperty, a as _objectWithoutProperties } from '../_chunks/dep-9f1126c1.js'; import { _ as _slicedToArray } from '../_chunks/dep-dc9b74a1.js'; import classNames from 'classnames'; import React, { useState } from 'react'; import { Transition } from '../transition/index.js'; import '../transition/Transition.js'; import 'lodash'; import './style/css.js'; import '../transition/type.js'; var _excluded = ["as", "scrolling", "scrollhint", "animation", "duration", "className", "open", "onStart", "onShow", "onHide", "onComplete", "children"]; function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } var DropdownMenu = function DropdownMenu(_ref) { var _ref$as = _ref.as, as = _ref$as === void 0 ? "div" : _ref$as, scrolling = _ref.scrolling, scrollhint = _ref.scrollhint, _ref$animation = _ref.animation, animation = _ref$animation === void 0 ? "slide down" : _ref$animation, _ref$duration = _ref.duration, duration = _ref$duration === void 0 ? 200 : _ref$duration, className = _ref.className, open = _ref.open, _onStart = _ref.onStart, _onShow = _ref.onShow, _onHide = _ref.onHide, _onComplete = _ref.onComplete, children = _ref.children, props = _objectWithoutProperties(_ref, _excluded); var _useState = useState({}), _useState2 = _slicedToArray(_useState, 2), style = _useState2[0], setStyle = _useState2[1]; if (!as) { as = "div"; } return /* @__PURE__ */React.createElement(Transition, { as: as, className: classNames("menu", { scrolling: scrolling, scrollhint: scrollhint }, className), visible: open, animation: animation, duration: duration, style: _objectSpread(_objectSpread({}, style), props.style), onStart: function onStart() { setStyle({ display: "block" }); _onStart === null || _onStart === void 0 ? void 0 : _onStart(); }, onShow: function onShow() { _onShow === null || _onShow === void 0 ? void 0 : _onShow(); }, onHide: function onHide() { _onHide === null || _onHide === void 0 ? void 0 : _onHide(); }, onComplete: function onComplete() { setStyle({}); _onComplete === null || _onComplete === void 0 ? void 0 : _onComplete(); } }, children); }; DropdownMenu.displayName = "DropdownMenu"; export { DropdownMenu as default }; //# sourceMappingURL=DropdownMenu.js.map