UNPKG

@carbon/ibm-security

Version:

Carbon for Cloud & Cognitive IBM Security UI components

45 lines (43 loc) 1.29 kB
import _defineProperty from "@babel/runtime/helpers/defineProperty"; /** * @file Pill. * @copyright IBM Security 2019 */ import PropTypes from 'prop-types'; import classnames from 'classnames'; import React from 'react'; import { Decorator } from '../DataDecorator'; import { getComponentNamespace } from '../../globals/namespace/index'; export var namespace = getComponentNamespace('pill'); /** * Pill component. */ var Pill = function Pill(_ref) { var className = _ref.className, inline = _ref.inline, type = _ref.type, value = _ref.value; var classes = classnames(className, namespace, _defineProperty({}, "".concat(namespace, "--inline"), inline)); return /*#__PURE__*/React.createElement(Decorator, { className: classes, inline: inline, noIcon: true, type: type, value: value }); }; Pill.propTypes = { /** @type {string} Extra classes to add. */ className: PropTypes.string, /** @type {boolean} Whether the Pill should be treated and styled as an inline element. */ inline: PropTypes.bool, /** @type {string} The type of data. */ type: PropTypes.string.isRequired, /** @type {string} The value of the data. */ value: PropTypes.string.isRequired }; Pill.defaultProps = { className: '', inline: false }; export default Pill;