UNPKG

@lunit/oui

Version:

Lunit Oncology UI components

26 lines (25 loc) 921 B
import { jsx as _jsx } from "react/jsx-runtime"; import { CloseSmall } from '../../icons'; import StyledChip from './Chip.styled'; import { presetMap } from './Chip.utils'; function Chip({ preset, label, icon, onDelete, onClick, ...otherProps }) { // eslint-disable-next-line @typescript-eslint/no-explicit-any const overwrittenProps = { label, icon, onDelete, onClick, }; // Remove undefined properties Object.keys(overwrittenProps).forEach((key) => overwrittenProps[key] === undefined ? delete overwrittenProps[key] : {}); const newPreset = preset?.includes('failed') ? 'failed' : preset; const customProps = { disableRipple: true, deleteIcon: _jsx(CloseSmall, {}), ...presetMap[newPreset || 'default'], ...overwrittenProps, ...otherProps, }; return _jsx(StyledChip, { ...customProps }); } export default Chip;