"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.ValueDisplayMultiSelect = ValueDisplayMultiSelect;
var _react = _interopRequireDefault(require("react"));
var _styledComponents = _interopRequireDefault(require("styled-components"));
var _ = require("../../..");
var _Select = require("../Select.styles");
var _excluded = ["label", "placeholder", "selectedCount"];
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _extends() { _extends = Object.assign ? Object.assign.bind() : 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 StyledTypography = (0, _styledComponents.default)(_.Typography).withConfig({
  displayName: "ValueDisplayMultiSelect__StyledTypography",
  componentId: "sc-1fihppj-0"
})(["display:block;margin-right:", "px;", ""], function (_ref) {
  var theme = _ref.theme;
  return theme.spacing.unit(2);
}, _Select.ellipsis);
function ValueDisplayMultiSelect(props) {
  var label = props.label,
    placeholder = props.placeholder,
    selectedCount = props.selectedCount,
    rest = _objectWithoutProperties(props, _excluded);
  if (selectedCount === 0) {
    return _react.default.createElement(StyledTypography, _extends({
      type: "secondary",
      color: function color(t) {
        return t.colorTokens.neutral.text_weak;
      }
    }, rest), placeholder);
  }
  return _react.default.createElement(_.Flexbox, _extends({
    container: true,
    alignItems: "center",
    gap: 1
  }, rest), _react.default.createElement(_.Flexbox, {
    item: true
  }, _react.default.createElement(_.Badge.Number, {
    size: 4
  }, selectedCount)), _react.default.createElement(_.Flexbox, {
    item: true
  }, _react.default.createElement(StyledTypography, {
    type: "secondary",
    color: "inherit"
  }, label)));
}