Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@contentful/f36-copybutton

Package Overview
Dependencies
Maintainers
175
Versions
344
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@contentful/f36-copybutton - npm Package Compare versions

Comparing version 4.54.5 to 4.55.0

2

dist/esm/index.js

@@ -7,3 +7,3 @@ import d, { useState, useCallback } from 'react';

var L=Object.defineProperty,F=Object.defineProperties;var N=Object.getOwnPropertyDescriptors;var m=Object.getOwnPropertySymbols;var h=Object.prototype.hasOwnProperty,E=Object.prototype.propertyIsEnumerable;var P=(t,o,e)=>o in t?L(t,o,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[o]=e,f=(t,o)=>{for(var e in o||(o={}))h.call(o,e)&&P(t,e,o[e]);if(m)for(var e of m(o))E.call(o,e)&&P(t,e,o[e]);return t},C=(t,o)=>F(t,N(o));var g=(t,o)=>{var e={};for(var n in t)h.call(t,n)&&o.indexOf(n)<0&&(e[n]=t[n]);if(t!=null&&m)for(var n of m(t))o.indexOf(n)<0&&E.call(t,n)&&(e[n]=t[n]);return e};var T=(t,o,e)=>new Promise((n,i)=>{var s=r=>{try{a(e.next(r));}catch(l){i(l);}},c=r=>{try{a(e.throw(r));}catch(l){i(l);}},a=r=>r.done?n(r.value):Promise.resolve(r.value).then(s,c);a((e=e.apply(t,o)).next());});var w=({size:t})=>{let o=t==="small"?"32px":"40px";return {button:css({height:o,minHeight:"auto",minWidth:"auto",width:o})}};function H(A,M){var B=A,{className:t,isDisabled:o=!1,isLoading:e=!1,label:n,onBlur:i,onCopy:s,size:c="medium",testId:a="cf-ui-copy-button",tooltipCopiedText:r="Copied!",tooltipProps:l,tooltipText:k="Copy to clipboard",value:u}=B,I=g(B,["className","isDisabled","isLoading","label","onBlur","onCopy","size","testId","tooltipCopiedText","tooltipProps","tooltipText","value"]);let z=w({size:c}),[y,x]=useState(!1),S=useCallback(()=>T(this,null,function*(){try{yield window.navigator.clipboard.writeText(u);}catch(b){let p=document.createElement("input");p.style.display="none",document.body.appendChild(p),p.value=u,p.focus(),p.select();let v=document.execCommand("copy");if(v==="unsuccessful")throw new Error("Unable to copy value",{cause:v});p.remove();return}s==null||s(u),x(!0);}),[s,u]),D=b=>{y&&x(!1),i==null||i(b);};return d.createElement(Tooltip,C(f({content:y?r:k},l),{isDisabled:o}),d.createElement(Button,C(f({"aria-label":y?"Value copied to clipboard":n!=null?n:"Copy to clipboard","aria-live":"assertive",className:cx(z.button,t),isDisabled:e||o,isLoading:e,onBlur:D,testId:a},I),{onClick:S,ref:M,startIcon:d.createElement(CopyIcon,{variant:"muted",size:c==="small"?"tiny":"small"}),variant:"secondary"})))}H.displayName="CopyButton";var q=d.forwardRef(H);
var L=Object.defineProperty,F=Object.defineProperties;var N=Object.getOwnPropertyDescriptors;var m=Object.getOwnPropertySymbols;var h=Object.prototype.hasOwnProperty,E=Object.prototype.propertyIsEnumerable;var v=(t,o,e)=>o in t?L(t,o,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[o]=e,f=(t,o)=>{for(var e in o||(o={}))h.call(o,e)&&v(t,e,o[e]);if(m)for(var e of m(o))E.call(o,e)&&v(t,e,o[e]);return t},C=(t,o)=>F(t,N(o));var g=(t,o)=>{var e={};for(var n in t)h.call(t,n)&&o.indexOf(n)<0&&(e[n]=t[n]);if(t!=null&&m)for(var n of m(t))o.indexOf(n)<0&&E.call(t,n)&&(e[n]=t[n]);return e};var T=(t,o,e)=>new Promise((n,i)=>{var p=r=>{try{a(e.next(r));}catch(l){i(l);}},c=r=>{try{a(e.throw(r));}catch(l){i(l);}},a=r=>r.done?n(r.value):Promise.resolve(r.value).then(p,c);a((e=e.apply(t,o)).next());});var w=({size:t})=>{let o=t==="small"?"32px":"40px";return {button:css({height:o,minHeight:"auto",minWidth:"auto",width:o})}};function H(A,z){var B=A,{className:t,isDisabled:o=!1,isLoading:e=!1,label:n,onBlur:i,onCopy:p,size:c="medium",testId:a="cf-ui-copy-button",tooltipCopiedText:r="Copied!",tooltipProps:l,tooltipText:k="Copy to clipboard",value:u}=B,M=g(B,["className","isDisabled","isLoading","label","onBlur","onCopy","size","testId","tooltipCopiedText","tooltipProps","tooltipText","value"]);let I=w({size:c}),[y,x]=useState(!1),S=useCallback(()=>T(this,null,function*(){try{yield window.navigator.clipboard.writeText(u);}catch(b){let s=document.createElement("input");s.style.display="none",document.body.appendChild(s),s.value=u,s.focus(),s.select();let P=document.execCommand("copy");if(P==="unsuccessful")throw new Error("Unable to copy value",{cause:P});s.remove();return}p==null||p(u),x(!0);}),[p,u]),D=b=>{y&&x(!1),i==null||i(b);};return d.createElement(Tooltip,C(f({content:y?r:k},l),{isDisabled:o}),d.createElement(Button,C(f({"aria-label":y?"Value copied to clipboard":n!=null?n:"Copy to clipboard","aria-live":"assertive",className:cx(I.button,t),isDisabled:e||o,isLoading:e,onBlur:D,testId:a,startIcon:d.createElement(CopyIcon,{variant:"muted",size:c==="small"?"tiny":"small"}),variant:"secondary"},M),{onClick:S,ref:z})))}H.displayName="CopyButton";var q=d.forwardRef(H);

@@ -10,0 +10,0 @@ export { q as CopyButton };

@@ -5,3 +5,3 @@ import React from 'react';

declare type CopyButtonProps = Omit<ButtonProps, 'children' | 'endIcon' | 'onCopy' | 'onClick' | 'startIcon' | 'isDisabled' | 'size' | 'value' | 'variant'> & {
declare type CopyButtonProps = Omit<ButtonProps, 'endIcon' | 'onCopy' | 'onClick' | 'isDisabled' | 'size' | 'value'> & {
/**

@@ -45,3 +45,3 @@ * Function that gets called when the button is clicked

};
declare const CopyButton: React.ForwardRefExoticComponent<Omit<ButtonProps<"button">, "children" | "variant" | "size" | "isDisabled" | "startIcon" | "endIcon" | "value" | "onCopy" | "onClick"> & {
declare const CopyButton: React.ForwardRefExoticComponent<Omit<ButtonProps<"button">, "size" | "isDisabled" | "endIcon" | "value" | "onCopy" | "onClick"> & {
/**

@@ -48,0 +48,0 @@ * Function that gets called when the button is clicked

@@ -13,3 +13,3 @@ 'use strict';

var L=Object.defineProperty,F=Object.defineProperties;var N=Object.getOwnPropertyDescriptors;var m=Object.getOwnPropertySymbols;var h=Object.prototype.hasOwnProperty,E=Object.prototype.propertyIsEnumerable;var P=(t,o,e)=>o in t?L(t,o,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[o]=e,f=(t,o)=>{for(var e in o||(o={}))h.call(o,e)&&P(t,e,o[e]);if(m)for(var e of m(o))E.call(o,e)&&P(t,e,o[e]);return t},C=(t,o)=>F(t,N(o));var g=(t,o)=>{var e={};for(var n in t)h.call(t,n)&&o.indexOf(n)<0&&(e[n]=t[n]);if(t!=null&&m)for(var n of m(t))o.indexOf(n)<0&&E.call(t,n)&&(e[n]=t[n]);return e};var T=(t,o,e)=>new Promise((n,i)=>{var s=r=>{try{a(e.next(r));}catch(l){i(l);}},c=r=>{try{a(e.throw(r));}catch(l){i(l);}},a=r=>r.done?n(r.value):Promise.resolve(r.value).then(s,c);a((e=e.apply(t,o)).next());});var w=({size:t})=>{let o=t==="small"?"32px":"40px";return {button:emotion.css({height:o,minHeight:"auto",minWidth:"auto",width:o})}};function H(A,M){var B=A,{className:t,isDisabled:o=!1,isLoading:e=!1,label:n,onBlur:i,onCopy:s,size:c="medium",testId:a="cf-ui-copy-button",tooltipCopiedText:r="Copied!",tooltipProps:l,tooltipText:k="Copy to clipboard",value:u}=B,I=g(B,["className","isDisabled","isLoading","label","onBlur","onCopy","size","testId","tooltipCopiedText","tooltipProps","tooltipText","value"]);let z=w({size:c}),[y,x]=d.useState(!1),S=d.useCallback(()=>T(this,null,function*(){try{yield window.navigator.clipboard.writeText(u);}catch(b){let p=document.createElement("input");p.style.display="none",document.body.appendChild(p),p.value=u,p.focus(),p.select();let v=document.execCommand("copy");if(v==="unsuccessful")throw new Error("Unable to copy value",{cause:v});p.remove();return}s==null||s(u),x(!0);}),[s,u]),D=b=>{y&&x(!1),i==null||i(b);};return d__default.default.createElement(f36Tooltip.Tooltip,C(f({content:y?r:k},l),{isDisabled:o}),d__default.default.createElement(f36Button.Button,C(f({"aria-label":y?"Value copied to clipboard":n!=null?n:"Copy to clipboard","aria-live":"assertive",className:emotion.cx(z.button,t),isDisabled:e||o,isLoading:e,onBlur:D,testId:a},I),{onClick:S,ref:M,startIcon:d__default.default.createElement(f36Icons.CopyIcon,{variant:"muted",size:c==="small"?"tiny":"small"}),variant:"secondary"})))}H.displayName="CopyButton";var q=d__default.default.forwardRef(H);
var L=Object.defineProperty,F=Object.defineProperties;var N=Object.getOwnPropertyDescriptors;var m=Object.getOwnPropertySymbols;var h=Object.prototype.hasOwnProperty,E=Object.prototype.propertyIsEnumerable;var v=(t,o,e)=>o in t?L(t,o,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[o]=e,f=(t,o)=>{for(var e in o||(o={}))h.call(o,e)&&v(t,e,o[e]);if(m)for(var e of m(o))E.call(o,e)&&v(t,e,o[e]);return t},C=(t,o)=>F(t,N(o));var g=(t,o)=>{var e={};for(var n in t)h.call(t,n)&&o.indexOf(n)<0&&(e[n]=t[n]);if(t!=null&&m)for(var n of m(t))o.indexOf(n)<0&&E.call(t,n)&&(e[n]=t[n]);return e};var T=(t,o,e)=>new Promise((n,i)=>{var p=r=>{try{a(e.next(r));}catch(l){i(l);}},c=r=>{try{a(e.throw(r));}catch(l){i(l);}},a=r=>r.done?n(r.value):Promise.resolve(r.value).then(p,c);a((e=e.apply(t,o)).next());});var w=({size:t})=>{let o=t==="small"?"32px":"40px";return {button:emotion.css({height:o,minHeight:"auto",minWidth:"auto",width:o})}};function H(A,z){var B=A,{className:t,isDisabled:o=!1,isLoading:e=!1,label:n,onBlur:i,onCopy:p,size:c="medium",testId:a="cf-ui-copy-button",tooltipCopiedText:r="Copied!",tooltipProps:l,tooltipText:k="Copy to clipboard",value:u}=B,M=g(B,["className","isDisabled","isLoading","label","onBlur","onCopy","size","testId","tooltipCopiedText","tooltipProps","tooltipText","value"]);let I=w({size:c}),[y,x]=d.useState(!1),S=d.useCallback(()=>T(this,null,function*(){try{yield window.navigator.clipboard.writeText(u);}catch(b){let s=document.createElement("input");s.style.display="none",document.body.appendChild(s),s.value=u,s.focus(),s.select();let P=document.execCommand("copy");if(P==="unsuccessful")throw new Error("Unable to copy value",{cause:P});s.remove();return}p==null||p(u),x(!0);}),[p,u]),D=b=>{y&&x(!1),i==null||i(b);};return d__default.default.createElement(f36Tooltip.Tooltip,C(f({content:y?r:k},l),{isDisabled:o}),d__default.default.createElement(f36Button.Button,C(f({"aria-label":y?"Value copied to clipboard":n!=null?n:"Copy to clipboard","aria-live":"assertive",className:emotion.cx(I.button,t),isDisabled:e||o,isLoading:e,onBlur:D,testId:a,startIcon:d__default.default.createElement(f36Icons.CopyIcon,{variant:"muted",size:c==="small"?"tiny":"small"}),variant:"secondary"},M),{onClick:S,ref:z})))}H.displayName="CopyButton";var q=d__default.default.forwardRef(H);

@@ -16,0 +16,0 @@ exports.CopyButton = q;

{
"name": "@contentful/f36-copybutton",
"version": "4.54.5",
"version": "4.55.0",
"description": "Forma 36: CopyButton component",

@@ -9,7 +9,7 @@ "scripts": {

"dependencies": {
"@contentful/f36-button": "^4.54.5",
"@contentful/f36-core": "^4.54.5",
"@contentful/f36-button": "^4.55.0",
"@contentful/f36-core": "^4.55.0",
"@contentful/f36-icons": "^4.27.0",
"@contentful/f36-tokens": "^4.0.2",
"@contentful/f36-tooltip": "^4.54.5",
"@contentful/f36-tooltip": "^4.55.0",
"emotion": "^10.0.17"

@@ -16,0 +16,0 @@ },

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc