UNPKG

@talend/react-faceted-search

Version:
59 lines (58 loc) 1.59 kB
import PropTypes from 'prop-types'; import { ButtonTertiary } from '@talend/design-system'; import { operatorsPropTypes } from '../../facetedSearch.propTypes'; import styles from './BadgeOperator.module.scss'; import { jsx as _jsx } from "react/jsx-runtime"; const BadgeOperatorRow = ({ onClick, id, name, label, iconName }) => { const onClickOperatorRow = event => { onClick(event, name); }; if (iconName) { return /*#__PURE__*/_jsx(ButtonTertiary, { id: `${id}-operator-row-button-${name}`, icon: `talend-${iconName}`, onClick: onClickOperatorRow, children: label }); } return /*#__PURE__*/_jsx(ButtonTertiary, { id: `${id}-operator-row-button-${name}`, onClick: onClickOperatorRow, children: label }); }; BadgeOperatorRow.propTypes = { onClick: PropTypes.func.isRequired, id: PropTypes.string, name: PropTypes.string, label: PropTypes.string, iconName: PropTypes.string }; const BadgeOperatorPopover = ({ id, operators, onClick }) => { return /*#__PURE__*/_jsx("div", { className: styles['tc-badge-operator-popover'], children: operators.map(operator => /*#__PURE__*/_jsx(BadgeOperatorRow, { id: id, onClick: onClick, ...operator }, `${id}-${operator.name}`)) }); }; BadgeOperatorPopover.propTypes = { id: PropTypes.string.isRequired, operators: operatorsPropTypes.isRequired, onClick: PropTypes.func.isRequired }; // eslint-disable-next-line import/prefer-default-export export { BadgeOperatorPopover }; //# sourceMappingURL=BadgeOperatorPopover.component.js.map