@cryptlex/web-components 6.6.56 → 6.6.57

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.
@@ -0,0 +1,7 @@
1
+ import { ReactNode } from 'react';
2
+ import { ButtonProps } from './button';
3
+ export type CopyButtonProps = Omit<ButtonProps, 'children' | 'ref' | 'active' | 'variant'> & {
4
+ label: ReactNode;
5
+ textToCopy: string | number | Record<string, unknown>;
6
+ };
7
+ export declare function CopyButton({ label, textToCopy, ...props }: CopyButtonProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,2 @@
1
+ "use client";import{jsxs as s,jsx as a}from"react/jsx-runtime";import{Button as p}from"./button.js";import{IcCopy as n}from"./icons.js";import{toast as r}from"./toast.js";import"class-variance-authority";import"react-aria-components";import"../utilities/theme.js";import"clsx";import"./loader.js";import"@icons-pack/react-simple-icons";import"react";import"react-dom";import"./alert.js";function x({label:i,textToCopy:t,...o}){return s(p,{...o,onPress:async()=>{if(t)try{const e=typeof t=="object"?JSON.stringify(t):String(t);await navigator.clipboard.writeText(e),r({title:"Copied to clipboard",variant:"success"})}catch{r({title:"Failed to copy to clipboard",variant:"destructive"})}},className:"gap-2",children:[a(n,{}),i]})}export{x as CopyButton};
2
+ //# sourceMappingURL=copy-button.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"copy-button.js","sources":["../../lib/components/copy-button.tsx"],"sourcesContent":["'use client';\n\nimport { type ReactNode } from 'react';\nimport { Button, type ButtonProps } from './button';\nimport { IcCopy } from './icons';\nimport { toast } from './toast';\n\nexport type CopyButtonProps = Omit<ButtonProps, 'children' | 'ref' | 'active' | 'variant'> & {\n label: ReactNode;\n textToCopy: string | number | Record<string, unknown>;\n};\n\nexport function CopyButton({ label, textToCopy, ...props }: CopyButtonProps) {\n const handlePress = async () => {\n if (!textToCopy) return;\n try {\n const text = typeof textToCopy === 'object' ? JSON.stringify(textToCopy) : String(textToCopy);\n await navigator.clipboard.writeText(text);\n toast({\n title: 'Copied to clipboard',\n variant: 'success',\n });\n } catch {\n toast({\n title: 'Failed to copy to clipboard',\n variant: 'destructive',\n });\n }\n };\n\n return (\n <Button {...props} onPress={handlePress} className=\"gap-2\">\n <IcCopy />\n {label}\n </Button>\n );\n}\n"],"names":["CopyButton","label","textToCopy","props","Button","text","toast","jsx","IcCopy"],"mappings":"mYAYO,SAASA,EAAW,CAAE,MAAAC,EAAO,WAAAC,EAAY,GAAGC,GAA0B,CAkBzE,SACKC,EAAA,CAAQ,GAAGD,EAAO,QAlBH,SAAY,CAC5B,GAAKD,EACL,GAAI,CACA,MAAMG,EAAO,OAAOH,GAAe,SAAW,KAAK,UAAUA,CAAU,EAAI,OAAOA,CAAU,EAC5F,MAAM,UAAU,UAAU,UAAUG,CAAI,EACxCC,EAAM,CACF,MAAO,sBACP,QAAS,SAAA,CACZ,CACL,MAAQ,CACJA,EAAM,CACF,MAAO,8BACP,QAAS,aAAA,CACZ,CACL,CACJ,EAG6C,UAAU,QAC/C,SAAA,CAAAC,EAACC,EAAA,EAAO,EACPP,CAAA,EACL,CAER"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cryptlex/web-components",
3
- "version": "6.6.56",
3
+ "version": "6.6.57",
4
4
  "description": "React component library for Cryptlex web applications",
5
5
  "author": "Cryptlex",
6
6
  "type": "module",