"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
exports.__esModule = true;
exports.SelectAllCheckbox = void 0;
var _designSystem = require("@wix/design-system");
var _react = _interopRequireDefault(require("react"));
var _mobxReactLite = require("mobx-react-lite");
var _jsxFileName = "/home/builduser/work/843658b9f44192f0/packages/cairo/dist/cjs/components/PickerContent/SelectAllCheckbox.tsx";
function _SelectAllCheckbox(props) {
  const {
    state
  } = props;
  const {
    toggleIsSelectAll,
    picker: {
      collection: {
        result: {
          isEmptyAndNotFetching
        },
        query: {
          hasActiveFilters
        },
        bulkSelect: {
          selectedCountOrTotal,
          select: {
            isNotEmptyEnabledItems: hasEnabledCheckedItems
          },
          allSelected,
          hasUnchecked,
          collection: {
            result: {
              total
            }
          }
        },
        translate: t
      }
    }
  } = state;
  return /*#__PURE__*/_react.default.createElement(_designSystem.Checkbox, {
    dataHook: "picker-select-all-checkbox",
    checked: allSelected,
    disabled: hasActiveFilters || isEmptyAndNotFetching,
    onChange: toggleIsSelectAll,
    indeterminate: hasEnabledCheckedItems && (!allSelected || hasUnchecked),
    __self: this,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 35,
      columnNumber: 5
    }
  }, hasEnabledCheckedItems ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, t('cairo.deselectAll'), !hasActiveFilters && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, " (", selectedCountOrTotal, ")")) : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, t('cairo.selectAll'), !hasActiveFilters && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, " (", total, ")")));
}
const SelectAllCheckbox = exports.SelectAllCheckbox = (0, _mobxReactLite.observer)(_SelectAllCheckbox);
//# sourceMappingURL=SelectAllCheckbox.js.map