UNPKG

@talend/react-components

Version:
60 lines 1.88 kB
/* eslint-disable @typescript-eslint/no-explicit-any */ import classNames from 'classnames'; import TooltipTrigger from '../TooltipTrigger'; import { Action } from '../Actions'; import getDefaultT from '../translate'; import theme from './PlainTextTitle.module.scss'; import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime"; export function PlainTextTitle({ id, componentClass = 'span', onEdit, disabled, text, inProgress, feature, t = getDefaultT(), ...rest }) { const isDisabled = disabled || inProgress; const ComponentClass = componentClass; const dataProps = Object.keys(rest).reduce((acc, propName) => { if (propName.startsWith('data-')) { acc[propName] = rest[propName]; } return acc; }, {}); return /*#__PURE__*/_jsxs("div", { className: theme['tc-editable-text-title'], children: [/*#__PURE__*/_jsx(TooltipTrigger, { label: text, tooltipPlacement: "bottom", className: "tc-editable-text-wording-wrapper", children: /*#__PURE__*/_jsx(ComponentClass, { id: id, className: classNames(theme['tc-editable-text-wording'], 'tc-editable-text-wording'), onDoubleClick: isDisabled ? undefined : onEdit, children: text }) }), /*#__PURE__*/_jsx(Action // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore , { name: "action-edit", label: t('MODIFY_TOOLTIP', { defaultValue: 'Rename' }), icon: "talend-pencil", onClick: onEdit, bsStyle: "link", className: classNames(theme['tc-editable-text-pencil'], 'tc-editable-text-pencil', { [theme['tc-editable-text-empty-pencil']]: !text }), disabled: disabled || inProgress, hideLabel: true, "data-feature": feature, ...dataProps })] }); } //# sourceMappingURL=PlainTextTitle.component.js.map