| 1 |
"use strict"; |
| 2 |
Object.defineProperty(exports, "__esModule", { value: true }); |
| 3 |
exports.Chip = void 0; |
| 4 |
const tslib_1 = require("tslib"); |
| 5 |
const jsx_runtime_1 = require("react/jsx-runtime"); |
| 6 |
const react_1 = require("react"); |
| 7 |
const Label_1 = require("../../../components/Label"); |
| 8 |
const helpers_1 = require("../../../helpers"); |
| 9 |
const SSRSafeIds_1 = require("../../../helpers/SSRSafeIds/SSRSafeIds"); |
| 10 |
class Chip extends react_1.Component { |
| 11 |
constructor(props) { |
| 12 |
super(props); |
| 13 |
} |
| 14 |
render() { |
| 15 |
const _a = this.props, { isOverflowChip, children, badge, onClick, className, textMaxWidth, isReadOnly, closeBtnAriaLabel, tooltipPosition, ouiaId, |
| 16 |
// eslint-disable-next-line @typescript-eslint/no-unused-vars |
| 17 |
component } = _a, props = tslib_1.__rest(_a, ["isOverflowChip", "children", "badge", "onClick", "className", "textMaxWidth", "isReadOnly", "closeBtnAriaLabel", "tooltipPosition", "ouiaId", "component"]); |
| 18 |
return ((0, jsx_runtime_1.jsx)(SSRSafeIds_1.SSRSafeIds, { prefix: "pf-", ouiaComponentType: Chip.displayName, children: (_, generatedOuiaId) => ((0, jsx_runtime_1.jsxs)(Label_1.Label, Object.assign({ variant: "outline", className: className, textMaxWidth: textMaxWidth, tooltipPosition: tooltipPosition }, (!isReadOnly && |
| 19 |
!isOverflowChip && { |
| 20 |
onClose: onClick, |
| 21 |
closeBtnAriaLabel: closeBtnAriaLabel ? closeBtnAriaLabel : `Close ${children}` |
| 22 |
}), (isOverflowChip && { onClick, variant: 'overflow' }), (0, helpers_1.getOUIAProps)(isOverflowChip ? 'OverflowChip' : Chip.displayName, ouiaId !== undefined ? ouiaId : generatedOuiaId), props, { children: [children, badge && (0, jsx_runtime_1.jsxs)(react_1.Fragment, { children: [" ", badge] })] }))) })); |
| 23 |
} |
| 24 |
} |
| 25 |
exports.Chip = Chip; |
| 26 |
Chip.displayName = 'Chip'; |
| 27 |
Chip.defaultProps = { |
| 28 |
className: '', |
| 29 |
isOverflowChip: false, |
| 30 |
isReadOnly: false, |
| 31 |
tooltipPosition: 'top', |
| 32 |
onClick: (_e) => undefined, |
| 33 |
textMaxWidth: '16ch' |
| 34 |
}; |
| 35 |
//# sourceMappingURL=Chip.js.map |