"use strict";

Liferay.Loader.define("@frontend-taglib-clay$clayui/autocomplete@3.58.0/lib/DropDown", ['module', 'exports', 'require', '@frontend-taglib-clay$clayui/drop-down', 'frontend-js-react-web$react', './Context'], function (module, exports, require) {
  var define = undefined;
  var global = window;
  {
    Object.defineProperty(exports, "__esModule", {
      value: true
    });
    exports.default = void 0;

    var _dropDown = _interopRequireDefault(require("@frontend-taglib-clay$clayui/drop-down"));

    var _react = _interopRequireDefault(require("frontend-js-react-web$react"));

    var _Context = _interopRequireDefault(require("./Context"));

    function _interopRequireDefault(obj) {
      return obj && obj.__esModule ? obj : { default: obj };
    }

    /**
     * SPDX-FileCopyrightText: © 2019 Liferay, Inc. <https://liferay.com>
     * SPDX-License-Identifier: BSD-3-Clause
     */
    var ClayAutocompleteDropDown = function ClayAutocompleteDropDown(_ref) {
      var _ref$active = _ref.active,
          active = _ref$active === void 0 ? false : _ref$active,
          alignElementRef = _ref.alignElementRef,
          children = _ref.children,
          closeOnClickOutside = _ref.closeOnClickOutside,
          _ref$onSetActive = _ref.onSetActive,
          onSetActive = _ref$onSetActive === void 0 ? function () {} : _ref$onSetActive;

      var _React$useContext = _react.default.useContext(_Context.default),
          containerElementRef = _React$useContext.containerElementRef;

      var menuElementRef = _react.default.useRef(null);

      if (!alignElementRef) {
        alignElementRef = containerElementRef;
      }

      var alignElementWidth = alignElementRef.current && alignElementRef.current.clientWidth;
      return (/*#__PURE__*/_react.default.createElement(_dropDown.default.Menu, {
          active: active,
          alignElementRef: alignElementRef,
          autoBestAlign: false,
          className: "autocomplete-dropdown-menu",
          closeOnClickOutside: closeOnClickOutside,
          onSetActive: onSetActive,
          ref: menuElementRef,
          style: {
            maxWidth: 'none',
            width: "".concat(alignElementWidth, "px")
          }
        }, children)
      );
    };

    var _default = ClayAutocompleteDropDown;
    exports.default = _default;
  }
});
//# sourceMappingURL=DropDown.js.map