Debian Codegraph @

node/@patternfly/react-core/dist/esm/deprecated/components/Chip/Chip.js

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