UNPKG

@payfit/unity-components

Version:

36 lines (35 loc) 1.16 kB
import { CircularIconButton as e } from "../icon-button/CircularIconButton.js"; import { copyToClipboard as t } from "./copyToClipboard.js"; import { forwardRef as n } from "react"; import { uyTv as r } from "@payfit/unity-themes"; import { jsx as i, jsxs as a } from "react/jsx-runtime"; import { useIntl as o } from "react-intl"; //#region src/components/code/Code.tsx var s = r({ slots: { base: ["uy:group uy:flex uy:p-100 uy:self-stretch uy:content-end uy:gap-100 uy:font-mono uy:rounded-100 uy:border uy:border-solid uy:border-border-neutral uy:bg-surface-neutral-lowest"], pre: "uy:grow uy:text-wrap" } }), c = n(({ children: n, ...r }, c) => { let l = o(), { base: u, pre: d } = s(), f = () => { t(n); }; return /* @__PURE__ */ a("code", { ref: c, "data-dd-privacy": "allow", className: u(), ...r, children: [/* @__PURE__ */ i("pre", { className: d(), children: n }), /* @__PURE__ */ i(e, { title: l.formatMessage({ id: "unity:command:code:icon:title", defaultMessage: "Copy to clipboard" }), icon: "ClipboardOutlined", onClick: f })] }); }); c.displayName = "Code"; //#endregion export { c as Code };