import { jsx, jsxs } from "react/jsx-runtime";
import { IconCopy01 } from "../../icons/index.mjs";
/* empty css                                                                                                                                                                                       */
/* empty css                                                                                                                                                                                        */
/* empty css                                                                                                                                                                                                */
/* empty css                                                                                                                                                                                           */
/* empty css                                                                                                                                                                                           */
import { Typography } from "../../primitive/Typography/index.mjs";
import { CopyButton } from "../../primitive/CopyButton/CopyButton.mjs";
import "clsx";
import { mergeSxList } from "../../utils/styles.mjs";
import { Box } from "../../node_modules/.pnpm/@mantine_core@7.15.2_patch_hash_jclkxeaefn6uz54h34k3r3yjsq_@mantine_hooks@7.15.2_react@18.3.1_szqfuioo5damkjdixckhzmwycq/node_modules/@mantine/core/esm/core/Box/Box.mjs";
import { Tooltip } from "../../node_modules/.pnpm/@mantine_core@7.15.2_patch_hash_jclkxeaefn6uz54h34k3r3yjsq_@mantine_hooks@7.15.2_react@18.3.1_szqfuioo5damkjdixckhzmwycq/node_modules/@mantine/core/esm/components/Tooltip/Tooltip.mjs";
import { ActionIcon } from "../../node_modules/.pnpm/@mantine_core@7.15.2_patch_hash_jclkxeaefn6uz54h34k3r3yjsq_@mantine_hooks@7.15.2_react@18.3.1_szqfuioo5damkjdixckhzmwycq/node_modules/@mantine/core/esm/components/ActionIcon/ActionIcon.mjs";
const FormCopyText = ({
  timeout = 3e3,
  value,
  valueProps,
  tooltipProps,
  size = 16,
  ...props
}) => {
  return /* @__PURE__ */ jsx(CopyButton, { value, timeout, children: ({ copied, copy }) => /* @__PURE__ */ jsxs(
    Box,
    {
      sx: mergeSxList([
        (theme) => ({
          display: "flex",
          alignItems: "center",
          paddingLeft: 12,
          paddingRight: 8,
          height: 40,
          borderRadius: theme.defaultRadius,
          backgroundColor: theme.colors.carbon[2],
          border: `1px solid ${theme.colors.carbon[5]}`
        }),
        props.sx
      ]),
      ...props,
      children: [
        /* @__PURE__ */ jsx(
          Typography,
          {
            variant: "body-lg",
            c: "carbon.8",
            sx: mergeSxList([
              () => ({
                flex: "1",
                whiteSpace: "nowrap",
                overflow: "hidden",
                textOverflow: "ellipsis",
                marginRight: 8
              }),
              valueProps == null ? void 0 : valueProps.sx
            ]),
            ...valueProps,
            children: value
          }
        ),
        /* @__PURE__ */ jsx(Tooltip, { label: copied ? "Copied" : "Copy", withArrow: true, ...tooltipProps, children: /* @__PURE__ */ jsx(ActionIcon, { "aria-label": "Copy", color: "carbon.8", variant: "transparent", onClick: copy, children: /* @__PURE__ */ jsx(
          IconCopy01,
          {
            size,
            onClick: () => {
              var _a;
              copy();
              (_a = props.onClick) == null ? void 0 : _a.call(props);
            }
          }
        ) }) })
      ]
    }
  ) });
};
export {
  FormCopyText
};
