UNPKG

@coveord/plasma-mantine

Version:

A Plasma flavoured Mantine theme

38 lines (37 loc) 1.7 kB
import { jsx as _jsx } from "react/jsx-runtime"; import { IconClipboardCheck, IconClipboardText } from '@coveord/plasma-react-icons'; import { CopyButton, TextInput, Tooltip } from '@mantine/core'; import { ActionIcon } from '../ActionIcon/ActionIcon.js'; const CopyToClipboardButton = ({ value, onCopy, color, tooltipLabelCopy = 'Copy to clipboard', tooltipLabelCopied = 'Copied', ...others })=>/*#__PURE__*/ _jsx(CopyButton, { value: value, timeout: 2000, children: ({ copied, copy })=>/*#__PURE__*/ _jsx(Tooltip, { label: copied ? tooltipLabelCopied : tooltipLabelCopy, children: /*#__PURE__*/ _jsx(ActionIcon.Quaternary, { "aria-label": tooltipLabelCopy, color: copied ? 'success' : color, onClick: (clickEvent)=>{ copy(); onCopy?.(clickEvent); }, ...others, children: copied ? /*#__PURE__*/ _jsx(IconClipboardCheck, { size: 16 }) : /*#__PURE__*/ _jsx(IconClipboardText, { size: 16 }) }) }) }); export const CopyToClipboard = ({ withLabel, ...others })=>withLabel ? /*#__PURE__*/ _jsx(TextInput, { value: others.value, readOnly: true, autoComplete: "off", rightSection: /*#__PURE__*/ _jsx(CopyToClipboardButton, { ...others }) }) : /*#__PURE__*/ _jsx(CopyToClipboardButton, { ...others }); CopyToClipboard.displayName = 'CopyToClipboard'; //# sourceMappingURL=CopyToClipboard.js.map