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

@contentful/f36-copybutton

Package Overview
Dependencies
Maintainers
159
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.30.2 to 4.30.3

6

dist/esm/index.js

@@ -1,2 +0,2 @@

import u, { useState, useCallback } from 'react';
import d, { useState, useCallback } from 'react';
import { CopyIcon } from '@contentful/f36-icons';

@@ -7,5 +7,5 @@ import { Tooltip } from '@contentful/f36-tooltip';

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

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

var u = require('react');
var d = require('react');
var f36Icons = require('@contentful/f36-icons');

@@ -14,7 +14,7 @@ var f36Tooltip = require('@contentful/f36-tooltip');

var u__default = /*#__PURE__*/_interopDefaultLegacy(u);
var d__default = /*#__PURE__*/_interopDefaultLegacy(d);
var S=Object.defineProperty,D=Object.defineProperties;var L=Object.getOwnPropertyDescriptors;var c=Object.getOwnPropertySymbols;var b=Object.prototype.hasOwnProperty,v=Object.prototype.propertyIsEnumerable;var P=(t,o,e)=>o in t?S(t,o,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[o]=e,f=(t,o)=>{for(var e in o||(o={}))b.call(o,e)&&P(t,e,o[e]);if(c)for(var e of c(o))v.call(o,e)&&P(t,e,o[e]);return t},C=(t,o)=>D(t,L(o));var g=(t,o)=>{var e={};for(var r in t)b.call(t,r)&&o.indexOf(r)<0&&(e[r]=t[r]);if(t!=null&&c)for(var r of c(t))o.indexOf(r)<0&&v.call(t,r)&&(e[r]=t[r]);return e};var h=(t,o,e)=>new Promise((r,i)=>{var p=n=>{try{s(e.next(n));}catch(a){i(a);}},l=n=>{try{s(e.throw(n));}catch(a){i(a);}},s=n=>n.done?r(n.value):Promise.resolve(n.value).then(p,l);s((e=e.apply(t,o)).next());});var T=({size:t})=>{let o=t==="small"?"32px":"40px";return {button:emotion.css({height:o,minHeight:"auto",minWidth:"auto",width:o})}};function E(q,k){var B=q,{className:t,isDisabled:o=!1,isLoading:e=!1,label:r,onBlur:i,onCopy:p,size:l="medium",testId:s="cf-ui-copy-button",tooltipCopiedText:n="Copied!",tooltipProps:a,tooltipText:H="Copy to clipboard",value:m}=B,w=g(B,["className","isDisabled","isLoading","label","onBlur","onCopy","size","testId","tooltipCopiedText","tooltipProps","tooltipText","value"]);let I=T({size:l}),[d,x]=u.useState(!1),M=u.useCallback(()=>h(this,null,function*(){try{yield window.navigator.clipboard.writeText(m);}catch(y){console.error(y);return}p==null||p(m),x(!0);}),[p,m]),z=y=>{d&&x(!1),i==null||i(y);};return u__default["default"].createElement(f36Tooltip.Tooltip,C(f({content:d?n:H},a),{isDisabled:o}),u__default["default"].createElement(f36Button.Button,C(f({"aria-label":d?"Value copied to clipboard":r!=null?r:"Copy to clipboard","aria-live":"assertive",className:emotion.cx(I.button,t),isDisabled:e||o,isLoading:e,onBlur:z,testId:s},w),{onClick:M,ref:k,startIcon:u__default["default"].createElement(f36Icons.CopyIcon,{variant:"muted",size:l==="small"?"tiny":"small"}),variant:"secondary"})))}E.displayName="CopyButton";var j=u__default["default"].forwardRef(E);
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);
exports.CopyButton = j;
exports.CopyButton = q;
//# sourceMappingURL=index.js.map
{
"name": "@contentful/f36-copybutton",
"version": "4.30.2",
"version": "4.30.3",
"description": "Forma 36: CopyButton component",

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

"dependencies": {
"@contentful/f36-button": "^4.30.2",
"@contentful/f36-core": "^4.30.2",
"@contentful/f36-button": "^4.30.3",
"@contentful/f36-core": "^4.30.3",
"@contentful/f36-icons": "^4.23.2",
"@contentful/f36-tokens": "^4.0.1",
"@contentful/f36-tooltip": "^4.30.2",
"@contentful/f36-tooltip": "^4.30.3",
"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

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