UNPKG

@carbon/ibm-security

Version:

Carbon for Cloud & Cognitive IBM Security UI components

55 lines (54 loc) 1.7 kB
import _extends from "@babel/runtime/helpers/extends"; import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties"; var _excluded = ["title", "children", "className", "filterData"]; /** * @file Filter panel component. * @copyright IBM Security 2020, 2021 */ import React from 'react'; import PropTypes from 'prop-types'; import classnames from 'classnames'; import LegacyFilterPanel from './LEGACY_FilterPanel'; import { getComponentNamespace } from '../../globals/namespace'; import deprecatedProp from '../../globals/prop-types'; export var namespace = getComponentNamespace('filter-panel'); var FilterPanel = function FilterPanel(props) { var title = props.title, children = props.children, className = props.className, filterData = props.filterData, other = _objectWithoutProperties(props, _excluded); if (filterData) { return /*#__PURE__*/React.createElement(LegacyFilterPanel, props); } return /*#__PURE__*/React.createElement("section", _extends({ className: classnames(namespace, className) }, other), title && /*#__PURE__*/React.createElement("h1", { className: "".concat(namespace, "__title") }, title), children); }; FilterPanel.propTypes = { /** * Filter panel content. */ children: PropTypes.node, /** * Optional class name. */ className: PropTypes.string, /** * (Deprecated) filter data object. */ filterData: deprecatedProp('children', PropTypes.object), /** * Optional title for the filter panel. */ title: PropTypes.node }; FilterPanel.defaultProps = { title: undefined, children: undefined, className: undefined, filterData: undefined }; export default FilterPanel;