Liferay.Loader.define("app-builder-web@1.0.73/js/components/management-toolbar/DropDown.es", ['module', 'exports', 'require', '@frontend-taglib-clay$clayui/drop-down', '@frontend-taglib-clay$clayui/form', 'frontend-js-react-web$react'], function (module, exports, require) {
  var define = undefined;
  var global = window;
  {
    Object.defineProperty(exports, "__esModule", {
      value: true
    });
    exports.default = exports.RadioGroup = exports.ItemsGroup = exports.CheckboxGroup = void 0;

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

    var _form = require("@frontend-taglib-clay$clayui/form");

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

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

    function _extends() {
      _extends = Object.assign || function (target) {
        for (var i = 1; i < arguments.length; i++) {
          var source = arguments[i];for (var key in source) {
            if (Object.prototype.hasOwnProperty.call(source, key)) {
              target[key] = source[key];
            }
          }
        }return target;
      };return _extends.apply(this, arguments);
    }

    function _objectWithoutProperties(source, excluded) {
      if (source == null) return {};var target = _objectWithoutPropertiesLoose(source, excluded);var key, i;if (Object.getOwnPropertySymbols) {
        var sourceSymbolKeys = Object.getOwnPropertySymbols(source);for (i = 0; i < sourceSymbolKeys.length; i++) {
          key = sourceSymbolKeys[i];if (excluded.indexOf(key) >= 0) continue;if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;target[key] = source[key];
        }
      }return target;
    }

    function _objectWithoutPropertiesLoose(source, excluded) {
      if (source == null) return {};var target = {};var sourceKeys = Object.keys(source);var key, i;for (i = 0; i < sourceKeys.length; i++) {
        key = sourceKeys[i];if (excluded.indexOf(key) >= 0) continue;target[key] = source[key];
      }return target;
    }

    var CheckboxGroup = function CheckboxGroup(_ref) {
      var _ref$checked = _ref.checked,
          checked = _ref$checked === void 0 ? [] : _ref$checked,
          _ref$items = _ref.items,
          items = _ref$items === void 0 ? [] : _ref$items,
          label = _ref.label,
          onAdd = _ref.onAdd,
          onRemove = _ref.onRemove;
      return (/*#__PURE__*/_react.default.createElement(_dropDown.default.Group, {
          header: label
        }, /*#__PURE__*/_react.default.createElement(_dropDown.default.ItemList, null, items.map(function (_ref2, index) {
          var value = _ref2.value,
              item = _objectWithoutProperties(_ref2, ["value"]);

          return (/*#__PURE__*/_react.default.createElement(_dropDown.default.Section, {
              key: index
            }, /*#__PURE__*/_react.default.createElement(_form.ClayCheckbox, _extends({}, item, {
              checked: checked.includes(value),
              onChange: function onChange(_ref3) {
                var checked = _ref3.target.checked;
                return checked ? onAdd(value) : onRemove(value);
              },
              value: value
            })))
          );
        })))
      );
    };

    exports.CheckboxGroup = CheckboxGroup;

    var ItemsGroup = function ItemsGroup(_ref4) {
      var checked = _ref4.checked,
          _ref4$items = _ref4.items,
          items = _ref4$items === void 0 ? [] : _ref4$items,
          label = _ref4.label,
          _onClick = _ref4.onClick;
      return (/*#__PURE__*/_react.default.createElement(_dropDown.default.Group, {
          header: label
        }, /*#__PURE__*/_react.default.createElement(_dropDown.default.ItemList, null, items.map(function (_ref5, index) {
          var label = _ref5.label,
              value = _ref5.value;
          return (/*#__PURE__*/_react.default.createElement(_dropDown.default.Item, {
              active: checked === value,
              href: "",
              key: index,
              onClick: function onClick() {
                return _onClick(value);
              },
              value: value
            }, label)
          );
        })))
      );
    };

    exports.ItemsGroup = ItemsGroup;

    var RadioGroup = function RadioGroup(_ref6) {
      var checked = _ref6.checked,
          _ref6$items = _ref6.items,
          items = _ref6$items === void 0 ? [] : _ref6$items,
          label = _ref6.label,
          _onChange = _ref6.onChange;
      return (/*#__PURE__*/_react.default.createElement(_dropDown.default.Group, {
          header: label
        }, /*#__PURE__*/_react.default.createElement(_dropDown.default.ItemList, null, items.map(function (_ref7, index) {
          var value = _ref7.value,
              item = _objectWithoutProperties(_ref7, ["value"]);

          return (/*#__PURE__*/_react.default.createElement(_dropDown.default.Section, {
              key: index
            }, /*#__PURE__*/_react.default.createElement(_form.ClayRadio, _extends({}, item, {
              checked: checked === value,
              onChange: function onChange() {
                return _onChange(value);
              },
              value: value
            })))
          );
        })))
      );
    };

    exports.RadioGroup = RadioGroup;

    var _default = function _default(_ref8) {
      var children = _ref8.children,
          footerContent = _ref8.footerContent,
          otherProps = _objectWithoutProperties(_ref8, ["children", "footerContent"]);

      return (/*#__PURE__*/_react.default.createElement(_dropDown.default, otherProps, /*#__PURE__*/_react.default.createElement(_dropDown.default.ItemList, {
          className: "dropdown-fixed-height inline-scroller"
        }, children), footerContent && /*#__PURE__*/_react.default.createElement("div", {
          className: "dropdown-footer dropdown-section pt-3"
        }, footerContent))
      );
    };

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