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

@contentful/f36-copybutton

Package Overview
Dependencies
Maintainers
171
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.48.0 to 4.48.1

dist/index.d.mts

1

dist/esm/index.js

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

export { q as CopyButton };
//# sourceMappingURL=out.js.map
//# sourceMappingURL=index.js.map

9

dist/index.js
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var d = require('react');

@@ -11,9 +9,10 @@ var f36Icons = require('@contentful/f36-icons');

function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
var d__default = /*#__PURE__*/_interopDefaultLegacy(d);
var d__default = /*#__PURE__*/_interopDefault(d);
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 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 = q;
//# sourceMappingURL=out.js.map
//# sourceMappingURL=index.js.map
{
"name": "@contentful/f36-copybutton",
"version": "4.48.0",
"version": "4.48.1",
"description": "Forma 36: CopyButton component",

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

"dependencies": {
"@contentful/f36-button": "^4.48.0",
"@contentful/f36-core": "^4.48.0",
"@contentful/f36-button": "^4.48.1",
"@contentful/f36-core": "^4.48.1",
"@contentful/f36-icons": "^4.27.0",
"@contentful/f36-tokens": "^4.0.2",
"@contentful/f36-tooltip": "^4.48.0",
"@contentful/f36-tooltip": "^4.48.1",
"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