@talend/react-components
Version:
Set of react components.
47 lines • 1.46 kB
JavaScript
import PropTypes from 'prop-types';
import ColumnChooserRow from '../ColumnChooserRow';
import cssModule from '../ColumnChooser.module.scss';
import { getTheme } from '../../../../../theme';
import { jsx as _jsx } from "react/jsx-runtime";
const theme = getTheme(cssModule);
const getLabels = (checked, t) => {
return checked ? {
label: t('TC_COLUMN_CHOOSER_UNSELECT_ALL', 'Unselect all'),
description: t('CHECKBOX_DESELECT_ALL_COLUMNS_DESCRIPTION', 'hide all the columns')
} : {
label: t('TC_COLUMN_CHOOSER_SELECT_ALL', 'Select all'),
description: t('CHECKBOX_SELECT_ALL_COLUMNS_DESCRIPTION', 'display all the columns')
};
};
const SelectAllColumnsCheckbox = ({
id,
onChange,
value,
t
}) => {
const {
label,
description
} = getLabels(value, t);
return /*#__PURE__*/_jsx(ColumnChooserRow, {
className: theme('tc-column-chooser-row-select-all'),
children: /*#__PURE__*/_jsx(ColumnChooserRow.Checkbox, {
id: id,
dataFeature: "column-chooser.select.all",
description: description,
label: label,
onChange: onChange,
checked: value,
intermediate: value === undefined,
t: t
})
});
};
SelectAllColumnsCheckbox.propTypes = {
id: PropTypes.string.isRequired,
onChange: PropTypes.func.isRequired,
value: PropTypes.bool,
t: PropTypes.func.isRequired
};
export default SelectAllColumnsCheckbox;
//# sourceMappingURL=SelectAllColumnsCheckbox.component.js.map