"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
exports.__esModule = true;
exports.TableBulkSelectionCheckbox = void 0;
var _BulkSelectionConsumer = require("../BulkSelection/BulkSelectionConsumer");
var _react = _interopRequireDefault(require("react"));
var _BulkSelection = require("../BulkSelection");
var _Checkbox = _interopRequireDefault(require("../../Checkbox/Checkbox"));
var _jsxFileName = "/home/builduser/work/57e038ea7326c1ec/packages/wix-design-system/dist/cjs/Table/components/TableBulkSelectionCheckbox.jsx",
  _this = void 0;
var TableBulkSelectionCheckbox = exports.TableBulkSelectionCheckbox = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref) {
  var dataHook = _ref.dataHook,
    children = _ref.children;
  return /*#__PURE__*/_react["default"].createElement(_BulkSelectionConsumer.BulkSelectionConsumer, {
    consumerCompName: "Table.BulkSelectionCheckbox",
    providerCompName: "Table",
    __self: _this,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 9,
      columnNumber: 7
    }
  }, function (_ref2) {
    var bulkSelectionState = _ref2.bulkSelectionState,
      toggleAll = _ref2.toggleAll,
      selectionDisabled = _ref2.selectionDisabled,
      deselectRowsByDefault = _ref2.deselectRowsByDefault;
    return /*#__PURE__*/_react["default"].createElement(_Checkbox["default"], {
      ref: ref,
      dataHook: dataHook,
      checked: bulkSelectionState === _BulkSelection.BulkSelectionState.ALL,
      indeterminate: bulkSelectionState === _BulkSelection.BulkSelectionState.SOME,
      disabled: selectionDisabled === true,
      onChange: function onChange() {
        return toggleAll(deselectRowsByDefault, 'TableBulkSelectionCheckbox');
      },
      __self: _this,
      __source: {
        fileName: _jsxFileName,
        lineNumber: 19,
        columnNumber: 11
      }
    }, children);
  });
});