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

@contentful/f36-copybutton

Package Overview
Dependencies
Maintainers
151
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.25.1 to 4.25.2

4

dist/esm/index.js

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

import m, { useState, useCallback } from 'react';
import u, { 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,g=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))g.call(o,e)&&P(t,e,o[e]);return t},C=(t,o)=>D(t,L(o));var h=(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&&g.call(t,r)&&(e[r]=t[r]);return e};var T=(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 v=({size:t})=>{let o=t==="small"?"32px":"40px";return {button:css({height:o,minHeight:"auto",minWidth:"auto",width:o})}};function E(q,I){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:u}=B,w=h(B,["className","isDisabled","isLoading","label","onBlur","onCopy","size","testId","tooltipCopiedText","tooltipProps","tooltipText","value"]);let M=v({size:l}),[d,x]=useState(!1),k=useCallback(()=>T(this,null,function*(){try{yield window.navigator.clipboard.writeText(u);}catch(y){console.error(y);return}p==null||p(u),x(!0);}),[p,u]),z=y=>{d&&x(!1),i==null||i(y);};return m.createElement(Tooltip,C(f({content:d?n:H},a),{isDisabled:o}),m.createElement(Button,C(f({"aria-label":d?"Value copied to clipboard":r!=null?r:"Copy to clipboard","aria-live":"assertive",className:cx(M.button,t),isDisabled:e||o,isLoading:e,onBlur:z,testId:s},w),{onClick:k,ref:I,startIcon:m.createElement(CopyIcon,{variant:"muted",size:l==="small"?"tiny":"small"}),variant:"secondary"})))}E.displayName="CopyButton";var j=m.forwardRef(E);
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);
export { j as CopyButton };
//# sourceMappingURL=index.js.map

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

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

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

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

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

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

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

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

var m__default = /*#__PURE__*/_interopDefaultLegacy(m);
var u__default = /*#__PURE__*/_interopDefaultLegacy(u);
var S=Object.defineProperty,D=Object.defineProperties;var L=Object.getOwnPropertyDescriptors;var c=Object.getOwnPropertySymbols;var b=Object.prototype.hasOwnProperty,g=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))g.call(o,e)&&P(t,e,o[e]);return t},C=(t,o)=>D(t,L(o));var h=(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&&g.call(t,r)&&(e[r]=t[r]);return e};var T=(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 v=({size:t})=>{let o=t==="small"?"32px":"40px";return {button:emotion.css({height:o,minHeight:"auto",minWidth:"auto",width:o})}};function E(q,I){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:u}=B,w=h(B,["className","isDisabled","isLoading","label","onBlur","onCopy","size","testId","tooltipCopiedText","tooltipProps","tooltipText","value"]);let M=v({size:l}),[d,x]=m.useState(!1),k=m.useCallback(()=>T(this,null,function*(){try{yield window.navigator.clipboard.writeText(u);}catch(y){console.error(y);return}p==null||p(u),x(!0);}),[p,u]),z=y=>{d&&x(!1),i==null||i(y);};return m__default["default"].createElement(f36Tooltip.Tooltip,C(f({content:d?n:H},a),{isDisabled:o}),m__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(M.button,t),isDisabled:e||o,isLoading:e,onBlur:z,testId:s},w),{onClick:k,ref:I,startIcon:m__default["default"].createElement(f36Icons.CopyIcon,{variant:"muted",size:l==="small"?"tiny":"small"}),variant:"secondary"})))}E.displayName="CopyButton";var j=m__default["default"].forwardRef(E);
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);
exports.CopyButton = j;
//# sourceMappingURL=index.js.map
{
"name": "@contentful/f36-copybutton",
"version": "4.25.1",
"version": "4.25.2",
"description": "Forma 36: CopyButton component",

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

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