@ultraviolet/ui 1.73.2 → 1.74.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -16,11 +16,15 @@ const CopyButton = ({
16
16
  bordered,
17
17
  className,
18
18
  children,
19
- "data-testid": dataTestId
19
+ "data-testid": dataTestId,
20
+ onCopy
20
21
  }) => {
21
22
  const [isCopied, setCopied] = useClipboard__default.default(value, {
22
23
  successDuration: COPY_DURATION
23
24
  });
24
- return /* @__PURE__ */ jsxRuntime.jsx(index.Button, { type: "button", onClick: setCopied, size, sentiment, variant: noBorder || !bordered ? "ghost" : "outlined", className, "data-testid": dataTestId, "aria-label": "Copy", icon: isCopied ? "check" : "copy-content", tooltip: isCopied ? copiedText : copyText, children });
25
+ return /* @__PURE__ */ jsxRuntime.jsx(index.Button, { type: "button", onClick: () => {
26
+ setCopied();
27
+ onCopy?.();
28
+ }, size, sentiment, variant: noBorder || !bordered ? "ghost" : "outlined", className, "data-testid": dataTestId, "aria-label": "Copy", icon: isCopied ? "check" : "copy-content", tooltip: isCopied ? copiedText : copyText, children });
25
29
  };
26
30
  exports.CopyButton = CopyButton;
@@ -12,9 +12,10 @@ type CopyButtonProps = {
12
12
  className?: string;
13
13
  'data-testid'?: string;
14
14
  children?: string;
15
+ onCopy?: () => void;
15
16
  };
16
17
  /**
17
18
  * CopyButton is a button that copies a given value to the clipboard.
18
19
  */
19
- export declare const CopyButton: ({ size, value, copyText, copiedText, sentiment, noBorder, bordered, className, children, "data-testid": dataTestId, }: CopyButtonProps) => import("@emotion/react/jsx-runtime").JSX.Element;
20
+ export declare const CopyButton: ({ size, value, copyText, copiedText, sentiment, noBorder, bordered, className, children, "data-testid": dataTestId, onCopy, }: CopyButtonProps) => import("@emotion/react/jsx-runtime").JSX.Element;
20
21
  export {};
@@ -12,12 +12,16 @@ const CopyButton = ({
12
12
  bordered,
13
13
  className,
14
14
  children,
15
- "data-testid": dataTestId
15
+ "data-testid": dataTestId,
16
+ onCopy
16
17
  }) => {
17
18
  const [isCopied, setCopied] = useClipboard(value, {
18
19
  successDuration: COPY_DURATION
19
20
  });
20
- return /* @__PURE__ */ jsx(Button, { type: "button", onClick: setCopied, size, sentiment, variant: noBorder || !bordered ? "ghost" : "outlined", className, "data-testid": dataTestId, "aria-label": "Copy", icon: isCopied ? "check" : "copy-content", tooltip: isCopied ? copiedText : copyText, children });
21
+ return /* @__PURE__ */ jsx(Button, { type: "button", onClick: () => {
22
+ setCopied();
23
+ onCopy?.();
24
+ }, size, sentiment, variant: noBorder || !bordered ? "ghost" : "outlined", className, "data-testid": dataTestId, "aria-label": "Copy", icon: isCopied ? "check" : "copy-content", tooltip: isCopied ? copiedText : copyText, children });
21
25
  };
22
26
  export {
23
27
  CopyButton