wix-style-react
Version:
26 lines • 1.15 kB
JavaScript
import { BulkSelectionConsumer } from '../BulkSelection/BulkSelectionConsumer';
import React from 'react';
import { BulkSelectionState } from '../BulkSelection';
import Checkbox from '../../Checkbox/Checkbox';
export var TableBulkSelectionCheckbox = function TableBulkSelectionCheckbox(_ref) {
var dataHook = _ref.dataHook,
children = _ref.children;
return /*#__PURE__*/React.createElement(BulkSelectionConsumer, {
consumerCompName: "Table.BulkSelectionCheckbox",
providerCompName: "Table"
}, function (_ref2) {
var bulkSelectionState = _ref2.bulkSelectionState,
toggleAll = _ref2.toggleAll,
selectionDisabled = _ref2.selectionDisabled,
deselectRowsByDefault = _ref2.deselectRowsByDefault;
return /*#__PURE__*/React.createElement(Checkbox, {
dataHook: dataHook,
checked: bulkSelectionState === BulkSelectionState.ALL,
indeterminate: bulkSelectionState === BulkSelectionState.SOME,
disabled: selectionDisabled === true,
onChange: function onChange() {
return toggleAll(deselectRowsByDefault, 'TableBulkSelectionCheckbox');
}
}, children);
});
};